<jupyter_start><jupyter_text>COPY ONLY WORKS ON CONTAINERS<jupyter_code>warehouse = list()
warehouse.append({'name': 'Lolly Pop', 'price': 0.4, 'weight': 133})
warehouse.append({'name': 'Licorice', 'price': 0.1, 'weight': 251})
warehouse.append({'name': 'Chocolate', 'price': 1, 'weight': 601})
warehouse.append({'name': 'Sours', 'price': 0.01, 'weight': 513})
warehouse.append({'name': 'Hard candies', 'price': 0.3, 'weight': 433})

print('Source list of candies')
warehouse2 = list()
for item in warehouse:
    warehouse2.append(copy.deepcopy(item))
for item in warehouse2:
    if item['weight'] > 300:
        item['price'] *= .8
warehouse2
import pickle

a_dict = dict()
a_dict['EUR'] = {'code':'Euro', 'symbol': '€'}
a_dict['GBP'] = {'code':'Pounds sterling', 'symbol': '£'}
a_dict['USD'] = {'code':'US dollar', 'symbol': '$'}
a_dict['JPY'] = {'code':'Japanese yen', 'symbol': '¥'}

a_list = ['a', 123, [10, 100, 1000]]

with open('multidata.pckl', 'wb') as file_out:
    pickle.dump(a_dict, file_out)
    pickle.dump(a_list, file_out)

with open('multidata.pckl','rb') as file_in:
    data1 = pickle.load(file_in)
    data2 = pickle.load(file_in)
print(type(data1))
print(data1)
print(type(data2))
print(data2)
# pickles -> bytes = serilization 
# dict of pickled stuff = shelves
for t in (type,list,str):
    print(type(t))
type.__class__
dir(type)
type.__subclasses__(type)
class Class():
    pass
Class.__class__
Class.__bases__
Class.__dict__
Class.__name__
bool.__class__
object.__class__
type.__class__
class Dog():
    pass
dog = Dog()
Dog.__name__ = 'do'
Dog.__name__
Dog.__name__
do
Dog = type('Dog',(),{'age':2})
Dog.__bases__
dog = Dog()
dog.age
def greeting(self):
    return 'hello how are you?'
class MetaClass(type):
    def __new__(mcs,name,bases,dictionary):
        if 'greeting' not in dictionary:
            dictionary['greeting'] = greeting
        obj = super().__new__(mcs,name,bases,dictionary)
        return obj
class MyClass(metaclass=MetaClass):
    pass
class OtherClass(metaclass=MetaClass):
    def greeting(self):
        return 'new thing'
thing = MyClass()
thing.greeting()
otherthing = OtherClass()
otherthing.greeting()
from datetime import datetime
def get_time():
    return datetime.now()
def get_instantiation(self):
    return self.instantiation_time
class Metaclass(type):
    def __new__(mcs,name,bases,dictionary):
        dictionary['instantiation_time'] = get_time()
        dictionary['get_instantiation_time'] = get_instantiation  
        obj = super().__new__(mcs,name,bases,dictionary)
        return obj
class myClass(metaclass=Metaclass):
    pass
myobject = myClass()
myobject.get_instantiation_time()
myClass.__help__()
myobject.help()
class Thing():
    Thing.y = 'z'
    def __init__(self):
        self.x = 'y'
thing = Thing()
getattr(Thing,'y')
setattr(thing,'123',123)
hasattr(Thing,'y')
Thing.__dict__
isinstance(thing,Thing)
class MyMeta(type):
    def __new__(mcs,name,bases,dictionary):
        obj = super().__new__(mcs,name,bases,dictionary)
        return obj
class Mything(metaclass=MyMeta):
    def __init__(self):
        pass
class Mynewthing(Mything):
    def __init__(self):
        super().__init__()
mything = Mything()
issubclass(Mynewthing,Mything)
int.__dict__
3.sub()
class MyInt(int):
    def __init__(self):
        super().__init__()
    def __eq__(self,num):
        return not super().__eq__(num)
x = MyInt()
x == x
dir(10)
int.__dict__
y = 0xee1
int(y)
oct(12)
y = 0x1000000000
for x in range(10):
    y = int(str(y)[2:])
    y = hex(y)
    print(y)
class MyInt(int):
    def __init__(self):
        super().__init__()
    def __add__(self,num):
        return super().__add__(num) + 348917256034
    
x = MyInt()
x + 10
x = x + 100123123
x
x + 1
a = 1
a.__add__(123)
import shelve
with shelve.open('spam') as db:
    db['eggs'] = 'eggs'
l = [0,1,2,3,4,5]
print(l[-2:-1])
1%2
None + None
5 + 7 * 8
v = []
l = v[:]
l.append(1)
v
for x in range(-2,1):
    print(x)
v = 1
while v < 10:
    print(v)
    v = v << 1
v = 1
if v == 1:
    continue
    print('something')
0 or 0<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1652003910068426, 'fraction_numerical': 0.03201368523949169, 'mean_word_length': 4.187579214195184, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '14046', 'license': 'MIT', 'n_tokens_mistral': 1631, 'n_tokens_neox': 1518, 'n_words': 358, 'path': 'PCPP301/PCPP301.1.ipynb', 'repo_name': 'jkohhokj/Games', 'size': '4092'}