schrodinger.utils.license module

Contains a class License that allows easy licensing of Python scripts

It is a violation of your software license agreement to modify the code in this module in any way.

Copyright Schrodinger, LLC. All rights reserved.

class schrodinger.utils.license.License(license_type, num_tokens=1, version=None, force=False)

Bases: object

Class to allow easy licensing of Python scripts

It is a violation of your software license to modify this class in any way.

__init__(license_type, num_tokens=1, version=None, force=False)

Create a License object. License objects should be assigned to a variable that stays in scope for the duration the license token should be held. The accepted way to return a license token is by calling the checkin method of the license object, but the token will also be returned when the object is garbage collected.

Parameters:
  • license_type (module-level constant) – Module-level constant such as BIOLUMINATE_MAIN, BIOLUMINATE_SHARED, BIOLUMINATE_PROTEIN_DOCKING, MATERIALSCIENCE_MAIN
  • num_tokens (int) – The number of tokens to check out
  • version (int) – An integer value representing the product version. This is ten times the decimal value with the tenths digit, i.e. 93 for version 9.3. If not provided, the license type is looked up in the module constant DEFAULT_VERSIONS dictionary and that version is used. If license_type is not found in DEFAULT_VERSIONS, the module constant DEFAULT_GENERIC_VERSION is used.
  • force (bool) – For the attempted checkout of the license even if license_type is not recognized by this class. If checkout is unsuccessful, no error will be raised, but self.license will be None
__str__()

Create an informative string to print in debugging messages

isValid()

Check if the license is currently valid

checkin()

Return the license token. After calling this method, the License object will report itself as invalid.

__enter__()
__exit__(etype, evalue, etrace)

Return the license token when leaving a ‘with’ statement

__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.utils.license', '__doc__': '\n Class to allow easy licensing of Python scripts\n\n It is a violation of your software license to modify this class in any way.\n ', '__init__': <function License.__init__>, '__str__': <function License.__str__>, 'isValid': <function License.isValid>, 'checkin': <function License.checkin>, '__enter__': <function License.__enter__>, '__exit__': <function License.__exit__>, '__dict__': <attribute '__dict__' of 'License' objects>, '__weakref__': <attribute '__weakref__' of 'License' objects>})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.utils.license'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

schrodinger.utils.license.is_license_available(license_type)
schrodinger.utils.license.is_opls2_available()

Returns TRUE if opls2 is available