blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
378
8.64k
id
stringlengths
44
44
length_bytes
int64
505
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.88k
prompted_full_text
stringlengths
565
12.5k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
5.05k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
snapshot_total_rows
int64
75.8k
75.8k
solution
stringlengths
242
8.3k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
271625f4489bcb1672a37b82c2fb3cdd1b063cda
[ "ticket0 = Ticket(variety='B', issue='ticket0', verified=True, date_verified=datetime.date.today(), date_start_dev=datetime.date.today())\nticket0.save()\nticket1 = Ticket.objects.create(variety='F', issue='ticket1', verified=True, date_verified=datetime.date.today(), date_start_dev=datetime.date.today(), date_done...
<|body_start_0|> ticket0 = Ticket(variety='B', issue='ticket0', verified=True, date_verified=datetime.date.today(), date_start_dev=datetime.date.today()) ticket0.save() ticket1 = Ticket.objects.create(variety='F', issue='ticket1', verified=True, date_verified=datetime.date.today(), date_start_de...
A class design to test passing data to a chart
TestCharts
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestCharts: """A class design to test passing data to a chart""" def test_ActivityChartdata(self): """Tests updates chart data""" <|body_0|> def test_bar_charts(self): """Tests popularity charts data""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_008600
2,411
no_license
[ { "docstring": "Tests updates chart data", "name": "test_ActivityChartdata", "signature": "def test_ActivityChartdata(self)" }, { "docstring": "Tests popularity charts data", "name": "test_bar_charts", "signature": "def test_bar_charts(self)" } ]
2
stack_v2_sparse_classes_30k_train_028603
Implement the Python class `TestCharts` described below. Class description: A class design to test passing data to a chart Method signatures and docstrings: - def test_ActivityChartdata(self): Tests updates chart data - def test_bar_charts(self): Tests popularity charts data
Implement the Python class `TestCharts` described below. Class description: A class design to test passing data to a chart Method signatures and docstrings: - def test_ActivityChartdata(self): Tests updates chart data - def test_bar_charts(self): Tests popularity charts data <|skeleton|> class TestCharts: """A c...
158953e5e375856c80ab34859c581b628681657e
<|skeleton|> class TestCharts: """A class design to test passing data to a chart""" def test_ActivityChartdata(self): """Tests updates chart data""" <|body_0|> def test_bar_charts(self): """Tests popularity charts data""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestCharts: """A class design to test passing data to a chart""" def test_ActivityChartdata(self): """Tests updates chart data""" ticket0 = Ticket(variety='B', issue='ticket0', verified=True, date_verified=datetime.date.today(), date_start_dev=datetime.date.today()) ticket0.save()...
the_stack_v2_python_sparse
home/test_models.py
kajamiko/u_m_website
train
0
aec4e05b567dd771e14544f27f007cdf08280014
[ "np.random.seed(106)\nself.params = dict()\nself.params['W1'] = weight_init_std * np.random.randn(input_size, hidden_size)\nself.params['b1'] = np.zeros(hidden_size)\nself.params['W2'] = weight_init_std * np.random.randn(hidden_size, output_size)\nself.params['b2'] = np.zeros(output_size)\nself.layers = OrderedDict...
<|body_start_0|> np.random.seed(106) self.params = dict() self.params['W1'] = weight_init_std * np.random.randn(input_size, hidden_size) self.params['b1'] = np.zeros(hidden_size) self.params['W2'] = weight_init_std * np.random.randn(hidden_size, output_size) self.params['...
TwoLayerNetwork
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TwoLayerNetwork: def __init__(self, input_size, hidden_size, output_size, weight_init_std=0.01): """신경망의 구조 결정""" <|body_0|> def predict(self, x): """input x를 받아 Forwrd Propagation을 통해 예측된 output Y1 = self.layer['affine1].forward(x) Y2 = self.layer['relu].forward(Y1)...
stack_v2_sparse_classes_75kplus_train_008601
7,910
no_license
[ { "docstring": "신경망의 구조 결정", "name": "__init__", "signature": "def __init__(self, input_size, hidden_size, output_size, weight_init_std=0.01)" }, { "docstring": "input x를 받아 Forwrd Propagation을 통해 예측된 output Y1 = self.layer['affine1].forward(x) Y2 = self.layer['relu].forward(Y1) Y3 = self.layer[...
5
stack_v2_sparse_classes_30k_train_005800
Implement the Python class `TwoLayerNetwork` described below. Class description: Implement the TwoLayerNetwork class. Method signatures and docstrings: - def __init__(self, input_size, hidden_size, output_size, weight_init_std=0.01): 신경망의 구조 결정 - def predict(self, x): input x를 받아 Forwrd Propagation을 통해 예측된 output Y1 ...
Implement the Python class `TwoLayerNetwork` described below. Class description: Implement the TwoLayerNetwork class. Method signatures and docstrings: - def __init__(self, input_size, hidden_size, output_size, weight_init_std=0.01): 신경망의 구조 결정 - def predict(self, x): input x를 받아 Forwrd Propagation을 통해 예측된 output Y1 ...
99ddcadec0c93bd42113f6b5fbecd9171c030f8b
<|skeleton|> class TwoLayerNetwork: def __init__(self, input_size, hidden_size, output_size, weight_init_std=0.01): """신경망의 구조 결정""" <|body_0|> def predict(self, x): """input x를 받아 Forwrd Propagation을 통해 예측된 output Y1 = self.layer['affine1].forward(x) Y2 = self.layer['relu].forward(Y1)...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TwoLayerNetwork: def __init__(self, input_size, hidden_size, output_size, weight_init_std=0.01): """신경망의 구조 결정""" np.random.seed(106) self.params = dict() self.params['W1'] = weight_init_std * np.random.randn(input_size, hidden_size) self.params['b1'] = np.zeros(hidden_...
the_stack_v2_python_sparse
ch05_Back_Propagation/ex10_MNIST_Two_Layer_NN_Propagation.py
handaeho/lab_dl
train
0
6e84ab5e8f8316ad937ef9a7efb2f4bcf023e1c9
[ "node = None\nif x not in self.__disjoint_set_dict.keys():\n node = self.Node(x)\n self.__disjoint_set_dict[x] = node\nreturn node", "new_sets = []\nfor x in array:\n if x not in self.__disjoint_set_dict.keys():\n node = self.Node(x)\n new_sets.append(node)\n self.__disjoint_set_dict...
<|body_start_0|> node = None if x not in self.__disjoint_set_dict.keys(): node = self.Node(x) self.__disjoint_set_dict[x] = node return node <|end_body_0|> <|body_start_1|> new_sets = [] for x in array: if x not in self.__disjoint_set_dict.key...
DisjointSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DisjointSet: def make_set(self, x): """Add a new set disjoint from all others to the list :param x: the id of the set to add :return: the new node or None if the node already exists in the set""" <|body_0|> def make_sets(self, array): """Add new disjoint sets for eac...
stack_v2_sparse_classes_75kplus_train_008602
2,550
no_license
[ { "docstring": "Add a new set disjoint from all others to the list :param x: the id of the set to add :return: the new node or None if the node already exists in the set", "name": "make_set", "signature": "def make_set(self, x)" }, { "docstring": "Add new disjoint sets for each id in the array :...
5
stack_v2_sparse_classes_30k_train_001641
Implement the Python class `DisjointSet` described below. Class description: Implement the DisjointSet class. Method signatures and docstrings: - def make_set(self, x): Add a new set disjoint from all others to the list :param x: the id of the set to add :return: the new node or None if the node already exists in the...
Implement the Python class `DisjointSet` described below. Class description: Implement the DisjointSet class. Method signatures and docstrings: - def make_set(self, x): Add a new set disjoint from all others to the list :param x: the id of the set to add :return: the new node or None if the node already exists in the...
674c4c4053f128c79f66440eaf2d1960395c840d
<|skeleton|> class DisjointSet: def make_set(self, x): """Add a new set disjoint from all others to the list :param x: the id of the set to add :return: the new node or None if the node already exists in the set""" <|body_0|> def make_sets(self, array): """Add new disjoint sets for eac...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DisjointSet: def make_set(self, x): """Add a new set disjoint from all others to the list :param x: the id of the set to add :return: the new node or None if the node already exists in the set""" node = None if x not in self.__disjoint_set_dict.keys(): node = self.Node(x) ...
the_stack_v2_python_sparse
Greedy/Minimum Spanning Tree/DisjointSet.py
dlowrey/applied-algorithms
train
0
00b628edd37ceb47194044e9d8f5f5f130791ea9
[ "from collections import defaultdict\nself.d = defaultdict(list)\nfor i, w in enumerate(words):\n self.d[w] += (i,)", "w1idx = self.d[word1]\nw2idx = self.d[word2]\ni, j = (0, 0)\nm, n = (len(w1idx), len(w2idx))\nmin_dist = float('inf')\nwhile i < m and j < n:\n if w1idx[i] < w2idx[j]:\n min_dist = m...
<|body_start_0|> from collections import defaultdict self.d = defaultdict(list) for i, w in enumerate(words): self.d[w] += (i,) <|end_body_0|> <|body_start_1|> w1idx = self.d[word1] w2idx = self.d[word2] i, j = (0, 0) m, n = (len(w1idx), len(w2idx)) ...
WordDistance
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WordDistance: def __init__(self, words): """:type words: List[str]""" <|body_0|> def shortest(self, word1, word2): """:type word1: str :type word2: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> from collections import defaultdict ...
stack_v2_sparse_classes_75kplus_train_008603
2,177
no_license
[ { "docstring": ":type words: List[str]", "name": "__init__", "signature": "def __init__(self, words)" }, { "docstring": ":type word1: str :type word2: str :rtype: int", "name": "shortest", "signature": "def shortest(self, word1, word2)" } ]
2
null
Implement the Python class `WordDistance` described below. Class description: Implement the WordDistance class. Method signatures and docstrings: - def __init__(self, words): :type words: List[str] - def shortest(self, word1, word2): :type word1: str :type word2: str :rtype: int
Implement the Python class `WordDistance` described below. Class description: Implement the WordDistance class. Method signatures and docstrings: - def __init__(self, words): :type words: List[str] - def shortest(self, word1, word2): :type word1: str :type word2: str :rtype: int <|skeleton|> class WordDistance: ...
6350568d16b0f8c49a020f055bb6d72e2705ea56
<|skeleton|> class WordDistance: def __init__(self, words): """:type words: List[str]""" <|body_0|> def shortest(self, word1, word2): """:type word1: str :type word2: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WordDistance: def __init__(self, words): """:type words: List[str]""" from collections import defaultdict self.d = defaultdict(list) for i, w in enumerate(words): self.d[w] += (i,) def shortest(self, word1, word2): """:type word1: str :type word2: str :...
the_stack_v2_python_sparse
co_linkedin/244_Shortest_Word_Distance_II.py
vsdrun/lc_public
train
6
c093645b38ab683021e11c21a957bd94a4a0b0b8
[ "try:\n self.requested_bands = algo_config[self.name][producttype_to_sat(product_type)]\nexcept KeyError as invalid_product:\n msg = f'{product_type} is not allowed with {self.name}'\n raise InputError(msg) from invalid_product\ncalibration_dict, calibration_name = load_calib(calibration, self._default_cal...
<|body_start_0|> try: self.requested_bands = algo_config[self.name][producttype_to_sat(product_type)] except KeyError as invalid_product: msg = f'{product_type} is not allowed with {self.name}' raise InputError(msg) from invalid_product calibration_dict, calib...
Chlorophyll-a concentration (in mg/m3) from 3 red bands after Gons et al., 1999, 2002, 2004 Red edge algorithm to retrieve Chlorophyll-a concentration (in mg/m3) from surface reflectances (rho, unitless) or remote sensing reflectances (Rrs, in sr-1) at 665nm B4 MSI, 704nm B5 MSI and 783nm B7 MSI. This algorithm was pub...
CHLAGons
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CHLAGons: """Chlorophyll-a concentration (in mg/m3) from 3 red bands after Gons et al., 1999, 2002, 2004 Red edge algorithm to retrieve Chlorophyll-a concentration (in mg/m3) from surface reflectances (rho, unitless) or remote sensing reflectances (Rrs, in sr-1) at 665nm B4 MSI, 704nm B5 MSI and ...
stack_v2_sparse_classes_75kplus_train_008604
23,282
permissive
[ { "docstring": "Inits an 'CHLAGons' instance with specific settings. Args: product_type: The type of the input satellite product (e.g. S2_ESA_L2A or L8_USGS_L1GT) calibration: Optional; The calibration (set of parameters) used by the algorithm (default=_default_calibration_name). **_ignored: Unused kwargs sent ...
2
stack_v2_sparse_classes_30k_train_013275
Implement the Python class `CHLAGons` described below. Class description: Chlorophyll-a concentration (in mg/m3) from 3 red bands after Gons et al., 1999, 2002, 2004 Red edge algorithm to retrieve Chlorophyll-a concentration (in mg/m3) from surface reflectances (rho, unitless) or remote sensing reflectances (Rrs, in s...
Implement the Python class `CHLAGons` described below. Class description: Chlorophyll-a concentration (in mg/m3) from 3 red bands after Gons et al., 1999, 2002, 2004 Red edge algorithm to retrieve Chlorophyll-a concentration (in mg/m3) from surface reflectances (rho, unitless) or remote sensing reflectances (Rrs, in s...
f516bb778b505739fdf320affe651b715ed75324
<|skeleton|> class CHLAGons: """Chlorophyll-a concentration (in mg/m3) from 3 red bands after Gons et al., 1999, 2002, 2004 Red edge algorithm to retrieve Chlorophyll-a concentration (in mg/m3) from surface reflectances (rho, unitless) or remote sensing reflectances (Rrs, in sr-1) at 665nm B4 MSI, 704nm B5 MSI and ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CHLAGons: """Chlorophyll-a concentration (in mg/m3) from 3 red bands after Gons et al., 1999, 2002, 2004 Red edge algorithm to retrieve Chlorophyll-a concentration (in mg/m3) from surface reflectances (rho, unitless) or remote sensing reflectances (Rrs, in sr-1) at 665nm B4 MSI, 704nm B5 MSI and 783nm B7 MSI....
the_stack_v2_python_sparse
sisppeo/wcproducts/chla.py
inrae/SISPPEO
train
11
96984604d78420cddf63ecc393a38d58f8d6bb8e
[ "import heapq\nh = []\nprint(lists, lists[0])\nfor list in lists:\n if list:\n heapq.heappush(h, (list.val, list))\nprint(h)\nroot = ListNode(-1)\nroot_copy = root\nwhile h:\n print(h)\n a = heapq.heappop(h)\n root.next = a[1]\n root = root.next\n print(a[1].val)\n b = a[1].next\n if ...
<|body_start_0|> import heapq h = [] print(lists, lists[0]) for list in lists: if list: heapq.heappush(h, (list.val, list)) print(h) root = ListNode(-1) root_copy = root while h: print(h) a = heapq.heappo...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mergeKLists(self, lists): """:type lists: List[ListNode] :rtype: ListNode 122ms""" <|body_0|> def mergeKLists_1(self, lists): """:type lists: List[ListNode] :rtype: ListNode 102ms""" <|body_1|> <|end_skeleton|> <|body_start_0|> import ...
stack_v2_sparse_classes_75kplus_train_008605
1,682
no_license
[ { "docstring": ":type lists: List[ListNode] :rtype: ListNode 122ms", "name": "mergeKLists", "signature": "def mergeKLists(self, lists)" }, { "docstring": ":type lists: List[ListNode] :rtype: ListNode 102ms", "name": "mergeKLists_1", "signature": "def mergeKLists_1(self, lists)" } ]
2
stack_v2_sparse_classes_30k_train_045734
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode 122ms - def mergeKLists_1(self, lists): :type lists: List[ListNode] :rtype: ListNode 102ms
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode 122ms - def mergeKLists_1(self, lists): :type lists: List[ListNode] :rtype: ListNode 102ms <|skeleton|...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def mergeKLists(self, lists): """:type lists: List[ListNode] :rtype: ListNode 122ms""" <|body_0|> def mergeKLists_1(self, lists): """:type lists: List[ListNode] :rtype: ListNode 102ms""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def mergeKLists(self, lists): """:type lists: List[ListNode] :rtype: ListNode 122ms""" import heapq h = [] print(lists, lists[0]) for list in lists: if list: heapq.heappush(h, (list.val, list)) print(h) root = ListNo...
the_stack_v2_python_sparse
MergekSortedLists_HARD_23.py
953250587/leetcode-python
train
2
6208c747837eb78a46a70521df0a510cc273bea9
[ "self.ensure_one()\nwith self.backend_id.work_on(self._name) as work:\n exporter = work.component(usage='standard_price.exporter')\n return exporter.run(self)", "backend = self.backend_id\nif not backend.backend_export_qty:\n return True\nwith backend.work_on('prestashop.product.template') as work:\n ...
<|body_start_0|> self.ensure_one() with self.backend_id.work_on(self._name) as work: exporter = work.component(usage='standard_price.exporter') return exporter.run(self) <|end_body_0|> <|body_start_1|> backend = self.backend_id if not backend.backend_export_qty: ...
PrestashopProductTemplate
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrestashopProductTemplate: def export_standard_price(self): """Export the standard price of a product.""" <|body_0|> def export_inventory(self, fields=None): """Export the inventory configuration and quantity of a product.""" <|body_1|> <|end_skeleton|> <|b...
stack_v2_sparse_classes_75kplus_train_008606
3,429
no_license
[ { "docstring": "Export the standard price of a product.", "name": "export_standard_price", "signature": "def export_standard_price(self)" }, { "docstring": "Export the inventory configuration and quantity of a product.", "name": "export_inventory", "signature": "def export_inventory(self...
2
stack_v2_sparse_classes_30k_train_046296
Implement the Python class `PrestashopProductTemplate` described below. Class description: Implement the PrestashopProductTemplate class. Method signatures and docstrings: - def export_standard_price(self): Export the standard price of a product. - def export_inventory(self, fields=None): Export the inventory configu...
Implement the Python class `PrestashopProductTemplate` described below. Class description: Implement the PrestashopProductTemplate class. Method signatures and docstrings: - def export_standard_price(self): Export the standard price of a product. - def export_inventory(self, fields=None): Export the inventory configu...
c24db5a1769c71b01397560309f5d2027f0da87c
<|skeleton|> class PrestashopProductTemplate: def export_standard_price(self): """Export the standard price of a product.""" <|body_0|> def export_inventory(self, fields=None): """Export the inventory configuration and quantity of a product.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PrestashopProductTemplate: def export_standard_price(self): """Export the standard price of a product.""" self.ensure_one() with self.backend_id.work_on(self._name) as work: exporter = work.component(usage='standard_price.exporter') return exporter.run(self) ...
the_stack_v2_python_sparse
project-addons/custom_prestashop/models/product_template/common.py
Comunitea/CMNT_00207_2020_ASC
train
2
2408b5ebaf5c6895bbf753fbda43473c545a9381
[ "self.controller_state = SimpleControllerState()\nself.S = State(self.index)\nself.D = Drawer(self.renderer)\nself.P = PygameDrawer()\nself.strategy = None", "print('FRAME')\nself.D._start_frame()\nself.P._start_frame()\nself.S.update(packet)\nstrategy = select_strategy(self.S, self.D, self.P)\nball_prediction = ...
<|body_start_0|> self.controller_state = SimpleControllerState() self.S = State(self.index) self.D = Drawer(self.renderer) self.P = PygameDrawer() self.strategy = None <|end_body_0|> <|body_start_1|> print('FRAME') self.D._start_frame() self.P._start_fram...
UntitledSideProject
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UntitledSideProject: def initialize_agent(self): """Callback from BaseAgent.__init__() TODO does this nested class affect performance?""" <|body_0|> def get_output(self, packet: GameTickPacket) -> SimpleControllerState: """Recieves: 1/60 second of new game informatio...
stack_v2_sparse_classes_75kplus_train_008607
1,997
permissive
[ { "docstring": "Callback from BaseAgent.__init__() TODO does this nested class affect performance?", "name": "initialize_agent", "signature": "def initialize_agent(self)" }, { "docstring": "Recieves: 1/60 second of new game information Returns: what buttons to push", "name": "get_output", ...
2
null
Implement the Python class `UntitledSideProject` described below. Class description: Implement the UntitledSideProject class. Method signatures and docstrings: - def initialize_agent(self): Callback from BaseAgent.__init__() TODO does this nested class affect performance? - def get_output(self, packet: GameTickPacket...
Implement the Python class `UntitledSideProject` described below. Class description: Implement the UntitledSideProject class. Method signatures and docstrings: - def initialize_agent(self): Callback from BaseAgent.__init__() TODO does this nested class affect performance? - def get_output(self, packet: GameTickPacket...
4980da9633eda02b71ff1dfab176b575e9873714
<|skeleton|> class UntitledSideProject: def initialize_agent(self): """Callback from BaseAgent.__init__() TODO does this nested class affect performance?""" <|body_0|> def get_output(self, packet: GameTickPacket) -> SimpleControllerState: """Recieves: 1/60 second of new game informatio...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UntitledSideProject: def initialize_agent(self): """Callback from BaseAgent.__init__() TODO does this nested class affect performance?""" self.controller_state = SimpleControllerState() self.S = State(self.index) self.D = Drawer(self.renderer) self.P = PygameDrawer() ...
the_stack_v2_python_sparse
src/bot.py
asmacdo/UntitledSideProject
train
0
22904627e083c0a6c499277dc3315e90328f7250
[ "result = 1\nmax_result = 0\nmax_list = []\nnums = self.zip(nums)\nreturn max_result", "num_1 = []\nfor i in range(len(nums)):\n count = 1\n numbers = 0\n if nums[i] != 1 and nums[i] != -1:\n if numbers > 1:\n num_1.append(count)\n num_1.append(nums[i])\n else:\n ...
<|body_start_0|> result = 1 max_result = 0 max_list = [] nums = self.zip(nums) return max_result <|end_body_0|> <|body_start_1|> num_1 = [] for i in range(len(nums)): count = 1 numbers = 0 if nums[i] != 1 and nums[i] != -1: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProduct(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def zip(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> result = 1 max_result = 0 max_li...
stack_v2_sparse_classes_75kplus_train_008608
39,159
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "maxProduct", "signature": "def maxProduct(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "zip", "signature": "def zip(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_007281
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProduct(self, nums): :type nums: List[int] :rtype: int - def zip(self, nums): :type nums: List[int] :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProduct(self, nums): :type nums: List[int] :rtype: int - def zip(self, nums): :type nums: List[int] :rtype: List[int] <|skeleton|> class Solution: def maxProduct(sel...
f71112f3880b5e77f633c88e075989a9ff2b25b7
<|skeleton|> class Solution: def maxProduct(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def zip(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def maxProduct(self, nums): """:type nums: List[int] :rtype: int""" result = 1 max_result = 0 max_list = [] nums = self.zip(nums) return max_result def zip(self, nums): """:type nums: List[int] :rtype: List[int]""" num_1 = [] ...
the_stack_v2_python_sparse
152. Maximum Product Subarray.py
sherlock1987/Leetcode
train
0
0efeb5b55cc15394fb1b8155c21eb00b4877974b
[ "multi = a\nres = 1\nwhile k:\n if k & 1 == 1:\n res = res % 1337 * (multi % 1337) % 1337\n multi = multi % 1337 * (multi % 1337) % 1337\n k >>= 1\nreturn res", "if not b:\n return 1\nn = len(b)\nlast_digit = b.pop()\nleft = self.fast_pow(a, last_digit)\nright = self.fast_pow(self.superPow(a, b...
<|body_start_0|> multi = a res = 1 while k: if k & 1 == 1: res = res % 1337 * (multi % 1337) % 1337 multi = multi % 1337 * (multi % 1337) % 1337 k >>= 1 return res <|end_body_0|> <|body_start_1|> if not b: return 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def fast_pow(self, a, k): """快速幂,以及乘法的模运算""" <|body_0|> def superPow(self, a: int, b: List[int]) -> int: """数学 math 快速幂 exponentiating by squaring 递归 https://leetcode.cn/problems/super-pow/solution/you-qian-ru-shen-kuai-su-mi-suan-fa-xiang-jie-by-l/""" ...
stack_v2_sparse_classes_75kplus_train_008609
1,339
no_license
[ { "docstring": "快速幂,以及乘法的模运算", "name": "fast_pow", "signature": "def fast_pow(self, a, k)" }, { "docstring": "数学 math 快速幂 exponentiating by squaring 递归 https://leetcode.cn/problems/super-pow/solution/you-qian-ru-shen-kuai-su-mi-suan-fa-xiang-jie-by-l/", "name": "superPow", "signature": "...
2
stack_v2_sparse_classes_30k_train_044345
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def fast_pow(self, a, k): 快速幂,以及乘法的模运算 - def superPow(self, a: int, b: List[int]) -> int: 数学 math 快速幂 exponentiating by squaring 递归 https://leetcode.cn/problems/super-pow/solutio...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def fast_pow(self, a, k): 快速幂,以及乘法的模运算 - def superPow(self, a: int, b: List[int]) -> int: 数学 math 快速幂 exponentiating by squaring 递归 https://leetcode.cn/problems/super-pow/solutio...
3ea03cd8b1fa507553ebee4fd765c4cc4b5814b6
<|skeleton|> class Solution: def fast_pow(self, a, k): """快速幂,以及乘法的模运算""" <|body_0|> def superPow(self, a: int, b: List[int]) -> int: """数学 math 快速幂 exponentiating by squaring 递归 https://leetcode.cn/problems/super-pow/solution/you-qian-ru-shen-kuai-su-mi-suan-fa-xiang-jie-by-l/""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def fast_pow(self, a, k): """快速幂,以及乘法的模运算""" multi = a res = 1 while k: if k & 1 == 1: res = res % 1337 * (multi % 1337) % 1337 multi = multi % 1337 * (multi % 1337) % 1337 k >>= 1 return res def superPo...
the_stack_v2_python_sparse
Super_Pow_372.py
jay6413682/Leetcode
train
0
a22ed3e64460539683906e2d6e3218494c17a836
[ "queryset = self.get_child_qs(graph_id)\nserializer = self.get_serializer(queryset, many=True)\nreturn response.Response(serializer.data)", "graph_id = self.request.resolver_match.kwargs['graph_id']\ngraph = self.get_graph(graph_id)\nserializer.save(graph=graph)" ]
<|body_start_0|> queryset = self.get_child_qs(graph_id) serializer = self.get_serializer(queryset, many=True) return response.Response(serializer.data) <|end_body_0|> <|body_start_1|> graph_id = self.request.resolver_match.kwargs['graph_id'] graph = self.get_graph(graph_id) ...
A ListCreateAPIView mixin for graph children objects. E.g. NodeViews and EdgeViews Child here refers to node or edge object
GraphChildListCreateViewMixin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GraphChildListCreateViewMixin: """A ListCreateAPIView mixin for graph children objects. E.g. NodeViews and EdgeViews Child here refers to node or edge object""" def list_(self, request, graph_id): """Return all the children of a given graph""" <|body_0|> def perform_crea...
stack_v2_sparse_classes_75kplus_train_008610
1,932
no_license
[ { "docstring": "Return all the children of a given graph", "name": "list_", "signature": "def list_(self, request, graph_id)" }, { "docstring": "Add the graph to the child object.", "name": "perform_create_", "signature": "def perform_create_(self, serializer)" } ]
2
stack_v2_sparse_classes_30k_train_000575
Implement the Python class `GraphChildListCreateViewMixin` described below. Class description: A ListCreateAPIView mixin for graph children objects. E.g. NodeViews and EdgeViews Child here refers to node or edge object Method signatures and docstrings: - def list_(self, request, graph_id): Return all the children of ...
Implement the Python class `GraphChildListCreateViewMixin` described below. Class description: A ListCreateAPIView mixin for graph children objects. E.g. NodeViews and EdgeViews Child here refers to node or edge object Method signatures and docstrings: - def list_(self, request, graph_id): Return all the children of ...
9e01ff8ab73f6d9d16606ec1c8b7c91cdfa9cd2c
<|skeleton|> class GraphChildListCreateViewMixin: """A ListCreateAPIView mixin for graph children objects. E.g. NodeViews and EdgeViews Child here refers to node or edge object""" def list_(self, request, graph_id): """Return all the children of a given graph""" <|body_0|> def perform_crea...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GraphChildListCreateViewMixin: """A ListCreateAPIView mixin for graph children objects. E.g. NodeViews and EdgeViews Child here refers to node or edge object""" def list_(self, request, graph_id): """Return all the children of a given graph""" queryset = self.get_child_qs(graph_id) ...
the_stack_v2_python_sparse
server/utils/views/mixins.py
Aviemusca/bjj-digraph
train
0
e2f882f2e338ae933f44ade3896080429808abe9
[ "self.sess = sess\nself.name_map = {v.name: v for v in vars_to_update}\nself.logger = logger", "if strict:\n var.load(val)\n return\nname = var.op.name\nvarshape = tuple(var.get_shape().as_list())\nif varshape != val.shape:\n assert np.prod(varshape) == np.prod(val.shape), '{}: {}!={}'.format(name, varsh...
<|body_start_0|> self.sess = sess self.name_map = {v.name: v for v in vars_to_update} self.logger = logger <|end_body_0|> <|body_start_1|> if strict: var.load(val) return name = var.op.name varshape = tuple(var.get_shape().as_list()) if va...
Update the variables in a session
SessionUpdate
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SessionUpdate: """Update the variables in a session""" def __init__(self, sess, vars_to_update, logger): """Args: sess (tf.Session): a session object vars_to_update: a collection of variables to update""" <|body_0|> def load_value_to_var(var, val, logger, strict=False): ...
stack_v2_sparse_classes_75kplus_train_008611
6,060
permissive
[ { "docstring": "Args: sess (tf.Session): a session object vars_to_update: a collection of variables to update", "name": "__init__", "signature": "def __init__(self, sess, vars_to_update, logger)" }, { "docstring": "Call `var.load(val)` with the default session. Args: var (tf.Variable): strict (b...
3
stack_v2_sparse_classes_30k_train_050673
Implement the Python class `SessionUpdate` described below. Class description: Update the variables in a session Method signatures and docstrings: - def __init__(self, sess, vars_to_update, logger): Args: sess (tf.Session): a session object vars_to_update: a collection of variables to update - def load_value_to_var(v...
Implement the Python class `SessionUpdate` described below. Class description: Update the variables in a session Method signatures and docstrings: - def __init__(self, sess, vars_to_update, logger): Args: sess (tf.Session): a session object vars_to_update: a collection of variables to update - def load_value_to_var(v...
5e7dd5f79b764a4af7a789ed84bff4b6dfcdb121
<|skeleton|> class SessionUpdate: """Update the variables in a session""" def __init__(self, sess, vars_to_update, logger): """Args: sess (tf.Session): a session object vars_to_update: a collection of variables to update""" <|body_0|> def load_value_to_var(var, val, logger, strict=False): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SessionUpdate: """Update the variables in a session""" def __init__(self, sess, vars_to_update, logger): """Args: sess (tf.Session): a session object vars_to_update: a collection of variables to update""" self.sess = sess self.name_map = {v.name: v for v in vars_to_update} ...
the_stack_v2_python_sparse
utils/dict_restore.py
xingyul/meteornet
train
148
3d2d93ce71ed3d1da9dc5c765f25e34f6ecaabc5
[ "if isinstance(traverse_block, Traverse):\n return cls(traverse_block.direction, traverse_block.edge_name)\nelse:\n raise AssertionError(u'Tried to initialize an instance of GremlinFoldedTraverse with block of type {}'.format(type(traverse_block)))", "self.validate()\ntemplate_data = {'direction': self.dire...
<|body_start_0|> if isinstance(traverse_block, Traverse): return cls(traverse_block.direction, traverse_block.edge_name) else: raise AssertionError(u'Tried to initialize an instance of GremlinFoldedTraverse with block of type {}'.format(type(traverse_block))) <|end_body_0|> <|bo...
A Gremlin-specific Traverse block to be used only within @fold scopes.
GremlinFoldedTraverse
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GremlinFoldedTraverse: """A Gremlin-specific Traverse block to be used only within @fold scopes.""" def from_traverse(cls, traverse_block): """Create a GremlinFoldedTraverse block as a copy of the given Traverse block.""" <|body_0|> def to_gremlin(self): """Retur...
stack_v2_sparse_classes_75kplus_train_008612
15,931
permissive
[ { "docstring": "Create a GremlinFoldedTraverse block as a copy of the given Traverse block.", "name": "from_traverse", "signature": "def from_traverse(cls, traverse_block)" }, { "docstring": "Return a unicode object with the Gremlin representation of this block.", "name": "to_gremlin", "...
2
stack_v2_sparse_classes_30k_val_002942
Implement the Python class `GremlinFoldedTraverse` described below. Class description: A Gremlin-specific Traverse block to be used only within @fold scopes. Method signatures and docstrings: - def from_traverse(cls, traverse_block): Create a GremlinFoldedTraverse block as a copy of the given Traverse block. - def to...
Implement the Python class `GremlinFoldedTraverse` described below. Class description: A Gremlin-specific Traverse block to be used only within @fold scopes. Method signatures and docstrings: - def from_traverse(cls, traverse_block): Create a GremlinFoldedTraverse block as a copy of the given Traverse block. - def to...
4511793281698bd55e63fd7a3f25f9cb094084d4
<|skeleton|> class GremlinFoldedTraverse: """A Gremlin-specific Traverse block to be used only within @fold scopes.""" def from_traverse(cls, traverse_block): """Create a GremlinFoldedTraverse block as a copy of the given Traverse block.""" <|body_0|> def to_gremlin(self): """Retur...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GremlinFoldedTraverse: """A Gremlin-specific Traverse block to be used only within @fold scopes.""" def from_traverse(cls, traverse_block): """Create a GremlinFoldedTraverse block as a copy of the given Traverse block.""" if isinstance(traverse_block, Traverse): return cls(tra...
the_stack_v2_python_sparse
graphql_compiler/compiler/ir_lowering_gremlin/ir_lowering.py
jb-kensho/graphql-compiler
train
0
062285f3854f1e3ad28a9a746c17eb49a2c678ad
[ "self.Tc = Tc\nself.Pc = Pc\nself.Vc = Vc\nself.Tb = Tb\nself.structureIndex = structureIndex", "string = 'CriticalPointGroupContribution(Tc={0!r}, Pc={1!r}, Vc={2!r}, Tb={3!r}, structureIndex={4!r}'.format(self.Tc, self.Pc, self.Vc, self.Tb, self.structureIndex)\nstring += ')'\nreturn string" ]
<|body_start_0|> self.Tc = Tc self.Pc = Pc self.Vc = Vc self.Tb = Tb self.structureIndex = structureIndex <|end_body_0|> <|body_start_1|> string = 'CriticalPointGroupContribution(Tc={0!r}, Pc={1!r}, Vc={2!r}, Tb={3!r}, structureIndex={4!r}'.format(self.Tc, self.Pc, self....
Joback group contribution to estimate critical properties
CriticalPointGroupContribution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CriticalPointGroupContribution: """Joback group contribution to estimate critical properties""" def __init__(self, Tc=None, Pc=None, Vc=None, Tb=None, structureIndex=None): """Note that argument names are retained for backward compatibility with loading database files.""" <|b...
stack_v2_sparse_classes_75kplus_train_008613
26,300
permissive
[ { "docstring": "Note that argument names are retained for backward compatibility with loading database files.", "name": "__init__", "signature": "def __init__(self, Tc=None, Pc=None, Vc=None, Tb=None, structureIndex=None)" }, { "docstring": "Return a string representation that can be used to rec...
2
stack_v2_sparse_classes_30k_train_006338
Implement the Python class `CriticalPointGroupContribution` described below. Class description: Joback group contribution to estimate critical properties Method signatures and docstrings: - def __init__(self, Tc=None, Pc=None, Vc=None, Tb=None, structureIndex=None): Note that argument names are retained for backward ...
Implement the Python class `CriticalPointGroupContribution` described below. Class description: Joback group contribution to estimate critical properties Method signatures and docstrings: - def __init__(self, Tc=None, Pc=None, Vc=None, Tb=None, structureIndex=None): Note that argument names are retained for backward ...
349a4af759cf8877197772cd7eaca1e51d46eff5
<|skeleton|> class CriticalPointGroupContribution: """Joback group contribution to estimate critical properties""" def __init__(self, Tc=None, Pc=None, Vc=None, Tb=None, structureIndex=None): """Note that argument names are retained for backward compatibility with loading database files.""" <|b...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CriticalPointGroupContribution: """Joback group contribution to estimate critical properties""" def __init__(self, Tc=None, Pc=None, Vc=None, Tb=None, structureIndex=None): """Note that argument names are retained for backward compatibility with loading database files.""" self.Tc = Tc ...
the_stack_v2_python_sparse
rmgpy/data/transport.py
CanePan-cc/CanePanWorkshop
train
2
091e613103660cf50e185f4b4a6f4785bc4c97e9
[ "credentials = Credentials.get()\nDataLayer.config['host'] = credentials.get_host()\nDataLayer.config['user'] = credentials.get_user()\nDataLayer.config['password'] = credentials.get_password()\nDataLayer.config['database'] = credentials.get_database()\nDataLayer.config['port'] = credentials.get_port()\nDataLayer.c...
<|body_start_0|> credentials = Credentials.get() DataLayer.config['host'] = credentials.get_host() DataLayer.config['user'] = credentials.get_user() DataLayer.config['password'] = credentials.get_password() DataLayer.config['database'] = credentials.get_database() DataLay...
A client for requesting the controller to load a host definition.
LoadHostClient
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoadHostClient: """A client for requesting the controller to load a host definition.""" def __init__(self): """Object constructor.""" <|body_0|> def main(self, filename): """The main function of load_schedule. :param str filename: The filename with the XML defini...
stack_v2_sparse_classes_75kplus_train_008614
1,688
permissive
[ { "docstring": "Object constructor.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "The main function of load_schedule. :param str filename: The filename with the XML definition of the host.", "name": "main", "signature": "def main(self, filename)" } ]
2
stack_v2_sparse_classes_30k_train_017670
Implement the Python class `LoadHostClient` described below. Class description: A client for requesting the controller to load a host definition. Method signatures and docstrings: - def __init__(self): Object constructor. - def main(self, filename): The main function of load_schedule. :param str filename: The filenam...
Implement the Python class `LoadHostClient` described below. Class description: A client for requesting the controller to load a host definition. Method signatures and docstrings: - def __init__(self): Object constructor. - def main(self, filename): The main function of load_schedule. :param str filename: The filenam...
ec0c33cdae4a0afeea37928743abd744ef291a9f
<|skeleton|> class LoadHostClient: """A client for requesting the controller to load a host definition.""" def __init__(self): """Object constructor.""" <|body_0|> def main(self, filename): """The main function of load_schedule. :param str filename: The filename with the XML defini...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LoadHostClient: """A client for requesting the controller to load a host definition.""" def __init__(self): """Object constructor.""" credentials = Credentials.get() DataLayer.config['host'] = credentials.get_host() DataLayer.config['user'] = credentials.get_user() ...
the_stack_v2_python_sparse
enarksh/controller/client/LoadHostClient.py
SetBased/py-enarksh
train
3
3ce67bf5af818140e696be7730024a2f84f9eb4e
[ "self.uid = 'global_association_id'\nself._attrs = {'ass_id': [], 'remove_id': [], 'combined_servers': []}\nsuper(AllAssociation, self).__init__(self.uid)", "if not server_name:\n raise TypeError('ERROR, NEED SERVER_NAME')\nfather_server_name = settings.get_father_server(server_name)\nif settings.is_combined(s...
<|body_start_0|> self.uid = 'global_association_id' self._attrs = {'ass_id': [], 'remove_id': [], 'combined_servers': []} super(AllAssociation, self).__init__(self.uid) <|end_body_0|> <|body_start_1|> if not server_name: raise TypeError('ERROR, NEED SERVER_NAME') fat...
工会全部id记录 @CHANGE LOG: assid里工会的id由纯数字改为servername-assid
AllAssociation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AllAssociation: """工会全部id记录 @CHANGE LOG: assid里工会的id由纯数字改为servername-assid""" def __init__(self, uid=None): """记录id""" <|body_0|> def get(cls, uid='', server_name=''): """重载父类get""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.uid = 'global...
stack_v2_sparse_classes_75kplus_train_008615
3,783
no_license
[ { "docstring": "记录id", "name": "__init__", "signature": "def __init__(self, uid=None)" }, { "docstring": "重载父类get", "name": "get", "signature": "def get(cls, uid='', server_name='')" } ]
2
stack_v2_sparse_classes_30k_train_003401
Implement the Python class `AllAssociation` described below. Class description: 工会全部id记录 @CHANGE LOG: assid里工会的id由纯数字改为servername-assid Method signatures and docstrings: - def __init__(self, uid=None): 记录id - def get(cls, uid='', server_name=''): 重载父类get
Implement the Python class `AllAssociation` described below. Class description: 工会全部id记录 @CHANGE LOG: assid里工会的id由纯数字改为servername-assid Method signatures and docstrings: - def __init__(self, uid=None): 记录id - def get(cls, uid='', server_name=''): 重载父类get <|skeleton|> class AllAssociation: """工会全部id记录 @CHANGE LOG...
fa1591863985a418fd361eb6dac36d1301bc1231
<|skeleton|> class AllAssociation: """工会全部id记录 @CHANGE LOG: assid里工会的id由纯数字改为servername-assid""" def __init__(self, uid=None): """记录id""" <|body_0|> def get(cls, uid='', server_name=''): """重载父类get""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AllAssociation: """工会全部id记录 @CHANGE LOG: assid里工会的id由纯数字改为servername-assid""" def __init__(self, uid=None): """记录id""" self.uid = 'global_association_id' self._attrs = {'ass_id': [], 'remove_id': [], 'combined_servers': []} super(AllAssociation, self).__init__(self.uid) ...
the_stack_v2_python_sparse
learn_backend/models/association.py
isoundy000/learn_python
train
0
395c52378cc690a36665040701ec1ef49a9cd547
[ "print('actores')\nprint('prtoagonista')\nprint('antagonista')\nprint('hora de transmicion')\nprint('canal')\nprint('capitulos')\nprint('extras')\nprint('genero')\nprint('clasificacion')\nprint('guion')", "print('disfrutar')\nprint('entretener')\nprint('aburrit')\nprint('relajar')\nprint('divertir')" ]
<|body_start_0|> print('actores') print('prtoagonista') print('antagonista') print('hora de transmicion') print('canal') print('capitulos') print('extras') print('genero') print('clasificacion') print('guion') <|end_body_0|> <|body_start_1...
serie_de_tv
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class serie_de_tv: def __init__(self): """Atributos""" <|body_0|> def metodo(self): """metodos""" <|body_1|> <|end_skeleton|> <|body_start_0|> print('actores') print('prtoagonista') print('antagonista') print('hora de transmicion')...
stack_v2_sparse_classes_75kplus_train_008616
556
no_license
[ { "docstring": "Atributos", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "metodos", "name": "metodo", "signature": "def metodo(self)" } ]
2
stack_v2_sparse_classes_30k_val_000091
Implement the Python class `serie_de_tv` described below. Class description: Implement the serie_de_tv class. Method signatures and docstrings: - def __init__(self): Atributos - def metodo(self): metodos
Implement the Python class `serie_de_tv` described below. Class description: Implement the serie_de_tv class. Method signatures and docstrings: - def __init__(self): Atributos - def metodo(self): metodos <|skeleton|> class serie_de_tv: def __init__(self): """Atributos""" <|body_0|> def meto...
9bc8a8dc5ae092e4a61acc92ece97eca11975acb
<|skeleton|> class serie_de_tv: def __init__(self): """Atributos""" <|body_0|> def metodo(self): """metodos""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class serie_de_tv: def __init__(self): """Atributos""" print('actores') print('prtoagonista') print('antagonista') print('hora de transmicion') print('canal') print('capitulos') print('extras') print('genero') print('clasificacion') ...
the_stack_v2_python_sparse
Semana_2/Programa_5.py
Kevin12-0/poo-1719110155
train
0
56b568f68e2cc7147d2dd90f481e11b8ffd74ddb
[ "dest_list = []\ndest_file = open('csv_files/Destinations.csv', 'r')\nreader = csv.DictReader(dest_file)\nfor row in reader:\n dest_id = row['dest_id']\n dest_country = row['country']\n dest_city = row['city']\n dest_airport = row['airport']\n dest_flight_time = row['flight_time']\n dest_distance ...
<|body_start_0|> dest_list = [] dest_file = open('csv_files/Destinations.csv', 'r') reader = csv.DictReader(dest_file) for row in reader: dest_id = row['dest_id'] dest_country = row['country'] dest_city = row['city'] dest_airport = row['air...
DestinationIO
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DestinationIO: def load_all_destinations(self): """Reads into the database. Returns a list of all destinations as instances""" <|body_0|> def store_new_destination(self, new_destination): """Stores new destination to the existing file""" <|body_1|> def s...
stack_v2_sparse_classes_75kplus_train_008617
2,033
no_license
[ { "docstring": "Reads into the database. Returns a list of all destinations as instances", "name": "load_all_destinations", "signature": "def load_all_destinations(self)" }, { "docstring": "Stores new destination to the existing file", "name": "store_new_destination", "signature": "def s...
4
stack_v2_sparse_classes_30k_train_019335
Implement the Python class `DestinationIO` described below. Class description: Implement the DestinationIO class. Method signatures and docstrings: - def load_all_destinations(self): Reads into the database. Returns a list of all destinations as instances - def store_new_destination(self, new_destination): Stores new...
Implement the Python class `DestinationIO` described below. Class description: Implement the DestinationIO class. Method signatures and docstrings: - def load_all_destinations(self): Reads into the database. Returns a list of all destinations as instances - def store_new_destination(self, new_destination): Stores new...
5dbce2a3d1cdc8a0614252fb77685211b395c2df
<|skeleton|> class DestinationIO: def load_all_destinations(self): """Reads into the database. Returns a list of all destinations as instances""" <|body_0|> def store_new_destination(self, new_destination): """Stores new destination to the existing file""" <|body_1|> def s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DestinationIO: def load_all_destinations(self): """Reads into the database. Returns a list of all destinations as instances""" dest_list = [] dest_file = open('csv_files/Destinations.csv', 'r') reader = csv.DictReader(dest_file) for row in reader: dest_id = ...
the_stack_v2_python_sparse
DataLayer/DestinationIO.py
svana00/VLN1-NaN-Air
train
0
c5effd7aad9e33598eff7a4e2c8e47736781c1d6
[ "reporting_entities = filter(self.is_entity_reporting, file.values())\nfiltered = filter(self.is_entity_canonical, reporting_entities) if exclude_noncanonical else reporting_entities\nreturn [entity.cloud_device_id for entity in filtered]", "virtual_entities = filter(self.is_entity_virtual, file.values())\nfilter...
<|body_start_0|> reporting_entities = filter(self.is_entity_reporting, file.values()) filtered = filter(self.is_entity_canonical, reporting_entities) if exclude_noncanonical else reporting_entities return [entity.cloud_device_id for entity in filtered] <|end_body_0|> <|body_start_1|> vi...
Quantifies whether the correct entities were included in the proposed file.
EntityIdentification
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EntityIdentification: """Quantifies whether the correct entities were included in the proposed file.""" def _list_ids_reporting(self, *, file: DeserializedFile, exclude_noncanonical: bool) -> List[CloudDeviceId]: """Generates list of `cloud_device_id`s representing reporting entities...
stack_v2_sparse_classes_75kplus_train_008618
3,656
permissive
[ { "docstring": "Generates list of `cloud_device_id`s representing reporting entities.", "name": "_list_ids_reporting", "signature": "def _list_ids_reporting(self, *, file: DeserializedFile, exclude_noncanonical: bool) -> List[CloudDeviceId]" }, { "docstring": "Generates list of `cloud_device_id`...
3
stack_v2_sparse_classes_30k_train_013533
Implement the Python class `EntityIdentification` described below. Class description: Quantifies whether the correct entities were included in the proposed file. Method signatures and docstrings: - def _list_ids_reporting(self, *, file: DeserializedFile, exclude_noncanonical: bool) -> List[CloudDeviceId]: Generates l...
Implement the Python class `EntityIdentification` described below. Class description: Quantifies whether the correct entities were included in the proposed file. Method signatures and docstrings: - def _list_ids_reporting(self, *, file: DeserializedFile, exclude_noncanonical: bool) -> List[CloudDeviceId]: Generates l...
0ffe5b61769143826142da4bada3c712b1fd0222
<|skeleton|> class EntityIdentification: """Quantifies whether the correct entities were included in the proposed file.""" def _list_ids_reporting(self, *, file: DeserializedFile, exclude_noncanonical: bool) -> List[CloudDeviceId]: """Generates list of `cloud_device_id`s representing reporting entities...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EntityIdentification: """Quantifies whether the correct entities were included in the proposed file.""" def _list_ids_reporting(self, *, file: DeserializedFile, exclude_noncanonical: bool) -> List[CloudDeviceId]: """Generates list of `cloud_device_id`s representing reporting entities.""" ...
the_stack_v2_python_sparse
tools/scoring/score/dimensions/entity_identification.py
google/digitalbuildings
train
319
228918554449272c924e9a6dc7166e6b20f876d8
[ "self.input_dim = input_dim\nself.sequence_length = sequence_length\nself.data_type = data_type\nself.last_avg = last_avg\nself.classes_list = classes_list\nself.model = KNNC(num_neighbors, weights=weights, metric=metric)\nself.data_dir = data_dir\nself.classes_dict = {}\nfor i, c in enumerate(classes_list):\n s...
<|body_start_0|> self.input_dim = input_dim self.sequence_length = sequence_length self.data_type = data_type self.last_avg = last_avg self.classes_list = classes_list self.model = KNNC(num_neighbors, weights=weights, metric=metric) self.data_dir = data_dir ...
KNN
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KNN: def __init__(self, input_dim: int=62, last_avg: int=3, data_dir: str='../data_train', sequence_length: int=45, data_type: DataType=DataType.HIGH_PASS, classes_list: list=['acetone', 'isopropanol', 'orange_juice', 'pinot_noir', 'raisin', 'wodka'], weights: str='distance', metric: str='euclid...
stack_v2_sparse_classes_75kplus_train_008619
4,079
permissive
[ { "docstring": "Class for a classifier based on k-nearest-neighbor approach defining training and prediction function. The saturated sensor values of the same class are assumed to have a small distance, whereas the distance between data points of different classes should be large. During inference the classes o...
3
stack_v2_sparse_classes_30k_train_025561
Implement the Python class `KNN` described below. Class description: Implement the KNN class. Method signatures and docstrings: - def __init__(self, input_dim: int=62, last_avg: int=3, data_dir: str='../data_train', sequence_length: int=45, data_type: DataType=DataType.HIGH_PASS, classes_list: list=['acetone', 'isopr...
Implement the Python class `KNN` described below. Class description: Implement the KNN class. Method signatures and docstrings: - def __init__(self, input_dim: int=62, last_avg: int=3, data_dir: str='../data_train', sequence_length: int=45, data_type: DataType=DataType.HIGH_PASS, classes_list: list=['acetone', 'isopr...
fdf2d58b96464db2d639baeebf9cd4b2e08306dd
<|skeleton|> class KNN: def __init__(self, input_dim: int=62, last_avg: int=3, data_dir: str='../data_train', sequence_length: int=45, data_type: DataType=DataType.HIGH_PASS, classes_list: list=['acetone', 'isopropanol', 'orange_juice', 'pinot_noir', 'raisin', 'wodka'], weights: str='distance', metric: str='euclid...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class KNN: def __init__(self, input_dim: int=62, last_avg: int=3, data_dir: str='../data_train', sequence_length: int=45, data_type: DataType=DataType.HIGH_PASS, classes_list: list=['acetone', 'isopropanol', 'orange_juice', 'pinot_noir', 'raisin', 'wodka'], weights: str='distance', metric: str='euclidean', num_neig...
the_stack_v2_python_sparse
classification/knn.py
Roboy/roboy_smells
train
0
348ad1bfbf42d03f884ebacec344b8dfa1293a8d
[ "N = len(arr)\nif x < arr[0]:\n return arr[:k]\nelif x > arr[-1]:\n return arr[N - k:]\nelse:\n index = bisect.bisect_left(arr, x)\n low = max(0, index - k - 1)\n high = min(N - 1, index + k - 1)\n while high - low > k - 1:\n if low < 0 or x - arr[low] <= arr[high] - x:\n high -=...
<|body_start_0|> N = len(arr) if x < arr[0]: return arr[:k] elif x > arr[-1]: return arr[N - k:] else: index = bisect.bisect_left(arr, x) low = max(0, index - k - 1) high = min(N - 1, index + k - 1) while high - low ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findClosestElements(self, arr, k, x): """:type arr: List[int] :type k: int :type x: int :rtype: List[int]""" <|body_0|> def findClosestElements_sort(self, arr, k, x): """:type arr: List[int] :type k: int :type x: int :rtype: List[int]""" <|body_...
stack_v2_sparse_classes_75kplus_train_008620
1,244
no_license
[ { "docstring": ":type arr: List[int] :type k: int :type x: int :rtype: List[int]", "name": "findClosestElements", "signature": "def findClosestElements(self, arr, k, x)" }, { "docstring": ":type arr: List[int] :type k: int :type x: int :rtype: List[int]", "name": "findClosestElements_sort", ...
2
stack_v2_sparse_classes_30k_train_005532
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findClosestElements(self, arr, k, x): :type arr: List[int] :type k: int :type x: int :rtype: List[int] - def findClosestElements_sort(self, arr, k, x): :type arr: List[int] :...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findClosestElements(self, arr, k, x): :type arr: List[int] :type k: int :type x: int :rtype: List[int] - def findClosestElements_sort(self, arr, k, x): :type arr: List[int] :...
1a3c1f4d6e9d3444039f087763b93241f4ba7892
<|skeleton|> class Solution: def findClosestElements(self, arr, k, x): """:type arr: List[int] :type k: int :type x: int :rtype: List[int]""" <|body_0|> def findClosestElements_sort(self, arr, k, x): """:type arr: List[int] :type k: int :type x: int :rtype: List[int]""" <|body_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def findClosestElements(self, arr, k, x): """:type arr: List[int] :type k: int :type x: int :rtype: List[int]""" N = len(arr) if x < arr[0]: return arr[:k] elif x > arr[-1]: return arr[N - k:] else: index = bisect.bisect_lef...
the_stack_v2_python_sparse
Algorithm/658_Find_K_Closest_Elements.py
Gi1ia/TechNoteBook
train
7
eee63d2f4aba5b57e557cab0ffb52af98669bc6a
[ "if len(s) != len(t):\n return False\ncache = {}\nresult = [0] * len(s)\ncounter = 0\nfor i in range(len(s)):\n if s[i] not in cache:\n cache[s[i]] = counter\n counter += 1\n result[i] = cache[s[i]]\ncache = {}\ncounter = 0\nfor j in range(len(t)):\n if t[j] not in cache:\n cache[t[...
<|body_start_0|> if len(s) != len(t): return False cache = {} result = [0] * len(s) counter = 0 for i in range(len(s)): if s[i] not in cache: cache[s[i]] = counter counter += 1 result[i] = cache[s[i]] cac...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isIsomorphic(self, s, t): """:type s: str :type t: str :rtype: bool""" <|body_0|> def isIsomorphic(self, s, t): """:type s: str :type t: str :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(s) != len(t): ...
stack_v2_sparse_classes_75kplus_train_008621
1,393
no_license
[ { "docstring": ":type s: str :type t: str :rtype: bool", "name": "isIsomorphic", "signature": "def isIsomorphic(self, s, t)" }, { "docstring": ":type s: str :type t: str :rtype: bool", "name": "isIsomorphic", "signature": "def isIsomorphic(self, s, t)" } ]
2
stack_v2_sparse_classes_30k_train_003115
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isIsomorphic(self, s, t): :type s: str :type t: str :rtype: bool - def isIsomorphic(self, s, t): :type s: str :type t: str :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isIsomorphic(self, s, t): :type s: str :type t: str :rtype: bool - def isIsomorphic(self, s, t): :type s: str :type t: str :rtype: bool <|skeleton|> class Solution: def...
d75876ae96bcd85c67bbfbf91bbc0f0bc773e97c
<|skeleton|> class Solution: def isIsomorphic(self, s, t): """:type s: str :type t: str :rtype: bool""" <|body_0|> def isIsomorphic(self, s, t): """:type s: str :type t: str :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def isIsomorphic(self, s, t): """:type s: str :type t: str :rtype: bool""" if len(s) != len(t): return False cache = {} result = [0] * len(s) counter = 0 for i in range(len(s)): if s[i] not in cache: cache[s[i]] ...
the_stack_v2_python_sparse
205. Isomorphic Strings.py
samir-0711/Leetcode-Python
train
0
da3495e4511ff43619efc5130b60186c3361bfc2
[ "coins = sorted(coins, reverse=True)\nl = len(coins)\nif amount == 0:\n return 0\nif l == 0 or amount < coins[-1]:\n return -1\nlst = [float('inf')]\n\ndef func(coins, a, count):\n print(lst, coins, a, count)\n if a == 0:\n lst.append(count)\n return\n if count >= lst[-1] - 1 or coins =...
<|body_start_0|> coins = sorted(coins, reverse=True) l = len(coins) if amount == 0: return 0 if l == 0 or amount < coins[-1]: return -1 lst = [float('inf')] def func(coins, a, count): print(lst, coins, a, count) if a == 0: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def coinChange(self, coins, amount): """:type coins: List[int] :type amount: int :rtype: int""" <|body_0|> def coinChange2(self, coins, amount): """:type coins: List[int] :type amount: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|...
stack_v2_sparse_classes_75kplus_train_008622
1,621
no_license
[ { "docstring": ":type coins: List[int] :type amount: int :rtype: int", "name": "coinChange", "signature": "def coinChange(self, coins, amount)" }, { "docstring": ":type coins: List[int] :type amount: int :rtype: int", "name": "coinChange2", "signature": "def coinChange2(self, coins, amou...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def coinChange(self, coins, amount): :type coins: List[int] :type amount: int :rtype: int - def coinChange2(self, coins, amount): :type coins: List[int] :type amount: int :rtype:...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def coinChange(self, coins, amount): :type coins: List[int] :type amount: int :rtype: int - def coinChange2(self, coins, amount): :type coins: List[int] :type amount: int :rtype:...
93cbb01487a61e37159e8bdd4bf40f623e131c19
<|skeleton|> class Solution: def coinChange(self, coins, amount): """:type coins: List[int] :type amount: int :rtype: int""" <|body_0|> def coinChange2(self, coins, amount): """:type coins: List[int] :type amount: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def coinChange(self, coins, amount): """:type coins: List[int] :type amount: int :rtype: int""" coins = sorted(coins, reverse=True) l = len(coins) if amount == 0: return 0 if l == 0 or amount < coins[-1]: return -1 lst = [float(...
the_stack_v2_python_sparse
Leetcode_medium/dynamicprogramming/322.py
HenryBalthier/Python-Learning
train
0
359cb1353c7bcea23d949da95d8c275fb33d0932
[ "super(Decoder, self).__init__()\nself.attention = Attention(hidden_size=hidden_size, alignment_mechanism=alignment)\nself.lstm = nn.LSTM(input_size=input_size, hidden_size=hidden_size, num_layers=nr_layers)\nself.concat_layer = nn.Linear(input_size * 2, input_size)", "output = []\ncontext_vectors = []\napplied_a...
<|body_start_0|> super(Decoder, self).__init__() self.attention = Attention(hidden_size=hidden_size, alignment_mechanism=alignment) self.lstm = nn.LSTM(input_size=input_size, hidden_size=hidden_size, num_layers=nr_layers) self.concat_layer = nn.Linear(input_size * 2, input_size) <|end_bo...
decoder (LSTM), decodes input sequence
Decoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Decoder: """decoder (LSTM), decodes input sequence""" def __init__(self, input_size, hidden_size, nr_layers, alignment): """:param input_size: size of input features :param hidden_size: size hidden features :param nr_layers: number of stacking layers :param alignment: defines which a...
stack_v2_sparse_classes_75kplus_train_008623
12,832
no_license
[ { "docstring": ":param input_size: size of input features :param hidden_size: size hidden features :param nr_layers: number of stacking layers :param alignment: defines which alignment method is used", "name": "__init__", "signature": "def __init__(self, input_size, hidden_size, nr_layers, alignment)" ...
2
stack_v2_sparse_classes_30k_train_022907
Implement the Python class `Decoder` described below. Class description: decoder (LSTM), decodes input sequence Method signatures and docstrings: - def __init__(self, input_size, hidden_size, nr_layers, alignment): :param input_size: size of input features :param hidden_size: size hidden features :param nr_layers: nu...
Implement the Python class `Decoder` described below. Class description: decoder (LSTM), decodes input sequence Method signatures and docstrings: - def __init__(self, input_size, hidden_size, nr_layers, alignment): :param input_size: size of input features :param hidden_size: size hidden features :param nr_layers: nu...
375633b9dc34302fa1d806a7ee69c86f97f1054d
<|skeleton|> class Decoder: """decoder (LSTM), decodes input sequence""" def __init__(self, input_size, hidden_size, nr_layers, alignment): """:param input_size: size of input features :param hidden_size: size hidden features :param nr_layers: number of stacking layers :param alignment: defines which a...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Decoder: """decoder (LSTM), decodes input sequence""" def __init__(self, input_size, hidden_size, nr_layers, alignment): """:param input_size: size of input features :param hidden_size: size hidden features :param nr_layers: number of stacking layers :param alignment: defines which alignment meth...
the_stack_v2_python_sparse
models/models_old.py
kessi1990/masterthesis
train
1
ac038f84fc0c3602d0031af1a93a7e2c1f9cfd54
[ "sql = ' '.join(['SELECT id, name FROM category WHERE', placeholder_update(['id'])])\nvalues = [id]\ncur = self.get_cursor()\nrow = cur.execute(sql, values).fetchone() or []\nreturn row", "sql = 'SELECT id, name FROM category'\ncur = self.get_cursor()\nrow = cur.execute(sql).fetchall() or []\nreturn row" ]
<|body_start_0|> sql = ' '.join(['SELECT id, name FROM category WHERE', placeholder_update(['id'])]) values = [id] cur = self.get_cursor() row = cur.execute(sql, values).fetchone() or [] return row <|end_body_0|> <|body_start_1|> sql = 'SELECT id, name FROM category' ...
>>> row = read().one(id: int) -> sqlite3.Row >>> print(row['id'], row['name']) Returns a sqlite3.Row passing an integer ID >>> rows = read().all() -> list >>> for row in rows: >>> print(row['id'], row['name']) Returns a list of sqlite3.Rows else and empty list Methods: - one - all
read
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class read: """>>> row = read().one(id: int) -> sqlite3.Row >>> print(row['id'], row['name']) Returns a sqlite3.Row passing an integer ID >>> rows = read().all() -> list >>> for row in rows: >>> print(row['id'], row['name']) Returns a list of sqlite3.Rows else and empty list Methods: - one - all""" ...
stack_v2_sparse_classes_75kplus_train_008624
3,058
no_license
[ { "docstring": ">>> row = read().one(id: int) -> sqlite3.Row >>> print(row['id'], row['name']) Returns a sqlite3.Row passing an integer ID", "name": "one", "signature": "def one(self, id: int)" }, { "docstring": ">>> rows = read().all() -> list >>> for row in rows: >>> print(row['id'], row['name...
2
null
Implement the Python class `read` described below. Class description: >>> row = read().one(id: int) -> sqlite3.Row >>> print(row['id'], row['name']) Returns a sqlite3.Row passing an integer ID >>> rows = read().all() -> list >>> for row in rows: >>> print(row['id'], row['name']) Returns a list of sqlite3.Rows else and...
Implement the Python class `read` described below. Class description: >>> row = read().one(id: int) -> sqlite3.Row >>> print(row['id'], row['name']) Returns a sqlite3.Row passing an integer ID >>> rows = read().all() -> list >>> for row in rows: >>> print(row['id'], row['name']) Returns a list of sqlite3.Rows else and...
b4ee681837add64b039afda3dfc286995199288a
<|skeleton|> class read: """>>> row = read().one(id: int) -> sqlite3.Row >>> print(row['id'], row['name']) Returns a sqlite3.Row passing an integer ID >>> rows = read().all() -> list >>> for row in rows: >>> print(row['id'], row['name']) Returns a list of sqlite3.Rows else and empty list Methods: - one - all""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class read: """>>> row = read().one(id: int) -> sqlite3.Row >>> print(row['id'], row['name']) Returns a sqlite3.Row passing an integer ID >>> rows = read().all() -> list >>> for row in rows: >>> print(row['id'], row['name']) Returns a list of sqlite3.Rows else and empty list Methods: - one - all""" def one(sel...
the_stack_v2_python_sparse
src/models/category.py
Otumian-empire/py-quiz
train
0
a4cb066a6f50340b2d4a171e26743012817b3a1a
[ "self.mainframe = parent\nwx.Frame.__init__(self, parent, title=title, size=(400, 250))\nself.panel = wx.Panel(self, pos=(0, 0), size=(400, 250))\nself.panel.SetBackgroundColour('#FFFFFF')\nbookName_tip = wx.StaticText(self.panel, label='书名:', pos=(5, 8), size=(35, 25))\nbookName_tip.SetBackgroundColour('#FFFFFF')\...
<|body_start_0|> self.mainframe = parent wx.Frame.__init__(self, parent, title=title, size=(400, 250)) self.panel = wx.Panel(self, pos=(0, 0), size=(400, 250)) self.panel.SetBackgroundColour('#FFFFFF') bookName_tip = wx.StaticText(self.panel, label='书名:', pos=(5, 8), size=(35, 25...
用来显示书籍的信息
ShowFrame
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShowFrame: """用来显示书籍的信息""" def __init__(self, parent, title, select_id): """初始化该小窗口的布局""" <|body_0|> def showAllText(self): """显示概述本原始信息""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.mainframe = parent wx.Frame.__init__(self, pare...
stack_v2_sparse_classes_75kplus_train_008625
13,549
no_license
[ { "docstring": "初始化该小窗口的布局", "name": "__init__", "signature": "def __init__(self, parent, title, select_id)" }, { "docstring": "显示概述本原始信息", "name": "showAllText", "signature": "def showAllText(self)" } ]
2
stack_v2_sparse_classes_30k_train_003050
Implement the Python class `ShowFrame` described below. Class description: 用来显示书籍的信息 Method signatures and docstrings: - def __init__(self, parent, title, select_id): 初始化该小窗口的布局 - def showAllText(self): 显示概述本原始信息
Implement the Python class `ShowFrame` described below. Class description: 用来显示书籍的信息 Method signatures and docstrings: - def __init__(self, parent, title, select_id): 初始化该小窗口的布局 - def showAllText(self): 显示概述本原始信息 <|skeleton|> class ShowFrame: """用来显示书籍的信息""" def __init__(self, parent, title, select_id): ...
e19c56fb353e9bc961a568da41dedba6ae6aa05f
<|skeleton|> class ShowFrame: """用来显示书籍的信息""" def __init__(self, parent, title, select_id): """初始化该小窗口的布局""" <|body_0|> def showAllText(self): """显示概述本原始信息""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ShowFrame: """用来显示书籍的信息""" def __init__(self, parent, title, select_id): """初始化该小窗口的布局""" self.mainframe = parent wx.Frame.__init__(self, parent, title=title, size=(400, 250)) self.panel = wx.Panel(self, pos=(0, 0), size=(400, 250)) self.panel.SetBackgroundColour('...
the_stack_v2_python_sparse
SXB/venv/Tkinter-master/t3.py
sh2268411762/Python_Three
train
1
74b26613aa5e69863760bfda100f0ba2940b51c4
[ "super().__init__(**kwargs)\nself.LayerNorm = tf.keras.layers.LayerNormalization(epsilon=config.layer_norm_eps, name='LayerNorm')\nself.dropout = tf.keras.layers.Dropout(config.hidden_dropout_prob)", "hidden_states, input_tensor = inputs\nhidden_states = self.dropout(hidden_states, training=training)\nhidden_stat...
<|body_start_0|> super().__init__(**kwargs) self.LayerNorm = tf.keras.layers.LayerNormalization(epsilon=config.layer_norm_eps, name='LayerNorm') self.dropout = tf.keras.layers.Dropout(config.hidden_dropout_prob) <|end_body_0|> <|body_start_1|> hidden_states, input_tensor = inputs ...
Output module.
TFFastSpeechOutput
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TFFastSpeechOutput: """Output module.""" def __init__(self, config, **kwargs): """Init variables.""" <|body_0|> def call(self, inputs, training=False): """Call logic.""" <|body_1|> <|end_skeleton|> <|body_start_0|> super().__init__(**kwargs) ...
stack_v2_sparse_classes_75kplus_train_008626
17,606
permissive
[ { "docstring": "Init variables.", "name": "__init__", "signature": "def __init__(self, config, **kwargs)" }, { "docstring": "Call logic.", "name": "call", "signature": "def call(self, inputs, training=False)" } ]
2
stack_v2_sparse_classes_30k_train_031322
Implement the Python class `TFFastSpeechOutput` described below. Class description: Output module. Method signatures and docstrings: - def __init__(self, config, **kwargs): Init variables. - def call(self, inputs, training=False): Call logic.
Implement the Python class `TFFastSpeechOutput` described below. Class description: Output module. Method signatures and docstrings: - def __init__(self, config, **kwargs): Init variables. - def call(self, inputs, training=False): Call logic. <|skeleton|> class TFFastSpeechOutput: """Output module.""" def _...
4343c409340c608a426cc6f0926fbe2c1661783e
<|skeleton|> class TFFastSpeechOutput: """Output module.""" def __init__(self, config, **kwargs): """Init variables.""" <|body_0|> def call(self, inputs, training=False): """Call logic.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TFFastSpeechOutput: """Output module.""" def __init__(self, config, **kwargs): """Init variables.""" super().__init__(**kwargs) self.LayerNorm = tf.keras.layers.LayerNormalization(epsilon=config.layer_norm_eps, name='LayerNorm') self.dropout = tf.keras.layers.Dropout(confi...
the_stack_v2_python_sparse
malaya_speech/train/model/fastspeech/model_aligner.py
Ariffleng/malaya-speech
train
0
fd94796047c557b42d455180121d18b4c96ee72f
[ "from scoop.content.models import Attachment\nuuid = self.value\nlink = Attachment.objects.get_link_by_uuid(uuid)\nreturn {'link': link}", "base = super(AttachmentInline, self).get_template_name()[0]\npath = 'content/{}'.format(base)\nreturn path" ]
<|body_start_0|> from scoop.content.models import Attachment uuid = self.value link = Attachment.objects.get_link_by_uuid(uuid) return {'link': link} <|end_body_0|> <|body_start_1|> base = super(AttachmentInline, self).get_template_name()[0] path = 'content/{}'.format(ba...
Inline d'insertion de pièces jointes Format : {{attachment uuid}}
AttachmentInline
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AttachmentInline: """Inline d'insertion de pièces jointes Format : {{attachment uuid}}""" def get_context(self): """Renvoyer le contexte de rendu de l'inline""" <|body_0|> def get_template_name(self): """Renvoyer le chemin du template""" <|body_1|> <|end...
stack_v2_sparse_classes_75kplus_train_008627
6,816
no_license
[ { "docstring": "Renvoyer le contexte de rendu de l'inline", "name": "get_context", "signature": "def get_context(self)" }, { "docstring": "Renvoyer le chemin du template", "name": "get_template_name", "signature": "def get_template_name(self)" } ]
2
stack_v2_sparse_classes_30k_train_006925
Implement the Python class `AttachmentInline` described below. Class description: Inline d'insertion de pièces jointes Format : {{attachment uuid}} Method signatures and docstrings: - def get_context(self): Renvoyer le contexte de rendu de l'inline - def get_template_name(self): Renvoyer le chemin du template
Implement the Python class `AttachmentInline` described below. Class description: Inline d'insertion de pièces jointes Format : {{attachment uuid}} Method signatures and docstrings: - def get_context(self): Renvoyer le contexte de rendu de l'inline - def get_template_name(self): Renvoyer le chemin du template <|skel...
8cef6f6e89c1990e2b25f83e54e0c3481d83b6d7
<|skeleton|> class AttachmentInline: """Inline d'insertion de pièces jointes Format : {{attachment uuid}}""" def get_context(self): """Renvoyer le contexte de rendu de l'inline""" <|body_0|> def get_template_name(self): """Renvoyer le chemin du template""" <|body_1|> <|end...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AttachmentInline: """Inline d'insertion de pièces jointes Format : {{attachment uuid}}""" def get_context(self): """Renvoyer le contexte de rendu de l'inline""" from scoop.content.models import Attachment uuid = self.value link = Attachment.objects.get_link_by_uuid(uuid) ...
the_stack_v2_python_sparse
scoop/content/util/inlines.py
artscoop/scoop
train
0
0c8b2001ba30966217b9835fbb308c0d7148523e
[ "if not isinstance(data, bytes):\n raise TypeError('Data needs to be bytes.')\ntry:\n data_dict = json.loads(data.decode('utf-8'))\nexcept ValueError as exc:\n raise TypeError('Unable to parse the byte string.') from exc\nif not 'username' in data_dict:\n raise TypeError('Username is not set.')\nif not ...
<|body_start_0|> if not isinstance(data, bytes): raise TypeError('Data needs to be bytes.') try: data_dict = json.loads(data.decode('utf-8')) except ValueError as exc: raise TypeError('Unable to parse the byte string.') from exc if not 'username' in da...
Username and password credentials for Timesketch authentication.
TimesketchPwdCredentials
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TimesketchPwdCredentials: """Username and password credentials for Timesketch authentication.""" def from_bytes(self, data): """Deserialize a credential object from bytes. Args: data (bytes): serialized credential object. Raises: TypeError: if the data is not in bytes.""" <|b...
stack_v2_sparse_classes_75kplus_train_008628
5,273
permissive
[ { "docstring": "Deserialize a credential object from bytes. Args: data (bytes): serialized credential object. Raises: TypeError: if the data is not in bytes.", "name": "from_bytes", "signature": "def from_bytes(self, data)" }, { "docstring": "Convert the credential object into bytes for storage....
2
stack_v2_sparse_classes_30k_train_041836
Implement the Python class `TimesketchPwdCredentials` described below. Class description: Username and password credentials for Timesketch authentication. Method signatures and docstrings: - def from_bytes(self, data): Deserialize a credential object from bytes. Args: data (bytes): serialized credential object. Raise...
Implement the Python class `TimesketchPwdCredentials` described below. Class description: Username and password credentials for Timesketch authentication. Method signatures and docstrings: - def from_bytes(self, data): Deserialize a credential object from bytes. Args: data (bytes): serialized credential object. Raise...
24f471b58ca4a87cb053961b5f05c07a544ca7b8
<|skeleton|> class TimesketchPwdCredentials: """Username and password credentials for Timesketch authentication.""" def from_bytes(self, data): """Deserialize a credential object from bytes. Args: data (bytes): serialized credential object. Raises: TypeError: if the data is not in bytes.""" <|b...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TimesketchPwdCredentials: """Username and password credentials for Timesketch authentication.""" def from_bytes(self, data): """Deserialize a credential object from bytes. Args: data (bytes): serialized credential object. Raises: TypeError: if the data is not in bytes.""" if not isinstanc...
the_stack_v2_python_sparse
api_client/python/timesketch_api_client/credentials.py
google/timesketch
train
2,263
b8d15571b2a366cf6cb95f441173bcee22660a40
[ "self.access_token = access_token\nself.base_url = base_url\nself._errors = {}", "prepared_request = self._prepare_request(request)\nctx = ssl.create_default_context()\ntry:\n response = urllib2.urlopen(prepared_request, context=ctx)\n result = response.read()\n return json.loads(result.decode())\nexcept...
<|body_start_0|> self.access_token = access_token self.base_url = base_url self._errors = {} <|end_body_0|> <|body_start_1|> prepared_request = self._prepare_request(request) ctx = ssl.create_default_context() try: response = urllib2.urlopen(prepared_request,...
Base API service connection class.
BaseConnection
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseConnection: """Base API service connection class.""" def __init__(self, access_token, base_url): """Constructs new BaseConnection object.""" <|body_0|> def send_request(self, request): """Sends http request to the endpoint. Args: request: http.Request object ...
stack_v2_sparse_classes_75kplus_train_008629
4,006
permissive
[ { "docstring": "Constructs new BaseConnection object.", "name": "__init__", "signature": "def __init__(self, access_token, base_url)" }, { "docstring": "Sends http request to the endpoint. Args: request: http.Request object containing sending request data. Returns: Deserialized python object fro...
3
stack_v2_sparse_classes_30k_val_002167
Implement the Python class `BaseConnection` described below. Class description: Base API service connection class. Method signatures and docstrings: - def __init__(self, access_token, base_url): Constructs new BaseConnection object. - def send_request(self, request): Sends http request to the endpoint. Args: request:...
Implement the Python class `BaseConnection` described below. Class description: Base API service connection class. Method signatures and docstrings: - def __init__(self, access_token, base_url): Constructs new BaseConnection object. - def send_request(self, request): Sends http request to the endpoint. Args: request:...
141a62102f520e0081b6a28022e33e26255c5e6f
<|skeleton|> class BaseConnection: """Base API service connection class.""" def __init__(self, access_token, base_url): """Constructs new BaseConnection object.""" <|body_0|> def send_request(self, request): """Sends http request to the endpoint. Args: request: http.Request object ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BaseConnection: """Base API service connection class.""" def __init__(self, access_token, base_url): """Constructs new BaseConnection object.""" self.access_token = access_token self.base_url = base_url self._errors = {} def send_request(self, request): """Sen...
the_stack_v2_python_sparse
virgil_sdk/client/http/base_connection.py
akasranjan005/virgil-sdk-python
train
0
e7936574823b3a54b6fb376de1f70baad89dd8b1
[ "self.identifiers = None\nself._real_scalers = None\nself._cat_scalers = None\nself._target_scaler = None\nself._num_classes_per_cat_input = None\nself._time_steps = get_fixed_params()['total_time_steps']\nself._num_encoder_steps = get_fixed_params()['num_encoder_steps']", "print_info('Formatting train-valid-test...
<|body_start_0|> self.identifiers = None self._real_scalers = None self._cat_scalers = None self._target_scaler = None self._num_classes_per_cat_input = None self._time_steps = get_fixed_params()['total_time_steps'] self._num_encoder_steps = get_fixed_params()['nu...
Defines and formats data for the electricity dataset. Note that per-entity z-score normalization is used here, and is implemented across functions. Attributes: column_definition: Defines input and data type of column used in the experiment. identifiers: Entity identifiers used in experiments.
ElectricityFormatter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ElectricityFormatter: """Defines and formats data for the electricity dataset. Note that per-entity z-score normalization is used here, and is implemented across functions. Attributes: column_definition: Defines input and data type of column used in the experiment. identifiers: Entity identifiers...
stack_v2_sparse_classes_75kplus_train_008630
16,393
permissive
[ { "docstring": "Initialises formatter.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Splits data frame into training-validation-test data frames. This also calibrates scaling object, and transforms data for each split. Args: df: Source data frame to split. valid_boun...
5
stack_v2_sparse_classes_30k_train_053297
Implement the Python class `ElectricityFormatter` described below. Class description: Defines and formats data for the electricity dataset. Note that per-entity z-score normalization is used here, and is implemented across functions. Attributes: column_definition: Defines input and data type of column used in the expe...
Implement the Python class `ElectricityFormatter` described below. Class description: Defines and formats data for the electricity dataset. Note that per-entity z-score normalization is used here, and is implemented across functions. Attributes: column_definition: Defines input and data type of column used in the expe...
7929adbe91e9cfe8dc5dc1daad5ae7392f9719a0
<|skeleton|> class ElectricityFormatter: """Defines and formats data for the electricity dataset. Note that per-entity z-score normalization is used here, and is implemented across functions. Attributes: column_definition: Defines input and data type of column used in the experiment. identifiers: Entity identifiers...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ElectricityFormatter: """Defines and formats data for the electricity dataset. Note that per-entity z-score normalization is used here, and is implemented across functions. Attributes: column_definition: Defines input and data type of column used in the experiment. identifiers: Entity identifiers used in expe...
the_stack_v2_python_sparse
tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/electricity_time_series_forecasting.py
openvinotoolkit/open_model_zoo
train
1,712
66fad14b9139ec7dee691d2d33b5e043a7a091c3
[ "self.name = str(name)\nself.frames = {}\nself.frame_names = []\nself.analyses = {}", "df_name = dataframe.name\nused_names = self.frames.keys()\nif not replace and df_name in used_names:\n while df_name in used_names:\n df_name = df_name + '_' + ''.join([random.choice(string.ascii_uppercase) for i in r...
<|body_start_0|> self.name = str(name) self.frames = {} self.frame_names = [] self.analyses = {} <|end_body_0|> <|body_start_1|> df_name = dataframe.name used_names = self.frames.keys() if not replace and df_name in used_names: while df_name in used_n...
! A multidata frame is a container of one or more data frames. This allows for processing across more than one data frames.
MultiDataframe
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiDataframe: """! A multidata frame is a container of one or more data frames. This allows for processing across more than one data frames.""" def __init__(self, name=''): """! Constructor. Initialize multidata frame with a name. @param name string: Name of this data frame. Defaul...
stack_v2_sparse_classes_75kplus_train_008631
37,474
no_license
[ { "docstring": "! Constructor. Initialize multidata frame with a name. @param name string: Name of this data frame. Default is empty name.", "name": "__init__", "signature": "def __init__(self, name='')" }, { "docstring": "! Method to add a data frame. It is highly encouraged that all data frame...
2
stack_v2_sparse_classes_30k_train_017724
Implement the Python class `MultiDataframe` described below. Class description: ! A multidata frame is a container of one or more data frames. This allows for processing across more than one data frames. Method signatures and docstrings: - def __init__(self, name=''): ! Constructor. Initialize multidata frame with a ...
Implement the Python class `MultiDataframe` described below. Class description: ! A multidata frame is a container of one or more data frames. This allows for processing across more than one data frames. Method signatures and docstrings: - def __init__(self, name=''): ! Constructor. Initialize multidata frame with a ...
553ae07fb52afb36717f45c0f3359232c157cc24
<|skeleton|> class MultiDataframe: """! A multidata frame is a container of one or more data frames. This allows for processing across more than one data frames.""" def __init__(self, name=''): """! Constructor. Initialize multidata frame with a name. @param name string: Name of this data frame. Defaul...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MultiDataframe: """! A multidata frame is a container of one or more data frames. This allows for processing across more than one data frames.""" def __init__(self, name=''): """! Constructor. Initialize multidata frame with a name. @param name string: Name of this data frame. Default is empty na...
the_stack_v2_python_sparse
copads/dataframe.py
Gutsu7/copads
train
1
c83db03c5bb92abc5d8e906d0e21542fb8668d1c
[ "dp = [float('inf') for _ in range(n + 1)]\ndp[0] = 0\nfor i in range(n + 1):\n j = 1\n while n >= i + j * j:\n dp[i + j * j] = min(dp[i] + 1, dp[i + j * j])\n j += 1\nreturn dp[-1]", "num = [0]\nwhile len(num) <= n:\n num.append(min((num[-i * i] for i in range(1, int(len(num) ** 0.5 + 1)))...
<|body_start_0|> dp = [float('inf') for _ in range(n + 1)] dp[0] = 0 for i in range(n + 1): j = 1 while n >= i + j * j: dp[i + j * j] = min(dp[i] + 1, dp[i + j * j]) j += 1 return dp[-1] <|end_body_0|> <|body_start_1|> num ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numSquares_2(self, n): """:type n: int :rtype: int""" <|body_0|> def numSquares(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> dp = [float('inf') for _ in range(n + 1)] dp[0] = 0 f...
stack_v2_sparse_classes_75kplus_train_008632
1,085
no_license
[ { "docstring": ":type n: int :rtype: int", "name": "numSquares_2", "signature": "def numSquares_2(self, n)" }, { "docstring": ":type n: int :rtype: int", "name": "numSquares", "signature": "def numSquares(self, n)" } ]
2
stack_v2_sparse_classes_30k_train_023491
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numSquares_2(self, n): :type n: int :rtype: int - def numSquares(self, n): :type n: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numSquares_2(self, n): :type n: int :rtype: int - def numSquares(self, n): :type n: int :rtype: int <|skeleton|> class Solution: def numSquares_2(self, n): """:...
0ca8983505ef5f694b68198742aaf50fc0b80e6b
<|skeleton|> class Solution: def numSquares_2(self, n): """:type n: int :rtype: int""" <|body_0|> def numSquares(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def numSquares_2(self, n): """:type n: int :rtype: int""" dp = [float('inf') for _ in range(n + 1)] dp[0] = 0 for i in range(n + 1): j = 1 while n >= i + j * j: dp[i + j * j] = min(dp[i] + 1, dp[i + j * j]) j += ...
the_stack_v2_python_sparse
leetcode 251-300/279. Perfect Squares.py
raxxar1024/code_snippet
train
0
d6242c1b427b95da9d6c3d4cf8e7007827d7a612
[ "super().__init__()\nself.self_attn = nn.MultiheadAttention(d_model, nhead, dropout=dropout)\nself.dropout = nn.Dropout(dropout)\nself.linear1 = nn.Linear(d_model, dim_feedforward)\nself.linear2 = nn.Linear(dim_feedforward, d_model)\nself.norm1 = nn.LayerNorm(d_model)\nself.norm2 = nn.LayerNorm(d_model)\nself.dropo...
<|body_start_0|> super().__init__() self.self_attn = nn.MultiheadAttention(d_model, nhead, dropout=dropout) self.dropout = nn.Dropout(dropout) self.linear1 = nn.Linear(d_model, dim_feedforward) self.linear2 = nn.Linear(dim_feedforward, d_model) self.norm1 = nn.LayerNorm(d...
TransformerEncoderLayer is made up of self-attn and feedforward. This standard encoder layer is based on the paper "Attention Is All You Need". Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. In Advances in Neu...
TransformerEncoderLayer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TransformerEncoderLayer: """TransformerEncoderLayer is made up of self-attn and feedforward. This standard encoder layer is based on the paper "Attention Is All You Need". Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. ...
stack_v2_sparse_classes_75kplus_train_008633
3,033
no_license
[ { "docstring": "Initialize a TransformerEncoderLayer. Parameters ---------- d_model : int The number of expected features in the input. n_head : int The number of heads in the multiheadattention models. dim_feedforward : int, optional The dimension of the feedforward network (default=2048). dropout : float, opt...
2
stack_v2_sparse_classes_30k_train_040149
Implement the Python class `TransformerEncoderLayer` described below. Class description: TransformerEncoderLayer is made up of self-attn and feedforward. This standard encoder layer is based on the paper "Attention Is All You Need". Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez...
Implement the Python class `TransformerEncoderLayer` described below. Class description: TransformerEncoderLayer is made up of self-attn and feedforward. This standard encoder layer is based on the paper "Attention Is All You Need". Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez...
8b9fadded0e9eed7e16bf6ce6c3235f3ad5132e8
<|skeleton|> class TransformerEncoderLayer: """TransformerEncoderLayer is made up of self-attn and feedforward. This standard encoder layer is based on the paper "Attention Is All You Need". Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TransformerEncoderLayer: """TransformerEncoderLayer is made up of self-attn and feedforward. This standard encoder layer is based on the paper "Attention Is All You Need". Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. Attenti...
the_stack_v2_python_sparse
models/cnn_dm/teacher/encoder/layers.3/source.py
asappresearch/imitkd
train
3
71dd5eff33ae8351c2734693beeec0a79e0b4ebe
[ "res = []\nfor field in self._fields_:\n res.append('%s=%s' % (field[0], repr(getattr(self, field[0]))))\nreturn self.__class__.__name__ + '(' + ','.join(res) + ')'", "res = []\nfor field in self._fields_:\n data = getattr(self, field[0])\n if field[0] == 'maxThreadsDim':\n data = '%d %d %d' % (da...
<|body_start_0|> res = [] for field in self._fields_: res.append('%s=%s' % (field[0], repr(getattr(self, field[0])))) return self.__class__.__name__ + '(' + ','.join(res) + ')' <|end_body_0|> <|body_start_1|> res = [] for field in self._fields_: data = ge...
cudaDeviceProp
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class cudaDeviceProp: def __repr__(self): """Print structured objects""" <|body_0|> def __str__(self): """Print structured objects""" <|body_1|> <|end_skeleton|> <|body_start_0|> res = [] for field in self._fields_: res.append('%s=%s' ...
stack_v2_sparse_classes_75kplus_train_008634
16,646
no_license
[ { "docstring": "Print structured objects", "name": "__repr__", "signature": "def __repr__(self)" }, { "docstring": "Print structured objects", "name": "__str__", "signature": "def __str__(self)" } ]
2
stack_v2_sparse_classes_30k_train_022896
Implement the Python class `cudaDeviceProp` described below. Class description: Implement the cudaDeviceProp class. Method signatures and docstrings: - def __repr__(self): Print structured objects - def __str__(self): Print structured objects
Implement the Python class `cudaDeviceProp` described below. Class description: Implement the cudaDeviceProp class. Method signatures and docstrings: - def __repr__(self): Print structured objects - def __str__(self): Print structured objects <|skeleton|> class cudaDeviceProp: def __repr__(self): """Pri...
38133f08c0ab5b0eb7dddeb31d104d9ba53b9a9e
<|skeleton|> class cudaDeviceProp: def __repr__(self): """Print structured objects""" <|body_0|> def __str__(self): """Print structured objects""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class cudaDeviceProp: def __repr__(self): """Print structured objects""" res = [] for field in self._fields_: res.append('%s=%s' % (field[0], repr(getattr(self, field[0])))) return self.__class__.__name__ + '(' + ','.join(res) + ')' def __str__(self): """Prin...
the_stack_v2_python_sparse
cuda/cuda_defs.py
jamak/epimorphism
train
0
154a503a816eee2159e5a6e0b514bf4e7adba173
[ "self._using_source = None\nself._using_destination = None\nself.device = device\nself.server_device_id = kwargs.get('server_device_id', device.central_server_id)\nif using_source == using_destination:\n raise UsingError(\"Arguments '<source>' and '<destination'> cannot be the same. Got '{0}' and '{1}'\".format(...
<|body_start_0|> self._using_source = None self._using_destination = None self.device = device self.server_device_id = kwargs.get('server_device_id', device.central_server_id) if using_source == using_destination: raise UsingError("Arguments '<source>' and '<destinati...
BaseUsing
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseUsing: def __init__(self, using_source, using_destination, **kwargs): """Initializes and verifies arguments ``using_source`` and ``using_destination``. Args: ``using_source``: settings.DATABASE key for source. Source is the server so must be 'default' if running on the server and 'se...
stack_v2_sparse_classes_75kplus_train_008635
4,751
no_license
[ { "docstring": "Initializes and verifies arguments ``using_source`` and ``using_destination``. Args: ``using_source``: settings.DATABASE key for source. Source is the server so must be 'default' if running on the server and 'server' if running on the device. ``using_destination``: settings.DATABASE key for dest...
6
stack_v2_sparse_classes_30k_train_045368
Implement the Python class `BaseUsing` described below. Class description: Implement the BaseUsing class. Method signatures and docstrings: - def __init__(self, using_source, using_destination, **kwargs): Initializes and verifies arguments ``using_source`` and ``using_destination``. Args: ``using_source``: settings.D...
Implement the Python class `BaseUsing` described below. Class description: Implement the BaseUsing class. Method signatures and docstrings: - def __init__(self, using_source, using_destination, **kwargs): Initializes and verifies arguments ``using_source`` and ``using_destination``. Args: ``using_source``: settings.D...
4f75336ff572babd39d431185677a65bece9e524
<|skeleton|> class BaseUsing: def __init__(self, using_source, using_destination, **kwargs): """Initializes and verifies arguments ``using_source`` and ``using_destination``. Args: ``using_source``: settings.DATABASE key for source. Source is the server so must be 'default' if running on the server and 'se...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BaseUsing: def __init__(self, using_source, using_destination, **kwargs): """Initializes and verifies arguments ``using_source`` and ``using_destination``. Args: ``using_source``: settings.DATABASE key for source. Source is the server so must be 'default' if running on the server and 'server' if runni...
the_stack_v2_python_sparse
edc/core/bhp_using/classes/base_using.py
botswana-harvard/edc
train
0
6d0c9ed0759d4dca15427911508dbe78da89cb42
[ "super().__init__()\nself.gats = nn.ModuleList([HeCoGATConv(hidden_dim, attn_drop, activation=F.elu) for _ in range(len(neighbor_sizes))])\nself.attn = Attention(hidden_dim, attn_drop)\nself.neighbor_sizes = neighbor_sizes", "h = []\nfor i in range(len(self.neighbor_sizes)):\n nodes = {bgs[i].dsttypes[0]: bgs[...
<|body_start_0|> super().__init__() self.gats = nn.ModuleList([HeCoGATConv(hidden_dim, attn_drop, activation=F.elu) for _ in range(len(neighbor_sizes))]) self.attn = Attention(hidden_dim, attn_drop) self.neighbor_sizes = neighbor_sizes <|end_body_0|> <|body_start_1|> h = [] ...
NetworkSchemaEncoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NetworkSchemaEncoder: def __init__(self, hidden_dim, attn_drop, neighbor_sizes): """网络结构视图编码器 :param hidden_dim: int 隐含特征维数 :param attn_drop: float 注意力dropout :param neighbor_sizes: List[int] 各邻居类型的采样个数,长度为邻居类型数S""" <|body_0|> def forward(self, bgs, feats): """:param...
stack_v2_sparse_classes_75kplus_train_008636
10,626
no_license
[ { "docstring": "网络结构视图编码器 :param hidden_dim: int 隐含特征维数 :param attn_drop: float 注意力dropout :param neighbor_sizes: List[int] 各邻居类型的采样个数,长度为邻居类型数S", "name": "__init__", "signature": "def __init__(self, hidden_dim, attn_drop, neighbor_sizes)" }, { "docstring": ":param bgs: List[DGLGraph] 各类型邻居到目标顶点...
2
stack_v2_sparse_classes_30k_train_033279
Implement the Python class `NetworkSchemaEncoder` described below. Class description: Implement the NetworkSchemaEncoder class. Method signatures and docstrings: - def __init__(self, hidden_dim, attn_drop, neighbor_sizes): 网络结构视图编码器 :param hidden_dim: int 隐含特征维数 :param attn_drop: float 注意力dropout :param neighbor_size...
Implement the Python class `NetworkSchemaEncoder` described below. Class description: Implement the NetworkSchemaEncoder class. Method signatures and docstrings: - def __init__(self, hidden_dim, attn_drop, neighbor_sizes): 网络结构视图编码器 :param hidden_dim: int 隐含特征维数 :param attn_drop: float 注意力dropout :param neighbor_size...
b40071dc9f9fb20f081f4ed4944a7b65de919c18
<|skeleton|> class NetworkSchemaEncoder: def __init__(self, hidden_dim, attn_drop, neighbor_sizes): """网络结构视图编码器 :param hidden_dim: int 隐含特征维数 :param attn_drop: float 注意力dropout :param neighbor_sizes: List[int] 各邻居类型的采样个数,长度为邻居类型数S""" <|body_0|> def forward(self, bgs, feats): """:param...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NetworkSchemaEncoder: def __init__(self, hidden_dim, attn_drop, neighbor_sizes): """网络结构视图编码器 :param hidden_dim: int 隐含特征维数 :param attn_drop: float 注意力dropout :param neighbor_sizes: List[int] 各邻居类型的采样个数,长度为邻居类型数S""" super().__init__() self.gats = nn.ModuleList([HeCoGATConv(hidden_dim, ...
the_stack_v2_python_sparse
gnn/heco/model.py
deepdumbo/pytorch-tutorial-1
train
0
73d298e6b681db79257d3e689633c4c0b079a06f
[ "res = []\n\ndef transform(node):\n if not node:\n res.append('#')\n else:\n res.append(str(node.val))\n transform(node.left)\n transform(node.right)\ntransform(root)\nreturn ','.join(res)", "res = iter(data.split(','))\n\ndef transform():\n val = next(res)\n if val == '#':...
<|body_start_0|> res = [] def transform(node): if not node: res.append('#') else: res.append(str(node.val)) transform(node.left) transform(node.right) transform(root) return ','.join(res) <|end_body_...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_75kplus_train_008637
1,006
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_017957
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
c5e4f540e08492ea27ce17119b03b2528b780a92
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" res = [] def transform(node): if not node: res.append('#') else: res.append(str(node.val)) transform(node...
the_stack_v2_python_sparse
Week_03/serialize_and_deserialize_binary_tree.py
SZ-Edward/algorithm011-class02
train
0
8ad2c37b556940498fdfb3ab37f383efcfe337f1
[ "self.ami = pyAMI.client.Client('atlas')\nif options.config:\n self.configFileName = os.path.expanduser(options.config)\nelse:\n sys.exit('No authentication file specified')\nprint(self.configFileName)", "if isinstance(cmd, str):\n cmd = cmd.split()\nprint('PRINT AMI CMD', cmd)\nresults = self.ami.execut...
<|body_start_0|> self.ami = pyAMI.client.Client('atlas') if options.config: self.configFileName = os.path.expanduser(options.config) else: sys.exit('No authentication file specified') print(self.configFileName) <|end_body_0|> <|body_start_1|> if isinstanc...
AMIWrapper
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AMIWrapper: def __init__(self): """Initalise AMI""" <|body_0|> def run(self, cmd): """Execute an AMI command given as a list of command and paramters (ami format) or space separated string (for convenience)""" <|body_1|> def periods(self, period=None, le...
stack_v2_sparse_classes_75kplus_train_008638
4,397
permissive
[ { "docstring": "Initalise AMI", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Execute an AMI command given as a list of command and paramters (ami format) or space separated string (for convenience)", "name": "run", "signature": "def run(self, cmd)" }, { ...
5
stack_v2_sparse_classes_30k_train_053932
Implement the Python class `AMIWrapper` described below. Class description: Implement the AMIWrapper class. Method signatures and docstrings: - def __init__(self): Initalise AMI - def run(self, cmd): Execute an AMI command given as a list of command and paramters (ami format) or space separated string (for convenienc...
Implement the Python class `AMIWrapper` described below. Class description: Implement the AMIWrapper class. Method signatures and docstrings: - def __init__(self): Initalise AMI - def run(self, cmd): Execute an AMI command given as a list of command and paramters (ami format) or space separated string (for convenienc...
354f92551294f7be678aebcd7b9d67d2c4448176
<|skeleton|> class AMIWrapper: def __init__(self): """Initalise AMI""" <|body_0|> def run(self, cmd): """Execute an AMI command given as a list of command and paramters (ami format) or space separated string (for convenience)""" <|body_1|> def periods(self, period=None, le...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AMIWrapper: def __init__(self): """Initalise AMI""" self.ami = pyAMI.client.Client('atlas') if options.config: self.configFileName = os.path.expanduser(options.config) else: sys.exit('No authentication file specified') print(self.configFileName) ...
the_stack_v2_python_sparse
InnerDetector/InDetExample/InDetBeamSpotExample/bin/periodInfo.py
strigazi/athena
train
0
b1453e22c6bcdd695d1b989dc11dd9cfb760a4b7
[ "self.type = type\nif 'cuda' not in kwargs:\n cuda = False\nelse:\n cuda = kwargs['cuda']\nif cuda:\n self.device = torch.device('cuda')\nelse:\n self.device = torch.device('cpu')\nif self.type == 'sph':\n self.bas_l = torch.as_tensor(kwargs['bas_l']).to(self.device)\n self.bas_m = torch.as_tensor...
<|body_start_0|> self.type = type if 'cuda' not in kwargs: cuda = False else: cuda = kwargs['cuda'] if cuda: self.device = torch.device('cuda') else: self.device = torch.device('cpu') if self.type == 'sph': self....
Harmonics
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Harmonics: def __init__(self, type, **kwargs): """Compute spherical or cartesian harmonics and their derivatives Args: type (str): harmonics type (cart or sph) Keyword Arguments: bas_l (torch.tensor): second quantum numbers (sph) bas_m (torch.tensor): third quantum numbers (sph) bas_kx (...
stack_v2_sparse_classes_75kplus_train_008639
20,956
permissive
[ { "docstring": "Compute spherical or cartesian harmonics and their derivatives Args: type (str): harmonics type (cart or sph) Keyword Arguments: bas_l (torch.tensor): second quantum numbers (sph) bas_m (torch.tensor): third quantum numbers (sph) bas_kx (torch.tensor): x exponent (cart) bas_ky (torch.tensor): xy...
2
null
Implement the Python class `Harmonics` described below. Class description: Implement the Harmonics class. Method signatures and docstrings: - def __init__(self, type, **kwargs): Compute spherical or cartesian harmonics and their derivatives Args: type (str): harmonics type (cart or sph) Keyword Arguments: bas_l (torc...
Implement the Python class `Harmonics` described below. Class description: Implement the Harmonics class. Method signatures and docstrings: - def __init__(self, type, **kwargs): Compute spherical or cartesian harmonics and their derivatives Args: type (str): harmonics type (cart or sph) Keyword Arguments: bas_l (torc...
439a79e97ee63057e3032d28a1a5ebafd2d5b5e4
<|skeleton|> class Harmonics: def __init__(self, type, **kwargs): """Compute spherical or cartesian harmonics and their derivatives Args: type (str): harmonics type (cart or sph) Keyword Arguments: bas_l (torch.tensor): second quantum numbers (sph) bas_m (torch.tensor): third quantum numbers (sph) bas_kx (...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Harmonics: def __init__(self, type, **kwargs): """Compute spherical or cartesian harmonics and their derivatives Args: type (str): harmonics type (cart or sph) Keyword Arguments: bas_l (torch.tensor): second quantum numbers (sph) bas_m (torch.tensor): third quantum numbers (sph) bas_kx (torch.tensor):...
the_stack_v2_python_sparse
qmctorch/wavefunction/orbitals/spherical_harmonics.py
NLESC-JCER/QMCTorch
train
22
a83b960857a3f56ec08535514ff69d9dbe1b11bc
[ "LOGGER.warning('${%s %s}: %s', cls.TYPE_NAME, value, cls.DEPRECATION_MSG)\nregion, value = read_value_from_path(value).split('@', 1)\nreturn (value, {'region': region})", "if '@' in value:\n query, args = cls.legacy_parse(value)\nelse:\n query, args = cls.parse(value)\nkms = context.get_session(region=args...
<|body_start_0|> LOGGER.warning('${%s %s}: %s', cls.TYPE_NAME, value, cls.DEPRECATION_MSG) region, value = read_value_from_path(value).split('@', 1) return (value, {'region': region}) <|end_body_0|> <|body_start_1|> if '@' in value: query, args = cls.legacy_parse(value) ...
AWS KMS lookup.
KmsLookup
[ "Apache-2.0", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KmsLookup: """AWS KMS lookup.""" def legacy_parse(cls, value: str) -> Tuple[str, Dict[str, str]]: """Retain support for legacy lookup syntax. Format of value:: <region>@<encrypted-blob>""" <|body_0|> def handle(cls, value: str, context: CfnginContext, **_: Any) -> str: ...
stack_v2_sparse_classes_75kplus_train_008640
2,188
permissive
[ { "docstring": "Retain support for legacy lookup syntax. Format of value:: <region>@<encrypted-blob>", "name": "legacy_parse", "signature": "def legacy_parse(cls, value: str) -> Tuple[str, Dict[str, str]]" }, { "docstring": "Decrypt the specified value with a master key in KMS. Args: value: Para...
2
stack_v2_sparse_classes_30k_train_026259
Implement the Python class `KmsLookup` described below. Class description: AWS KMS lookup. Method signatures and docstrings: - def legacy_parse(cls, value: str) -> Tuple[str, Dict[str, str]]: Retain support for legacy lookup syntax. Format of value:: <region>@<encrypted-blob> - def handle(cls, value: str, context: Cf...
Implement the Python class `KmsLookup` described below. Class description: AWS KMS lookup. Method signatures and docstrings: - def legacy_parse(cls, value: str) -> Tuple[str, Dict[str, str]]: Retain support for legacy lookup syntax. Format of value:: <region>@<encrypted-blob> - def handle(cls, value: str, context: Cf...
0763b06aee07d2cf3f037a49ca0cb81a048c5deb
<|skeleton|> class KmsLookup: """AWS KMS lookup.""" def legacy_parse(cls, value: str) -> Tuple[str, Dict[str, str]]: """Retain support for legacy lookup syntax. Format of value:: <region>@<encrypted-blob>""" <|body_0|> def handle(cls, value: str, context: CfnginContext, **_: Any) -> str: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class KmsLookup: """AWS KMS lookup.""" def legacy_parse(cls, value: str) -> Tuple[str, Dict[str, str]]: """Retain support for legacy lookup syntax. Format of value:: <region>@<encrypted-blob>""" LOGGER.warning('${%s %s}: %s', cls.TYPE_NAME, value, cls.DEPRECATION_MSG) region, value = re...
the_stack_v2_python_sparse
runway/cfngin/lookups/handlers/kms.py
onicagroup/runway
train
156
8b59c05981957880efe0e835a5022b301bc4801e
[ "guess_str = (str(parent_hash) + str(merkle_root) + str(nonce)).encode('utf8')\nguess_hash = FuncUtil.hashfunc_sha256(guess_str)\ndifficulty = 1\nwhile int('f' * difficulty, 16) < sum_stake:\n difficulty += 1\nguess_weight = int(guess_hash[:difficulty], 16) / int('f' * difficulty, 16)\nreturn guess_weight < stak...
<|body_start_0|> guess_str = (str(parent_hash) + str(merkle_root) + str(nonce)).encode('utf8') guess_hash = FuncUtil.hashfunc_sha256(guess_str) difficulty = 1 while int('f' * difficulty, 16) < sum_stake: difficulty += 1 guess_weight = int(guess_hash[:difficulty], 16) ...
Proof-of-Stake consenses mechanism
POS
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class POS: """Proof-of-Stake consenses mechanism""" def valid_proof(parent_hash, merkle_root, nonce, stake_weight=1, sum_stake=1): """Check if a guessing hash value satisfies the mining difficulty conditions. @ parent_hash: parent block hash value @ merkle_root: merkle tree root of transac...
stack_v2_sparse_classes_75kplus_train_008641
3,326
no_license
[ { "docstring": "Check if a guessing hash value satisfies the mining difficulty conditions. @ parent_hash: parent block hash value @ merkle_root: merkle tree root of transactions in block @ nonce: the stake deposit value", "name": "valid_proof", "signature": "def valid_proof(parent_hash, merkle_root, non...
3
stack_v2_sparse_classes_30k_train_018987
Implement the Python class `POS` described below. Class description: Proof-of-Stake consenses mechanism Method signatures and docstrings: - def valid_proof(parent_hash, merkle_root, nonce, stake_weight=1, sum_stake=1): Check if a guessing hash value satisfies the mining difficulty conditions. @ parent_hash: parent bl...
Implement the Python class `POS` described below. Class description: Proof-of-Stake consenses mechanism Method signatures and docstrings: - def valid_proof(parent_hash, merkle_root, nonce, stake_weight=1, sum_stake=1): Check if a guessing hash value satisfies the mining difficulty conditions. @ parent_hash: parent bl...
03ff57e6fe0114ffd2dd953e79a73a893a6bc0ad
<|skeleton|> class POS: """Proof-of-Stake consenses mechanism""" def valid_proof(parent_hash, merkle_root, nonce, stake_weight=1, sum_stake=1): """Check if a guessing hash value satisfies the mining difficulty conditions. @ parent_hash: parent block hash value @ merkle_root: merkle tree root of transac...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class POS: """Proof-of-Stake consenses mechanism""" def valid_proof(parent_hash, merkle_root, nonce, stake_weight=1, sum_stake=1): """Check if a guessing hash value satisfies the mining difficulty conditions. @ parent_hash: parent block hash value @ merkle_root: merkle tree root of transactions in bloc...
the_stack_v2_python_sparse
Security/py_dev/VDF_chain/consensus/consensus.py
samuelxu999/Research
train
1
03a998679c0489f0fa6f8632660d5f5bb0de3bd3
[ "startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('yufeng72', 'yufeng72')\nurl = 'https://s3.amazonaws.com/hubway-data/Hubway_Stations_as_of_July_2017.csv'\nresponse = urllib.request.urlopen(url)\nr = csv.reader(io.StringIO(response.read().decode('utf-8'...
<|body_start_0|> startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('yufeng72', 'yufeng72') url = 'https://s3.amazonaws.com/hubway-data/Hubway_Stations_as_of_July_2017.csv' response = urllib.request.urlopen(url) ...
RetrieveHubwayStations
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RetrieveHubwayStations: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing e...
stack_v2_sparse_classes_75kplus_train_008642
4,460
no_license
[ { "docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).", "name": "execute", "signature": "def execute(trial=False)" }, { "docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new d...
2
stack_v2_sparse_classes_30k_train_043585
Implement the Python class `RetrieveHubwayStations` described below. Class description: Implement the RetrieveHubwayStations class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(),...
Implement the Python class `RetrieveHubwayStations` described below. Class description: Implement the RetrieveHubwayStations class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(),...
90284cf3debbac36eead07b8d2339cdd191b86cf
<|skeleton|> class RetrieveHubwayStations: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing e...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RetrieveHubwayStations: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('yufeng72', 'yufeng72') ...
the_stack_v2_python_sparse
yufeng72/RetrieveHubwayStations.py
maximega/course-2019-spr-proj
train
2
c0a7f679b4f453396c73ace046a692ec0a91452a
[ "if root is None:\n return 'X#'\nleftSerialized = self.serialize(root.left)\nrightSerialized = self.serialize(root.right)\nreturn str(root.val) + '#' + leftSerialized + rightSerialized", "def dfs():\n val = next(data)\n if val == 'X':\n return None\n node = TreeNode(int(val))\n node.left = d...
<|body_start_0|> if root is None: return 'X#' leftSerialized = self.serialize(root.left) rightSerialized = self.serialize(root.right) return str(root.val) + '#' + leftSerialized + rightSerialized <|end_body_0|> <|body_start_1|> def dfs(): val = next(data)...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes a string to a binary tree""" <|body_1|> <|end_skeleton|> <|body_start_0|> if root is No...
stack_v2_sparse_classes_75kplus_train_008643
2,530
no_license
[ { "docstring": "Encodes a tree to a single string", "name": "serialize", "signature": "def serialize(self, root: TreeNode) -> str" }, { "docstring": "Decodes a string to a binary tree", "name": "deserialize", "signature": "def deserialize(self, data: str) -> TreeNode" } ]
2
stack_v2_sparse_classes_30k_train_053742
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string - def deserialize(self, data: str) -> TreeNode: Decodes a string to a binary tree
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string - def deserialize(self, data: str) -> TreeNode: Decodes a string to a binary tree <|skeleton|> clas...
4f3706877c99ea008c3d429e1841758213286a71
<|skeleton|> class Solution: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes a string to a binary tree""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string""" if root is None: return 'X#' leftSerialized = self.serialize(root.left) rightSerialized = self.serialize(root.right) return str(root.val) + '#' + leftSerialized + r...
the_stack_v2_python_sparse
Python/Data Strucutre Related Questions/Trees & Graphs/Serialize and Deserialize Binary Tree - Hard #297.py
tmdenddl/Algorithm
train
0
e54e44ca570f6f792182bb0d4fb72b82ce9f7ab2
[ "if authorization_header and isinstance(authorization_header, str):\n array = authorization_header.split(' ')\n if len(array) > 1:\n if array[0] == 'Basic':\n return array[1]\nreturn None", "if base64_authorization_header and isinstance(base64_authorization_header, str):\n try:\n ...
<|body_start_0|> if authorization_header and isinstance(authorization_header, str): array = authorization_header.split(' ') if len(array) > 1: if array[0] == 'Basic': return array[1] return None <|end_body_0|> <|body_start_1|> if base6...
[simple auth] Args: Auth ([class]): [class auth]
BasicAuth
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BasicAuth: """[simple auth] Args: Auth ([class]): [class auth]""" def extract_base64_authorization_header(self, authorization_header: str) -> str: """[base 64 header] Args: authorization_header (str): [header] Returns: str: [base 64 string]""" <|body_0|> def decode_base6...
stack_v2_sparse_classes_75kplus_train_008644
3,335
no_license
[ { "docstring": "[base 64 header] Args: authorization_header (str): [header] Returns: str: [base 64 string]", "name": "extract_base64_authorization_header", "signature": "def extract_base64_authorization_header(self, authorization_header: str) -> str" }, { "docstring": "[decode] Args: base64_auth...
5
stack_v2_sparse_classes_30k_train_034953
Implement the Python class `BasicAuth` described below. Class description: [simple auth] Args: Auth ([class]): [class auth] Method signatures and docstrings: - def extract_base64_authorization_header(self, authorization_header: str) -> str: [base 64 header] Args: authorization_header (str): [header] Returns: str: [ba...
Implement the Python class `BasicAuth` described below. Class description: [simple auth] Args: Auth ([class]): [class auth] Method signatures and docstrings: - def extract_base64_authorization_header(self, authorization_header: str) -> str: [base 64 header] Args: authorization_header (str): [header] Returns: str: [ba...
0c235315b6c67e4cf26977c80f51e995da762fb1
<|skeleton|> class BasicAuth: """[simple auth] Args: Auth ([class]): [class auth]""" def extract_base64_authorization_header(self, authorization_header: str) -> str: """[base 64 header] Args: authorization_header (str): [header] Returns: str: [base 64 string]""" <|body_0|> def decode_base6...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BasicAuth: """[simple auth] Args: Auth ([class]): [class auth]""" def extract_base64_authorization_header(self, authorization_header: str) -> str: """[base 64 header] Args: authorization_header (str): [header] Returns: str: [base 64 string]""" if authorization_header and isinstance(author...
the_stack_v2_python_sparse
0x06-Basic_authentication/api/v1/auth/basic_auth.py
abu-bakarr/holbertonschool-web_back_end
train
0
f83a05c08f5420472690a62a0811838ec02d12de
[ "Tuberculoventral.__init__(self)\nself.vecstim = h.VecStim()\nself.spike_source = self.vecstim\nself.add_section(h.Section(), self.somaname)\nself.status = {self.somaname: True, 'axon': False, 'dendrites': False, 'pumps': False, 'na': None, 'species': species, 'modelType': 'Dummy', 'modelName': 'DummyTuberculoventr...
<|body_start_0|> Tuberculoventral.__init__(self) self.vecstim = h.VecStim() self.spike_source = self.vecstim self.add_section(h.Section(), self.somaname) self.status = {self.somaname: True, 'axon': False, 'dendrites': False, 'pumps': False, 'na': None, 'species': species, 'modelT...
Tuberculoventral cell class with no cell body; this cell only replays a predetermined spike train. Useful for testing, or replacing spike trains to determine the importance of spike structures within a network.
DummyTuberculoventral
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DummyTuberculoventral: """Tuberculoventral cell class with no cell body; this cell only replays a predetermined spike train. Useful for testing, or replacing spike trains to determine the importance of spike structures within a network.""" def __init__(self, cf=None, species='mouse'): ...
stack_v2_sparse_classes_75kplus_train_008645
19,763
permissive
[ { "docstring": "Parameters ---------- cf : float (default: None) Required: the characteristic frequency for the TV cell Really just for reference.", "name": "__init__", "signature": "def __init__(self, cf=None, species='mouse')" }, { "docstring": "Set the times of spikes (in seconds) to be repla...
2
null
Implement the Python class `DummyTuberculoventral` described below. Class description: Tuberculoventral cell class with no cell body; this cell only replays a predetermined spike train. Useful for testing, or replacing spike trains to determine the importance of spike structures within a network. Method signatures an...
Implement the Python class `DummyTuberculoventral` described below. Class description: Tuberculoventral cell class with no cell body; this cell only replays a predetermined spike train. Useful for testing, or replacing spike trains to determine the importance of spike structures within a network. Method signatures an...
ff705f650e765142775f4ae0e3c3159e30af8944
<|skeleton|> class DummyTuberculoventral: """Tuberculoventral cell class with no cell body; this cell only replays a predetermined spike train. Useful for testing, or replacing spike trains to determine the importance of spike structures within a network.""" def __init__(self, cf=None, species='mouse'): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DummyTuberculoventral: """Tuberculoventral cell class with no cell body; this cell only replays a predetermined spike train. Useful for testing, or replacing spike trains to determine the importance of spike structures within a network.""" def __init__(self, cf=None, species='mouse'): """Paramete...
the_stack_v2_python_sparse
cnmodel/cells/tuberculoventral.py
cnmodel/cnmodel
train
10
38231ecf1cf1b10c97e1fefe15cc6596168457a9
[ "self.banner_id = banner_id\nself.content = content\nself.created_time_msecs = created_time_msecs\nself.description = description\nself.last_updated_time_msecs = last_updated_time_msecs", "if dictionary is None:\n return None\nbanner_id = dictionary.get('bannerId')\ncontent = dictionary.get('content')\ncreated...
<|body_start_0|> self.banner_id = banner_id self.content = content self.created_time_msecs = created_time_msecs self.description = description self.last_updated_time_msecs = last_updated_time_msecs <|end_body_0|> <|body_start_1|> if dictionary is None: return...
Implementation of the 'Banner' model. Banner is used for storing the banner content in scribe and also for transferring it over the wire. Attributes: banner_id (string): Specifies a banner_id which can uniquely identify a banner. This may be the cluster_id, or the tenant_id, or the group_id, or the user SID etc. If thi...
Banner
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Banner: """Implementation of the 'Banner' model. Banner is used for storing the banner content in scribe and also for transferring it over the wire. Attributes: banner_id (string): Specifies a banner_id which can uniquely identify a banner. This may be the cluster_id, or the tenant_id, or the gro...
stack_v2_sparse_classes_75kplus_train_008646
2,940
permissive
[ { "docstring": "Constructor for the Banner class", "name": "__init__", "signature": "def __init__(self, banner_id=None, content=None, created_time_msecs=None, description=None, last_updated_time_msecs=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary ...
2
stack_v2_sparse_classes_30k_train_047234
Implement the Python class `Banner` described below. Class description: Implementation of the 'Banner' model. Banner is used for storing the banner content in scribe and also for transferring it over the wire. Attributes: banner_id (string): Specifies a banner_id which can uniquely identify a banner. This may be the c...
Implement the Python class `Banner` described below. Class description: Implementation of the 'Banner' model. Banner is used for storing the banner content in scribe and also for transferring it over the wire. Attributes: banner_id (string): Specifies a banner_id which can uniquely identify a banner. This may be the c...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class Banner: """Implementation of the 'Banner' model. Banner is used for storing the banner content in scribe and also for transferring it over the wire. Attributes: banner_id (string): Specifies a banner_id which can uniquely identify a banner. This may be the cluster_id, or the tenant_id, or the gro...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Banner: """Implementation of the 'Banner' model. Banner is used for storing the banner content in scribe and also for transferring it over the wire. Attributes: banner_id (string): Specifies a banner_id which can uniquely identify a banner. This may be the cluster_id, or the tenant_id, or the group_id, or the...
the_stack_v2_python_sparse
cohesity_management_sdk/models/banner.py
cohesity/management-sdk-python
train
24
527336b806a7b6ac8ed33162f044918c56a9d5ec
[ "if not root:\n return []\nnodes = []\npairs = []\nq = deque([root])\nwhile len(q) > 0:\n root = q.popleft()\n nodes.append(root)\n if root.left:\n q.append(root.left)\n pairs.append((root, root.left))\n if root.right:\n q.append(root.right)\n pairs.append((root, root.righ...
<|body_start_0|> if not root: return [] nodes = [] pairs = [] q = deque([root]) while len(q) > 0: root = q.popleft() nodes.append(root) if root.left: q.append(root.left) pairs.append((root, root.left)...
BiTree
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BiTree: def level_traversal(cls, root: BiNode, get_rel_pair=False) -> list: """层次遍历 :param root: 根节点 :param get_rel_pair: 是否获取 父节点-节点 对 :return:""" <|body_0|> def depth(cls, root: BiNode): """返回树的深度(后序遍历) :param root: 根节点 :return:""" <|body_1|> def plot(...
stack_v2_sparse_classes_75kplus_train_008647
3,157
no_license
[ { "docstring": "层次遍历 :param root: 根节点 :param get_rel_pair: 是否获取 父节点-节点 对 :return:", "name": "level_traversal", "signature": "def level_traversal(cls, root: BiNode, get_rel_pair=False) -> list" }, { "docstring": "返回树的深度(后序遍历) :param root: 根节点 :return:", "name": "depth", "signature": "def ...
3
stack_v2_sparse_classes_30k_train_033253
Implement the Python class `BiTree` described below. Class description: Implement the BiTree class. Method signatures and docstrings: - def level_traversal(cls, root: BiNode, get_rel_pair=False) -> list: 层次遍历 :param root: 根节点 :param get_rel_pair: 是否获取 父节点-节点 对 :return: - def depth(cls, root: BiNode): 返回树的深度(后序遍历) :pa...
Implement the Python class `BiTree` described below. Class description: Implement the BiTree class. Method signatures and docstrings: - def level_traversal(cls, root: BiNode, get_rel_pair=False) -> list: 层次遍历 :param root: 根节点 :param get_rel_pair: 是否获取 父节点-节点 对 :return: - def depth(cls, root: BiNode): 返回树的深度(后序遍历) :pa...
dbdcff0bf302c48fa554ae686a0f6d6d6520a618
<|skeleton|> class BiTree: def level_traversal(cls, root: BiNode, get_rel_pair=False) -> list: """层次遍历 :param root: 根节点 :param get_rel_pair: 是否获取 父节点-节点 对 :return:""" <|body_0|> def depth(cls, root: BiNode): """返回树的深度(后序遍历) :param root: 根节点 :return:""" <|body_1|> def plot(...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BiTree: def level_traversal(cls, root: BiNode, get_rel_pair=False) -> list: """层次遍历 :param root: 根节点 :param get_rel_pair: 是否获取 父节点-节点 对 :return:""" if not root: return [] nodes = [] pairs = [] q = deque([root]) while len(q) > 0: root = q....
the_stack_v2_python_sparse
trees/tree.py
123456789asdfjkl/machine_learning
train
0
b8e4ca4874f8d3188b6f9f248e38c1b0010a2d0a
[ "global DEBUG\nDEBUG = True\nfor end, distance in PART1_TESTS:\n self.assertEqual(findManhattanDistance(1, end), distance)", "global DEBUG\nDEBUG = True\nfor target, nextResult in PART2_TESTS:\n self.assertEqual(findNextAccumulation(target), nextResult)" ]
<|body_start_0|> global DEBUG DEBUG = True for end, distance in PART1_TESTS: self.assertEqual(findManhattanDistance(1, end), distance) <|end_body_0|> <|body_start_1|> global DEBUG DEBUG = True for target, nextResult in PART2_TESTS: self.assertEqua...
Tests for Part 1
TestDistance
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestDistance: """Tests for Part 1""" def test_part1(self): """Part 1 tests""" <|body_0|> def test_part2(self): """Part 2 tests""" <|body_1|> <|end_skeleton|> <|body_start_0|> global DEBUG DEBUG = True for end, distance in PART1_T...
stack_v2_sparse_classes_75kplus_train_008648
8,565
permissive
[ { "docstring": "Part 1 tests", "name": "test_part1", "signature": "def test_part1(self)" }, { "docstring": "Part 2 tests", "name": "test_part2", "signature": "def test_part2(self)" } ]
2
stack_v2_sparse_classes_30k_train_022008
Implement the Python class `TestDistance` described below. Class description: Tests for Part 1 Method signatures and docstrings: - def test_part1(self): Part 1 tests - def test_part2(self): Part 2 tests
Implement the Python class `TestDistance` described below. Class description: Tests for Part 1 Method signatures and docstrings: - def test_part1(self): Part 1 tests - def test_part2(self): Part 2 tests <|skeleton|> class TestDistance: """Tests for Part 1""" def test_part1(self): """Part 1 tests""" ...
ef66ed25fef416f1f5f269810e6039cab53dc6d0
<|skeleton|> class TestDistance: """Tests for Part 1""" def test_part1(self): """Part 1 tests""" <|body_0|> def test_part2(self): """Part 2 tests""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestDistance: """Tests for Part 1""" def test_part1(self): """Part 1 tests""" global DEBUG DEBUG = True for end, distance in PART1_TESTS: self.assertEqual(findManhattanDistance(1, end), distance) def test_part2(self): """Part 2 tests""" glo...
the_stack_v2_python_sparse
day03.py
AnthonyFloyd/2017-AdventOfCode-Python
train
0
519c43695818684ccb03218570d6f18b12461616
[ "n = len(nums)\nif n == 1:\n return True\njmp_lst = [False for _ in range(n)]\njmp_lst[n - 1] = True\nfor i in range(n - 2, -1, -1):\n for j in range(min(n - i - 1, nums[i]), 0, -1):\n if jmp_lst[i + j]:\n jmp_lst[i] = True\n break\nreturn jmp_lst[0]", "max_step = 0\nfor i, n in...
<|body_start_0|> n = len(nums) if n == 1: return True jmp_lst = [False for _ in range(n)] jmp_lst[n - 1] = True for i in range(n - 2, -1, -1): for j in range(min(n - i - 1, nums[i]), 0, -1): if jmp_lst[i + j]: jmp_lst[i]...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def canJump(self, nums: List[int]) -> bool: """166 / 166 test cases passed. Status: Accepted Runtime: 5652 ms Memory Usage: 15.3 MB :param nums: :return:""" <|body_0|> def canJump2(self, nums: List[int]) -> bool: """166 / 166 test cases passed. Status: Acce...
stack_v2_sparse_classes_75kplus_train_008649
2,508
permissive
[ { "docstring": "166 / 166 test cases passed. Status: Accepted Runtime: 5652 ms Memory Usage: 15.3 MB :param nums: :return:", "name": "canJump", "signature": "def canJump(self, nums: List[int]) -> bool" }, { "docstring": "166 / 166 test cases passed. Status: Accepted Runtime: 500 ms Memory Usage:...
3
stack_v2_sparse_classes_30k_train_027489
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canJump(self, nums: List[int]) -> bool: 166 / 166 test cases passed. Status: Accepted Runtime: 5652 ms Memory Usage: 15.3 MB :param nums: :return: - def canJump2(self, nums: ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canJump(self, nums: List[int]) -> bool: 166 / 166 test cases passed. Status: Accepted Runtime: 5652 ms Memory Usage: 15.3 MB :param nums: :return: - def canJump2(self, nums: ...
4dd1e54d8d08f7e6590bc76abd08ecaacaf775e5
<|skeleton|> class Solution: def canJump(self, nums: List[int]) -> bool: """166 / 166 test cases passed. Status: Accepted Runtime: 5652 ms Memory Usage: 15.3 MB :param nums: :return:""" <|body_0|> def canJump2(self, nums: List[int]) -> bool: """166 / 166 test cases passed. Status: Acce...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def canJump(self, nums: List[int]) -> bool: """166 / 166 test cases passed. Status: Accepted Runtime: 5652 ms Memory Usage: 15.3 MB :param nums: :return:""" n = len(nums) if n == 1: return True jmp_lst = [False for _ in range(n)] jmp_lst[n - 1] = T...
the_stack_v2_python_sparse
src/55-JumpGame.py
Jiezhi/myleetcode
train
1
9f656590f1f0425eb734b306babae74fd93c5c24
[ "NodePrototype.__init__(self, macroenv)\nself.version = version\nself.milestones = milestones\nself.href = vtitlehref", "msmap = dict()\nfor milestone, ticketlist in self.milestones.items():\n num = 0\n comp = 0\n for t in ticketlist:\n if t.getfielddef('status', '') == 'closed':\n comp...
<|body_start_0|> NodePrototype.__init__(self, macroenv) self.version = version self.milestones = milestones self.href = vtitlehref <|end_body_0|> <|body_start_1|> msmap = dict() for milestone, ticketlist in self.milestones.items(): num = 0 comp = ...
Base Prototype for Version Nodes Creates HTML Code for GV Nodelabels
VersionNodePrototype
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VersionNodePrototype: """Base Prototype for Version Nodes Creates HTML Code for GV Nodelabels""" def __init__(self, macroenv, version, milestones, vtitlehref): """Initialize the Base Node Prototype.""" <|body_0|> def addcompletiontable(self): """Create a Table wi...
stack_v2_sparse_classes_75kplus_train_008650
29,768
permissive
[ { "docstring": "Initialize the Base Node Prototype.", "name": "__init__", "signature": "def __init__(self, macroenv, version, milestones, vtitlehref)" }, { "docstring": "Create a Table with Completion Information for the Milestones in this Version.", "name": "addcompletiontable", "signat...
3
stack_v2_sparse_classes_30k_train_053754
Implement the Python class `VersionNodePrototype` described below. Class description: Base Prototype for Version Nodes Creates HTML Code for GV Nodelabels Method signatures and docstrings: - def __init__(self, macroenv, version, milestones, vtitlehref): Initialize the Base Node Prototype. - def addcompletiontable(sel...
Implement the Python class `VersionNodePrototype` described below. Class description: Base Prototype for Version Nodes Creates HTML Code for GV Nodelabels Method signatures and docstrings: - def __init__(self, macroenv, version, milestones, vtitlehref): Initialize the Base Node Prototype. - def addcompletiontable(sel...
9ea0210f6b88f135ef73f370b48127af0495b2d7
<|skeleton|> class VersionNodePrototype: """Base Prototype for Version Nodes Creates HTML Code for GV Nodelabels""" def __init__(self, macroenv, version, milestones, vtitlehref): """Initialize the Base Node Prototype.""" <|body_0|> def addcompletiontable(self): """Create a Table wi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VersionNodePrototype: """Base Prototype for Version Nodes Creates HTML Code for GV Nodelabels""" def __init__(self, macroenv, version, milestones, vtitlehref): """Initialize the Base Node Prototype.""" NodePrototype.__init__(self, macroenv) self.version = version self.mile...
the_stack_v2_python_sparse
trac/Lib/site-packages/projectplan-0.93.0-py2.7-patched.egg/projectplan/gvproto.py
thinkbase/PortableTrac
train
2
d33f5928e4414fbed5d4a09ae32baa2c6f413c19
[ "super(Variational, self).__init__()\nself.hidden_size = hidden_size\nself.latent_size = latent_size\nself.use_identity = use_identity\nif self.use_identity:\n self.hidden_to_mu = nn.Identity()\n self.hidden_to_tanh = nn.Linear(self.hidden_size, self.latent_size)\n self.act_tanh = nn.Tanh()\n self.than_...
<|body_start_0|> super(Variational, self).__init__() self.hidden_size = hidden_size self.latent_size = latent_size self.use_identity = use_identity if self.use_identity: self.hidden_to_mu = nn.Identity() self.hidden_to_tanh = nn.Linear(self.hidden_size, se...
Variation Layer of Variational AutoEncoder
Variational
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Variational: """Variation Layer of Variational AutoEncoder""" def __init__(self, hidden_size: int, latent_size: int, use_identity: bool=False): """Variational Args: hidden_size (int): number of features per time step (output from encoder) latent_size (int): what size the latent vecto...
stack_v2_sparse_classes_75kplus_train_008651
14,969
permissive
[ { "docstring": "Variational Args: hidden_size (int): number of features per time step (output from encoder) latent_size (int): what size the latent vector should be use_identity (bool, optional): if identity should be used. Defaults to False.", "name": "__init__", "signature": "def __init__(self, hidden...
2
stack_v2_sparse_classes_30k_train_016292
Implement the Python class `Variational` described below. Class description: Variation Layer of Variational AutoEncoder Method signatures and docstrings: - def __init__(self, hidden_size: int, latent_size: int, use_identity: bool=False): Variational Args: hidden_size (int): number of features per time step (output fr...
Implement the Python class `Variational` described below. Class description: Variation Layer of Variational AutoEncoder Method signatures and docstrings: - def __init__(self, hidden_size: int, latent_size: int, use_identity: bool=False): Variational Args: hidden_size (int): number of features per time step (output fr...
5b4a61b5dd0bc259ffe68223877949ef4ebfa5e3
<|skeleton|> class Variational: """Variation Layer of Variational AutoEncoder""" def __init__(self, hidden_size: int, latent_size: int, use_identity: bool=False): """Variational Args: hidden_size (int): number of features per time step (output from encoder) latent_size (int): what size the latent vecto...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Variational: """Variation Layer of Variational AutoEncoder""" def __init__(self, hidden_size: int, latent_size: int, use_identity: bool=False): """Variational Args: hidden_size (int): number of features per time step (output from encoder) latent_size (int): what size the latent vector should be u...
the_stack_v2_python_sparse
src/models/anomalia/layers.py
maurony/ts-vrae
train
1
153aaffd8521adacd823cc176e1c1d6ffa7f4781
[ "self._threshold = threshold\nif start_datetime is None:\n self._start_datetime = get_last_year_date()\nelse:\n self._start_datetime = start_datetime", "valid_entries = date_values_after(fin.current_ratio, self._start_datetime)\navg_ratio = sum([valid_entries.get(date_str) for date_str in valid_entries]) / ...
<|body_start_0|> self._threshold = threshold if start_datetime is None: self._start_datetime = get_last_year_date() else: self._start_datetime = start_datetime <|end_body_0|> <|body_start_1|> valid_entries = date_values_after(fin.current_ratio, self._start_dateti...
CurrentRatioScorer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CurrentRatioScorer: def __init__(self, threshold=1.5, start_datetime=None): """:param threshold: :type threshold: float :param start_datetime: :type start_datetime: datetime.datetime""" <|body_0|> def score(self, fin, log): """Compute the score for a stock :param fin...
stack_v2_sparse_classes_75kplus_train_008652
4,516
permissive
[ { "docstring": ":param threshold: :type threshold: float :param start_datetime: :type start_datetime: datetime.datetime", "name": "__init__", "signature": "def __init__(self, threshold=1.5, start_datetime=None)" }, { "docstring": "Compute the score for a stock :param fin: the morningstar financi...
2
null
Implement the Python class `CurrentRatioScorer` described below. Class description: Implement the CurrentRatioScorer class. Method signatures and docstrings: - def __init__(self, threshold=1.5, start_datetime=None): :param threshold: :type threshold: float :param start_datetime: :type start_datetime: datetime.datetim...
Implement the Python class `CurrentRatioScorer` described below. Class description: Implement the CurrentRatioScorer class. Method signatures and docstrings: - def __init__(self, threshold=1.5, start_datetime=None): :param threshold: :type threshold: float :param start_datetime: :type start_datetime: datetime.datetim...
88d0b3479d6bf92018335c74ef9afc4c20d61754
<|skeleton|> class CurrentRatioScorer: def __init__(self, threshold=1.5, start_datetime=None): """:param threshold: :type threshold: float :param start_datetime: :type start_datetime: datetime.datetime""" <|body_0|> def score(self, fin, log): """Compute the score for a stock :param fin...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CurrentRatioScorer: def __init__(self, threshold=1.5, start_datetime=None): """:param threshold: :type threshold: float :param start_datetime: :type start_datetime: datetime.datetime""" self._threshold = threshold if start_datetime is None: self._start_datetime = get_last_y...
the_stack_v2_python_sparse
pyvalue/stock_scorer.py
ltangt/pyvalue
train
0
30f4f7d23d01413805611565d8d3f7971afbaa4e
[ "if self.is_active is False:\n if deferred is True:\n DeferredMessage(user_id=self.user_id, title=title, body=body, data=data, related_type=related_type, related_id=related_id).save()\n return False\nelse:\n result = send_fcm_message(registration_id=self.registration_id, title=title, body=body, data...
<|body_start_0|> if self.is_active is False: if deferred is True: DeferredMessage(user_id=self.user_id, title=title, body=body, data=data, related_type=related_type, related_id=related_id).save() return False else: result = send_fcm_message(registratio...
Extends `Model` to keep information about devices. Device has a One to One relation. The foreign key is located on the device to allow eventually multiples devices for on user. It's a common practice, but not used in this project.
Device
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Device: """Extends `Model` to keep information about devices. Device has a One to One relation. The foreign key is located on the device to allow eventually multiples devices for on user. It's a common practice, but not used in this project.""" def send_message(self, title=None, body=None, d...
stack_v2_sparse_classes_75kplus_train_008653
5,970
no_license
[ { "docstring": "Send a push message to the device, allowing the message to be deferred if sending failed. Will mark the device as inactive if sending fails and won't try to send a message to an already inactive device. :param title: the title of the message :param body: the body of the message :param data: a Js...
2
stack_v2_sparse_classes_30k_train_032086
Implement the Python class `Device` described below. Class description: Extends `Model` to keep information about devices. Device has a One to One relation. The foreign key is located on the device to allow eventually multiples devices for on user. It's a common practice, but not used in this project. Method signatur...
Implement the Python class `Device` described below. Class description: Extends `Model` to keep information about devices. Device has a One to One relation. The foreign key is located on the device to allow eventually multiples devices for on user. It's a common practice, but not used in this project. Method signatur...
38f0b29e6fc737756ae21a8c193a110876bc221c
<|skeleton|> class Device: """Extends `Model` to keep information about devices. Device has a One to One relation. The foreign key is located on the device to allow eventually multiples devices for on user. It's a common practice, but not used in this project.""" def send_message(self, title=None, body=None, d...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Device: """Extends `Model` to keep information about devices. Device has a One to One relation. The foreign key is located on the device to allow eventually multiples devices for on user. It's a common practice, but not used in this project.""" def send_message(self, title=None, body=None, data=None, def...
the_stack_v2_python_sparse
backend/device/models.py
BenjaminSchubert/HEIG_VD_2016_PDG
train
0
60351c5539a2c0347c18b9f37b9002f77e5524b1
[ "self.selector = selector\nself.K = ParallelMean(1)\nself.C = ParallelMean(2)\nself.count = 0\nself.input_m_is_weighted = input_m_is_weighted", "data = _DataWrapper(data, '')\nsel = self.selector(data, *args, **kwargs)\nw = data['weight']\nK = data['m']\ng1 = data['g1']\ng2 = data['g2']\nn = g1[sel].size\nself.co...
<|body_start_0|> self.selector = selector self.K = ParallelMean(1) self.C = ParallelMean(2) self.count = 0 self.input_m_is_weighted = input_m_is_weighted <|end_body_0|> <|body_start_1|> data = _DataWrapper(data, '') sel = self.selector(data, *args, **kwargs) ...
This class builds up the total calibration factors for lensfit-convention shears from each chunk of data it is given. Note here we derive the c-terms from the data (in constrast to averaging values derived from simulations and stored in the catalog.) At the end an MPI communicator can be supplied to collect together th...
LensfitCalculator
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LensfitCalculator: """This class builds up the total calibration factors for lensfit-convention shears from each chunk of data it is given. Note here we derive the c-terms from the data (in constrast to averaging values derived from simulations and stored in the catalog.) At the end an MPI commun...
stack_v2_sparse_classes_75kplus_train_008654
27,539
permissive
[ { "docstring": "Initialize the Calibrator using the function you will use to select objects. That function should take at least one argument, the chunk of data to select on. The selector can take further *args and **kwargs, passed in when adding data. Parameters ---------- selector: function Function that selec...
3
stack_v2_sparse_classes_30k_train_009630
Implement the Python class `LensfitCalculator` described below. Class description: This class builds up the total calibration factors for lensfit-convention shears from each chunk of data it is given. Note here we derive the c-terms from the data (in constrast to averaging values derived from simulations and stored in...
Implement the Python class `LensfitCalculator` described below. Class description: This class builds up the total calibration factors for lensfit-convention shears from each chunk of data it is given. Note here we derive the c-terms from the data (in constrast to averaging values derived from simulations and stored in...
addbfbe6c4dc0df208ce4f7ba4cb0a7588a932e3
<|skeleton|> class LensfitCalculator: """This class builds up the total calibration factors for lensfit-convention shears from each chunk of data it is given. Note here we derive the c-terms from the data (in constrast to averaging values derived from simulations and stored in the catalog.) At the end an MPI commun...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LensfitCalculator: """This class builds up the total calibration factors for lensfit-convention shears from each chunk of data it is given. Note here we derive the c-terms from the data (in constrast to averaging values derived from simulations and stored in the catalog.) At the end an MPI communicator can be...
the_stack_v2_python_sparse
txpipe/utils/calibration_tools.py
LSSTDESC/TXPipe
train
17
1cef70cdaa1057fc13edc0274f541b81c83f30b9
[ "try:\n aminitrator = ElectionsAminitrator.objects.get(pk=pk)\n user = User.objects.get(id=aminitrator.aminitrator_id)\nexcept ElectionsAminitrator.DoesNotExist:\n return Response(status=status.HTTP_404_NOT_FOUND)\nuser.delete()\naminitrators = ElectionsAminitrator.objects.filter(author=request.user)\nseri...
<|body_start_0|> try: aminitrator = ElectionsAminitrator.objects.get(pk=pk) user = User.objects.get(id=aminitrator.aminitrator_id) except ElectionsAminitrator.DoesNotExist: return Response(status=status.HTTP_404_NOT_FOUND) user.delete() aminitrators = ...
EletionAminitratorUpdateDestroy
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EletionAminitratorUpdateDestroy: def destroy(self, request, pk=None): """删除选举活动管理员""" <|body_0|> def partial_update(self, request, pk=None): """发送邮件,并修改状态值为1,部分更新""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: aminitrator = Electio...
stack_v2_sparse_classes_75kplus_train_008655
18,195
no_license
[ { "docstring": "删除选举活动管理员", "name": "destroy", "signature": "def destroy(self, request, pk=None)" }, { "docstring": "发送邮件,并修改状态值为1,部分更新", "name": "partial_update", "signature": "def partial_update(self, request, pk=None)" } ]
2
stack_v2_sparse_classes_30k_train_044879
Implement the Python class `EletionAminitratorUpdateDestroy` described below. Class description: Implement the EletionAminitratorUpdateDestroy class. Method signatures and docstrings: - def destroy(self, request, pk=None): 删除选举活动管理员 - def partial_update(self, request, pk=None): 发送邮件,并修改状态值为1,部分更新
Implement the Python class `EletionAminitratorUpdateDestroy` described below. Class description: Implement the EletionAminitratorUpdateDestroy class. Method signatures and docstrings: - def destroy(self, request, pk=None): 删除选举活动管理员 - def partial_update(self, request, pk=None): 发送邮件,并修改状态值为1,部分更新 <|skeleton|> class ...
fd2c2bc3cc23125f5d32b5655fa104ff7c59e652
<|skeleton|> class EletionAminitratorUpdateDestroy: def destroy(self, request, pk=None): """删除选举活动管理员""" <|body_0|> def partial_update(self, request, pk=None): """发送邮件,并修改状态值为1,部分更新""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EletionAminitratorUpdateDestroy: def destroy(self, request, pk=None): """删除选举活动管理员""" try: aminitrator = ElectionsAminitrator.objects.get(pk=pk) user = User.objects.get(id=aminitrator.aminitrator_id) except ElectionsAminitrator.DoesNotExist: return R...
the_stack_v2_python_sparse
A_helios/helios2019Server/helios2019Server/election/views.py
yuanlyainihey/reactStudy
train
0
79c6dcf36a28b214983ccc7cef64c1052c0c04ab
[ "temp = sorted(nums)\nstart = -1\nend = -2\nfor i in range(len(nums)):\n if temp[i] != nums[i]:\n start = i\n break\nfor j in range(len(nums))[::-1]:\n if temp[j] != nums[j]:\n end = j\n break\nreturn end - start + 1", "start = -1\nend = -2\nn = len(nums)\nmaxcur = nums[0]\nmincu...
<|body_start_0|> temp = sorted(nums) start = -1 end = -2 for i in range(len(nums)): if temp[i] != nums[i]: start = i break for j in range(len(nums))[::-1]: if temp[j] != nums[j]: end = j break...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findUnsortedSubarray(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def findUnsortedSubarray(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> temp = sorted(nums) ...
stack_v2_sparse_classes_75kplus_train_008656
1,527
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "findUnsortedSubarray", "signature": "def findUnsortedSubarray(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "findUnsortedSubarray", "signature": "def findUnsortedSubarray(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_019293
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findUnsortedSubarray(self, nums): :type nums: List[int] :rtype: int - def findUnsortedSubarray(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findUnsortedSubarray(self, nums): :type nums: List[int] :rtype: int - def findUnsortedSubarray(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: ...
6698f83614b01e43147f869a342e0e30943f4cf3
<|skeleton|> class Solution: def findUnsortedSubarray(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def findUnsortedSubarray(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def findUnsortedSubarray(self, nums): """:type nums: List[int] :rtype: int""" temp = sorted(nums) start = -1 end = -2 for i in range(len(nums)): if temp[i] != nums[i]: start = i break for j in range(len(nums)...
the_stack_v2_python_sparse
LeetCode/Easy/Shortest_Unsorted_Continuous_Subarray.py
kongyitian/coding_interviews
train
0
bfcb2616c491d8ba0e893ad5f3c79aa9f45ba1f3
[ "if s == '':\n return ''\nss = s[::-1]\nfor i in range(len(s)):\n length = len(s) - i\n if ss[i:] == s[:length]:\n return ss + s[length:]", "if s == '':\n return ''\nss = s[::-1]\nfor i in range(len(s)):\n length = len(s) - i\n if s[i:] == ss[:length]:\n return s + ss[length:]", ...
<|body_start_0|> if s == '': return '' ss = s[::-1] for i in range(len(s)): length = len(s) - i if ss[i:] == s[:length]: return ss + s[length:] <|end_body_0|> <|body_start_1|> if s == '': return '' ss = s[::-1] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def shortestPalindrome_front(self, s: str) -> str: """暴力+串后加""" <|body_0|> def shortestPalindrome_behind(self, s: str) -> str: """暴力+串前加""" <|body_1|> def shortestPalindrome_advanced(self, s: str) -> str: """KMP 算法""" <|body_2|>...
stack_v2_sparse_classes_75kplus_train_008657
1,371
no_license
[ { "docstring": "暴力+串后加", "name": "shortestPalindrome_front", "signature": "def shortestPalindrome_front(self, s: str) -> str" }, { "docstring": "暴力+串前加", "name": "shortestPalindrome_behind", "signature": "def shortestPalindrome_behind(self, s: str) -> str" }, { "docstring": "KMP ...
3
stack_v2_sparse_classes_30k_train_022165
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def shortestPalindrome_front(self, s: str) -> str: 暴力+串后加 - def shortestPalindrome_behind(self, s: str) -> str: 暴力+串前加 - def shortestPalindrome_advanced(self, s: str) -> str: KMP...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def shortestPalindrome_front(self, s: str) -> str: 暴力+串后加 - def shortestPalindrome_behind(self, s: str) -> str: 暴力+串前加 - def shortestPalindrome_advanced(self, s: str) -> str: KMP...
57f303aa6e76f7c5292fa60bffdfddcb4ff9ddfb
<|skeleton|> class Solution: def shortestPalindrome_front(self, s: str) -> str: """暴力+串后加""" <|body_0|> def shortestPalindrome_behind(self, s: str) -> str: """暴力+串前加""" <|body_1|> def shortestPalindrome_advanced(self, s: str) -> str: """KMP 算法""" <|body_2|>...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def shortestPalindrome_front(self, s: str) -> str: """暴力+串后加""" if s == '': return '' ss = s[::-1] for i in range(len(s)): length = len(s) - i if ss[i:] == s[:length]: return ss + s[length:] def shortestPalindro...
the_stack_v2_python_sparse
4_LEETCODE/11_Interview/网易/1_最短回文串.py
fzingithub/SwordRefers2Offer
train
1
49e2858afaf4c77f2c5c2c655e6a5efa9cf9eca0
[ "self.name = name\nself.type = type\nself.required = required\nself.default = default\nself.ignore = ignore\nself.choices = choices\nself.nullable = nullable\nself.location = location\nself.discard = discard\nself.help = help", "if self.location and hasattr(request, self.location):\n req_data = getattr(request...
<|body_start_0|> self.name = name self.type = type self.required = required self.default = default self.ignore = ignore self.choices = choices self.nullable = nullable self.location = location self.discard = discard self.help = help <|end_b...
Param
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Param: def __init__(self, name, type=str, required=False, default=None, nullable=True, ignore=False, choices=None, location=None, discard=False, help=''): """请求参数对象 Args: name (str): 字段名 type (class): 类型 required (bool): 是否必填 default (any): 默认值 (必填时无效) nullable (bool): 是否非空 ignore (bool)...
stack_v2_sparse_classes_75kplus_train_008658
3,546
no_license
[ { "docstring": "请求参数对象 Args: name (str): 字段名 type (class): 类型 required (bool): 是否必填 default (any): 默认值 (必填时无效) nullable (bool): 是否非空 ignore (bool): 是否忽略类型 choices (tuple): 可选值 location (str): 访问数据源 args, json, form 默认 GET: args, POST: json discard (bool): 不存在 key, 是否不解析参数 help (str): 参数不匹配时, 返回提示", "name": ...
2
stack_v2_sparse_classes_30k_train_022519
Implement the Python class `Param` described below. Class description: Implement the Param class. Method signatures and docstrings: - def __init__(self, name, type=str, required=False, default=None, nullable=True, ignore=False, choices=None, location=None, discard=False, help=''): 请求参数对象 Args: name (str): 字段名 type (c...
Implement the Python class `Param` described below. Class description: Implement the Param class. Method signatures and docstrings: - def __init__(self, name, type=str, required=False, default=None, nullable=True, ignore=False, choices=None, location=None, discard=False, help=''): 请求参数对象 Args: name (str): 字段名 type (c...
7877724c7875fad0297f7801910f162d80c5d695
<|skeleton|> class Param: def __init__(self, name, type=str, required=False, default=None, nullable=True, ignore=False, choices=None, location=None, discard=False, help=''): """请求参数对象 Args: name (str): 字段名 type (class): 类型 required (bool): 是否必填 default (any): 默认值 (必填时无效) nullable (bool): 是否非空 ignore (bool)...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Param: def __init__(self, name, type=str, required=False, default=None, nullable=True, ignore=False, choices=None, location=None, discard=False, help=''): """请求参数对象 Args: name (str): 字段名 type (class): 类型 required (bool): 是否必填 default (any): 默认值 (必填时无效) nullable (bool): 是否非空 ignore (bool): 是否忽略类型 choic...
the_stack_v2_python_sparse
base/params.py
HeyManLean/RedisApp
train
0
fee68699409cd9530e8fd967122376d13e8b3d7c
[ "x = self.root_node.gui.dialogs.constant_handler_ASK_INTEGER(x, title='Set Mouse Cursor Position', prompt='Please input x-coordinate:')\ny = self.get_y()\nctypes.windll.user32.SetCursorPos(x, y)", "x = self.get_x()\ny = self.root_node.gui.dialogs.constant_handler_ASK_INTEGER(y, title='Set Mouse Cursor Position', ...
<|body_start_0|> x = self.root_node.gui.dialogs.constant_handler_ASK_INTEGER(x, title='Set Mouse Cursor Position', prompt='Please input x-coordinate:') y = self.get_y() ctypes.windll.user32.SetCursorPos(x, y) <|end_body_0|> <|body_start_1|> x = self.get_x() y = self.root_node.gu...
The advanced mouse node on Windows.
Mouse
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Mouse: """The advanced mouse node on Windows.""" def set_x(self, x): """Set the x-coord of the mouse pointer. x: int. The new x-coord of the mouse pointer.""" <|body_0|> def set_y(self, y): """Set the y-coord of the mouse pointer. y: int. The new y-coord of the m...
stack_v2_sparse_classes_75kplus_train_008659
18,417
no_license
[ { "docstring": "Set the x-coord of the mouse pointer. x: int. The new x-coord of the mouse pointer.", "name": "set_x", "signature": "def set_x(self, x)" }, { "docstring": "Set the y-coord of the mouse pointer. y: int. The new y-coord of the mouse pointer.", "name": "set_y", "signature": ...
3
stack_v2_sparse_classes_30k_val_000613
Implement the Python class `Mouse` described below. Class description: The advanced mouse node on Windows. Method signatures and docstrings: - def set_x(self, x): Set the x-coord of the mouse pointer. x: int. The new x-coord of the mouse pointer. - def set_y(self, y): Set the y-coord of the mouse pointer. y: int. The...
Implement the Python class `Mouse` described below. Class description: The advanced mouse node on Windows. Method signatures and docstrings: - def set_x(self, x): Set the x-coord of the mouse pointer. x: int. The new x-coord of the mouse pointer. - def set_y(self, y): Set the y-coord of the mouse pointer. y: int. The...
3945ef235ac8e7a7a66fec018597aa9b34b0a4e6
<|skeleton|> class Mouse: """The advanced mouse node on Windows.""" def set_x(self, x): """Set the x-coord of the mouse pointer. x: int. The new x-coord of the mouse pointer.""" <|body_0|> def set_y(self, y): """Set the y-coord of the mouse pointer. y: int. The new y-coord of the m...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Mouse: """The advanced mouse node on Windows.""" def set_x(self, x): """Set the x-coord of the mouse pointer. x: int. The new x-coord of the mouse pointer.""" x = self.root_node.gui.dialogs.constant_handler_ASK_INTEGER(x, title='Set Mouse Cursor Position', prompt='Please input x-coordinat...
the_stack_v2_python_sparse
wavesynlib/interfaces/os/modelnode.py
xialulee/WaveSyn
train
9
7e68252bc522fca4e46d24c4bc2df4d0bd172872
[ "Parametre.__init__(self, 'creer', 'create')\nself.schema = '<cle>'\nself.aide_courte = 'crée une auberge'\nself.aide_longue = \"Cette commande permet de créer une auberge dans la salle où vous vous trouvez. Vous devez préciser en paramètre sa clé. Notez que la salle configurée pour une auberge n'est pas une de ses...
<|body_start_0|> Parametre.__init__(self, 'creer', 'create') self.schema = '<cle>' self.aide_courte = 'crée une auberge' self.aide_longue = "Cette commande permet de créer une auberge dans la salle où vous vous trouvez. Vous devez préciser en paramètre sa clé. Notez que la salle configur...
Commande 'auberge créer'
PrmCreer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrmCreer: """Commande 'auberge créer'""" def __init__(self): """Constructeur du paramètre.""" <|body_0|> def interpreter(self, personnage, dic_masques): """Méthode d'interprétation de commande""" <|body_1|> <|end_skeleton|> <|body_start_0|> Para...
stack_v2_sparse_classes_75kplus_train_008660
2,979
permissive
[ { "docstring": "Constructeur du paramètre.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Méthode d'interprétation de commande", "name": "interpreter", "signature": "def interpreter(self, personnage, dic_masques)" } ]
2
null
Implement the Python class `PrmCreer` described below. Class description: Commande 'auberge créer' Method signatures and docstrings: - def __init__(self): Constructeur du paramètre. - def interpreter(self, personnage, dic_masques): Méthode d'interprétation de commande
Implement the Python class `PrmCreer` described below. Class description: Commande 'auberge créer' Method signatures and docstrings: - def __init__(self): Constructeur du paramètre. - def interpreter(self, personnage, dic_masques): Méthode d'interprétation de commande <|skeleton|> class PrmCreer: """Commande 'au...
7e93bff08cdf891352efba587e89c40f3b4a2301
<|skeleton|> class PrmCreer: """Commande 'auberge créer'""" def __init__(self): """Constructeur du paramètre.""" <|body_0|> def interpreter(self, personnage, dic_masques): """Méthode d'interprétation de commande""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PrmCreer: """Commande 'auberge créer'""" def __init__(self): """Constructeur du paramètre.""" Parametre.__init__(self, 'creer', 'create') self.schema = '<cle>' self.aide_courte = 'crée une auberge' self.aide_longue = "Cette commande permet de créer une auberge dans...
the_stack_v2_python_sparse
src/secondaires/auberge/commandes/auberge/creer.py
vincent-lg/tsunami
train
5
d9ceff2f4faf64b7d3047bb7efd866e979cfb194
[ "super(Method, self).__init__(model, evaluate, dtype=dtype, pos=pos)\nself.x2y_model = x2y_model\nself.num_classes = num_classes\nself.start_lr = self.model.optimizer.learning_rate.numpy()\nself.class_weight = None", "clf = erm.Method(model=self.x2y_model, dtype=self.dtype, inputs='x', outputs='y', pos=self.pos)\...
<|body_start_0|> super(Method, self).__init__(model, evaluate, dtype=dtype, pos=pos) self.x2y_model = x2y_model self.num_classes = num_classes self.start_lr = self.model.optimizer.learning_rate.numpy() self.class_weight = None <|end_body_0|> <|body_start_1|> clf = erm.Me...
Label shift baseline method.
Method
[ "Apache-2.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Method: """Label shift baseline method.""" def __init__(self, model, x2y_model, evaluate=None, num_classes=2, inputs='x', outputs='y', dtype=tf.float32, pos=None): """Constructor. Args: model: Keras model to predict Y from X. x2y_model: A second Keras model to predict y from x, which...
stack_v2_sparse_classes_75kplus_train_008661
4,868
permissive
[ { "docstring": "Constructor. Args: model: Keras model to predict Y from X. x2y_model: A second Keras model to predict y from x, which used for label correction using the confusion matrix method. evaluate: a tf.keras.metrics method. num_classes: number of classes. inputs: the input of a model, e.g. 'x' if x -> y...
4
null
Implement the Python class `Method` described below. Class description: Label shift baseline method. Method signatures and docstrings: - def __init__(self, model, x2y_model, evaluate=None, num_classes=2, inputs='x', outputs='y', dtype=tf.float32, pos=None): Constructor. Args: model: Keras model to predict Y from X. x...
Implement the Python class `Method` described below. Class description: Label shift baseline method. Method signatures and docstrings: - def __init__(self, model, x2y_model, evaluate=None, num_classes=2, inputs='x', outputs='y', dtype=tf.float32, pos=None): Constructor. Args: model: Keras model to predict Y from X. x...
5573d9c5822f4e866b6692769963ae819cb3f10d
<|skeleton|> class Method: """Label shift baseline method.""" def __init__(self, model, x2y_model, evaluate=None, num_classes=2, inputs='x', outputs='y', dtype=tf.float32, pos=None): """Constructor. Args: model: Keras model to predict Y from X. x2y_model: A second Keras model to predict y from x, which...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Method: """Label shift baseline method.""" def __init__(self, model, x2y_model, evaluate=None, num_classes=2, inputs='x', outputs='y', dtype=tf.float32, pos=None): """Constructor. Args: model: Keras model to predict Y from X. x2y_model: A second Keras model to predict y from x, which used for lab...
the_stack_v2_python_sparse
latent_shift_adaptation/latent_shift_adaptation/methods/shift_correction/bbse.py
Jimmy-INL/google-research
train
1
7a9a12f511c5ba3661570e3a207ca114377adffa
[ "with open(filename, 'r') as json_out:\n data = json.load(json_out)\n json_headers = data.keys()\n json_entries_strings = list(zip(*list(data.values())))\n return (json_headers, cls()._get_entries(json_headers, json_entries_strings))", "with open(filename, 'w') as json_out:\n entry_strings = {heade...
<|body_start_0|> with open(filename, 'r') as json_out: data = json.load(json_out) json_headers = data.keys() json_entries_strings = list(zip(*list(data.values()))) return (json_headers, cls()._get_entries(json_headers, json_entries_strings)) <|end_body_0|> <|body...
Class to save or load data from .json files of such format: { "name" : ["name_1", "name_2, ..."] "city" : ["city_1", "city_2, ..."] "age" : ["age_1", "age_2, ..."] }
JSONDataProvider
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JSONDataProvider: """Class to save or load data from .json files of such format: { "name" : ["name_1", "name_2, ..."] "city" : ["city_1", "city_2, ..."] "age" : ["age_1", "age_2, ..."] }""" def load_data(cls, filename, **kwargs): """Method to get data from csv file Args: filename (st...
stack_v2_sparse_classes_75kplus_train_008662
26,005
no_license
[ { "docstring": "Method to get data from csv file Args: filename (str): source filename with extension **kwargs : optional arguments for opening json file *23/03/18 - not defined Returns: csv_headers (list): headers of csv table csv_entries (list): rows of csv table. Each row is list of values according to csv h...
2
null
Implement the Python class `JSONDataProvider` described below. Class description: Class to save or load data from .json files of such format: { "name" : ["name_1", "name_2, ..."] "city" : ["city_1", "city_2, ..."] "age" : ["age_1", "age_2, ..."] } Method signatures and docstrings: - def load_data(cls, filename, **kwa...
Implement the Python class `JSONDataProvider` described below. Class description: Class to save or load data from .json files of such format: { "name" : ["name_1", "name_2, ..."] "city" : ["city_1", "city_2, ..."] "age" : ["age_1", "age_2, ..."] } Method signatures and docstrings: - def load_data(cls, filename, **kwa...
c627dd404e5073eff6093bbd2b35273be77520a9
<|skeleton|> class JSONDataProvider: """Class to save or load data from .json files of such format: { "name" : ["name_1", "name_2, ..."] "city" : ["city_1", "city_2, ..."] "age" : ["age_1", "age_2, ..."] }""" def load_data(cls, filename, **kwargs): """Method to get data from csv file Args: filename (st...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class JSONDataProvider: """Class to save or load data from .json files of such format: { "name" : ["name_1", "name_2, ..."] "city" : ["city_1", "city_2, ..."] "age" : ["age_1", "age_2, ..."] }""" def load_data(cls, filename, **kwargs): """Method to get data from csv file Args: filename (str): source fi...
the_stack_v2_python_sparse
task_6/data_reader.py
de-don/PyCamp2018-1
train
0
ef09edcd8877f4ccf17e1e13af43209a0e97b290
[ "resource_path = '/judges'\nmethod = 'GET'\nquery_params = {'limit': limit, 'offset': offset}\nreturn self.api_client.call_api(resource_path, method, {}, query_params)", "resource_path = '/judges'\nmethod = 'POST'\nif sourceCode == '':\n raise SphereEngineException('empty source', 400)\npost_params = {'source'...
<|body_start_0|> resource_path = '/judges' method = 'GET' query_params = {'limit': limit, 'offset': offset} return self.api_client.call_api(resource_path, method, {}, query_params) <|end_body_0|> <|body_start_1|> resource_path = '/judges' method = 'POST' if sourc...
ProblemsApiJudges
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProblemsApiJudges: def all(self, limit=10, offset=0, type='testcase'): """List of all judges :param limit: number of judges to get (default 10) :type limit: integer :param offset: starting number (default 0) :type offset: integer :returns: list of judges :rtype: json :raises SphereEngine...
stack_v2_sparse_classes_75kplus_train_008663
23,159
no_license
[ { "docstring": "List of all judges :param limit: number of judges to get (default 10) :type limit: integer :param offset: starting number (default 0) :type offset: integer :returns: list of judges :rtype: json :raises SphereEngineException: code 401 for invalid access token", "name": "all", "signature":...
4
stack_v2_sparse_classes_30k_val_000998
Implement the Python class `ProblemsApiJudges` described below. Class description: Implement the ProblemsApiJudges class. Method signatures and docstrings: - def all(self, limit=10, offset=0, type='testcase'): List of all judges :param limit: number of judges to get (default 10) :type limit: integer :param offset: st...
Implement the Python class `ProblemsApiJudges` described below. Class description: Implement the ProblemsApiJudges class. Method signatures and docstrings: - def all(self, limit=10, offset=0, type='testcase'): List of all judges :param limit: number of judges to get (default 10) :type limit: integer :param offset: st...
2b9ddbea0f9173754dfeb4f4e651a7c5a275bf52
<|skeleton|> class ProblemsApiJudges: def all(self, limit=10, offset=0, type='testcase'): """List of all judges :param limit: number of judges to get (default 10) :type limit: integer :param offset: starting number (default 0) :type offset: integer :returns: list of judges :rtype: json :raises SphereEngine...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ProblemsApiJudges: def all(self, limit=10, offset=0, type='testcase'): """List of all judges :param limit: number of judges to get (default 10) :type limit: integer :param offset: starting number (default 0) :type offset: integer :returns: list of judges :rtype: json :raises SphereEngineException: cod...
the_stack_v2_python_sparse
build/lib/sphere_engine/apis/problems.py
rucamedia/python-client
train
1
6f2f49270da19c3bdbb27944f047d8b9ad45b9c0
[ "self.side = side\nself.cells: DefaultDict[Cell, Power] = defaultdict(int)\nfor x, y in product(range(side), range(side)):\n self.cells[x, y] = self.get_power_level(x, y, serial)", "grid = [['.' for _ in range(self.side)] for _ in range(self.side)]\nfor cell, value in self.cells.items():\n x, y = cell\n ...
<|body_start_0|> self.side = side self.cells: DefaultDict[Cell, Power] = defaultdict(int) for x, y in product(range(side), range(side)): self.cells[x, y] = self.get_power_level(x, y, serial) <|end_body_0|> <|body_start_1|> grid = [['.' for _ in range(self.side)] for _ in ran...
Power grid.
Grid
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Grid: """Power grid.""" def __init__(self, serial: int, side: int) -> None: """Where serial is grid serial number and side is a side length.""" <|body_0|> def show(self) -> None: """Plot a human readable grid image.""" <|body_1|> def get_power_level(...
stack_v2_sparse_classes_75kplus_train_008664
2,502
permissive
[ { "docstring": "Where serial is grid serial number and side is a side length.", "name": "__init__", "signature": "def __init__(self, serial: int, side: int) -> None" }, { "docstring": "Plot a human readable grid image.", "name": "show", "signature": "def show(self) -> None" }, { ...
5
stack_v2_sparse_classes_30k_train_052422
Implement the Python class `Grid` described below. Class description: Power grid. Method signatures and docstrings: - def __init__(self, serial: int, side: int) -> None: Where serial is grid serial number and side is a side length. - def show(self) -> None: Plot a human readable grid image. - def get_power_level(x: i...
Implement the Python class `Grid` described below. Class description: Power grid. Method signatures and docstrings: - def __init__(self, serial: int, side: int) -> None: Where serial is grid serial number and side is a side length. - def show(self) -> None: Plot a human readable grid image. - def get_power_level(x: i...
4b8ac6a97859b1320f77ba0ee91168b58db28cdb
<|skeleton|> class Grid: """Power grid.""" def __init__(self, serial: int, side: int) -> None: """Where serial is grid serial number and side is a side length.""" <|body_0|> def show(self) -> None: """Plot a human readable grid image.""" <|body_1|> def get_power_level(...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Grid: """Power grid.""" def __init__(self, serial: int, side: int) -> None: """Where serial is grid serial number and side is a side length.""" self.side = side self.cells: DefaultDict[Cell, Power] = defaultdict(int) for x, y in product(range(side), range(side)): ...
the_stack_v2_python_sparse
src/year2018/day11a.py
lancelote/advent_of_code
train
11
95db108faa8810da1b4e78c4be66ecd787466d71
[ "config = Config()\ndirectory = config.agent_cache_directory(PATTOO_API_AGENT_NAME)\nself._batch_id = int(time.time() * 1000)\nself._data = files.read_json_files(directory, die=False, age=age, count=batch_size)\nself.files = len(self._data)", "_cache = {}\nresult = []\nfor filepath, json_data in sorted(self._data...
<|body_start_0|> config = Config() directory = config.agent_cache_directory(PATTOO_API_AGENT_NAME) self._batch_id = int(time.time() * 1000) self._data = files.read_json_files(directory, die=False, age=age, count=batch_size) self.files = len(self._data) <|end_body_0|> <|body_star...
Process ingest cache data.
Cache
[ "GPL-3.0-only" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Cache: """Process ingest cache data.""" def __init__(self, batch_size=500, age=0): """Initialize the class. Args: batch_size: Number of files to read age: Minimum age of files to be read per batch Returns: None""" <|body_0|> def records(self): """Create PattooDBr...
stack_v2_sparse_classes_75kplus_train_008665
8,665
permissive
[ { "docstring": "Initialize the class. Args: batch_size: Number of files to read age: Minimum age of files to be read per batch Returns: None", "name": "__init__", "signature": "def __init__(self, batch_size=500, age=0)" }, { "docstring": "Create PattooDBrecord objects from cache directory. Args:...
4
stack_v2_sparse_classes_30k_train_051432
Implement the Python class `Cache` described below. Class description: Process ingest cache data. Method signatures and docstrings: - def __init__(self, batch_size=500, age=0): Initialize the class. Args: batch_size: Number of files to read age: Minimum age of files to be read per batch Returns: None - def records(se...
Implement the Python class `Cache` described below. Class description: Process ingest cache data. Method signatures and docstrings: - def __init__(self, batch_size=500, age=0): Initialize the class. Args: batch_size: Number of files to read age: Minimum age of files to be read per batch Returns: None - def records(se...
57bd3e82e49d51e3426b13ad53ed8326a735ce29
<|skeleton|> class Cache: """Process ingest cache data.""" def __init__(self, batch_size=500, age=0): """Initialize the class. Args: batch_size: Number of files to read age: Minimum age of files to be read per batch Returns: None""" <|body_0|> def records(self): """Create PattooDBr...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Cache: """Process ingest cache data.""" def __init__(self, batch_size=500, age=0): """Initialize the class. Args: batch_size: Number of files to read age: Minimum age of files to be read per batch Returns: None""" config = Config() directory = config.agent_cache_directory(PATTOO_A...
the_stack_v2_python_sparse
pattoo/ingest/files.py
palisadoes/pattoo
train
0
6215eccb15e0e896dd77acd84021aed3b3bebca8
[ "if not email:\n raise ValueError('Users must have an email address')\nuser = self.model(username=username, email=self.normalize_email(email))\nuser.set_password(password)\nuser.save(using=self._db)\nreturn user", "if not email:\n raise ValueError('The given email must be set')\nemail = MyUserManager.normal...
<|body_start_0|> if not email: raise ValueError('Users must have an email address') user = self.model(username=username, email=self.normalize_email(email)) user.set_password(password) user.save(using=self._db) return user <|end_body_0|> <|body_start_1|> if no...
MyUserManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyUserManager: def create_user(self, email, username, password=None): """Creates and saves a User with the given email and password.""" <|body_0|> def create_superuser(self, email, username, password): """Creates and saves a superuser with the given email and passwor...
stack_v2_sparse_classes_75kplus_train_008666
18,918
no_license
[ { "docstring": "Creates and saves a User with the given email and password.", "name": "create_user", "signature": "def create_user(self, email, username, password=None)" }, { "docstring": "Creates and saves a superuser with the given email and password.", "name": "create_superuser", "sig...
2
null
Implement the Python class `MyUserManager` described below. Class description: Implement the MyUserManager class. Method signatures and docstrings: - def create_user(self, email, username, password=None): Creates and saves a User with the given email and password. - def create_superuser(self, email, username, passwor...
Implement the Python class `MyUserManager` described below. Class description: Implement the MyUserManager class. Method signatures and docstrings: - def create_user(self, email, username, password=None): Creates and saves a User with the given email and password. - def create_superuser(self, email, username, passwor...
b01bdffd015df84e9258cd8fdb7db2c075a7586b
<|skeleton|> class MyUserManager: def create_user(self, email, username, password=None): """Creates and saves a User with the given email and password.""" <|body_0|> def create_superuser(self, email, username, password): """Creates and saves a superuser with the given email and passwor...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MyUserManager: def create_user(self, email, username, password=None): """Creates and saves a User with the given email and password.""" if not email: raise ValueError('Users must have an email address') user = self.model(username=username, email=self.normalize_email(email))...
the_stack_v2_python_sparse
administration/models.py
ganicas/basic_django
train
0
1bcc744dc03056f586cf3454139a69a1f6127246
[ "nodes = list()\nstack = list()\nstack.append(root)\nnodes.append(root)\nwhile stack:\n root = stack.pop(0)\n left, right = (root.left, root.right)\n nodes.append(left)\n nodes.append(right)\n if left:\n stack.append(left)\n if right:\n stack.append(right)\nwhile nodes and nodes[-1] ...
<|body_start_0|> nodes = list() stack = list() stack.append(root) nodes.append(root) while stack: root = stack.pop(0) left, right = (root.left, root.right) nodes.append(left) nodes.append(right) if left: ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_75kplus_train_008667
4,016
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_037218
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
6b24724da055a08510c83c645455eaa4ed201298
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" nodes = list() stack = list() stack.append(root) nodes.append(root) while stack: root = stack.pop(0) left, right = (root.left, roo...
the_stack_v2_python_sparse
Tree/python/leetcode/serialize_and_deserialize_binary_tree.py
sankeerth/Algorithms
train
0
c7ef827ce147272a79b8be95db96945f6f67e493
[ "import collections\nif len(s) != len(t):\n return False\nfreq_map1, freq_map2 = (collections.defaultdict(int), collections.defaultdict(int))\nfor i in xrange(len(s)):\n freq_map1[s[i]] += 1\n freq_map2[t[i]] += 1\nreturn freq_map1 == freq_map2", "a = ''.join(sorted(list(s)))\nb = ''.join(sorted(list(t))...
<|body_start_0|> import collections if len(s) != len(t): return False freq_map1, freq_map2 = (collections.defaultdict(int), collections.defaultdict(int)) for i in xrange(len(s)): freq_map1[s[i]] += 1 freq_map2[t[i]] += 1 return freq_map1 == fre...
https://leetcode.com/problems/valid-anagram/solution/
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """https://leetcode.com/problems/valid-anagram/solution/""" def isAnagram(self, s, t): """Tech1: create frequency maps for both and compare these maps. Time: O(n) Space: O(n)""" <|body_0|> def isAnagram_sorting(self, s, t): """Tech2: If you don't want t...
stack_v2_sparse_classes_75kplus_train_008668
858
no_license
[ { "docstring": "Tech1: create frequency maps for both and compare these maps. Time: O(n) Space: O(n)", "name": "isAnagram", "signature": "def isAnagram(self, s, t)" }, { "docstring": "Tech2: If you don't want to use extra space, sort both strings and compare. Time: O(nlogn) Space: O(1)", "na...
2
stack_v2_sparse_classes_30k_train_012494
Implement the Python class `Solution` described below. Class description: https://leetcode.com/problems/valid-anagram/solution/ Method signatures and docstrings: - def isAnagram(self, s, t): Tech1: create frequency maps for both and compare these maps. Time: O(n) Space: O(n) - def isAnagram_sorting(self, s, t): Tech2...
Implement the Python class `Solution` described below. Class description: https://leetcode.com/problems/valid-anagram/solution/ Method signatures and docstrings: - def isAnagram(self, s, t): Tech1: create frequency maps for both and compare these maps. Time: O(n) Space: O(n) - def isAnagram_sorting(self, s, t): Tech2...
57212d700dfba0db4925d9d4896f7f0b9635a5b5
<|skeleton|> class Solution: """https://leetcode.com/problems/valid-anagram/solution/""" def isAnagram(self, s, t): """Tech1: create frequency maps for both and compare these maps. Time: O(n) Space: O(n)""" <|body_0|> def isAnagram_sorting(self, s, t): """Tech2: If you don't want t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: """https://leetcode.com/problems/valid-anagram/solution/""" def isAnagram(self, s, t): """Tech1: create frequency maps for both and compare these maps. Time: O(n) Space: O(n)""" import collections if len(s) != len(t): return False freq_map1, freq_map2...
the_stack_v2_python_sparse
valid_anagrams.py
baloooo/coding_practice
train
0
474c9af46b678c23d9667474c7f87ce251ba55fb
[ "try:\n return [x for x, in self.all()]\nexcept ValueError as e:\n raise MultipleValuesFound(str(e))", "result = super().first()\ntry:\n if len(result) == 1:\n return result[0]\nexcept:\n return result" ]
<|body_start_0|> try: return [x for x, in self.all()] except ValueError as e: raise MultipleValuesFound(str(e)) <|end_body_0|> <|body_start_1|> result = super().first() try: if len(result) == 1: return result[0] except: ...
Custom SQLAlchemy query class.
Query
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Query: """Custom SQLAlchemy query class.""" def values(self): """Returns an iterable of all scalar element values from rows matched by this query. Returns: List of scalars. Raises: MultipleValuesFound: If result rows have more than one element.""" <|body_0|> def first(se...
stack_v2_sparse_classes_75kplus_train_008669
21,205
no_license
[ { "docstring": "Returns an iterable of all scalar element values from rows matched by this query. Returns: List of scalars. Raises: MultipleValuesFound: If result rows have more than one element.", "name": "values", "signature": "def values(self)" }, { "docstring": "Modified to return a Python s...
2
stack_v2_sparse_classes_30k_train_038845
Implement the Python class `Query` described below. Class description: Custom SQLAlchemy query class. Method signatures and docstrings: - def values(self): Returns an iterable of all scalar element values from rows matched by this query. Returns: List of scalars. Raises: MultipleValuesFound: If result rows have more ...
Implement the Python class `Query` described below. Class description: Custom SQLAlchemy query class. Method signatures and docstrings: - def values(self): Returns an iterable of all scalar element values from rows matched by this query. Returns: List of scalars. Raises: MultipleValuesFound: If result rows have more ...
1924e1545ed0626e144da92391438e0621ac6daa
<|skeleton|> class Query: """Custom SQLAlchemy query class.""" def values(self): """Returns an iterable of all scalar element values from rows matched by this query. Returns: List of scalars. Raises: MultipleValuesFound: If result rows have more than one element.""" <|body_0|> def first(se...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Query: """Custom SQLAlchemy query class.""" def values(self): """Returns an iterable of all scalar element values from rows matched by this query. Returns: List of scalars. Raises: MultipleValuesFound: If result rows have more than one element.""" try: return [x for x, in self...
the_stack_v2_python_sparse
Knowledge_Database_App/storage/orm_core.py
lnabergall/knowledge-database
train
0
7d4854cc764b09c2d494f9a25613f258522aacce
[ "self._load_dictionary()\nself._get_input(msg=msg)\nself._rotate(cipher)\nself._validate()\nself._output()", "if isfile(PATH):\n with open(PATH, 'r') as file:\n for line in file.readlines():\n self.dictionary.append(line.strip())\nelse:\n print(\"Dictionary file '{}' not found\".format(PAT...
<|body_start_0|> self._load_dictionary() self._get_input(msg=msg) self._rotate(cipher) self._validate() self._output() <|end_body_0|> <|body_start_1|> if isfile(PATH): with open(PATH, 'r') as file: for line in file.readlines(): ...
Simple ROT bruteforcer to check if a certain string is ROT encoded
ROTCodec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ROTCodec: """Simple ROT bruteforcer to check if a certain string is ROT encoded""" def encode(self, cipher=None, msg=''): """Rot encode, if no cipher specified encode by all 25 ciphers possible""" <|body_0|> def _load_dictionary(self, PATH='dictionary.txt'): """L...
stack_v2_sparse_classes_75kplus_train_008670
3,491
no_license
[ { "docstring": "Rot encode, if no cipher specified encode by all 25 ciphers possible", "name": "encode", "signature": "def encode(self, cipher=None, msg='')" }, { "docstring": "Load dictionary file", "name": "_load_dictionary", "signature": "def _load_dictionary(self, PATH='dictionary.tx...
6
null
Implement the Python class `ROTCodec` described below. Class description: Simple ROT bruteforcer to check if a certain string is ROT encoded Method signatures and docstrings: - def encode(self, cipher=None, msg=''): Rot encode, if no cipher specified encode by all 25 ciphers possible - def _load_dictionary(self, PATH...
Implement the Python class `ROTCodec` described below. Class description: Simple ROT bruteforcer to check if a certain string is ROT encoded Method signatures and docstrings: - def encode(self, cipher=None, msg=''): Rot encode, if no cipher specified encode by all 25 ciphers possible - def _load_dictionary(self, PATH...
3f546cf463fed1dab53b03ed11ce723a5ffb2c1c
<|skeleton|> class ROTCodec: """Simple ROT bruteforcer to check if a certain string is ROT encoded""" def encode(self, cipher=None, msg=''): """Rot encode, if no cipher specified encode by all 25 ciphers possible""" <|body_0|> def _load_dictionary(self, PATH='dictionary.txt'): """L...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ROTCodec: """Simple ROT bruteforcer to check if a certain string is ROT encoded""" def encode(self, cipher=None, msg=''): """Rot encode, if no cipher specified encode by all 25 ciphers possible""" self._load_dictionary() self._get_input(msg=msg) self._rotate(cipher) ...
the_stack_v2_python_sparse
codec/ROT/main.py
Davincible/pycharm-projects
train
0
69720234042a8feb576a5a9455428b62b7ab5d19
[ "rows = []\nfor neighbor in neighbors:\n v4Addr = (ipnetwork.sprint_addr(neighbor.transportAddressV4.addr),)\n v6Addr = (ipnetwork.sprint_addr(neighbor.transportAddressV6.addr),)\n helloMsgSentTimeDelta = str(datetime.timedelta(milliseconds=neighbor.lastHelloMsgSentTimeDelta))\n handshakeMsgSentTimeDelt...
<|body_start_0|> rows = [] for neighbor in neighbors: v4Addr = (ipnetwork.sprint_addr(neighbor.transportAddressV4.addr),) v6Addr = (ipnetwork.sprint_addr(neighbor.transportAddressV6.addr),) helloMsgSentTimeDelta = str(datetime.timedelta(milliseconds=neighbor.lastHello...
SparkBaseCmd
[ "MIT", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SparkBaseCmd: def print_spark_neighbors_detailed(self, neighbors: Sequence[SparkNeighbor]) -> None: """Construct print lines of Spark neighbors in detailed fashion""" <|body_0|> def print_spark_neighbors(self, neighbors: Sequence[SparkNeighbor]) -> None: """Render ne...
stack_v2_sparse_classes_75kplus_train_008671
9,796
permissive
[ { "docstring": "Construct print lines of Spark neighbors in detailed fashion", "name": "print_spark_neighbors_detailed", "signature": "def print_spark_neighbors_detailed(self, neighbors: Sequence[SparkNeighbor]) -> None" }, { "docstring": "Render neighbors without details", "name": "print_sp...
2
stack_v2_sparse_classes_30k_train_046778
Implement the Python class `SparkBaseCmd` described below. Class description: Implement the SparkBaseCmd class. Method signatures and docstrings: - def print_spark_neighbors_detailed(self, neighbors: Sequence[SparkNeighbor]) -> None: Construct print lines of Spark neighbors in detailed fashion - def print_spark_neigh...
Implement the Python class `SparkBaseCmd` described below. Class description: Implement the SparkBaseCmd class. Method signatures and docstrings: - def print_spark_neighbors_detailed(self, neighbors: Sequence[SparkNeighbor]) -> None: Construct print lines of Spark neighbors in detailed fashion - def print_spark_neigh...
8e4c6e553f0314763c1595dd6097dd578d771f1c
<|skeleton|> class SparkBaseCmd: def print_spark_neighbors_detailed(self, neighbors: Sequence[SparkNeighbor]) -> None: """Construct print lines of Spark neighbors in detailed fashion""" <|body_0|> def print_spark_neighbors(self, neighbors: Sequence[SparkNeighbor]) -> None: """Render ne...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SparkBaseCmd: def print_spark_neighbors_detailed(self, neighbors: Sequence[SparkNeighbor]) -> None: """Construct print lines of Spark neighbors in detailed fashion""" rows = [] for neighbor in neighbors: v4Addr = (ipnetwork.sprint_addr(neighbor.transportAddressV4.addr),) ...
the_stack_v2_python_sparse
openr/py/openr/cli/commands/spark.py
facebook/openr
train
936
0984bb7e449fa26ac0128fd9474a8f77550e927a
[ "headers = {'Content-Type': 'application/json;charset=UTF-8'}\nrequest_url = 'http://uatopenapi.crm.yxqiche.com/baseapi/Account/Login'\nrequest_data = {'sourceFlag': 2, 'account': 'wangquan1', 'password': 'uat.portal'}\nresponse_data = requests.post(request_url, json.dumps(request_data), headers=headers).json()\nse...
<|body_start_0|> headers = {'Content-Type': 'application/json;charset=UTF-8'} request_url = 'http://uatopenapi.crm.yxqiche.com/baseapi/Account/Login' request_data = {'sourceFlag': 2, 'account': 'wangquan1', 'password': 'uat.portal'} response_data = requests.post(request_url, json.dumps(r...
TestLogin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestLogin: def test1_wrong_name(self): """测试输入的用户不存在""" <|body_0|> def test2_wrong_pwd(self): """测试输入的密码不正确""" <|body_1|> def test3_no_name(self): """测试不输入用户名""" <|body_2|> def test4_no_pwd(self): """测试不输入密码""" <|body...
stack_v2_sparse_classes_75kplus_train_008672
3,521
no_license
[ { "docstring": "测试输入的用户不存在", "name": "test1_wrong_name", "signature": "def test1_wrong_name(self)" }, { "docstring": "测试输入的密码不正确", "name": "test2_wrong_pwd", "signature": "def test2_wrong_pwd(self)" }, { "docstring": "测试不输入用户名", "name": "test3_no_name", "signature": "def ...
5
null
Implement the Python class `TestLogin` described below. Class description: Implement the TestLogin class. Method signatures and docstrings: - def test1_wrong_name(self): 测试输入的用户不存在 - def test2_wrong_pwd(self): 测试输入的密码不正确 - def test3_no_name(self): 测试不输入用户名 - def test4_no_pwd(self): 测试不输入密码 - def test5_right(self): 测试...
Implement the Python class `TestLogin` described below. Class description: Implement the TestLogin class. Method signatures and docstrings: - def test1_wrong_name(self): 测试输入的用户不存在 - def test2_wrong_pwd(self): 测试输入的密码不正确 - def test3_no_name(self): 测试不输入用户名 - def test4_no_pwd(self): 测试不输入密码 - def test5_right(self): 测试...
204856bd33c06d25f2970eba13799db75d4fd4fe
<|skeleton|> class TestLogin: def test1_wrong_name(self): """测试输入的用户不存在""" <|body_0|> def test2_wrong_pwd(self): """测试输入的密码不正确""" <|body_1|> def test3_no_name(self): """测试不输入用户名""" <|body_2|> def test4_no_pwd(self): """测试不输入密码""" <|body...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestLogin: def test1_wrong_name(self): """测试输入的用户不存在""" headers = {'Content-Type': 'application/json;charset=UTF-8'} request_url = 'http://uatopenapi.crm.yxqiche.com/baseapi/Account/Login' request_data = {'sourceFlag': 2, 'account': 'wangquan1', 'password': 'uat.portal'} ...
the_stack_v2_python_sparse
mc/xmdCW/testcase/test_login.py
boeai/mc
train
0
17cac3f29858b7edb8053fab35a6f5e04545cc6f
[ "if verbose:\n print('SQL Database type %s verbose=%s' % (db_dict, verbose))\nsuper(SQLLastScanTable, self).__init__(db_dict, dbtype, verbose)\nself.connection = None", "try:\n print('database characteristics')\n for key in self.db_dict:\n print('%s: %s' % (key, self.db_dict[key]))\nexcept ValueE...
<|body_start_0|> if verbose: print('SQL Database type %s verbose=%s' % (db_dict, verbose)) super(SQLLastScanTable, self).__init__(db_dict, dbtype, verbose) self.connection = None <|end_body_0|> <|body_start_1|> try: print('database characteristics') ...
SQL table for Last scan
SQLLastScanTable
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SQLLastScanTable: """SQL table for Last scan""" def __init__(self, db_dict, dbtype, verbose): """Pass through to SQL""" <|body_0|> def db_info(self): """Display the db info and Return info on the database used as a dictionary.""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_75kplus_train_008673
6,482
permissive
[ { "docstring": "Pass through to SQL", "name": "__init__", "signature": "def __init__(self, db_dict, dbtype, verbose)" }, { "docstring": "Display the db info and Return info on the database used as a dictionary.", "name": "db_info", "signature": "def db_info(self)" } ]
2
stack_v2_sparse_classes_30k_train_043800
Implement the Python class `SQLLastScanTable` described below. Class description: SQL table for Last scan Method signatures and docstrings: - def __init__(self, db_dict, dbtype, verbose): Pass through to SQL - def db_info(self): Display the db info and Return info on the database used as a dictionary.
Implement the Python class `SQLLastScanTable` described below. Class description: SQL table for Last scan Method signatures and docstrings: - def __init__(self, db_dict, dbtype, verbose): Pass through to SQL - def db_info(self): Display the db info and Return info on the database used as a dictionary. <|skeleton|> c...
9c60b3489f02592bd9099b8719ca23ae43a9eaa5
<|skeleton|> class SQLLastScanTable: """SQL table for Last scan""" def __init__(self, db_dict, dbtype, verbose): """Pass through to SQL""" <|body_0|> def db_info(self): """Display the db info and Return info on the database used as a dictionary.""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SQLLastScanTable: """SQL table for Last scan""" def __init__(self, db_dict, dbtype, verbose): """Pass through to SQL""" if verbose: print('SQL Database type %s verbose=%s' % (db_dict, verbose)) super(SQLLastScanTable, self).__init__(db_dict, dbtype, verbose) s...
the_stack_v2_python_sparse
smipyping/_lastscantable.py
KSchopmeyer/smipyping
train
0
8177090727343302afe93f36330edf7e29ebb479
[ "courses = []\nuser = self.context['user']\nmodules = user.profile.purchased_modules.all()\nfor module in modules:\n course_id = self.course_in_courses(module.course.mnemo, courses)\n if course_id:\n courses[course_id[0]]['modules'].append({'mnemo': module.mnemo})\n else:\n courses.append({'m...
<|body_start_0|> courses = [] user = self.context['user'] modules = user.profile.purchased_modules.all() for module in modules: course_id = self.course_in_courses(module.course.mnemo, courses) if course_id: courses[course_id[0]]['modules'].append({...
UserInfoSerializer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserInfoSerializer: def get_courses(self, *args): """Return purchased modules embedded in courses""" <|body_0|> def course_in_courses(self, mnemo, courses): """Check whether corresponding to 'mnemo' course is in 'courses'. Return tuple (course_id,) if course mnemo fo...
stack_v2_sparse_classes_75kplus_train_008674
5,467
permissive
[ { "docstring": "Return purchased modules embedded in courses", "name": "get_courses", "signature": "def get_courses(self, *args)" }, { "docstring": "Check whether corresponding to 'mnemo' course is in 'courses'. Return tuple (course_id,) if course mnemo found in courses, return False otherwise."...
2
stack_v2_sparse_classes_30k_train_050420
Implement the Python class `UserInfoSerializer` described below. Class description: Implement the UserInfoSerializer class. Method signatures and docstrings: - def get_courses(self, *args): Return purchased modules embedded in courses - def course_in_courses(self, mnemo, courses): Check whether corresponding to 'mnem...
Implement the Python class `UserInfoSerializer` described below. Class description: Implement the UserInfoSerializer class. Method signatures and docstrings: - def get_courses(self, *args): Return purchased modules embedded in courses - def course_in_courses(self, mnemo, courses): Check whether corresponding to 'mnem...
860d1c1214de125346c0accc4ec4b8953297231b
<|skeleton|> class UserInfoSerializer: def get_courses(self, *args): """Return purchased modules embedded in courses""" <|body_0|> def course_in_courses(self, mnemo, courses): """Check whether corresponding to 'mnemo' course is in 'courses'. Return tuple (course_id,) if course mnemo fo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserInfoSerializer: def get_courses(self, *args): """Return purchased modules embedded in courses""" courses = [] user = self.context['user'] modules = user.profile.purchased_modules.all() for module in modules: course_id = self.course_in_courses(module.cour...
the_stack_v2_python_sparse
src/user/serializers.py
xgerinx/skillsitev2
train
0
7f19ff2f16af84465bc9bee957980679fadcd9ea
[ "image_array = gdal_array.numpy.frombuffer(image.tobytes(), 'b')\nimage_array.shape = (image.im.size[1], image.im.size[0])\nreturn image_array", "ulx = geomatrix[0]\nuly = geomatrix[3]\nx_dist = geomatrix[1]\npixel = int((x - ulx) / x_dist)\nline = int((uly - y) / x_dist)\nreturn (pixel, line)" ]
<|body_start_0|> image_array = gdal_array.numpy.frombuffer(image.tobytes(), 'b') image_array.shape = (image.im.size[1], image.im.size[0]) return image_array <|end_body_0|> <|body_start_1|> ulx = geomatrix[0] uly = geomatrix[3] x_dist = geomatrix[1] pixel = int((x...
CHANGE
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CHANGE: def image_to_array(self, image): """将一个Python图像库的数组转换为一个gdal_array图片""" <|body_0|> def world_to_pixel(self, geomatrix, x, y): """使用GDAL库的geomatrix对象((gdal.GetGeoTransform()))计算地理坐标的像素位置""" <|body_1|> <|end_skeleton|> <|body_start_0|> image_a...
stack_v2_sparse_classes_75kplus_train_008675
2,938
no_license
[ { "docstring": "将一个Python图像库的数组转换为一个gdal_array图片", "name": "image_to_array", "signature": "def image_to_array(self, image)" }, { "docstring": "使用GDAL库的geomatrix对象((gdal.GetGeoTransform()))计算地理坐标的像素位置", "name": "world_to_pixel", "signature": "def world_to_pixel(self, geomatrix, x, y)" }...
2
stack_v2_sparse_classes_30k_train_037248
Implement the Python class `CHANGE` described below. Class description: Implement the CHANGE class. Method signatures and docstrings: - def image_to_array(self, image): 将一个Python图像库的数组转换为一个gdal_array图片 - def world_to_pixel(self, geomatrix, x, y): 使用GDAL库的geomatrix对象((gdal.GetGeoTransform()))计算地理坐标的像素位置
Implement the Python class `CHANGE` described below. Class description: Implement the CHANGE class. Method signatures and docstrings: - def image_to_array(self, image): 将一个Python图像库的数组转换为一个gdal_array图片 - def world_to_pixel(self, geomatrix, x, y): 使用GDAL库的geomatrix对象((gdal.GetGeoTransform()))计算地理坐标的像素位置 <|skeleton|> ...
23fec47eb56af7efad06f594e23a3b3e78ed94f8
<|skeleton|> class CHANGE: def image_to_array(self, image): """将一个Python图像库的数组转换为一个gdal_array图片""" <|body_0|> def world_to_pixel(self, geomatrix, x, y): """使用GDAL库的geomatrix对象((gdal.GetGeoTransform()))计算地理坐标的像素位置""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CHANGE: def image_to_array(self, image): """将一个Python图像库的数组转换为一个gdal_array图片""" image_array = gdal_array.numpy.frombuffer(image.tobytes(), 'b') image_array.shape = (image.im.size[1], image.im.size[0]) return image_array def world_to_pixel(self, geomatrix, x, y): ""...
the_stack_v2_python_sparse
拼接与裁剪/clip.py
ThinkBlue1991/tools
train
1
f0afac49ef8df28f8c3c859259004ecdbcebae64
[ "super(VariationalAutoEncoder, self).__init__(name=name)\nif preprocess_layers is None:\n self._preprocess_layers = tf.keras.Sequential(layers=[tf.keras.layers.Dense(2 * hidden_dim, activation='tanh') for i in range(2)], name=name + '/preprocess')\nelse:\n self._preprocess_layers = preprocess_layers\nself._hi...
<|body_start_0|> super(VariationalAutoEncoder, self).__init__(name=name) if preprocess_layers is None: self._preprocess_layers = tf.keras.Sequential(layers=[tf.keras.layers.Dense(2 * hidden_dim, activation='tanh') for i in range(2)], name=name + '/preprocess') else: self....
VariationalAutoEncoder encodes data into diagonal multivariate gaussian, performs sampling with reparametrization trick, and returns kl divergence between posterior and prior. Mathematically: log p(x) >= E_z log P(x|z) - beta KL(q(z|x) || prior(z)) sampling_forward method returns sampled z and KL, it is up to user of t...
VariationalAutoEncoder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VariationalAutoEncoder: """VariationalAutoEncoder encodes data into diagonal multivariate gaussian, performs sampling with reparametrization trick, and returns kl divergence between posterior and prior. Mathematically: log p(x) >= E_z log P(x|z) - beta KL(q(z|x) || prior(z)) sampling_forward meth...
stack_v2_sparse_classes_75kplus_train_008676
4,438
permissive
[ { "docstring": "Create an instance of `VariationalAutoEncoder`. Args: hidden_dim (int): dimension of latent vector prior_network (keras.Model): network to compute the priors (mean, log_var) preprocess_layers (keras.Layer): layers to preprocess input data before project into (mean, log_var) beta (float): the wei...
2
stack_v2_sparse_classes_30k_train_010265
Implement the Python class `VariationalAutoEncoder` described below. Class description: VariationalAutoEncoder encodes data into diagonal multivariate gaussian, performs sampling with reparametrization trick, and returns kl divergence between posterior and prior. Mathematically: log p(x) >= E_z log P(x|z) - beta KL(q(...
Implement the Python class `VariationalAutoEncoder` described below. Class description: VariationalAutoEncoder encodes data into diagonal multivariate gaussian, performs sampling with reparametrization trick, and returns kl divergence between posterior and prior. Mathematically: log p(x) >= E_z log P(x|z) - beta KL(q(...
38a3621337a030f74bb3944d7695e7642e777e10
<|skeleton|> class VariationalAutoEncoder: """VariationalAutoEncoder encodes data into diagonal multivariate gaussian, performs sampling with reparametrization trick, and returns kl divergence between posterior and prior. Mathematically: log p(x) >= E_z log P(x|z) - beta KL(q(z|x) || prior(z)) sampling_forward meth...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VariationalAutoEncoder: """VariationalAutoEncoder encodes data into diagonal multivariate gaussian, performs sampling with reparametrization trick, and returns kl divergence between posterior and prior. Mathematically: log p(x) >= E_z log P(x|z) - beta KL(q(z|x) || prior(z)) sampling_forward method returns sa...
the_stack_v2_python_sparse
alf/algorithms/vae.py
Haichao-Zhang/alf
train
1
ada71852f359c2f97bc45159ad3b9ff0e3cf51a6
[ "standard = {}\nstandard['normal'] = self.make_images()\nstandard['attack'] = self.make_images(True, DRAW_ATTACK_ORDER)\nstrobing = {}\nstrobing['normal'] = self.make_hit_images(standard['normal'])\nstrobing['attack'] = self.make_hit_images(standard['attack'])\nreturn [standard, strobing]", "sheet = prepare.GFX['...
<|body_start_0|> standard = {} standard['normal'] = self.make_images() standard['attack'] = self.make_images(True, DRAW_ATTACK_ORDER) strobing = {} strobing['normal'] = self.make_hit_images(standard['normal']) strobing['attack'] = self.make_hit_images(standard['attack']) ...
This is a mixin for use with the player class. It pulls all the image loading and processing out of the main Player class to make things easier to work with.
_ImageProcessing
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _ImageProcessing: """This is a mixin for use with the player class. It pulls all the image loading and processing out of the main Player class to make things easier to work with.""" def make_all_animations(self): """Returns a list of two dictionaries containing all animations. Index ...
stack_v2_sparse_classes_75kplus_train_008677
15,218
no_license
[ { "docstring": "Returns a list of two dictionaries containing all animations. Index zero corresponds to normal frames; index one corresponds to frames for taking damage.", "name": "make_all_animations", "signature": "def make_all_animations(self)" }, { "docstring": "Return a tools.Anim object wi...
6
stack_v2_sparse_classes_30k_train_050151
Implement the Python class `_ImageProcessing` described below. Class description: This is a mixin for use with the player class. It pulls all the image loading and processing out of the main Player class to make things easier to work with. Method signatures and docstrings: - def make_all_animations(self): Returns a l...
Implement the Python class `_ImageProcessing` described below. Class description: This is a mixin for use with the player class. It pulls all the image loading and processing out of the main Player class to make things easier to work with. Method signatures and docstrings: - def make_all_animations(self): Returns a l...
cee7e4b5dc28c57a6c912852827652b5f51005ae
<|skeleton|> class _ImageProcessing: """This is a mixin for use with the player class. It pulls all the image loading and processing out of the main Player class to make things easier to work with.""" def make_all_animations(self): """Returns a list of two dictionaries containing all animations. Index ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class _ImageProcessing: """This is a mixin for use with the player class. It pulls all the image loading and processing out of the main Player class to make things easier to work with.""" def make_all_animations(self): """Returns a list of two dictionaries containing all animations. Index zero correspo...
the_stack_v2_python_sparse
IE_games_3/cabbages-and-kings-master/data/components/player.py
IndexErrorCoders/PygamesCompilation
train
2
08d94b72f5650e0e37321b6c4536d2359d4840f8
[ "h, v = SpatialSvdModuleSplitter.get_svd_matrices(layer, rank)\nconv_a_stride, conv_b_stride = get_strides_for_split_conv_ops(op=layer.module)\nwith layer.model.graph.as_default():\n last_slash_index = layer.module.name.rfind('/')\n data_format = layer.module.get_attr('data_format').decode('utf-8')\n if da...
<|body_start_0|> h, v = SpatialSvdModuleSplitter.get_svd_matrices(layer, rank) conv_a_stride, conv_b_stride = get_strides_for_split_conv_ops(op=layer.module) with layer.model.graph.as_default(): last_slash_index = layer.module.name.rfind('/') data_format = layer.module.ge...
Spatial SVD module splitter
SpatialSvdModuleSplitter
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpatialSvdModuleSplitter: """Spatial SVD module splitter""" def split_module(layer: Layer, rank: int) -> (tf.Operation, tf.Operation): """:param layer: Module to be split :param rank: rank for splitting :return: Two split modules""" <|body_0|> def get_svd_matrices(layer:...
stack_v2_sparse_classes_75kplus_train_008678
6,069
permissive
[ { "docstring": ":param layer: Module to be split :param rank: rank for splitting :return: Two split modules", "name": "split_module", "signature": "def split_module(layer: Layer, rank: int) -> (tf.Operation, tf.Operation)" }, { "docstring": ":param layer: Module to be split :param rank: rank for...
2
stack_v2_sparse_classes_30k_train_036488
Implement the Python class `SpatialSvdModuleSplitter` described below. Class description: Spatial SVD module splitter Method signatures and docstrings: - def split_module(layer: Layer, rank: int) -> (tf.Operation, tf.Operation): :param layer: Module to be split :param rank: rank for splitting :return: Two split modul...
Implement the Python class `SpatialSvdModuleSplitter` described below. Class description: Spatial SVD module splitter Method signatures and docstrings: - def split_module(layer: Layer, rank: int) -> (tf.Operation, tf.Operation): :param layer: Module to be split :param rank: rank for splitting :return: Two split modul...
5a406e657082b6a4f6e4bf48f0e46e085cb1e351
<|skeleton|> class SpatialSvdModuleSplitter: """Spatial SVD module splitter""" def split_module(layer: Layer, rank: int) -> (tf.Operation, tf.Operation): """:param layer: Module to be split :param rank: rank for splitting :return: Two split modules""" <|body_0|> def get_svd_matrices(layer:...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SpatialSvdModuleSplitter: """Spatial SVD module splitter""" def split_module(layer: Layer, rank: int) -> (tf.Operation, tf.Operation): """:param layer: Module to be split :param rank: rank for splitting :return: Two split modules""" h, v = SpatialSvdModuleSplitter.get_svd_matrices(layer, ...
the_stack_v2_python_sparse
TrainingExtensions/tensorflow/src/python/aimet_tensorflow/svd_spiltter.py
quic/aimet
train
1,676
00f342ba4fdf1e94f70d430810acc4b3eb7b44b9
[ "self.capacity = capacity\nself.usage = 0\nself.LRU = {}\nself.usage_history = []", "if self.LRU.get(key, None):\n self.usage_history.remove(key)\n self.usage_history.append(key)\n return self.LRU[key]\nelse:\n return -1", "if key not in self.LRU:\n if self.usage == self.capacity:\n self.L...
<|body_start_0|> self.capacity = capacity self.usage = 0 self.LRU = {} self.usage_history = [] <|end_body_0|> <|body_start_1|> if self.LRU.get(key, None): self.usage_history.remove(key) self.usage_history.append(key) return self.LRU[key] ...
LRUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:rtype: int""" <|body_1|> def set(self, key, value): """:type key: int :type value: int :rtype: nothing""" <|body_2|> <|end_skeleton|> <...
stack_v2_sparse_classes_75kplus_train_008679
1,166
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: nothing", "name": "set", "sig...
3
stack_v2_sparse_classes_30k_train_052542
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :rtype: int - def set(self, key, value): :type key: int :type value: int :rtype: nothing
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :rtype: int - def set(self, key, value): :type key: int :type value: int :rtype: nothing <|skeleton|> cla...
b6942c05c27556e5fe47879e8b823845c84c5430
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:rtype: int""" <|body_1|> def set(self, key, value): """:type key: int :type value: int :rtype: nothing""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LRUCache: def __init__(self, capacity): """:type capacity: int""" self.capacity = capacity self.usage = 0 self.LRU = {} self.usage_history = [] def get(self, key): """:rtype: int""" if self.LRU.get(key, None): self.usage_history.remove(k...
the_stack_v2_python_sparse
Algorithms/leetcode/146_LRU_cache.py
leeo1116/PyCharm
train
0
6de7b29e93df236ca71e67d7e59233b8995bb801
[ "if excl_indices is None:\n excl_indices = set()\nsample_ind = torch.tensor([], device=device, dtype=torch.long)\nfor ind_set in cls.class_index_cache.values():\n if ind_set:\n valid_ind = ind_set - excl_indices\n perm_ind = torch.randperm(len(valid_ind), device=device)\n ind = torch.tens...
<|body_start_0|> if excl_indices is None: excl_indices = set() sample_ind = torch.tensor([], device=device, dtype=torch.long) for ind_set in cls.class_index_cache.values(): if ind_set: valid_ind = ind_set - excl_indices perm_ind = torch.ran...
ClassBalancedRandomSampling
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClassBalancedRandomSampling: def sample(cls, buffer_x, buffer_y, n_smp_cls, excl_indices=None, device='cpu'): """Take same number of random samples from each class from buffer. Args: buffer_x (tensor): data buffer. buffer_y (tensor): label buffer. n_smp_cls (int): number of samples to ta...
stack_v2_sparse_classes_75kplus_train_008680
5,641
no_license
[ { "docstring": "Take same number of random samples from each class from buffer. Args: buffer_x (tensor): data buffer. buffer_y (tensor): label buffer. n_smp_cls (int): number of samples to take from each class. excl_indices (set): indices of buffered instances to be excluded from sampling. device (str): device ...
2
stack_v2_sparse_classes_30k_train_036543
Implement the Python class `ClassBalancedRandomSampling` described below. Class description: Implement the ClassBalancedRandomSampling class. Method signatures and docstrings: - def sample(cls, buffer_x, buffer_y, n_smp_cls, excl_indices=None, device='cpu'): Take same number of random samples from each class from buf...
Implement the Python class `ClassBalancedRandomSampling` described below. Class description: Implement the ClassBalancedRandomSampling class. Method signatures and docstrings: - def sample(cls, buffer_x, buffer_y, n_smp_cls, excl_indices=None, device='cpu'): Take same number of random samples from each class from buf...
1050d1b716c51edc83799e2ecee38da66a169931
<|skeleton|> class ClassBalancedRandomSampling: def sample(cls, buffer_x, buffer_y, n_smp_cls, excl_indices=None, device='cpu'): """Take same number of random samples from each class from buffer. Args: buffer_x (tensor): data buffer. buffer_y (tensor): label buffer. n_smp_cls (int): number of samples to ta...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ClassBalancedRandomSampling: def sample(cls, buffer_x, buffer_y, n_smp_cls, excl_indices=None, device='cpu'): """Take same number of random samples from each class from buffer. Args: buffer_x (tensor): data buffer. buffer_y (tensor): label buffer. n_smp_cls (int): number of samples to take from each c...
the_stack_v2_python_sparse
utils/buffer/buffer_utils.py
Chandan-IITI/online-continual-learning
train
2
d4e2aa4665885a5ebfcf6e20152a510f8f84aaa5
[ "dp = [float('inf')] * (n + 1)\ndp[0] = 0\nfor i in range(n + 1):\n j = 1\n while j * j <= i:\n dp[i] = min(dp[i], dp[i - j * j] + 1)\n j += 1\nreturn dp[n]", "def isPerfectSquare(x: int) -> bool:\n y = int(x ** 0.5)\n return y * y == x\n\ndef check(x: int) -> bool:\n while x % 4 == 0...
<|body_start_0|> dp = [float('inf')] * (n + 1) dp[0] = 0 for i in range(n + 1): j = 1 while j * j <= i: dp[i] = min(dp[i], dp[i - j * j] + 1) j += 1 return dp[n] <|end_body_0|> <|body_start_1|> def isPerfectSquare(x: int) -...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numSquares_MK1(self, n: int) -> int: """Time complexity: O(n√n) Space complexity: O(n)""" <|body_0|> def numSquares_MK2(self, n: int) -> int: """四平方和定理 Time complexity: O(√n) Space complexity: O(1)""" <|body_1|> <|end_skeleton|> <|body_start_0...
stack_v2_sparse_classes_75kplus_train_008681
1,025
no_license
[ { "docstring": "Time complexity: O(n√n) Space complexity: O(n)", "name": "numSquares_MK1", "signature": "def numSquares_MK1(self, n: int) -> int" }, { "docstring": "四平方和定理 Time complexity: O(√n) Space complexity: O(1)", "name": "numSquares_MK2", "signature": "def numSquares_MK2(self, n: ...
2
stack_v2_sparse_classes_30k_train_020061
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numSquares_MK1(self, n: int) -> int: Time complexity: O(n√n) Space complexity: O(n) - def numSquares_MK2(self, n: int) -> int: 四平方和定理 Time complexity: O(√n) Space complexity:...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numSquares_MK1(self, n: int) -> int: Time complexity: O(n√n) Space complexity: O(n) - def numSquares_MK2(self, n: int) -> int: 四平方和定理 Time complexity: O(√n) Space complexity:...
d7ba416d22becfa8f2a2ae4eee04c86617cd9332
<|skeleton|> class Solution: def numSquares_MK1(self, n: int) -> int: """Time complexity: O(n√n) Space complexity: O(n)""" <|body_0|> def numSquares_MK2(self, n: int) -> int: """四平方和定理 Time complexity: O(√n) Space complexity: O(1)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def numSquares_MK1(self, n: int) -> int: """Time complexity: O(n√n) Space complexity: O(n)""" dp = [float('inf')] * (n + 1) dp[0] = 0 for i in range(n + 1): j = 1 while j * j <= i: dp[i] = min(dp[i], dp[i - j * j] + 1) ...
the_stack_v2_python_sparse
0279. Perfect Squares/Solution.py
faterazer/LeetCode
train
4
168aac522698d2205063d34b6284e590943bff4b
[ "self.DTYPE = 'float32'\nself.n_negative_samples_batch = config['n_negative_samples_batch']\nself.n_tokens_vocab = config['n_tokens_vocab']\nself.projection_dim = config['dim']\nwith tf.variable_scope('softmax'), tf.device('/cpu:0'):\n softmax_init = tf.random_normal_initializer(0.0, 1.0 / np.sqrt(self.projectio...
<|body_start_0|> self.DTYPE = 'float32' self.n_negative_samples_batch = config['n_negative_samples_batch'] self.n_tokens_vocab = config['n_tokens_vocab'] self.projection_dim = config['dim'] with tf.variable_scope('softmax'), tf.device('/cpu:0'): softmax_init = tf.rand...
a layer class: sampled softmax loss
BiSampledSoftmaxLoss
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BiSampledSoftmaxLoss: """a layer class: sampled softmax loss""" def __init__(self, config=None): """init function""" <|body_0|> def ops(self, input_tensors, next_ids): """an op to calculate losses loss for each direction of the LSTM Args: input_tensors: outputs o...
stack_v2_sparse_classes_75kplus_train_008682
3,677
no_license
[ { "docstring": "init function", "name": "__init__", "signature": "def __init__(self, config=None)" }, { "docstring": "an op to calculate losses loss for each direction of the LSTM Args: input_tensors: outputs of elmo embedding next_ids = [self.next_token_id, self.next_token_id_reverse] Returns: ...
2
stack_v2_sparse_classes_30k_train_013974
Implement the Python class `BiSampledSoftmaxLoss` described below. Class description: a layer class: sampled softmax loss Method signatures and docstrings: - def __init__(self, config=None): init function - def ops(self, input_tensors, next_ids): an op to calculate losses loss for each direction of the LSTM Args: inp...
Implement the Python class `BiSampledSoftmaxLoss` described below. Class description: a layer class: sampled softmax loss Method signatures and docstrings: - def __init__(self, config=None): init function - def ops(self, input_tensors, next_ids): an op to calculate losses loss for each direction of the LSTM Args: inp...
598b5b08f9e365beca032fcb2d75c0723b77d3cb
<|skeleton|> class BiSampledSoftmaxLoss: """a layer class: sampled softmax loss""" def __init__(self, config=None): """init function""" <|body_0|> def ops(self, input_tensors, next_ids): """an op to calculate losses loss for each direction of the LSTM Args: input_tensors: outputs o...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BiSampledSoftmaxLoss: """a layer class: sampled softmax loss""" def __init__(self, config=None): """init function""" self.DTYPE = 'float32' self.n_negative_samples_batch = config['n_negative_samples_batch'] self.n_tokens_vocab = config['n_tokens_vocab'] self.projec...
the_stack_v2_python_sparse
tfnlp/layers/loss_layer.py
RipperLom/AssembleNet
train
1
7b5789d3208f144f041ca923f7ce08533546434c
[ "self.xLoc = (geneObj.start, geneObj.end)\nself.yLoc = self._get_y(1, 5, geneObj.transCnt)\nself.patches = []\ntsList = geneObj.transcript.keys()\nif geneObj.strand == '-':\n tsList.sort(key=lambda x: geneObj.transcript[x]['tsEnd'])\nelse:\n tsList.sort(key=lambda x: geneObj.transcript[x]['tsStart'])\nfor ind...
<|body_start_0|> self.xLoc = (geneObj.start, geneObj.end) self.yLoc = self._get_y(1, 5, geneObj.transCnt) self.patches = [] tsList = geneObj.transcript.keys() if geneObj.strand == '-': tsList.sort(key=lambda x: geneObj.transcript[x]['tsEnd']) else: ...
Class to construct a gene model
GeneModel
[ "MIT", "GPL-3.0-only" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GeneModel: """Class to construct a gene model""" def __init__(self, geneObj, height=2): """Arguments: geneObj (obj) = a gene object created from a subclass of _Gene in mclib.gff height (int) = the height of the exon model Attributes: xLoc (tuple) = Gene start and end coordinates. yLo...
stack_v2_sparse_classes_75kplus_train_008683
7,451
permissive
[ { "docstring": "Arguments: geneObj (obj) = a gene object created from a subclass of _Gene in mclib.gff height (int) = the height of the exon model Attributes: xLoc (tuple) = Gene start and end coordinates. yLoc (list) = List of y-coordinates for plotting each transcript on a different row patches (list) = List ...
3
stack_v2_sparse_classes_30k_train_029674
Implement the Python class `GeneModel` described below. Class description: Class to construct a gene model Method signatures and docstrings: - def __init__(self, geneObj, height=2): Arguments: geneObj (obj) = a gene object created from a subclass of _Gene in mclib.gff height (int) = the height of the exon model Attri...
Implement the Python class `GeneModel` described below. Class description: Class to construct a gene model Method signatures and docstrings: - def __init__(self, geneObj, height=2): Arguments: geneObj (obj) = a gene object created from a subclass of _Gene in mclib.gff height (int) = the height of the exon model Attri...
edafc670880803433b7f2255058bf9696699b581
<|skeleton|> class GeneModel: """Class to construct a gene model""" def __init__(self, geneObj, height=2): """Arguments: geneObj (obj) = a gene object created from a subclass of _Gene in mclib.gff height (int) = the height of the exon model Attributes: xLoc (tuple) = Gene start and end coordinates. yLo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GeneModel: """Class to construct a gene model""" def __init__(self, geneObj, height=2): """Arguments: geneObj (obj) = a gene object created from a subclass of _Gene in mclib.gff height (int) = the height of the exon model Attributes: xLoc (tuple) = Gene start and end coordinates. yLoc (list) = Li...
the_stack_v2_python_sparse
hpc/ase_scripts/mclib_Python/wiggle.py
jlboat/BayesASE
train
0
c01e92b3ea8ef07f7243188f319fc6dc0efd4c5b
[ "super(ConfigurationBuilder, self).__init__(self.DEFAULT_PATH)\nself._init_default()\nif survey:\n for other_survey in Survey.objects.all():\n unwanted_survey = survey.name != other_survey.name\n if unwanted_survey:\n del self._conf[other_survey.name]", "default_value_generic = self._c...
<|body_start_0|> super(ConfigurationBuilder, self).__init__(self.DEFAULT_PATH) self._init_default() if survey: for other_survey in Survey.objects.all(): unwanted_survey = survey.name != other_survey.name if unwanted_survey: del self...
Permit to create serializable uninitialized configuration easily. We just use the default dict for a Builder, the user will be able to modify value from the default. We delete unwanted survey in self._conf in order to print only what the user want.
ConfigurationBuilder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConfigurationBuilder: """Permit to create serializable uninitialized configuration easily. We just use the default dict for a Builder, the user will be able to modify value from the default. We delete unwanted survey in self._conf in order to print only what the user want.""" def __init__(se...
stack_v2_sparse_classes_75kplus_train_008684
1,787
permissive
[ { "docstring": "Initialize a configuration file. :param Survey survey: If survey is defined we generate configuration only for this survey.", "name": "__init__", "signature": "def __init__(self, survey=None)" }, { "docstring": "Return the default configuration.", "name": "_init_default", ...
2
stack_v2_sparse_classes_30k_train_045924
Implement the Python class `ConfigurationBuilder` described below. Class description: Permit to create serializable uninitialized configuration easily. We just use the default dict for a Builder, the user will be able to modify value from the default. We delete unwanted survey in self._conf in order to print only what...
Implement the Python class `ConfigurationBuilder` described below. Class description: Permit to create serializable uninitialized configuration easily. We just use the default dict for a Builder, the user will be able to modify value from the default. We delete unwanted survey in self._conf in order to print only what...
2f08b87a7cde6d180e16d6f37d0b8019b8361638
<|skeleton|> class ConfigurationBuilder: """Permit to create serializable uninitialized configuration easily. We just use the default dict for a Builder, the user will be able to modify value from the default. We delete unwanted survey in self._conf in order to print only what the user want.""" def __init__(se...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ConfigurationBuilder: """Permit to create serializable uninitialized configuration easily. We just use the default dict for a Builder, the user will be able to modify value from the default. We delete unwanted survey in self._conf in order to print only what the user want.""" def __init__(self, survey=No...
the_stack_v2_python_sparse
survey/exporter/tex/configuration_builder.py
TheWITProject/MentorApp
train
0
f7bdb6108aed4a3403073ef98caac9239016aab4
[ "self.model = model\nself.layer_output = LayerOutput(model=model, dir_path=dir_path)\nself.save_input_output = SaveInputOutput(dir_path, 'NCHW')", "logger.info('Generating layer-outputs for %d input instances', len(input_batch))\ninput_dict = create_input_dict(self.model, input_batch)\nlayer_output_dict = self.la...
<|body_start_0|> self.model = model self.layer_output = LayerOutput(model=model, dir_path=dir_path) self.save_input_output = SaveInputOutput(dir_path, 'NCHW') <|end_body_0|> <|body_start_1|> logger.info('Generating layer-outputs for %d input instances', len(input_batch)) input_d...
Implementation to capture and save outputs of intermediate layers of a model (fp32/quantsim)
LayerOutputUtil
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LayerOutputUtil: """Implementation to capture and save outputs of intermediate layers of a model (fp32/quantsim)""" def __init__(self, model: onnx_pb.ModelProto, dir_path: str): """Constructor - It initializes the utility classes that captures and saves layer-outputs :param model: ON...
stack_v2_sparse_classes_75kplus_train_008685
6,602
permissive
[ { "docstring": "Constructor - It initializes the utility classes that captures and saves layer-outputs :param model: ONNX model :param dir_path: Directory wherein layer-outputs will be saved", "name": "__init__", "signature": "def __init__(self, model: onnx_pb.ModelProto, dir_path: str)" }, { "d...
2
stack_v2_sparse_classes_30k_train_018012
Implement the Python class `LayerOutputUtil` described below. Class description: Implementation to capture and save outputs of intermediate layers of a model (fp32/quantsim) Method signatures and docstrings: - def __init__(self, model: onnx_pb.ModelProto, dir_path: str): Constructor - It initializes the utility class...
Implement the Python class `LayerOutputUtil` described below. Class description: Implementation to capture and save outputs of intermediate layers of a model (fp32/quantsim) Method signatures and docstrings: - def __init__(self, model: onnx_pb.ModelProto, dir_path: str): Constructor - It initializes the utility class...
5a406e657082b6a4f6e4bf48f0e46e085cb1e351
<|skeleton|> class LayerOutputUtil: """Implementation to capture and save outputs of intermediate layers of a model (fp32/quantsim)""" def __init__(self, model: onnx_pb.ModelProto, dir_path: str): """Constructor - It initializes the utility classes that captures and saves layer-outputs :param model: ON...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LayerOutputUtil: """Implementation to capture and save outputs of intermediate layers of a model (fp32/quantsim)""" def __init__(self, model: onnx_pb.ModelProto, dir_path: str): """Constructor - It initializes the utility classes that captures and saves layer-outputs :param model: ONNX model :par...
the_stack_v2_python_sparse
TrainingExtensions/onnx/src/python/aimet_onnx/layer_output_utils.py
quic/aimet
train
1,676
70edcb73239287b25b55f3bf69d90b40addb98ae
[ "self.doi_prefix = prefix\nif self.doi_prefix[-1] == '/':\n self.doi_prefix = self.doi_prefix[:-1]\nif not message:\n self.message = 'You cannot change an already registered DOI.'\nctx = dict(prefix=prefix, CFG_SITE_NAME=current_app.config['CFG_SITE_NAME'])\nself.message = self.message % ctx", "if field.obj...
<|body_start_0|> self.doi_prefix = prefix if self.doi_prefix[-1] == '/': self.doi_prefix = self.doi_prefix[:-1] if not message: self.message = 'You cannot change an already registered DOI.' ctx = dict(prefix=prefix, CFG_SITE_NAME=current_app.config['CFG_SITE_NAME'...
Validate if DOI.
MintedDOIValidator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MintedDOIValidator: """Validate if DOI.""" def __init__(self, prefix='10.5072', message=None): """Initialize validator. :param doi_prefix: DOI prefix, e.g. 10.5072""" <|body_0|> def __call__(self, form, field): """Validate.""" <|body_1|> <|end_skeleton|>...
stack_v2_sparse_classes_75kplus_train_008686
11,750
no_license
[ { "docstring": "Initialize validator. :param doi_prefix: DOI prefix, e.g. 10.5072", "name": "__init__", "signature": "def __init__(self, prefix='10.5072', message=None)" }, { "docstring": "Validate.", "name": "__call__", "signature": "def __call__(self, form, field)" } ]
2
stack_v2_sparse_classes_30k_test_002185
Implement the Python class `MintedDOIValidator` described below. Class description: Validate if DOI. Method signatures and docstrings: - def __init__(self, prefix='10.5072', message=None): Initialize validator. :param doi_prefix: DOI prefix, e.g. 10.5072 - def __call__(self, form, field): Validate.
Implement the Python class `MintedDOIValidator` described below. Class description: Validate if DOI. Method signatures and docstrings: - def __init__(self, prefix='10.5072', message=None): Initialize validator. :param doi_prefix: DOI prefix, e.g. 10.5072 - def __call__(self, form, field): Validate. <|skeleton|> clas...
4de8910fff569fc9028300c70b63200da521ddb9
<|skeleton|> class MintedDOIValidator: """Validate if DOI.""" def __init__(self, prefix='10.5072', message=None): """Initialize validator. :param doi_prefix: DOI prefix, e.g. 10.5072""" <|body_0|> def __call__(self, form, field): """Validate.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MintedDOIValidator: """Validate if DOI.""" def __init__(self, prefix='10.5072', message=None): """Initialize validator. :param doi_prefix: DOI prefix, e.g. 10.5072""" self.doi_prefix = prefix if self.doi_prefix[-1] == '/': self.doi_prefix = self.doi_prefix[:-1] ...
the_stack_v2_python_sparse
inspirehep/modules/forms/validation_utils.py
nikpap/inspire-next
train
1
0b6b362c8d56b4399304d42a9b9ca1d71d3ba473
[ "super(ObjBranch, self).__init__()\nself.trans_factor = trans_factor\nself.scale_factor = scale_factor\nself.inp_res = [256, 256]", "if scaletrans is None:\n batch_size = scale.shape[0]\nelse:\n batch_size = scaletrans.shape[0]\nif scale is None:\n scale = scaletrans[:, :1]\nif trans is None:\n trans ...
<|body_start_0|> super(ObjBranch, self).__init__() self.trans_factor = trans_factor self.scale_factor = scale_factor self.inp_res = [256, 256] <|end_body_0|> <|body_start_1|> if scaletrans is None: batch_size = scale.shape[0] else: batch_size = sc...
ObjBranch
[ "LicenseRef-scancode-unknown", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ObjBranch: def __init__(self, trans_factor=1, scale_factor=1): """Args: trans_factor: Scaling parameter to insure translation and scale are updated similarly during training (if one is updated much more than the other, training is slowed down, because for instance only the variation of t...
stack_v2_sparse_classes_75kplus_train_008687
3,616
permissive
[ { "docstring": "Args: trans_factor: Scaling parameter to insure translation and scale are updated similarly during training (if one is updated much more than the other, training is slowed down, because for instance only the variation of translation or scale significantly influences the final loss variation) sca...
2
stack_v2_sparse_classes_30k_test_000210
Implement the Python class `ObjBranch` described below. Class description: Implement the ObjBranch class. Method signatures and docstrings: - def __init__(self, trans_factor=1, scale_factor=1): Args: trans_factor: Scaling parameter to insure translation and scale are updated similarly during training (if one is updat...
Implement the Python class `ObjBranch` described below. Class description: Implement the ObjBranch class. Method signatures and docstrings: - def __init__(self, trans_factor=1, scale_factor=1): Args: trans_factor: Scaling parameter to insure translation and scale are updated similarly during training (if one is updat...
9651c569c328707cc1ad1e4797b9e4b32083c446
<|skeleton|> class ObjBranch: def __init__(self, trans_factor=1, scale_factor=1): """Args: trans_factor: Scaling parameter to insure translation and scale are updated similarly during training (if one is updated much more than the other, training is slowed down, because for instance only the variation of t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ObjBranch: def __init__(self, trans_factor=1, scale_factor=1): """Args: trans_factor: Scaling parameter to insure translation and scale are updated similarly during training (if one is updated much more than the other, training is slowed down, because for instance only the variation of translation or ...
the_stack_v2_python_sparse
meshreg/models/objbranch.py
pgrady3/handobjectconsist
train
0
e71cfa4eb58e07d16d27a714b41879b1c0d02cf6
[ "fast = self.helper(self.helper(n))\nslow = self.helper(n)\nwhile slow != fast:\n fast = self.helper(self.helper(fast))\n slow = self.helper(slow)\nreturn slow == 1", "res = 0\nwhile n:\n res += (n % 10) ** 2\n n //= 10\nreturn res" ]
<|body_start_0|> fast = self.helper(self.helper(n)) slow = self.helper(n) while slow != fast: fast = self.helper(self.helper(fast)) slow = self.helper(slow) return slow == 1 <|end_body_0|> <|body_start_1|> res = 0 while n: res += (n % ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isHappy(self, n): """Args: n: int Return: bool""" <|body_0|> def helper(self, n): """Args: n: int Return: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> fast = self.helper(self.helper(n)) slow = self.helper(n) whil...
stack_v2_sparse_classes_75kplus_train_008688
1,351
no_license
[ { "docstring": "Args: n: int Return: bool", "name": "isHappy", "signature": "def isHappy(self, n)" }, { "docstring": "Args: n: int Return: int", "name": "helper", "signature": "def helper(self, n)" } ]
2
stack_v2_sparse_classes_30k_train_009531
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isHappy(self, n): Args: n: int Return: bool - def helper(self, n): Args: n: int Return: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isHappy(self, n): Args: n: int Return: bool - def helper(self, n): Args: n: int Return: int <|skeleton|> class Solution: def isHappy(self, n): """Args: n: int R...
101bce2fac8b188a4eb2f5e017293d21ad0ecb21
<|skeleton|> class Solution: def isHappy(self, n): """Args: n: int Return: bool""" <|body_0|> def helper(self, n): """Args: n: int Return: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def isHappy(self, n): """Args: n: int Return: bool""" fast = self.helper(self.helper(n)) slow = self.helper(n) while slow != fast: fast = self.helper(self.helper(fast)) slow = self.helper(slow) return slow == 1 def helper(self, n):...
the_stack_v2_python_sparse
code/202. 快乐数.py
AiZhanghan/Leetcode
train
0
13e5ed456a5487e73014f09daee43e92150b07d3
[ "nums = []\np = head\nwhile p is not None:\n nums.append(p.val)\n p = p.next\nreturn self.sortedArrayToBST(nums)", "if len(nums) == 0:\n return None\nmid_index = len(nums) >> 1\nnode = TreeNode(nums[mid_index])\nnode.left = self.sortedArrayToBST(nums[:mid_index])\nnode.right = self.sortedArrayToBST(nums[...
<|body_start_0|> nums = [] p = head while p is not None: nums.append(p.val) p = p.next return self.sortedArrayToBST(nums) <|end_body_0|> <|body_start_1|> if len(nums) == 0: return None mid_index = len(nums) >> 1 node = TreeNode...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def sortedListToBST(self, head): """:type head: ListNode :rtype: TreeNode""" <|body_0|> def sortedArrayToBST(self, nums): """:type nums: List[int] :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> nums = [] p = head ...
stack_v2_sparse_classes_75kplus_train_008689
864
permissive
[ { "docstring": ":type head: ListNode :rtype: TreeNode", "name": "sortedListToBST", "signature": "def sortedListToBST(self, head)" }, { "docstring": ":type nums: List[int] :rtype: TreeNode", "name": "sortedArrayToBST", "signature": "def sortedArrayToBST(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_005864
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortedListToBST(self, head): :type head: ListNode :rtype: TreeNode - def sortedArrayToBST(self, nums): :type nums: List[int] :rtype: TreeNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortedListToBST(self, head): :type head: ListNode :rtype: TreeNode - def sortedArrayToBST(self, nums): :type nums: List[int] :rtype: TreeNode <|skeleton|> class Solution: ...
3f05fff7758d650469862bc28df9e4aa7b1d3203
<|skeleton|> class Solution: def sortedListToBST(self, head): """:type head: ListNode :rtype: TreeNode""" <|body_0|> def sortedArrayToBST(self, nums): """:type nums: List[int] :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def sortedListToBST(self, head): """:type head: ListNode :rtype: TreeNode""" nums = [] p = head while p is not None: nums.append(p.val) p = p.next return self.sortedArrayToBST(nums) def sortedArrayToBST(self, nums): """:typ...
the_stack_v2_python_sparse
solutions/solution109.py
Satily/leetcode_python_solution
train
3
02caefed8e6134c5fc7c5f7a2a8e911d06ad1484
[ "if isinstance(value, cls):\n if hasattr(value, table):\n return 1\nreturn 0", "if cls.check(value):\n return value\nif isinstance(value, dbschema.TableSchema):\n return cls(table=value)\nelse:\n raise TypeError(\"%r couldn't be converted to a %s\" % (value, cls.__name__))" ]
<|body_start_0|> if isinstance(value, cls): if hasattr(value, table): return 1 return 0 <|end_body_0|> <|body_start_1|> if cls.check(value): return value if isinstance(value, dbschema.TableSchema): return cls(table=value) else:...
A Join of a table, basically just a name:table item
JoinTable
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JoinTable: """A Join of a table, basically just a name:table item""" def check(cls, value): """Check that value is a proper instance of this class""" <|body_0|> def coerce(cls, value): """Coerce a value to an instance of this class""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_75kplus_train_008690
2,661
no_license
[ { "docstring": "Check that value is a proper instance of this class", "name": "check", "signature": "def check(cls, value)" }, { "docstring": "Coerce a value to an instance of this class", "name": "coerce", "signature": "def coerce(cls, value)" } ]
2
stack_v2_sparse_classes_30k_train_012197
Implement the Python class `JoinTable` described below. Class description: A Join of a table, basically just a name:table item Method signatures and docstrings: - def check(cls, value): Check that value is a proper instance of this class - def coerce(cls, value): Coerce a value to an instance of this class
Implement the Python class `JoinTable` described below. Class description: A Join of a table, basically just a name:table item Method signatures and docstrings: - def check(cls, value): Check that value is a proper instance of this class - def coerce(cls, value): Coerce a value to an instance of this class <|skeleto...
86410d2e8bece963ee7e7306560c94930467a1a7
<|skeleton|> class JoinTable: """A Join of a table, basically just a name:table item""" def check(cls, value): """Check that value is a proper instance of this class""" <|body_0|> def coerce(cls, value): """Coerce a value to an instance of this class""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class JoinTable: """A Join of a table, basically just a name:table item""" def check(cls, value): """Check that value is a proper instance of this class""" if isinstance(value, cls): if hasattr(value, table): return 1 return 0 def coerce(cls, value): ...
the_stack_v2_python_sparse
build/pytable/pytable/viewschema.py
icot/euler
train
0
078547d3e6040cddc0b37ae328fa0fa6fa2bb8ca
[ "if len(nums) < 2:\n return\nflag = False\nfor i in range(len(nums) - 1)[::-1]:\n if nums[i] < nums[i + 1]:\n lst = sorted(nums[i:])\n for j in range(len(lst)):\n if lst[j] > nums[i]:\n break\n nums[i] = lst[j]\n nums[i + 1:] = lst[:j] + lst[j + 1:]\n ...
<|body_start_0|> if len(nums) < 2: return flag = False for i in range(len(nums) - 1)[::-1]: if nums[i] < nums[i + 1]: lst = sorted(nums[i:]) for j in range(len(lst)): if lst[j] > nums[i]: break ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def nextPermutation(self, nums): """:type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.""" <|body_0|> def nextPermutation(self, nums): """:type nums: List[int] :rtype: void Do not return anything, modify nums in-place in...
stack_v2_sparse_classes_75kplus_train_008691
1,388
no_license
[ { "docstring": ":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.", "name": "nextPermutation", "signature": "def nextPermutation(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.", "...
2
stack_v2_sparse_classes_30k_val_002366
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def nextPermutation(self, nums): :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. - def nextPermutation(self, nums): :type nums: List[int]...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def nextPermutation(self, nums): :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. - def nextPermutation(self, nums): :type nums: List[int]...
052bd7915257679877dbe55b60ed1abb7528eaa2
<|skeleton|> class Solution: def nextPermutation(self, nums): """:type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.""" <|body_0|> def nextPermutation(self, nums): """:type nums: List[int] :rtype: void Do not return anything, modify nums in-place in...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def nextPermutation(self, nums): """:type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.""" if len(nums) < 2: return flag = False for i in range(len(nums) - 1)[::-1]: if nums[i] < nums[i + 1]: ...
the_stack_v2_python_sparse
python_solution/Array/31_NextPermutation.py
Dimen61/leetcode
train
4
fe6aaff3bab333725621fdcdc7462e3a655d458a
[ "super().__init__()\nself.out_n = out_n\nself.lstm_hidden_size = lstm_hidden_size\nself.lstm_num_layers = lstm_num_layers\nlstm_in_n = lin_before_hidden_size if lin_before_num_layers > 0 else inp_n\nself.lstm_out_n = lin_after_hidden_size if lin_after_num_layers > 0 else out_n\nself.lin_before = LinearPolicy(inp_n,...
<|body_start_0|> super().__init__() self.out_n = out_n self.lstm_hidden_size = lstm_hidden_size self.lstm_num_layers = lstm_num_layers lstm_in_n = lin_before_hidden_size if lin_before_num_layers > 0 else inp_n self.lstm_out_n = lin_after_hidden_size if lin_after_num_layer...
A LSTM policy.
LSTMPolicy
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LSTMPolicy: """A LSTM policy.""" def __init__(self, inp_n: int, out_n: int, lin_before_hidden_size: int, lin_before_num_layers: int, lstm_hidden_size: int, lstm_num_layers: int, lin_after_hidden_size: int, lin_after_num_layers: int, activation_fn: nn.Module): """Creates the LSTM poli...
stack_v2_sparse_classes_75kplus_train_008692
10,329
permissive
[ { "docstring": "Creates the LSTM policy, with a linear policy before and after it. The LSTM module is batch major. Args: inp_n: The number of input units. out_n: The number of output units. lin_before_hidden_size: The number of hidden units in the linear network before the LSTM. lin_before_num_layers: The numbe...
3
null
Implement the Python class `LSTMPolicy` described below. Class description: A LSTM policy. Method signatures and docstrings: - def __init__(self, inp_n: int, out_n: int, lin_before_hidden_size: int, lin_before_num_layers: int, lstm_hidden_size: int, lstm_num_layers: int, lin_after_hidden_size: int, lin_after_num_laye...
Implement the Python class `LSTMPolicy` described below. Class description: A LSTM policy. Method signatures and docstrings: - def __init__(self, inp_n: int, out_n: int, lin_before_hidden_size: int, lin_before_num_layers: int, lstm_hidden_size: int, lstm_num_layers: int, lin_after_hidden_size: int, lin_after_num_laye...
cde3be1c69bfd76fe4a78fa529e851d0a78318c7
<|skeleton|> class LSTMPolicy: """A LSTM policy.""" def __init__(self, inp_n: int, out_n: int, lin_before_hidden_size: int, lin_before_num_layers: int, lstm_hidden_size: int, lstm_num_layers: int, lin_after_hidden_size: int, lin_after_num_layers: int, activation_fn: nn.Module): """Creates the LSTM poli...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LSTMPolicy: """A LSTM policy.""" def __init__(self, inp_n: int, out_n: int, lin_before_hidden_size: int, lin_before_num_layers: int, lstm_hidden_size: int, lstm_num_layers: int, lin_after_hidden_size: int, lin_after_num_layers: int, activation_fn: nn.Module): """Creates the LSTM policy, with a li...
the_stack_v2_python_sparse
hlrl/torch/policies/recurrent.py
Chainso/HLRL
train
3
09819c575296574bf10ed2136dbc6862aa5f99c6
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn SynchronizationJobRestartCriteria()", "from .synchronization_job_restart_scope import SynchronizationJobRestartScope\nfrom .synchronization_job_restart_scope import SynchronizationJobRestartScope\nfields: Dict[str, Callable[[Any], None...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return SynchronizationJobRestartCriteria() <|end_body_0|> <|body_start_1|> from .synchronization_job_restart_scope import SynchronizationJobRestartScope from .synchronization_job_restart_scope ...
SynchronizationJobRestartCriteria
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SynchronizationJobRestartCriteria: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SynchronizationJobRestartCriteria: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discrimin...
stack_v2_sparse_classes_75kplus_train_008693
3,964
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: SynchronizationJobRestartCriteria", "name": "create_from_discriminator_value", "signature": "def create_from...
3
stack_v2_sparse_classes_30k_train_002484
Implement the Python class `SynchronizationJobRestartCriteria` described below. Class description: Implement the SynchronizationJobRestartCriteria class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SynchronizationJobRestartCriteria: Creates a new in...
Implement the Python class `SynchronizationJobRestartCriteria` described below. Class description: Implement the SynchronizationJobRestartCriteria class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SynchronizationJobRestartCriteria: Creates a new in...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class SynchronizationJobRestartCriteria: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SynchronizationJobRestartCriteria: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discrimin...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SynchronizationJobRestartCriteria: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SynchronizationJobRestartCriteria: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and...
the_stack_v2_python_sparse
msgraph/generated/models/synchronization_job_restart_criteria.py
microsoftgraph/msgraph-sdk-python
train
135
d0feddd91e2b148fbcdb60bdf966929c50e23159
[ "super(LevelMap, self).__init__(**kwargs)\nself.level = level\nself.scale = scale\nself.rect.topleft = pos\nself.rect.size = vector.scalar_divide(level.cullrect.size, scale)", "self.surf.fill(self.bgcolor, self.rect)\nori_left = self.level.cullrect.left\nori_top = self.level.cullrect.top\nrect = pygame.Rect(0, 0,...
<|body_start_0|> super(LevelMap, self).__init__(**kwargs) self.level = level self.scale = scale self.rect.topleft = pos self.rect.size = vector.scalar_divide(level.cullrect.size, scale) <|end_body_0|> <|body_start_1|> self.surf.fill(self.bgcolor, self.rect) ori_l...
Mini-map of a level. Covers the cullrect. Shows sprites which have the 'color' attribute.
LevelMap
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LevelMap: """Mini-map of a level. Covers the cullrect. Shows sprites which have the 'color' attribute.""" def __init__(self, level, scale, pos, **kwargs): """'level' provides the sprites. 'scale' is the scale factor. 'pos' is where on the screen to put the map.""" <|body_0|> ...
stack_v2_sparse_classes_75kplus_train_008694
1,853
no_license
[ { "docstring": "'level' provides the sprites. 'scale' is the scale factor. 'pos' is where on the screen to put the map.", "name": "__init__", "signature": "def __init__(self, level, scale, pos, **kwargs)" }, { "docstring": "Loop over all sprites on the level and paint dots for the ones that have...
2
stack_v2_sparse_classes_30k_train_053215
Implement the Python class `LevelMap` described below. Class description: Mini-map of a level. Covers the cullrect. Shows sprites which have the 'color' attribute. Method signatures and docstrings: - def __init__(self, level, scale, pos, **kwargs): 'level' provides the sprites. 'scale' is the scale factor. 'pos' is w...
Implement the Python class `LevelMap` described below. Class description: Mini-map of a level. Covers the cullrect. Shows sprites which have the 'color' attribute. Method signatures and docstrings: - def __init__(self, level, scale, pos, **kwargs): 'level' provides the sprites. 'scale' is the scale factor. 'pos' is w...
cfbf73fae96394a95cdf2db3020adc9719fc6473
<|skeleton|> class LevelMap: """Mini-map of a level. Covers the cullrect. Shows sprites which have the 'color' attribute.""" def __init__(self, level, scale, pos, **kwargs): """'level' provides the sprites. 'scale' is the scale factor. 'pos' is where on the screen to put the map.""" <|body_0|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LevelMap: """Mini-map of a level. Covers the cullrect. Shows sprites which have the 'color' attribute.""" def __init__(self, level, scale, pos, **kwargs): """'level' provides the sprites. 'scale' is the scale factor. 'pos' is where on the screen to put the map.""" super(LevelMap, self).__...
the_stack_v2_python_sparse
minimap.py
gmcnutt/stardog
train
0
c8049094844995027357513c2e867c03987995f7
[ "\"\"\" Take parameters, and Sprite Constants \"\"\"\nsuper(BeesSprite, self).__init__(world_map, BeesSprite.IMAGE, GRID_LOCK, BeesSprite.HEALTH_BAR, BeesSprite.AVG_SPEED, BeesSprite.VISION, coordinates)\nself.type = 'bees'\nself.prey = ['plant']", "visible_tiles = vision.vision(15, self.world_map, self.tile)\nvi...
<|body_start_0|> """ Take parameters, and Sprite Constants """ super(BeesSprite, self).__init__(world_map, BeesSprite.IMAGE, GRID_LOCK, BeesSprite.HEALTH_BAR, BeesSprite.AVG_SPEED, BeesSprite.VISION, coordinates) self.type = 'bees' self.prey = ['plant'] <|end_body_0|> <|body_start_1|> ...
BeesSprite
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BeesSprite: def __init__(self, world_map, GRID_LOCK, coordinates=None): """Create a BeesSprite object :param world_map: WorldMap Object :param coordinates: Array of coordinates [x,y] :param GRID_LOCK: Lock for screen (for threading)""" <|body_0|> def move(self, target=None):...
stack_v2_sparse_classes_75kplus_train_008695
3,276
no_license
[ { "docstring": "Create a BeesSprite object :param world_map: WorldMap Object :param coordinates: Array of coordinates [x,y] :param GRID_LOCK: Lock for screen (for threading)", "name": "__init__", "signature": "def __init__(self, world_map, GRID_LOCK, coordinates=None)" }, { "docstring": "@Overri...
3
stack_v2_sparse_classes_30k_train_000348
Implement the Python class `BeesSprite` described below. Class description: Implement the BeesSprite class. Method signatures and docstrings: - def __init__(self, world_map, GRID_LOCK, coordinates=None): Create a BeesSprite object :param world_map: WorldMap Object :param coordinates: Array of coordinates [x,y] :param...
Implement the Python class `BeesSprite` described below. Class description: Implement the BeesSprite class. Method signatures and docstrings: - def __init__(self, world_map, GRID_LOCK, coordinates=None): Create a BeesSprite object :param world_map: WorldMap Object :param coordinates: Array of coordinates [x,y] :param...
8995bd57ae0faaf7420c74e1a7b2c091c64d6942
<|skeleton|> class BeesSprite: def __init__(self, world_map, GRID_LOCK, coordinates=None): """Create a BeesSprite object :param world_map: WorldMap Object :param coordinates: Array of coordinates [x,y] :param GRID_LOCK: Lock for screen (for threading)""" <|body_0|> def move(self, target=None):...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BeesSprite: def __init__(self, world_map, GRID_LOCK, coordinates=None): """Create a BeesSprite object :param world_map: WorldMap Object :param coordinates: Array of coordinates [x,y] :param GRID_LOCK: Lock for screen (for threading)""" """ Take parameters, and Sprite Constants """ supe...
the_stack_v2_python_sparse
sprites/sprite___bees.py
EcoSimulator/EcoSim2.0
train
0
e28391d7c4b82a0a3918dd79eef43426b5a34cf0
[ "if not len(trainers) == len(ensemble.models):\n raise ValueError('As many trainers as models needed!')\nself.trainers = trainers", "for trainer in self.trainers:\n samples = np.random.uniform(0, len(inputs), size=len(inputs))\n trainer.train(inputs[samples], targets[samples])" ]
<|body_start_0|> if not len(trainers) == len(ensemble.models): raise ValueError('As many trainers as models needed!') self.trainers = trainers <|end_body_0|> <|body_start_1|> for trainer in self.trainers: samples = np.random.uniform(0, len(inputs), size=len(inputs)) ...
EnsembleTrainer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EnsembleTrainer: def __init__(self, ensemble, trainers): """EnsembleTrainer is composed of multiple trainers, one for each model in the ensemble. :param ensemble: the ensemble model to train, instance of EnsembleEnvironmentModel :param trainers: a list of model trainers for the ensemble ...
stack_v2_sparse_classes_75kplus_train_008696
21,063
no_license
[ { "docstring": "EnsembleTrainer is composed of multiple trainers, one for each model in the ensemble. :param ensemble: the ensemble model to train, instance of EnsembleEnvironmentModel :param trainers: a list of model trainers for the ensemble models", "name": "__init__", "signature": "def __init__(self...
2
null
Implement the Python class `EnsembleTrainer` described below. Class description: Implement the EnsembleTrainer class. Method signatures and docstrings: - def __init__(self, ensemble, trainers): EnsembleTrainer is composed of multiple trainers, one for each model in the ensemble. :param ensemble: the ensemble model to...
Implement the Python class `EnsembleTrainer` described below. Class description: Implement the EnsembleTrainer class. Method signatures and docstrings: - def __init__(self, ensemble, trainers): EnsembleTrainer is composed of multiple trainers, one for each model in the ensemble. :param ensemble: the ensemble model to...
ceeb196bde01592f9ec15f9e24d008a9395c65ea
<|skeleton|> class EnsembleTrainer: def __init__(self, ensemble, trainers): """EnsembleTrainer is composed of multiple trainers, one for each model in the ensemble. :param ensemble: the ensemble model to train, instance of EnsembleEnvironmentModel :param trainers: a list of model trainers for the ensemble ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EnsembleTrainer: def __init__(self, ensemble, trainers): """EnsembleTrainer is composed of multiple trainers, one for each model in the ensemble. :param ensemble: the ensemble model to train, instance of EnsembleEnvironmentModel :param trainers: a list of model trainers for the ensemble models""" ...
the_stack_v2_python_sparse
src/algorithm/MPC/model.py
al91liwo/pytorch-rl-lab
train
3
2e4376f7331777b5521feda55dd6f9bcc1b75dff
[ "step = 0\nfor num in chips:\n if num % 2 == 1:\n step += 1\nreturn min(step, len(chips) - step)", "step1, step2 = (0, 0)\nfor num in chips:\n if num % 2 == 1:\n step1 += 1\n else:\n step2 += 1\nreturn min(step1, step2)" ]
<|body_start_0|> step = 0 for num in chips: if num % 2 == 1: step += 1 return min(step, len(chips) - step) <|end_body_0|> <|body_start_1|> step1, step2 = (0, 0) for num in chips: if num % 2 == 1: step1 += 1 else...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def min_cost_to_move_chips(self, chips: List[int]) -> int: """摆筹码代价最小 Args: chips: 数组 Returns: 摆筹码""" <|body_0|> def min_cost_to_move_chips2(self, chips: List[int]) -> int: """摆筹码代价最小 Args: chips: 数组 Returns: 摆筹码""" <|body_1|> <|end_skeleton|> <|b...
stack_v2_sparse_classes_75kplus_train_008697
2,366
permissive
[ { "docstring": "摆筹码代价最小 Args: chips: 数组 Returns: 摆筹码", "name": "min_cost_to_move_chips", "signature": "def min_cost_to_move_chips(self, chips: List[int]) -> int" }, { "docstring": "摆筹码代价最小 Args: chips: 数组 Returns: 摆筹码", "name": "min_cost_to_move_chips2", "signature": "def min_cost_to_mov...
2
stack_v2_sparse_classes_30k_train_054468
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def min_cost_to_move_chips(self, chips: List[int]) -> int: 摆筹码代价最小 Args: chips: 数组 Returns: 摆筹码 - def min_cost_to_move_chips2(self, chips: List[int]) -> int: 摆筹码代价最小 Args: chips:...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def min_cost_to_move_chips(self, chips: List[int]) -> int: 摆筹码代价最小 Args: chips: 数组 Returns: 摆筹码 - def min_cost_to_move_chips2(self, chips: List[int]) -> int: 摆筹码代价最小 Args: chips:...
50f35eef6a0ad63173efed10df3c835b1dceaa3f
<|skeleton|> class Solution: def min_cost_to_move_chips(self, chips: List[int]) -> int: """摆筹码代价最小 Args: chips: 数组 Returns: 摆筹码""" <|body_0|> def min_cost_to_move_chips2(self, chips: List[int]) -> int: """摆筹码代价最小 Args: chips: 数组 Returns: 摆筹码""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def min_cost_to_move_chips(self, chips: List[int]) -> int: """摆筹码代价最小 Args: chips: 数组 Returns: 摆筹码""" step = 0 for num in chips: if num % 2 == 1: step += 1 return min(step, len(chips) - step) def min_cost_to_move_chips2(self, chips: Li...
the_stack_v2_python_sparse
src/leetcodepython/array/play_with_chips_1217.py
zhangyu345293721/leetcode
train
101
62a1dacaa06baab9385d76dbad8c7f4c2ac7da11
[ "self.metrics = Metrics()\nself.discs = discs\nself.pegs = pegs\nself.towers = []\nfor t in range(0, pegs):\n self.towers.append(deque(maxlen=discs))\nfor d in range(discs, 0, -1):\n self.towers[0].append(d)\nself.initial = self.towers\nself.end = list(reversed(self.towers))", "actions = []\nfor from_peg in...
<|body_start_0|> self.metrics = Metrics() self.discs = discs self.pegs = pegs self.towers = [] for t in range(0, pegs): self.towers.append(deque(maxlen=discs)) for d in range(discs, 0, -1): self.towers[0].append(d) self.initial = self.tower...
TowersOfHanoi
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TowersOfHanoi: def __init__(self, discs, pegs=3): """Constructor builds a Towers of Hanoit problem with a given number of discs and pegs. The default number of pegs is 3.""" <|body_0|> def actions(self, state): """Return the actions that can be executed in the given ...
stack_v2_sparse_classes_75kplus_train_008698
4,889
no_license
[ { "docstring": "Constructor builds a Towers of Hanoit problem with a given number of discs and pegs. The default number of pegs is 3.", "name": "__init__", "signature": "def __init__(self, discs, pegs=3)" }, { "docstring": "Return the actions that can be executed in the given state. actions is a...
5
null
Implement the Python class `TowersOfHanoi` described below. Class description: Implement the TowersOfHanoi class. Method signatures and docstrings: - def __init__(self, discs, pegs=3): Constructor builds a Towers of Hanoit problem with a given number of discs and pegs. The default number of pegs is 3. - def actions(s...
Implement the Python class `TowersOfHanoi` described below. Class description: Implement the TowersOfHanoi class. Method signatures and docstrings: - def __init__(self, discs, pegs=3): Constructor builds a Towers of Hanoit problem with a given number of discs and pegs. The default number of pegs is 3. - def actions(s...
743313ac216e60661b2c036e8ec8b04f3e372928
<|skeleton|> class TowersOfHanoi: def __init__(self, discs, pegs=3): """Constructor builds a Towers of Hanoit problem with a given number of discs and pegs. The default number of pegs is 3.""" <|body_0|> def actions(self, state): """Return the actions that can be executed in the given ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TowersOfHanoi: def __init__(self, discs, pegs=3): """Constructor builds a Towers of Hanoit problem with a given number of discs and pegs. The default number of pegs is 3.""" self.metrics = Metrics() self.discs = discs self.pegs = pegs self.towers = [] for t in r...
the_stack_v2_python_sparse
towersofhanoi/hanoi.py
ACSchil/PyAI
train
0
8ef76ee55021915956e251679d57339834e34733
[ "n1, n2 = (len(nums1), len(nums2))\nleft, right = ((n1 + n2 + 1) // 2, (n1 + n2 + 2) // 2)\nreturn (self.findKthSortedArrays(nums1, 0, nums2, 0, left) + self.findKthSortedArrays(nums1, 0, nums2, 0, right)) / 2", "if s1 >= len(nums1):\n return nums2[s2 + k - 1]\nif s2 >= len(nums2):\n return nums1[s1 + k - 1...
<|body_start_0|> n1, n2 = (len(nums1), len(nums2)) left, right = ((n1 + n2 + 1) // 2, (n1 + n2 + 2) // 2) return (self.findKthSortedArrays(nums1, 0, nums2, 0, left) + self.findKthSortedArrays(nums1, 0, nums2, 0, right)) / 2 <|end_body_0|> <|body_start_1|> if s1 >= len(nums1): ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMedianSortedArrays(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: float""" <|body_0|> def findKthSortedArrays(self, nums1, s1, nums2, s2, k): """:type nums1: List[int] :type s1: int :type nums2: List[int] :type s2: int...
stack_v2_sparse_classes_75kplus_train_008699
1,422
permissive
[ { "docstring": ":type nums1: List[int] :type nums2: List[int] :rtype: float", "name": "findMedianSortedArrays", "signature": "def findMedianSortedArrays(self, nums1, nums2)" }, { "docstring": ":type nums1: List[int] :type s1: int :type nums2: List[int] :type s2: int :type k: int :rtype: float", ...
2
stack_v2_sparse_classes_30k_train_017613
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMedianSortedArrays(self, nums1, nums2): :type nums1: List[int] :type nums2: List[int] :rtype: float - def findKthSortedArrays(self, nums1, s1, nums2, s2, k): :type nums1:...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMedianSortedArrays(self, nums1, nums2): :type nums1: List[int] :type nums2: List[int] :rtype: float - def findKthSortedArrays(self, nums1, s1, nums2, s2, k): :type nums1:...
cb70ca87aa4604d1aec83d4224b3489eacebba75
<|skeleton|> class Solution: def findMedianSortedArrays(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: float""" <|body_0|> def findKthSortedArrays(self, nums1, s1, nums2, s2, k): """:type nums1: List[int] :type s1: int :type nums2: List[int] :type s2: int...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def findMedianSortedArrays(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: float""" n1, n2 = (len(nums1), len(nums2)) left, right = ((n1 + n2 + 1) // 2, (n1 + n2 + 2) // 2) return (self.findKthSortedArrays(nums1, 0, nums2, 0, left) + self...
the_stack_v2_python_sparse
LeetCode/Python3/0004._Median_of_Two_Sorted_Arrays.py
icgw/practice
train
1