This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#MONTHLY PYPI PACKAGE DOWNLOADS | |
SELECT | |
COUNT(*) AS num_downloads, | |
SUBSTR(_TABLE_SUFFIX, 1, 6) AS `day` | |
FROM `the-psf.pypi.downloads*` | |
WHERE | |
file.project = 'mindsdb' | |
-- Only query the last 6 months of history | |
AND _TABLE_SUFFIX | |
BETWEEN FORMAT_DATE( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Pool: | |
'''Manage pool objects''' | |
def __init__(self, size): | |
self._objects = [PoolObject() for i in range(size)] | |
def get_object(self): | |
return self._objects.pop() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Prototype(object): | |
value = 'default' | |
def clone(self, **attrs): | |
"""Clone a prototype and update dictionary""" | |
obj = self.__class__() | |
obj.__dict__.update(attrs) | |
return obj |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Director(): | |
'''Controls creation of final product ''' | |
def __init__(self, builder): | |
self._builder = builder | |
def create_house(self): | |
self._builder.create_new_house() | |
self._builder.add_basement() | |
self._builder.add_rooms() | |
self._builder.add_roof() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Singleton(type): | |
def __init__(cls, name, bases, attrs, **kwargs): | |
super().__init__(name, bases, attrs) | |
cls._instance = None | |
def __call__(cls, *args, **kwargs): | |
if cls._instance is None: | |
cls._instance = super().__call__(*args, **kwargs) | |
return cls._instance |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Borg(object): | |
__shared_state = {} | |
def __init__(self): | |
self.__dict__ = self.__shared_state | |
class Singleton(Borg): | |
pass | |
if __name__ == '__main__': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Car: | |
def drive(self): | |
print("Starting the Car engine!") | |
class Bus: | |
def drive(self): | |
print("Starting the Bus engine!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Car: | |
def __init__(self, name, capacity): | |
self._name = name | |
self._capacity = capacity | |
def drive(self): | |
print("Starting the Car engine!") | |
class Bus: | |
def __init__(self, name, capacity): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gdpr_cc = ["AT", "BE", "BG", "CY", "CH", "CZ", "DE", "DK", "EE", "ES", "FI", "FR", | |
"GB", "GR", "HR", "HU", "IE","IS", "IT","LI", "LT", "LU", "LV", "MT", "NL","NO", | |
"PL", "PT", "RO", "SE", "SI", "SK"] | |
#EU and EFTA Country codes |