uid
stringlengths
24
24
split
stringclasses
1 value
category
stringclasses
2 values
content
stringlengths
5
482k
signature
stringlengths
1
14k
suffix
stringlengths
1
482k
prefix
stringlengths
9
14k
prefix_token_count
int64
3
5.01k
prefix_token_budget
int64
64
256
element_token_count
int64
1
292k
signature_token_count
int64
1
5.01k
prefix_context_token_count
int64
0
255
repo
stringlengths
7
112
path
stringlengths
4
208
language
stringclasses
1 value
name
stringlengths
1
218
qualname
stringlengths
1
218
start_line
int64
1
26.7k
end_line
int64
1
26.7k
signature_start_line
int64
1
26.7k
signature_end_line
int64
1
26.7k
source_hash
stringlengths
40
40
source_dataset
stringclasses
1 value
source_split
stringclasses
1 value
ac562e309960ace5b8f495eb
train
class
class QUAD(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.DoNotUseThisField = v_uint64()
class QUAD(vstruct.VStruct):
def __init__(self): vstruct.VStruct.__init__(self) self.DoNotUseThisField = v_uint64()
KD_READ_MEMORY32(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.TargetBaseAddress = v_uint32() self.TransferCount = v_uint32() self.ActualBytesRead = v_uint32() class QUAD(vstruct.VStruct):
64
64
37
8
56
cmaruti/vivisect
vstruct/defs/windows/win_5_1_i386/ntoskrnl.py
Python
QUAD
QUAD
7,011
7,014
7,011
7,011
5aa581aee07266b01b5c18992a51b35d4d726827
bigcode/the-stack
train
9f399210318491a0cb54092d
train
class
class PORT_MESSAGE(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.u1 = _unnamed_15734() self.u2 = _unnamed_15735() self.ClientId = CLIENT_ID() self.MessageId = v_uint32() self.ClientViewSize = v_uint32()
class PORT_MESSAGE(vstruct.VStruct):
def __init__(self): vstruct.VStruct.__init__(self) self.u1 = _unnamed_15734() self.u2 = _unnamed_15735() self.ClientId = CLIENT_ID() self.MessageId = v_uint32() self.ClientViewSize = v_uint32()
self.InterfaceReference = v_ptr32() self.InterfaceDereference = v_ptr32() self.ReadConfig = v_ptr32() self.WriteConfig = v_ptr32() self.PinToLine = v_ptr32() self.LineToPin = v_ptr32() class PORT_MESSAGE(vstruct.VStruct):
64
64
76
8
56
cmaruti/vivisect
vstruct/defs/windows/win_5_1_i386/ntoskrnl.py
Python
PORT_MESSAGE
PORT_MESSAGE
4,443
4,450
4,443
4,443
f9e51daeb77f14f871a343aab15e6550bbda7e9d
bigcode/the-stack
train
e566eac735f6c4a5b539a6c3
train
class
class OBJECT_HEADER(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.PointerCount = v_uint32() self.HandleCount = v_uint32() self.Type = v_ptr32() self.NameInfoOffset = v_uint8() self.HandleInfoOffset = v_uint8() self.QuotaInfoOffset =...
class OBJECT_HEADER(vstruct.VStruct):
def __init__(self): vstruct.VStruct.__init__(self) self.PointerCount = v_uint32() self.HandleCount = v_uint32() self.Type = v_ptr32() self.NameInfoOffset = v_uint8() self.HandleInfoOffset = v_uint8() self.QuotaInfoOffset = v_uint8() self.Flags = v_uint...
v_ptr32() self.Segment = v_ptr32() class LUID(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.LowPart = v_uint32() self.HighPart = v_uint32() class OBJECT_HEADER(vstruct.VStruct):
64
64
116
8
56
cmaruti/vivisect
vstruct/defs/windows/win_5_1_i386/ntoskrnl.py
Python
OBJECT_HEADER
OBJECT_HEADER
3,696
3,708
3,696
3,696
f4436a70976c85f93bc2f0d5354d27f879138619
bigcode/the-stack
train
f0c8190d9a2ed067196f7187
train
class
class IA64_DBGKD_CONTROL_SET(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.Continue = v_uint32() self.CurrentSymbolStart = v_uint64() self.CurrentSymbolEnd = v_uint64()
class IA64_DBGKD_CONTROL_SET(vstruct.VStruct):
def __init__(self): vstruct.VStruct.__init__(self) self.Continue = v_uint32() self.CurrentSymbolStart = v_uint64() self.CurrentSymbolEnd = v_uint64()
.KeyCell = v_uint32() self.KeyHive = v_ptr32() class MMSECTION_FLAGS(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.BeingDeleted = v_uint32() class IA64_DBGKD_CONTROL_SET(vstruct.VStruct):
64
64
58
12
52
cmaruti/vivisect
vstruct/defs/windows/win_5_1_i386/ntoskrnl.py
Python
IA64_DBGKD_CONTROL_SET
IA64_DBGKD_CONTROL_SET
1,565
1,570
1,565
1,565
2fe0bd57732837b64ef72f83416ab51e6516a3aa
bigcode/the-stack
train
d155ed4f61958e79672f7169
train
class
class SECURITY_TOKEN_PROXY_DATA(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.Length = v_uint32() self.ProxyClass = v_uint32() self.PathInfo = UNICODE_STRING() self.ContainerMask = v_uint32() self.ObjectMask = v_uint32()
class SECURITY_TOKEN_PROXY_DATA(vstruct.VStruct):
def __init__(self): vstruct.VStruct.__init__(self) self.Length = v_uint32() self.ProxyClass = v_uint32() self.PathInfo = UNICODE_STRING() self.ContainerMask = v_uint32() self.ObjectMask = v_uint32()
def __init__(self): vstruct.VStruct.__init__(self) self.Flags = v_uint32() self.NextCookieSequenceNumber = v_uint32() self.ActiveFrame = v_ptr32() self.FrameListCache = LIST_ENTRY() class SECURITY_TOKEN_PROXY_DATA(vstruct.VStruct):
64
64
71
10
54
cmaruti/vivisect
vstruct/defs/windows/win_5_1_i386/ntoskrnl.py
Python
SECURITY_TOKEN_PROXY_DATA
SECURITY_TOKEN_PROXY_DATA
6,820
6,827
6,820
6,820
edacf9dff877b7b7099a58c6d9b873eb86fed688
bigcode/the-stack
train
362632ca5b9a5f59d7277c57
train
class
class _unnamed_16631(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.NotificationStructure = v_ptr32() self.DeviceIds = vstruct.VArray([ v_uint16() for i in xrange(1) ]) self._pad0008 = v_bytes(size=2)
class _unnamed_16631(vstruct.VStruct):
def __init__(self): vstruct.VStruct.__init__(self) self.NotificationStructure = v_ptr32() self.DeviceIds = vstruct.VArray([ v_uint16() for i in xrange(1) ]) self._pad0008 = v_bytes(size=2)
struct.VStruct.__init__(self) self.Notification = v_ptr32() class EX_RUNDOWN_REF(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.Count = v_uint32() class _unnamed_16631(vstruct.VStruct):
64
64
73
12
52
cmaruti/vivisect
vstruct/defs/windows/win_5_1_i386/ntoskrnl.py
Python
_unnamed_16631
_unnamed_16631
6,857
6,862
6,857
6,857
0d0072e8064a166f92d56af684c6fab99fb701bb
bigcode/the-stack
train
8da79bc9e4349013c103962f
train
class
class PCI_COMMON_CONFIG(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.VendorID = v_uint16() self.DeviceID = v_uint16() self.Command = v_uint16() self.Status = v_uint16() self.RevisionID = v_uint8() self.ProgIf = v_uint8() se...
class PCI_COMMON_CONFIG(vstruct.VStruct):
def __init__(self): vstruct.VStruct.__init__(self) self.VendorID = v_uint16() self.DeviceID = v_uint16() self.Command = v_uint16() self.Status = v_uint16() self.RevisionID = v_uint8() self.ProgIf = v_uint8() self.SubClass = v_uint8() self.BaseC...
.ClientViewSize = v_uint32() class _unnamed_16385(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.Type = v_uint16() self.DataInfoOffset = v_uint16() class PCI_COMMON_CONFIG(vstruct.VStruct):
64
64
170
9
55
cmaruti/vivisect
vstruct/defs/windows/win_5_1_i386/ntoskrnl.py
Python
PCI_COMMON_CONFIG
PCI_COMMON_CONFIG
4,460
4,476
4,460
4,460
a863e7c0aefa40b827b1a466135a4cda95932884
bigcode/the-stack
train
ca14065ed7742835c9d08e5e
train
class
class DEFERRED_WRITE(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.NodeTypeCode = v_uint16() self.NodeByteSize = v_uint16() self.FileObject = v_ptr32() self.BytesToWrite = v_uint32() self.DeferredWriteLinks = LIST_ENTRY() self.Event...
class DEFERRED_WRITE(vstruct.VStruct):
def __init__(self): vstruct.VStruct.__init__(self) self.NodeTypeCode = v_uint16() self.NodeByteSize = v_uint16() self.FileObject = v_ptr32() self.BytesToWrite = v_uint32() self.DeferredWriteLinks = LIST_ENTRY() self.Event = v_ptr32() self.PostRoutine =...
v_uint32() self.PagesProcessed = v_uint32() self.BytesCopied = v_uint32() self.DumpCount = v_uint32() self.FileRuns = v_uint32() self._pad0048 = v_bytes(size=4) class DEFERRED_WRITE(vstruct.VStruct):
64
64
135
10
54
cmaruti/vivisect
vstruct/defs/windows/win_5_1_i386/ntoskrnl.py
Python
DEFERRED_WRITE
DEFERRED_WRITE
5,323
5,336
5,323
5,323
34436aa29a81c42f55be5c887193af43302edb26
bigcode/the-stack
train
c7c8abe8137f1a75e3f9a14f
train
class
class DISPATCHER_HEADER(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.Type = v_uint8() self.Absolute = v_uint8() self.Size = v_uint8() self.Inserted = v_uint8() self.SignalState = v_uint32() self.WaitListHead = LIST_ENTRY()
class DISPATCHER_HEADER(vstruct.VStruct):
def __init__(self): vstruct.VStruct.__init__(self) self.Type = v_uint8() self.Absolute = v_uint8() self.Size = v_uint8() self.Inserted = v_uint8() self.SignalState = v_uint32() self.WaitListHead = LIST_ENTRY()
) class MMCOLOR_TABLES(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.Flink = v_uint32() self.Blink = v_ptr32() self.Count = v_uint32() class DISPATCHER_HEADER(vstruct.VStruct):
64
64
78
10
54
cmaruti/vivisect
vstruct/defs/windows/win_5_1_i386/ntoskrnl.py
Python
DISPATCHER_HEADER
DISPATCHER_HEADER
3,421
3,429
3,421
3,421
ca96b6baaaf23df12e39897c1c8f831ddb204fb7
bigcode/the-stack
train
53d7b4ae91c515e241956d1b
train
class
class ETHREAD(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.Tcb = KTHREAD() self.CreateTime = LARGE_INTEGER() self.ExitTime = LARGE_INTEGER() self.ExitStatus = v_uint32() self.PostBlockList = LIST_ENTRY() self.TerminationPort = v_pt...
class ETHREAD(vstruct.VStruct):
def __init__(self): vstruct.VStruct.__init__(self) self.Tcb = KTHREAD() self.CreateTime = LARGE_INTEGER() self.ExitTime = LARGE_INTEGER() self.ExitStatus = v_uint32() self.PostBlockList = LIST_ENTRY() self.TerminationPort = v_ptr32() self.ActiveTimerLi...
.VStruct.__init__(self) self.ControlArea = v_ptr32() self.u = _unnamed_12531() self.StartingSector = v_uint32() self.NumberOfFullSectors = v_uint32() self.SubsectionBase = v_ptr32() self.UnusedPtes = v_uint32() self.PtesInSubsection = v_uint32() self.NextS...
100
100
335
8
92
cmaruti/vivisect
vstruct/defs/windows/win_5_1_i386/ntoskrnl.py
Python
ETHREAD
ETHREAD
4,268
4,300
4,268
4,268
42ed7472835789922c79ec7cd30cb72475c3c3e2
bigcode/the-stack
train
8dd76fe3e00147f534ab689c
train
class
class PCI_HEADER_TYPE_0(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.BaseAddresses = vstruct.VArray([ v_uint32() for i in xrange(6) ]) self.CIS = v_uint32() self.SubVendorID = v_uint16() self.SubSystemID = v_uint16() self.ROMBaseAddress = ...
class PCI_HEADER_TYPE_0(vstruct.VStruct):
def __init__(self): vstruct.VStruct.__init__(self) self.BaseAddresses = vstruct.VArray([ v_uint32() for i in xrange(6) ]) self.CIS = v_uint32() self.SubVendorID = v_uint16() self.SubSystemID = v_uint16() self.ROMBaseAddress = v_uint32() self.CapabilitiesPtr = ...
v_uint8() for i in xrange(3) ]) self.ROMBaseAddress = v_uint32() self.InterruptLine = v_uint8() self.InterruptPin = v_uint8() self.BridgeControl = v_uint16() class PCI_HEADER_TYPE_0(vstruct.VStruct):
64
64
171
11
53
cmaruti/vivisect
vstruct/defs/windows/win_5_1_i386/ntoskrnl.py
Python
PCI_HEADER_TYPE_0
PCI_HEADER_TYPE_0
3,762
3,776
3,762
3,762
451063392814b607258bf6b2fb26b842bd7a27e8
bigcode/the-stack
train
2550384834855baa4a7bb74a
train
class
class KLOCK_QUEUE_HANDLE(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.LockQueue = KSPIN_LOCK_QUEUE() self.OldIrql = v_uint8() self._pad000c = v_bytes(size=3)
class KLOCK_QUEUE_HANDLE(vstruct.VStruct):
def __init__(self): vstruct.VStruct.__init__(self) self.LockQueue = KSPIN_LOCK_QUEUE() self.OldIrql = v_uint8() self._pad000c = v_bytes(size=3)
) class _unnamed_11794(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.ReadMemory = DBGKD_READ_MEMORY64() self._pad0028 = v_bytes(size=24) class KLOCK_QUEUE_HANDLE(vstruct.VStruct):
64
64
62
10
54
cmaruti/vivisect
vstruct/defs/windows/win_5_1_i386/ntoskrnl.py
Python
KLOCK_QUEUE_HANDLE
KLOCK_QUEUE_HANDLE
1,715
1,720
1,715
1,715
8812feecb48209ff4237262111c350a2bce89460
bigcode/the-stack
train
f931d69bb4108e168a448324
train
class
class WMI_LOGGER_MODE(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.SequentialFile = v_uint32()
class WMI_LOGGER_MODE(vstruct.VStruct):
def __init__(self): vstruct.VStruct.__init__(self) self.SequentialFile = v_uint32()
self.DataOffset = v_uint32() self.DataSelector = v_uint32() self.RegisterArea = vstruct.VArray([ v_uint8() for i in xrange(80) ]) self.Cr0NpxState = v_uint32() class WMI_LOGGER_MODE(vstruct.VStruct):
64
64
37
11
53
cmaruti/vivisect
vstruct/defs/windows/win_5_1_i386/ntoskrnl.py
Python
WMI_LOGGER_MODE
WMI_LOGGER_MODE
2,440
2,443
2,440
2,440
6cbafa192ed9934de9bf3bfe4cb4a3f20e7c2d96
bigcode/the-stack
train
d9011ecf85b6fc872fa82563
train
class
class PO_DEVICE_NOTIFY_ORDER(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.DevNodeSequence = v_uint32() self.WarmEjectPdoPointer = v_ptr32() self.OrderLevel = vstruct.VArray([ PO_NOTIFY_ORDER_LEVEL() for i in xrange(8) ])
class PO_DEVICE_NOTIFY_ORDER(vstruct.VStruct):
def __init__(self): vstruct.VStruct.__init__(self) self.DevNodeSequence = v_uint32() self.WarmEjectPdoPointer = v_ptr32() self.OrderLevel = vstruct.VArray([ PO_NOTIFY_ORDER_LEVEL() for i in xrange(8) ])
KSYSTEM_TIME(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.LowPart = v_uint32() self.High1Time = v_uint32() self.High2Time = v_uint32() class PO_DEVICE_NOTIFY_ORDER(vstruct.VStruct):
64
64
74
10
54
cmaruti/vivisect
vstruct/defs/windows/win_5_1_i386/ntoskrnl.py
Python
PO_DEVICE_NOTIFY_ORDER
PO_DEVICE_NOTIFY_ORDER
2,411
2,416
2,411
2,411
122a715bce6014e8a63a4a68a8f57addbbc6e9b8
bigcode/the-stack
train
4c85f2fba12be8011f6bf5a8
train
class
class _unnamed_12916(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.LegacyDeviceNode = v_ptr32()
class _unnamed_12916(vstruct.VStruct):
def __init__(self): vstruct.VStruct.__init__(self) self.LegacyDeviceNode = v_ptr32()
() self.u = _unnamed_14532() class _unnamed_12917(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.NextResourceDeviceNode = v_ptr32() class _unnamed_12916(vstruct.VStruct):
64
64
40
12
52
cmaruti/vivisect
vstruct/defs/windows/win_5_1_i386/ntoskrnl.py
Python
_unnamed_12916
_unnamed_12916
4,181
4,184
4,181
4,181
ad5f287107004566b6a2536a350c3006c38a17f1
bigcode/the-stack
train
2d2960b1f387683fb10331e7
train
class
class _unnamed_14411(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.PrimaryBus = v_uint8() self.SecondaryBus = v_uint8() self.SubordinateBus = v_uint8() self.SubtractiveDecode = v_uint8()
class _unnamed_14411(vstruct.VStruct):
def __init__(self): vstruct.VStruct.__init__(self) self.PrimaryBus = v_uint8() self.SecondaryBus = v_uint8() self.SubordinateBus = v_uint8() self.SubtractiveDecode = v_uint8()
class _unnamed_14410(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.Spare = vstruct.VArray([ v_uint8() for i in xrange(4) ]) class _unnamed_14411(vstruct.VStruct):
63
64
68
12
51
cmaruti/vivisect
vstruct/defs/windows/win_5_1_i386/ntoskrnl.py
Python
_unnamed_14411
_unnamed_14411
7,266
7,272
7,266
7,266
3fd5d58f676faf3aaf3369933766296971bd0d33
bigcode/the-stack
train
e5cbc3f2524752619fef2e42
train
class
class IMAGE_DOS_HEADER(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.e_magic = v_uint16() self.e_cblp = v_uint16() self.e_cp = v_uint16() self.e_crlc = v_uint16() self.e_cparhdr = v_uint16() self.e_minalloc = v_uint16() self...
class IMAGE_DOS_HEADER(vstruct.VStruct):
def __init__(self): vstruct.VStruct.__init__(self) self.e_magic = v_uint16() self.e_cblp = v_uint16() self.e_cp = v_uint16() self.e_crlc = v_uint16() self.e_cparhdr = v_uint16() self.e_minalloc = v_uint16() self.e_maxalloc = v_uint16() self.e_s...
self.type0 = _unnamed_14410() class CM_BIG_DATA(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.Signature = v_uint16() self.Count = v_uint16() self.List = v_uint32() class IMAGE_DOS_HEADER(vstruct.VStruct):
72
72
243
10
62
cmaruti/vivisect
vstruct/defs/windows/win_5_1_i386/ntoskrnl.py
Python
IMAGE_DOS_HEADER
IMAGE_DOS_HEADER
6,896
6,917
6,896
6,896
974b9a8ac79f76cc7b6232a0e98ad47cd23e7ef8
bigcode/the-stack
train
29dae5d6c7e3e1e923787257
train
class
class SID(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.Revision = v_uint8() self.SubAuthorityCount = v_uint8() self.IdentifierAuthority = SID_IDENTIFIER_AUTHORITY() self.SubAuthority = vstruct.VArray([ v_uint32() for i in xrange(1) ])
class SID(vstruct.VStruct):
def __init__(self): vstruct.VStruct.__init__(self) self.Revision = v_uint8() self.SubAuthorityCount = v_uint8() self.IdentifierAuthority = SID_IDENTIFIER_AUTHORITY() self.SubAuthority = vstruct.VArray([ v_uint32() for i in xrange(1) ])
() self.SmallDir = v_ptr32() self.Guard = v_uint32() self.FreeDisplay = vstruct.VArray([ RTL_BITMAP() for i in xrange(24) ]) self.FreeSummary = v_uint32() self.FreeBins = LIST_ENTRY() class SID(vstruct.VStruct):
64
64
75
7
57
cmaruti/vivisect
vstruct/defs/windows/win_5_1_i386/ntoskrnl.py
Python
SID
SID
616
622
616
616
d3789d6add746f2d4e64e4ec777e2e6ce301e075
bigcode/the-stack
train
5d388f2057a2c953d8d1484a
train
class
class DBGKD_WRITE_MEMORY64(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.TargetBaseAddress = v_uint64() self.TransferCount = v_uint32() self.ActualBytesWritten = v_uint32()
class DBGKD_WRITE_MEMORY64(vstruct.VStruct):
def __init__(self): vstruct.VStruct.__init__(self) self.TargetBaseAddress = v_uint64() self.TransferCount = v_uint32() self.ActualBytesWritten = v_uint32()
(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.InterfaceType = v_uint32() self.BusNumber = v_uint32() self.PartialResourceList = CM_PARTIAL_RESOURCE_LIST() class DBGKD_WRITE_MEMORY64(vstruct.VStruct):
64
64
58
11
53
cmaruti/vivisect
vstruct/defs/windows/win_5_1_i386/ntoskrnl.py
Python
DBGKD_WRITE_MEMORY64
DBGKD_WRITE_MEMORY64
2,141
2,146
2,141
2,141
2c7ab50f8aebebf8171324d23bd7d83a270b78ac
bigcode/the-stack
train
095f83f05c9a082aaa256bb7
train
class
class MMPTE(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.u = _unnamed_11597()
class MMPTE(vstruct.VStruct):
def __init__(self): vstruct.VStruct.__init__(self) self.u = _unnamed_11597()
= v_uint32() self.ExceptionRecord = v_ptr32() self.ExceptionAddress = v_ptr32() self.NumberParameters = v_uint32() self.ExceptionInformation = vstruct.VArray([ v_uint32() for i in xrange(15) ]) class MMPTE(vstruct.VStruct):
63
64
37
9
54
cmaruti/vivisect
vstruct/defs/windows/win_5_1_i386/ntoskrnl.py
Python
MMPTE
MMPTE
6,014
6,017
6,014
6,014
04b9f685b3a1efa3db9192d853d001a088242c85
bigcode/the-stack
train
919f4c95978f1ff340cd378a
train
class
class MMSUBSECTION_FLAGS(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.ReadOnly = v_uint32()
class MMSUBSECTION_FLAGS(vstruct.VStruct):
def __init__(self): vstruct.VStruct.__init__(self) self.ReadOnly = v_uint32()
class WMI_CLIENT_CONTEXT(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.ProcessorNumber = v_uint8() self.Alignment = v_uint8() self.LoggerId = v_uint16() class MMSUBSECTION_FLAGS(vstruct.VStruct):
64
64
36
10
54
cmaruti/vivisect
vstruct/defs/windows/win_5_1_i386/ntoskrnl.py
Python
MMSUBSECTION_FLAGS
MMSUBSECTION_FLAGS
6,242
6,245
6,242
6,242
4eadad635a95f7b7499f68e7f8171e11876793a6
bigcode/the-stack
train
376653872191860510387736
train
class
class MMWSLE_HASH(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.Key = v_ptr32() self.Index = v_uint32()
class MMWSLE_HASH(vstruct.VStruct):
def __init__(self): vstruct.VStruct.__init__(self) self.Key = v_ptr32() self.Index = v_uint32()
LARGE_INTEGER() self.Waiters = v_uint32() self.Busy = v_uint32() self.LastLock = v_ptr32() self.Lock = KEVENT() self.Event = KEVENT() self.CompletionContext = v_ptr32() class MMWSLE_HASH(vstruct.VStruct):
64
64
43
10
54
cmaruti/vivisect
vstruct/defs/windows/win_5_1_i386/ntoskrnl.py
Python
MMWSLE_HASH
MMWSLE_HASH
6,470
6,474
6,470
6,470
e238e7fbf74faa0d4f4ef0c971e1f7d813ada45a
bigcode/the-stack
train
69273c02c3955c1d37e199f0
train
class
class IO_RESOURCE_REQUIREMENTS_LIST(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.ListSize = v_uint32() self.InterfaceType = v_uint32() self.BusNumber = v_uint32() self.SlotNumber = v_uint32() self.Reserved = vstruct.VArray([ v_uint32() for...
class IO_RESOURCE_REQUIREMENTS_LIST(vstruct.VStruct):
def __init__(self): vstruct.VStruct.__init__(self) self.ListSize = v_uint32() self.InterfaceType = v_uint32() self.BusNumber = v_uint32() self.SlotNumber = v_uint32() self.Reserved = vstruct.VArray([ v_uint32() for i in xrange(3) ]) self.AlternativeLists = v_u...
Array([ RTL_DRIVE_LETTER_CURDIR() for i in xrange(32) ]) class u(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.KeyNode = CM_KEY_NODE() class IO_RESOURCE_REQUIREMENTS_LIST(vstruct.VStruct):
64
64
118
11
53
cmaruti/vivisect
vstruct/defs/windows/win_5_1_i386/ntoskrnl.py
Python
IO_RESOURCE_REQUIREMENTS_LIST
IO_RESOURCE_REQUIREMENTS_LIST
7,397
7,406
7,397
7,397
de55f2762399ab81e77fc562b5a61d174b33800b
bigcode/the-stack
train
9419893458d666899e84b255
train
class
class DRIVER_EXTENSION(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.DriverObject = v_ptr32() self.AddDevice = v_ptr32() self.Count = v_uint32() self.ServiceKeyName = UNICODE_STRING() self.ClientDriverExtension = v_ptr32() self.FsFi...
class DRIVER_EXTENSION(vstruct.VStruct):
def __init__(self): vstruct.VStruct.__init__(self) self.DriverObject = v_ptr32() self.AddDevice = v_ptr32() self.Count = v_uint32() self.ServiceKeyName = UNICODE_STRING() self.ClientDriverExtension = v_ptr32() self.FsFilterCallbacks = v_ptr32()
init__(self): vstruct.VStruct.__init__(self) self.PhysicalDeviceObject = v_ptr32() self.ConflictingResource = v_ptr32() self.ConflictCount = v_ptr32() self.Conflicts = v_ptr32() class DRIVER_EXTENSION(vstruct.VStruct):
64
64
82
8
56
cmaruti/vivisect
vstruct/defs/windows/win_5_1_i386/ntoskrnl.py
Python
DRIVER_EXTENSION
DRIVER_EXTENSION
5,810
5,818
5,810
5,810
b01c78e3c9a3d876eddf271d7536371e2cc92fa0
bigcode/the-stack
train
c2a8ad9193c426480f79e647
train
class
class LIST_ENTRY32(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.Flink = v_uint32() self.Blink = v_uint32()
class LIST_ENTRY32(vstruct.VStruct):
def __init__(self): vstruct.VStruct.__init__(self) self.Flink = v_uint32() self.Blink = v_uint32()
xrange(1) ]) self._pad0018 = v_bytes(size=2) class MMVAD_FLAGS2(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.FileOffset = v_uint32() class LIST_ENTRY32(vstruct.VStruct):
64
64
44
9
55
cmaruti/vivisect
vstruct/defs/windows/win_5_1_i386/ntoskrnl.py
Python
LIST_ENTRY32
LIST_ENTRY32
3,937
3,941
3,937
3,937
a9c7acb150481755a74118c4588f9e766407cd8a
bigcode/the-stack
train
0523841cbbaeee151fd98e6e
train
class
class IMAGE_FILE_HEADER(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.Machine = v_uint16() self.NumberOfSections = v_uint16() self.TimeDateStamp = v_uint32() self.PointerToSymbolTable = v_uint32() self.NumberOfSymbols = v_uint32() s...
class IMAGE_FILE_HEADER(vstruct.VStruct):
def __init__(self): vstruct.VStruct.__init__(self) self.Machine = v_uint16() self.NumberOfSections = v_uint16() self.TimeDateStamp = v_uint32() self.PointerToSymbolTable = v_uint32() self.NumberOfSymbols = v_uint32() self.SizeOfOptionalHeader = v_uint16() ...
pare1 = v_uint8() self._pad00dc = v_bytes(size=3) self.KernelReserved2 = vstruct.VArray([ v_uint32() for i in xrange(17) ]) self.PrcbData = KPRCB() class IMAGE_FILE_HEADER(vstruct.VStruct):
64
64
96
9
55
cmaruti/vivisect
vstruct/defs/windows/win_5_1_i386/ntoskrnl.py
Python
IMAGE_FILE_HEADER
IMAGE_FILE_HEADER
6,068
6,077
6,068
6,068
825fb451b93bf4b3616feb981f5a36abadfeff03
bigcode/the-stack
train
109c57da1712553ab5554b38
train
class
class _unnamed_13151(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.Blink = v_uint32()
class _unnamed_13151(vstruct.VStruct):
def __init__(self): vstruct.VStruct.__init__(self) self.Blink = v_uint32()
v_ptr32() for i in xrange(1024) ]) class _unnamed_13150(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.Flink = v_uint32() class _unnamed_13151(vstruct.VStruct):
64
64
38
12
52
cmaruti/vivisect
vstruct/defs/windows/win_5_1_i386/ntoskrnl.py
Python
_unnamed_13151
_unnamed_13151
4,051
4,054
4,051
4,051
1fe36f4ff054878d3ffba3246dd41ebbf8dd9b86
bigcode/the-stack
train
6e5f7da1db946e8896d772e0
train
class
class INTERLOCK_SEQ(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.Depth = v_uint16() self.FreeEntryOffset = v_uint16() self.Sequence = v_uint32()
class INTERLOCK_SEQ(vstruct.VStruct):
def __init__(self): vstruct.VStruct.__init__(self) self.Depth = v_uint16() self.FreeEntryOffset = v_uint16() self.Sequence = v_uint32()
.Reserved = vstruct.VArray([ v_uint32() for i in xrange(3) ]) class EX_FAST_REF(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.Object = v_ptr32() class INTERLOCK_SEQ(vstruct.VStruct):
64
64
52
9
55
cmaruti/vivisect
vstruct/defs/windows/win_5_1_i386/ntoskrnl.py
Python
INTERLOCK_SEQ
INTERLOCK_SEQ
4,108
4,113
4,108
4,108
c56266cac280ca6f06a2bceb672f526eca6c033c
bigcode/the-stack
train
16b2728e035529105e813a6a
train
class
class RTL_CRITICAL_SECTION_DEBUG(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.Type = v_uint16() self.CreatorBackTraceIndex = v_uint16() self.CriticalSection = v_ptr32() self.ProcessLocksList = LIST_ENTRY() self.EntryCount = v_uint32() ...
class RTL_CRITICAL_SECTION_DEBUG(vstruct.VStruct):
def __init__(self): vstruct.VStruct.__init__(self) self.Type = v_uint16() self.CreatorBackTraceIndex = v_uint16() self.CriticalSection = v_ptr32() self.ProcessLocksList = LIST_ENTRY() self.EntryCount = v_uint32() self.ContentionCount = v_uint32() self....
7) ]) self.WaitWakeIrp = v_ptr32() self.SavedCancelRoutine = v_ptr32() self.Paging = v_uint32() self.Hibernate = v_uint32() self.CrashDump = v_uint32() class RTL_CRITICAL_SECTION_DEBUG(vstruct.VStruct):
64
64
107
11
53
cmaruti/vivisect
vstruct/defs/windows/win_5_1_i386/ntoskrnl.py
Python
RTL_CRITICAL_SECTION_DEBUG
RTL_CRITICAL_SECTION_DEBUG
3,300
3,309
3,300
3,300
796a688785b9ced12cd0cb59fa8dbe9872cefaff
bigcode/the-stack
train
7b77ed1a37df9c15873e0362
train
class
class DBGKD_SET_INTERNAL_BREAKPOINT64(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.BreakpointAddress = v_uint64() self.Flags = v_uint32() self._pad0010 = v_bytes(size=4)
class DBGKD_SET_INTERNAL_BREAKPOINT64(vstruct.VStruct):
def __init__(self): vstruct.VStruct.__init__(self) self.BreakpointAddress = v_uint64() self.Flags = v_uint32() self._pad0010 = v_bytes(size=4)
= v_uint32() self.Alternatives = v_ptr32() self.Flags = v_uint16() self.RangeAttributes = v_uint8() self.RangeAvailableAttributes = v_uint8() self.WorkSpace = v_uint32() class DBGKD_SET_INTERNAL_BREAKPOINT64(vstruct.VStruct):
64
64
62
13
51
cmaruti/vivisect
vstruct/defs/windows/win_5_1_i386/ntoskrnl.py
Python
DBGKD_SET_INTERNAL_BREAKPOINT64
DBGKD_SET_INTERNAL_BREAKPOINT64
1,066
1,071
1,066
1,066
17c10e4135962cb8f6e59e8b3ba9ec57e0290e91
bigcode/the-stack
train
8a452138487867c3b97eadbd
train
class
class KIDTENTRY(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.Offset = v_uint16() self.Selector = v_uint16() self.Access = v_uint16() self.ExtendedOffset = v_uint16()
class KIDTENTRY(vstruct.VStruct):
def __init__(self): vstruct.VStruct.__init__(self) self.Offset = v_uint16() self.Selector = v_uint16() self.Access = v_uint16() self.ExtendedOffset = v_uint16()
v_uint32() self.NewCell = v_uint32() class _unnamed_14065(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.InitialPrivilegeSet = INITIAL_PRIVILEGE_SET() class KIDTENTRY(vstruct.VStruct):
64
64
62
10
54
cmaruti/vivisect
vstruct/defs/windows/win_5_1_i386/ntoskrnl.py
Python
KIDTENTRY
KIDTENTRY
5,612
5,618
5,612
5,612
5e0b74fe0bec2a1d978224c4ce8b76765b10a931
bigcode/the-stack
train
ca9b3d99855eb171e6c1f6d8
train
class
class EX_PUSH_LOCK_CACHE_AWARE(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.Locks = vstruct.VArray([ v_ptr32() for i in xrange(1) ])
class EX_PUSH_LOCK_CACHE_AWARE(vstruct.VStruct):
def __init__(self): vstruct.VStruct.__init__(self) self.Locks = vstruct.VArray([ v_ptr32() for i in xrange(1) ])
LARGE_INTEGER() self.EndOfFile = LARGE_INTEGER() self.NumberOfLinks = v_uint32() self.DeletePending = v_uint8() self.Directory = v_uint8() self._pad0018 = v_bytes(size=2) class EX_PUSH_LOCK_CACHE_AWARE(vstruct.VStruct):
64
64
51
12
52
cmaruti/vivisect
vstruct/defs/windows/win_5_1_i386/ntoskrnl.py
Python
EX_PUSH_LOCK_CACHE_AWARE
EX_PUSH_LOCK_CACHE_AWARE
1,195
1,198
1,195
1,195
b2c396a4161486b11eaa0af4ef632d75d97f7e2c
bigcode/the-stack
train
d418a109889ba1e8ef205b7e
train
class
class EPROCESS_QUOTA_ENTRY(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.Usage = v_uint32() self.Limit = v_uint32() self.Peak = v_uint32() self.Return = v_uint32()
class EPROCESS_QUOTA_ENTRY(vstruct.VStruct):
def __init__(self): vstruct.VStruct.__init__(self) self.Usage = v_uint32() self.Limit = v_uint32() self.Peak = v_uint32() self.Return = v_uint32()
struct.VStruct.__init__(self) self.List = LIST_ENTRY() class _unnamed_14105(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.Banked = v_ptr32() class EPROCESS_QUOTA_ENTRY(vstruct.VStruct):
64
64
63
11
53
cmaruti/vivisect
vstruct/defs/windows/win_5_1_i386/ntoskrnl.py
Python
EPROCESS_QUOTA_ENTRY
EPROCESS_QUOTA_ENTRY
2,314
2,320
2,314
2,314
96af9f8d02e49bdc7e5772f39bd221b6aef00e62
bigcode/the-stack
train
0a722694cc5a16f441deb9f7
train
class
class DEVICE_OBJECT(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.Type = v_uint16() self.Size = v_uint16() self.ReferenceCount = v_uint32() self.DriverObject = v_ptr32() self.NextDevice = v_ptr32() self.AttachedDevice = v_ptr32() ...
class DEVICE_OBJECT(vstruct.VStruct):
def __init__(self): vstruct.VStruct.__init__(self) self.Type = v_uint16() self.Size = v_uint16() self.ReferenceCount = v_uint32() self.DriverObject = v_ptr32() self.NextDevice = v_ptr32() self.AttachedDevice = v_ptr32() self.CurrentIrp = v_ptr32() ...
= v_uint32() self.Descriptor = SECURITY_DESCRIPTOR_RELATIVE() class POP_TRIGGER_WAIT(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.Event = KEVENT() self.Status = v_uint32() self.Link = LIST_ENTRY() self.Trigger = v_ptr32() class DEVICE_O...
79
79
265
8
71
cmaruti/vivisect
vstruct/defs/windows/win_5_1_i386/ntoskrnl.py
Python
DEVICE_OBJECT
DEVICE_OBJECT
7,078
7,106
7,078
7,078
0b78be3d24f7de5073a88e10796e2ad92602ae24
bigcode/the-stack
train
d7e3f770e15c4258a0a6bceb
train
class
class PEB_LDR_DATA(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.Length = v_uint32() self.Initialized = v_uint8() self._pad0008 = v_bytes(size=3) self.SsHandle = v_ptr32() self.InLoadOrderModuleList = LIST_ENTRY() self.InMemoryOrder...
class PEB_LDR_DATA(vstruct.VStruct):
def __init__(self): vstruct.VStruct.__init__(self) self.Length = v_uint32() self.Initialized = v_uint8() self._pad0008 = v_bytes(size=3) self.SsHandle = v_ptr32() self.InLoadOrderModuleList = LIST_ENTRY() self.InMemoryOrderModuleList = LIST_ENTRY() sel...
.DataSize = v_uint32() self.InterfaceType = v_uint32() self.BusNumber = v_uint32() self.AddressSpace = v_uint32() self.IoAddress = v_uint32() self.DataValue = v_uint32() class PEB_LDR_DATA(vstruct.VStruct):
64
64
111
11
53
cmaruti/vivisect
vstruct/defs/windows/win_5_1_i386/ntoskrnl.py
Python
PEB_LDR_DATA
PEB_LDR_DATA
6,128
6,138
6,128
6,128
9147248aa36f22fa3657b77e621b8039a62a35d2
bigcode/the-stack
train
42b30d614041406c31c1840d
train
class
class WMI_BUFFER_STATE(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.Free = v_uint32()
class WMI_BUFFER_STATE(vstruct.VStruct):
def __init__(self): vstruct.VStruct.__init__(self) self.Free = v_uint32()
Frees = v_uint32() self.PagedBytes = v_uint32() class _unnamed_16666(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.DiskId = GUID() class WMI_BUFFER_STATE(vstruct.VStruct):
64
64
35
10
54
cmaruti/vivisect
vstruct/defs/windows/win_5_1_i386/ntoskrnl.py
Python
WMI_BUFFER_STATE
WMI_BUFFER_STATE
2,474
2,477
2,474
2,474
d56927dbd9b1e973e7d379b1d0b7f269c0367ac2
bigcode/the-stack
train
63341291ff24aadb69dbe7c3
train
class
class IMAGE_DATA_DIRECTORY(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.VirtualAddress = v_uint32() self.Size = v_uint32()
class IMAGE_DATA_DIRECTORY(vstruct.VStruct):
def __init__(self): vstruct.VStruct.__init__(self) self.VirtualAddress = v_uint32() self.Size = v_uint32()
() self.PowerCapabilities = PCI_PMC() self.TargetAgpCapabilityId = v_uint8() self._pad00c4 = v_bytes(size=1) self.CommandEnables = v_uint16() self.InitialCommand = v_uint16() class IMAGE_DATA_DIRECTORY(vstruct.VStruct):
64
64
43
9
55
cmaruti/vivisect
vstruct/defs/windows/win_5_1_i386/ntoskrnl.py
Python
IMAGE_DATA_DIRECTORY
IMAGE_DATA_DIRECTORY
6,431
6,435
6,431
6,431
2a23b93f78e856b675e76926c39a55c1a8ee82be
bigcode/the-stack
train
9043310eed94c83c9f197aa5
train
class
class MQTTClient: client_mqtt = None flag_connected = 0 list_topics = None @staticmethod def on_connect(client, userdata, flags, rc): try: if MQTTClient.flag_connected == 1: return MQTTClient.flag_connected = 1 logging.info('MQTT on_conn...
class MQTTClient:
client_mqtt = None flag_connected = 0 list_topics = None @staticmethod def on_connect(client, userdata, flags, rc): try: if MQTTClient.flag_connected == 1: return MQTTClient.flag_connected = 1 logging.info('MQTT on_connect event') ...
import paho.mqtt.client as mqtt import logging class MQTTClient:
16
187
624
4
11
MONICA-Project/WristbandGwMqttEmulator
mqtt_client.py
Python
MQTTClient
MQTTClient
4
90
4
4
ff86c25e66233c59207752d757b6c3cbb13234bf
bigcode/the-stack
train
f72a53a56f5886af49c589e0
train
class
class Profile(models.Model): avatar = models.ImageField(default="avatar.svg", null=True) bio = models.TextField(blank=True, null=True) user = models.ForeignKey(UserAccount, on_delete=models.CASCADE, related_name='users') location = models.ForeignKey(Location, on_delete=models.CASCADE, related_name='mtaa...
class Profile(models.Model):
avatar = models.ImageField(default="avatar.svg", null=True) bio = models.TextField(blank=True, null=True) user = models.ForeignKey(UserAccount, on_delete=models.CASCADE, related_name='users') location = models.ForeignKey(Location, on_delete=models.CASCADE, related_name='mtaani', blank=True, null=True) ...
is_active = models.BooleanField(default=False) def __str__(self): return self.username def has_perm(self, perm, obj=None): return True def has_module_perms(self,add_label): return self.is_admin from neighbour.models import Location class Profile(models.Model):
64
64
89
5
58
engineer237/neighbourhood
accounts/models.py
Python
Profile
Profile
69
76
69
69
cb486a7c388220900cf33dde295d0c98bdcee13e
bigcode/the-stack
train
813370211dd1dc02e1c2b736
train
class
class UserAccount(AbstractBaseUser): username = models.CharField(max_length=50, unique=True) email = models.EmailField(max_length=150, unique=True) first_name = models.CharField(max_length=50) last_name = models.CharField(max_length=50) phone_number = models.CharField(max_length=15) USERNAME_FI...
class UserAccount(AbstractBaseUser):
username = models.CharField(max_length=50, unique=True) email = models.EmailField(max_length=150, unique=True) first_name = models.CharField(max_length=50) last_name = models.CharField(max_length=50) phone_number = models.CharField(max_length=15) USERNAME_FIELD = 'email' REQUIRED_FIELDS = [...
email= self.normalize_email(email), password = password ) user.is_admin = True user.is_active = True user.is_superuser = True user.is_staff = True user.save(using = self._db) return user class UserAccount(AbstractBaseUser):
63
64
212
7
55
engineer237/neighbourhood
accounts/models.py
Python
UserAccount
UserAccount
38
64
38
38
176aea0a77682d8f1a8f0541eec1495c341171de
bigcode/the-stack
train
7fdb44779af599ec0a42a7b7
train
class
class UserAccountPermission(BaseUserManager): def create_user(self, first_name, last_name, username, email, password=None): user =self.model( first_name = first_name, last_name = last_name, username = username, email = self.normalize_email(email) ) ...
class UserAccountPermission(BaseUserManager):
def create_user(self, first_name, last_name, username, email, password=None): user =self.model( first_name = first_name, last_name = last_name, username = username, email = self.normalize_email(email) ) user.set_password(password) user...
from email.policy import default from django.db import models from django.contrib.auth.models import BaseUserManager, AbstractBaseUser, PermissionsMixin from cloudinary.models import CloudinaryField # Create your models here. class UserAccountPermission(BaseUserManager):
52
64
183
8
44
engineer237/neighbourhood
accounts/models.py
Python
UserAccountPermission
UserAccountPermission
6
35
6
6
0cb5780039869ea524aab3debf7065ae936338cc
bigcode/the-stack
train
cfac9767fc0d1c6555960ba8
train
function
@bp.route('/') def heartbeat(): """ Default endpoint generated. """ data: HeartbeatModel = HeartbeatModel() return jsonify(data.__dict__)
@bp.route('/') def heartbeat():
""" Default endpoint generated. """ data: HeartbeatModel = HeartbeatModel() return jsonify(data.__dict__)
import functools from flask import Blueprint, jsonify from models.HeartbeatModel import HeartbeatModel bp = Blueprint('heartbeat', __name__, url_prefix="/heartbeat") @bp.route('/') def heartbeat():
41
64
34
7
34
jdcaperon/AuthOut
server/views/Center.py
Python
heartbeat
heartbeat
8
14
8
9
891e08b7f5661469b6cbf7e5aca145c1d94cb4d3
bigcode/the-stack
train
a9f417cf977ee36e79a39123
train
class
class UpdatePolicyRequest: """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name and the value is json key in definition. """ sensitive_list =...
class UpdatePolicyRequest:
""" Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name and the value is json key in definition. """ sensitive_list = [] openapi_types = { ...
# coding: utf-8 import pprint import re import six class UpdatePolicyRequest:
21
212
707
5
15
wuchen-huawei/huaweicloud-sdk-python-v3
huaweicloud-sdk-cbr/huaweicloudsdkcbr/v1/model/update_policy_request.py
Python
UpdatePolicyRequest
UpdatePolicyRequest
12
134
12
14
ed2e35631856f7d3fd23e352a478270bbfc141ff
bigcode/the-stack
train
91a789e586507a125f38e44a
train
class
@pulumi.output_type class GetCloudServiceResult: """ Describes the cloud service. """ def __init__(__self__, id=None, location=None, name=None, properties=None, tags=None, type=None): if id and not isinstance(id, str): raise TypeError("Expected argument 'id' to be a str") pul...
@pulumi.output_type class GetCloudServiceResult:
""" Describes the cloud service. """ def __init__(__self__, id=None, location=None, name=None, properties=None, tags=None, type=None): if id and not isinstance(id, str): raise TypeError("Expected argument 'id' to be a str") pulumi.set(__self__, "id", id) if location a...
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union from ... import _utilities, _tables from...
120
151
504
12
108
pulumi/pulumi-azure-nextgen
sdk/python/pulumi_azure_nextgen/compute/v20201001preview/get_cloud_service.py
Python
GetCloudServiceResult
GetCloudServiceResult
18
89
18
19
98e9b638d4ad174a17d4dbdd5de6b099e7f3c72f
bigcode/the-stack
train
93f6a6f3c000884871f68999
train
class
class AwaitableGetCloudServiceResult(GetCloudServiceResult): # pylint: disable=using-constant-test def __await__(self): if False: yield self return GetCloudServiceResult( id=self.id, location=self.location, name=self.name, properties=se...
class AwaitableGetCloudServiceResult(GetCloudServiceResult): # pylint: disable=using-constant-test
def __await__(self): if False: yield self return GetCloudServiceResult( id=self.id, location=self.location, name=self.name, properties=self.properties, tags=self.tags, type=self.type)
, "tags") @property @pulumi.getter def type(self) -> str: """ Resource type. """ return pulumi.get(self, "type") class AwaitableGetCloudServiceResult(GetCloudServiceResult): # pylint: disable=using-constant-test
64
64
75
23
41
pulumi/pulumi-azure-nextgen
sdk/python/pulumi_azure_nextgen/compute/v20201001preview/get_cloud_service.py
Python
AwaitableGetCloudServiceResult
AwaitableGetCloudServiceResult
92
103
92
93
1005b64447fa11f56dc8f2fa116fee79caace791
bigcode/the-stack
train
67ef73a86171d22e9bdadc16
train
function
def get_cloud_service(cloud_service_name: Optional[str] = None, resource_group_name: Optional[str] = None, opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetCloudServiceResult: """ Describes the cloud service. :param str cloud_service_name: Name of the...
def get_cloud_service(cloud_service_name: Optional[str] = None, resource_group_name: Optional[str] = None, opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetCloudServiceResult:
""" Describes the cloud service. :param str cloud_service_name: Name of the cloud service. :param str resource_group_name: Name of the resource group. """ __args__ = dict() __args__['cloudServiceName'] = cloud_service_name __args__['resourceGroupName'] = resource_group_name if opts...
.id, location=self.location, name=self.name, properties=self.properties, tags=self.tags, type=self.type) def get_cloud_service(cloud_service_name: Optional[str] = None, resource_group_name: Optional[str] = None, opts...
74
74
248
47
27
pulumi/pulumi-azure-nextgen
sdk/python/pulumi_azure_nextgen/compute/v20201001preview/get_cloud_service.py
Python
get_cloud_service
get_cloud_service
106
131
106
108
3610e6a7b5e44f982e50c999fc4cdb60c9399f37
bigcode/the-stack
train
839c0839bbbcda0bec7531e7
train
class
class BowlingGame: def __init__(self): pass def roll(self, pins): pass def score(self): pass
class BowlingGame:
def __init__(self): pass def roll(self, pins): pass def score(self): pass
class BowlingGame:
4
64
32
4
0
kishankj/python
exercises/bowling/bowling.py
Python
BowlingGame
BowlingGame
1
9
1
1
52f1cbb300ac21e135877dbac12baab0d66cefa4
bigcode/the-stack
train
48e203d74f6a2e635ab9c4a9
train
class
class TestPermittedWarnings(AzulUnitTestCase): def test_permitted_warnings(self): # The following warning does not get caught by the catch_warning context # manager in the AzulTestCase class because the message matches an # ignore warning filter. warnings.warn("unclosed <ssl.SSLSock...
class TestPermittedWarnings(AzulUnitTestCase):
def test_permitted_warnings(self): # The following warning does not get caught by the catch_warning context # manager in the AzulTestCase class because the message matches an # ignore warning filter. warnings.warn("unclosed <ssl.SSLSocket fd=30, family=AddressFamily.AF_INET, type=Soc...
# … and a generic error message is logged. self.assertEqual( azul_log.output[1], 'INFO:azul.chalice:Returning 500 response. To log headers and body, set AZUL_DEBUG to 1.' ) class TestPermitted...
64
64
129
11
53
jessebrennan/azul
test/test_app_logging.py
Python
TestPermittedWarnings
TestPermittedWarnings
111
119
111
112
a6bfee712289068f972beaaefdc4a17af11e2dea
bigcode/the-stack
train
b9adca70fe1477248add0a33
train
class
class TestUnexpectedWarnings(TestCase): def test_unexpected_warning(self): msg = 'Testing unexpected warnings, nothing to see here.' category = ResourceWarning for parents in ( (AzulUnitTestCase,), (AzulUnitTestCase, AlwaysTearDownTestCase), (AlwaysTearD...
class TestUnexpectedWarnings(TestCase):
def test_unexpected_warning(self): msg = 'Testing unexpected warnings, nothing to see here.' category = ResourceWarning for parents in ( (AzulUnitTestCase,), (AzulUnitTestCase, AlwaysTearDownTestCase), (AlwaysTearDownTestCase, AzulUnitTestCase) ):...
fd=30, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM," "proto=0, laddr=('192.168.1.11', 63179), raddr=('172.217.5.112', 443)>", category=ResourceWarning) class TestUnexpectedWarnings(TestCase):
68
68
229
7
61
jessebrennan/azul
test/test_app_logging.py
Python
TestUnexpectedWarnings
TestUnexpectedWarnings
122
150
122
123
23e99347da76ec9b156a725245992a8647e18f62
bigcode/the-stack
train
563773c63f2aa394a2572924
train
class
class TestAppLogging(TestCase): def test(self): magic_message = 'Now you see me' traceback_header = 'Traceback (most recent call last):' for debug in 0, 1, 2: with mock.patch.dict(os.environ, AZUL_DEBUG=str(debug)): with self.subTest(debug=debug): ...
class TestAppLogging(TestCase):
def test(self): magic_message = 'Now you see me' traceback_header = 'Traceback (most recent call last):' for debug in 0, 1, 2: with mock.patch.dict(os.environ, AZUL_DEBUG=str(debug)): with self.subTest(debug=debug): log_level = azul_log_level(...
import os from typing import ( Any, Tuple, cast, ) from unittest import ( TestCase, TestResult, TestSuite, mock, ) import warnings from chalice.config import ( Config as ChaliceConfig, ) from more_itertools import ( one, ) import requests from app_test_case import ( AzulUnitTes...
157
178
594
7
150
jessebrennan/azul
test/test_app_logging.py
Python
TestAppLogging
TestAppLogging
45
108
45
46
e44f64b58aa8688d5769396c25124bcc3044c31c
bigcode/the-stack
train
8ae6f290156f35adf907de25
train
function
def setupModule(): configure_test_logging()
def setupModule():
configure_test_logging()
iceServerThread, ) import azul from azul.chalice import ( AzulChaliceApp, ) from azul.logging import ( azul_log_level, configure_test_logging, ) from azul_test_case import ( AlwaysTearDownTestCase, ) # noinspection PyPep8Naming def setupModule():
64
64
9
4
59
jessebrennan/azul
test/test_app_logging.py
Python
setupModule
setupModule
41
42
41
41
613c53765d8f8ca0198fad850233ba490d42b00c
bigcode/the-stack
train
455309625070f0a0699c16bb
train
function
def auto_train( dataset: Union[str, pd.DataFrame, dd.core.DataFrame], target: str, time_limit_s: Union[int, float], output_directory: str = OUTPUT_DIR, **kwargs ) -> AutoTrainResults: """ Main auto train API that first builds configs for each model type (e.g. concat, tabnet, transformer)...
def auto_train( dataset: Union[str, pd.DataFrame, dd.core.DataFrame], target: str, time_limit_s: Union[int, float], output_directory: str = OUTPUT_DIR, **kwargs ) -> AutoTrainResults:
""" Main auto train API that first builds configs for each model type (e.g. concat, tabnet, transformer). Then selects model based on dataset attributes. And finally runs a hyperparameter optimization experiment. All batch and learning rate tuning is done @ training time. # Inputs :param d...
property def best_model(self) -> LudwigModel: return LudwigModel.load(self.path_to_best_model) def auto_train( dataset: Union[str, pd.DataFrame, dd.core.DataFrame], target: str, time_limit_s: Union[int, float], output_directory: str = OUTPUT_DIR, **kwargs ) -> AutoTrainResults:
76
76
256
53
23
ksbrar/ludwig
ludwig/automl/automl.py
Python
auto_train
auto_train
59
90
59
65
ff06fb5018d5a23b5c2850052122d848f47d7681
bigcode/the-stack
train
7c6ec08290bdee6c22aad393
train
function
def _train( config: Dict, dataset: Union[str, pd.DataFrame, dd.core.DataFrame], output_directory: str, model_name: str, **kwargs ): hyperopt_results = hyperopt( config, dataset=dataset, output_directory=output_directory, model_name=model_name, backend='loc...
def _train( config: Dict, dataset: Union[str, pd.DataFrame, dd.core.DataFrame], output_directory: str, model_name: str, **kwargs ):
hyperopt_results = hyperopt( config, dataset=dataset, output_directory=output_directory, model_name=model_name, backend='local', **kwargs ) return hyperopt_results
by default. This will be improved in subsequent iterations """ return default_configs['tabnet'] def _train( config: Dict, dataset: Union[str, pd.DataFrame, dd.core.DataFrame], output_directory: str, model_name: str, **kwargs ):
64
64
87
41
23
ksbrar/ludwig
ludwig/automl/automl.py
Python
_train
_train
170
185
170
176
e8f5f589f509966cca1bb69ed66e774ce0430f4f
bigcode/the-stack
train
e8b391ef4c79fd34721c3746
train
function
def _model_select(default_configs): """ Performs model selection based on dataset. Note: Current implementation returns tabnet by default. This will be improved in subsequent iterations """ return default_configs['tabnet']
def _model_select(default_configs):
""" Performs model selection based on dataset. Note: Current implementation returns tabnet by default. This will be improved in subsequent iterations """ return default_configs['tabnet']
warnings.warn( "There was an error running the experiment. " "A trial failed to start. " "Consider increasing the time budget for experiment. " ) experiment_analysis = hyperopt_results.experiment_analysis return AutoTrainResults(experiment...
64
64
48
7
57
ksbrar/ludwig
ludwig/automl/automl.py
Python
_model_select
_model_select
161
167
161
161
782addce58acaae6d5ddd00e547517164e166b15
bigcode/the-stack
train
5179f7543b94ff5503751658
train
function
def create_auto_config( dataset: Union[str, pd.DataFrame, dd.core.DataFrame, DatasetInfo], target: str, time_limit_s: Union[int, float], ) -> dict: """ Returns an auto-generated Ludwig config with the intent of training the best model on given given dataset / target in the given time limit. ...
def create_auto_config( dataset: Union[str, pd.DataFrame, dd.core.DataFrame, DatasetInfo], target: str, time_limit_s: Union[int, float], ) -> dict:
""" Returns an auto-generated Ludwig config with the intent of training the best model on given given dataset / target in the given time limit. # Inputs :param dataset: (str) filepath to dataset. :param target: (str) name of target feature :param time_limit_s: (int, float) total time al...
_with_config( dataset, config, output_directory=output_directory, **kwargs ) def create_auto_config( dataset: Union[str, pd.DataFrame, dd.core.DataFrame, DatasetInfo], target: str, time_limit_s: Union[int, float], ) -> dict:
64
64
179
42
22
ksbrar/ludwig
ludwig/automl/automl.py
Python
create_auto_config
create_auto_config
93
114
93
97
d8d7348ee8754efbfb70c1de622074ac1269c190
bigcode/the-stack
train
ab3e803db04c20fb8ff605de
train
function
def train_with_config( dataset: Union[str, pd.DataFrame, dd.core.DataFrame], config: dict, output_directory: str = OUTPUT_DIR, **kwargs, ) -> AutoTrainResults: """ Performs hyperparameter optimization with respect to the given config and selects the best model. # Inputs :param datas...
def train_with_config( dataset: Union[str, pd.DataFrame, dd.core.DataFrame], config: dict, output_directory: str = OUTPUT_DIR, **kwargs, ) -> AutoTrainResults:
""" Performs hyperparameter optimization with respect to the given config and selects the best model. # Inputs :param dataset: (str) filepath to dataset. :param config: (dict) optional Ludwig configuration to use for training, defaults to `create_auto_config`. :param outp...
parameter # Return :return: (dict) selected model configuration """ default_configs = _create_default_config(dataset, target, time_limit_s) model_config = _model_select(default_configs) return model_config def train_with_config( dataset: Union[str, pd.DataFrame, dd.core.DataFrame], con...
94
94
315
44
49
ksbrar/ludwig
ludwig/automl/automl.py
Python
train_with_config
train_with_config
117
158
117
122
b00dae5312073750cceaea7ae8b4c6c2abcbc69f
bigcode/the-stack
train
3f76c2d9c30c82fd662389a2
train
class
class AutoTrainResults: def __init__(self, experiment_analysis: ExperimentAnalysis): self._experiment_analysis = experiment_analysis @property def experiment_analysis(self): return self._experiment_analysis @property def path_to_best_model(self) -> str: return self._experim...
class AutoTrainResults:
def __init__(self, experiment_analysis: ExperimentAnalysis): self._experiment_analysis = experiment_analysis @property def experiment_analysis(self): return self._experiment_analysis @property def path_to_best_model(self) -> str: return self._experiment_analysis.best_checkp...
dd import ray from ray.tune import ExperimentAnalysis except ImportError: raise ImportError( ' ray is not installed. ' 'In order to use auto_train please run ' 'pip install ludwig[ray]' ) OUTPUT_DIR = "." class AutoTrainResults:
64
64
119
5
58
ksbrar/ludwig
ludwig/automl/automl.py
Python
AutoTrainResults
AutoTrainResults
38
56
38
38
988c6b637cecfbae086f31e4f4738395026461a1
bigcode/the-stack
train
b31031fe4965683c32f17e49
train
class
class ConfigParser(DefaultConfig): def __init__(self, config: Union[Path, dict]): """Parses and validates a user supplied config Args: config (Union[Path, dict]): Name of config file or preloaded config dictionary. """ self.config = config ...
class ConfigParser(DefaultConfig):
def __init__(self, config: Union[Path, dict]): """Parses and validates a user supplied config Args: config (Union[Path, dict]): Name of config file or preloaded config dictionary. """ self.config = config super().__init__(self.config) ...
": False, # Whether to load a pretrained model TODO "use_tensorboard": False, # Whether to output tensorboard data "plot_loss": True, # Whether to plot loss curves } # Required parameters not specified in `_defaults` _required_params = {"net_names"} # Parameters that should ...
224
224
748
6
218
bowang-lab/BIONIC
bionic/utils/config_parser.py
Python
ConfigParser
ConfigParser
66
164
66
66
5a853d1ae24de155be5c5b627fe7c3c1b1de57f9
bigcode/the-stack
train
cf4a0f313f03d3b8da1553ed
train
class
class DefaultConfig: """Defines the default BIONIC config parameters. """ # Default config parameters used unless specified by user _defaults = { "net_names": None, # Filepaths of input networks "label_names": None, # Filepaths of gene/protein labels (if available) "ou...
class DefaultConfig:
"""Defines the default BIONIC config parameters. """ # Default config parameters used unless specified by user _defaults = { "net_names": None, # Filepaths of input networks "label_names": None, # Filepaths of gene/protein labels (if available) "out_name": None, # Name...
import json import warnings from pathlib import Path from typing import Union, List, Any from argparse import Namespace class DefaultConfig:
29
191
639
4
24
bowang-lab/BIONIC
bionic/utils/config_parser.py
Python
DefaultConfig
DefaultConfig
8
63
8
8
6e439aa1cc86d5644937e1d3f7ce2f0673fc3797
bigcode/the-stack
train
45352f5447eade80a0643e84
train
function
def process(img): ret = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) return ret
def process(img):
ret = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) return ret
import cv2 def process(img):
8
64
24
4
3
olliexollie/diploma
process.py
Python
process
process
4
6
4
4
19226f4c7addc26122741a78f5a1b09e13dcc5e3
bigcode/the-stack
train
5eecbdb06d375d49bfef92f3
train
class
class CrossSectFluxBarrierRotor(CrossSectBase): def __init__(self, **kwargs: any) -> None: ''' Initialization function for Flux Barrier Rotor class. This function takes in arguments and saves the information passed to private variable to make them read-only Parameters ...
class CrossSectFluxBarrierRotor(CrossSectBase):
def __init__(self, **kwargs: any) -> None: ''' Initialization function for Flux Barrier Rotor class. This function takes in arguments and saves the information passed to private variable to make them read-only Parameters ---------- **kwargs : any D...
import numpy as np from ...dimensions.dim_linear import DimLinear from ...dimensions.dim_angular import DimAngular from ...dimensions import DimRadian from ..cross_sect_base import CrossSectBase, CrossSectToken __all__ = ['CrossSectFluxBarrierRotor'] class CrossSectFluxBarrierRotor(CrossSectBase):
69
256
4,684
11
58
Severson-Group/MachEval
mach_cad/model_obj/cross_sects/flux_barrier_rotor/__init__.py
Python
CrossSectFluxBarrierRotor
CrossSectFluxBarrierRotor
10
389
10
10
4bfcc309ab52c6e7839007ab0b98870a4136825a
bigcode/the-stack
train
3d6dd0d09b87f083dec24ba5
train
class
class MainSequence(Sequence): """Exercise different combinations of values for the parameters for the genPA instruction. Focus in this test is to try values of the Size, Align and CanAlias parameters. Type is always 'D'; Bank is always "Default". """ def generate(self, **kargs): ldstr_...
class MainSequence(Sequence):
"""Exercise different combinations of values for the parameters for the genPA instruction. Focus in this test is to try values of the Size, Align and CanAlias parameters. Type is always 'D'; Bank is always "Default". """ def generate(self, **kargs): ldstr_byte_ops = ["LB##RISCV", "SB##...
# # Copyright (C) [2020] Futurewei Technologies, Inc. # # FORCE-RISCV is licensed under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # THIS SOFTWARE IS PR...
186
222
740
6
179
Wlgen/force-riscv
tests/riscv/APIs/api_genVAforPA_01_force.py
Python
MainSequence
MainSequence
21
112
21
21
198f6cf4f14c8bf3858bc141efbedf4136affe49
bigcode/the-stack
train
352d0471194e2d5fddd91e74
train
class
class CodeSimilarityTool: def __cursor_kind_list_filter__(self, cursors, kinds_to_filter=[]): """ CursorKind.COMPOUND_STMT - Remove braces (helps to better recognized code like this: #1: if (variable == 1) return 1; #2 if (variable == 1) { ...
class CodeSimilarityTool:
def __cursor_kind_list_filter__(self, cursors, kinds_to_filter=[]): """ CursorKind.COMPOUND_STMT - Remove braces (helps to better recognized code like this: #1: if (variable == 1) return 1; #2 if (variable == 1) { return 1; } ...
.kind in {CursorKind.FOR_STMT, CursorKind.DO_STMT, CursorKind.WHILE_STMT}): loops.append((c.location.file, c.location.line)) return loops ...
256
256
2,392
5
250
kamsykula/Laverna
laverna/analyser.py
Python
CodeSimilarityTool
CodeSimilarityTool
95
307
95
95
047b9a9f48c3f8cbd265167cf6371056345225de
bigcode/the-stack
train
7d8de427cb6198ac2804c53d
train
class
class CodeAnalyser: def __init__(self): pass def __get_filtered_cursors__(self, cursor, filter_fun): filtered = [] if filter_fun(cursor): filtered.append(cursor) for c in cursor.get_children(): filtered += self.__get_filtered_cursors__(c, filter_fun) ...
class CodeAnalyser:
def __init__(self): pass def __get_filtered_cursors__(self, cursor, filter_fun): filtered = [] if filter_fun(cursor): filtered.append(cursor) for c in cursor.get_children(): filtered += self.__get_filtered_cursors__(c, filter_fun) return filtere...
import itertools from clang.cindex import * import difflib class CodeAnalyser:
19
199
664
5
13
kamsykula/Laverna
laverna/analyser.py
Python
CodeAnalyser
CodeAnalyser
7
92
7
8
7678551f1f108eab422a9e95a3aa9b9e7666f519
bigcode/the-stack
train
0911d6b5183013407cf1c396
train
function
def infer_named_tuple(node, context=None): """Specific inference function for namedtuple Call node""" tuple_base_name = nodes.Name(name="tuple", parent=node.root()) class_node, name, attributes = infer_func_form( node, tuple_base_name, context=context ) call_site = arguments.CallSite.from_ca...
def infer_named_tuple(node, context=None):
"""Specific inference function for namedtuple Call node""" tuple_base_name = nodes.Name(name="tuple", parent=node.root()) class_node, name, attributes = infer_func_form( node, tuple_base_name, context=context ) call_site = arguments.CallSite.from_call(node) func = next(extract_node("impo...
:type node: ClassDef :rtype: bool """ return set(node.basenames) & TYPING_NAMEDTUPLE_BASENAMES def _looks_like(node, name): func = node.func if isinstance(func, nodes.Attribute): return func.attrname == name if isinstance(func, nodes.Name): return func.name == name return ...
147
147
490
9
138
VikrantAgrahari/littlegenius
venv/lib/python3.8/site-packages/astroid/brain/brain_namedtuple_enum.py
Python
infer_named_tuple
infer_named_tuple
164
219
164
164
684115745f84e713b993ea1859398854b0c7f6c9
bigcode/the-stack
train
c05c4caf703ecfd7f83eaf62
train
function
def _get_renamed_namedtuple_attributes(field_names): names = list(field_names) seen = set() for i, name in enumerate(field_names): if ( not all(c.isalnum() or c == "_" for c in name) or keyword.iskeyword(name) or not name or name[0].isdigit() ...
def _get_renamed_namedtuple_attributes(field_names):
names = list(field_names) seen = set() for i, name in enumerate(field_names): if ( not all(c.isalnum() or c == "_" for c in name) or keyword.iskeyword(name) or not name or name[0].isdigit() or name.startswith("_") or name in see...
0].locals["_fields"] for attr in attributes: class_node.locals[attr] = fake.body[0].locals[attr] # we use UseInferenceDefault, we can't be a generator so return an iterator return iter([class_node]) def _get_renamed_namedtuple_attributes(field_names):
64
64
110
12
52
VikrantAgrahari/littlegenius
venv/lib/python3.8/site-packages/astroid/brain/brain_namedtuple_enum.py
Python
_get_renamed_namedtuple_attributes
_get_renamed_namedtuple_attributes
222
236
222
222
480787ac904cf94b5d7b7f44c221d67653a37f88
bigcode/the-stack
train
6cac8330cc9729b9a08fcf41
train
function
def infer_enum(node, context=None): """ Specific inference function for enum Call node. """ enum_meta = extract_node( """ class EnumMeta(object): 'docstring' def __call__(self, node): class EnumAttribute(object): name = '' value = 0 ...
def infer_enum(node, context=None):
""" Specific inference function for enum Call node. """ enum_meta = extract_node( """ class EnumMeta(object): 'docstring' def __call__(self, node): class EnumAttribute(object): name = '' value = 0 return EnumAttribute() ...
in name) or keyword.iskeyword(name) or not name or name[0].isdigit() or name.startswith("_") or name in seen ): names[i] = "_%d" % i seen.add(name) return tuple(names) def infer_enum(node, context=None):
67
67
226
8
59
VikrantAgrahari/littlegenius
venv/lib/python3.8/site-packages/astroid/brain/brain_namedtuple_enum.py
Python
infer_enum
infer_enum
239
276
239
239
384558f926bad130d88b21f83f5aa18019fbe4c1
bigcode/the-stack
train
2d83ef9a0e43a0dc27229651
train
function
def infer_typing_namedtuple_class(class_node, context=None): """Infer a subclass of typing.NamedTuple""" # Check if it has the corresponding bases annassigns_fields = [ annassign.target.name for annassign in class_node.body if isinstance(annassign, nodes.AnnAssign) ] code = d...
def infer_typing_namedtuple_class(class_node, context=None):
"""Infer a subclass of typing.NamedTuple""" # Check if it has the corresponding bases annassigns_fields = [ annassign.target.name for annassign in class_node.body if isinstance(annassign, nodes.AnnAssign) ] code = dedent( """ from collections import namedtuple ...
.parent = target.parent for method in node.mymethods(): fake.locals[method.name] = [method] new_targets.append(fake.instantiate_class()) node.locals[local] = new_targets break return node def infer_typing_namedtuple_class(class_node, context=No...
65
65
219
13
51
VikrantAgrahari/littlegenius
venv/lib/python3.8/site-packages/astroid/brain/brain_namedtuple_enum.py
Python
infer_typing_namedtuple_class
infer_typing_namedtuple_class
366
393
366
366
382c7748b6ddea9715004a5e95711b3eac3b9819
bigcode/the-stack
train
d83e504fe7e6ec90952e6313
train
function
def infer_enum_class(node): """ Specific inference for enums. """ for basename in node.basenames: # TODO: doesn't handle subclasses yet. This implementation # is a hack to support enums. if basename not in ENUM_BASE_NAMES: continue if node.root().name == "enum": ...
def infer_enum_class(node):
""" Specific inference for enums. """ for basename in node.basenames: # TODO: doesn't handle subclasses yet. This implementation # is a hack to support enums. if basename not in ENUM_BASE_NAMES: continue if node.root().name == "enum": # Skip if the class i...
_ADDITION_METHODS = """ def __or__(self, other): return {name}(self.value | other.value) def __and__(self, other): return {name}(self.value & other.value) def __xor__(self, other): return {name}(self.value ^ other.value) def __add__(self, other): return {name}(self.value ...
149
149
498
6
143
VikrantAgrahari/littlegenius
venv/lib/python3.8/site-packages/astroid/brain/brain_namedtuple_enum.py
Python
infer_enum_class
infer_enum_class
297
363
297
297
15901db46fbe16111eb4ed36334c638b46733391
bigcode/the-stack
train
82f6e6cec92e3a9c10711cd3
train
function
def _find_func_form_arguments(node, context): def _extract_namedtuple_arg_or_keyword(position, key_name=None): if len(args) > position: return _infer_first(args[position], context) if key_name and key_name in found_keywords: return _infer_first(found_keywords[key_name], cont...
def _find_func_form_arguments(node, context):
def _extract_namedtuple_arg_or_keyword(position, key_name=None): if len(args) > position: return _infer_first(args[position], context) if key_name and key_name in found_keywords: return _infer_first(found_keywords[key_name], context) args = node.args keywords = node...
able: raise UseInferenceDefault try: value = next(node.infer(context=context)) if value is util.Uninferable: raise UseInferenceDefault() else: return value except StopIteration: raise InferenceError() def _find_func_form_arguments(node, context):
64
64
160
10
54
VikrantAgrahari/littlegenius
venv/lib/python3.8/site-packages/astroid/brain/brain_namedtuple_enum.py
Python
_find_func_form_arguments
_find_func_form_arguments
56
75
56
56
a9cbb6e8a76d81c6ca398bae16d72a1c37b803c0
bigcode/the-stack
train
ce38fe525c781ad5b6cc15d3
train
function
def infer_func_form(node, base_type, context=None, enum=False): """Specific inference function for namedtuple or Python 3 enum. """ # node is a Call node, class name as first argument and generated class # attributes as second argument # namedtuple or enums list of attributes can be a list of strings o...
def infer_func_form(node, base_type, context=None, enum=False):
"""Specific inference function for namedtuple or Python 3 enum. """ # node is a Call node, class name as first argument and generated class # attributes as second argument # namedtuple or enums list of attributes can be a list of strings or a # whitespace-separate string try: name, name...
tuple_arg_or_keyword(position, key_name=None): if len(args) > position: return _infer_first(args[position], context) if key_name and key_name in found_keywords: return _infer_first(found_keywords[key_name], context) args = node.args keywords = node.keywords found_ke...
160
160
535
15
145
VikrantAgrahari/littlegenius
venv/lib/python3.8/site-packages/astroid/brain/brain_namedtuple_enum.py
Python
infer_func_form
infer_func_form
78
138
78
78
22236d40ad3f513baa007f36ca3462b37742e59b
bigcode/the-stack
train
ff8c89a66aa44e4cde9b0f6e
train
function
def _has_namedtuple_base(node): """Predicate for class inference tip :type node: ClassDef :rtype: bool """ return set(node.basenames) & TYPING_NAMEDTUPLE_BASENAMES
def _has_namedtuple_base(node):
"""Predicate for class inference tip :type node: ClassDef :rtype: bool """ return set(node.basenames) & TYPING_NAMEDTUPLE_BASENAMES
__(*attributes) method for attr in attributes: fake_node = nodes.EmptyNode() fake_node.parent = class_node fake_node.attrname = attr class_node.instance_attrs[attr] = [fake_node] return class_node, name, attributes def _has_namedtuple_base(node):
64
64
55
8
55
VikrantAgrahari/littlegenius
venv/lib/python3.8/site-packages/astroid/brain/brain_namedtuple_enum.py
Python
_has_namedtuple_base
_has_namedtuple_base
141
147
141
141
ccd8fd214b760d44e020fe28127f398db7257794
bigcode/the-stack
train
140f21c0d9fbbeb17a304d5f
train
function
def _infer_first(node, context): if node is util.Uninferable: raise UseInferenceDefault try: value = next(node.infer(context=context)) if value is util.Uninferable: raise UseInferenceDefault() else: return value except StopIteration: raise Infe...
def _infer_first(node, context):
if node is util.Uninferable: raise UseInferenceDefault try: value = next(node.infer(context=context)) if value is util.Uninferable: raise UseInferenceDefault() else: return value except StopIteration: raise InferenceError()
AMEDTUPLE_BASENAMES = {"NamedTuple", "typing.NamedTuple"} ENUM_BASE_NAMES = { "Enum", "IntEnum", "enum.Enum", "enum.IntEnum", "IntFlag", "enum.IntFlag", } def _infer_first(node, context):
64
64
69
8
56
VikrantAgrahari/littlegenius
venv/lib/python3.8/site-packages/astroid/brain/brain_namedtuple_enum.py
Python
_infer_first
_infer_first
43
53
43
43
e04c117fb83a1b3dd783599ca4efc4ec9b3ec371
bigcode/the-stack
train
b61922960a97883377d364c7
train
function
def infer_typing_namedtuple(node, context=None): """Infer a typing.NamedTuple(...) call.""" # This is essentially a namedtuple with different arguments # so we extract the args and infer a named tuple. try: func = next(node.func.infer()) except InferenceError: raise UseInferenceDefau...
def infer_typing_namedtuple(node, context=None):
"""Infer a typing.NamedTuple(...) call.""" # This is essentially a namedtuple with different arguments # so we extract the args and infer a named tuple. try: func = next(node.func.infer()) except InferenceError: raise UseInferenceDefault if func.qname() != "typing.NamedTuple": ...
s(): generated_class_node.locals[method.name] = [method] for assign in class_node.body: if not isinstance(assign, nodes.Assign): continue for target in assign.targets: attr = target.name generated_class_node.locals[attr] = class_node.locals[attr] re...
80
81
270
11
70
VikrantAgrahari/littlegenius
venv/lib/python3.8/site-packages/astroid/brain/brain_namedtuple_enum.py
Python
infer_typing_namedtuple
infer_typing_namedtuple
396
430
396
396
d15b6b98a9b203ae0efb426852f580c198e6001b
bigcode/the-stack
train
60e187d19c6bc404e87d1e75
train
function
def _looks_like(node, name): func = node.func if isinstance(func, nodes.Attribute): return func.attrname == name if isinstance(func, nodes.Name): return func.name == name return False
def _looks_like(node, name):
func = node.func if isinstance(func, nodes.Attribute): return func.attrname == name if isinstance(func, nodes.Name): return func.name == name return False
def _has_namedtuple_base(node): """Predicate for class inference tip :type node: ClassDef :rtype: bool """ return set(node.basenames) & TYPING_NAMEDTUPLE_BASENAMES def _looks_like(node, name):
64
64
49
8
55
VikrantAgrahari/littlegenius
venv/lib/python3.8/site-packages/astroid/brain/brain_namedtuple_enum.py
Python
_looks_like
_looks_like
150
156
150
150
89c7cbcb0ee71b3dd1056250a71e1e98d2da4bba
bigcode/the-stack
train
1984f49c7bc9e38045620dfa
train
class
class Curve(object): def __init__(self): raise NotImplementedError("Abstract class Curve not instantiable") def fit(self, data, **kwargs): """ Fits the curve to the provided data. Data is accepted as a dict with array fields 'x' and 'y'. A keyword parameter 'iterations...
class Curve(object):
def __init__(self): raise NotImplementedError("Abstract class Curve not instantiable") def fit(self, data, **kwargs): """ Fits the curve to the provided data. Data is accepted as a dict with array fields 'x' and 'y'. A keyword parameter 'iterations' can be given to spe...
import tensorflow as tf class Curve(object):
9
75
250
4
4
tuohis/tensorflow-playground
curve.py
Python
Curve
Curve
3
34
3
3
3ec9ec185c6f51b7f00722c79aebfd4aaf251920
bigcode/the-stack
train
21d0384f1212b785631d0441
train
class
class SecondDegreeCurve(Curve): """ A second-degree curve of the form y = ax^2 + bx + c """ def __init__(self): a = tf.Variable(1.0, tf.float32) b = tf.Variable(1.0, tf.float32) c = tf.Variable(0.0, tf.float32) self.x = tf.placeholder(tf.float32) self.curve = a * ...
class SecondDegreeCurve(Curve):
""" A second-degree curve of the form y = ax^2 + bx + c """ def __init__(self): a = tf.Variable(1.0, tf.float32) b = tf.Variable(1.0, tf.float32) c = tf.Variable(0.0, tf.float32) self.x = tf.placeholder(tf.float32) self.curve = a * self.x**2 + b * self.x + c ...
y:data['y']}) output = sess.run(self.vars + [loss], {self.x:data['x'], y:data['y']}) labels = self.var_names + ['loss'] return { labels[i]: output[i] for i in range(len(output)) } class SecondDegreeCurve(Curve):
64
64
132
7
57
tuohis/tensorflow-playground
curve.py
Python
SecondDegreeCurve
SecondDegreeCurve
36
47
36
36
38e3485555efa78bafef30e776caff71848e4328
bigcode/the-stack
train
c48506dfb4e0a6244396a05b
train
function
def test_metric_tag_symbol(aggregator): metrics = common.SUPPORTED_METRIC_TYPES instance = common.generate_instance_config(metrics) instance['metric_tags'] = [{'MIB': 'SNMPv2-MIB', 'symbol': 'sysName', 'tag': 'snmp_host'}] check = common.create_check(instance) check.check(instance) tags = list...
def test_metric_tag_symbol(aggregator):
metrics = common.SUPPORTED_METRIC_TYPES instance = common.generate_instance_config(metrics) instance['metric_tags'] = [{'MIB': 'SNMPv2-MIB', 'symbol': 'sysName', 'tag': 'snmp_host'}] check = common.create_check(instance) check.check(instance) tags = list(common.CHECK_TAGS) tags.append('snm...
usage instance['bulk_threshold'] = 1 instance['enforce_mib_constraints'] = False check = common.create_check(instance) check.check(instance) aggregator.assert_metric_has_tag_prefix('snmp.ifInOctets', 'speed') def test_metric_tag_symbol(aggregator):
64
64
202
9
55
mchelen-gov/integrations-core
snmp/tests/test_check.py
Python
test_metric_tag_symbol
test_metric_tag_symbol
1,028
1,047
1,028
1,028
630a4d4248aab2126154437b723e67b20d12f349
bigcode/the-stack
train
601b4837df7cec2a3701db1e
train
function
@pytest.mark.parametrize( "config, has_next_bulk_oids", [ pytest.param({}, True, id='disabled_config_default'), pytest.param({'refresh_oids_cache_interval': 0}, True, id='disabled_config_explicit'), pytest.param({'refresh_oids_cache_interval': 60}, False, id='enabled_config_60'), ...
@pytest.mark.parametrize( "config, has_next_bulk_oids", [ pytest.param({}, True, id='disabled_config_default'), pytest.param({'refresh_oids_cache_interval': 0}, True, id='disabled_config_explicit'), pytest.param({'refresh_oids_cache_interval': 60}, False, id='enabled_config_60'), ...
""" Check whether config oids are correctly updated depending on refresh_oids_cache_interval. """ instance = common.generate_instance_config(common.BULK_TABULAR_OBJECTS) instance['bulk_threshold'] = 10 instance.update(config) check = common.create_check(instance) assert bool(check._conf...
@pytest.mark.parametrize( "config, has_next_bulk_oids", [ pytest.param({}, True, id='disabled_config_default'), pytest.param({'refresh_oids_cache_interval': 0}, True, id='disabled_config_explicit'), pytest.param({'refresh_oids_cache_interval': 60}, False, id='enabled_config_60'), ...
114
87
291
114
0
mchelen-gov/integrations-core
snmp/tests/test_check.py
Python
test_oids_cache_config_update
test_oids_cache_config_update
1,289
1,315
1,289
1,298
89d6f0a8275f1020ad8baf283054ef9809acc9e3
bigcode/the-stack
train
3c172f94adb4af93ea4e266f
train
function
def test_snmpget(aggregator): """ When failing with 'snmpget' command, SNMP check falls back to 'snmpgetnext' > snmpget -v2c -c public localhost:11111 1.3.6.1.2.1.25.6.3.1.4 iso.3.6.1.2.1.25.6.3.1.4 = No Such Instance currently exists at this OID > snmpgetnext -v2c -c public localhost:1...
def test_snmpget(aggregator):
""" When failing with 'snmpget' command, SNMP check falls back to 'snmpgetnext' > snmpget -v2c -c public localhost:11111 1.3.6.1.2.1.25.6.3.1.4 iso.3.6.1.2.1.25.6.3.1.4 = No Such Instance currently exists at this OID > snmpgetnext -v2c -c public localhost:11111 1.3.6.1.2.1.25.6.3.1.4 ...
og_checks.snmp.commands._handle_error', side_effect=RuntimeError): check.check(instance) aggregator.assert_service_check("snmp.can_check", status=SnmpCheck.CRITICAL, tags=common.CHECK_TAGS, at_least=1) check.check(instance) aggregator.assert_service_check("snmp.can_check", status=SnmpCheck.OK, tag...
99
99
331
9
90
mchelen-gov/integrations-core
snmp/tests/test_check.py
Python
test_snmpget
test_snmpget
83
107
83
83
f55b1e86f211648b3da30810078b528cad67493d
bigcode/the-stack
train
8f3e6ebd86ed274ca5f1266a
train
function
def test_bulk_table(aggregator, caplog): caplog.set_level(logging.DEBUG) # Needed to test that debug logs won't raise exceptions instance = common.generate_instance_config(common.BULK_TABULAR_OBJECTS) instance['bulk_threshold'] = 5 check = common.create_check(instance) check.check(instance) ...
def test_bulk_table(aggregator, caplog):
caplog.set_level(logging.DEBUG) # Needed to test that debug logs won't raise exceptions instance = common.generate_instance_config(common.BULK_TABULAR_OBJECTS) instance['bulk_threshold'] = 5 check = common.create_check(instance) check.check(instance) # Test metrics for symbol in common.B...
_has_tag_prefix(metric_name, tag, at_least=1) aggregator.assert_metric('snmp.sysUpTimeInstance', count=1) # Test service check aggregator.assert_service_check("snmp.can_check", status=SnmpCheck.OK, tags=common.CHECK_TAGS, at_least=1) common.assert_common_metrics(aggregator) aggregator.all_metrics_...
95
95
318
11
84
mchelen-gov/integrations-core
snmp/tests/test_check.py
Python
test_bulk_table
test_bulk_table
561
590
561
561
c273713194306ac36a011345b20852c3e792cfbf
bigcode/the-stack
train
c01d2d09d8a5cdfbf34706fe
train
function
def test_profile_by_file(aggregator): instance = common.generate_instance_config([]) instance['profile'] = 'profile1' with temp_dir() as tmp: profile_file = os.path.join(tmp, 'profile1.yaml') with open(profile_file, 'wb') as f: f.write(yaml.safe_dump({'metrics': common.SUPPORTED_...
def test_profile_by_file(aggregator):
instance = common.generate_instance_config([]) instance['profile'] = 'profile1' with temp_dir() as tmp: profile_file = os.path.join(tmp, 'profile1.yaml') with open(profile_file, 'wb') as f: f.write(yaml.safe_dump({'metrics': common.SUPPORTED_METRIC_TYPES})) init_config = ...
." + metric['name'] aggregator.assert_metric(metric_name, tags=common_tags, count=1) aggregator.assert_metric('snmp.sysUpTimeInstance', count=1) common.assert_common_metrics(aggregator) aggregator.assert_all_metrics_covered() def test_profile_by_file(aggregator):
64
64
211
9
55
mchelen-gov/integrations-core
snmp/tests/test_check.py
Python
test_profile_by_file
test_profile_by_file
715
733
715
715
a4ba3d7294eb1f70cb060f7c5b0a4667b1f1ddf7
bigcode/the-stack
train
eb543a2c6dfd58885baed08c
train
function
def test_table_v3_SHA_DES(aggregator): """ Support SNMP V3 priv modes: SHA + DES """ # build multiple confgs auth = 'SHA' priv = 'DES' name = 'instance_{}_{}'.format(auth, priv) instance = common.generate_v3_instance_config( common.TABULAR_OBJECTS, name=name, user...
def test_table_v3_SHA_DES(aggregator):
""" Support SNMP V3 priv modes: SHA + DES """ # build multiple confgs auth = 'SHA' priv = 'DES' name = 'instance_{}_{}'.format(auth, priv) instance = common.generate_v3_instance_config( common.TABULAR_OBJECTS, name=name, user='datadog{}{}'.format(auth.upper(), pri...
_has_tag_prefix(metric_name, tag, at_least=1) aggregator.assert_metric('snmp.sysUpTimeInstance', count=1) # Test service check aggregator.assert_service_check("snmp.can_check", status=SnmpCheck.OK, tags=common.CHECK_TAGS, at_least=1) common.assert_common_metrics(aggregator) aggregator.all_metrics_...
95
95
319
11
84
mchelen-gov/integrations-core
snmp/tests/test_check.py
Python
test_table_v3_SHA_DES
test_table_v3_SHA_DES
483
519
483
483
17659acfcfa1a993dc6cc901369e209d0bbb5361
bigcode/the-stack
train
67d360f91be690e559d74c41
train
function
def test_extract_value_inferred(aggregator): instance = common.generate_instance_config( [ { "MIB": "DUMMY-MIB", 'symbol': { 'OID': "1.3.6.1.4.1.123456789.4.0", 'name': "aTemperatureValueInferred", 'extra...
def test_extract_value_inferred(aggregator):
instance = common.generate_instance_config( [ { "MIB": "DUMMY-MIB", 'symbol': { 'OID': "1.3.6.1.4.1.123456789.4.0", 'name': "aTemperatureValueInferred", 'extract_value': r'(\d+)C', }, ...
, count=1, value=value, tags=common.CHECK_TAGS) # Test service check aggregator.assert_service_check("snmp.can_check", status=SnmpCheck.OK, tags=common.CHECK_TAGS, at_least=1) def test_extract_value_inferred(aggregator):
64
64
170
10
54
mchelen-gov/integrations-core
snmp/tests/test_check.py
Python
test_extract_value_inferred
test_extract_value_inferred
126
144
126
126
d48c8602b6e24f39f87209fdfeed44cb7c51de8b
bigcode/the-stack
train
0a86a344510c23d4445ee3ae
train
function
def test_metric_tag_oid(aggregator): metrics = common.SUPPORTED_METRIC_TYPES instance = common.generate_instance_config(metrics) instance['metric_tags'] = [{'OID': '1.3.6.1.2.1.1.5.0', 'symbol': 'sysName', 'tag': 'snmp_host'}] check = common.create_check(instance) check.check(instance) tags = ...
def test_metric_tag_oid(aggregator):
metrics = common.SUPPORTED_METRIC_TYPES instance = common.generate_instance_config(metrics) instance['metric_tags'] = [{'OID': '1.3.6.1.2.1.1.5.0', 'symbol': 'sysName', 'tag': 'snmp_host'}] check = common.create_check(instance) check.check(instance) tags = list(common.CHECK_TAGS) tags.appe...
snmp.sysUpTimeInstance', count=1) aggregator.assert_service_check("snmp.can_check", status=SnmpCheck.OK, tags=tags, at_least=1) common.assert_common_metrics(aggregator) aggregator.all_metrics_asserted() def test_metric_tag_oid(aggregator):
64
64
212
9
55
mchelen-gov/integrations-core
snmp/tests/test_check.py
Python
test_metric_tag_oid
test_metric_tag_oid
1,050
1,069
1,050
1,050
cb67e045fa33769118c3c564c26dd2f28a636a4e
bigcode/the-stack
train
d076f81e2ee2c624b4672b2d
train
function
def test_command_generator(): """ Command generator's parameters should match init_config """ instance = common.generate_instance_config(common.CONSTRAINED_OID) check = SnmpCheck('snmp', common.MIBS_FOLDER, [instance]) config = check._config # Test command generator MIB source mib_folde...
def test_command_generator():
""" Command generator's parameters should match init_config """ instance = common.generate_instance_config(common.CONSTRAINED_OID) check = SnmpCheck('snmp', common.MIBS_FOLDER, [instance]) config = check._config # Test command generator MIB source mib_folders = config._snmp_engine.getMi...
from datadog_checks.dev import temp_dir from datadog_checks.dev.utils import get_metadata_metrics from datadog_checks.snmp import SnmpCheck from . import common pytestmark = [pytest.mark.usefixtures("dd_environment"), common.snmp_integration_only] def test_command_generator():
64
64
177
5
59
mchelen-gov/integrations-core
snmp/tests/test_check.py
Python
test_command_generator
test_command_generator
25
41
25
25
3461e10f0f4ec168511ee1da834b17dfc2f2653c
bigcode/the-stack
train
904908cdf276810f62387b68
train
function
def test_different_tables(aggregator): metrics = [ { 'MIB': 'IF-MIB', 'table': 'ifTable', 'symbols': ['ifInOctets', 'ifOutOctets'], 'metric_tags': [ {'tag': 'interface', 'column': 'ifDescr'}, {'tag': 'speed', 'column': 'ifHighSp...
def test_different_tables(aggregator):
metrics = [ { 'MIB': 'IF-MIB', 'table': 'ifTable', 'symbols': ['ifInOctets', 'ifOutOctets'], 'metric_tags': [ {'tag': 'interface', 'column': 'ifDescr'}, {'tag': 'speed', 'column': 'ifHighSpeed', 'table': 'ifXTable'}, ...
], } ] instance = common.generate_instance_config(metrics) instance['community_string'] = 'entity' check = common.create_check(instance) check.check(instance) aggregator.assert_metric_has_tag_prefix('snmp.entPhySensorValue', 'desc') def test_different_tables(aggregator):
64
64
203
9
55
mchelen-gov/integrations-core
snmp/tests/test_check.py
Python
test_different_tables
test_different_tables
1,004
1,025
1,004
1,004
dfa8d2bba62c607a8b65fc6bc6db1ba96c85ac6d
bigcode/the-stack
train
ddc39ceceed226b03eeef07d
train
function
@pytest.mark.parametrize( 'init_config, instance_extra, expected_interval', [ pytest.param({}, {}, 0, id='none'), pytest.param({}, {'refresh_oids_cache_interval': 3600}, 3600, id='instance_config'), pytest.param({'refresh_oids_cache_interval': 3600}, {}, 3600, id='init_config'), ...
@pytest.mark.parametrize( 'init_config, instance_extra, expected_interval', [ pytest.param({}, {}, 0, id='none'), pytest.param({}, {'refresh_oids_cache_interval': 3600}, 3600, id='instance_config'), pytest.param({'refresh_oids_cache_interval': 3600}, {}, 3600, id='init_config'), ...
instance = common.generate_instance_config(common.TABULAR_OBJECTS) instance.update(instance_extra) check = SnmpCheck('snmp', init_config, [instance]) assert check._config.oid_config._refresh_interval_sec == expected_interval
@pytest.mark.parametrize( 'init_config, instance_extra, expected_interval', [ pytest.param({}, {}, 0, id='none'), pytest.param({}, {'refresh_oids_cache_interval': 3600}, 3600, id='instance_config'), pytest.param({'refresh_oids_cache_interval': 3600}, {}, 3600, id='init_config'), ...
127
64
179
127
0
mchelen-gov/integrations-core
snmp/tests/test_check.py
Python
test_oids_cache_configs
test_oids_cache_configs
1,272
1,286
1,272
1,281
7a65b55fd4bd3e2ff302bc153e3b4605f8ba6c68
bigcode/the-stack
train
a152a45b5eff84ae83a581cb
train
function
def test_table_v3_MD5_AES(aggregator): """ Support SNMP V3 priv modes: MD5 + AES """ # build multiple confgs auth = 'MD5' priv = 'AES' name = 'instance_{}_{}'.format(auth, priv) instance = common.generate_v3_instance_config( common.TABULAR_OBJECTS, name=name, use...
def test_table_v3_MD5_AES(aggregator):
""" Support SNMP V3 priv modes: MD5 + AES """ # build multiple confgs auth = 'MD5' priv = 'AES' name = 'instance_{}_{}'.format(auth, priv) instance = common.generate_v3_instance_config( common.TABULAR_OBJECTS, name=name, user='datadog{}{}'.format(auth.upper(), pr...
_has_tag_prefix(metric_name, tag, at_least=1) aggregator.assert_metric('snmp.sysUpTimeInstance', count=1) # Test service check aggregator.assert_service_check("snmp.can_check", status=SnmpCheck.OK, tags=common.CHECK_TAGS, at_least=1) common.assert_common_metrics(aggregator) aggregator.all_metrics_...
96
96
322
12
84
mchelen-gov/integrations-core
snmp/tests/test_check.py
Python
test_table_v3_MD5_AES
test_table_v3_MD5_AES
443
480
443
443
56427ea0e07fc6745830968c4ee19a866d409e81
bigcode/the-stack
train
23275214eed31c2374f56fcc
train
function
def test_custom_mib(aggregator): instance = common.generate_instance_config([oid for oid, _, _ in common.DUMMY_MIB_OID]) instance["community_string"] = "dummy" check = SnmpCheck('snmp', common.MIBS_FOLDER, [instance]) check.check(instance) # Test metrics for metric, metric_type, value in commo...
def test_custom_mib(aggregator):
instance = common.generate_instance_config([oid for oid, _, _ in common.DUMMY_MIB_OID]) instance["community_string"] = "dummy" check = SnmpCheck('snmp', common.MIBS_FOLDER, [instance]) check.check(instance) # Test metrics for metric, metric_type, value in common.DUMMY_MIB_OID: metric_n...
) # Test service check aggregator.assert_service_check("snmp.can_check", status=SnmpCheck.OK, tags=common.CHECK_TAGS, at_least=1) common.assert_common_metrics(aggregator) aggregator.all_metrics_asserted() def test_custom_mib(aggregator):
64
64
175
9
55
mchelen-gov/integrations-core
snmp/tests/test_check.py
Python
test_custom_mib
test_custom_mib
110
123
110
110
633d3ecf9afcb293eeea3b0c59bf50f7f523e16b
bigcode/the-stack
train
2686078a11ec4aa80e2d54b4
train
function
def test_extract_value_table(aggregator): instance = common.generate_instance_config( [ { "MIB": "IF-MIB", 'table': { 'OID': '1.3.6.1.2.1.2.2', 'name': 'ifTable', }, 'symbols': [ ...
def test_extract_value_table(aggregator):
instance = common.generate_instance_config( [ { "MIB": "IF-MIB", 'table': { 'OID': '1.3.6.1.2.1.2.2', 'name': 'ifTable', }, 'symbols': [ { 'OID': "1...
) instance["community_string"] = "dummy" check = SnmpCheck('snmp', common.MIBS_FOLDER, [instance]) check.check(instance) aggregator.assert_metric( 'snmp.aTemperatureValueForced', metric_type=aggregator.RATE, count=1, value=22, tags=common.CHECK_TAGS ) def test_extract_value_table(aggrega...
85
85
285
9
76
mchelen-gov/integrations-core
snmp/tests/test_check.py
Python
test_extract_value_table
test_extract_value_table
188
224
188
188
b96972626f555be5bb7da687d37964b064030422
bigcode/the-stack
train
cc2eda2dd8ed45d25f3a3fb9
train
function
def test_metric_tag_profile_sysoid(aggregator): instance = common.generate_instance_config([]) definition = { 'metric_tags': [{'OID': '1.3.6.1.2.1.1.5.0', 'symbol': 'sysName', 'tag': 'snmp_host'}], 'metrics': common.SUPPORTED_METRIC_TYPES, 'sysobjectid': '1.3.6.1.4.1.8072.3.2.10', } ...
def test_metric_tag_profile_sysoid(aggregator):
instance = common.generate_instance_config([]) definition = { 'metric_tags': [{'OID': '1.3.6.1.2.1.1.5.0', 'symbol': 'sysName', 'tag': 'snmp_host'}], 'metrics': common.SUPPORTED_METRIC_TYPES, 'sysobjectid': '1.3.6.1.4.1.8072.3.2.10', } init_config = {'profiles': {'profile1': {'de...
_metric(metric_name, tags=tags, count=1) aggregator.assert_metric('snmp.sysUpTimeInstance', count=1) aggregator.assert_service_check("snmp.can_check", status=SnmpCheck.OK, tags=tags, at_least=1) common.assert_common_metrics(aggregator) aggregator.all_metrics_asserted() def test_metric_tag_profile_syso...
84
84
283
12
72
mchelen-gov/integrations-core
snmp/tests/test_check.py
Python
test_metric_tag_profile_sysoid
test_metric_tag_profile_sysoid
1,099
1,123
1,099
1,099
5cf11a6f9d2de41562756250700679fba1cfa58d
bigcode/the-stack
train
370d1aba7c49abd16761951f
train
function
def test_resolved_table(aggregator): instance = common.generate_instance_config(common.RESOLVED_TABULAR_OBJECTS) check = common.create_check(instance) check.check(instance) for symbol in common.TABULAR_OBJECTS[0]['symbols']: metric_name = "snmp." + symbol aggregator.assert_metric(metri...
def test_resolved_table(aggregator):
instance = common.generate_instance_config(common.RESOLVED_TABULAR_OBJECTS) check = common.create_check(instance) check.check(instance) for symbol in common.TABULAR_OBJECTS[0]['symbols']: metric_name = "snmp." + symbol aggregator.assert_metric(metric_name, at_least=1) aggregato...
suffix:{}'.format(interface[1:]), ] aggregator.assert_metric(metric_name, tags=tags) aggregator.assert_metric('snmp.sysUpTimeInstance', count=1) common.assert_common_metrics(aggregator) aggregator.assert_all_metrics_covered() def test_resolved_table(aggregator):
64
64
207
9
55
mchelen-gov/integrations-core
snmp/tests/test_check.py
Python
test_resolved_table
test_resolved_table
381
400
381
381
a91dd2d7f92e26572bf5579e0abc6d831777c46a
bigcode/the-stack
train
8932f63eb9321e40e8c117a3
train
function
def test_type_support(aggregator): """ Support expected types """ metrics = common.SUPPORTED_METRIC_TYPES + common.UNSUPPORTED_METRICS instance = common.generate_instance_config(metrics) check = common.create_check(instance) check.check(instance) # Test metrics for metric in common...
def test_type_support(aggregator):
""" Support expected types """ metrics = common.SUPPORTED_METRIC_TYPES + common.UNSUPPORTED_METRICS instance = common.generate_instance_config(metrics) check = common.create_check(instance) check.check(instance) # Test metrics for metric in common.SUPPORTED_METRIC_TYPES: me...
# Default value check = SnmpCheck('snmp', common.IGNORE_NONINCREASING_OID, [instance]) assert check.ignore_nonincreasing_oid assert common.MIBS_FOLDER["mibs_folder"] in full_path_mib_folders def test_type_support(aggregator):
65
65
219
8
56
mchelen-gov/integrations-core
snmp/tests/test_check.py
Python
test_type_support
test_type_support
44
67
44
44
27d61dcaa366aaa012c074b3c7c66cd83263b49e
bigcode/the-stack
train
efa5796dcc9b841f068d45cc
train
function
def test_extract_value_forced_type(aggregator): instance = common.generate_instance_config( [ { "MIB": "DUMMY-MIB", 'forced_type': 'counter', 'symbol': { 'OID': "1.3.6.1.4.1.123456789.4.0", 'name': "aTemperat...
def test_extract_value_forced_type(aggregator):
instance = common.generate_instance_config( [ { "MIB": "DUMMY-MIB", 'forced_type': 'counter', 'symbol': { 'OID': "1.3.6.1.4.1.123456789.4.0", 'name': "aTemperatureValueForced", 'extract_va...
["community_string"] = "dummy" check = SnmpCheck('snmp', common.MIBS_FOLDER, [instance]) check.check(instance) assert "Unable to submit metric `aTemperatureValueInferred`" in str(caplog.text) def test_extract_value_forced_type(aggregator):
64
64
176
11
53
mchelen-gov/integrations-core
snmp/tests/test_check.py
Python
test_extract_value_forced_type
test_extract_value_forced_type
166
185
166
166
0b08942e27a5353db38a594da4e23ac236be5e9a
bigcode/the-stack
train
b0bef8ecbe6daef52de16208
train
function
def test_cast_metrics(aggregator): instance = common.generate_instance_config(common.CAST_METRICS) check = common.create_check(instance) check.check(instance) aggregator.assert_metric('snmp.cpuload1', value=0.06) aggregator.assert_metric('snmp.cpuload2', value=0.06) aggregator.assert_metric('sn...
def test_cast_metrics(aggregator):
instance = common.generate_instance_config(common.CAST_METRICS) check = common.create_check(instance) check.check(instance) aggregator.assert_metric('snmp.cpuload1', value=0.06) aggregator.assert_metric('snmp.cpuload2', value=0.06) aggregator.assert_metric('snmp.sysUpTimeInstance', count=1) ...
) # Test service check aggregator.assert_service_check("snmp.can_check", status=SnmpCheck.CRITICAL, tags=common.CHECK_TAGS, at_least=1) common.assert_common_metrics(aggregator) aggregator.all_metrics_asserted() def test_cast_metrics(aggregator):
64
64
103
8
56
mchelen-gov/integrations-core
snmp/tests/test_check.py
Python
test_cast_metrics
test_cast_metrics
685
695
685
685
65cc6ee137e346177233fb72f6551751d41d4663
bigcode/the-stack
train
af09794053c7e6b2b432bfae
train
function
def test_profile_sysoid_list(aggregator, caplog): definition = { 'metric_tags': [{'OID': '1.3.6.1.2.1.1.2', 'symbol': 'sysoid', 'tag': 'snmp_oid'}], 'metrics': [{'OID': "1.3.6.1.2.1.7.1.0", 'name': "IAmACounter32"}], 'sysobjectid': ['1.3.6.1.4.1.232.1.2', '1.3.6.1.4.1.1.2.1.3.4'], } ...
def test_profile_sysoid_list(aggregator, caplog):
definition = { 'metric_tags': [{'OID': '1.3.6.1.2.1.1.2', 'symbol': 'sysoid', 'tag': 'snmp_oid'}], 'metrics': [{'OID': "1.3.6.1.2.1.7.1.0", 'name': "IAmACounter32"}], 'sysobjectid': ['1.3.6.1.4.1.232.1.2', '1.3.6.1.4.1.1.2.1.3.4'], } init_config = {'profiles': {'profile1': {'definiti...
'profile1': { 'definition': {'metrics': common.SUPPORTED_METRIC_TYPES, 'sysobjectid': '1.3.6.1.4.1.8072.3.2.10'} } } } check = SnmpCheck('snmp', init_config, [instance]) check.check(instance) common_tags = common.CHECK_TAGS + ['snmp_profile:profile1'] for metric...
180
180
600
14
166
mchelen-gov/integrations-core
snmp/tests/test_check.py
Python
test_profile_sysoid_list
test_profile_sysoid_list
758
801
758
758
da7bab8c3f18654dc0823b46b26b6a956fbc183f
bigcode/the-stack
train
d36962e4169125b2ec564253
train
function
def test_enforce_constraint(aggregator): instance = common.generate_instance_config(common.CONSTRAINED_OID) instance["community_string"] = "constraint" instance["enforce_mib_constraints"] = True check = common.create_check(instance) check.check(instance) aggregator.assert_service_check("snmp.c...
def test_enforce_constraint(aggregator):
instance = common.generate_instance_config(common.CONSTRAINED_OID) instance["community_string"] = "constraint" instance["enforce_mib_constraints"] = True check = common.create_check(instance) check.check(instance) aggregator.assert_service_check("snmp.can_check", status=SnmpCheck.CRITICAL, tag...
) aggregator.all_metrics_asserted() aggregator.assert_metrics_using_metadata( get_metadata_metrics(), check_submission_type=True, exclude=['snmp.snmpEngineTime', 'snmp.tcpInSegs', 'snmp.udpDatagrams'], ) def test_enforce_constraint(aggregator):
64
64
116
9
55
mchelen-gov/integrations-core
snmp/tests/test_check.py
Python
test_enforce_constraint
test_enforce_constraint
283
293
283
283
80df6d8de10226b0dc49c59e072af517b84c23e6
bigcode/the-stack
train
2e3811a20685a5916294b5ef
train
function
def test_profile_sys_object_unknown(aggregator, caplog): """If the fetched sysObjectID is not referenced by any profiles, check fails.""" caplog.set_level(logging.WARNING) unknown_sysobjectid = '1.2.3.4.5' init_config = { 'profiles': { 'profile1': {'definition': {'metrics': common.S...
def test_profile_sys_object_unknown(aggregator, caplog):
"""If the fetched sysObjectID is not referenced by any profiles, check fails.""" caplog.set_level(logging.WARNING) unknown_sysobjectid = '1.2.3.4.5' init_config = { 'profiles': { 'profile1': {'definition': {'metrics': common.SUPPORTED_METRIC_TYPES, 'sysobjectid': unknown_sysobjectid...
name'] aggregator.assert_metric(metric_name, tags=matching_profile_tags, count=1) for metric in least_specific_profile['metrics']: metric_name = "snmp." + metric['name'] aggregator.assert_metric(metric_name, tags=ignored_profile_tags, count=0) aggregator.assert_metric('snmp.sysUpTimeIn...
111
111
371
13
98
mchelen-gov/integrations-core
snmp/tests/test_check.py
Python
test_profile_sys_object_unknown
test_profile_sys_object_unknown
843
889
843
843
05cb6ee8635f459b1c37082f1e03fc35de60402d
bigcode/the-stack
train
877dbbc9a8860b3c3566d609
train
function
def test_forcedtype_metric(aggregator): """ Forced Types should be reported as metrics of the forced type """ instance = common.generate_instance_config(common.FORCED_METRICS) check = common.create_check(instance) check.check(instance) aggregator.assert_metric('snmp.IAmAGauge32', tags=commo...
def test_forcedtype_metric(aggregator):
""" Forced Types should be reported as metrics of the forced type """ instance = common.generate_instance_config(common.FORCED_METRICS) check = common.create_check(instance) check.check(instance) aggregator.assert_metric('snmp.IAmAGauge32', tags=common.CHECK_TAGS, count=1, metric_type=aggre...
common.generate_instance_config(common.INVALID_METRICS) check = common.create_check(instance) check.check(instance) # Test service check aggregator.assert_service_check("snmp.can_check", status=SnmpCheck.WARNING, tags=common.CHECK_TAGS, at_least=1) def test_forcedtype_metric(aggregator):
71
71
239
10
61
mchelen-gov/integrations-core
snmp/tests/test_check.py
Python
test_forcedtype_metric
test_forcedtype_metric
605
625
605
605
6467e17fff38050f9d62825f5bf2611c26f30193
bigcode/the-stack
train