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
a2499c9b19c45642823905dc
train
class
class UOWTransaction(object): def __init__(self, session): self.session = session # dictionary used by external actors to # store arbitrary state information. self.attributes = {} # dictionary of mappers to sets of # DependencyProcessors, which are also # se...
class UOWTransaction(object):
def __init__(self, session): self.session = session # dictionary used by external actors to # store arbitrary state information. self.attributes = {} # dictionary of mappers to sets of # DependencyProcessors, which are also # set to be part of the sorted flu...
state.session if sess: if sess._warn_on_events: sess._flush_warning("related attribute set") prop = state.manager.mapper._props[key] if newvalue is not None: newvalue_state = attributes.instance_state(newvalue) if prop._casca...
256
256
2,251
6
250
lindamar/ecclesi
env/lib/python2.7/site-packages/sqlalchemy/orm/unitofwork.py
Python
UOWTransaction
UOWTransaction
109
411
109
109
fdc6232321ae77577001f6a72af94f26400d7eb4
bigcode/the-stack
train
b34d98e4a4d2b1a97aee4be8
train
class
class IssuePostUpdate(PostSortRec): def __init__(self, uow, mapper, isdelete): self.mapper = mapper self.isdelete = isdelete def execute(self, uow): states, cols = uow.post_update_states[self.mapper] states = [s for s in states if uow.states[s][0] == self.isdelete] pers...
class IssuePostUpdate(PostSortRec):
def __init__(self, uow, mapper, isdelete): self.mapper = mapper self.isdelete = isdelete def execute(self, uow): states, cols = uow.post_update_states[self.mapper] states = [s for s in states if uow.states[s][0] == self.isdelete] persistence.post_update(self.mapper, sta...
, uow): for mapper in self._mappers(uow): for state in uow.mappers[mapper]: (isdelete, listonly) = uow.states[state] if isdelete == self.delete and not listonly: yield state class IssuePostUpdate(PostSortRec):
64
64
94
8
55
lindamar/ecclesi
env/lib/python2.7/site-packages/sqlalchemy/orm/unitofwork.py
Python
IssuePostUpdate
IssuePostUpdate
527
536
527
527
3e632bb37587aee0be1e95fef053bfb79cc7f1c5
bigcode/the-stack
train
f3afb496f6eed049c8867476
train
class
class DeleteState(PostSortRec): def __init__(self, uow, state, mapper): self.state = state self.mapper = mapper def execute_aggregate(self, uow, recs): cls_ = self.__class__ mapper = self.mapper our_recs = [r for r in recs if r.__class__ is cls_ and ...
class DeleteState(PostSortRec):
def __init__(self, uow, state, mapper): self.state = state self.mapper = mapper def execute_aggregate(self, uow, recs): cls_ = self.__class__ mapper = self.mapper our_recs = [r for r in recs if r.__class__ is cls_ and r.mapper is m...
(mapper, [self.state] + [r.state for r in our_recs], uow) def __repr__(self): return "%s(%s)" % ( self.__class__.__name__, orm_util.state_str(self.state) ) class DeleteState(PostSortRec):
64
64
178
7
57
lindamar/ecclesi
env/lib/python2.7/site-packages/sqlalchemy/orm/unitofwork.py
Python
DeleteState
DeleteState
651
672
651
651
511c8ffd2d0c4cefc4d2be9b0f06cf8ee23d1bbf
bigcode/the-stack
train
958ca96363a761d931e75d4c
train
class
class SaveUpdateState(PostSortRec): def __init__(self, uow, state, mapper): self.state = state self.mapper = mapper def execute_aggregate(self, uow, recs): cls_ = self.__class__ mapper = self.mapper our_recs = [r for r in recs if r.__class__ is cls_ a...
class SaveUpdateState(PostSortRec):
def __init__(self, uow, state, mapper): self.state = state self.mapper = mapper def execute_aggregate(self, uow, recs): cls_ = self.__class__ mapper = self.mapper our_recs = [r for r in recs if r.__class__ is cls_ and r.mapper is m...
aves(uow, states) def __repr__(self): return "%s(%s, %s, delete=%s)" % ( self.__class__.__name__, self.dependency_processor, orm_util.state_str(self.state), self.delete ) class SaveUpdateState(PostSortRec):
64
64
163
8
56
lindamar/ecclesi
env/lib/python2.7/site-packages/sqlalchemy/orm/unitofwork.py
Python
SaveUpdateState
SaveUpdateState
627
648
627
627
2ae00d8aa968db2599667a03a5d2258936e70e70
bigcode/the-stack
train
f429ea38769b5b211b66745f
train
class
class PostSortRec(object): disabled = False def __new__(cls, uow, *args): key = (cls, ) + args if key in uow.postsort_actions: return uow.postsort_actions[key] else: uow.postsort_actions[key] = \ ret = \ object.__new__(cls) ...
class PostSortRec(object):
disabled = False def __new__(cls, uow, *args): key = (cls, ) + args if key in uow.postsort_actions: return uow.postsort_actions[key] else: uow.postsort_actions[key] = \ ret = \ object.__new__(cls) return ret def ex...
delete_states, True) or self.dependency_processor. prop_has_changes(uow, save_states, False) ): self.dependency_processor.per_property_flush_actions(uow) self.setup_flush_actions = True return True else: ...
64
64
141
6
57
lindamar/ecclesi
env/lib/python2.7/site-packages/sqlalchemy/orm/unitofwork.py
Python
PostSortRec
PostSortRec
467
487
467
467
89e6234d54d115db292056a87bdcd613aa3b19ee
bigcode/the-stack
train
ce383aface06449477767586
train
class
class Preprocess(IterateMappersMixin): def __init__(self, dependency_processor, fromparent): self.dependency_processor = dependency_processor self.fromparent = fromparent self.processed = set() self.setup_flush_actions = False def execute(self, uow): delete_states = set(...
class Preprocess(IterateMappersMixin):
def __init__(self, dependency_processor, fromparent): self.dependency_processor = dependency_processor self.fromparent = fromparent self.processed = set() self.setup_flush_actions = False def execute(self, uow): delete_states = set() save_states = set() ...
IterateMappersMixin(object): def _mappers(self, uow): if self.fromparent: return iter( m for m in self.dependency_processor.parent.self_and_descendants if uow._mapper_for_dep[(m, self.dependency_processor)] ) else: ...
86
86
287
10
75
lindamar/ecclesi
env/lib/python2.7/site-packages/sqlalchemy/orm/unitofwork.py
Python
Preprocess
Preprocess
426
464
426
426
6c1f2e753a5bb35c7083016bffa3b5c24dd7222c
bigcode/the-stack
train
680d4a1237ff8a206f7acaaf
train
class
class SaveUpdateAll(PostSortRec): def __init__(self, uow, mapper): self.mapper = mapper assert mapper is mapper.base_mapper def execute(self, uow): persistence.save_obj(self.mapper, uow.states_for_mapper_hierarchy( self.mappe...
class SaveUpdateAll(PostSortRec):
def __init__(self, uow, mapper): self.mapper = mapper assert mapper is mapper.base_mapper def execute(self, uow): persistence.save_obj(self.mapper, uow.states_for_mapper_hierarchy( self.mapper, False, False), ...
def execute(self, uow): states, cols = uow.post_update_states[self.mapper] states = [s for s in states if uow.states[s][0] == self.isdelete] persistence.post_update(self.mapper, states, uow, cols) class SaveUpdateAll(PostSortRec):
65
65
218
8
57
lindamar/ecclesi
env/lib/python2.7/site-packages/sqlalchemy/orm/unitofwork.py
Python
SaveUpdateAll
SaveUpdateAll
539
565
539
539
43c7875f35fff5194cbc70faa860c44325f41651
bigcode/the-stack
train
f728b92c350838421b7df64e
train
class
class DavisDataset(ISDataset): def __init__(self, dataset_path, images_dir_name='img', masks_dir_name='gt', **kwargs): super(DavisDataset, self).__init__(**kwargs) self.dataset_path = Path(dataset_path) self._images_path = self.dataset_path / images_dir_nam...
class DavisDataset(ISDataset):
def __init__(self, dataset_path, images_dir_name='img', masks_dir_name='gt', **kwargs): super(DavisDataset, self).__init__(**kwargs) self.dataset_path = Path(dataset_path) self._images_path = self.dataset_path / images_dir_name self._insts_path = se...
from pathlib import Path import cv2 import numpy as np from isegm.data.base import ISDataset from isegm.data.sample import DSample class DavisDataset(ISDataset):
40
78
260
6
33
supervisely-ecosystem/ritm-training
isegm/data/datasets/davis.py
Python
DavisDataset
DavisDataset
10
33
10
10
2e0afae2bfcad976c77dd2913adbbd2e5f34717e
bigcode/the-stack
train
1acd7b6e488399d2caa8caec
train
class
class Packet(Enum): """ Packet (Enum Class) Packet type .. data:: icmp = 0 ICMP packet type .. data:: icm_pv6 = 1 ICMPv6 packet type .. data:: igmp = 2 IGMP packet type .. data:: unknown = 3 Packet type unknown """ icmp = Enum.YLeaf(0, "icmp") icm_...
class Packet(Enum):
""" Packet (Enum Class) Packet type .. data:: icmp = 0 ICMP packet type .. data:: icm_pv6 = 1 ICMPv6 packet type .. data:: igmp = 2 IGMP packet type .. data:: unknown = 3 Packet type unknown """ icmp = Enum.YLeaf(0, "icmp") icm_pv6 = Enum.YLeaf(1, ...
"up") na = Enum.YLeaf(2, "na") @staticmethod def _meta_info(): from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_ip_tcp_oper as meta return meta._meta_table['NsrStatus'] class Packet(Enum):
64
64
191
4
60
CiscoDevNet/ydk-py
cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_ip_tcp_oper.py
Python
Packet
Packet
1,161
1,197
1,161
1,161
da68266b499b01361489567d5a3b9ec1b940cae6
bigcode/the-stack
train
76a7b5c25028a7ff2ac3c757
train
class
class TcpConnection(_Entity_): """ TCP connection operational data .. attribute:: nodes Table of information about all nodes present on the system **type**\: :py:class:`Nodes <ydk.models.cisco_ios_xr.Cisco_IOS_XR_ip_tcp_oper.TcpConnection.Nodes>` **config**\: False ...
class TcpConnection(_Entity_):
""" TCP connection operational data .. attribute:: nodes Table of information about all nodes present on the system **type**\: :py:class:`Nodes <ydk.models.cisco_ios_xr.Cisco_IOS_XR_ip_tcp_oper.TcpConnection.Nodes>` **config**\: False """ _prefix = 'ip-tcp-...
ger Timer .. data:: retransmission_giveup_timer = 6 Retransmission Giveup timer .. data:: throttle_timer = 7 Throttle (for PAW/xipc) timer """ retransmission_timer = Enum.YLeaf(0, "retransmission-timer") window_probe_timer = Enum.YLeaf(1, "window-probe-timer") timewait_state_ti...
255
256
61,675
7
248
CiscoDevNet/ydk-py
cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_ip_tcp_oper.py
Python
TcpConnection
TcpConnection
1,596
8,888
1,596
1,596
841b93a2ae636c758d30b2e269551a870da0fc8e
bigcode/the-stack
train
35a0299cbe3dbe02ad982316
train
class
class MessageTypeIcmp_(Enum): """ MessageTypeIcmp\_ (Enum Class) LPTS ICMP message types .. data:: echo_reply = 0 ICMP Packet type: Echo reply .. data:: destination_unreachable = 3 ICMP Packet type: Destination unreachable .. data:: source_quench = 4 ICMP Packet type: Sourc...
class MessageTypeIcmp_(Enum):
""" MessageTypeIcmp\_ (Enum Class) LPTS ICMP message types .. data:: echo_reply = 0 ICMP Packet type: Echo reply .. data:: destination_unreachable = 3 ICMP Packet type: Destination unreachable .. data:: source_quench = 4 ICMP Packet type: Source quench .. data:: redire...
14, "time-stamp-reply") information_request = Enum.YLeaf(15, "information-request") information_reply = Enum.YLeaf(16, "information-reply") address_mask_request = Enum.YLeaf(17, "address-mask-request") address_mask_reply = Enum.YLeaf(18, "address-mask-reply") trace_route = Enum.YLeaf(30, "trace...
256
256
964
8
248
CiscoDevNet/ydk-py
cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_ip_tcp_oper.py
Python
MessageTypeIcmp_
MessageTypeIcmp_
214
370
214
214
60e17401dcdcd1f1590134efeb6bd3adb4874714
bigcode/the-stack
train
f329d4a6a4fdc4bfc3381875
train
class
class MessageTypeIcmp(Enum): """ MessageTypeIcmp (Enum Class) LPTS ICMP message types .. data:: echo_reply = 0 ICMP Packet type: Echo reply .. data:: destination_unreachable = 3 ICMP Packet type: Destination unreachable .. data:: source_quench = 4 ICMP Packet type: Source q...
class MessageTypeIcmp(Enum):
""" MessageTypeIcmp (Enum Class) LPTS ICMP message types .. data:: echo_reply = 0 ICMP Packet type: Echo reply .. data:: destination_unreachable = 3 ICMP Packet type: Destination unreachable .. data:: source_quench = 4 ICMP Packet type: Source quench .. data:: redirect...
from ydk.types import Entity as _Entity_ from ydk.types import EntityPath, Identity, Enum, YType, YLeaf, YLeafList, YList, LeafDataList, Bits, Empty, Decimal64 from ydk.types import Entity, EntityPath, Identity, Enum, YType, YLeaf, YLeafList, YList, LeafDataList, Bits, Empty, Decimal64 from ydk.filters import YFilter...
256
256
960
7
249
CiscoDevNet/ydk-py
cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_ip_tcp_oper.py
Python
MessageTypeIcmp
MessageTypeIcmp
55
211
55
55
25489638f5a81d039950e4f172a8536cbcce6e9d
bigcode/the-stack
train
cb53a685d993468f94dcc876
train
class
class TcpKeyInvalidReason(Enum): """ TcpKeyInvalidReason (Enum Class) TCP AO key state invalid reason .. data:: none = 0 No reason .. data:: incomplete = 1 Incomplete .. data:: lifetime_not_same = 2 Send and accept lifetime are not same .. data:: send_id_invalid = 3 ...
class TcpKeyInvalidReason(Enum):
""" TcpKeyInvalidReason (Enum Class) TCP AO key state invalid reason .. data:: none = 0 No reason .. data:: incomplete = 1 Incomplete .. data:: lifetime_not_same = 2 Send and accept lifetime are not same .. data:: send_id_invalid = 3 Send ID is invalid .. da...
2") time_wait = Enum.YLeaf(10, "time-wait") @staticmethod def _meta_info(): from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_ip_tcp_oper as meta return meta._meta_table['TcpConnState'] class TcpKeyInvalidReason(Enum):
69
69
231
7
62
CiscoDevNet/ydk-py
cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_ip_tcp_oper.py
Python
TcpKeyInvalidReason
TcpKeyInvalidReason
1,406
1,448
1,406
1,406
9ab555234ad2d962ca81483d2437384220b64df1
bigcode/the-stack
train
0784ce3d1b5b400b22a0473a
train
class
class MessageTypeIcmpv6(Enum): """ MessageTypeIcmpv6 (Enum Class) LPTS ICMPv6 message types .. data:: destination_unreachable = 1 ICMPv6 Packet type: Destination unreachable .. data:: packet_too_big = 2 ICMPv6 Packet type: packet too big .. data:: time_exceeded = 3 ICMPv6 P...
class MessageTypeIcmpv6(Enum):
""" MessageTypeIcmpv6 (Enum Class) LPTS ICMPv6 message types .. data:: destination_unreachable = 1 ICMPv6 Packet type: Destination unreachable .. data:: packet_too_big = 2 ICMPv6 Packet type: packet too big .. data:: time_exceeded = 3 ICMPv6 Packet type: Time exceeded ...
"time-stamp-reply") information_request = Enum.YLeaf(15, "information-request") information_reply = Enum.YLeaf(16, "information-reply") address_mask_request = Enum.YLeaf(17, "address-mask-request") address_mask_reply = Enum.YLeaf(18, "address-mask-reply") trace_route = Enum.YLeaf(30, "trace-ro...
256
256
1,529
9
247
CiscoDevNet/ydk-py
cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_ip_tcp_oper.py
Python
MessageTypeIcmpv6
MessageTypeIcmpv6
373
595
373
373
b6c3628285b0405f07ec81b2eab95a3c6d063dfb
bigcode/the-stack
train
df4579397ea230064647759c
train
class
class MessageTypeIgmp(Enum): """ MessageTypeIgmp (Enum Class) LPTS IGMP message types .. data:: membership_query = 17 IGMP Packet type: Membership query .. data:: v1_membership_report = 18 IGMP Packet type: V1 membership report .. data:: dvmrp = 19 IGMP Packet type: DVMRP ...
class MessageTypeIgmp(Enum):
""" MessageTypeIgmp (Enum Class) LPTS IGMP message types .. data:: membership_query = 17 IGMP Packet type: Membership query .. data:: v1_membership_report = 18 IGMP Packet type: V1 membership report .. data:: dvmrp = 19 IGMP Packet type: DVMRP .. data:: pi_mv1 = 20 ...
"certification-path-solicitation-message") certification_path_advertisement_message = Enum.YLeaf(149, "certification-path-advertisement-message") experimental_mobility_protocols = Enum.YLeaf(150, "experimental-mobility-protocols") multicast_router_advertisement = Enum.YLeaf(151, "multicast-router-advert...
191
191
637
7
184
CiscoDevNet/ydk-py
cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_ip_tcp_oper.py
Python
MessageTypeIgmp
MessageTypeIgmp
823
915
823
823
825c54c1eb7c6f5c1eac54ed1bb1551fa456f4ca
bigcode/the-stack
train
64235df2b23704f56d9a70da
train
class
class TcpNsr(_Entity_): """ tcp nsr .. attribute:: nodes Table of information about all nodes present on the system **type**\: :py:class:`Nodes <ydk.models.cisco_ios_xr.Cisco_IOS_XR_ip_tcp_oper.TcpNsr.Nodes>` **config**\: False """ _prefix = 'ip-tcp-oper' ...
class TcpNsr(_Entity_):
""" tcp nsr .. attribute:: nodes Table of information about all nodes present on the system **type**\: :py:class:`Nodes <ydk.models.cisco_ios_xr.Cisco_IOS_XR_ip_tcp_oper.TcpNsr.Nodes>` **config**\: False """ _prefix = 'ip-tcp-oper' _revision = '2018-11-...
r._meta import _Cisco_IOS_XR_ip_tcp_oper as meta return meta._meta_table['Tcp.Nodes.Node.Statistics.Ipv6Traffic']['meta_info'] @staticmethod def _meta_info(): from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_ip_tcp_oper as meta ...
256
256
47,700
8
248
CiscoDevNet/ydk-py
cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_ip_tcp_oper.py
Python
TcpNsr
TcpNsr
9,291
14,701
9,291
9,291
fcc8db9c8fa6ae98cb8b58a6c4543e8e58fd41a4
bigcode/the-stack
train
72785419694f2b873dad122d
train
class
class Tcp(_Entity_): """ tcp .. attribute:: nodes Node\-specific TCP operational data **type**\: :py:class:`Nodes <ydk.models.cisco_ios_xr.Cisco_IOS_XR_ip_tcp_oper.Tcp.Nodes>` **config**\: False """ _prefix = 'ip-tcp-oper' _revision = '2018-11-01' ...
class Tcp(_Entity_):
""" tcp .. attribute:: nodes Node\-specific TCP operational data **type**\: :py:class:`Nodes <ydk.models.cisco_ios_xr.Cisco_IOS_XR_ip_tcp_oper.Tcp.Nodes>` **config**\: False """ _prefix = 'ip-tcp-oper' _revision = '2018-11-01' def __init__(self): ...
Cisco_IOS_XR_ip_tcp_oper as meta return meta._meta_table['TcpConnection.Nodes.Node.BriefInformations.BriefInformation']['meta_info'] @staticmethod def _meta_info(): from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_ip_tcp_oper as meta ...
256
256
3,126
6
250
CiscoDevNet/ydk-py
cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_ip_tcp_oper.py
Python
Tcp
Tcp
8,891
9,288
8,891
8,891
6c753dd4c43bb9f0232955953ad8fe75f357218b
bigcode/the-stack
train
a91f604e3eac9a9bbb6719b8
train
class
class TcpMacAlgo(Enum): """ TcpMacAlgo (Enum Class) TCP AO MAC algorithm type .. data:: not_configured = 0 Not configured .. data:: aes_128_cmac_96 = 1 CMAC 96 .. data:: hmac_sha1_12 = 2 HMAC SHA1 12 .. data:: md5_16 = 3 MD5 16 .. data:: sha1_20 = 4 SH...
class TcpMacAlgo(Enum):
""" TcpMacAlgo (Enum Class) TCP AO MAC algorithm type .. data:: not_configured = 0 Not configured .. data:: aes_128_cmac_96 = 1 CMAC 96 .. data:: hmac_sha1_12 = 2 HMAC SHA1 12 .. data:: md5_16 = 3 MD5 16 .. data:: sha1_20 = 4 SHA1 20 .. data:: hma...
= 3 Send ID is invalid .. data:: recv_id_invalid = 4 Receive ID is invalid """ none = Enum.YLeaf(0, "none") incomplete = Enum.YLeaf(1, "incomplete") lifetime_not_same = Enum.YLeaf(2, "lifetime-not-same") send_id_invalid = Enum.YLeaf(3, "send-id-invalid") recv_id_invalid =...
157
157
525
6
151
CiscoDevNet/ydk-py
cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_ip_tcp_oper.py
Python
TcpMacAlgo
TcpMacAlgo
1,451
1,529
1,451
1,451
6c1dc42cd2f42bb1823e2dae8c149ad1687afb01
bigcode/the-stack
train
fa370a4dcf05904fef6b71ef
train
class
class NsrDownReason(Enum): """ NsrDownReason (Enum Class) NSR\-Down Reasons .. data:: none = 0 None, i.e. NSR was never up .. data:: init_sync_aborted = 1 Initial sync was aborted .. data:: client_disabled = 2 Disabled by Active APP .. data:: client_disconnect = 3 ...
class NsrDownReason(Enum):
""" NsrDownReason (Enum Class) NSR\-Down Reasons .. data:: none = 0 None, i.e. NSR was never up .. data:: init_sync_aborted = 1 Initial sync was aborted .. data:: client_disabled = 2 Disabled by Active APP .. data:: client_disconnect = 3 Standby APP disconnected ...
hip-report") v2_leave_group = Enum.YLeaf(23, "v2-leave-group") multicast_traceroute_response = Enum.YLeaf(30, "multicast-traceroute-response") multicast_traceroute = Enum.YLeaf(31, "multicast-traceroute") v3_membership_report = Enum.YLeaf(34, "v3-membership-report") multicast_router_advertiseme...
197
197
657
7
190
CiscoDevNet/ydk-py
cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_ip_tcp_oper.py
Python
NsrDownReason
NsrDownReason
1,013
1,125
1,013
1,013
07f306a4091d2f80e2577feb3bc0333ff6ed3a96
bigcode/the-stack
train
e46e8706d1cccbd599c53733
train
class
class AddrFamily(Enum): """ AddrFamily (Enum Class) Address Family Types .. data:: internetwork = 2 Internetwork: UDP, TCP, etc. .. data:: ip_version6 = 10 IP version 6 """ internetwork = Enum.YLeaf(2, "internetwork") ip_version6 = Enum.YLeaf(10, "ip-version6") @s...
class AddrFamily(Enum):
""" AddrFamily (Enum Class) Address Family Types .. data:: internetwork = 2 Internetwork: UDP, TCP, etc. .. data:: ip_version6 = 10 IP version 6 """ internetwork = Enum.YLeaf(2, "internetwork") ip_version6 = Enum.YLeaf(10, "ip-version6") @staticmethod def _met...
Enum, YType, YLeaf, YLeafList, YList, LeafDataList, Bits, Empty, Decimal64 from ydk.filters import YFilter from ydk.errors import YError, YModelError from ydk.errors.error_handler import handle_type_error as _handle_type_error class AddrFamily(Enum):
64
64
134
5
58
CiscoDevNet/ydk-py
cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_ip_tcp_oper.py
Python
AddrFamily
AddrFamily
28
52
28
28
93a9b27e25e44718ed5a27f72bf9294c5546ad32
bigcode/the-stack
train
c2fbfdd02897ce5da1cbfa74
train
class
class MessageTypeIgmp_(Enum): """ MessageTypeIgmp\_ (Enum Class) LPTS IGMP message types .. data:: membership_query = 17 IGMP Packet type: Membership query .. data:: v1_membership_report = 18 IGMP Packet type: V1 membership report .. data:: dvmrp = 19 IGMP Packet type: DVMR...
class MessageTypeIgmp_(Enum):
""" MessageTypeIgmp\_ (Enum Class) LPTS IGMP message types .. data:: membership_query = 17 IGMP Packet type: Membership query .. data:: v1_membership_report = 18 IGMP Packet type: V1 membership report .. data:: dvmrp = 19 IGMP Packet type: DVMRP .. data:: pi_mv1 = 20 ...
2_leave_group = Enum.YLeaf(23, "v2-leave-group") multicast_traceroute_response = Enum.YLeaf(30, "multicast-traceroute-response") multicast_traceroute = Enum.YLeaf(31, "multicast-traceroute") v3_membership_report = Enum.YLeaf(34, "v3-membership-report") multicast_router_advertisement = Enum.YLeaf(48,...
192
192
641
8
184
CiscoDevNet/ydk-py
cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_ip_tcp_oper.py
Python
MessageTypeIgmp_
MessageTypeIgmp_
918
1,010
918
918
b221bab4730a4d6100037ea9d04a6baa8e382d59
bigcode/the-stack
train
e1ca58e8c11d40817ce72c13
train
class
class TcpConnState(Enum): """ TcpConnState (Enum Class) TCP Connection State .. data:: closed = 0 Closed .. data:: listen = 1 Listen .. data:: syn_sent = 2 Syn sent .. data:: syn_received = 3 Syn received .. data:: established = 4 Established .. d...
class TcpConnState(Enum):
""" TcpConnState (Enum Class) TCP Connection State .. data:: closed = 0 Closed .. data:: listen = 1 Listen .. data:: syn_sent = 2 Syn sent .. data:: syn_received = 3 Syn received .. data:: established = 4 Established .. data:: close_wait = 5 ...
Address Family Type .. data:: ipv4 = 2 IPv4 .. data:: ipv6 = 10 IPv6 """ ipv4 = Enum.YLeaf(2, "ipv4") ipv6 = Enum.YLeaf(10, "ipv6") @staticmethod def _meta_info(): from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_ip_tcp_oper as meta return meta._met...
115
115
384
6
109
CiscoDevNet/ydk-py
cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_ip_tcp_oper.py
Python
TcpConnState
TcpConnState
1,325
1,403
1,325
1,325
e3be99a85a04364280d5ea66eea6bc20dc876538
bigcode/the-stack
train
9af7d911d79896fc3109fc73
train
class
class PakPrio(Enum): """ PakPrio (Enum Class) Packet Priority Types .. data:: unspecified_packet = 0 Unspecified .. data:: normal_packet = 1 Normal: all traffic routed via this router, Telnet/FTP traffic generated from within this router .. data:: medium_packet = 2 ...
class PakPrio(Enum):
""" PakPrio (Enum Class) Packet Priority Types .. data:: unspecified_packet = 0 Unspecified .. data:: normal_packet = 1 Normal: all traffic routed via this router, Telnet/FTP traffic generated from within this router .. data:: medium_packet = 2 Medium: Packets w...
icm_pv6 = Enum.YLeaf(1, "icm-pv6") igmp = Enum.YLeaf(2, "igmp") unknown = Enum.YLeaf(3, "unknown") @staticmethod def _meta_info(): from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_ip_tcp_oper as meta return meta._meta_table['Packet'] class PakPrio(Enum):
95
95
317
6
89
CiscoDevNet/ydk-py
cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_ip_tcp_oper.py
Python
PakPrio
PakPrio
1,200
1,256
1,200
1,200
83119ea4efeb7061da190b1949113e576b510e27
bigcode/the-stack
train
ea954d1f4ce5d3849b812cdd
train
class
class NsrStatus(Enum): """ NsrStatus (Enum Class) NSR Stream Status .. data:: down = 0 NSR Stream Down .. data:: up = 1 NSR Stream Up .. data:: na = 2 NSR Stream Not applicable """ down = Enum.YLeaf(0, "down") up = Enum.YLeaf(1, "up") na = Enum.YLeaf(2, ...
class NsrStatus(Enum):
""" NsrStatus (Enum Class) NSR Stream Status .. data:: down = 0 NSR Stream Down .. data:: up = 1 NSR Stream Up .. data:: na = 2 NSR Stream Not applicable """ down = Enum.YLeaf(0, "down") up = Enum.YLeaf(1, "up") na = Enum.YLeaf(2, "na") @staticmeth...
= Enum.YLeaf(15, "partner-deleted") @staticmethod def _meta_info(): from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_ip_tcp_oper as meta return meta._meta_table['NsrDownReason'] class NsrStatus(Enum):
64
64
151
6
58
CiscoDevNet/ydk-py
cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_ip_tcp_oper.py
Python
NsrStatus
NsrStatus
1,128
1,158
1,128
1,128
52c966f7f7bcb124439639c1ac31966b99004685
bigcode/the-stack
train
77714b19c4f2b97f3758b366
train
class
class Show(Enum): """ Show (Enum Class) Show .. data:: all = 0 To dispay all .. data:: static_policy = 1 To display static policy .. data:: interface_filter = 2 To display interface filter .. data:: packet_filter = 3 To display packet type filter """ al...
class Show(Enum):
""" Show (Enum Class) Show .. data:: all = 0 To dispay all .. data:: static_policy = 1 To display static policy .. data:: interface_filter = 2 To display interface filter .. data:: packet_filter = 3 To display packet type filter """ all = Enum.YLeaf(0, ...
_packet = Enum.YLeaf(4, "crucial-packet") @staticmethod def _meta_info(): from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_ip_tcp_oper as meta return meta._meta_table['PakPrio'] class Show(Enum):
64
64
182
4
60
CiscoDevNet/ydk-py
cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_ip_tcp_oper.py
Python
Show
Show
1,259
1,295
1,259
1,259
0dc51246c1f80eb1b1b3560500bcf16d88e539af
bigcode/the-stack
train
082a4ddabe8280e4e6116ecb
train
class
class MessageTypeIcmpv6_(Enum): """ MessageTypeIcmpv6\_ (Enum Class) LPTS ICMPv6 message types .. data:: destination_unreachable = 1 ICMPv6 Packet type: Destination unreachable .. data:: packet_too_big = 2 ICMPv6 Packet type: packet too big .. data:: time_exceeded = 3 ICMPv...
class MessageTypeIcmpv6_(Enum):
""" MessageTypeIcmpv6\_ (Enum Class) LPTS ICMPv6 message types .. data:: destination_unreachable = 1 ICMPv6 Packet type: Destination unreachable .. data:: packet_too_big = 2 ICMPv6 Packet type: packet too big .. data:: time_exceeded = 3 ICMPv6 Packet type: Time exceeded ...
"home-agent-address-discovery-reply") mobile_prefix_solicitation = Enum.YLeaf(146, "mobile-prefix-solicitation") mobile_prefix_advertisement = Enum.YLeaf(147, "mobile-prefix-advertisement") certification_path_solicitation_message = Enum.YLeaf(148, "certification-path-solicitation-message") certific...
256
256
1,533
10
246
CiscoDevNet/ydk-py
cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_ip_tcp_oper.py
Python
MessageTypeIcmpv6_
MessageTypeIcmpv6_
598
820
598
598
f91281d2dfc070ffdfc0ee92f4cd8db146926eb6
bigcode/the-stack
train
a87958dac1c28d0130a3d76c
train
class
class TcpAddressFamily(Enum): """ TcpAddressFamily (Enum Class) Address Family Type .. data:: ipv4 = 2 IPv4 .. data:: ipv6 = 10 IPv6 """ ipv4 = Enum.YLeaf(2, "ipv4") ipv6 = Enum.YLeaf(10, "ipv6") @staticmethod def _meta_info(): from ydk.models.cisco_io...
class TcpAddressFamily(Enum):
""" TcpAddressFamily (Enum Class) Address Family Type .. data:: ipv4 = 2 IPv4 .. data:: ipv6 = 10 IPv6 """ ipv4 = Enum.YLeaf(2, "ipv4") ipv6 = Enum.YLeaf(10, "ipv6") @staticmethod def _meta_info(): from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_X...
") packet_filter = Enum.YLeaf(3, "packet-filter") @staticmethod def _meta_info(): from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_ip_tcp_oper as meta return meta._meta_table['Show'] class TcpAddressFamily(Enum):
64
64
126
6
58
CiscoDevNet/ydk-py
cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_ip_tcp_oper.py
Python
TcpAddressFamily
TcpAddressFamily
1,298
1,322
1,298
1,298
e2d3e11b141ea644cfdec8c665c34359ad7bda10
bigcode/the-stack
train
62b90f24c8710c435778ea28
train
class
class TcpTimer(Enum): """ TcpTimer (Enum Class) TCP Timer Type .. data:: retransmission_timer = 0 Retransmission timer .. data:: window_probe_timer = 1 Send Window Probe timer .. data:: timewait_state_timer = 2 TIMEWAIT state timer .. data:: ack_hold_timer = 3 AC...
class TcpTimer(Enum):
""" TcpTimer (Enum Class) TCP Timer Type .. data:: retransmission_timer = 0 Retransmission timer .. data:: window_probe_timer = 1 Send Window Probe timer .. data:: timewait_state_timer = 2 TIMEWAIT state timer .. data:: ack_hold_timer = 3 ACK Hold timer .. d...
_256_cmac = Enum.YLeaf(8, "aes-256-cmac") hmac_sha1_96 = Enum.YLeaf(9, "hmac-sha1-96") hmac_sha_256 = Enum.YLeaf(10, "hmac-sha-256") @staticmethod def _meta_info(): from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_ip_tcp_oper as meta return meta._meta_table['TcpMacAlgo'] class...
112
112
374
5
107
CiscoDevNet/ydk-py
cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_ip_tcp_oper.py
Python
TcpTimer
TcpTimer
1,532
1,592
1,532
1,532
234412ff770bb9a24ac37816caaf8a77ccc3a0ab
bigcode/the-stack
train
664cd74f78d64d48afaaa8c1
train
function
def main(): train_model()
def main():
train_model()
.read_csv('data/diabetes.csv') X_train = data.drop(columns='Outcome') y_train = data['Outcome'] rfc = RandomForestClassifier() rfc.fit(X_train, y_train) dump(rfc, 'model/diabetes_predictor.joblib') def main():
63
64
7
3
60
rodolfo-mendes/diabetes-prediction-api
train.py
Python
main
main
41
42
41
41
659316af23b33257027d64639676fc66b7e14223
bigcode/the-stack
train
a7970e2e015feebe0149c7ad
train
function
def train_model(): data = pd.read_csv('data/diabetes.csv') X_train = data.drop(columns='Outcome') y_train = data['Outcome'] rfc = RandomForestClassifier() rfc.fit(X_train, y_train) dump(rfc, 'model/diabetes_predictor.joblib')
def train_model():
data = pd.read_csv('data/diabetes.csv') X_train = data.drop(columns='Outcome') y_train = data['Outcome'] rfc = RandomForestClassifier() rfc.fit(X_train, y_train) dump(rfc, 'model/diabetes_predictor.joblib')
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. For more information, please refer to <https://unlicense.org> ''' import pandas as pd from sklearn.ensemble import RandomForestClassifier from joblib import dump def train_model():
64
64
68
4
59
rodolfo-mendes/diabetes-prediction-api
train.py
Python
train_model
train_model
32
38
32
32
04057c741e94b7b9de8e96434b0cbc141fed5a18
bigcode/the-stack
train
4f41853fe54c9825f21a18b1
train
class
class ToolStripDropDownButton(ToolStripDropDownItem,IComponent,IDisposable,IDropTarget,ISupportOleDropSource,IArrangedElement): """ Represents a control that when clicked displays an associated System.Windows.Forms.ToolStripDropDown from which the user can select a single item. ToolStripDropDownButton() ...
class ToolStripDropDownButton(ToolStripDropDownItem,IComponent,IDisposable,IDropTarget,ISupportOleDropSource,IArrangedElement):
""" Represents a control that when clicked displays an associated System.Windows.Forms.ToolStripDropDown from which the user can select a single item. ToolStripDropDownButton() ToolStripDropDownButton(text: str) ToolStripDropDownButton(image: Image) ToolStripDropDownButton(text: str,image: Image...
class ToolStripDropDownButton(ToolStripDropDownItem,IComponent,IDisposable,IDropTarget,ISupportOleDropSource,IArrangedElement):
34
256
4,477
34
0
htlcnn/ironpython-stubs
release/stubs.min/System/Windows/Forms/__init___parts/ToolStripDropDownButton.py
Python
ToolStripDropDownButton
ToolStripDropDownButton
1
793
1
1
3bff8d245b66dc281f5515cdfe11c8442f5441ff
bigcode/the-stack
train
dfcfcd9ab8f9b9d947ccc645
train
function
def imwrite(im, filename): img = np.copy(im) img = img.squeeze() if img.dtype == np.double: # img = np.array(img*255, dtype=np.uint8) img = img * np.iinfo(np.uint8).max img = img.astype(np.uint8) imsave(filename, img)
def imwrite(im, filename):
img = np.copy(im) img = img.squeeze() if img.dtype == np.double: # img = np.array(img*255, dtype=np.uint8) img = img * np.iinfo(np.uint8).max img = img.astype(np.uint8) imsave(filename, img)
import numpy as np from imageio import imread, imsave import scipy.stats as stats normpdf = stats.norm.pdf def im2double(im): info = np.iinfo(im.dtype) return im.astype(np.double) / info.max def imwrite(im, filename):
61
64
73
7
53
Junlin-Yin/Image-restoration
code/genCorrImg.py
Python
imwrite
imwrite
12
19
12
12
b4717b79188eecf15fd86da4d0687bffcd218931
bigcode/the-stack
train
b44e6c3dd8975361e49e2787
train
function
def im2double(im): info = np.iinfo(im.dtype) return im.astype(np.double) / info.max
def im2double(im):
info = np.iinfo(im.dtype) return im.astype(np.double) / info.max
import numpy as np from imageio import imread, imsave import scipy.stats as stats normpdf = stats.norm.pdf def im2double(im):
34
64
26
6
27
Junlin-Yin/Image-restoration
code/genCorrImg.py
Python
im2double
im2double
7
9
7
7
65e0bdb6450e53519b4ff04a783cd6f9d93cdc88
bigcode/the-stack
train
28d3d51b71e1437f15236bc5
train
class
class FilingManagerTest(unittest.TestCase): def setUp(self): #self.fm = FilingManager() #instance for non: static & class methods. os.chdir(rootwd) self.chosenmodel = DummyCell() os.chdir(pwd) #@unittest.skip("reason for skipping") def test_1_available_modelscales_nomodelsc...
class FilingManagerTest(unittest.TestCase):
def setUp(self): #self.fm = FilingManager() #instance for non: static & class methods. os.chdir(rootwd) self.chosenmodel = DummyCell() os.chdir(pwd) #@unittest.skip("reason for skipping") def test_1_available_modelscales_nomodelscales(self): # modelscales are under m...
# ../managers/filingTest.py import unittest import os import shutil import sys # import modules from other directories # set to ~/cerebmodels sys.path.append(os.path.dirname(os.getcwd())) # this is required for #from models.cells.modelDummyTest import DummyCell # pwd = os.getcwd() os.chdir("..") # this moves up to ~/c...
124
256
924
8
115
HarshKhilawala/cerebmodels
managers/filingTest.py
Python
FilingManagerTest
FilingManagerTest
21
102
21
22
88a171300fc0287bd9ba28711c53938df4d76d52
bigcode/the-stack
train
314f03849f33bd9fcd2b17db
train
function
def log_debug(s): with open('/opt/docker/pyexecutor.log', 'a+') as f: print('[PyExecutor] {}\n'.format(s), file=f)
def log_debug(s):
with open('/opt/docker/pyexecutor.log', 'a+') as f: print('[PyExecutor] {}\n'.format(s), file=f)
# distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from __future__ import print_function import sys def log_debug(s):
64
64
37
5
58
subinsoman/seahorse
seahorse-workflow-executor/python/pyexecutor/simple_logging.py
Python
log_debug
log_debug
20
22
20
20
b9cd901eccbb2d24dfad530d6d7431821a02920c
bigcode/the-stack
train
fda8f9c4eb344d4adccea3bd
train
function
def log_error(s): with open('/opt/docker/pyexecutor.log', 'a+') as f: print('[PyExecutor] {}\n'.format(s), file=f)
def log_error(s):
with open('/opt/docker/pyexecutor.log', 'a+') as f: print('[PyExecutor] {}\n'.format(s), file=f)
language governing permissions and # limitations under the License. from __future__ import print_function import sys def log_debug(s): with open('/opt/docker/pyexecutor.log', 'a+') as f: print('[PyExecutor] {}\n'.format(s), file=f) def log_error(s):
64
64
37
5
59
subinsoman/seahorse
seahorse-workflow-executor/python/pyexecutor/simple_logging.py
Python
log_error
log_error
25
27
25
25
0c74070cd7c5b2250089b363587ff52cacb0a36d
bigcode/the-stack
train
92bb140b2438583ffa66de5e
train
class
class EmailSenderException(Exception): pass
class EmailSenderException(Exception):
pass
import smtplib from email.mime.text import MIMEText import config_loader _EMAIL_SUBJECT = '[YALMA] Visits are available' class EmailSenderException(Exception):
36
64
9
6
30
Rexikon/yalma
email_sender.py
Python
EmailSenderException
EmailSenderException
9
10
9
9
36106c17aaa9f1178eadb8195051f12e69a22aed
bigcode/the-stack
train
0bd43506053c183f73657063
train
function
def _load_email_setting(): settings = config_loader.read_configuration('email_settings', ['username', 'password', 'smtp_server', 'smtp_port']) return settings['username'], settings['password'], settings['smtp_server'], settings['smtp_port']
def _load_email_setting():
settings = config_loader.read_configuration('email_settings', ['username', 'password', 'smtp_server', 'smtp_port']) return settings['username'], settings['password'], settings['smtp_server'], settings['smtp_port']
import smtplib from email.mime.text import MIMEText import config_loader _EMAIL_SUBJECT = '[YALMA] Visits are available' class EmailSenderException(Exception): pass def _load_email_setting():
45
64
51
6
38
Rexikon/yalma
email_sender.py
Python
_load_email_setting
_load_email_setting
13
15
13
13
2e677a8aab94d4e8282ac12817b2b6f8618e0d5c
bigcode/the-stack
train
692db0cf3c41b067f79a1a77
train
function
def send_email(to: str, message: str): username, password, smtp_server, smtp_port = _load_email_setting() email_message = MIMEText(message) email_message['From'] = username email_message['To'] = to email_message['Subject'] = _EMAIL_SUBJECT mail_server_connection = None try: print(...
def send_email(to: str, message: str):
username, password, smtp_server, smtp_port = _load_email_setting() email_message = MIMEText(message) email_message['From'] = username email_message['To'] = to email_message['Subject'] = _EMAIL_SUBJECT mail_server_connection = None try: print('Sending an email message with notifica...
pass def _load_email_setting(): settings = config_loader.read_configuration('email_settings', ['username', 'password', 'smtp_server', 'smtp_port']) return settings['username'], settings['password'], settings['smtp_server'], settings['smtp_port'] def send_email(to: str, message: str):
64
64
191
11
53
Rexikon/yalma
email_sender.py
Python
send_email
send_email
18
41
18
18
5d7e8e901b361710aeaf1a731528310900c0d1d5
bigcode/the-stack
train
84e7c5759486a08131bbad3e
train
function
def grouper(it, n): for i in range(0, len(it), n): yield it[i:i + n]
def grouper(it, n):
for i in range(0, len(it), n): yield it[i:i + n]
# coding: utf-8 import uuid def grouper(it, n):
17
64
28
7
9
infotim/tochka-nasdaq
src/tochka_nasdaq/util/__init__.py
Python
grouper
grouper
5
7
5
5
cb7d02158ceb5f83a548763ea02469be3b4a80d0
bigcode/the-stack
train
753751e2ce98286ee8c35fdb
train
function
def uuid5(*args, namespace=uuid.NAMESPACE_OID): key = '+'.join([str(i) for i in args]) return uuid.uuid5(namespace, key)
def uuid5(*args, namespace=uuid.NAMESPACE_OID):
key = '+'.join([str(i) for i in args]) return uuid.uuid5(namespace, key)
# coding: utf-8 import uuid def grouper(it, n): for i in range(0, len(it), n): yield it[i:i + n] def uuid5(*args, namespace=uuid.NAMESPACE_OID):
52
64
38
14
38
infotim/tochka-nasdaq
src/tochka_nasdaq/util/__init__.py
Python
uuid5
uuid5
10
12
10
10
49f46067591273e018fae5ad8a528bba57ced22c
bigcode/the-stack
train
81572b42265f847a45fd4b67
train
class
class Discovery(ast.NodeVisitor, abc.ABC): def __init__(self, actions: List[ast.AST]): self.actions = actions @abc.abstractmethod def report_findings(self) -> Tuple: pass
class Discovery(ast.NodeVisitor, abc.ABC):
def __init__(self, actions: List[ast.AST]): self.actions = actions @abc.abstractmethod def report_findings(self) -> Tuple: pass
""" Module containing the parent class of Dicovery classes """ import abc import ast from typing import List, Tuple class Discovery(ast.NodeVisitor, abc.ABC):
36
64
50
10
25
Kulivox/PyGalGen
pygalgen/generator/common/source_file_parsing/parsing_commons.py
Python
Discovery
Discovery
8
14
8
8
5a23b2d34ef87d901f0b1861aa428e1311f167b8
bigcode/the-stack
train
f1dfb8f8fa52b5197a9a4f33
train
function
def add_parents(tree: ast.AST): for node in ast.walk(tree): for child in ast.iter_child_nodes(node): child.parent = node
def add_parents(tree: ast.AST):
for node in ast.walk(tree): for child in ast.iter_child_nodes(node): child.parent = node
List, Tuple class Discovery(ast.NodeVisitor, abc.ABC): def __init__(self, actions: List[ast.AST]): self.actions = actions @abc.abstractmethod def report_findings(self) -> Tuple: pass def add_parents(tree: ast.AST):
64
64
34
10
53
Kulivox/PyGalGen
pygalgen/generator/common/source_file_parsing/parsing_commons.py
Python
add_parents
add_parents
16
19
16
16
a11d87758409df4793292726c6899964a7f28d2e
bigcode/the-stack
train
87fdb36c61416305e88c9c33
train
function
def create_module_tree(path: str) -> ast.Module: with open(path, mode="r", encoding="utf-8") as file: tree = ast.parse(file.read()) add_parents(tree) return tree
def create_module_tree(path: str) -> ast.Module:
with open(path, mode="r", encoding="utf-8") as file: tree = ast.parse(file.read()) add_parents(tree) return tree
@abc.abstractmethod def report_findings(self) -> Tuple: pass def add_parents(tree: ast.AST): for node in ast.walk(tree): for child in ast.iter_child_nodes(node): child.parent = node def create_module_tree(path: str) -> ast.Module:
64
64
48
12
51
Kulivox/PyGalGen
pygalgen/generator/common/source_file_parsing/parsing_commons.py
Python
create_module_tree
create_module_tree
21
25
21
21
eff231bd443654d50aa5f222783c6452b0862716
bigcode/the-stack
train
a99da0819dee52a41d962c62
train
function
def log_value_losses(agent, saps, label_prefix, table='value_data'): ''' Computes the validation loss of the value function modeling it as a supervised learning of returns. Calculates the loss using all three admissible loss functions (returns, consistency, mixed). Inputs: None Outputs: None, ...
def log_value_losses(agent, saps, label_prefix, table='value_data'):
''' Computes the validation loss of the value function modeling it as a supervised learning of returns. Calculates the loss using all three admissible loss functions (returns, consistency, mixed). Inputs: None Outputs: None, logs to the store ''' with torch.no_grad(): # Comput...
: if k != 'opt_step': row[k] = float(row[k]) agent.store.log_table_and_tb(table, row) ## # Treating value learning as a supervised learning problem: # How well do we do? ## def log_value_losses(agent, saps, label_prefix, table='value_data'):
66
66
222
17
49
molumitu/implementation-matters
src/policy_gradients/logging.py
Python
log_value_losses
log_value_losses
41
60
41
41
6aa8012d09417921f9de53b21f98e458b9434bd5
bigcode/the-stack
train
6c87f8c03da716bf9f98949c
train
function
def paper_constraints_logging(agent, saps, old_pds, table): new_pds = agent.policy_model(saps.states) new_log_ps = agent.policy_model.get_loglikelihood(new_pds, saps.actions) ratios = torch.exp(new_log_ps - saps.action_log_probs) max_rat = ratios.max(...
def paper_constraints_logging(agent, saps, old_pds, table):
new_pds = agent.policy_model(saps.states) new_log_ps = agent.policy_model.get_loglikelihood(new_pds, saps.actions) ratios = torch.exp(new_log_ps - saps.action_log_probs) max_rat = ratios.max() kls = agent.policy_model.calc_kl(old_pds, new_pds) ...
sklearn.metrics.pairwise import cosine_similarity from sklearn.metrics import pairwise_distances from .steps import value_loss_returns, value_loss_gae, adv_normalize ##### # Understanding TRPO approximations for KL constraint ##### def paper_constraints_logging(agent, saps, old_pds, table):
64
64
164
15
48
molumitu/implementation-matters
src/policy_gradients/logging.py
Python
paper_constraints_logging
paper_constraints_logging
14
35
14
14
fd7b205639f82f5d87a36b4d2c3c5bca1e5404c7
bigcode/the-stack
train
470ebf6c30bdf0e4c36a8bcf
train
class
class TestLoadImage(): def test_bad_path(self): for path in [ 'some string', '/tmp/not-a-file', 'http://not-a-url', ]: yield self.check_none, path def check_none(self, path): assert_raises( errors.LoadImageError, ...
class TestLoadImage():
def test_bad_path(self): for path in [ 'some string', '/tmp/not-a-file', 'http://not-a-url', ]: yield self.check_none, path def check_none(self, path): assert_raises( errors.LoadImageError, image_utils.l...
# Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved. from __future__ import absolute_import import os import tempfile # Find the best implementation available try: from cStringIO import StringIO except ImportError: from StringIO import StringIO import mock from nose.tools import assert_raises...
121
256
867
5
116
wills2133/digits-ssd
digits/utils/test_image.py
Python
TestLoadImage
TestLoadImage
27
130
27
28
ab2517d5853b34a2359b37e0eb480e1f3c793eea
bigcode/the-stack
train
294aae0dfd9b527f714b835e
train
class
class TestResizeImage(): @classmethod def setup_class(cls): cls.np_gray = np.random.randint(0, 255, (10, 10)).astype('uint8') cls.pil_gray = PIL.Image.fromarray(cls.np_gray) cls.np_color = np.random.randint(0, 255, (10, 10, 3)).astype('uint8') cls.pil_color = PIL.Image.fromarray...
class TestResizeImage(): @classmethod
def setup_class(cls): cls.np_gray = np.random.randint(0, 255, (10, 10)).astype('uint8') cls.pil_gray = PIL.Image.fromarray(cls.np_gray) cls.np_color = np.random.randint(0, 255, (10, 10, 3)).astype('uint8') cls.pil_color = PIL.Image.fromarray(cls.np_color) def test_configs(self):...
img is not None def test_corrupted_file(self): image = PIL.Image.fromarray(np.zeros((10, 10, 3), dtype=np.uint8)) # Save image to a JPEG buffer. buffer_io = StringIO() image.save(buffer_io, format='jpeg') encoded = buffer_io.getvalue() buffer_io.close() # ...
204
204
683
9
195
wills2133/digits-ssd
digits/utils/test_image.py
Python
TestResizeImage
TestResizeImage
133
196
133
135
767d75f82ba4a2ab4059f029fba926c1188c4dce
bigcode/the-stack
train
f04476df1d79a34378d70011
train
function
def get_block_hashes(settings, max_blocks_per_call=10000): rpc = BitcoinRPC(settings['host'], settings['port'], settings['rpcuser'], settings['rpcpassword']) height = settings['min_height'] while height < settings['max_height']+1: num_blocks = min(settings['max_height']+1-height, max_blocks_per_call) batch ...
def get_block_hashes(settings, max_blocks_per_call=10000):
rpc = BitcoinRPC(settings['host'], settings['port'], settings['rpcuser'], settings['rpcpassword']) height = settings['min_height'] while height < settings['max_height']+1: num_blocks = min(settings['max_height']+1-height, max_blocks_per_call) batch = [] for x in range(num_blocks): batch.append(rpc.buil...
['params'] = [] else: obj['params'] = params return obj @staticmethod def response_is_error(resp_obj): return 'error' in resp_obj and resp_obj['error'] is not None def get_block_hashes(settings, max_blocks_per_call=10000):
64
64
196
15
48
paulus99/Tincoin
contrib/linearize/linearize-hashes.py
Python
get_block_hashes
get_block_hashes
55
75
55
55
024ef2c8bbba6d30e433af5a8d6e81078aee10fb
bigcode/the-stack
train
ae27d90a480f237612df34d2
train
class
class BitcoinRPC: def __init__(self, host, port, username, password): authpair = "%s:%s" % (username, password) self.authhdr = "Basic %s" % (base64.b64encode(authpair)) self.conn = httplib.HTTPConnection(host, port, False, 30) def execute(self, obj): self.conn.request('POST', '/', json.dumps(obj), { 'Auth...
class BitcoinRPC:
def __init__(self, host, port, username, password): authpair = "%s:%s" % (username, password) self.authhdr = "Basic %s" % (base64.b64encode(authpair)) self.conn = httplib.HTTPConnection(host, port, False, 30) def execute(self, obj): self.conn.request('POST', '/', json.dumps(obj), { 'Authorization' : self....
(c) 2013-2014 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # from __future__ import print_function import json import struct import re import base64 import httplib import sys settings = {} class Bi...
77
77
259
4
73
paulus99/Tincoin
contrib/linearize/linearize-hashes.py
Python
BitcoinRPC
BitcoinRPC
20
53
20
20
6b7226f2f54db83eae4e3ccee8048117282ec514
bigcode/the-stack
train
44a96bd78079a80b639ec17b
train
class
class RpmCopyright(Section): """ Class that always creates default SUSE copyright. Keeps around Copyrights of other uses and some of the build defines that are still relevant. Everything else is ignored. """ copyrights = [] buildrules = [] def _add_pkg_header(self): specname = ...
class RpmCopyright(Section):
""" Class that always creates default SUSE copyright. Keeps around Copyrights of other uses and some of the build defines that are still relevant. Everything else is ignored. """ copyrights = [] buildrules = [] def _add_pkg_header(self): specname = os.path.splitext(os.path.base...
# vim: set ts=4 sw=4 et: coding=UTF-8 import os import time from rpmsection import Section class RpmCopyright(Section):
36
187
625
7
28
Mailaender/spec-cleaner
spec_cleaner/rpmcopyright.py
Python
RpmCopyright
RpmCopyright
9
88
9
9
d00f4b11b088dca45f07bed68d6ca33c9f0e1c39
bigcode/the-stack
train
45a5bbce22c817ac64c15025
train
function
def add_TraceServiceServicer_to_server(servicer, server): rpc_method_handlers = { 'ListTraces': grpc.unary_unary_rpc_method_handler( servicer.ListTraces, request_deserializer=google_dot_cloud_dot_proto_dot_devtools_dot_cloudtrace_dot_v1_dot_trace__pb2.ListTracesRequest.FromString, ...
def add_TraceServiceServicer_to_server(servicer, server):
rpc_method_handlers = { 'ListTraces': grpc.unary_unary_rpc_method_handler( servicer.ListTraces, request_deserializer=google_dot_cloud_dot_proto_dot_devtools_dot_cloudtrace_dot_v1_dot_trace__pb2.ListTracesRequest.FromString, response_serializer=google_dot_cloud_dot_proto_dot_devtool...
existing trace and its spans are overwritten by the provided values, and any new fields provided are merged with the existing trace data. If the ID does not match, a new trace is created. """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise No...
88
89
299
14
75
rodrigodias27/google-cloud-python
trace/google/cloud/proto/devtools/cloudtrace/v1/trace_pb2_grpc.py
Python
add_TraceServiceServicer_to_server
add_TraceServiceServicer_to_server
73
93
73
73
ed6f76bba58a0d344d0f9c7b3a310e37dd9f84f2
bigcode/the-stack
train
14c5344b03ee4153588c466c
train
class
class TraceServiceServicer(object): """This file describes an API for collecting and viewing traces and spans within a trace. A Trace is a collection of spans corresponding to a single operation or set of operations for an application. A span is an individual timed event which forms a node of the trace tree. S...
class TraceServiceServicer(object):
"""This file describes an API for collecting and viewing traces and spans within a trace. A Trace is a collection of spans corresponding to a single operation or set of operations for an application. A span is an individual timed event which forms a node of the trace tree. Spans for a single trace may span m...
pb2.Trace.FromString, ) self.PatchTraces = channel.unary_unary( '/google.devtools.cloudtrace.v1.TraceService/PatchTraces', request_serializer=google_dot_cloud_dot_proto_dot_devtools_dot_cloudtrace_dot_v1_dot_trace__pb2.PatchTracesRequest.SerializeToString, response_deserializer=googl...
96
96
321
7
89
rodrigodias27/google-cloud-python
trace/google/cloud/proto/devtools/cloudtrace/v1/trace_pb2_grpc.py
Python
TraceServiceServicer
TraceServiceServicer
39
70
39
39
33abc8a8ff24cc7eecdae96e15703320e2a123e8
bigcode/the-stack
train
e9b41424f645bb252462be70
train
class
class TraceServiceStub(object): """This file describes an API for collecting and viewing traces and spans within a trace. A Trace is a collection of spans corresponding to a single operation or set of operations for an application. A span is an individual timed event which forms a node of the trace tree. Spans...
class TraceServiceStub(object):
"""This file describes an API for collecting and viewing traces and spans within a trace. A Trace is a collection of spans corresponding to a single operation or set of operations for an application. A span is an individual timed event which forms a node of the trace tree. Spans for a single trace may span m...
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! import grpc import google.cloud.proto.devtools.cloudtrace.v1.trace_pb2 as google_dot_cloud_dot_proto_dot_devtools_dot_cloudtrace_dot_v1_dot_trace__pb2 import google.protobuf.empty_pb2 as google_dot_protobuf_dot_empty__pb2 class TraceServiceStub(obje...
75
109
364
6
68
rodrigodias27/google-cloud-python
trace/google/cloud/proto/devtools/cloudtrace/v1/trace_pb2_grpc.py
Python
TraceServiceStub
TraceServiceStub
8
36
8
8
4180ac78c2c1f60203ea4ecc3f7c6b6f01f6c5ff
bigcode/the-stack
train
0c9c4515dfdea9aeaf4884f2
train
class
class ListUserLevelsOfSkillGroupRequest(RpcRequest): def __init__(self): RpcRequest.__init__(self, 'CCC', '2020-07-01', 'ListUserLevelsOfSkillGroup','CCC') self.set_method('POST') if hasattr(self, "endpoint_map"): setattr(self, "endpoint_map", endpoint_data.getEndpointMap()) if hasattr(self, "endpoint_reg...
class ListUserLevelsOfSkillGroupRequest(RpcRequest):
def __init__(self): RpcRequest.__init__(self, 'CCC', '2020-07-01', 'ListUserLevelsOfSkillGroup','CCC') self.set_method('POST') if hasattr(self, "endpoint_map"): setattr(self, "endpoint_map", endpoint_data.getEndpointMap()) if hasattr(self, "endpoint_regional"): setattr(self, "endpoint_regional", endpoin...
-2.0 # # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the L...
104
104
348
12
91
jorsonzen/aliyun-openapi-python-sdk
aliyun-python-sdk-ccc/aliyunsdkccc/request/v20200701/ListUserLevelsOfSkillGroupRequest.py
Python
ListUserLevelsOfSkillGroupRequest
ListUserLevelsOfSkillGroupRequest
23
68
23
24
c20c972d680116deb48e5178a58543f2b79bcb1a
bigcode/the-stack
train
857c7a94c46e85b956c56b66
train
class
class TestDataManager(MpfTestCase): def get_config_file(self): return "config.yaml" def get_machine_path(self): return 'tests/machine_files/data_manager/' def setUp(self): super().setUp() YamlInterface.cache = False def tearDown(self): YamlInterface.cache = Tr...
class TestDataManager(MpfTestCase):
def get_config_file(self): return "config.yaml" def get_machine_path(self): return 'tests/machine_files/data_manager/' def setUp(self): super().setUp() YamlInterface.cache = False def tearDown(self): YamlInterface.cache = True super().tearDown() de...
"""Test the bonus mode.""" import os import time from unittest.mock import mock_open, patch from mpf.file_interfaces.yaml_interface import YamlInterface from mpf.core.data_manager import DataManager from mpf.tests.MpfTestCase import MpfTestCase class TestDataManager(MpfTestCase):
66
256
1,040
9
56
Scottacus64/mpf
mpf/tests/test_DataManager.py
Python
TestDataManager
TestDataManager
11
105
11
12
ea83b16a3c865ff7204645e074442a52765841c1
bigcode/the-stack
train
65c5cbf6a43ce75ca08f5ada
train
class
class Analyzer: def __init__(self, user_agent, dataset='multiwoz'): self.user_agent = user_agent self.dataset = dataset def build_sess(self, sys_agent): if self.dataset == 'multiwoz': evaluator = MultiWozEvaluator() else: evaluator = None if eval...
class Analyzer:
def __init__(self, user_agent, dataset='multiwoz'): self.user_agent = user_agent self.dataset = dataset def build_sess(self, sys_agent): if self.dataset == 'multiwoz': evaluator = MultiWozEvaluator() else: evaluator = None if evaluator is None: ...
import os from convlab2.dialog_agent import BiSession, PipelineAgent from convlab2.evaluator.multiwoz_eval import MultiWozEvaluator from pprint import pprint import random import numpy as np import torch import matplotlib.pyplot as plt from convlab2.util.analysis_tool.helper import Reporter from tqdm import tqdm, trang...
79
256
2,874
3
75
weizh/convlab2_ubar
convlab2/util/analysis_tool/analyzer.py
Python
Analyzer
Analyzer
14
282
14
14
8806a5e4be0d09c83c67741bb83dbec8bd40fb6e
bigcode/the-stack
train
3bdd95bf4690e45c06c4a599
train
function
def main(args): print("Loading Cityscapes from", args.root_dir) num_stuff, num_thing = _get_meta() # Prepare directories img_dir = path.join(args.out_dir, "img") _ensure_dir(img_dir) msk_dir = path.join(args.out_dir, "msk") _ensure_dir(msk_dir) lst_dir = path.join(args.out_dir, "lst") ...
def main(args):
print("Loading Cityscapes from", args.root_dir) num_stuff, num_thing = _get_meta() # Prepare directories img_dir = path.join(args.out_dir, "img") _ensure_dir(img_dir) msk_dir = path.join(args.out_dir, "msk") _ensure_dir(msk_dir) lst_dir = path.join(args.out_dir, "lst") _ensure_dir(l...
from os import path, mkdir, listdir import numpy as np import tqdm import umsgpack from PIL import Image from cityscapesscripts.helpers.labels import labels as cs_labels from pycococreatortools import pycococreatortools as pct parser = argparse.ArgumentParser(description="Convert Cityscapes to seamseg format") parse...
203
203
678
4
199
curtkim/seamseg
scripts/data_preparation/prepare_cityscapes.py
Python
main
main
28
107
28
28
7f6d66cffd755964a6abc89157eb121cedc582b7
bigcode/the-stack
train
4a87d7512a18c86f05ed4833
train
function
def _get_images(base_dir): img_list = [] for subdir in listdir(base_dir): subdir_abs = path.join(base_dir, subdir) if path.isdir(subdir_abs): for img in glob.glob(path.join(subdir_abs, "*" + _INSTANCE_EXT)): _, img = path.split(img) parts = img.split(...
def _get_images(base_dir):
img_list = [] for subdir in listdir(base_dir): subdir_abs = path.join(base_dir, subdir) if path.isdir(subdir_abs): for img in glob.glob(path.join(subdir_abs, "*" + _INSTANCE_EXT)): _, img = path.split(img) parts = img.split("_") img_id...
meta["meta"]["palette"].append(lbl.color) meta["meta"]["original_ids"].append(lbl.id) with open(path.join(args.out_dir, "metadata.bin"), "wb") as fid: umsgpack.dump(meta, fid, encoding="utf-8") def _get_images(base_dir):
64
64
114
7
57
curtkim/seamseg
scripts/data_preparation/prepare_cityscapes.py
Python
_get_images
_get_images
110
124
110
110
c4bd2bd883cb9383a5c35bef0f3e627368140077
bigcode/the-stack
train
de30e068ec420e27907fc042
train
function
def _init_counter(c): global counter counter = c
def _init_counter(c):
global counter counter = c
png")) img_meta = { "id": img_id, "cat": cat, "size": (lbl_size[1], lbl_size[0]), "iscrowd": iscrowd } return img_meta, coco_img, coco_ann def _init_counter(c):
64
64
15
6
57
curtkim/seamseg
scripts/data_preparation/prepare_cityscapes.py
Python
_init_counter
_init_counter
212
214
212
212
5779931e2949caaa2f8285cd5577f81c5ffcf354
bigcode/the-stack
train
c1cd6027d9609aad49fe5858
train
class
class _Counter: def __init__(self, initval=0): self.val = Value('i', initval) self.lock = Lock() def increment(self): with self.lock: val = self.val.value self.val.value += 1 return val
class _Counter:
def __init__(self, initval=0): self.val = Value('i', initval) self.lock = Lock() def increment(self): with self.lock: val = self.val.value self.val.value += 1 return val
, "cat": cat, "size": (lbl_size[1], lbl_size[0]), "iscrowd": iscrowd } return img_meta, coco_img, coco_ann def _init_counter(c): global counter counter = c class _Counter:
64
64
62
4
59
curtkim/seamseg
scripts/data_preparation/prepare_cityscapes.py
Python
_Counter
_Counter
217
226
217
217
9189b6f5bf5ba53b67a1441f0d51984330cbc8fa
bigcode/the-stack
train
0afc7a84920a8b94e69b2d5c
train
function
def _get_meta(): num_stuff = sum(1 for lbl in cs_labels if 0 <= lbl.trainId < 255 and not lbl.hasInstances) num_thing = sum(1 for lbl in cs_labels if 0 <= lbl.trainId < 255 and lbl.hasInstances) return num_stuff, num_thing
def _get_meta():
num_stuff = sum(1 for lbl in cs_labels if 0 <= lbl.trainId < 255 and not lbl.hasInstances) num_thing = sum(1 for lbl in cs_labels if 0 <= lbl.trainId < 255 and lbl.hasInstances) return num_stuff, num_thing
"*" + _INSTANCE_EXT)): _, img = path.split(img) parts = img.split("_") img_id = "_".join(parts[:-2]) lbl_cat = parts[-2] img_list.append((subdir, img_id, lbl_cat)) return img_list def _get_meta():
64
64
72
5
58
curtkim/seamseg
scripts/data_preparation/prepare_cityscapes.py
Python
_get_meta
_get_meta
127
130
127
127
0df9d11f8bf759287acbd193cba8e9f23c456e7f
bigcode/the-stack
train
48876eb1fd80a1616782bcc9
train
class
class _Worker: def __init__(self, img_base_dir, msk_base_dir, img_dir, msk_dir): self.img_base_dir = img_base_dir self.msk_base_dir = msk_base_dir self.img_dir = img_dir self.msk_dir = msk_dir def __call__(self, img_desc): img_dir, img_id, lbl_cat = img_desc coco...
class _Worker:
def __init__(self, img_base_dir, msk_base_dir, img_dir, msk_dir): self.img_base_dir = img_base_dir self.msk_base_dir = msk_base_dir self.img_dir = img_dir self.msk_dir = msk_dir def __call__(self, img_desc): img_dir, img_id, lbl_cat = img_desc coco_ann = [] ...
.join(base_dir, subdir) if path.isdir(subdir_abs): for img in glob.glob(path.join(subdir_abs, "*" + _INSTANCE_EXT)): _, img = path.split(img) parts = img.split("_") img_id = "_".join(parts[:-2]) lbl_cat = parts[-2] img...
186
186
622
4
181
curtkim/seamseg
scripts/data_preparation/prepare_cityscapes.py
Python
_Worker
_Worker
140
209
140
140
b4a38affdffa8a2498e43095ed34e3c93dc49ce4
bigcode/the-stack
train
5aa7915ccb906f649dde0282
train
function
def _ensure_dir(dir_path): try: mkdir(dir_path) except FileExistsError: pass
def _ensure_dir(dir_path):
try: mkdir(dir_path) except FileExistsError: pass
in cs_labels if 0 <= lbl.trainId < 255 and not lbl.hasInstances) num_thing = sum(1 for lbl in cs_labels if 0 <= lbl.trainId < 255 and lbl.hasInstances) return num_stuff, num_thing def _ensure_dir(dir_path):
64
64
24
7
56
curtkim/seamseg
scripts/data_preparation/prepare_cityscapes.py
Python
_ensure_dir
_ensure_dir
133
137
133
133
1ef3f8b4a35f681a855779c05ab65e5c63bc86b7
bigcode/the-stack
train
c894877a1f195c24bb90baf9
train
class
class GetWalletBalanceWithTransactionsInteractor: def __init__( self, storage: StorageInterface): self.storage = storage def get_wallet_balance_with_transactions_wrapper( self, user_id: int, offset: int, limit: int, presenter: PresenterInterface ): wallet...
class GetWalletBalanceWithTransactionsInteractor:
def __init__( self, storage: StorageInterface): self.storage = storage def get_wallet_balance_with_transactions_wrapper( self, user_id: int, offset: int, limit: int, presenter: PresenterInterface ): wallet_transactions_dto = \ self.get_wallet_...
presenter_interface import PresenterInterface from essentials_kit_management.interactors.get_wallet_balance_interactor \ import GetWalletBalanceInteractor from essentials_kit_management.interactors.\ get_transactions_details_interactor import \ GetTransactionsDetailsInteractor from essentials_kit_managemen...
77
77
257
8
68
RajeshKumar1490/iB_hubs_mini_project
essentials_kit_management/interactors/get_wallet_balance_with_transactions_interactor.py
Python
GetWalletBalanceWithTransactionsInteractor
GetWalletBalanceWithTransactionsInteractor
14
50
14
14
09a09696e648f623e9562af6b7aa9640fda1cc9c
bigcode/the-stack
train
c7c766f31b29d62136818bb1
train
function
def create_log(referred_service, service_provider, planned_date, args, publish_progress=True): if frappe.db.sql("""select count(name) from `tabCase Plan Tracker` where docstatus < 2 and referred_service = %s and service_provider = %s and planned_date = %s""", (referred_service,service_provider,planned_date))[0][0]=...
def create_log(referred_service, service_provider, planned_date, args, publish_progress=True):
if frappe.db.sql("""select count(name) from `tabCase Plan Tracker` where docstatus < 2 and referred_service = %s and service_provider = %s and planned_date = %s""", (referred_service,service_provider,planned_date))[0][0]==0: log_args = frappe._dict({ "doctype": "Case Plan Tracker", "plan_id": args.plan_id...
if d.tracker: track = frappe.get_doc("Case Plan Tracker", t.tracker) track.db_set("direct_service", d.service) track.db_set("planned_date", d.when) def create_log(referred_service, service_provider, planned_date, args, publish_progress=True):
64
64
171
19
45
amutaher/case_management
case_management/case_management/doctype/case_action_plan/case_action_plan.py
Python
create_log
create_log
63
76
63
63
b7dd034d5afb2366d5eb73b8d078c9cc9cf1cf42
bigcode/the-stack
train
f3d48fdf32351a931b2726a6
train
function
@frappe.whitelist() def make_evaluation(source_name, target_doc=None): return get_mapped_doc("Case Action Plan", source_name, { "Case Action Plan": { "doctype": "Evaluate Services Implementation" } }, target_doc)
@frappe.whitelist() def make_evaluation(source_name, target_doc=None):
return get_mapped_doc("Case Action Plan", source_name, { "Case Action Plan": { "doctype": "Evaluate Services Implementation" } }, target_doc)
": args.case_id, "type": "Direct Service", "direct_service": direct_service, "planned_date": planned_date, }) il = frappe.get_doc(log_args) il.insert() @frappe.whitelist() def make_evaluation(source_name, target_doc=None):
64
64
57
17
47
amutaher/case_management
case_management/case_management/doctype/case_action_plan/case_action_plan.py
Python
make_evaluation
make_evaluation
92
98
92
93
b106436031ff5ba0fe3bdfa46bd67003c2843d6e
bigcode/the-stack
train
515c405e9f2e91de164bef29
train
function
def create_log_direct(direct_service, planned_date, args, publish_progress=True): if frappe.db.sql("""select count(name) from `tabCase Plan Tracker` where docstatus < 2 and direct_service = %s and planned_date = %s""", (direct_service,planned_date))[0][0]==0: log_args = frappe._dict({ "doctype": "Case Plan ...
def create_log_direct(direct_service, planned_date, args, publish_progress=True):
if frappe.db.sql("""select count(name) from `tabCase Plan Tracker` where docstatus < 2 and direct_service = %s and planned_date = %s""", (direct_service,planned_date))[0][0]==0: log_args = frappe._dict({ "doctype": "Case Plan Tracker", "plan_id": args.plan_id, "case_id": args.case_id, "type": "Dire...
ferred Service", "referred_service": referred_service, "service_provider": service_provider, "planned_date": planned_date, }) il = frappe.get_doc(log_args) il.insert() def create_log_direct(direct_service, planned_date, args, publish_progress=True):
64
64
149
17
47
amutaher/case_management
case_management/case_management/doctype/case_action_plan/case_action_plan.py
Python
create_log_direct
create_log_direct
78
90
78
78
576d8cf622677f4c1953681dc38686b137fea68c
bigcode/the-stack
train
bc6dbf3a195ac584f8bedce5
train
class
class CaseActionPlan(Document): pass def after_insert(self): frappe.db.sql("UPDATE `tabGBV Assessment` set action_plan=1 where case_id=%s and name=%s", (self.case_id,self.assessment)) frappe.db.sql("UPDATE `tabCP Assessment` set action_plan=1 where case_id=%s and name=%s", (self.case_id,self.assessment)) frap...
class CaseActionPlan(Document):
pass def after_insert(self): frappe.db.sql("UPDATE `tabGBV Assessment` set action_plan=1 where case_id=%s and name=%s", (self.case_id,self.assessment)) frappe.db.sql("UPDATE `tabCP Assessment` set action_plan=1 where case_id=%s and name=%s", (self.case_id,self.assessment)) frappe.db.sql("UPDATE `tabGeneral As...
# -*- coding: utf-8 -*- # Copyright (c) 2020, Akram Mutaher and contributors # For license information, please see license.txt from __future__ import unicode_literals import frappe from frappe.model.document import Document from frappe.model.mapper import get_mapped_doc class CaseActionPlan(Document):
68
156
521
6
61
amutaher/case_management
case_management/case_management/doctype/case_action_plan/case_action_plan.py
Python
CaseActionPlan
CaseActionPlan
10
59
10
10
f0e4e426ab440e4721683a70d94410b028c496b2
bigcode/the-stack
train
0e8784922d5b41e40cd17632
train
class
class DescribeCasterConfigRequest(RpcRequest): def __init__(self): RpcRequest.__init__(self, 'live', '2016-11-01', 'DescribeCasterConfig','live') if hasattr(self, "endpoint_map"): setattr(self, "endpoint_map", endpoint_data.getEndpointMap()) if hasattr(self, "endpoint_regional"): setattr(self, "endpoint_r...
class DescribeCasterConfigRequest(RpcRequest):
def __init__(self): RpcRequest.__init__(self, 'live', '2016-11-01', 'DescribeCasterConfig','live') if hasattr(self, "endpoint_map"): setattr(self, "endpoint_map", endpoint_data.getEndpointMap()) if hasattr(self, "endpoint_regional"): setattr(self, "endpoint_regional", endpoint_data.getEndpointRegional()) ...
WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. from aliyunsdkcore.request import RpcRequest from aliyunsdklive.endpoint import endpoint_data class DescribeCasterConfigRequest(RpcRequest):
64
64
175
9
54
liumihust/aliyun-openapi-python-sdk
aliyun-python-sdk-live/aliyunsdklive/request/v20161101/DescribeCasterConfigRequest.py
Python
DescribeCasterConfigRequest
DescribeCasterConfigRequest
23
43
23
24
4f246c2ce7ade30343ae56034db8b718d471f8f0
bigcode/the-stack
train
41e217c4a23cd62c1f3d2898
train
class
class SELocalFlavorTests(LocalFlavorTestCase): def setUp(self): # Mocking datetime.date to make sure # localflavor.se.utils.validate_id_birthday works class MockDate(datetime.date): def today(cls): return datetime.date(2008, 5, 14) today = classmethod...
class SELocalFlavorTests(LocalFlavorTestCase):
def setUp(self): # Mocking datetime.date to make sure # localflavor.se.utils.validate_id_birthday works class MockDate(datetime.date): def today(cls): return datetime.date(2008, 5, 14) today = classmethod(today) self._olddate = datetime.date ...
# -*- coding: utf-8 -*- from django.contrib.localflavor.se.forms import (SECountySelect, SEOrganisationNumberField, SEPersonalIdentityNumberField, SEPostalCodeField) import datetime from utils import LocalFlavorTestCase class SELocalFlavorTests(LocalFlavorTestCase):
61
256
1,555
10
50
adamjmcgrath/glancydesign
src/django-nonrel/tests/regressiontests/forms/localflavor/se.py
Python
SELocalFlavorTests
SELocalFlavorTests
10
164
10
11
0d0b6b354351c433bed7a21cf42c29b2f67d8568
bigcode/the-stack
train
80117ecfe090ecec7b279fd1
train
function
def set_block(package): """ set block """ user = package.get('user') params = package.get('params') friendname = params.get(ParamType.Username) friend = UserHelper.get_user_by_username(friendname) if friend is None: return Response.error_response("Error Username") ChatBlockHelper...
def set_block(package):
""" set block """ user = package.get('user') params = package.get('params') friendname = params.get(ParamType.Username) friend = UserHelper.get_user_by_username(friendname) if friend is None: return Response.error_response("Error Username") ChatBlockHelper.add_block(user['id'], f...
from utils.params import ParamType import utils.response as Response def get_list(package): """ get block list """ user = package.get('user') blocks = ChatBlockHelper.get_block_list(user['id']) return Response.success_response({'list' : blocks}) def set_block(package):
64
64
89
5
59
Hrsn2861/pysat-server
message/views/block.py
Python
set_block
set_block
15
25
15
15
a2588a4d8df77522083d149d0851b5ca6ae1b3d1
bigcode/the-stack
train
f23f92e097702162aad5391e
train
function
def unset_block(package): """ unset block """ user = package.get('user') params = package.get('params') friendname = params.get(ParamType.Username) friend = UserHelper.get_user_by_username(friendname) if friend is None: return Response.error_response("Error Username") ChatBlockHe...
def unset_block(package):
""" unset block """ user = package.get('user') params = package.get('params') friendname = params.get(ParamType.Username) friend = UserHelper.get_user_by_username(friendname) if friend is None: return Response.error_response("Error Username") ChatBlockHelper.del_block(user['id'],...
name = params.get(ParamType.Username) friend = UserHelper.get_user_by_username(friendname) if friend is None: return Response.error_response("Error Username") ChatBlockHelper.add_block(user['id'], friend['id']) return Response.checked_response('Set Success') def unset_block(package):
64
64
89
5
59
Hrsn2861/pysat-server
message/views/block.py
Python
unset_block
unset_block
27
37
27
27
fb397522c41e4138c5eda001d53792c2e0fa4b46
bigcode/the-stack
train
9e25bf1565ee5cb94b7d6547
train
function
def get_list(package): """ get block list """ user = package.get('user') blocks = ChatBlockHelper.get_block_list(user['id']) return Response.success_response({'list' : blocks})
def get_list(package):
""" get block list """ user = package.get('user') blocks = ChatBlockHelper.get_block_list(user['id']) return Response.success_response({'list' : blocks})
"""views for message.message """ from message.models import ChatBlockHelper from user.models import UserHelper from utils.params import ParamType import utils.response as Response def get_list(package):
40
64
45
5
34
Hrsn2861/pysat-server
message/views/block.py
Python
get_list
get_list
8
13
8
8
c6327ac57d8d264bd115b0f06f472d60d82ad65a
bigcode/the-stack
train
6cd5556fe8303eaedad33f82
train
class
class CommonMiddleware(common.CommonMiddleware): def process_request(self, request): with safe_query_string(request): return super(CommonMiddleware, self).process_request(request)
class CommonMiddleware(common.CommonMiddleware):
def process_request(self, request): with safe_query_string(request): return super(CommonMiddleware, self).process_request(request)
_to_uri seems like a good compromise. """ qs = request.META.get('QUERY_STRING', '') try: request.META['QUERY_STRING'] = iri_to_uri(qs) yield finally: request.META['QUERY_STRING'] = qs class CommonMiddleware(common.CommonMiddleware):
64
64
34
7
56
jpetto/olympia
src/olympia/amo/middleware.py
Python
CommonMiddleware
CommonMiddleware
162
166
162
163
31217b7d9e5fa5c1d9fad309a8d25d1f202848a0
bigcode/the-stack
train
454256e862783a9023b2d422
train
class
class LocaleAndAppURLMiddleware(object): """ 1. search for locale first 2. see if there are acceptable apps 3. save those matched parameters in the request 4. strip them from the URL so we can do stuff """ def process_request(self, request): # Find locale, app prefixer = url...
class LocaleAndAppURLMiddleware(object):
""" 1. search for locale first 2. see if there are acceptable apps 3. save those matched parameters in the request 4. strip them from the URL so we can do stuff """ def process_request(self, request): # Find locale, app prefixer = urlresolvers.Prefixer(request) if se...
""" Borrowed from: http://code.google.com/p/django-localeurl Note: didn't make sense to use localeurl since we need to capture app as well """ import contextlib import urllib from django.conf import settings from django.contrib.sessions.middleware import SessionMiddleware from django.core.urlresolvers import is_valid...
163
165
551
8
154
jpetto/olympia
src/olympia/amo/middleware.py
Python
LocaleAndAppURLMiddleware
LocaleAndAppURLMiddleware
28
88
28
28
3a757a60923a8df8fa5d8a3673895be6ee0113d2
bigcode/the-stack
train
40863ce894f347348756ed45
train
class
class NoVarySessionMiddleware(SessionMiddleware): """ SessionMiddleware sets Vary: Cookie anytime request.session is accessed. request.session is accessed indirectly anytime request.user is touched. We always touch request.user to see if the user is authenticated, so every request would be sending v...
class NoVarySessionMiddleware(SessionMiddleware):
""" SessionMiddleware sets Vary: Cookie anytime request.session is accessed. request.session is accessed indirectly anytime request.user is touched. We always touch request.user to see if the user is authenticated, so every request would be sending vary, so we'd get no caching. We skip the cach...
!= new_app: patch_vary_headers(response, ['User-Agent']) return response request.path_info = '/' + prefixer.shortened_path tower.activate(prefixer.locale) request.APP = amo.APPS.get(prefixer.app, amo.FIREFOX) request.LANG = prefixer.locale class NoVarySessio...
74
74
248
9
64
jpetto/olympia
src/olympia/amo/middleware.py
Python
NoVarySessionMiddleware
NoVarySessionMiddleware
91
120
91
91
d197367e8749b63f223569adede0bbf7f180f4fe
bigcode/the-stack
train
84b031b19a7923824baeb676
train
class
class RemoveSlashMiddleware(object): """ Middleware that tries to remove a trailing slash if there was a 404. If the response is a 404 because url resolution failed, we'll look for a better url without a trailing slash. """ def process_response(self, request, response): if (response.st...
class RemoveSlashMiddleware(object):
""" Middleware that tries to remove a trailing slash if there was a 404. If the response is a 404 because url resolution failed, we'll look for a better url without a trailing slash. """ def process_response(self, request, response): if (response.status_code == 404 and ...
('Vary', None) new_response = (super(NoVarySessionMiddleware, self) .process_response(request, response)) if vary: new_response['Vary'] = vary else: del new_response['Vary'] return new_response class RemoveSlashMiddleware(object):
64
64
168
6
57
jpetto/olympia
src/olympia/amo/middleware.py
Python
RemoveSlashMiddleware
RemoveSlashMiddleware
123
143
123
123
2ca10b9a7ab1f8993048ee5095c6ae1d7bb8dfab
bigcode/the-stack
train
f2cc3b910f4cf0b91391b206
train
class
class NoAddonsMiddleware(ViewMiddleware): """ If enabled will try and stop any requests to addons by 404'ing them. Here there be dragons. Fortunately this is temporary right? """ def process_view(self, request, view_func, view_args, view_kwargs): name = self.get_name(view_func) if n...
class NoAddonsMiddleware(ViewMiddleware):
""" If enabled will try and stop any requests to addons by 404'ing them. Here there be dragons. Fortunately this is temporary right? """ def process_view(self, request, view_func, view_args, view_kwargs): name = self.get_name(view_func) if name.startswith(settings.NO_ADDONS_MODULES)...
used the class based view class name. if not hasattr(view_func, '__name__'): name = view_func.__class__.__name__ else: name = view_func.__name__ return '%s.%s' % (view_func.__module__, name) class NoAddonsMiddleware(ViewMiddleware):
64
64
83
8
56
jpetto/olympia
src/olympia/amo/middleware.py
Python
NoAddonsMiddleware
NoAddonsMiddleware
191
200
191
191
9f6dc6d692f56c4fd5ed8a972233ec0ccdc96b06
bigcode/the-stack
train
2ee90c22c76f2fc9fba64920
train
class
class ReadOnlyMiddleware(object): def process_request(self, request): if request.method == 'POST': return render(request, 'amo/read-only.html', status=503) def process_exception(self, request, exception): if isinstance(exception, mysql.OperationalError): return render(r...
class ReadOnlyMiddleware(object):
def process_request(self, request): if request.method == 'POST': return render(request, 'amo/read-only.html', status=503) def process_exception(self, request, exception): if isinstance(exception, mysql.OperationalError): return render(request, 'amo/read-only.html', statu...
= iri_to_uri(qs) yield finally: request.META['QUERY_STRING'] = qs class CommonMiddleware(common.CommonMiddleware): def process_request(self, request): with safe_query_string(request): return super(CommonMiddleware, self).process_request(request) class ReadOnlyMiddleware(o...
64
64
72
6
58
jpetto/olympia
src/olympia/amo/middleware.py
Python
ReadOnlyMiddleware
ReadOnlyMiddleware
169
177
169
170
4e652f4ceb4a3e74e4ad66428c74d9496cf2961e
bigcode/the-stack
train
4d93d8290f5180abdc124dbc
train
function
@contextlib.contextmanager def safe_query_string(request): """ Turn the QUERY_STRING into a unicode- and ascii-safe string. We need unicode so it can be combined with a reversed URL, but it has to be ascii to go in a Location header. iri_to_uri seems like a good compromise. """ qs = request.ME...
@contextlib.contextmanager def safe_query_string(request):
""" Turn the QUERY_STRING into a unicode- and ascii-safe string. We need unicode so it can be combined with a reversed URL, but it has to be ascii to go in a Location header. iri_to_uri seems like a good compromise. """ qs = request.META.get('QUERY_STRING', '') try: request.META['Q...
newurl = request.path[:-1] if request.GET: with safe_query_string(request): newurl += '?' + request.META.get('QUERY_STRING', '') return HttpResponsePermanentRedirect(newurl) else: return response @contextlib.contextmanager def s...
64
64
116
12
51
jpetto/olympia
src/olympia/amo/middleware.py
Python
safe_query_string
safe_query_string
146
159
146
147
9f9580219207729524fb1362a7b2bd4062cdb349
bigcode/the-stack
train
80bb0c83a224339b6f7cfd15
train
class
class ViewMiddleware(object): def get_name(self, view_func): # Find a function name or used the class based view class name. if not hasattr(view_func, '__name__'): name = view_func.__class__.__name__ else: name = view_func.__name__ return '%s.%s' % (view_func...
class ViewMiddleware(object):
def get_name(self, view_func): # Find a function name or used the class based view class name. if not hasattr(view_func, '__name__'): name = view_func.__class__.__name__ else: name = view_func.__name__ return '%s.%s' % (view_func.__module__, name)
): if request.method == 'POST': return render(request, 'amo/read-only.html', status=503) def process_exception(self, request, exception): if isinstance(exception, mysql.OperationalError): return render(request, 'amo/read-only.html', status=503) class ViewMiddleware(object): ...
64
64
77
5
59
jpetto/olympia
src/olympia/amo/middleware.py
Python
ViewMiddleware
ViewMiddleware
180
188
180
181
2f7abbf053b4f84aecaa789fda7d26884bc7bfca
bigcode/the-stack
train
5a17e96458df8c296da12a28
train
class
class PantsDaemonStats: """Tracks various stats about the daemon.""" def __init__(self): self.scheduler_metrics = {} def set_scheduler_metrics(self, scheduler_metrics): self.scheduler_metrics = scheduler_metrics def set_target_root_size(self, size): self.scheduler_metrics['target_root_size'] = si...
class PantsDaemonStats:
"""Tracks various stats about the daemon.""" def __init__(self): self.scheduler_metrics = {} def set_scheduler_metrics(self, scheduler_metrics): self.scheduler_metrics = scheduler_metrics def set_target_root_size(self, size): self.scheduler_metrics['target_root_size'] = size def set_affected_t...
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). class PantsDaemonStats:
34
64
126
5
29
sammy-1234/pants
src/python/pants/goal/pantsd_stats.py
Python
PantsDaemonStats
PantsDaemonStats
5
23
5
5
10989883879aad4845f2fc7856fe893ac7f86825
bigcode/the-stack
train
cf71596e28165dd0254e60e5
train
class
class SquirtleBot(SlackBot): def __init__(self, name, config, debug=False): super(SquirtleBot, self).__init__(name=name, config=config, debug=debug) self._refreshtime = 30 self._init_channels() if self.DEBUG: self.info('Starting in DEBUG mode.') else: self.info('Starting.') def run...
class SquirtleBot(SlackBot):
def __init__(self, name, config, debug=False): super(SquirtleBot, self).__init__(name=name, config=config, debug=debug) self._refreshtime = 30 self._init_channels() if self.DEBUG: self.info('Starting in DEBUG mode.') else: self.info('Starting.') def run(self): """ Overrides...
""" Subclass of SlackBot. Accesses a given ESPN fantasy football league to provide snark and maybe, possibly some useful functions. """ __author__ = 'Matthew Sheridan' __copyright__ = 'Copyright 2017, Matthew Sheridan' __license__ = 'Beer-Ware License Rev. 42' __maintainer__ = 'Matthew Sheridan' __email__ ...
180
192
643
9
170
segfaultmagnet/squirtlebot
slackbot/squirtlebot.py
Python
SquirtleBot
SquirtleBot
23
103
23
23
76aacaec42f4135ca73215222cb4cacd5d07c080
bigcode/the-stack
train
afcfdd55fb06d66861f9926e
train
function
@patch("insights.client.auto_config.set_auto_configuration") @patch("insights.client.auto_config.open", return_value=["serverURL=https://some-hostname/", "sslCACert=some-certificate", "enabl...
@patch("insights.client.auto_config.set_auto_configuration") @patch("insights.client.auto_config.open", return_value=["serverURL=https://some-hostname/", "sslCACert=some-certificate", "enabl...
""" set_auto_configuration_mock is called with correct arguments. """ config_mock = Mock() _try_satellite5_configuration(config_mock) set_auto_configuration_mock.assert_called_once_with(config_mock, "some-hostname/redhat_access", ...
@patch("insights.client.auto_config.set_auto_configuration") @patch("insights.client.auto_config.open", return_value=["serverURL=https://some-hostname/", "sslCACert=some-certificate", "enabl...
103
64
167
103
0
dpensi/insights-core
insights/tests/client/auto_config/test_try_satellite5_configuration.py
Python
test_set_auto_configuration
test_set_auto_configuration
5
21
5
11
03230e7781b40ab7bbcddfe3fb5669a14dc79922
bigcode/the-stack
train
56894334cf50b8dbe5153ccc
train
class
class FaultTypes: PARAMETER_ERROR = 'Parameter Error' OBJECT_NOT_FOUND = 'Object Not Found' NOT_CONNECTED = 'Not Connected' TIME_OUT = 'Operation Timed Out' TASK_ERROR = 'Task Error' NOT_SUPPORTED = 'Operation Not Supported' INVALID_OPERATION = 'Inval...
class FaultTypes:
PARAMETER_ERROR = 'Parameter Error' OBJECT_NOT_FOUND = 'Object Not Found' NOT_CONNECTED = 'Not Connected' TIME_OUT = 'Operation Timed Out' TASK_ERROR = 'Task Error' NOT_SUPPORTED = 'Operation Not Supported' INVALID_OPERATION = 'Invalid Operation'
: message = str(e) try: fault = e.fault.detail[0].typecode.pname except: fault = 'Undefined' super(self.__class__, self).__init__(message, fault) class UnsupportedPerfIntervalError(VIException): pass class FaultTypes:
64
64
73
4
59
NCAR/spol-nagios
omd/versions/1.2.8p15.cre/lib/python/pysphere-0.1.7-py2.7.egg/pysphere/resources/vi_exception.py
Python
FaultTypes
FaultTypes
54
61
54
54
4c8faf87d8bb13a3ea2d0b310086872e4a2d4291
bigcode/the-stack
train
0fd711c578600e3d11be9fbc
train
class
class VIApiException(VIException): def __init__(self, e): try: message = e.fault.args[1] except: message = str(e) try: fault = e.fault.detail[0].typecode.pname except: fault = 'Undefined' super(self.__class__, self)....
class VIApiException(VIException):
def __init__(self, e): try: message = e.fault.args[1] except: message = str(e) try: fault = e.fault.detail[0].typecode.pname except: fault = 'Undefined' super(self.__class__, self).__init__(message, fault)
VIException(Exception): def __init__(self, msg, fault): self.message = str(msg) self.fault = str(fault) def __str__(self): return "[%s]: %s" % (self.fault, self.message) class VIApiException(VIException):
64
64
80
8
56
NCAR/spol-nagios
omd/versions/1.2.8p15.cre/lib/python/pysphere-0.1.7-py2.7.egg/pysphere/resources/vi_exception.py
Python
VIApiException
VIApiException
38
49
38
38
b4649c02842849a6bf5b14e84239d47990a0d9cb
bigcode/the-stack
train
840d35b955ef13d8a804e111
train
class
class UnsupportedPerfIntervalError(VIException): pass
class UnsupportedPerfIntervalError(VIException):
pass
ault.args[1] except: message = str(e) try: fault = e.fault.detail[0].typecode.pname except: fault = 'Undefined' super(self.__class__, self).__init__(message, fault) class UnsupportedPerfIntervalError(VIException):
64
64
12
9
55
NCAR/spol-nagios
omd/versions/1.2.8p15.cre/lib/python/pysphere-0.1.7-py2.7.egg/pysphere/resources/vi_exception.py
Python
UnsupportedPerfIntervalError
UnsupportedPerfIntervalError
51
52
51
51
92c1052c5e39b2d3cb5436179227007572cd243d
bigcode/the-stack
train
9ce1a3025e5ed81ece92d73e
train
class
class VIException(Exception): def __init__(self, msg, fault): self.message = str(msg) self.fault = str(fault) def __str__(self): return "[%s]: %s" % (self.fault, self.message)
class VIException(Exception):
def __init__(self, msg, fault): self.message = str(msg) self.fault = str(fault) def __str__(self): return "[%s]: %s" % (self.fault, self.message)
OR BUSINESS INTERRUPTION) HOWEVER # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # #-- class VIException(Exception):
63
64
57
5
58
NCAR/spol-nagios
omd/versions/1.2.8p15.cre/lib/python/pysphere-0.1.7-py2.7.egg/pysphere/resources/vi_exception.py
Python
VIException
VIException
30
35
30
30
00cba26ff5d98bac600fede2cb07fa6614b15b64
bigcode/the-stack
train
7f1d313e03ff6f272cd62512
train
function
def transition_system(env: PysmtEnv) -> Tuple[FrozenSet[FNode], FNode, FNode, FNode]: assert isinstance(env, PysmtEnv) mgr = env.formula_manager pc = mgr.Symbol("pc", types.INT) x = mgr.Symbol("x", types.INT) y = mgr.Symbol("y", types.INT) x_pc = sym...
def transition_system(env: PysmtEnv) -> Tuple[FrozenSet[FNode], FNode, FNode, FNode]:
assert isinstance(env, PysmtEnv) mgr = env.formula_manager pc = mgr.Symbol("pc", types.INT) x = mgr.Symbol("x", types.INT) y = mgr.Symbol("y", types.INT) x_pc = symb_to_next(mgr, pc) x_x = symb_to_next(mgr, x) x_y = symb_to_next(mgr, y) symbols = frozenset([pc, x, y]) m_1 = mgr...
from typing import Tuple, FrozenSet from pysmt.environment import Environment as PysmtEnv from pysmt.fnode import FNode import pysmt.typing as types from utils import symb_to_next from hint import Hint, Location def transition_system(env: PysmtEnv) -> Tuple[FrozenSet[FNode], FNode, FNode, ...
80
207
690
28
51
EnricoMagnago/F3
benchmarks/f3_wrong_hints/scaling_software_termination/13-2Nested_false-termination_32.py
Python
transition_system
transition_system
11
81
11
12
ee7d9122ed3dd418f18e1c09634da5f16f30d0d1
bigcode/the-stack
train
f2ea4b260de637eb87e77804
train
function
def hints(env: PysmtEnv) -> FrozenSet[Hint]: assert isinstance(env, PysmtEnv) mgr = env.formula_manager pc = mgr.Symbol("pc", types.INT) x = mgr.Symbol("x", types.INT) y = mgr.Symbol("y", types.INT) symbs = frozenset([pc, x, y]) m_100 = mgr.Int(-100) m_1 = mgr.Int(-1) i_0 = mgr.Int...
def hints(env: PysmtEnv) -> FrozenSet[Hint]:
assert isinstance(env, PysmtEnv) mgr = env.formula_manager pc = mgr.Symbol("pc", types.INT) x = mgr.Symbol("x", types.INT) y = mgr.Symbol("y", types.INT) symbs = frozenset([pc, x, y]) m_100 = mgr.Int(-100) m_1 = mgr.Int(-1) i_0 = mgr.Int(0) i_1 = mgr.Int(1) i_2 = mgr.Int(2)...
= -1 cfg.append(mgr.Implies(pcend, x_pcend)) trans = [] same_x = mgr.Equals(x_x, x) same_y = mgr.Equals(x_y, y) same = mgr.And(same_x, same_y) # pc = 0 -> same trans.append(mgr.Implies(pcs[0], same)) # pc = 1 -> x' = x + y & same_y trans.append(mgr.Implies(pcs[1], ...
256
256
1,709
15
240
EnricoMagnago/F3
benchmarks/f3_wrong_hints/scaling_software_termination/13-2Nested_false-termination_32.py
Python
hints
hints
84
222
84
84
6dd16665b7c1bd9e38a222108400685d873d13ec
bigcode/the-stack
train
e4787f2ab43db15009ab07c3
train
function
def init_system(): cap = init_vision_system(DEVICE_NUMBER) sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) sock.bind((HOST, PORT)) sock.listen(5) try: while True: newSocket, address = sock.accept() ...
def init_system():
cap = init_vision_system(DEVICE_NUMBER) sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) sock.bind((HOST, PORT)) sock.listen(5) try: while True: newSocket, address = sock.accept() print("Connected ...
# -*- coding: utf-8 -*- import socket import cv2 import math from configparser import ConfigParser from Modules import module_vision, module_calibrate_color, module_useful, module_simulation, module_plot # Read config.ini file config_object = ConfigParser() config_object.read("config.ini") system = config_object["SYST...
132
256
1,270
4
127
plugns/central-control-system
main.py
Python
init_system
init_system
23
131
23
23
7e129ac984c033841efae96a6e3fe06aa69a8b01
bigcode/the-stack
train
62f7897d5d297cfe7afae35e
train
function
def print_menuCentral(): module_useful.screen_clear() print(24 * "-", "CENTRAL CONTROL SYSTEM", 24 * "-") print("1. START CENTRAL CONTROL") print("2. ROBOT COLOR CALIBRATION") print("3. OBSTACLE COLOR CALIBRATION") print("4. VISUALIZAR CENÁRIO") print("5. VISUALIZAR CAMINHO") print("6. S...
def print_menuCentral():
module_useful.screen_clear() print(24 * "-", "CENTRAL CONTROL SYSTEM", 24 * "-") print("1. START CENTRAL CONTROL") print("2. ROBOT COLOR CALIBRATION") print("3. OBSTACLE COLOR CALIBRATION") print("4. VISUALIZAR CENÁRIO") print("5. VISUALIZAR CAMINHO") print("6. SIMULATOR") print("7. ...
= init_vision_system(DEVICE_NUMBER) while True: _, frame = cap.read() cv2.imshow("Cenario", frame) if cv2.waitKey(1) & 0xFF == ord('q'): break cv2.destroyAllWindows() def print_menuCentral():
64
64
112
5
59
plugns/central-control-system
main.py
Python
print_menuCentral
print_menuCentral
181
191
181
181
2a1e6b97bc64559e10d315b265b5e8e820105ad8
bigcode/the-stack
train
566cc1557c90e0072d66707a
train
function
def send_receive_data(newSocket, data): if SEND_COMMAND: newSocket.send(data.encode('utf-8')) print(">> Send Data: ", data) receivedData = newSocket.recv(2048).decode('utf-8') print(">> Receive Data: ", receivedData)
def send_receive_data(newSocket, data):
if SEND_COMMAND: newSocket.send(data.encode('utf-8')) print(">> Send Data: ", data) receivedData = newSocket.recv(2048).decode('utf-8') print(">> Receive Data: ", receivedData)
# 3 Parametro Velocidade Roda Esquerda # De 1 a 1024 # 4 Parametro Tempo # Em milisegundos # # Delimitador de parametros # F#500#100#100 def send_receive_data(newSocket, data):
64
64
63
9
54
plugns/central-control-system
main.py
Python
send_receive_data
send_receive_data
163
168
163
163
fdca7200e21fe188a12eb67e60f4183ef1beb3b6
bigcode/the-stack
train
b6b6adce27634f149467d794
train
function
def init_vision_system(device_number): cap = cv2.VideoCapture(device_number) if cap.isOpened(): cap.set(cv2.CAP_PROP_FRAME_WIDTH, 640) cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 480) width = cap.get(cv2.CAP_PROP_FRAME_WIDTH) height = cap.get(cv2.CAP_PROP_FRAME_HEIGHT) # print...
def init_vision_system(device_number):
cap = cv2.VideoCapture(device_number) if cap.isOpened(): cap.set(cv2.CAP_PROP_FRAME_WIDTH, 640) cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 480) width = cap.get(cv2.CAP_PROP_FRAME_WIDTH) height = cap.get(cv2.CAP_PROP_FRAME_HEIGHT) # print(cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP...
send_receive_data(newSocket, data) cv2.imshow("Cenario", frame) if cv2.waitKey(1) & 0xFF == ord('q'): break robot_log.close() obstacle_log.close() finally: sock.close() def init_vision_system(device_number):
65
65
218
8
57
plugns/central-control-system
main.py
Python
init_vision_system
init_vision_system
133
150
133
133
6950d15e4a018d4453a629fcad63d24787385372
bigcode/the-stack
train
283cece66bb476b755513096
train
function
def view_scenery(): cap = init_vision_system(DEVICE_NUMBER) while True: _, frame = cap.read() cv2.imshow("Cenario", frame) if cv2.waitKey(1) & 0xFF == ord('q'): break cv2.destroyAllWindows()
def view_scenery():
cap = init_vision_system(DEVICE_NUMBER) while True: _, frame = cap.read() cv2.imshow("Cenario", frame) if cv2.waitKey(1) & 0xFF == ord('q'): break cv2.destroyAllWindows()
Socket, data): if SEND_COMMAND: newSocket.send(data.encode('utf-8')) print(">> Send Data: ", data) receivedData = newSocket.recv(2048).decode('utf-8') print(">> Receive Data: ", receivedData) def view_scenery():
64
64
67
6
58
plugns/central-control-system
main.py
Python
view_scenery
view_scenery
171
178
171
171
a3ccbc7f96254154bfd3945b180d75fc6f3ad8d3
bigcode/the-stack
train
c09a6c6e349ac6d0387238b7
train
function
def main(): # dist_robot_obstacle = math.sqrt((308 - 297) ** 2) + math.sqrt((177 - 103) ** 2) # catX = 308 - 297 # catY = 177 - 103 # print(dist_robot_obstacle) while 1: print_menuCentral() try: choice = int(input("Enter your choice [1-5]:")) except ValueError: ...
def main(): # dist_robot_obstacle = math.sqrt((308 - 297) ** 2) + math.sqrt((177 - 103) ** 2) # catX = 308 - 297 # catY = 177 - 103 # print(dist_robot_obstacle)
while 1: print_menuCentral() try: choice = int(input("Enter your choice [1-5]:")) except ValueError: print("Not an integer! Try again.") continue if choice == 1: print(">> Starting Centrel Control") init_system() if ...
6. SIMULATOR") print("7. EXIT") print(71 * "-") def main(): # dist_robot_obstacle = math.sqrt((308 - 297) ** 2) + math.sqrt((177 - 103) ** 2) # catX = 308 - 297 # catY = 177 - 103 # print(dist_robot_obstacle)
85
85
286
65
20
plugns/central-control-system
main.py
Python
main
main
194
228
194
198
ade3c33f9c2659a301a85959536f3ff84fa43384
bigcode/the-stack
train
96c03cd8d1e4019a2c4d6b54
train
function
@client.event async def on_ready(): print(f'Logged in as "{client.user}"')
@client.event async def on_ready():
print(f'Logged in as "{client.user}"')
from asgiref.sync import sync_to_async from django.conf import settings from django.core.management.base import BaseCommand, CommandError from django.db.models import Q import discord from puzzles.models import Puzzle client = discord.Client() @client.event async def on_ready():
59
64
21
9
50
brentisreallyme/smallboard
chat/management/commands/rundiscordbot.py
Python
on_ready
on_ready
12
14
12
13
0ae888f914a1ce7367f22ca684c8f5a247dc8676
bigcode/the-stack
train
380c517c29d61c75b0547288
train
function
async def send_puzzles_stuck(message): puzzles = await sync_to_async(list)( Puzzle.objects.filter( Q(hunt=settings.BOT_ACTIVE_HUNT), Q(status=Puzzle.STUCK) | Q(status=Puzzle.EXTRACTION), ).select_related("chat_room") ) await send_puzzles(message, puzzles, "Stuck puzzl...
async def send_puzzles_stuck(message):
puzzles = await sync_to_async(list)( Puzzle.objects.filter( Q(hunt=settings.BOT_ACTIVE_HUNT), Q(status=Puzzle.STUCK) | Q(status=Puzzle.EXTRACTION), ).select_related("chat_room") ) await send_puzzles(message, puzzles, "Stuck puzzles")
(message): puzzles = await sync_to_async(list)( Puzzle.objects.filter( hunt=settings.BOT_ACTIVE_HUNT, status=Puzzle.SOLVED ).select_related("chat_room") ) await send_puzzles(message, puzzles, "Solved puzzles") async def send_puzzles_stuck(message):
64
64
74
9
55
brentisreallyme/smallboard
chat/management/commands/rundiscordbot.py
Python
send_puzzles_stuck
send_puzzles_stuck
61
68
61
61
f628d2408ee8ee4a9b8f1e19c1b66302c4366bc7
bigcode/the-stack
train
34152c56cd33f67a8ddeb3d6
train
function
async def send_puzzles_unsolved(message): puzzles = await sync_to_async(list)( Puzzle.objects.filter( Q(hunt=settings.BOT_ACTIVE_HUNT), Q(status=Puzzle.SOLVING) | Q(status=Puzzle.PENDING), ).select_related("chat_room") ) await send_puzzles(message, puzzles, "Unsolved ...
async def send_puzzles_unsolved(message):
puzzles = await sync_to_async(list)( Puzzle.objects.filter( Q(hunt=settings.BOT_ACTIVE_HUNT), Q(status=Puzzle.SOLVING) | Q(status=Puzzle.PENDING), ).select_related("chat_room") ) await send_puzzles(message, puzzles, "Unsolved puzzles")
to help text. handle = { "unsolved": send_puzzles_unsolved, "solved": send_puzzles_solved, "stuck": send_puzzles_stuck, }.get(subcommand, send_help) await handle(message) async def send_puzzles_unsolved(message):
64
64
77
9
55
brentisreallyme/smallboard
chat/management/commands/rundiscordbot.py
Python
send_puzzles_unsolved
send_puzzles_unsolved
42
49
42
42
e609da9ee1f00eb3c96f8abf4e5701251ea73768
bigcode/the-stack
train