this repo has no description
1/* Copyright (c) Facebook, Inc. and its affiliates. (http://www.facebook.com) */
2#pragma once
3
4#include "globals.h"
5#include "handles-decl.h"
6#include "objects.h"
7#include "symbols.h"
8
9namespace py {
10
11class Thread;
12
13// Look up the value of ValueCell associated with key in module with
14// consideration of placeholders created for caching.
15RawObject moduleAt(const Module& module, const Object& name);
16// Same as moduleAt but with SymbolId as key.
17RawObject moduleAtById(Thread* thread, const Module& module, SymbolId id);
18// Same as moduleAtById but returns the underlying ValueCell.
19RawObject moduleValueCellAtById(Thread* thread, const Module& module,
20 SymbolId id);
21// Same as moduleAt but returns the underlying ValueCell.
22RawObject moduleValueCellAt(Thread* thread, const Module& module,
23 const Object& name);
24
25// Associate name with value in module.
26RawObject moduleAtPut(Thread* thread, const Module& module, const Object& name,
27 const Object& value);
28// Associate name with value in module.
29RawObject moduleAtPutByCStr(Thread* thread, const Module& module,
30 const char* name_cstr, const Object& value);
31// Associate id with value in module.
32RawObject moduleAtPutById(Thread* thread, const Module& module, SymbolId id,
33 const Object& value);
34
35RawObject moduleDeleteAttribute(Thread* thread, const Module& receiver,
36 const Object& name);
37
38RawObject moduleInit(Thread* thread, const Module& module, const Object& name);
39
40// Returns keys associated with non-placeholder ValueCells in `module`.
41RawObject moduleKeys(Thread* thread, const Module& module);
42
43// Returns the number of keys associated with non-placeholder ValueCells.
44word moduleLen(Thread* thread, const Module& module);
45
46// Remove the ValueCell associcated with key in module_dict.
47RawObject moduleRemove(Thread* thread, const Module& module,
48 const Object& name);
49
50// Returns the list of values contained in non-placeholder ValueCells.
51RawObject moduleValues(Thread* thread, const Module& module);
52
53RawObject moduleGetAttribute(Thread* thread, const Module& module,
54 const Object& name);
55
56RawObject moduleGetAttributeSetLocation(Thread* thread, const Module& module,
57 const Object& name,
58 Object* location_out);
59
60RawObject moduleRaiseAttributeError(Thread* thread, const Module& module,
61 const Object& name);
62
63RawObject moduleSetAttr(Thread* thread, const Module& module,
64 const Object& name, const Object& value);
65
66void initializeModuleType(Thread* thread);
67
68} // namespace py