body_hash
stringlengths
64
64
body
stringlengths
23
109k
docstring
stringlengths
1
57k
path
stringlengths
4
198
name
stringlengths
1
115
repository_name
stringlengths
7
111
repository_stars
float64
0
191k
lang
stringclasses
1 value
body_without_docstring
stringlengths
14
108k
unified
stringlengths
45
133k
333589701f926b6dc1cefbf89ef07ecfad24e1907eb533046a7d819ad78368fd
def open(self) -> None: 'Open all listeners callbacks' self.__event_dispatcher.add_listener(event_id=DeviceRecordCreatedOrUpdatedEvent.EVENT_NAME, listener=self.__handle_create_or_update_device) self.__event_dispatcher.add_listener(event_id=DataPointRecordCreatedOrUpdatedEvent.EVENT_NAME, listener=self.__ha...
Open all listeners callbacks
fastybird_tuya_connector/events/listeners.py
open
FastyBird/tuya-connector
0
python
def open(self) -> None: self.__event_dispatcher.add_listener(event_id=DeviceRecordCreatedOrUpdatedEvent.EVENT_NAME, listener=self.__handle_create_or_update_device) self.__event_dispatcher.add_listener(event_id=DataPointRecordCreatedOrUpdatedEvent.EVENT_NAME, listener=self.__handle_create_or_update_data_poi...
def open(self) -> None: self.__event_dispatcher.add_listener(event_id=DeviceRecordCreatedOrUpdatedEvent.EVENT_NAME, listener=self.__handle_create_or_update_device) self.__event_dispatcher.add_listener(event_id=DataPointRecordCreatedOrUpdatedEvent.EVENT_NAME, listener=self.__handle_create_or_update_data_poi...
7ecfc47559339cda7e8a4adcc68007788605cf7f925003aa17fb8e7410b39969
def close(self) -> None: 'Close all listeners registrations' self.__event_dispatcher.remove_listener(event_id=DeviceRecordCreatedOrUpdatedEvent.EVENT_NAME, listener=self.__handle_create_or_update_device) self.__event_dispatcher.remove_listener(event_id=DataPointRecordCreatedOrUpdatedEvent.EVENT_NAME, listen...
Close all listeners registrations
fastybird_tuya_connector/events/listeners.py
close
FastyBird/tuya-connector
0
python
def close(self) -> None: self.__event_dispatcher.remove_listener(event_id=DeviceRecordCreatedOrUpdatedEvent.EVENT_NAME, listener=self.__handle_create_or_update_device) self.__event_dispatcher.remove_listener(event_id=DataPointRecordCreatedOrUpdatedEvent.EVENT_NAME, listener=self.__handle_create_or_update_d...
def close(self) -> None: self.__event_dispatcher.remove_listener(event_id=DeviceRecordCreatedOrUpdatedEvent.EVENT_NAME, listener=self.__handle_create_or_update_device) self.__event_dispatcher.remove_listener(event_id=DataPointRecordCreatedOrUpdatedEvent.EVENT_NAME, listener=self.__handle_create_or_update_d...
a0fc42ba827e83d96a95272d42c6911631974bde6345fd721a8572c237d926df
def test_process_route_keys(redis_mock, db_mock): 'Tests that a redis hash is parsed correctly to generate db rows and delete the redis key' routes = {'/v1/users/search?query=ray': '3', '/v1/tracks/trending?genre=rap&timeRange=week': '2', '/v1/playlists/hash': '1', '/tracks': '1'} key = 'API_METRICS:routes:...
Tests that a redis hash is parsed correctly to generate db rows and delete the redis key
discovery-provider/src/tasks/index_metrics_test.py
test_process_route_keys
atticwip/audius-protocol
429
python
def test_process_route_keys(redis_mock, db_mock): routes = {'/v1/users/search?query=ray': '3', '/v1/tracks/trending?genre=rap&timeRange=week': '2', '/v1/playlists/hash': '1', '/tracks': '1'} key = 'API_METRICS:routes:192.168.0.1:2020/08/06:19' ip = '192.168.0.1' redis_mock.hmset(key, routes) da...
def test_process_route_keys(redis_mock, db_mock): routes = {'/v1/users/search?query=ray': '3', '/v1/tracks/trending?genre=rap&timeRange=week': '2', '/v1/playlists/hash': '1', '/tracks': '1'} key = 'API_METRICS:routes:192.168.0.1:2020/08/06:19' ip = '192.168.0.1' redis_mock.hmset(key, routes) da...
5da5b3ce7366208a1ce5298b0f24894f41598be537c7aae3a21021aaab63d9eb
def test_process_app_name_keys(redis_mock, db_mock): 'Test that the app name redis hash is parsed correctly to generate db rows' app_names = {'audilous': '22', 'music_corp': '51'} key = 'API_METRICS:applications:192.168.0.1:2020/08/06:19' ip = '192.168.0.1' redis_mock.hmset(key, app_names) date ...
Test that the app name redis hash is parsed correctly to generate db rows
discovery-provider/src/tasks/index_metrics_test.py
test_process_app_name_keys
atticwip/audius-protocol
429
python
def test_process_app_name_keys(redis_mock, db_mock): app_names = {'audilous': '22', 'music_corp': '51'} key = 'API_METRICS:applications:192.168.0.1:2020/08/06:19' ip = '192.168.0.1' redis_mock.hmset(key, app_names) date = datetime.utcnow() with db_mock.scoped_session() as session: A...
def test_process_app_name_keys(redis_mock, db_mock): app_names = {'audilous': '22', 'music_corp': '51'} key = 'API_METRICS:applications:192.168.0.1:2020/08/06:19' ip = '192.168.0.1' redis_mock.hmset(key, app_names) date = datetime.utcnow() with db_mock.scoped_session() as session: A...
b8b6f4fe00721116b3ab7c76b5159a9fb335e71841fd8c9e90ef1af8feb9307e
def test_sweep_metrics(redis_mock, db_mock): 'Test that the app name redis hash is parsed correctly to generate db rows' app_names = {'music': '1'} date = datetime.utcnow().replace(minute=0, second=0, microsecond=0) before_date = (date + timedelta(hours=(- 1))) after_date = (date + timedelta(hours=1...
Test that the app name redis hash is parsed correctly to generate db rows
discovery-provider/src/tasks/index_metrics_test.py
test_sweep_metrics
atticwip/audius-protocol
429
python
def test_sweep_metrics(redis_mock, db_mock): app_names = {'music': '1'} date = datetime.utcnow().replace(minute=0, second=0, microsecond=0) before_date = (date + timedelta(hours=(- 1))) after_date = (date + timedelta(hours=1)) ip = '192.168.0.1' current = date.strftime(datetime_format) ...
def test_sweep_metrics(redis_mock, db_mock): app_names = {'music': '1'} date = datetime.utcnow().replace(minute=0, second=0, microsecond=0) before_date = (date + timedelta(hours=(- 1))) after_date = (date + timedelta(hours=1)) ip = '192.168.0.1' current = date.strftime(datetime_format) ...
602a615febab5e61133168097dbc4baf34a181365f02417a0aed70562ff79a6b
def _FixPossibleAdbInstability(): 'Host side workaround for crbug.com/268450 (adb instability).\n\n The adb server has a race which is mitigated by binding to a single core.\n ' if (not psutil): return for process in psutil.process_iter(): try: if (psutil.version_info >= (2, 0)...
Host side workaround for crbug.com/268450 (adb instability). The adb server has a race which is mitigated by binding to a single core.
telemetry/telemetry/internal/platform/android_platform_backend.py
_FixPossibleAdbInstability
atuchin-m/catapult
1,894
python
def _FixPossibleAdbInstability(): 'Host side workaround for crbug.com/268450 (adb instability).\n\n The adb server has a race which is mitigated by binding to a single core.\n ' if (not psutil): return for process in psutil.process_iter(): try: if (psutil.version_info >= (2, 0)...
def _FixPossibleAdbInstability(): 'Host side workaround for crbug.com/268450 (adb instability).\n\n The adb server has a race which is mitigated by binding to a single core.\n ' if (not psutil): return for process in psutil.process_iter(): try: if (psutil.version_info >= (2, 0)...
20957245409c5482acfb968f38087b47e6b497eb138b3cecd0ffa7cf0a293154
def GetSharedPrefs(self, package, filename, use_encrypted_path=False): 'Creates a Devil SharedPrefs instance.\n\n See devil.android.sdk.shared_prefs for the documentation of the returned\n object.\n\n Args:\n package: A string containing the package of the app that the SharedPrefs\n instance ...
Creates a Devil SharedPrefs instance. See devil.android.sdk.shared_prefs for the documentation of the returned object. Args: package: A string containing the package of the app that the SharedPrefs instance will be for. filename: A string containing the specific settings file of the app that the Share...
telemetry/telemetry/internal/platform/android_platform_backend.py
GetSharedPrefs
atuchin-m/catapult
1,894
python
def GetSharedPrefs(self, package, filename, use_encrypted_path=False): 'Creates a Devil SharedPrefs instance.\n\n See devil.android.sdk.shared_prefs for the documentation of the returned\n object.\n\n Args:\n package: A string containing the package of the app that the SharedPrefs\n instance ...
def GetSharedPrefs(self, package, filename, use_encrypted_path=False): 'Creates a Devil SharedPrefs instance.\n\n See devil.android.sdk.shared_prefs for the documentation of the returned\n object.\n\n Args:\n package: A string containing the package of the app that the SharedPrefs\n instance ...
9e559177f08d0689ad04bb9147368b9d6d344f282d6e0aad78ca9c514b24e555
def GetDeviceHostClockOffset(self): 'Returns the difference between the device and host clocks.' if (self._device_host_clock_offset is None): device_time = self.device.RunShellCommand(['date', '+%s'], single_line=True) host_time = time.time() self._device_host_clock_offset = int((int(dev...
Returns the difference between the device and host clocks.
telemetry/telemetry/internal/platform/android_platform_backend.py
GetDeviceHostClockOffset
atuchin-m/catapult
1,894
python
def GetDeviceHostClockOffset(self): if (self._device_host_clock_offset is None): device_time = self.device.RunShellCommand(['date', '+%s'], single_line=True) host_time = time.time() self._device_host_clock_offset = int((int(device_time.strip()) - host_time)) return self._device_host...
def GetDeviceHostClockOffset(self): if (self._device_host_clock_offset is None): device_time = self.device.RunShellCommand(['date', '+%s'], single_line=True) host_time = time.time() self._device_host_clock_offset = int((int(device_time.strip()) - host_time)) return self._device_host...
46cdada346ea348dfb27d7c21a80432e32cd970f5decf768ddbb34758cdd95e2
def StopApplication(self, application): 'Stop the given |application|.\n\n Args:\n application: The full package name string of the application to stop.\n ' self._device.ForceStop(application)
Stop the given |application|. Args: application: The full package name string of the application to stop.
telemetry/telemetry/internal/platform/android_platform_backend.py
StopApplication
atuchin-m/catapult
1,894
python
def StopApplication(self, application): 'Stop the given |application|.\n\n Args:\n application: The full package name string of the application to stop.\n ' self._device.ForceStop(application)
def StopApplication(self, application): 'Stop the given |application|.\n\n Args:\n application: The full package name string of the application to stop.\n ' self._device.ForceStop(application)<|docstring|>Stop the given |application|. Args: application: The full package name string of the applic...
d8f3dea3e3465de339373aa00d83c42469897c864f3f4d70dc03416c2fb6a463
def KillApplication(self, application): 'Kill the given |application|.\n\n Might be used instead of ForceStop for efficiency reasons.\n\n Args:\n application: The full package name string of the application to kill.\n ' assert isinstance(application, six.string_types) self._device.KillAll(appl...
Kill the given |application|. Might be used instead of ForceStop for efficiency reasons. Args: application: The full package name string of the application to kill.
telemetry/telemetry/internal/platform/android_platform_backend.py
KillApplication
atuchin-m/catapult
1,894
python
def KillApplication(self, application): 'Kill the given |application|.\n\n Might be used instead of ForceStop for efficiency reasons.\n\n Args:\n application: The full package name string of the application to kill.\n ' assert isinstance(application, six.string_types) self._device.KillAll(appl...
def KillApplication(self, application): 'Kill the given |application|.\n\n Might be used instead of ForceStop for efficiency reasons.\n\n Args:\n application: The full package name string of the application to kill.\n ' assert isinstance(application, six.string_types) self._device.KillAll(appl...
1ec9eb14b9de8b34e694b9cdfe19dd92abd609572e40a6043c89ae999ac5d366
def LaunchApplication(self, application, parameters=None, elevate_privilege=False): 'Launches the given |application| with a list of |parameters| on the OS.\n\n Args:\n application: The full package name string of the application to launch.\n parameters: A list of parameters to be passed to the Activit...
Launches the given |application| with a list of |parameters| on the OS. Args: application: The full package name string of the application to launch. parameters: A list of parameters to be passed to the ActivityManager. elevate_privilege: Currently unimplemented on Android.
telemetry/telemetry/internal/platform/android_platform_backend.py
LaunchApplication
atuchin-m/catapult
1,894
python
def LaunchApplication(self, application, parameters=None, elevate_privilege=False): 'Launches the given |application| with a list of |parameters| on the OS.\n\n Args:\n application: The full package name string of the application to launch.\n parameters: A list of parameters to be passed to the Activit...
def LaunchApplication(self, application, parameters=None, elevate_privilege=False): 'Launches the given |application| with a list of |parameters| on the OS.\n\n Args:\n application: The full package name string of the application to launch.\n parameters: A list of parameters to be passed to the Activit...
95dfa4f1adece1bb990321300972cb6c3d86a44b1faeedc5d25538ba9922106a
def StartActivity(self, intent, blocking): 'Starts an activity for the given intent on the device.' self._device.StartActivity(intent, blocking=blocking)
Starts an activity for the given intent on the device.
telemetry/telemetry/internal/platform/android_platform_backend.py
StartActivity
atuchin-m/catapult
1,894
python
def StartActivity(self, intent, blocking): self._device.StartActivity(intent, blocking=blocking)
def StartActivity(self, intent, blocking): self._device.StartActivity(intent, blocking=blocking)<|docstring|>Starts an activity for the given intent on the device.<|endoftext|>
22ef330cc7f7a0dba08db389ca01ffb1e7c2d89c5943830d695fff00e03bf35f
def PathExists(self, device_path, **kwargs): ' Return whether the given path exists on the device.\n This method is the same as\n devil.android.device_utils.DeviceUtils.PathExists.\n ' return self._device.PathExists(device_path, **kwargs)
Return whether the given path exists on the device. This method is the same as devil.android.device_utils.DeviceUtils.PathExists.
telemetry/telemetry/internal/platform/android_platform_backend.py
PathExists
atuchin-m/catapult
1,894
python
def PathExists(self, device_path, **kwargs): ' Return whether the given path exists on the device.\n This method is the same as\n devil.android.device_utils.DeviceUtils.PathExists.\n ' return self._device.PathExists(device_path, **kwargs)
def PathExists(self, device_path, **kwargs): ' Return whether the given path exists on the device.\n This method is the same as\n devil.android.device_utils.DeviceUtils.PathExists.\n ' return self._device.PathExists(device_path, **kwargs)<|docstring|>Return whether the given path exists on the device. ...
455bfb58c9cd19fcb852390410133d2209622f78c9b9776c490afd55f7a363eb
def DismissCrashDialogIfNeeded(self): 'Dismiss any error dialogs.\n\n Limit the number in case we have an error loop or we are failing to dismiss.\n ' for _ in range(10): if (not self._device.DismissCrashDialogIfNeeded()): break
Dismiss any error dialogs. Limit the number in case we have an error loop or we are failing to dismiss.
telemetry/telemetry/internal/platform/android_platform_backend.py
DismissCrashDialogIfNeeded
atuchin-m/catapult
1,894
python
def DismissCrashDialogIfNeeded(self): 'Dismiss any error dialogs.\n\n Limit the number in case we have an error loop or we are failing to dismiss.\n ' for _ in range(10): if (not self._device.DismissCrashDialogIfNeeded()): break
def DismissCrashDialogIfNeeded(self): 'Dismiss any error dialogs.\n\n Limit the number in case we have an error loop or we are failing to dismiss.\n ' for _ in range(10): if (not self._device.DismissCrashDialogIfNeeded()): break<|docstring|>Dismiss any error dialogs. Limit the number ...
66a664294090d65157dd2eb9d961f0b3c8af061632786ed1f7be0cf368eba619
def PushProfile(self, package, new_profile_dir): "Replace application profile with files found on host machine.\n\n Pushing the profile is slow, so we don't want to do it every time.\n Avoid this by pushing to a safe location using PushChangedFiles, and\n then copying into the correct location on each test...
Replace application profile with files found on host machine. Pushing the profile is slow, so we don't want to do it every time. Avoid this by pushing to a safe location using PushChangedFiles, and then copying into the correct location on each test run. Args: package: The full package name string of the applicatio...
telemetry/telemetry/internal/platform/android_platform_backend.py
PushProfile
atuchin-m/catapult
1,894
python
def PushProfile(self, package, new_profile_dir): "Replace application profile with files found on host machine.\n\n Pushing the profile is slow, so we don't want to do it every time.\n Avoid this by pushing to a safe location using PushChangedFiles, and\n then copying into the correct location on each test...
def PushProfile(self, package, new_profile_dir): "Replace application profile with files found on host machine.\n\n Pushing the profile is slow, so we don't want to do it every time.\n Avoid this by pushing to a safe location using PushChangedFiles, and\n then copying into the correct location on each test...
359a3caafd2b646c7c33dc3d7219c971d2104b444de25637ea8dc2e36b67af8c
def RemoveProfile(self, package, ignore_list): 'Delete application profile on device.\n\n Args:\n package: The full package name string of the application for which the\n profile is to be deleted.\n ignore_list: List of files to keep.\n ' profile_dir = self.GetProfileDir(package) if (...
Delete application profile on device. Args: package: The full package name string of the application for which the profile is to be deleted. ignore_list: List of files to keep.
telemetry/telemetry/internal/platform/android_platform_backend.py
RemoveProfile
atuchin-m/catapult
1,894
python
def RemoveProfile(self, package, ignore_list): 'Delete application profile on device.\n\n Args:\n package: The full package name string of the application for which the\n profile is to be deleted.\n ignore_list: List of files to keep.\n ' profile_dir = self.GetProfileDir(package) if (...
def RemoveProfile(self, package, ignore_list): 'Delete application profile on device.\n\n Args:\n package: The full package name string of the application for which the\n profile is to be deleted.\n ignore_list: List of files to keep.\n ' profile_dir = self.GetProfileDir(package) if (...
36ae930f7a020e3f4132d02a295a53bc7d382ba262e9dafad5caf0b4da27e90e
def GetProfileDir(self, package): 'Returns the on-device location where the application profile is stored\n based on Android convention.\n\n Args:\n package: The full package name string of the application.\n ' if self._require_root: return ('/data/data/%s/' % package) return ('/data/l...
Returns the on-device location where the application profile is stored based on Android convention. Args: package: The full package name string of the application.
telemetry/telemetry/internal/platform/android_platform_backend.py
GetProfileDir
atuchin-m/catapult
1,894
python
def GetProfileDir(self, package): 'Returns the on-device location where the application profile is stored\n based on Android convention.\n\n Args:\n package: The full package name string of the application.\n ' if self._require_root: return ('/data/data/%s/' % package) return ('/data/l...
def GetProfileDir(self, package): 'Returns the on-device location where the application profile is stored\n based on Android convention.\n\n Args:\n package: The full package name string of the application.\n ' if self._require_root: return ('/data/data/%s/' % package) return ('/data/l...
48168c716b2821b6510ce94a1d84910634bcc0e9ddce43ce4171ea767edd52ec
def GetDumpLocation(self, package): 'Returns the location where crash dumps should be written to.\n\n Args:\n package: A string containing the package name of the application that the\n dump location is for.\n ' return (self.GetProfileDir(package) + 'dumps')
Returns the location where crash dumps should be written to. Args: package: A string containing the package name of the application that the dump location is for.
telemetry/telemetry/internal/platform/android_platform_backend.py
GetDumpLocation
atuchin-m/catapult
1,894
python
def GetDumpLocation(self, package): 'Returns the location where crash dumps should be written to.\n\n Args:\n package: A string containing the package name of the application that the\n dump location is for.\n ' return (self.GetProfileDir(package) + 'dumps')
def GetDumpLocation(self, package): 'Returns the location where crash dumps should be written to.\n\n Args:\n package: A string containing the package name of the application that the\n dump location is for.\n ' return (self.GetProfileDir(package) + 'dumps')<|docstring|>Returns the location ...
4520b26989a44e88ee98329becf4e0f83e8c34d5728aa1bc02393eae3e86c54d
def SetDebugApp(self, package): 'Set application to debugging.\n\n Args:\n package: The full package name string of the application.\n ' if self._device.IsUserBuild(): logging.debug('User build device, setting debug app') self._device.RunShellCommand(['am', 'set-debug-app', '--persist...
Set application to debugging. Args: package: The full package name string of the application.
telemetry/telemetry/internal/platform/android_platform_backend.py
SetDebugApp
atuchin-m/catapult
1,894
python
def SetDebugApp(self, package): 'Set application to debugging.\n\n Args:\n package: The full package name string of the application.\n ' if self._device.IsUserBuild(): logging.debug('User build device, setting debug app') self._device.RunShellCommand(['am', 'set-debug-app', '--persist...
def SetDebugApp(self, package): 'Set application to debugging.\n\n Args:\n package: The full package name string of the application.\n ' if self._device.IsUserBuild(): logging.debug('User build device, setting debug app') self._device.RunShellCommand(['am', 'set-debug-app', '--persist...
46c7f161bd6038f7296461bfacb4cc22f9342cad2dbdb211f1c0f293338090ee
def GetLogCat(self, number_of_lines=1500): 'Returns most recent lines of logcat dump.\n\n Args:\n number_of_lines: Number of lines of log to return.\n ' def decode_line(line): try: if six.PY2: uline = six.text_type(line, encoding='utf-8') return ul...
Returns most recent lines of logcat dump. Args: number_of_lines: Number of lines of log to return.
telemetry/telemetry/internal/platform/android_platform_backend.py
GetLogCat
atuchin-m/catapult
1,894
python
def GetLogCat(self, number_of_lines=1500): 'Returns most recent lines of logcat dump.\n\n Args:\n number_of_lines: Number of lines of log to return.\n ' def decode_line(line): try: if six.PY2: uline = six.text_type(line, encoding='utf-8') return ul...
def GetLogCat(self, number_of_lines=1500): 'Returns most recent lines of logcat dump.\n\n Args:\n number_of_lines: Number of lines of log to return.\n ' def decode_line(line): try: if six.PY2: uline = six.text_type(line, encoding='utf-8') return ul...
ef0a992b1629e58ae037c40800e559487a604939eed377a5799a458b04fb0df8
def SymbolizeLogCat(self, logcat): 'Attempts to symbolize any crash stacks in the given logcat data.\n\n Args:\n logcat: A string containing the logcat data to be symbolized.\n\n Returns:\n A string containing the symbolized logcat data, or None if the symbolize\n script was not found.\n ' ...
Attempts to symbolize any crash stacks in the given logcat data. Args: logcat: A string containing the logcat data to be symbolized. Returns: A string containing the symbolized logcat data, or None if the symbolize script was not found.
telemetry/telemetry/internal/platform/android_platform_backend.py
SymbolizeLogCat
atuchin-m/catapult
1,894
python
def SymbolizeLogCat(self, logcat): 'Attempts to symbolize any crash stacks in the given logcat data.\n\n Args:\n logcat: A string containing the logcat data to be symbolized.\n\n Returns:\n A string containing the symbolized logcat data, or None if the symbolize\n script was not found.\n ' ...
def SymbolizeLogCat(self, logcat): 'Attempts to symbolize any crash stacks in the given logcat data.\n\n Args:\n logcat: A string containing the logcat data to be symbolized.\n\n Returns:\n A string containing the symbolized logcat data, or None if the symbolize\n script was not found.\n ' ...
baab0860bb9561616f48bd18830af2bb80a8124762a261c5ba65902f2690cbd5
def GetTombstones(self): 'Attempts to get any tombstones currently on the device.\n\n Returns:\n A string containing any tombstones found on the device, or None if the\n tombstones script was not found or failed.\n ' tombstones = os.path.join(util.GetChromiumSrcDir(), 'build', 'android', 'tombst...
Attempts to get any tombstones currently on the device. Returns: A string containing any tombstones found on the device, or None if the tombstones script was not found or failed.
telemetry/telemetry/internal/platform/android_platform_backend.py
GetTombstones
atuchin-m/catapult
1,894
python
def GetTombstones(self): 'Attempts to get any tombstones currently on the device.\n\n Returns:\n A string containing any tombstones found on the device, or None if the\n tombstones script was not found or failed.\n ' tombstones = os.path.join(util.GetChromiumSrcDir(), 'build', 'android', 'tombst...
def GetTombstones(self): 'Attempts to get any tombstones currently on the device.\n\n Returns:\n A string containing any tombstones found on the device, or None if the\n tombstones script was not found or failed.\n ' tombstones = os.path.join(util.GetChromiumSrcDir(), 'build', 'android', 'tombst...
75613a25784b6f370cf2e17f84f9de5420c85448084606ab6cd523c2386c99be
def IsScreenOn(self): 'Determines if device screen is on.' return self._device.IsScreenOn()
Determines if device screen is on.
telemetry/telemetry/internal/platform/android_platform_backend.py
IsScreenOn
atuchin-m/catapult
1,894
python
def IsScreenOn(self): return self._device.IsScreenOn()
def IsScreenOn(self): return self._device.IsScreenOn()<|docstring|>Determines if device screen is on.<|endoftext|>
eb46fdeca83ec1481db7468497e20a52e11bf2f1d3a361f5a5e3b54e8657b38f
@staticmethod def _IsScreenLocked(input_methods): 'Parser method for IsScreenLocked()\n\n Args:\n input_methods: Output from dumpsys input_methods\n\n Returns:\n boolean: True if screen is locked, false if screen is not locked.\n\n Raises:\n ValueError: An unknown value is found for the scre...
Parser method for IsScreenLocked() Args: input_methods: Output from dumpsys input_methods Returns: boolean: True if screen is locked, false if screen is not locked. Raises: ValueError: An unknown value is found for the screen lock state. AndroidDeviceParsingError: Error in detecting screen state.
telemetry/telemetry/internal/platform/android_platform_backend.py
_IsScreenLocked
atuchin-m/catapult
1,894
python
@staticmethod def _IsScreenLocked(input_methods): 'Parser method for IsScreenLocked()\n\n Args:\n input_methods: Output from dumpsys input_methods\n\n Returns:\n boolean: True if screen is locked, false if screen is not locked.\n\n Raises:\n ValueError: An unknown value is found for the scre...
@staticmethod def _IsScreenLocked(input_methods): 'Parser method for IsScreenLocked()\n\n Args:\n input_methods: Output from dumpsys input_methods\n\n Returns:\n boolean: True if screen is locked, false if screen is not locked.\n\n Raises:\n ValueError: An unknown value is found for the scre...
5af95162b8b9c9fbf94f8a354a54e5b4f2511390e6ea93a9be4511a87d14ae9d
def IsScreenLocked(self): 'Determines if device screen is locked.' input_methods = self._device.RunShellCommand(['dumpsys', 'input_method'], check_return=True) return self._IsScreenLocked(input_methods)
Determines if device screen is locked.
telemetry/telemetry/internal/platform/android_platform_backend.py
IsScreenLocked
atuchin-m/catapult
1,894
python
def IsScreenLocked(self): input_methods = self._device.RunShellCommand(['dumpsys', 'input_method'], check_return=True) return self._IsScreenLocked(input_methods)
def IsScreenLocked(self): input_methods = self._device.RunShellCommand(['dumpsys', 'input_method'], check_return=True) return self._IsScreenLocked(input_methods)<|docstring|>Determines if device screen is locked.<|endoftext|>
2698f14e3cf3026711c5a54d2ef2654c837ca2e223507ebf53d5d5d7df760b45
def Log(self, message): 'Prints line to logcat.' TELEMETRY_LOGCAT_TAG = 'Telemetry' self._device.RunShellCommand(['log', '-p', 'i', '-t', TELEMETRY_LOGCAT_TAG, message], check_return=True)
Prints line to logcat.
telemetry/telemetry/internal/platform/android_platform_backend.py
Log
atuchin-m/catapult
1,894
python
def Log(self, message): TELEMETRY_LOGCAT_TAG = 'Telemetry' self._device.RunShellCommand(['log', '-p', 'i', '-t', TELEMETRY_LOGCAT_TAG, message], check_return=True)
def Log(self, message): TELEMETRY_LOGCAT_TAG = 'Telemetry' self._device.RunShellCommand(['log', '-p', 'i', '-t', TELEMETRY_LOGCAT_TAG, message], check_return=True)<|docstring|>Prints line to logcat.<|endoftext|>
3809c3d658309975a49f3725d0c1d959ba24e60675d2c5fc890853acbfa2f981
def get_random_slug(): 'Return a 20 character long random string' return ''.join(str(uuid.uuid4()).split('-')[:(- 1)])
Return a 20 character long random string
src/olympia/addons/models.py
get_random_slug
thefreakingmind12/addons-server
2
python
def get_random_slug(): return .join(str(uuid.uuid4()).split('-')[:(- 1)])
def get_random_slug(): return .join(str(uuid.uuid4()).split('-')[:(- 1)])<|docstring|>Return a 20 character long random string<|endoftext|>
db4677735405a68646734048edbfe39fa94064fe50761b11486d9e21abc8e51a
def clean_slug(instance, slug_field='slug'): 'Cleans a model instance slug.\n\n This strives to be as generic as possible but is only used\n by Add-ons at the moment.\n\n :param instance: The instance to clean the slug for.\n :param slug_field: The field where to get the currently set slug from.\n ' ...
Cleans a model instance slug. This strives to be as generic as possible but is only used by Add-ons at the moment. :param instance: The instance to clean the slug for. :param slug_field: The field where to get the currently set slug from.
src/olympia/addons/models.py
clean_slug
thefreakingmind12/addons-server
2
python
def clean_slug(instance, slug_field='slug'): 'Cleans a model instance slug.\n\n This strives to be as generic as possible but is only used\n by Add-ons at the moment.\n\n :param instance: The instance to clean the slug for.\n :param slug_field: The field where to get the currently set slug from.\n ' ...
def clean_slug(instance, slug_field='slug'): 'Cleans a model instance slug.\n\n This strives to be as generic as possible but is only used\n by Add-ons at the moment.\n\n :param instance: The instance to clean the slug for.\n :param slug_field: The field where to get the currently set slug from.\n ' ...
6ac8721c6f1180e99d4cae7ddd6174e16c5abd1538dddf81904edbb9c7eb0f7d
@Addon.on_change def watch_status(old_attr=None, new_attr=None, instance=None, sender=None, **kwargs): '\n Set nomination date if the addon is new in queue or updating.\n\n The nomination date cannot be reset, say, when a developer cancels\n their request for review and re-requests review.\n\n If a vers...
Set nomination date if the addon is new in queue or updating. The nomination date cannot be reset, say, when a developer cancels their request for review and re-requests review. If a version is rejected after nomination, the developer has to upload a new version.
src/olympia/addons/models.py
watch_status
thefreakingmind12/addons-server
2
python
@Addon.on_change def watch_status(old_attr=None, new_attr=None, instance=None, sender=None, **kwargs): '\n Set nomination date if the addon is new in queue or updating.\n\n The nomination date cannot be reset, say, when a developer cancels\n their request for review and re-requests review.\n\n If a vers...
@Addon.on_change def watch_status(old_attr=None, new_attr=None, instance=None, sender=None, **kwargs): '\n Set nomination date if the addon is new in queue or updating.\n\n The nomination date cannot be reset, say, when a developer cancels\n their request for review and re-requests review.\n\n If a vers...
6de2679ba2fb4ed1c134bb86306b1c1e12a6695f966c28fc55ac7741de10a1f6
def attach_translations(addons): 'Put all translations into a translations dict.' attach_trans_dict(Addon, addons)
Put all translations into a translations dict.
src/olympia/addons/models.py
attach_translations
thefreakingmind12/addons-server
2
python
def attach_translations(addons): attach_trans_dict(Addon, addons)
def attach_translations(addons): attach_trans_dict(Addon, addons)<|docstring|>Put all translations into a translations dict.<|endoftext|>
18f64f99e6420cb3dd8b7f07da688740166db85991822b1ed197009ddd633171
def id_or_slug(self, val): 'Get add-ons by id or slug.' if (isinstance(val, basestring) and (not val.isdigit())): return self.filter(slug=val) return self.filter(id=val)
Get add-ons by id or slug.
src/olympia/addons/models.py
id_or_slug
thefreakingmind12/addons-server
2
python
def id_or_slug(self, val): if (isinstance(val, basestring) and (not val.isdigit())): return self.filter(slug=val) return self.filter(id=val)
def id_or_slug(self, val): if (isinstance(val, basestring) and (not val.isdigit())): return self.filter(slug=val) return self.filter(id=val)<|docstring|>Get add-ons by id or slug.<|endoftext|>
39ff879e8b1b7ee21689f556cf50bd735583f41a901bd7853fee77e0a28924c8
def enabled(self): "Get add-ons that haven't been disabled by their developer(s)." return self.filter(disabled_by_user=False)
Get add-ons that haven't been disabled by their developer(s).
src/olympia/addons/models.py
enabled
thefreakingmind12/addons-server
2
python
def enabled(self): return self.filter(disabled_by_user=False)
def enabled(self): return self.filter(disabled_by_user=False)<|docstring|>Get add-ons that haven't been disabled by their developer(s).<|endoftext|>
195b6abb5831bf3f4753f546efd64fb57d70d21a0124c50ed13b87bbe35a86dd
def public(self): 'Get public add-ons only' return self.filter(self.valid_q([amo.STATUS_PUBLIC]))
Get public add-ons only
src/olympia/addons/models.py
public
thefreakingmind12/addons-server
2
python
def public(self): return self.filter(self.valid_q([amo.STATUS_PUBLIC]))
def public(self): return self.filter(self.valid_q([amo.STATUS_PUBLIC]))<|docstring|>Get public add-ons only<|endoftext|>
5c19f8879a8924a0168b0e59e6e6bd40eb5cda70fe7a6d312287003d205bd6a2
def valid(self): 'Get valid, enabled add-ons only' return self.filter(self.valid_q(amo.VALID_ADDON_STATUSES))
Get valid, enabled add-ons only
src/olympia/addons/models.py
valid
thefreakingmind12/addons-server
2
python
def valid(self): return self.filter(self.valid_q(amo.VALID_ADDON_STATUSES))
def valid(self): return self.filter(self.valid_q(amo.VALID_ADDON_STATUSES))<|docstring|>Get valid, enabled add-ons only<|endoftext|>
fcc3f60e584bf275aad87ce215ce93b6ceeccc4527ce3cd8e1a3f231c0e95552
def valid_and_disabled_and_pending(self): '\n Get valid, pending, enabled and disabled add-ons.\n Used to allow pending theme pages to still be viewed.\n ' statuses = (list(amo.VALID_ADDON_STATUSES) + [amo.STATUS_DISABLED, amo.STATUS_PENDING]) return self.filter((Q(status__in=statuses) ...
Get valid, pending, enabled and disabled add-ons. Used to allow pending theme pages to still be viewed.
src/olympia/addons/models.py
valid_and_disabled_and_pending
thefreakingmind12/addons-server
2
python
def valid_and_disabled_and_pending(self): '\n Get valid, pending, enabled and disabled add-ons.\n Used to allow pending theme pages to still be viewed.\n ' statuses = (list(amo.VALID_ADDON_STATUSES) + [amo.STATUS_DISABLED, amo.STATUS_PENDING]) return self.filter((Q(status__in=statuses) ...
def valid_and_disabled_and_pending(self): '\n Get valid, pending, enabled and disabled add-ons.\n Used to allow pending theme pages to still be viewed.\n ' statuses = (list(amo.VALID_ADDON_STATUSES) + [amo.STATUS_DISABLED, amo.STATUS_PENDING]) return self.filter((Q(status__in=statuses) ...
245e5cdec860c0a814fe7984142028f50a52ba1bf3de91126bc5bc2056c7bccd
def featured(self, app, lang=None, type=None): '\n Filter for all featured add-ons for an application in all locales.\n ' ids = get_featured_ids(app, lang, type) return manual_order(self.listed(app), ids, 'addons.id')
Filter for all featured add-ons for an application in all locales.
src/olympia/addons/models.py
featured
thefreakingmind12/addons-server
2
python
def featured(self, app, lang=None, type=None): '\n \n ' ids = get_featured_ids(app, lang, type) return manual_order(self.listed(app), ids, 'addons.id')
def featured(self, app, lang=None, type=None): '\n \n ' ids = get_featured_ids(app, lang, type) return manual_order(self.listed(app), ids, 'addons.id')<|docstring|>Filter for all featured add-ons for an application in all locales.<|endoftext|>
223667c55bc3c8deffda25407ccb0a4e95c22cd73c14058304767a1d0b034571
def listed(self, app, *status): '\n Return add-ons that support a given ``app``, have a version with a file\n matching ``status`` and are not disabled.\n ' if (len(status) == 0): status = [amo.STATUS_PUBLIC] return self.filter(self.valid_q(status), appsupport__app=app.id)
Return add-ons that support a given ``app``, have a version with a file matching ``status`` and are not disabled.
src/olympia/addons/models.py
listed
thefreakingmind12/addons-server
2
python
def listed(self, app, *status): '\n Return add-ons that support a given ``app``, have a version with a file\n matching ``status`` and are not disabled.\n ' if (len(status) == 0): status = [amo.STATUS_PUBLIC] return self.filter(self.valid_q(status), appsupport__app=app.id)
def listed(self, app, *status): '\n Return add-ons that support a given ``app``, have a version with a file\n matching ``status`` and are not disabled.\n ' if (len(status) == 0): status = [amo.STATUS_PUBLIC] return self.filter(self.valid_q(status), appsupport__app=app.id)<|docst...
c80bab4639b1227397e0f31f3ff512687a482f08013646d6a29068d3a85fb889
def valid_q(self, status=None, prefix=''): "\n Return a Q object that selects a valid Addon with the given statuses.\n\n An add-on is valid if not disabled and has a current version.\n ``prefix`` can be used if you're not working with Addon directly and\n need to hop across a join, e.g. ...
Return a Q object that selects a valid Addon with the given statuses. An add-on is valid if not disabled and has a current version. ``prefix`` can be used if you're not working with Addon directly and need to hop across a join, e.g. ``prefix='addon__'`` in CollectionAddon.
src/olympia/addons/models.py
valid_q
thefreakingmind12/addons-server
2
python
def valid_q(self, status=None, prefix=): "\n Return a Q object that selects a valid Addon with the given statuses.\n\n An add-on is valid if not disabled and has a current version.\n ``prefix`` can be used if you're not working with Addon directly and\n need to hop across a join, e.g. ``...
def valid_q(self, status=None, prefix=): "\n Return a Q object that selects a valid Addon with the given statuses.\n\n An add-on is valid if not disabled and has a current version.\n ``prefix`` can be used if you're not working with Addon directly and\n need to hop across a join, e.g. ``...
d2358d6df8b4e8cdd4f66ac172bdd862847772b36971711719775a0734449563
def id_or_slug(self, val): 'Get add-ons by id or slug.' return self.get_queryset().id_or_slug(val)
Get add-ons by id or slug.
src/olympia/addons/models.py
id_or_slug
thefreakingmind12/addons-server
2
python
def id_or_slug(self, val): return self.get_queryset().id_or_slug(val)
def id_or_slug(self, val): return self.get_queryset().id_or_slug(val)<|docstring|>Get add-ons by id or slug.<|endoftext|>
7cf5302412f3b01735f7d368ebcc27ba70b2690dac89092cd716653c6c525590
def enabled(self): "Get add-ons that haven't been disabled by their developer(s)." return self.get_queryset().enabled()
Get add-ons that haven't been disabled by their developer(s).
src/olympia/addons/models.py
enabled
thefreakingmind12/addons-server
2
python
def enabled(self): return self.get_queryset().enabled()
def enabled(self): return self.get_queryset().enabled()<|docstring|>Get add-ons that haven't been disabled by their developer(s).<|endoftext|>
e0e3a016be02fa01fb9d5ab0a2e19732ef4b098cec1031e4d4b8803dedbb7534
def public(self): 'Get public add-ons only' return self.get_queryset().public()
Get public add-ons only
src/olympia/addons/models.py
public
thefreakingmind12/addons-server
2
python
def public(self): return self.get_queryset().public()
def public(self): return self.get_queryset().public()<|docstring|>Get public add-ons only<|endoftext|>
21a9d1679ebf8d20eb00c0a2194b97ff2d3901e8ef534fc291b3c21556ed168b
def valid(self): 'Get valid, enabled add-ons only' return self.get_queryset().valid()
Get valid, enabled add-ons only
src/olympia/addons/models.py
valid
thefreakingmind12/addons-server
2
python
def valid(self): return self.get_queryset().valid()
def valid(self): return self.get_queryset().valid()<|docstring|>Get valid, enabled add-ons only<|endoftext|>
2b6da9a8616b9129d322e0c57ae466bf5aa108172e184164895bde1ab632ac20
def valid_and_disabled_and_pending(self): '\n Get valid, pending, enabled and disabled add-ons.\n Used to allow pending theme pages to still be viewed.\n ' return self.get_queryset().valid_and_disabled_and_pending()
Get valid, pending, enabled and disabled add-ons. Used to allow pending theme pages to still be viewed.
src/olympia/addons/models.py
valid_and_disabled_and_pending
thefreakingmind12/addons-server
2
python
def valid_and_disabled_and_pending(self): '\n Get valid, pending, enabled and disabled add-ons.\n Used to allow pending theme pages to still be viewed.\n ' return self.get_queryset().valid_and_disabled_and_pending()
def valid_and_disabled_and_pending(self): '\n Get valid, pending, enabled and disabled add-ons.\n Used to allow pending theme pages to still be viewed.\n ' return self.get_queryset().valid_and_disabled_and_pending()<|docstring|>Get valid, pending, enabled and disabled add-ons. Used to allow...
696d044ac3051a7ffc9af74141fac5d503e32430fbfdfe959e20abc1421a599b
def featured(self, app, lang=None, type=None): '\n Filter for all featured add-ons for an application in all locales.\n ' return self.get_queryset().featured(app, lang=lang, type=type)
Filter for all featured add-ons for an application in all locales.
src/olympia/addons/models.py
featured
thefreakingmind12/addons-server
2
python
def featured(self, app, lang=None, type=None): '\n \n ' return self.get_queryset().featured(app, lang=lang, type=type)
def featured(self, app, lang=None, type=None): '\n \n ' return self.get_queryset().featured(app, lang=lang, type=type)<|docstring|>Filter for all featured add-ons for an application in all locales.<|endoftext|>
98aa4c9551003ba13b8c404c76d4bb9a0a94cd9e478e6c6a329f38a0b4e703c0
def listed(self, app, *status): '\n Return add-ons that support a given ``app``, have a version with a file\n matching ``status`` and are not disabled.\n ' return self.get_queryset().listed(app, *status)
Return add-ons that support a given ``app``, have a version with a file matching ``status`` and are not disabled.
src/olympia/addons/models.py
listed
thefreakingmind12/addons-server
2
python
def listed(self, app, *status): '\n Return add-ons that support a given ``app``, have a version with a file\n matching ``status`` and are not disabled.\n ' return self.get_queryset().listed(app, *status)
def listed(self, app, *status): '\n Return add-ons that support a given ``app``, have a version with a file\n matching ``status`` and are not disabled.\n ' return self.get_queryset().listed(app, *status)<|docstring|>Return add-ons that support a given ``app``, have a version with a file mat...
906534290cb5ff7d3961f841a91a68a088e27e842297ff7553ea41dd504c72a1
@classmethod def search_public(cls): "Legacy search method for public add-ons.\n\n Note that typically, code using this method do a search in ES but then\n will fetch the relevant objects from the database using Addon.objects,\n so deleted addons won't be returned no matter what ES returns. See...
Legacy search method for public add-ons. Note that typically, code using this method do a search in ES but then will fetch the relevant objects from the database using Addon.objects, so deleted addons won't be returned no matter what ES returns. See amo.search.ES and amo.search.ObjectSearchResults for more details. I...
src/olympia/addons/models.py
search_public
thefreakingmind12/addons-server
2
python
@classmethod def search_public(cls): "Legacy search method for public add-ons.\n\n Note that typically, code using this method do a search in ES but then\n will fetch the relevant objects from the database using Addon.objects,\n so deleted addons won't be returned no matter what ES returns. See...
@classmethod def search_public(cls): "Legacy search method for public add-ons.\n\n Note that typically, code using this method do a search in ES but then\n will fetch the relevant objects from the database using Addon.objects,\n so deleted addons won't be returned no matter what ES returns. See...
629dfc9f8ecac050acdd30f20bf9b34b7790f37cd7a5741b1358c729a12db69e
@classmethod def from_upload(cls, upload, selected_apps, channel=amo.RELEASE_CHANNEL_LISTED, parsed_data=None, user=None): "\n Create an Addon instance, a Version and corresponding File(s) from a\n FileUpload, a list of compatible app ids, a channel id and the\n parsed_data generated by parse_a...
Create an Addon instance, a Version and corresponding File(s) from a FileUpload, a list of compatible app ids, a channel id and the parsed_data generated by parse_addon(). Note that it's the caller's responsability to ensure the file is valid. We can't check for that here because an admin may have overridden the valid...
src/olympia/addons/models.py
from_upload
thefreakingmind12/addons-server
2
python
@classmethod def from_upload(cls, upload, selected_apps, channel=amo.RELEASE_CHANNEL_LISTED, parsed_data=None, user=None): "\n Create an Addon instance, a Version and corresponding File(s) from a\n FileUpload, a list of compatible app ids, a channel id and the\n parsed_data generated by parse_a...
@classmethod def from_upload(cls, upload, selected_apps, channel=amo.RELEASE_CHANNEL_LISTED, parsed_data=None, user=None): "\n Create an Addon instance, a Version and corresponding File(s) from a\n FileUpload, a list of compatible app ids, a channel id and the\n parsed_data generated by parse_a...
bb0f8ea58d2663f88a912389490fd3fa68e9cd3d5e5753b86fc06a30877ccac7
@classmethod def resolve_webext_translations(cls, data, upload): 'Resolve all possible translations from an add-on.\n\n This returns a modified `data` dictionary accordingly with proper\n translations filled in.\n ' default_locale = find_language(data.get('default_locale')) if ((not dat...
Resolve all possible translations from an add-on. This returns a modified `data` dictionary accordingly with proper translations filled in.
src/olympia/addons/models.py
resolve_webext_translations
thefreakingmind12/addons-server
2
python
@classmethod def resolve_webext_translations(cls, data, upload): 'Resolve all possible translations from an add-on.\n\n This returns a modified `data` dictionary accordingly with proper\n translations filled in.\n ' default_locale = find_language(data.get('default_locale')) if ((not dat...
@classmethod def resolve_webext_translations(cls, data, upload): 'Resolve all possible translations from an add-on.\n\n This returns a modified `data` dictionary accordingly with proper\n translations filled in.\n ' default_locale = find_language(data.get('default_locale')) if ((not dat...
541cdb7e0d94e2058822687bb66805ce42e2802e633b4e01faa34333538dbaa2
def type_url(self): "The url for this add-on's type." return Addon.get_type_url(self.type)
The url for this add-on's type.
src/olympia/addons/models.py
type_url
thefreakingmind12/addons-server
2
python
def type_url(self): return Addon.get_type_url(self.type)
def type_url(self): return Addon.get_type_url(self.type)<|docstring|>The url for this add-on's type.<|endoftext|>
3820d050fb8d744ce7d61ce6402ecb672805ed6d67655940defa369ff739fe8c
def find_latest_public_listed_version(self): 'Retrieve the latest public listed version of an addon.\n\n If the add-on is not public, it can return a listed version awaiting\n review (since non-public add-ons should not have public versions).' if (self.type == amo.ADDON_PERSONA): return ...
Retrieve the latest public listed version of an addon. If the add-on is not public, it can return a listed version awaiting review (since non-public add-ons should not have public versions).
src/olympia/addons/models.py
find_latest_public_listed_version
thefreakingmind12/addons-server
2
python
def find_latest_public_listed_version(self): 'Retrieve the latest public listed version of an addon.\n\n If the add-on is not public, it can return a listed version awaiting\n review (since non-public add-ons should not have public versions).' if (self.type == amo.ADDON_PERSONA): return ...
def find_latest_public_listed_version(self): 'Retrieve the latest public listed version of an addon.\n\n If the add-on is not public, it can return a listed version awaiting\n review (since non-public add-ons should not have public versions).' if (self.type == amo.ADDON_PERSONA): return ...
730cdb231bcc7b4d1506fa13e480846646e72c7b029c843d7a7be551b7c38b8e
def find_latest_version(self, channel, exclude=(amo.STATUS_DISABLED,)): 'Retrieve the latest version of an add-on for the specified channel.\n\n If channel is None either channel is returned.\n\n Keyword arguments:\n exclude -- exclude versions for which all files have one\n o...
Retrieve the latest version of an add-on for the specified channel. If channel is None either channel is returned. Keyword arguments: exclude -- exclude versions for which all files have one of those statuses (default STATUS_DISABLED).
src/olympia/addons/models.py
find_latest_version
thefreakingmind12/addons-server
2
python
def find_latest_version(self, channel, exclude=(amo.STATUS_DISABLED,)): 'Retrieve the latest version of an add-on for the specified channel.\n\n If channel is None either channel is returned.\n\n Keyword arguments:\n exclude -- exclude versions for which all files have one\n o...
def find_latest_version(self, channel, exclude=(amo.STATUS_DISABLED,)): 'Retrieve the latest version of an add-on for the specified channel.\n\n If channel is None either channel is returned.\n\n Keyword arguments:\n exclude -- exclude versions for which all files have one\n o...
4646b8e058972dace3905cb9ca81fc03708339c31e9b5428471cd6d848b1a296
@use_primary_db def update_version(self, ignore=None, _signal=True): '\n Update the current_version field on this add-on if necessary.\n\n Returns True if we updated the current_version field.\n\n The optional ``ignore`` parameter, if present, is a a version\n to not consider as part of ...
Update the current_version field on this add-on if necessary. Returns True if we updated the current_version field. The optional ``ignore`` parameter, if present, is a a version to not consider as part of the update, since it may be in the process of being deleted. Pass ``_signal=False`` if you want to no signals fi...
src/olympia/addons/models.py
update_version
thefreakingmind12/addons-server
2
python
@use_primary_db def update_version(self, ignore=None, _signal=True): '\n Update the current_version field on this add-on if necessary.\n\n Returns True if we updated the current_version field.\n\n The optional ``ignore`` parameter, if present, is a a version\n to not consider as part of ...
@use_primary_db def update_version(self, ignore=None, _signal=True): '\n Update the current_version field on this add-on if necessary.\n\n Returns True if we updated the current_version field.\n\n The optional ``ignore`` parameter, if present, is a a version\n to not consider as part of ...
42b3e887a51f83d04db97939c9302bdd4dc610b84bc750577814ecb880a5c263
def increment_theme_version_number(self): 'Increment theme version number by 1.' latest_version = self.find_latest_version(None) version = (latest_version or self.current_version) version.version = str((float(version.version) + 1)) self.update(_current_version=version.save())
Increment theme version number by 1.
src/olympia/addons/models.py
increment_theme_version_number
thefreakingmind12/addons-server
2
python
def increment_theme_version_number(self): latest_version = self.find_latest_version(None) version = (latest_version or self.current_version) version.version = str((float(version.version) + 1)) self.update(_current_version=version.save())
def increment_theme_version_number(self): latest_version = self.find_latest_version(None) version = (latest_version or self.current_version) version.version = str((float(version.version) + 1)) self.update(_current_version=version.save())<|docstring|>Increment theme version number by 1.<|endoftext|>
d5d10f215e0b4ceb91a6e9e7753ba37df04bea8b7e5b79386f36a1ead1b286e4
def invalidate_d2c_versions(self): 'Invalidates the cache of compatible versions.\n\n Call this when there is an event that may change what compatible\n versions are returned so they are recalculated.\n ' key = cache_ns_key(('d2c-versions:%s' % self.id), increment=True) log.info(('Incre...
Invalidates the cache of compatible versions. Call this when there is an event that may change what compatible versions are returned so they are recalculated.
src/olympia/addons/models.py
invalidate_d2c_versions
thefreakingmind12/addons-server
2
python
def invalidate_d2c_versions(self): 'Invalidates the cache of compatible versions.\n\n Call this when there is an event that may change what compatible\n versions are returned so they are recalculated.\n ' key = cache_ns_key(('d2c-versions:%s' % self.id), increment=True) log.info(('Incre...
def invalidate_d2c_versions(self): 'Invalidates the cache of compatible versions.\n\n Call this when there is an event that may change what compatible\n versions are returned so they are recalculated.\n ' key = cache_ns_key(('d2c-versions:%s' % self.id), increment=True) log.info(('Incre...
e5c15ce82c4837142271b151bf868d47353de09bfa3cce6b9545ed492bfcb56d
@property def current_version(self): 'Return the latest public listed version of an addon.\n\n If the add-on is not public, it can return a listed version awaiting\n review (since non-public add-ons should not have public versions).\n\n If the add-on has not been created yet or is deleted, it r...
Return the latest public listed version of an addon. If the add-on is not public, it can return a listed version awaiting review (since non-public add-ons should not have public versions). If the add-on has not been created yet or is deleted, it returns None.
src/olympia/addons/models.py
current_version
thefreakingmind12/addons-server
2
python
@property def current_version(self): 'Return the latest public listed version of an addon.\n\n If the add-on is not public, it can return a listed version awaiting\n review (since non-public add-ons should not have public versions).\n\n If the add-on has not been created yet or is deleted, it r...
@property def current_version(self): 'Return the latest public listed version of an addon.\n\n If the add-on is not public, it can return a listed version awaiting\n review (since non-public add-ons should not have public versions).\n\n If the add-on has not been created yet or is deleted, it r...
5b17c85220b16951b0aa60c7b96e3ad0fb3ebbd5aaec1d456261d3675bdc4ba6
@cached_property def latest_unlisted_version(self): 'Shortcut property for Addon.find_latest_version(\n channel=RELEASE_CHANNEL_UNLISTED).' return self.find_latest_version(channel=amo.RELEASE_CHANNEL_UNLISTED)
Shortcut property for Addon.find_latest_version( channel=RELEASE_CHANNEL_UNLISTED).
src/olympia/addons/models.py
latest_unlisted_version
thefreakingmind12/addons-server
2
python
@cached_property def latest_unlisted_version(self): 'Shortcut property for Addon.find_latest_version(\n channel=RELEASE_CHANNEL_UNLISTED).' return self.find_latest_version(channel=amo.RELEASE_CHANNEL_UNLISTED)
@cached_property def latest_unlisted_version(self): 'Shortcut property for Addon.find_latest_version(\n channel=RELEASE_CHANNEL_UNLISTED).' return self.find_latest_version(channel=amo.RELEASE_CHANNEL_UNLISTED)<|docstring|>Shortcut property for Addon.find_latest_version( channel=RELEASE_CHANNEL_UNLISTED)....
1abc4960684fcf2a237118de543b0f249ac677e590d1d4f8c8606e328d13b261
@cached_property def binary(self): 'Returns if the current version has binary files.' version = self.current_version if version: return version.files.filter(binary=True).exists() return False
Returns if the current version has binary files.
src/olympia/addons/models.py
binary
thefreakingmind12/addons-server
2
python
@cached_property def binary(self): version = self.current_version if version: return version.files.filter(binary=True).exists() return False
@cached_property def binary(self): version = self.current_version if version: return version.files.filter(binary=True).exists() return False<|docstring|>Returns if the current version has binary files.<|endoftext|>
faf7ac9c65c1bf60acf2c2faed48ca8357f7438b34b0d9383fc8bdcd6c3351d2
@cached_property def binary_components(self): 'Returns if the current version has files with binary_components.' version = self.current_version if version: return version.files.filter(binary_components=True).exists() return False
Returns if the current version has files with binary_components.
src/olympia/addons/models.py
binary_components
thefreakingmind12/addons-server
2
python
@cached_property def binary_components(self): version = self.current_version if version: return version.files.filter(binary_components=True).exists() return False
@cached_property def binary_components(self): version = self.current_version if version: return version.files.filter(binary_components=True).exists() return False<|docstring|>Returns if the current version has files with binary_components.<|endoftext|>
a98b6c6d66c70f1030676de32f27c3ad42594ef0a9868e9025eda3a502d4f631
def get_icon_url(self, size, use_default=True): "\n Returns the addon's icon url according to icon_type.\n\n If it's a persona, it will return the icon_url of the associated\n Persona instance.\n\n If it's a theme and there is no icon set, it will return the default\n theme icon.\...
Returns the addon's icon url according to icon_type. If it's a persona, it will return the icon_url of the associated Persona instance. If it's a theme and there is no icon set, it will return the default theme icon. If it's something else, it will return the default add-on icon, unless use_default is False, in whic...
src/olympia/addons/models.py
get_icon_url
thefreakingmind12/addons-server
2
python
def get_icon_url(self, size, use_default=True): "\n Returns the addon's icon url according to icon_type.\n\n If it's a persona, it will return the icon_url of the associated\n Persona instance.\n\n If it's a theme and there is no icon set, it will return the default\n theme icon.\...
def get_icon_url(self, size, use_default=True): "\n Returns the addon's icon url according to icon_type.\n\n If it's a persona, it will return the icon_url of the associated\n Persona instance.\n\n If it's a theme and there is no icon set, it will return the default\n theme icon.\...
7c544f37cdf07d6d86438bbeadac04c00f05ff055f3e36d6b07c337cf7422b2b
def authors_other_addons(self, app=None): '\n Return other addons by the author(s) of this addon,\n optionally takes an app.\n ' if app: qs = Addon.objects.listed(app) else: qs = Addon.objects.valid() return qs.exclude(id=self.id).filter(addonuser__listed=True, autho...
Return other addons by the author(s) of this addon, optionally takes an app.
src/olympia/addons/models.py
authors_other_addons
thefreakingmind12/addons-server
2
python
def authors_other_addons(self, app=None): '\n Return other addons by the author(s) of this addon,\n optionally takes an app.\n ' if app: qs = Addon.objects.listed(app) else: qs = Addon.objects.valid() return qs.exclude(id=self.id).filter(addonuser__listed=True, autho...
def authors_other_addons(self, app=None): '\n Return other addons by the author(s) of this addon,\n optionally takes an app.\n ' if app: qs = Addon.objects.listed(app) else: qs = Addon.objects.valid() return qs.exclude(id=self.id).filter(addonuser__listed=True, autho...
0d85b446befa47bbc9a08450056c1fb772098f810214bfddd21e77d4d66c6c95
@property def thumbnail_url(self): "\n Returns the addon's thumbnail url or a default.\n " try: preview = self._all_previews[0] return preview.thumbnail_url except IndexError: return (settings.STATIC_URL + '/img/icons/no-preview.png')
Returns the addon's thumbnail url or a default.
src/olympia/addons/models.py
thumbnail_url
thefreakingmind12/addons-server
2
python
@property def thumbnail_url(self): "\n \n " try: preview = self._all_previews[0] return preview.thumbnail_url except IndexError: return (settings.STATIC_URL + '/img/icons/no-preview.png')
@property def thumbnail_url(self): "\n \n " try: preview = self._all_previews[0] return preview.thumbnail_url except IndexError: return (settings.STATIC_URL + '/img/icons/no-preview.png')<|docstring|>Returns the addon's thumbnail url or a default.<|endoftext|>
194c08d809dc66ff82f484e2dc91767e514c2b976b1c351df0dc8ebe5819c706
def can_request_review(self): 'Return whether an add-on can request a review or not.' if (self.is_disabled or (self.status in (amo.STATUS_PUBLIC, amo.STATUS_NOMINATED, amo.STATUS_DELETED))): return False latest_version = self.find_latest_version(amo.RELEASE_CHANNEL_LISTED, exclude=()) return ((l...
Return whether an add-on can request a review or not.
src/olympia/addons/models.py
can_request_review
thefreakingmind12/addons-server
2
python
def can_request_review(self): if (self.is_disabled or (self.status in (amo.STATUS_PUBLIC, amo.STATUS_NOMINATED, amo.STATUS_DELETED))): return False latest_version = self.find_latest_version(amo.RELEASE_CHANNEL_LISTED, exclude=()) return ((latest_version is not None) and latest_version.files.exi...
def can_request_review(self): if (self.is_disabled or (self.status in (amo.STATUS_PUBLIC, amo.STATUS_NOMINATED, amo.STATUS_DELETED))): return False latest_version = self.find_latest_version(amo.RELEASE_CHANNEL_LISTED, exclude=()) return ((latest_version is not None) and latest_version.files.exi...
8f74c8c7883e8a6ef71b4d8c57951cbd6272f114ae2845b98dce2226e329907a
@property def is_disabled(self): 'True if this Addon is disabled.\n\n It could be disabled by an admin or disabled by the developer\n ' return ((self.status == amo.STATUS_DISABLED) or self.disabled_by_user)
True if this Addon is disabled. It could be disabled by an admin or disabled by the developer
src/olympia/addons/models.py
is_disabled
thefreakingmind12/addons-server
2
python
@property def is_disabled(self): 'True if this Addon is disabled.\n\n It could be disabled by an admin or disabled by the developer\n ' return ((self.status == amo.STATUS_DISABLED) or self.disabled_by_user)
@property def is_disabled(self): 'True if this Addon is disabled.\n\n It could be disabled by an admin or disabled by the developer\n ' return ((self.status == amo.STATUS_DISABLED) or self.disabled_by_user)<|docstring|>True if this Addon is disabled. It could be disabled by an admin or disabled b...
84f01c6f8206b87d63538602bd6f28d62b106336772d3c12aecb014a7bf84292
def has_complete_metadata(self, has_listed_versions=None): 'See get_required_metadata for has_listed_versions details.' return all(self.get_required_metadata(has_listed_versions=has_listed_versions))
See get_required_metadata for has_listed_versions details.
src/olympia/addons/models.py
has_complete_metadata
thefreakingmind12/addons-server
2
python
def has_complete_metadata(self, has_listed_versions=None): return all(self.get_required_metadata(has_listed_versions=has_listed_versions))
def has_complete_metadata(self, has_listed_versions=None): return all(self.get_required_metadata(has_listed_versions=has_listed_versions))<|docstring|>See get_required_metadata for has_listed_versions details.<|endoftext|>
f76877937c9b32bde447c386256abf819d7736438ab0174d97b04bc433952a3e
def get_required_metadata(self, has_listed_versions=None): 'If has_listed_versions is not specified this method will return the\n current (required) metadata (truthy values if present) for this Addon.\n\n If has_listed_versions is specified then the method will act as if\n Addon.has_listed_vers...
If has_listed_versions is not specified this method will return the current (required) metadata (truthy values if present) for this Addon. If has_listed_versions is specified then the method will act as if Addon.has_listed_versions() returns that value. Used to predict if the addon will require extra metadata before a...
src/olympia/addons/models.py
get_required_metadata
thefreakingmind12/addons-server
2
python
def get_required_metadata(self, has_listed_versions=None): 'If has_listed_versions is not specified this method will return the\n current (required) metadata (truthy values if present) for this Addon.\n\n If has_listed_versions is specified then the method will act as if\n Addon.has_listed_vers...
def get_required_metadata(self, has_listed_versions=None): 'If has_listed_versions is not specified this method will return the\n current (required) metadata (truthy values if present) for this Addon.\n\n If has_listed_versions is specified then the method will act as if\n Addon.has_listed_vers...
9590d5846beb254bb144a54ab31f9a0f86c2e852e5fa3ec00f927d62da80ef74
@property def is_restart_required(self): 'Whether the add-on current version requires a browser restart to\n work.' return (self.current_version and self.current_version.is_restart_required)
Whether the add-on current version requires a browser restart to work.
src/olympia/addons/models.py
is_restart_required
thefreakingmind12/addons-server
2
python
@property def is_restart_required(self): 'Whether the add-on current version requires a browser restart to\n work.' return (self.current_version and self.current_version.is_restart_required)
@property def is_restart_required(self): 'Whether the add-on current version requires a browser restart to\n work.' return (self.current_version and self.current_version.is_restart_required)<|docstring|>Whether the add-on current version requires a browser restart to work.<|endoftext|>
e513dec7e8c5fb3f8e85a4666a57a51289d2605d8c07ecdb75f1a3d6e020c3d6
def is_featured(self, app=None, lang=None): 'Is add-on globally featured for this app and language?' return (self.id in get_featured_ids(app, lang))
Is add-on globally featured for this app and language?
src/olympia/addons/models.py
is_featured
thefreakingmind12/addons-server
2
python
def is_featured(self, app=None, lang=None): return (self.id in get_featured_ids(app, lang))
def is_featured(self, app=None, lang=None): return (self.id in get_featured_ids(app, lang))<|docstring|>Is add-on globally featured for this app and language?<|endoftext|>
27af7f590e2fad3e77d86a81c03a097ba52934e4ca4b2d5a2f3fc2b4df948d86
@cached_property def tags_partitioned_by_developer(self): 'Returns a tuple of developer tags and user tags for this addon.' tags = self.tags.not_denied() if self.is_persona: return ([], tags) user_tags = tags.exclude(addon_tags__user__in=self.listed_authors) dev_tags = tags.exclude(id__in=[t...
Returns a tuple of developer tags and user tags for this addon.
src/olympia/addons/models.py
tags_partitioned_by_developer
thefreakingmind12/addons-server
2
python
@cached_property def tags_partitioned_by_developer(self): tags = self.tags.not_denied() if self.is_persona: return ([], tags) user_tags = tags.exclude(addon_tags__user__in=self.listed_authors) dev_tags = tags.exclude(id__in=[t.id for t in user_tags]) return (dev_tags, user_tags)
@cached_property def tags_partitioned_by_developer(self): tags = self.tags.not_denied() if self.is_persona: return ([], tags) user_tags = tags.exclude(addon_tags__user__in=self.listed_authors) dev_tags = tags.exclude(id__in=[t.id for t in user_tags]) return (dev_tags, user_tags)<|docstr...
1b0e1fd410378c1076f1a0e932a06a3fed13fdfb5383bdb0c5bdfe6c0ac71ed4
@cached_property def compatible_apps(self): 'Shortcut to get compatible apps for the current version.' if self.current_version: return self.current_version.compatible_apps else: return {}
Shortcut to get compatible apps for the current version.
src/olympia/addons/models.py
compatible_apps
thefreakingmind12/addons-server
2
python
@cached_property def compatible_apps(self): if self.current_version: return self.current_version.compatible_apps else: return {}
@cached_property def compatible_apps(self): if self.current_version: return self.current_version.compatible_apps else: return {}<|docstring|>Shortcut to get compatible apps for the current version.<|endoftext|>
a441afb8873aa2bdfeba21b96981bf194ba3b877c19a24ee1ddbf31edde67399
def accepts_compatible_apps(self): 'True if this add-on lists compatible apps.' return (self.type not in amo.NO_COMPAT)
True if this add-on lists compatible apps.
src/olympia/addons/models.py
accepts_compatible_apps
thefreakingmind12/addons-server
2
python
def accepts_compatible_apps(self): return (self.type not in amo.NO_COMPAT)
def accepts_compatible_apps(self): return (self.type not in amo.NO_COMPAT)<|docstring|>True if this add-on lists compatible apps.<|endoftext|>
71440996a6c33394ae17c42b2d9cd3d4bc3c73f92f3bb4479b94ba14bcd3118f
def incompatible_latest_apps(self): 'Returns a list of applications with which this add-on is\n incompatible (based on the latest version of each app).\n\n ' return [app for (app, ver) in self.compatible_apps.items() if (ver and (version_int(ver.max.version) < version_int(app.latest_version)))]
Returns a list of applications with which this add-on is incompatible (based on the latest version of each app).
src/olympia/addons/models.py
incompatible_latest_apps
thefreakingmind12/addons-server
2
python
def incompatible_latest_apps(self): 'Returns a list of applications with which this add-on is\n incompatible (based on the latest version of each app).\n\n ' return [app for (app, ver) in self.compatible_apps.items() if (ver and (version_int(ver.max.version) < version_int(app.latest_version)))]
def incompatible_latest_apps(self): 'Returns a list of applications with which this add-on is\n incompatible (based on the latest version of each app).\n\n ' return [app for (app, ver) in self.compatible_apps.items() if (ver and (version_int(ver.max.version) < version_int(app.latest_version)))]<|d...
4d520a461043eb319eaeff1c32287f5ff7777ec9b2188feed26654d180b56d12
def has_author(self, user): 'True if ``user`` is an author of the add-on.' if ((user is None) or user.is_anonymous): return False return AddonUser.objects.filter(addon=self, user=user).exists()
True if ``user`` is an author of the add-on.
src/olympia/addons/models.py
has_author
thefreakingmind12/addons-server
2
python
def has_author(self, user): if ((user is None) or user.is_anonymous): return False return AddonUser.objects.filter(addon=self, user=user).exists()
def has_author(self, user): if ((user is None) or user.is_anonymous): return False return AddonUser.objects.filter(addon=self, user=user).exists()<|docstring|>True if ``user`` is an author of the add-on.<|endoftext|>
0d74275c84c6a18da005a035ca0cb8646e2d0bd26b73dc919fcef848ef343601
@classmethod def _last_updated_queries(cls): '\n Get the queries used to calculate addon.last_updated.\n ' status_change = Max('versions__files__datestatuschanged') public = Addon.objects.filter(status=amo.STATUS_PUBLIC, versions__files__status=amo.STATUS_PUBLIC).exclude(type=amo.ADDON_PERSONA...
Get the queries used to calculate addon.last_updated.
src/olympia/addons/models.py
_last_updated_queries
thefreakingmind12/addons-server
2
python
@classmethod def _last_updated_queries(cls): '\n \n ' status_change = Max('versions__files__datestatuschanged') public = Addon.objects.filter(status=amo.STATUS_PUBLIC, versions__files__status=amo.STATUS_PUBLIC).exclude(type=amo.ADDON_PERSONA).values('id').annotate(last_updated=status_change) ...
@classmethod def _last_updated_queries(cls): '\n \n ' status_change = Max('versions__files__datestatuschanged') public = Addon.objects.filter(status=amo.STATUS_PUBLIC, versions__files__status=amo.STATUS_PUBLIC).exclude(type=amo.ADDON_PERSONA).values('id').annotate(last_updated=status_change) ...
38fd62c8b5bf922b9a561bbd66469c1c9b95ca52cc23220139c1d7f3cf43740e
@cached_property def current_previews(self): 'Previews for the current version, or all of them if not a\n static theme.' if self.has_per_version_previews: if self.current_version: return self.current_version.previews.all() return VersionPreview.objects.none() else: ...
Previews for the current version, or all of them if not a static theme.
src/olympia/addons/models.py
current_previews
thefreakingmind12/addons-server
2
python
@cached_property def current_previews(self): 'Previews for the current version, or all of them if not a\n static theme.' if self.has_per_version_previews: if self.current_version: return self.current_version.previews.all() return VersionPreview.objects.none() else: ...
@cached_property def current_previews(self): 'Previews for the current version, or all of them if not a\n static theme.' if self.has_per_version_previews: if self.current_version: return self.current_version.previews.all() return VersionPreview.objects.none() else: ...
2b3e6c6b30ceeeeddf352e41e56311c4431c13330844574ac96a40ced87bdbaf
@cached_property def _all_previews(self): 'Exclude promo graphics.' return list(self.previews.exclude(position=(- 1)))
Exclude promo graphics.
src/olympia/addons/models.py
_all_previews
thefreakingmind12/addons-server
2
python
@cached_property def _all_previews(self): return list(self.previews.exclude(position=(- 1)))
@cached_property def _all_previews(self): return list(self.previews.exclude(position=(- 1)))<|docstring|>Exclude promo graphics.<|endoftext|>
874e96485c48ddf4bc16d8f0b8814fe98ebbfb0a05dfb6097ae359bedf20de98
def remove_locale(self, locale): 'NULLify strings in this locale for the add-on and versions.' for o in itertools.chain([self], self.versions.all()): Translation.objects.remove_for(o, locale)
NULLify strings in this locale for the add-on and versions.
src/olympia/addons/models.py
remove_locale
thefreakingmind12/addons-server
2
python
def remove_locale(self, locale): for o in itertools.chain([self], self.versions.all()): Translation.objects.remove_for(o, locale)
def remove_locale(self, locale): for o in itertools.chain([self], self.versions.all()): Translation.objects.remove_for(o, locale)<|docstring|>NULLify strings in this locale for the add-on and versions.<|endoftext|>
6a277cb33bd55db367bfdfb1d25b95233021c9d3316c9684ffeb192eaf40eef5
def get_localepicker(self): 'For language packs, gets the contents of localepicker.' if ((self.type == amo.ADDON_LPAPP) and (self.status == amo.STATUS_PUBLIC) and self.current_version): files = self.current_version.files.filter(platform=amo.PLATFORM_ANDROID.id) try: return unicode(fi...
For language packs, gets the contents of localepicker.
src/olympia/addons/models.py
get_localepicker
thefreakingmind12/addons-server
2
python
def get_localepicker(self): if ((self.type == amo.ADDON_LPAPP) and (self.status == amo.STATUS_PUBLIC) and self.current_version): files = self.current_version.files.filter(platform=amo.PLATFORM_ANDROID.id) try: return unicode(files[0].get_localepicker(), 'utf-8') except Index...
def get_localepicker(self): if ((self.type == amo.ADDON_LPAPP) and (self.status == amo.STATUS_PUBLIC) and self.current_version): files = self.current_version.files.filter(platform=amo.PLATFORM_ANDROID.id) try: return unicode(files[0].get_localepicker(), 'utf-8') except Index...
b1365156b5a96493a25cc72725423bc4c6551dd3d0462f36681de6d9850c827d
def can_review(self, user): 'Check whether the user should be prompted to add a review or not.' return ((not user.is_authenticated) or (not self.has_author(user)))
Check whether the user should be prompted to add a review or not.
src/olympia/addons/models.py
can_review
thefreakingmind12/addons-server
2
python
def can_review(self, user): return ((not user.is_authenticated) or (not self.has_author(user)))
def can_review(self, user): return ((not user.is_authenticated) or (not self.has_author(user)))<|docstring|>Check whether the user should be prompted to add a review or not.<|endoftext|>
4fcfaffe946fc6f73b1c9727cc20e8064105d65a5e10ae3fd735447b8d6e06fb
def check_ownership(self, request, require_owner, require_author, ignore_disabled, admin): '\n Used by acl.check_ownership to see if request.user has permissions for\n the addon.\n ' if require_author: require_owner = False ignore_disabled = True admin = False re...
Used by acl.check_ownership to see if request.user has permissions for the addon.
src/olympia/addons/models.py
check_ownership
thefreakingmind12/addons-server
2
python
def check_ownership(self, request, require_owner, require_author, ignore_disabled, admin): '\n Used by acl.check_ownership to see if request.user has permissions for\n the addon.\n ' if require_author: require_owner = False ignore_disabled = True admin = False re...
def check_ownership(self, request, require_owner, require_author, ignore_disabled, admin): '\n Used by acl.check_ownership to see if request.user has permissions for\n the addon.\n ' if require_author: require_owner = False ignore_disabled = True admin = False re...
e4bd26538c09d212186d41cbb2ca95c1f5a6aa591c05e431933e3c3763fc8eff
@cached_property def thumb_url(self): '\n Handles deprecated GetPersonas URL.\n In days of yore, preview.jpg used to be a separate image.\n In modern days, we use the same image for big preview + thumb.\n ' if self.is_new(): return self._image_url('preview.png') else: ...
Handles deprecated GetPersonas URL. In days of yore, preview.jpg used to be a separate image. In modern days, we use the same image for big preview + thumb.
src/olympia/addons/models.py
thumb_url
thefreakingmind12/addons-server
2
python
@cached_property def thumb_url(self): '\n Handles deprecated GetPersonas URL.\n In days of yore, preview.jpg used to be a separate image.\n In modern days, we use the same image for big preview + thumb.\n ' if self.is_new(): return self._image_url('preview.png') else: ...
@cached_property def thumb_url(self): '\n Handles deprecated GetPersonas URL.\n In days of yore, preview.jpg used to be a separate image.\n In modern days, we use the same image for big preview + thumb.\n ' if self.is_new(): return self._image_url('preview.png') else: ...
ef6aca14b604a1b7e84a3e1cbb0b9039cd498d678221f4a971b594ad12347795
@cached_property def thumb_path(self): '\n Handles deprecated GetPersonas path.\n In days of yore, preview.jpg used to be a separate image.\n In modern days, we use the same image for big preview + thumb.\n ' if self.is_new(): return self._image_path('preview.png') else: ...
Handles deprecated GetPersonas path. In days of yore, preview.jpg used to be a separate image. In modern days, we use the same image for big preview + thumb.
src/olympia/addons/models.py
thumb_path
thefreakingmind12/addons-server
2
python
@cached_property def thumb_path(self): '\n Handles deprecated GetPersonas path.\n In days of yore, preview.jpg used to be a separate image.\n In modern days, we use the same image for big preview + thumb.\n ' if self.is_new(): return self._image_path('preview.png') else: ...
@cached_property def thumb_path(self): '\n Handles deprecated GetPersonas path.\n In days of yore, preview.jpg used to be a separate image.\n In modern days, we use the same image for big preview + thumb.\n ' if self.is_new(): return self._image_path('preview.png') else: ...
96f23b9071c1ca81c0b4e8f3eed8d48c111f30ecf1c62ba5be1c35dbbb11d823
@cached_property def icon_url(self): 'URL to personas square preview.' if self.is_new(): return self._image_url('icon.png') else: return self._image_url('preview_small.jpg')
URL to personas square preview.
src/olympia/addons/models.py
icon_url
thefreakingmind12/addons-server
2
python
@cached_property def icon_url(self): if self.is_new(): return self._image_url('icon.png') else: return self._image_url('preview_small.jpg')
@cached_property def icon_url(self): if self.is_new(): return self._image_url('icon.png') else: return self._image_url('preview_small.jpg')<|docstring|>URL to personas square preview.<|endoftext|>
75483cc8ee43c49f7fc86c4756bd743add4c0f799a17398a4039cf982741a4f7
@cached_property def icon_path(self): 'Path to personas square preview.' if self.is_new(): return self._image_path('icon.png') else: return self._image_path('preview_small.jpg')
Path to personas square preview.
src/olympia/addons/models.py
icon_path
thefreakingmind12/addons-server
2
python
@cached_property def icon_path(self): if self.is_new(): return self._image_path('icon.png') else: return self._image_path('preview_small.jpg')
@cached_property def icon_path(self): if self.is_new(): return self._image_path('icon.png') else: return self._image_path('preview_small.jpg')<|docstring|>Path to personas square preview.<|endoftext|>
87f3bed53b03a2941ad2318439ec38368116d3550f0cd9d6dcabc99cbe4d26fb
@cached_property def preview_url(self): "URL to Persona's big, 680px, preview." if self.is_new(): return self._image_url('preview.png') else: return self._image_url('preview_large.jpg')
URL to Persona's big, 680px, preview.
src/olympia/addons/models.py
preview_url
thefreakingmind12/addons-server
2
python
@cached_property def preview_url(self): if self.is_new(): return self._image_url('preview.png') else: return self._image_url('preview_large.jpg')
@cached_property def preview_url(self): if self.is_new(): return self._image_url('preview.png') else: return self._image_url('preview_large.jpg')<|docstring|>URL to Persona's big, 680px, preview.<|endoftext|>
5b6f66dc49d171217ac7f804d5111afcd475e0583b4fcbaa102daf4547db4509
@cached_property def preview_path(self): "Path to Persona's big, 680px, preview." if self.is_new(): return self._image_path('preview.png') else: return self._image_path('preview_large.jpg')
Path to Persona's big, 680px, preview.
src/olympia/addons/models.py
preview_path
thefreakingmind12/addons-server
2
python
@cached_property def preview_path(self): if self.is_new(): return self._image_path('preview.png') else: return self._image_path('preview_large.jpg')
@cached_property def preview_path(self): if self.is_new(): return self._image_path('preview.png') else: return self._image_path('preview_large.jpg')<|docstring|>Path to Persona's big, 680px, preview.<|endoftext|>
79aa88a39aac69504899ccddb3791cb78ee9f42e79f83480ece4cf51a3c0eb43
@cached_property def theme_data(self): 'Theme JSON Data for Browser/extension preview.' def hexcolor(color): return (('#%s' % color) if color else None) addon = self.addon return {'id': unicode(self.addon.id), 'name': unicode(addon.name), 'accentcolor': hexcolor(self.accentcolor), 'textcolor': ...
Theme JSON Data for Browser/extension preview.
src/olympia/addons/models.py
theme_data
thefreakingmind12/addons-server
2
python
@cached_property def theme_data(self): def hexcolor(color): return (('#%s' % color) if color else None) addon = self.addon return {'id': unicode(self.addon.id), 'name': unicode(addon.name), 'accentcolor': hexcolor(self.accentcolor), 'textcolor': hexcolor(self.textcolor), 'category': (unicode(a...
@cached_property def theme_data(self): def hexcolor(color): return (('#%s' % color) if color else None) addon = self.addon return {'id': unicode(self.addon.id), 'name': unicode(addon.name), 'accentcolor': hexcolor(self.accentcolor), 'textcolor': hexcolor(self.textcolor), 'category': (unicode(a...
79c3f1bcbf0db258510a0879cbfced5a02f44711d72af66046ef70b4ac4224a1
@property def json_data(self): 'Persona JSON Data for Browser/extension preview.' return json.dumps(self.theme_data, separators=(',', ':'), cls=AMOJSONEncoder)
Persona JSON Data for Browser/extension preview.
src/olympia/addons/models.py
json_data
thefreakingmind12/addons-server
2
python
@property def json_data(self): return json.dumps(self.theme_data, separators=(',', ':'), cls=AMOJSONEncoder)
@property def json_data(self): return json.dumps(self.theme_data, separators=(',', ':'), cls=AMOJSONEncoder)<|docstring|>Persona JSON Data for Browser/extension preview.<|endoftext|>
434a925cfe2e4d78d565e2b1d97f96fa372101fb4b360ba8e2850748b24c2512
def authors_other_addons(self, app=None): '\n Return other addons by the author(s) of this addon,\n optionally takes an app.\n ' qs = Addon.objects.valid().exclude(id=self.addon.id).filter(type=amo.ADDON_PERSONA) return qs.filter(addonuser__listed=True, authors__in=self.addon.listed_aut...
Return other addons by the author(s) of this addon, optionally takes an app.
src/olympia/addons/models.py
authors_other_addons
thefreakingmind12/addons-server
2
python
def authors_other_addons(self, app=None): '\n Return other addons by the author(s) of this addon,\n optionally takes an app.\n ' qs = Addon.objects.valid().exclude(id=self.addon.id).filter(type=amo.ADDON_PERSONA) return qs.filter(addonuser__listed=True, authors__in=self.addon.listed_aut...
def authors_other_addons(self, app=None): '\n Return other addons by the author(s) of this addon,\n optionally takes an app.\n ' qs = Addon.objects.valid().exclude(id=self.addon.id).filter(type=amo.ADDON_PERSONA) return qs.filter(addonuser__listed=True, authors__in=self.addon.listed_aut...
435338c80705db15bc085f6376335f0c4659a56ebde4678f072b930c4bba4658
@classmethod def increment_for_addon(cls, addon): '\n Increment approval counter for the specified addon, setting the last\n human review date and last content review date to now.\n If an AddonApprovalsCounter already exists, it updates it, otherwise it\n creates and saves a new instance...
Increment approval counter for the specified addon, setting the last human review date and last content review date to now. If an AddonApprovalsCounter already exists, it updates it, otherwise it creates and saves a new instance.
src/olympia/addons/models.py
increment_for_addon
thefreakingmind12/addons-server
2
python
@classmethod def increment_for_addon(cls, addon): '\n Increment approval counter for the specified addon, setting the last\n human review date and last content review date to now.\n If an AddonApprovalsCounter already exists, it updates it, otherwise it\n creates and saves a new instance...
@classmethod def increment_for_addon(cls, addon): '\n Increment approval counter for the specified addon, setting the last\n human review date and last content review date to now.\n If an AddonApprovalsCounter already exists, it updates it, otherwise it\n creates and saves a new instance...
90c0285cf002b2760e71c2084538ab35ea6a1a690d14fcbef794ba76286f75d1
@classmethod def reset_for_addon(cls, addon): '\n Reset the approval counter (but not the dates) for the specified addon.\n ' (obj, created) = cls.objects.update_or_create(addon=addon, defaults={'counter': 0}) return obj
Reset the approval counter (but not the dates) for the specified addon.
src/olympia/addons/models.py
reset_for_addon
thefreakingmind12/addons-server
2
python
@classmethod def reset_for_addon(cls, addon): '\n \n ' (obj, created) = cls.objects.update_or_create(addon=addon, defaults={'counter': 0}) return obj
@classmethod def reset_for_addon(cls, addon): '\n \n ' (obj, created) = cls.objects.update_or_create(addon=addon, defaults={'counter': 0}) return obj<|docstring|>Reset the approval counter (but not the dates) for the specified addon.<|endoftext|>
c3ebd9aafde2de37b1963396cf7b1cbb5f51dd94bc75274e69ee1c74e8f0eaf7
@classmethod def approve_content_for_addon(cls, addon): '\n Set last_content_review for this addon.\n ' (obj, created) = cls.objects.update_or_create(addon=addon, defaults={'last_content_review': datetime.now()}) return obj
Set last_content_review for this addon.
src/olympia/addons/models.py
approve_content_for_addon
thefreakingmind12/addons-server
2
python
@classmethod def approve_content_for_addon(cls, addon): '\n \n ' (obj, created) = cls.objects.update_or_create(addon=addon, defaults={'last_content_review': datetime.now()}) return obj
@classmethod def approve_content_for_addon(cls, addon): '\n \n ' (obj, created) = cls.objects.update_or_create(addon=addon, defaults={'last_content_review': datetime.now()}) return obj<|docstring|>Set last_content_review for this addon.<|endoftext|>
7098d0dcb77970f5b06c54ec9b39a9aef6cf6abe32fe7ae2336c38080511fcda
def to_static_category(self): 'Return the corresponding StaticCategory instance from a Category.' try: staticcategory = CATEGORIES[self.application][self.type][self.slug] except KeyError: staticcategory = None return staticcategory
Return the corresponding StaticCategory instance from a Category.
src/olympia/addons/models.py
to_static_category
thefreakingmind12/addons-server
2
python
def to_static_category(self): try: staticcategory = CATEGORIES[self.application][self.type][self.slug] except KeyError: staticcategory = None return staticcategory
def to_static_category(self): try: staticcategory = CATEGORIES[self.application][self.type][self.slug] except KeyError: staticcategory = None return staticcategory<|docstring|>Return the corresponding StaticCategory instance from a Category.<|endoftext|>
bbccffcd767be5a375bafcf50e785e2d729a0cb12d6f51fb4095f28e6f3b50ca
@classmethod def from_static_category(cls, static_category, save=False): 'Return a Category instance created from a StaticCategory.\n\n Does not save it into the database by default. Useful in tests.' _dict = dict(static_category.__dict__) _dict['db_name'] = _dict.pop('name', None) del _dict['des...
Return a Category instance created from a StaticCategory. Does not save it into the database by default. Useful in tests.
src/olympia/addons/models.py
from_static_category
thefreakingmind12/addons-server
2
python
@classmethod def from_static_category(cls, static_category, save=False): 'Return a Category instance created from a StaticCategory.\n\n Does not save it into the database by default. Useful in tests.' _dict = dict(static_category.__dict__) _dict['db_name'] = _dict.pop('name', None) del _dict['des...
@classmethod def from_static_category(cls, static_category, save=False): 'Return a Category instance created from a StaticCategory.\n\n Does not save it into the database by default. Useful in tests.' _dict = dict(static_category.__dict__) _dict['db_name'] = _dict.pop('name', None) del _dict['des...
b4c04f9a54b6bf307c11ef3516f4cf2d535d32054086e5db87e41101feb7ad2d
def is_hosted(self): 'Am I talking about an add-on on AMO?' return bool(self.addon_id)
Am I talking about an add-on on AMO?
src/olympia/addons/models.py
is_hosted
thefreakingmind12/addons-server
2
python
def is_hosted(self): return bool(self.addon_id)
def is_hosted(self): return bool(self.addon_id)<|docstring|>Am I talking about an add-on on AMO?<|endoftext|>
c3e307e3af520c2a33d125f5de6522d18556a7d904d5912c92822c3b8c84b65b
def collapsed_ranges(self): 'Collapse identical version ranges into one entity.' Range = collections.namedtuple('Range', 'type min max apps') AppRange = collections.namedtuple('AppRange', 'app min max') rv = [] def sort_key(x): return (x.min_version, x.max_version, x.type) for (key, com...
Collapse identical version ranges into one entity.
src/olympia/addons/models.py
collapsed_ranges
thefreakingmind12/addons-server
2
python
def collapsed_ranges(self): Range = collections.namedtuple('Range', 'type min max apps') AppRange = collections.namedtuple('AppRange', 'app min max') rv = [] def sort_key(x): return (x.min_version, x.max_version, x.type) for (key, compats) in sorted_groupby(self.compat_ranges, key=sort...
def collapsed_ranges(self): Range = collections.namedtuple('Range', 'type min max apps') AppRange = collections.namedtuple('AppRange', 'app min max') rv = [] def sort_key(x): return (x.min_version, x.max_version, x.type) for (key, compats) in sorted_groupby(self.compat_ranges, key=sort...
6149088aecce63b9a52c46fe410d6a9b6c37db72a418b619f01cec61e486cb23
def override_type(self): 'This is what Firefox wants to see in the XML output.' return {0: 'compatible', 1: 'incompatible'}[self.type]
This is what Firefox wants to see in the XML output.
src/olympia/addons/models.py
override_type
thefreakingmind12/addons-server
2
python
def override_type(self): return {0: 'compatible', 1: 'incompatible'}[self.type]
def override_type(self): return {0: 'compatible', 1: 'incompatible'}[self.type]<|docstring|>This is what Firefox wants to see in the XML output.<|endoftext|>
4eb4bd99253ef6b1b497bd8fdb51ec06a59c7114412851d4ef8e1f36d1d8a6dd
def create_spiral(r1, r2, N): '\n Creates a "propagating spiral", often used as an easy mitotic-like\n starting conformation.\n\n Run it with r1=10, r2 = 13, N=5000, and see what it does.\n ' Pi = 3.141592 points = [] finished = [False] def rad(phi): return (phi / (2 * Pi)) ...
Creates a "propagating spiral", often used as an easy mitotic-like starting conformation. Run it with r1=10, r2 = 13, N=5000, and see what it does.
polychrom/starting_conformations.py
create_spiral
rusch-emma/polychrom
13
python
def create_spiral(r1, r2, N): '\n Creates a "propagating spiral", often used as an easy mitotic-like\n starting conformation.\n\n Run it with r1=10, r2 = 13, N=5000, and see what it does.\n ' Pi = 3.141592 points = [] finished = [False] def rad(phi): return (phi / (2 * Pi)) ...
def create_spiral(r1, r2, N): '\n Creates a "propagating spiral", often used as an easy mitotic-like\n starting conformation.\n\n Run it with r1=10, r2 = 13, N=5000, and see what it does.\n ' Pi = 3.141592 points = [] finished = [False] def rad(phi): return (phi / (2 * Pi)) ...
8ce409b4cf05d7811380f558cbafcd8be8af65e61c2f5c452fd2da8598d48f38
def create_random_walk(step_size, N): '\n Creates a freely joined chain of length N with step step_size \n ' (theta, u) = _random_points_sphere(N).T dx = ((step_size * np.sqrt((1.0 - (u * u)))) * np.cos(theta)) dy = ((step_size * np.sqrt((1.0 - (u * u)))) * np.sin(theta)) dz = (step_size * u) ...
Creates a freely joined chain of length N with step step_size
polychrom/starting_conformations.py
create_random_walk
rusch-emma/polychrom
13
python
def create_random_walk(step_size, N): '\n \n ' (theta, u) = _random_points_sphere(N).T dx = ((step_size * np.sqrt((1.0 - (u * u)))) * np.cos(theta)) dy = ((step_size * np.sqrt((1.0 - (u * u)))) * np.sin(theta)) dz = (step_size * u) (x, y, z) = (np.cumsum(dx), np.cumsum(dy), np.cumsum(dz))...
def create_random_walk(step_size, N): '\n \n ' (theta, u) = _random_points_sphere(N).T dx = ((step_size * np.sqrt((1.0 - (u * u)))) * np.cos(theta)) dy = ((step_size * np.sqrt((1.0 - (u * u)))) * np.sin(theta)) dz = (step_size * u) (x, y, z) = (np.cumsum(dx), np.cumsum(dy), np.cumsum(dz))...
c04b02360564685097a4a25ca1777fd29d77279b4b0e1dfa0c5bcabb2de0433e
def create_constrained_random_walk(N, constraint_f, starting_point=(0, 0, 0), step_size=1.0): '\n Creates a constrained freely joined chain of length N with step step_size.\n Each step of a random walk is tested with the constraint function and is\n rejected if the tried step lies outside of the constraint...
Creates a constrained freely joined chain of length N with step step_size. Each step of a random walk is tested with the constraint function and is rejected if the tried step lies outside of the constraint. This function is much less efficient than create_random_walk(). Parameters ---------- N : int The number of ...
polychrom/starting_conformations.py
create_constrained_random_walk
rusch-emma/polychrom
13
python
def create_constrained_random_walk(N, constraint_f, starting_point=(0, 0, 0), step_size=1.0): '\n Creates a constrained freely joined chain of length N with step step_size.\n Each step of a random walk is tested with the constraint function and is\n rejected if the tried step lies outside of the constraint...
def create_constrained_random_walk(N, constraint_f, starting_point=(0, 0, 0), step_size=1.0): '\n Creates a constrained freely joined chain of length N with step step_size.\n Each step of a random walk is tested with the constraint function and is\n rejected if the tried step lies outside of the constraint...
d85ce8d5e5f030deff74345515845e3770f424f85bdac4c67b550d36110ff267
def grow_cubic(N, boxSize, method='standard'): '\n This function grows a ring or linear polymer on a cubic lattice \n in the cubic box of size boxSize. \n \n If method=="standard, grows a ring starting with a 4-monomer ring in the middle \n \n if method =="extended", it grows a ring starting with ...
This function grows a ring or linear polymer on a cubic lattice in the cubic box of size boxSize. If method=="standard, grows a ring starting with a 4-monomer ring in the middle if method =="extended", it grows a ring starting with a long ring going from z=0, center of XY face, to z=boxSize center of XY face, and...
polychrom/starting_conformations.py
grow_cubic
rusch-emma/polychrom
13
python
def grow_cubic(N, boxSize, method='standard'): '\n This function grows a ring or linear polymer on a cubic lattice \n in the cubic box of size boxSize. \n \n If method=="standard, grows a ring starting with a 4-monomer ring in the middle \n \n if method =="extended", it grows a ring starting with ...
def grow_cubic(N, boxSize, method='standard'): '\n This function grows a ring or linear polymer on a cubic lattice \n in the cubic box of size boxSize. \n \n If method=="standard, grows a ring starting with a 4-monomer ring in the middle \n \n if method =="extended", it grows a ring starting with ...