blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
6.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
438
7.52k
id
stringlengths
40
40
length_bytes
int64
506
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.25k
prompted_full_text
stringlengths
645
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.34k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
302
7.33k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
e4b14379eb670afab61944937403deb312e03268
[ "if num1 == num2:\n return 0\npos1 = []\npos2 = []\nfor i, v in enumerate(nums):\n if v == num1:\n pos1.append(i)\n if v == num2:\n pos2.append(i)\nif len(pos1) == 0 or len(pos2) == 0:\n return -1\nmindistance = len(nums)\nfor i in pos1:\n for j in pos2:\n t = abs(i - j)\n ...
<|body_start_0|> if num1 == num2: return 0 pos1 = [] pos2 = [] for i, v in enumerate(nums): if v == num1: pos1.append(i) if v == num2: pos2.append(i) if len(pos1) == 0 or len(pos2) == 0: return -1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minDistance1(self, nums: List[int], num1: int, num2: int) -> int: """数组存在重复元素,求num1和num2的最短距离""" <|body_0|> def minDistance(self, nums: List[int], num1: int, num2: int) -> int: """数组存在重复元素,求num1和num2的最短距离 最优解""" <|body_1|> <|end_skeleton|> <|b...
stack_v2_sparse_classes_36k_train_001800
1,707
no_license
[ { "docstring": "数组存在重复元素,求num1和num2的最短距离", "name": "minDistance1", "signature": "def minDistance1(self, nums: List[int], num1: int, num2: int) -> int" }, { "docstring": "数组存在重复元素,求num1和num2的最短距离 最优解", "name": "minDistance", "signature": "def minDistance(self, nums: List[int], num1: int, ...
2
stack_v2_sparse_classes_30k_train_013215
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minDistance1(self, nums: List[int], num1: int, num2: int) -> int: 数组存在重复元素,求num1和num2的最短距离 - def minDistance(self, nums: List[int], num1: int, num2: int) -> int: 数组存在重复元素,求nu...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minDistance1(self, nums: List[int], num1: int, num2: int) -> int: 数组存在重复元素,求num1和num2的最短距离 - def minDistance(self, nums: List[int], num1: int, num2: int) -> int: 数组存在重复元素,求nu...
3fd69b85f52af861ff7e2c74d8aacc515b192615
<|skeleton|> class Solution: def minDistance1(self, nums: List[int], num1: int, num2: int) -> int: """数组存在重复元素,求num1和num2的最短距离""" <|body_0|> def minDistance(self, nums: List[int], num1: int, num2: int) -> int: """数组存在重复元素,求num1和num2的最短距离 最优解""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minDistance1(self, nums: List[int], num1: int, num2: int) -> int: """数组存在重复元素,求num1和num2的最短距离""" if num1 == num2: return 0 pos1 = [] pos2 = [] for i, v in enumerate(nums): if v == num1: pos1.append(i) if ...
the_stack_v2_python_sparse
Other/NumsDistance.py
helloprogram6/leetcode_Cookbook_python
train
0
6d8fd81c0713e853944ff19070cb15a1af041ce7
[ "db = connect(db_url)\ndb_proxy.initialize(db)\nWeatherStats.create_table()", "stats = [stats] if not isinstance(stats, list) else stats\nfor stat in stats:\n _ = WeatherStats.insert(**stat.dict).on_conflict('replace').execute()", "if end_date:\n stats = WeatherStats.select().where((WeatherStats.city == c...
<|body_start_0|> db = connect(db_url) db_proxy.initialize(db) WeatherStats.create_table() <|end_body_0|> <|body_start_1|> stats = [stats] if not isinstance(stats, list) else stats for stat in stats: _ = WeatherStats.insert(**stat.dict).on_conflict('replace').execute(...
Класс для работы с БД
DatabaseUpdater
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DatabaseUpdater: """Класс для работы с БД""" def __init__(self, db_url): """:param db_url: str Путь к бд. См. https://peewee.readthedocs.io/en/latest/peewee/playhouse.html#db-url""" <|body_0|> def add_stats(self, stats): """Добавляет прогноз в базу данных :param ...
stack_v2_sparse_classes_36k_train_001801
1,822
no_license
[ { "docstring": ":param db_url: str Путь к бд. См. https://peewee.readthedocs.io/en/latest/peewee/playhouse.html#db-url", "name": "__init__", "signature": "def __init__(self, db_url)" }, { "docstring": "Добавляет прогноз в базу данных :param stats: [Stats, ] список прогнозов погоды", "name": ...
3
stack_v2_sparse_classes_30k_train_019483
Implement the Python class `DatabaseUpdater` described below. Class description: Класс для работы с БД Method signatures and docstrings: - def __init__(self, db_url): :param db_url: str Путь к бд. См. https://peewee.readthedocs.io/en/latest/peewee/playhouse.html#db-url - def add_stats(self, stats): Добавляет прогноз ...
Implement the Python class `DatabaseUpdater` described below. Class description: Класс для работы с БД Method signatures and docstrings: - def __init__(self, db_url): :param db_url: str Путь к бд. См. https://peewee.readthedocs.io/en/latest/peewee/playhouse.html#db-url - def add_stats(self, stats): Добавляет прогноз ...
d2c0014dffccadb8232a1034e4ea9b427016a1d1
<|skeleton|> class DatabaseUpdater: """Класс для работы с БД""" def __init__(self, db_url): """:param db_url: str Путь к бд. См. https://peewee.readthedocs.io/en/latest/peewee/playhouse.html#db-url""" <|body_0|> def add_stats(self, stats): """Добавляет прогноз в базу данных :param ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DatabaseUpdater: """Класс для работы с БД""" def __init__(self, db_url): """:param db_url: str Путь к бд. См. https://peewee.readthedocs.io/en/latest/peewee/playhouse.html#db-url""" db = connect(db_url) db_proxy.initialize(db) WeatherStats.create_table() def add_stats...
the_stack_v2_python_sparse
lesson_016/engine/db_updater.py
glotyuids/skillbox_learning
train
0
36f781fa6b60eca68a5f6a3cd792800d741592b7
[ "nums.sort()\nn = len(nums)\ncount = 0\npre = nums[0]\nif n == 1:\n return pre\nfor num in nums:\n if num != pre:\n if count == 1:\n return pre\n pre = num\n count = 1\n else:\n count += 1\nreturn num", "sum = 0\nfor n in nums:\n sum ^= n\nreturn sum" ]
<|body_start_0|> nums.sort() n = len(nums) count = 0 pre = nums[0] if n == 1: return pre for num in nums: if num != pre: if count == 1: return pre pre = num count = 1 e...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def singleNumber(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def singleNumber0(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> nums.sort() n = len(nums) ...
stack_v2_sparse_classes_36k_train_001802
668
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "singleNumber", "signature": "def singleNumber(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "singleNumber0", "signature": "def singleNumber0(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def singleNumber(self, nums): :type nums: List[int] :rtype: int - def singleNumber0(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 singleNumber(self, nums): :type nums: List[int] :rtype: int - def singleNumber0(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def singleNu...
9e49b2c6003b957276737005d4aaac276b44d251
<|skeleton|> class Solution: def singleNumber(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def singleNumber0(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def singleNumber(self, nums): """:type nums: List[int] :rtype: int""" nums.sort() n = len(nums) count = 0 pre = nums[0] if n == 1: return pre for num in nums: if num != pre: if count == 1: ...
the_stack_v2_python_sparse
PythonCode/src/0136_Single_Number.py
oneyuan/CodeforFun
train
0
13a705286855428685854833d92523ae412d3d60
[ "dir_name = os.path.dirname(outfile)\ninfile_stub = P.snip(os.path.basename(infile), '.bam')\ncontrol_stub = P.snip(os.path.basename(controlfile), '.bam')\noutfile_stub = infile_stub + '_VS_' + control_stub\noutfile_stub = os.path.join(dir_name, outfile_stub)\nstatement = ['macs2 callpeak --treatment %(infile)s --c...
<|body_start_0|> dir_name = os.path.dirname(outfile) infile_stub = P.snip(os.path.basename(infile), '.bam') control_stub = P.snip(os.path.basename(controlfile), '.bam') outfile_stub = infile_stub + '_VS_' + control_stub outfile_stub = os.path.join(dir_name, outfile_stub) ...
macs2IDRPeaks
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class macs2IDRPeaks: def getRunStatement(self, infile, outfile, controlfile): """Generate a specific run statement for each peakcaller class""" <|body_0|> def postProcess(self, infile, outfile, controlfile): """Takes the narrowPeak files output by macs2. If macs2 given pva...
stack_v2_sparse_classes_36k_train_001803
19,216
permissive
[ { "docstring": "Generate a specific run statement for each peakcaller class", "name": "getRunStatement", "signature": "def getRunStatement(self, infile, outfile, controlfile)" }, { "docstring": "Takes the narrowPeak files output by macs2. If macs2 given pvalue, then sorts by column 8 (-log10(pva...
2
null
Implement the Python class `macs2IDRPeaks` described below. Class description: Implement the macs2IDRPeaks class. Method signatures and docstrings: - def getRunStatement(self, infile, outfile, controlfile): Generate a specific run statement for each peakcaller class - def postProcess(self, infile, outfile, controlfil...
Implement the Python class `macs2IDRPeaks` described below. Class description: Implement the macs2IDRPeaks class. Method signatures and docstrings: - def getRunStatement(self, infile, outfile, controlfile): Generate a specific run statement for each peakcaller class - def postProcess(self, infile, outfile, controlfil...
7ae2e893a41f952c07f35b5cebb4c3c408d8477b
<|skeleton|> class macs2IDRPeaks: def getRunStatement(self, infile, outfile, controlfile): """Generate a specific run statement for each peakcaller class""" <|body_0|> def postProcess(self, infile, outfile, controlfile): """Takes the narrowPeak files output by macs2. If macs2 given pva...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class macs2IDRPeaks: def getRunStatement(self, infile, outfile, controlfile): """Generate a specific run statement for each peakcaller class""" dir_name = os.path.dirname(outfile) infile_stub = P.snip(os.path.basename(infile), '.bam') control_stub = P.snip(os.path.basename(controlfil...
the_stack_v2_python_sparse
obsolete/PipelineIDR.py
cgat-developers/cgat-flow
train
13
6863ad675ef48d1df9abc65224fc909dbd046a16
[ "sorted_nums = sorted(nums)\nlength = len(nums)\nclosest = float('inf')\nfor a in range(length - 2):\n b = a + 1\n c = length - 1\n while b < c:\n s = sorted_nums[a] + sorted_nums[b] + sorted_nums[c]\n if s == target:\n return s\n if abs(target - s) < abs(target - closest):\...
<|body_start_0|> sorted_nums = sorted(nums) length = len(nums) closest = float('inf') for a in range(length - 2): b = a + 1 c = length - 1 while b < c: s = sorted_nums[a] + sorted_nums[b] + sorted_nums[c] if s == target:...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def threeSumClosest(self, nums, target): """Optimized solution First sort the list in ascending order and use two pointers to narrow down search. Time: O(n^2) Space: O(n) * if we sort the list in-place, this would be O(1) :type nums: List[int] :type target: int :rtype: int""" ...
stack_v2_sparse_classes_36k_train_001804
1,494
no_license
[ { "docstring": "Optimized solution First sort the list in ascending order and use two pointers to narrow down search. Time: O(n^2) Space: O(n) * if we sort the list in-place, this would be O(1) :type nums: List[int] :type target: int :rtype: int", "name": "threeSumClosest", "signature": "def threeSumClo...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def threeSumClosest(self, nums, target): Optimized solution First sort the list in ascending order and use two pointers to narrow down search. Time: O(n^2) Space: O(n) * if we so...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def threeSumClosest(self, nums, target): Optimized solution First sort the list in ascending order and use two pointers to narrow down search. Time: O(n^2) Space: O(n) * if we so...
c14d8829c95f61ff6691816e8c0de76b9319f389
<|skeleton|> class Solution: def threeSumClosest(self, nums, target): """Optimized solution First sort the list in ascending order and use two pointers to narrow down search. Time: O(n^2) Space: O(n) * if we sort the list in-place, this would be O(1) :type nums: List[int] :type target: int :rtype: int""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def threeSumClosest(self, nums, target): """Optimized solution First sort the list in ascending order and use two pointers to narrow down search. Time: O(n^2) Space: O(n) * if we sort the list in-place, this would be O(1) :type nums: List[int] :type target: int :rtype: int""" sorted_...
the_stack_v2_python_sparse
medium/3sum-closest/solution.py
hsuanhauliu/leetcode-solutions
train
0
d6697b69f888aa83ef7cbd034c6a20d4dd7f0745
[ "super(DeepLPFNet, self).__init__()\nself.backbonenet = unet.UNetModel()\nself.deeplpfnet = DeepLPFParameterPrediction()", "feat = self.backbonenet(img)\nimg = self.deeplpfnet(feat)\nreturn img" ]
<|body_start_0|> super(DeepLPFNet, self).__init__() self.backbonenet = unet.UNetModel() self.deeplpfnet = DeepLPFParameterPrediction() <|end_body_0|> <|body_start_1|> feat = self.backbonenet(img) img = self.deeplpfnet(feat) return img <|end_body_1|>
DeepLPFNet
[ "BSD-3-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeepLPFNet: def __init__(self): """Initialisation function :returns: initialises parameters of the neural networ :rtype: N/A""" <|body_0|> def forward(self, img): """Neural network forward function :param img: forward the data img through the network :returns: residu...
stack_v2_sparse_classes_36k_train_001805
38,578
permissive
[ { "docstring": "Initialisation function :returns: initialises parameters of the neural networ :rtype: N/A", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Neural network forward function :param img: forward the data img through the network :returns: residual image :rtyp...
2
stack_v2_sparse_classes_30k_train_014160
Implement the Python class `DeepLPFNet` described below. Class description: Implement the DeepLPFNet class. Method signatures and docstrings: - def __init__(self): Initialisation function :returns: initialises parameters of the neural networ :rtype: N/A - def forward(self, img): Neural network forward function :param...
Implement the Python class `DeepLPFNet` described below. Class description: Implement the DeepLPFNet class. Method signatures and docstrings: - def __init__(self): Initialisation function :returns: initialises parameters of the neural networ :rtype: N/A - def forward(self, img): Neural network forward function :param...
82c49c36b76987a46dec8479793f7cf0150839c6
<|skeleton|> class DeepLPFNet: def __init__(self): """Initialisation function :returns: initialises parameters of the neural networ :rtype: N/A""" <|body_0|> def forward(self, img): """Neural network forward function :param img: forward the data img through the network :returns: residu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DeepLPFNet: def __init__(self): """Initialisation function :returns: initialises parameters of the neural networ :rtype: N/A""" super(DeepLPFNet, self).__init__() self.backbonenet = unet.UNetModel() self.deeplpfnet = DeepLPFParameterPrediction() def forward(self, img): ...
the_stack_v2_python_sparse
DeepLPF/model.py
huawei-noah/noah-research
train
816
e3444f0f65c68ffc8c264445b411017eb4b67aeb
[ "super().__init__(parent, Part.get_unscoped_name(part_name).split('.')[-1:])\nself.setFlags(Qt.ItemIsEnabled | Qt.ItemIsUserCheckable)\nself.setCheckState(0, Qt.Unchecked)\nself.part_name = part_name\nself.part = part\nself.target_availability = []", "if len(self.target_availability) == 0:\n self.setForeground...
<|body_start_0|> super().__init__(parent, Part.get_unscoped_name(part_name).split('.')[-1:]) self.setFlags(Qt.ItemIsEnabled | Qt.ItemIsUserCheckable) self.setCheckState(0, Qt.Unchecked) self.part_name = part_name self.part = part self.target_availability = [] <|end_body_0...
An item in a QTreeWidget that encapsulates a public part.
PartItem
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PartItem: """An item in a QTreeWidget that encapsulates a public part.""" def __init__(self, parent, part_name, part): """Initialise the item.""" <|body_0|> def set_availability(self): """Set the availability of the part.""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_36k_train_001806
13,213
permissive
[ { "docstring": "Initialise the item.", "name": "__init__", "signature": "def __init__(self, parent, part_name, part)" }, { "docstring": "Set the availability of the part.", "name": "set_availability", "signature": "def set_availability(self)" } ]
2
stack_v2_sparse_classes_30k_train_006316
Implement the Python class `PartItem` described below. Class description: An item in a QTreeWidget that encapsulates a public part. Method signatures and docstrings: - def __init__(self, parent, part_name, part): Initialise the item. - def set_availability(self): Set the availability of the part.
Implement the Python class `PartItem` described below. Class description: An item in a QTreeWidget that encapsulates a public part. Method signatures and docstrings: - def __init__(self, parent, part_name, part): Initialise the item. - def set_availability(self): Set the availability of the part. <|skeleton|> class ...
4ed2b1b9a2407afcbffdf304020d42b81c4c8cdc
<|skeleton|> class PartItem: """An item in a QTreeWidget that encapsulates a public part.""" def __init__(self, parent, part_name, part): """Initialise the item.""" <|body_0|> def set_availability(self): """Set the availability of the part.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PartItem: """An item in a QTreeWidget that encapsulates a public part.""" def __init__(self, parent, part_name, part): """Initialise the item.""" super().__init__(parent, Part.get_unscoped_name(part_name).split('.')[-1:]) self.setFlags(Qt.ItemIsEnabled | Qt.ItemIsUserCheckable) ...
the_stack_v2_python_sparse
note/demo/pyqt_demo/pyqtdeploy-3.3.0/pyqtdeploy/gui/packages_page.py
onsunsl/onsunsl.github.io
train
1
9b163d2f2dc761fcedc6068ae000b1c5faa7b4d5
[ "try:\n qr_code = qrcode.make(message)\n qr_code.save('/')\n return True\nexcept:\n return False", "print('Looking for valid QR code...')\nvid_stream = VideoStream('http://10.247.193.162:8080/video').start()\ntime.sleep(2.0)\nfound = set()\nwhile True:\n frame = vid_stream.read()\n frame = imuti...
<|body_start_0|> try: qr_code = qrcode.make(message) qr_code.save('/') return True except: return False <|end_body_0|> <|body_start_1|> print('Looking for valid QR code...') vid_stream = VideoStream('http://10.247.193.162:8080/video').star...
QR class for QR code authentication
Qr_auth
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Qr_auth: """QR class for QR code authentication""" def create_qr(self, message): """Function to create QR code""" <|body_0|> def read_qr(self): """Function to read QR code from IP Webcam""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: ...
stack_v2_sparse_classes_36k_train_001807
2,307
no_license
[ { "docstring": "Function to create QR code", "name": "create_qr", "signature": "def create_qr(self, message)" }, { "docstring": "Function to read QR code from IP Webcam", "name": "read_qr", "signature": "def read_qr(self)" } ]
2
stack_v2_sparse_classes_30k_train_007525
Implement the Python class `Qr_auth` described below. Class description: QR class for QR code authentication Method signatures and docstrings: - def create_qr(self, message): Function to create QR code - def read_qr(self): Function to read QR code from IP Webcam
Implement the Python class `Qr_auth` described below. Class description: QR class for QR code authentication Method signatures and docstrings: - def create_qr(self, message): Function to create QR code - def read_qr(self): Function to read QR code from IP Webcam <|skeleton|> class Qr_auth: """QR class for QR cod...
8a54132766ce38a7e338218cc70fd58093edd820
<|skeleton|> class Qr_auth: """QR class for QR code authentication""" def create_qr(self, message): """Function to create QR code""" <|body_0|> def read_qr(self): """Function to read QR code from IP Webcam""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Qr_auth: """QR class for QR code authentication""" def create_qr(self, message): """Function to create QR code""" try: qr_code = qrcode.make(message) qr_code.save('/') return True except: return False def read_qr(self): ...
the_stack_v2_python_sparse
AgentPi/qr_auth.py
chrisho251/Car-Share-IoT-Application
train
0
b2214986256a7b21b23d166354d12bf373f729e3
[ "self.message_received = message_container\nmessage = ''.join(message_container)\nmessage = message.split('X')[0]\nlogger.debug(f'the message after formatting and transforming: {message}')\nposes = message.split('|')\nposition_list = list()\nrotation_list = list()\nfor individual_pose in poses:\n position, rotat...
<|body_start_0|> self.message_received = message_container message = ''.join(message_container) message = message.split('X')[0] logger.debug(f'the message after formatting and transforming: {message}') poses = message.split('|') position_list = list() rotation_lis...
InformationProcessor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InformationProcessor: async def process_hololens_data(self, message_container: List[str]) -> Tuple[List[float], List[float]]: """this method takes the data received from the hololens and processes into a data format which can be processed furhter The data may either be : 1. trans+quat 2....
stack_v2_sparse_classes_36k_train_001808
3,853
no_license
[ { "docstring": "this method takes the data received from the hololens and processes into a data format which can be processed furhter The data may either be : 1. trans+quat 2. 3 rows of 4 elements =>rotationmatrix 3. list of n points The transmission format is as follows: 1. \"x,y,z:i,j,k,w|x,y,z:i,j,k,w|....X\...
2
stack_v2_sparse_classes_30k_test_000639
Implement the Python class `InformationProcessor` described below. Class description: Implement the InformationProcessor class. Method signatures and docstrings: - async def process_hololens_data(self, message_container: List[str]) -> Tuple[List[float], List[float]]: this method takes the data received from the holol...
Implement the Python class `InformationProcessor` described below. Class description: Implement the InformationProcessor class. Method signatures and docstrings: - async def process_hololens_data(self, message_container: List[str]) -> Tuple[List[float], List[float]]: this method takes the data received from the holol...
f779f93d2672a6e6d2ecbf789bdf0322a210c1a5
<|skeleton|> class InformationProcessor: async def process_hololens_data(self, message_container: List[str]) -> Tuple[List[float], List[float]]: """this method takes the data received from the hololens and processes into a data format which can be processed furhter The data may either be : 1. trans+quat 2....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InformationProcessor: async def process_hololens_data(self, message_container: List[str]) -> Tuple[List[float], List[float]]: """this method takes the data received from the hololens and processes into a data format which can be processed furhter The data may either be : 1. trans+quat 2. 3 rows of 4 e...
the_stack_v2_python_sparse
backend_core/backend_utils/information_processor.py
MarvinGravert/Master_thesis_backend
train
0
e125e655a8febcb816ca069eaaa3bbd2076ae4e7
[ "super(Conv1dGenerated, self).__init__()\nself.in_channels = in_channels\nself.out_channels = out_channels\nself.kernel_size = kernel_size\nself.groups = groups\nself.stride = stride\nself.padding = padding\nself.dilation = dilation\nself.bottleneck = nn.Linear(E_1, E_2) if E_1 is not None else nn.Parameter(torch.r...
<|body_start_0|> super(Conv1dGenerated, self).__init__() self.in_channels = in_channels self.out_channels = out_channels self.kernel_size = kernel_size self.groups = groups self.stride = stride self.padding = padding self.dilation = dilation self.b...
1D convolution with a kernel generated by a linear transformation of the instrument embedding
Conv1dGenerated
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Conv1dGenerated: """1D convolution with a kernel generated by a linear transformation of the instrument embedding""" def __init__(self, E_1, E_2, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=False): """Arguments: E_1 {int} -- Dimension of th...
stack_v2_sparse_classes_36k_train_001809
37,269
no_license
[ { "docstring": "Arguments: E_1 {int} -- Dimension of the instrument embedding E_2 {int} -- Dimension of the instrument embedding bottleneck in_channels {int} -- Number of channels of the input out_channels {int} -- Number of channels of the output kernel_size {int} -- Kernel size of the convolution Keyword Argu...
2
stack_v2_sparse_classes_30k_train_015725
Implement the Python class `Conv1dGenerated` described below. Class description: 1D convolution with a kernel generated by a linear transformation of the instrument embedding Method signatures and docstrings: - def __init__(self, E_1, E_2, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, group...
Implement the Python class `Conv1dGenerated` described below. Class description: 1D convolution with a kernel generated by a linear transformation of the instrument embedding Method signatures and docstrings: - def __init__(self, E_1, E_2, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, group...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class Conv1dGenerated: """1D convolution with a kernel generated by a linear transformation of the instrument embedding""" def __init__(self, E_1, E_2, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=False): """Arguments: E_1 {int} -- Dimension of th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Conv1dGenerated: """1D convolution with a kernel generated by a linear transformation of the instrument embedding""" def __init__(self, E_1, E_2, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=False): """Arguments: E_1 {int} -- Dimension of the instrument ...
the_stack_v2_python_sparse
generated/test_pfnet_research_meta_tasnet.py
jansel/pytorch-jit-paritybench
train
35
892cbc07a1524f47caaf9eddeb1e1485bb79c915
[ "data = form.cleaned_data\nself.success_url = reverse('registered_courses', kwargs={'level': int(data['level']), 'semester': int(data['semester'])})\nreturn super().form_valid(form)", "context = super().get_context_data(**kwargs)\ncontext['title_text'] = 'Choose Registered Courses To Display'\ncontext['detail_tex...
<|body_start_0|> data = form.cleaned_data self.success_url = reverse('registered_courses', kwargs={'level': int(data['level']), 'semester': int(data['semester'])}) return super().form_valid(form) <|end_body_0|> <|body_start_1|> context = super().get_context_data(**kwargs) contex...
View for choosing which registered course to display. Check that the user's account is still active. Redirects to registered_courses view on form valid.
ShowRegisteredCourseView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShowRegisteredCourseView: """View for choosing which registered course to display. Check that the user's account is still active. Redirects to registered_courses view on form valid.""" def form_valid(self, form): """Compute the success URL and call super.form_valid()""" <|bod...
stack_v2_sparse_classes_36k_train_001810
29,759
no_license
[ { "docstring": "Compute the success URL and call super.form_valid()", "name": "form_valid", "signature": "def form_valid(self, form)" }, { "docstring": "Return the data used in the templates rendering.", "name": "get_context_data", "signature": "def get_context_data(self, **kwargs)" } ...
2
stack_v2_sparse_classes_30k_train_000090
Implement the Python class `ShowRegisteredCourseView` described below. Class description: View for choosing which registered course to display. Check that the user's account is still active. Redirects to registered_courses view on form valid. Method signatures and docstrings: - def form_valid(self, form): Compute the...
Implement the Python class `ShowRegisteredCourseView` described below. Class description: View for choosing which registered course to display. Check that the user's account is still active. Redirects to registered_courses view on form valid. Method signatures and docstrings: - def form_valid(self, form): Compute the...
06bc577d01d3dbf6c425e03dcb903977a38e377c
<|skeleton|> class ShowRegisteredCourseView: """View for choosing which registered course to display. Check that the user's account is still active. Redirects to registered_courses view on form valid.""" def form_valid(self, form): """Compute the success URL and call super.form_valid()""" <|bod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ShowRegisteredCourseView: """View for choosing which registered course to display. Check that the user's account is still active. Redirects to registered_courses view on form valid.""" def form_valid(self, form): """Compute the success URL and call super.form_valid()""" data = form.cleane...
the_stack_v2_python_sparse
cbt/views.py
Festusali/CBTest
train
6
6ceeea63df91d96bd9f043a37ad31b4253134693
[ "super().__init__()\nif all((var is None for var in (hidden_conv_layers, n_filters, kernel_sizes, strides))):\n hidden_conv_layers = EncoderNet.DEFAULT_PARAMS['hidden_conv_layers']\n n_filters = EncoderNet.DEFAULT_PARAMS['n_filters']\n kernel_sizes = EncoderNet.DEFAULT_PARAMS['kernel_sizes']\n strides =...
<|body_start_0|> super().__init__() if all((var is None for var in (hidden_conv_layers, n_filters, kernel_sizes, strides))): hidden_conv_layers = EncoderNet.DEFAULT_PARAMS['hidden_conv_layers'] n_filters = EncoderNet.DEFAULT_PARAMS['n_filters'] kernel_sizes = EncoderN...
Implementation of the encoder network, that encodes the input frames sequence into a distribution over the latent space and samples with the common reparametrization trick. The network expects the images to be concatenated along channel dimension. This means that if a batch of sequences has shape (batch_size, seq_len, ...
EncoderNet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EncoderNet: """Implementation of the encoder network, that encodes the input frames sequence into a distribution over the latent space and samples with the common reparametrization trick. The network expects the images to be concatenated along channel dimension. This means that if a batch of sequ...
stack_v2_sparse_classes_36k_train_001811
6,277
permissive
[ { "docstring": "Instantiate the convolutional layers that compose the input network with the appropriate shapes. If K is the total number of layers, then hidden_conv_layers = K - 2. The length of n_filters must be K - 1, and that of kernel_sizes and strides must be K. If all them are None, EncoderNet.DEFAULT_PA...
2
stack_v2_sparse_classes_30k_train_010067
Implement the Python class `EncoderNet` described below. Class description: Implementation of the encoder network, that encodes the input frames sequence into a distribution over the latent space and samples with the common reparametrization trick. The network expects the images to be concatenated along channel dimens...
Implement the Python class `EncoderNet` described below. Class description: Implementation of the encoder network, that encodes the input frames sequence into a distribution over the latent space and samples with the common reparametrization trick. The network expects the images to be concatenated along channel dimens...
702d3ff3aec40eba20e17c5a1612b5b0b1e2f831
<|skeleton|> class EncoderNet: """Implementation of the encoder network, that encodes the input frames sequence into a distribution over the latent space and samples with the common reparametrization trick. The network expects the images to be concatenated along channel dimension. This means that if a batch of sequ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EncoderNet: """Implementation of the encoder network, that encodes the input frames sequence into a distribution over the latent space and samples with the common reparametrization trick. The network expects the images to be concatenated along channel dimension. This means that if a batch of sequences has sha...
the_stack_v2_python_sparse
networks/encoder_net.py
CampusAI/Hamiltonian-Generative-Networks
train
35
58f5d344a33a5fcca3f0e93fa0cd831eaa8cfd76
[ "try:\n advice = Advices.objects.filter(description=self.request.data['description'], type_diagnostic=self.request.data['type_diagnostic'], deleted=0)\nexcept:\n advice = None\nif advice:\n raise ValidationError({'description': ['Ya se registró esta recomendación.']})\nserializer.save()", "try:\n advi...
<|body_start_0|> try: advice = Advices.objects.filter(description=self.request.data['description'], type_diagnostic=self.request.data['type_diagnostic'], deleted=0) except: advice = None if advice: raise ValidationError({'description': ['Ya se registró esta re...
Type diagnostic view FILTERS: 'id': ['exact'], 'description':['exact', 'icontains'], 'type_diagnostic':['exact',], 'created_at': ['exact', 'year', 'year__gte', 'year__lte', 'month', 'month__lte', 'month__gte', 'day', 'day__lte', 'day__gte', 'year__in', 'month__in', 'day__in'], 'created_by': ['exact'],
AdvicesViewSet
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdvicesViewSet: """Type diagnostic view FILTERS: 'id': ['exact'], 'description':['exact', 'icontains'], 'type_diagnostic':['exact',], 'created_at': ['exact', 'year', 'year__gte', 'year__lte', 'month', 'month__lte', 'month__gte', 'day', 'day__lte', 'day__gte', 'year__in', 'month__in', 'day__in'], ...
stack_v2_sparse_classes_36k_train_001812
3,244
permissive
[ { "docstring": "Overwrite create", "name": "perform_create", "signature": "def perform_create(self, serializer)" }, { "docstring": "Overwrite update", "name": "perform_update", "signature": "def perform_update(self, serializer)" } ]
2
stack_v2_sparse_classes_30k_train_010242
Implement the Python class `AdvicesViewSet` described below. Class description: Type diagnostic view FILTERS: 'id': ['exact'], 'description':['exact', 'icontains'], 'type_diagnostic':['exact',], 'created_at': ['exact', 'year', 'year__gte', 'year__lte', 'month', 'month__lte', 'month__gte', 'day', 'day__lte', 'day__gte'...
Implement the Python class `AdvicesViewSet` described below. Class description: Type diagnostic view FILTERS: 'id': ['exact'], 'description':['exact', 'icontains'], 'type_diagnostic':['exact',], 'created_at': ['exact', 'year', 'year__gte', 'year__lte', 'month', 'month__lte', 'month__gte', 'day', 'day__lte', 'day__gte'...
6a18a137e0a16138607413925727d7e5f8486777
<|skeleton|> class AdvicesViewSet: """Type diagnostic view FILTERS: 'id': ['exact'], 'description':['exact', 'icontains'], 'type_diagnostic':['exact',], 'created_at': ['exact', 'year', 'year__gte', 'year__lte', 'month', 'month__lte', 'month__gte', 'day', 'day__lte', 'day__gte', 'year__in', 'month__in', 'day__in'], ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdvicesViewSet: """Type diagnostic view FILTERS: 'id': ['exact'], 'description':['exact', 'icontains'], 'type_diagnostic':['exact',], 'created_at': ['exact', 'year', 'year__gte', 'year__lte', 'month', 'month__lte', 'month__gte', 'day', 'day__lte', 'day__gte', 'year__in', 'month__in', 'day__in'], 'created_by':...
the_stack_v2_python_sparse
api/views/advices.py
jcasmer/grow_control_backend
train
2
386e3380ed2f0aa97b54aebfd55fe0ff611a2b34
[ "django_logs = hub_container.get_logs().decode('utf-8')\nassert 'Running migrations' in django_logs\npsql_output = postgresql_container.exec_psql(\"SELECT COUNT(*) FROM information_schema.tables WHERE table_schema='public';\")\ncount = int(psql_output.output.strip())\nassert count > 0", "client = hub_container.ht...
<|body_start_0|> django_logs = hub_container.get_logs().decode('utf-8') assert 'Running migrations' in django_logs psql_output = postgresql_container.exec_psql("SELECT COUNT(*) FROM information_schema.tables WHERE table_schema='public';") count = int(psql_output.output.strip()) a...
TestHubContainer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestHubContainer: def test_db_tables_created(self, hub_container, postgresql_container): """When the Django container starts, it should run its migrations""" <|body_0|> def test_admin_page(self, hub_container, postgresql_container): """When we try to access the djang...
stack_v2_sparse_classes_36k_train_001813
1,166
permissive
[ { "docstring": "When the Django container starts, it should run its migrations", "name": "test_db_tables_created", "signature": "def test_db_tables_created(self, hub_container, postgresql_container)" }, { "docstring": "When we try to access the django admin page, it should be returned", "nam...
2
null
Implement the Python class `TestHubContainer` described below. Class description: Implement the TestHubContainer class. Method signatures and docstrings: - def test_db_tables_created(self, hub_container, postgresql_container): When the Django container starts, it should run its migrations - def test_admin_page(self, ...
Implement the Python class `TestHubContainer` described below. Class description: Implement the TestHubContainer class. Method signatures and docstrings: - def test_db_tables_created(self, hub_container, postgresql_container): When the Django container starts, it should run its migrations - def test_admin_page(self, ...
e1ea0beaf079f4f4d5f9562fb9d9a4f0670f459f
<|skeleton|> class TestHubContainer: def test_db_tables_created(self, hub_container, postgresql_container): """When the Django container starts, it should run its migrations""" <|body_0|> def test_admin_page(self, hub_container, postgresql_container): """When we try to access the djang...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestHubContainer: def test_db_tables_created(self, hub_container, postgresql_container): """When the Django container starts, it should run its migrations""" django_logs = hub_container.get_logs().decode('utf-8') assert 'Running migrations' in django_logs psql_output = postgres...
the_stack_v2_python_sparse
seaworthy/test.py
praekeltfoundation/ndoh-hub
train
0
a41cbba17ea89f17dfcf3123be2ca308b2fdd219
[ "unique_slug = slug = slugify(self.name)\nnum = 1\nwhile Tag.objects.filter(slug=unique_slug).exists():\n unique_slug = '{}-{}'.format(slug, num)\n num += 1\nreturn unique_slug", "if not self.slug:\n self.slug = self._generate_unique_slug()\nsuper().save(*args, **kwargs)" ]
<|body_start_0|> unique_slug = slug = slugify(self.name) num = 1 while Tag.objects.filter(slug=unique_slug).exists(): unique_slug = '{}-{}'.format(slug, num) num += 1 return unique_slug <|end_body_0|> <|body_start_1|> if not self.slug: self.sl...
Tag
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Tag: def _generate_unique_slug(self): """Generates a unique slug based on the tag name.""" <|body_0|> def save(self, *args, **kwargs): """Tag save method. Before checking it creates a unique tag slug if does not exist already.""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_36k_train_001814
1,249
permissive
[ { "docstring": "Generates a unique slug based on the tag name.", "name": "_generate_unique_slug", "signature": "def _generate_unique_slug(self)" }, { "docstring": "Tag save method. Before checking it creates a unique tag slug if does not exist already.", "name": "save", "signature": "def...
2
stack_v2_sparse_classes_30k_train_015075
Implement the Python class `Tag` described below. Class description: Implement the Tag class. Method signatures and docstrings: - def _generate_unique_slug(self): Generates a unique slug based on the tag name. - def save(self, *args, **kwargs): Tag save method. Before checking it creates a unique tag slug if does not...
Implement the Python class `Tag` described below. Class description: Implement the Tag class. Method signatures and docstrings: - def _generate_unique_slug(self): Generates a unique slug based on the tag name. - def save(self, *args, **kwargs): Tag save method. Before checking it creates a unique tag slug if does not...
11896f17d0a30d1ae7e7f0ee8ccd6ab7652b25a7
<|skeleton|> class Tag: def _generate_unique_slug(self): """Generates a unique slug based on the tag name.""" <|body_0|> def save(self, *args, **kwargs): """Tag save method. Before checking it creates a unique tag slug if does not exist already.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Tag: def _generate_unique_slug(self): """Generates a unique slug based on the tag name.""" unique_slug = slug = slugify(self.name) num = 1 while Tag.objects.filter(slug=unique_slug).exists(): unique_slug = '{}-{}'.format(slug, num) num += 1 retur...
the_stack_v2_python_sparse
tags/models.py
pkmanish2611/plio-backend
train
0
d25f54f2efc7874765e4adc0c2892d643feb27fb
[ "self.delete_old = False\nself.service = service\nself.config = config\nself.validate_config()\nself.events: dict[Calendar, list[Event]] = {}\nself.dst_src: dict[Calendar, list[Calendar]] = {}\nself.src_cals: set[Calendar] = set()\nself.dst_cals: set[Calendar] = set()\nself.lock = asyncio.Lock()", "want_destinati...
<|body_start_0|> self.delete_old = False self.service = service self.config = config self.validate_config() self.events: dict[Calendar, list[Event]] = {} self.dst_src: dict[Calendar, list[Calendar]] = {} self.src_cals: set[Calendar] = set() self.dst_cals: ...
Google Calendar Aggregator.
GCalAggregator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GCalAggregator: """Google Calendar Aggregator.""" def __init__(self, service, config) -> None: """Initialize an Aggregator.""" <|body_0|> def validate_config(self) -> None: """Validate the calendar names in the config.""" <|body_1|> def load_calendar...
stack_v2_sparse_classes_36k_train_001815
17,423
no_license
[ { "docstring": "Initialize an Aggregator.", "name": "__init__", "signature": "def __init__(self, service, config) -> None" }, { "docstring": "Validate the calendar names in the config.", "name": "validate_config", "signature": "def validate_config(self) -> None" }, { "docstring":...
6
stack_v2_sparse_classes_30k_train_014505
Implement the Python class `GCalAggregator` described below. Class description: Google Calendar Aggregator. Method signatures and docstrings: - def __init__(self, service, config) -> None: Initialize an Aggregator. - def validate_config(self) -> None: Validate the calendar names in the config. - def load_calendars(se...
Implement the Python class `GCalAggregator` described below. Class description: Google Calendar Aggregator. Method signatures and docstrings: - def __init__(self, service, config) -> None: Initialize an Aggregator. - def validate_config(self) -> None: Validate the calendar names in the config. - def load_calendars(se...
ce37b68f5e869b8fa9390c278aee716dda7f085d
<|skeleton|> class GCalAggregator: """Google Calendar Aggregator.""" def __init__(self, service, config) -> None: """Initialize an Aggregator.""" <|body_0|> def validate_config(self) -> None: """Validate the calendar names in the config.""" <|body_1|> def load_calendar...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GCalAggregator: """Google Calendar Aggregator.""" def __init__(self, service, config) -> None: """Initialize an Aggregator.""" self.delete_old = False self.service = service self.config = config self.validate_config() self.events: dict[Calendar, list[Event]...
the_stack_v2_python_sparse
gcal_aggregator/aggregate.py
IsaacG/python-projects
train
1
4cab805cc8d6819f74aed5c0ab39268c11263522
[ "if self.display_location != DISPLAY_LOCATIONS[0][0] and (not self.page):\n raise ValidationError({'page': 'This field is required'})\nreturn super().clean()", "if not page:\n return cls.objects.none()\ndismissed = cls.dismissed(request)\nlocation = DISPLAY_LOCATIONS[1][0]\nnotices = cls.objects.all().filte...
<|body_start_0|> if self.display_location != DISPLAY_LOCATIONS[0][0] and (not self.page): raise ValidationError({'page': 'This field is required'}) return super().clean() <|end_body_0|> <|body_start_1|> if not page: return cls.objects.none() dismissed = cls.dismi...
A snippet class for page notices.
PageNotice
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PageNotice: """A snippet class for page notices.""" def clean(self): """Page field is optional, so raise a validation error when a notice is not global.""" <|body_0|> def get_notice(cls, page, request): """Class method for finding most specific notice to match a ...
stack_v2_sparse_classes_36k_train_001816
6,697
permissive
[ { "docstring": "Page field is optional, so raise a validation error when a notice is not global.", "name": "clean", "signature": "def clean(self)" }, { "docstring": "Class method for finding most specific notice to match a page.", "name": "get_notice", "signature": "def get_notice(cls, p...
2
null
Implement the Python class `PageNotice` described below. Class description: A snippet class for page notices. Method signatures and docstrings: - def clean(self): Page field is optional, so raise a validation error when a notice is not global. - def get_notice(cls, page, request): Class method for finding most specif...
Implement the Python class `PageNotice` described below. Class description: A snippet class for page notices. Method signatures and docstrings: - def clean(self): Page field is optional, so raise a validation error when a notice is not global. - def get_notice(cls, page, request): Class method for finding most specif...
4cf7be72b6b3d0c46dcadcc9d9904b471215ea81
<|skeleton|> class PageNotice: """A snippet class for page notices.""" def clean(self): """Page field is optional, so raise a validation error when a notice is not global.""" <|body_0|> def get_notice(cls, page, request): """Class method for finding most specific notice to match a ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PageNotice: """A snippet class for page notices.""" def clean(self): """Page field is optional, so raise a validation error when a notice is not global.""" if self.display_location != DISPLAY_LOCATIONS[0][0] and (not self.page): raise ValidationError({'page': 'This field is re...
the_stack_v2_python_sparse
notices/models.py
IATI/IATI-Standard-Website
train
4
f420d6fe0349a4db5d669fd5128fb93c6898bb0d
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn SharingInvitation()", "from .identity_set import IdentitySet\nfrom .identity_set import IdentitySet\nfields: Dict[str, Callable[[Any], None]] = {'email': lambda n: setattr(self, 'email', n.get_str_value()), 'invitedBy': lambda n: setat...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return SharingInvitation() <|end_body_0|> <|body_start_1|> from .identity_set import IdentitySet from .identity_set import IdentitySet fields: Dict[str, Callable[[Any], None]] = {'email...
SharingInvitation
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SharingInvitation: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SharingInvitation: """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...
stack_v2_sparse_classes_36k_train_001817
3,527
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: SharingInvitation", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_v...
3
stack_v2_sparse_classes_30k_train_011291
Implement the Python class `SharingInvitation` described below. Class description: Implement the SharingInvitation class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SharingInvitation: Creates a new instance of the appropriate class based on discrim...
Implement the Python class `SharingInvitation` described below. Class description: Implement the SharingInvitation class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SharingInvitation: Creates a new instance of the appropriate class based on discrim...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class SharingInvitation: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SharingInvitation: """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...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SharingInvitation: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SharingInvitation: """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: Shar...
the_stack_v2_python_sparse
msgraph/generated/models/sharing_invitation.py
microsoftgraph/msgraph-sdk-python
train
135
1e64394032698e6ddfc25913ea5923e7e8e750d0
[ "self.meta_path = graph_saver.get_meta_and_checkpoint_path(working_dir)\nif starting_ops:\n self.starting_ops = starting_ops\nelse:\n self.starting_ops = []\nif ending_ops:\n self.ending_ops = ending_ops\nelse:\n self.ending_ops = []\nself.input_shape = input_shape\ngraph_saver.save_model_to_meta(model=...
<|body_start_0|> self.meta_path = graph_saver.get_meta_and_checkpoint_path(working_dir) if starting_ops: self.starting_ops = starting_ops else: self.starting_ops = [] if ending_ops: self.ending_ops = ending_ops else: self.ending_ops...
Stores, creates and updates the Layer database. Also stores compressible layers to model optimization.
LayerDatabase
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LayerDatabase: """Stores, creates and updates the Layer database. Also stores compressible layers to model optimization.""" def __init__(self, model: tf.compat.v1.Session, input_shape: Union[Tuple, List[Tuple]], working_dir: str, starting_ops: List[str]=None, ending_ops: List[str]=None): ...
stack_v2_sparse_classes_36k_train_001818
11,506
permissive
[ { "docstring": ":param model: TensorFlow Session :param input_shape: tuple or list of tuples of input shapes to the model :param working_dir: path to working directory to store intermediate graphs :param starting_ops: Starting ops of the graph, used in a top down DFS search :param ending_ops: Ending ops of the ...
6
null
Implement the Python class `LayerDatabase` described below. Class description: Stores, creates and updates the Layer database. Also stores compressible layers to model optimization. Method signatures and docstrings: - def __init__(self, model: tf.compat.v1.Session, input_shape: Union[Tuple, List[Tuple]], working_dir:...
Implement the Python class `LayerDatabase` described below. Class description: Stores, creates and updates the Layer database. Also stores compressible layers to model optimization. Method signatures and docstrings: - def __init__(self, model: tf.compat.v1.Session, input_shape: Union[Tuple, List[Tuple]], working_dir:...
5a406e657082b6a4f6e4bf48f0e46e085cb1e351
<|skeleton|> class LayerDatabase: """Stores, creates and updates the Layer database. Also stores compressible layers to model optimization.""" def __init__(self, model: tf.compat.v1.Session, input_shape: Union[Tuple, List[Tuple]], working_dir: str, starting_ops: List[str]=None, ending_ops: List[str]=None): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LayerDatabase: """Stores, creates and updates the Layer database. Also stores compressible layers to model optimization.""" def __init__(self, model: tf.compat.v1.Session, input_shape: Union[Tuple, List[Tuple]], working_dir: str, starting_ops: List[str]=None, ending_ops: List[str]=None): """:para...
the_stack_v2_python_sparse
TrainingExtensions/tensorflow/src/python/aimet_tensorflow/layer_database.py
quic/aimet
train
1,676
f5a742cc3f4d3a074f29c6b122eea154e5c577d6
[ "self.k = k\nself.model = model\nself.args = [list() for i in range(k)]", "probs = tf.nn.softmax(logits, axis=-1)\ntopk_probs = tf.math.top_k(probs, self.k)[0].numpy()\ntopk_args = np.squeeze(tf.math.top_k(probs, self.k)[1].numpy())\n_ = [self.args[i].append(topk_args[i]) for i in range(self.k)]\ndec_input = np.a...
<|body_start_0|> self.k = k self.model = model self.args = [list() for i in range(k)] <|end_body_0|> <|body_start_1|> probs = tf.nn.softmax(logits, axis=-1) topk_probs = tf.math.top_k(probs, self.k)[0].numpy() topk_args = np.squeeze(tf.math.top_k(probs, self.k)[1].numpy(...
BeamSearch
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BeamSearch: def __init__(self, k, model): """k- beam search width model- decoding model""" <|body_0|> def first_step(self, logits): """logits- (seqlen=1, target_vocab_size)""" <|body_1|> def multisteps(self, enc_input, dec_input, topk_probs, tar_vocab_si...
stack_v2_sparse_classes_36k_train_001819
2,733
permissive
[ { "docstring": "k- beam search width model- decoding model", "name": "__init__", "signature": "def __init__(self, k, model)" }, { "docstring": "logits- (seqlen=1, target_vocab_size)", "name": "first_step", "signature": "def first_step(self, logits)" }, { "docstring": "enc_input- ...
5
stack_v2_sparse_classes_30k_train_006406
Implement the Python class `BeamSearch` described below. Class description: Implement the BeamSearch class. Method signatures and docstrings: - def __init__(self, k, model): k- beam search width model- decoding model - def first_step(self, logits): logits- (seqlen=1, target_vocab_size) - def multisteps(self, enc_inpu...
Implement the Python class `BeamSearch` described below. Class description: Implement the BeamSearch class. Method signatures and docstrings: - def __init__(self, k, model): k- beam search width model- decoding model - def first_step(self, logits): logits- (seqlen=1, target_vocab_size) - def multisteps(self, enc_inpu...
bdd5493cbb99c3eb1b12979745dacd20be62c51d
<|skeleton|> class BeamSearch: def __init__(self, k, model): """k- beam search width model- decoding model""" <|body_0|> def first_step(self, logits): """logits- (seqlen=1, target_vocab_size)""" <|body_1|> def multisteps(self, enc_input, dec_input, topk_probs, tar_vocab_si...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BeamSearch: def __init__(self, k, model): """k- beam search width model- decoding model""" self.k = k self.model = model self.args = [list() for i in range(k)] def first_step(self, logits): """logits- (seqlen=1, target_vocab_size)""" probs = tf.nn.softmax(l...
the_stack_v2_python_sparse
tf_lightning/utils/beam_search.py
MukundVarmaT/tf-lightning
train
0
20ef8e584e16577c207e2acd7e93d6bbf64f7b6e
[ "super(Generator, self).__init__()\nself.song_len, self.batch_size, self.num_feature = (song_len, batch_size, num_feature)\nself.rand_feature_dim = rand_feature_dim\n'Song Generator'\nself.fc1 = nn.Linear(self.rand_feature_dim * 2, num_hidden)\nself.lstm_g1 = nn.LSTMCell(num_hidden, num_hidden)\nself.ht1, self.ct1 ...
<|body_start_0|> super(Generator, self).__init__() self.song_len, self.batch_size, self.num_feature = (song_len, batch_size, num_feature) self.rand_feature_dim = rand_feature_dim 'Song Generator' self.fc1 = nn.Linear(self.rand_feature_dim * 2, num_hidden) self.lstm_g1 = n...
Generator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Generator: def __init__(self, song_len, batch_size, num_feature, rand_feature_dim, num_hidden=350, keep_prob=0.5): """Generator of C-R-GAN. Get a midi sequence which is similar to a real music. :var input_dim: Input song dimension = [song_len, batch_size, num_feature]. A random input. :p...
stack_v2_sparse_classes_36k_train_001820
5,393
no_license
[ { "docstring": "Generator of C-R-GAN. Get a midi sequence which is similar to a real music. :var input_dim: Input song dimension = [song_len, batch_size, num_feature]. A random input. :param song_len: :param batch_size: :param num_feature: :param rand_feature_dim: Num feature of rand_inputs :param num_hidden: H...
2
stack_v2_sparse_classes_30k_train_019101
Implement the Python class `Generator` described below. Class description: Implement the Generator class. Method signatures and docstrings: - def __init__(self, song_len, batch_size, num_feature, rand_feature_dim, num_hidden=350, keep_prob=0.5): Generator of C-R-GAN. Get a midi sequence which is similar to a real mus...
Implement the Python class `Generator` described below. Class description: Implement the Generator class. Method signatures and docstrings: - def __init__(self, song_len, batch_size, num_feature, rand_feature_dim, num_hidden=350, keep_prob=0.5): Generator of C-R-GAN. Get a midi sequence which is similar to a real mus...
aab5bf469d00506a4d2782e90f6fe9fc55bb50fb
<|skeleton|> class Generator: def __init__(self, song_len, batch_size, num_feature, rand_feature_dim, num_hidden=350, keep_prob=0.5): """Generator of C-R-GAN. Get a midi sequence which is similar to a real music. :var input_dim: Input song dimension = [song_len, batch_size, num_feature]. A random input. :p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Generator: def __init__(self, song_len, batch_size, num_feature, rand_feature_dim, num_hidden=350, keep_prob=0.5): """Generator of C-R-GAN. Get a midi sequence which is similar to a real music. :var input_dim: Input song dimension = [song_len, batch_size, num_feature]. A random input. :param song_len:...
the_stack_v2_python_sparse
c-rnn-gan/model.py
pzq7025/Music
train
0
0b3484f7d2692e39751cb995b88ee51339c4cb4d
[ "if opt is None:\n opt = ConvCnstrMODMaskDcpl_IterSM.Options()\nsuper(ConvCnstrMODMaskDcpl_IterSM, self).__init__(Z, S, W, dsz, opt, dimK, dimN)", "self.YU[:] = self.Y - self.U\nself.block_sep0(self.YU)[:] += self.S\nYUf = sl.rfftn(self.YU, None, self.cri.axisN)\nb = sl.inner(np.conj(self.Zf), self.block_sep0(...
<|body_start_0|> if opt is None: opt = ConvCnstrMODMaskDcpl_IterSM.Options() super(ConvCnstrMODMaskDcpl_IterSM, self).__init__(Z, S, W, dsz, opt, dimK, dimN) <|end_body_0|> <|body_start_1|> self.YU[:] = self.Y - self.U self.block_sep0(self.YU)[:] += self.S YUf = sl.r...
ADMM algorithm for Convolutional Constrained MOD with Mask Decoupling :cite:`heide-2015-fast` with the :math:`\\mathbf{x}` step solved via iterated application of the Sherman-Morrison equation :cite:`wohlberg-2016-efficient`. | .. inheritance-diagram:: ConvCnstrMODMaskDcpl_IterSM :parts: 2 | Multi-channel signals/image...
ConvCnstrMODMaskDcpl_IterSM
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConvCnstrMODMaskDcpl_IterSM: """ADMM algorithm for Convolutional Constrained MOD with Mask Decoupling :cite:`heide-2015-fast` with the :math:`\\mathbf{x}` step solved via iterated application of the Sherman-Morrison equation :cite:`wohlberg-2016-efficient`. | .. inheritance-diagram:: ConvCnstrMOD...
stack_v2_sparse_classes_36k_train_001821
39,880
permissive
[ { "docstring": "| **Call graph** .. image:: ../_static/jonga/ccmodmdism_init.svg :width: 20% :target: ../_static/jonga/ccmodmdism_init.svg", "name": "__init__", "signature": "def __init__(self, Z, S, W, dsz, opt=None, dimK=1, dimN=2)" }, { "docstring": "Minimise Augmented Lagrangian with respect...
2
null
Implement the Python class `ConvCnstrMODMaskDcpl_IterSM` described below. Class description: ADMM algorithm for Convolutional Constrained MOD with Mask Decoupling :cite:`heide-2015-fast` with the :math:`\\mathbf{x}` step solved via iterated application of the Sherman-Morrison equation :cite:`wohlberg-2016-efficient`. ...
Implement the Python class `ConvCnstrMODMaskDcpl_IterSM` described below. Class description: ADMM algorithm for Convolutional Constrained MOD with Mask Decoupling :cite:`heide-2015-fast` with the :math:`\\mathbf{x}` step solved via iterated application of the Sherman-Morrison equation :cite:`wohlberg-2016-efficient`. ...
5a64fbe456f3a117275c45ee1f10c60d6e133915
<|skeleton|> class ConvCnstrMODMaskDcpl_IterSM: """ADMM algorithm for Convolutional Constrained MOD with Mask Decoupling :cite:`heide-2015-fast` with the :math:`\\mathbf{x}` step solved via iterated application of the Sherman-Morrison equation :cite:`wohlberg-2016-efficient`. | .. inheritance-diagram:: ConvCnstrMOD...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConvCnstrMODMaskDcpl_IterSM: """ADMM algorithm for Convolutional Constrained MOD with Mask Decoupling :cite:`heide-2015-fast` with the :math:`\\mathbf{x}` step solved via iterated application of the Sherman-Morrison equation :cite:`wohlberg-2016-efficient`. | .. inheritance-diagram:: ConvCnstrMODMaskDcpl_Iter...
the_stack_v2_python_sparse
benchmarks/other/sporco/admm/ccmodmd.py
tomMoral/dicodile
train
17
9cc119613e1c46cda66c3272a9d549a78fbb1e57
[ "while True:\n r = s.replace('()', '').replace('[]', '').replace('{}', '')\n if r == '':\n return True\n elif r == s:\n return False\n else:\n s = r", "pair = {'(': ')', '[': ']', '{': '}'}\nstack = []\nfor p in s:\n if p in pair:\n stack.append(p)\n else:\n if...
<|body_start_0|> while True: r = s.replace('()', '').replace('[]', '').replace('{}', '') if r == '': return True elif r == s: return False else: s = r <|end_body_0|> <|body_start_1|> pair = {'(': ')', '[': '...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isValid(self, s): """:type s: str :rtype: bool""" <|body_0|> def isValid2(self, s): """Using stack.""" <|body_1|> <|end_skeleton|> <|body_start_0|> while True: r = s.replace('()', '').replace('[]', '').replace('{}', '') ...
stack_v2_sparse_classes_36k_train_001822
996
no_license
[ { "docstring": ":type s: str :rtype: bool", "name": "isValid", "signature": "def isValid(self, s)" }, { "docstring": "Using stack.", "name": "isValid2", "signature": "def isValid2(self, s)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValid(self, s): :type s: str :rtype: bool - def isValid2(self, s): Using stack.
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValid(self, s): :type s: str :rtype: bool - def isValid2(self, s): Using stack. <|skeleton|> class Solution: def isValid(self, s): """:type s: str :rtype: boo...
11942efcf481ab79a1c4a7e020e4353e0e0d3901
<|skeleton|> class Solution: def isValid(self, s): """:type s: str :rtype: bool""" <|body_0|> def isValid2(self, s): """Using stack.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isValid(self, s): """:type s: str :rtype: bool""" while True: r = s.replace('()', '').replace('[]', '').replace('{}', '') if r == '': return True elif r == s: return False else: s = r ...
the_stack_v2_python_sparse
python/solveleet/validParentheses.py
clumsyme/learn
train
0
c26c2039ea0afa6f699a7decc83a72fff7344846
[ "tiles = data_input('test_data')\nresult = part_1(tiles)\nself.assertEqual(result, 20899048083289)", "tiles = data_input('data')\nresult = part_1(tiles)\nself.assertEqual(result, 18482479935793)", "tiles = data_input('test_data')\nresult = part_2(tiles)\nself.assertEqual(result, 273)", "tiles = data_input('da...
<|body_start_0|> tiles = data_input('test_data') result = part_1(tiles) self.assertEqual(result, 20899048083289) <|end_body_0|> <|body_start_1|> tiles = data_input('data') result = part_1(tiles) self.assertEqual(result, 18482479935793) <|end_body_1|> <|body_start_2|> ...
()
TestAoC20
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestAoC20: """()""" def test_part_1_1(self): """()""" <|body_0|> def test_part_1_2(self): """()""" <|body_1|> def test_part_2_1(self): """()""" <|body_2|> def test_part_2_2(self): """()""" <|body_3|> <|end_skelet...
stack_v2_sparse_classes_36k_train_001823
953
no_license
[ { "docstring": "()", "name": "test_part_1_1", "signature": "def test_part_1_1(self)" }, { "docstring": "()", "name": "test_part_1_2", "signature": "def test_part_1_2(self)" }, { "docstring": "()", "name": "test_part_2_1", "signature": "def test_part_2_1(self)" }, { ...
4
stack_v2_sparse_classes_30k_train_014527
Implement the Python class `TestAoC20` described below. Class description: () Method signatures and docstrings: - def test_part_1_1(self): () - def test_part_1_2(self): () - def test_part_2_1(self): () - def test_part_2_2(self): ()
Implement the Python class `TestAoC20` described below. Class description: () Method signatures and docstrings: - def test_part_1_1(self): () - def test_part_1_2(self): () - def test_part_2_1(self): () - def test_part_2_2(self): () <|skeleton|> class TestAoC20: """()""" def test_part_1_1(self): """(...
934c1c45daf189ce2f517b70abe896fedb152b88
<|skeleton|> class TestAoC20: """()""" def test_part_1_1(self): """()""" <|body_0|> def test_part_1_2(self): """()""" <|body_1|> def test_part_2_1(self): """()""" <|body_2|> def test_part_2_2(self): """()""" <|body_3|> <|end_skelet...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestAoC20: """()""" def test_part_1_1(self): """()""" tiles = data_input('test_data') result = part_1(tiles) self.assertEqual(result, 20899048083289) def test_part_1_2(self): """()""" tiles = data_input('data') result = part_1(tiles) se...
the_stack_v2_python_sparse
20/test.py
iveL91/Advent-of-Code-2020
train
0
0e4d80688909d5ef80563e4ea41ffef8c72b2b8c
[ "buff = BytesIO()\nbuff.write(stream)\nbuff.seek(0)\ntry:\n Img.open(buff)\n result = True\nexcept UnidentifiedImageError:\n result = False\nbuff.close()\nreturn result", "buff = BytesIO()\nbuff.write(image_stream)\nbuff.seek(0)\nimage = Img.open(buff)\nrotated_buff = BytesIO()\nimage.rotate(rotation, ex...
<|body_start_0|> buff = BytesIO() buff.write(stream) buff.seek(0) try: Img.open(buff) result = True except UnidentifiedImageError: result = False buff.close() return result <|end_body_0|> <|body_start_1|> buff = BytesIO...
Contains methods for interacting with images.
Image
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Image: """Contains methods for interacting with images.""" def is_image(stream: bytes) -> bool: """Checks if a stream is indeed an image.""" <|body_0|> def rotate_image(image_stream: bytes, rotation: Union[float, int]) -> bytes: """Rotates an image by a rotation ...
stack_v2_sparse_classes_36k_train_001824
1,678
no_license
[ { "docstring": "Checks if a stream is indeed an image.", "name": "is_image", "signature": "def is_image(stream: bytes) -> bool" }, { "docstring": "Rotates an image by a rotation angle.", "name": "rotate_image", "signature": "def rotate_image(image_stream: bytes, rotation: Union[float, in...
3
stack_v2_sparse_classes_30k_train_012614
Implement the Python class `Image` described below. Class description: Contains methods for interacting with images. Method signatures and docstrings: - def is_image(stream: bytes) -> bool: Checks if a stream is indeed an image. - def rotate_image(image_stream: bytes, rotation: Union[float, int]) -> bytes: Rotates an...
Implement the Python class `Image` described below. Class description: Contains methods for interacting with images. Method signatures and docstrings: - def is_image(stream: bytes) -> bool: Checks if a stream is indeed an image. - def rotate_image(image_stream: bytes, rotation: Union[float, int]) -> bytes: Rotates an...
11b213da49ef00a82fc7a2c9488291d03f6a56ae
<|skeleton|> class Image: """Contains methods for interacting with images.""" def is_image(stream: bytes) -> bool: """Checks if a stream is indeed an image.""" <|body_0|> def rotate_image(image_stream: bytes, rotation: Union[float, int]) -> bytes: """Rotates an image by a rotation ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Image: """Contains methods for interacting with images.""" def is_image(stream: bytes) -> bool: """Checks if a stream is indeed an image.""" buff = BytesIO() buff.write(stream) buff.seek(0) try: Img.open(buff) result = True except Un...
the_stack_v2_python_sparse
venv/Lib/site-packages/PyPDFForm/core/image.py
KevinIbel/WebScraper
train
0
7e9c0b7d49556895dd6c79bd7e349b3cb06abd0b
[ "order_id = request.GET.get('order_id')\ntry:\n order = OrderInfo.objects.get(order_id=order_id, user=request.user)\nexcept OrderInfo.DoesNotExist:\n return http.HttpResponseForbidden('订单不存在')\ntry:\n uncomment_goods = order.skus.filter(is_commented=False, order_id=order_id)\nexcept OrderInfo.DoesNotExist:...
<|body_start_0|> order_id = request.GET.get('order_id') try: order = OrderInfo.objects.get(order_id=order_id, user=request.user) except OrderInfo.DoesNotExist: return http.HttpResponseForbidden('订单不存在') try: uncomment_goods = order.skus.filter(is_comme...
订单商品评价
OrderCommentView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrderCommentView: """订单商品评价""" def get(self, request): """订单商品评价 :param request: :return:""" <|body_0|> def post(self, request): """获取参数修改评论页面的内容""" <|body_1|> <|end_skeleton|> <|body_start_0|> order_id = request.GET.get('order_id') try:...
stack_v2_sparse_classes_36k_train_001825
14,520
permissive
[ { "docstring": "订单商品评价 :param request: :return:", "name": "get", "signature": "def get(self, request)" }, { "docstring": "获取参数修改评论页面的内容", "name": "post", "signature": "def post(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_016754
Implement the Python class `OrderCommentView` described below. Class description: 订单商品评价 Method signatures and docstrings: - def get(self, request): 订单商品评价 :param request: :return: - def post(self, request): 获取参数修改评论页面的内容
Implement the Python class `OrderCommentView` described below. Class description: 订单商品评价 Method signatures and docstrings: - def get(self, request): 订单商品评价 :param request: :return: - def post(self, request): 获取参数修改评论页面的内容 <|skeleton|> class OrderCommentView: """订单商品评价""" def get(self, request): """订...
fecdf074ddb6844f33d6fadf05d40b0e562b46fb
<|skeleton|> class OrderCommentView: """订单商品评价""" def get(self, request): """订单商品评价 :param request: :return:""" <|body_0|> def post(self, request): """获取参数修改评论页面的内容""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OrderCommentView: """订单商品评价""" def get(self, request): """订单商品评价 :param request: :return:""" order_id = request.GET.get('order_id') try: order = OrderInfo.objects.get(order_id=order_id, user=request.user) except OrderInfo.DoesNotExist: return http.H...
the_stack_v2_python_sparse
meiduo_mall/meiduo_mall/apps/orders/views.py
qls7/dianshang
train
0
45c282e5451e9b9c2e4ffd94629784853dfa1c92
[ "log.debug('POST request from user %s to create a new project stage' % request.user)\nproj = Project.objects.get(project_number=project_number)\nif not check_project_write_acl(proj, request.user):\n log.debug('Refusing POST request for project %s from user %s' % (project_number, request.user))\n return rc.FOR...
<|body_start_0|> log.debug('POST request from user %s to create a new project stage' % request.user) proj = Project.objects.get(project_number=project_number) if not check_project_write_acl(proj, request.user): log.debug('Refusing POST request for project %s from user %s' % (project_...
URL: /api/stageplan/%project_number%/ VERBS: GET, POST Returns a list of Stage Plans associated with a project
StageplanListHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StageplanListHandler: """URL: /api/stageplan/%project_number%/ VERBS: GET, POST Returns a list of Stage Plans associated with a project""" def create(self, request, project_number): """Create a new Project Stage""" <|body_0|> def read(self, request, project_number): ...
stack_v2_sparse_classes_36k_train_001826
19,350
no_license
[ { "docstring": "Create a new Project Stage", "name": "create", "signature": "def create(self, request, project_number)" }, { "docstring": "Return a list of project stages associated with projects filtered by ACL", "name": "read", "signature": "def read(self, request, project_number)" }...
2
stack_v2_sparse_classes_30k_train_010297
Implement the Python class `StageplanListHandler` described below. Class description: URL: /api/stageplan/%project_number%/ VERBS: GET, POST Returns a list of Stage Plans associated with a project Method signatures and docstrings: - def create(self, request, project_number): Create a new Project Stage - def read(self...
Implement the Python class `StageplanListHandler` described below. Class description: URL: /api/stageplan/%project_number%/ VERBS: GET, POST Returns a list of Stage Plans associated with a project Method signatures and docstrings: - def create(self, request, project_number): Create a new Project Stage - def read(self...
106a96307612318fb66246486e7226069e5508ac
<|skeleton|> class StageplanListHandler: """URL: /api/stageplan/%project_number%/ VERBS: GET, POST Returns a list of Stage Plans associated with a project""" def create(self, request, project_number): """Create a new Project Stage""" <|body_0|> def read(self, request, project_number): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StageplanListHandler: """URL: /api/stageplan/%project_number%/ VERBS: GET, POST Returns a list of Stage Plans associated with a project""" def create(self, request, project_number): """Create a new Project Stage""" log.debug('POST request from user %s to create a new project stage' % requ...
the_stack_v2_python_sparse
branches/rest-api-branch/django-project-management/wbs/api_views.py
NhaTrang/django-project-management
train
0
bb1185333c3133df7f6a4cbe3bc184095b54eca6
[ "self.archival_runs = archival_runs\nself.backup_runs = backup_runs\nself.replication_runs = replication_runs", "if dictionary is None:\n return None\narchival_runs = None\nif dictionary.get('archivalRuns') != None:\n archival_runs = list()\n for structure in dictionary.get('archivalRuns'):\n arch...
<|body_start_0|> self.archival_runs = archival_runs self.backup_runs = backup_runs self.replication_runs = replication_runs <|end_body_0|> <|body_start_1|> if dictionary is None: return None archival_runs = None if dictionary.get('archivalRuns') != None: ...
Implementation of the 'ProtectionRunResponse' model. Specifies the information about the Protection Runs across all snapshot target locations. Attributes: archival_runs (list of LatestProtectionJobRunInfo): Specifies the list of archival job information. backup_runs (list of LatestProtectionJobRunInfo): Specifies the l...
ProtectionRunResponse
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProtectionRunResponse: """Implementation of the 'ProtectionRunResponse' model. Specifies the information about the Protection Runs across all snapshot target locations. Attributes: archival_runs (list of LatestProtectionJobRunInfo): Specifies the list of archival job information. backup_runs (lis...
stack_v2_sparse_classes_36k_train_001827
3,040
permissive
[ { "docstring": "Constructor for the ProtectionRunResponse class", "name": "__init__", "signature": "def __init__(self, archival_runs=None, backup_runs=None, replication_runs=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary ...
2
null
Implement the Python class `ProtectionRunResponse` described below. Class description: Implementation of the 'ProtectionRunResponse' model. Specifies the information about the Protection Runs across all snapshot target locations. Attributes: archival_runs (list of LatestProtectionJobRunInfo): Specifies the list of arc...
Implement the Python class `ProtectionRunResponse` described below. Class description: Implementation of the 'ProtectionRunResponse' model. Specifies the information about the Protection Runs across all snapshot target locations. Attributes: archival_runs (list of LatestProtectionJobRunInfo): Specifies the list of arc...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class ProtectionRunResponse: """Implementation of the 'ProtectionRunResponse' model. Specifies the information about the Protection Runs across all snapshot target locations. Attributes: archival_runs (list of LatestProtectionJobRunInfo): Specifies the list of archival job information. backup_runs (lis...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProtectionRunResponse: """Implementation of the 'ProtectionRunResponse' model. Specifies the information about the Protection Runs across all snapshot target locations. Attributes: archival_runs (list of LatestProtectionJobRunInfo): Specifies the list of archival job information. backup_runs (list of LatestPr...
the_stack_v2_python_sparse
cohesity_management_sdk/models/protection_run_response.py
cohesity/management-sdk-python
train
24
d58c3d0ba58abc3161954ae2dd6df303f0f3b343
[ "for i, matr in enumerate(self.transition_matrices):\n print(matrix_name + '_' + str(i), ':', file=file)\n matr_print(matr, file=file)\nprint('Average intensity:', self.avg_intensity, file=file)\nprint('Average batch intensity:', self.batch_intensity, file=file)\nprint('Variation coefficient:', self.c_var, fi...
<|body_start_0|> for i, matr in enumerate(self.transition_matrices): print(matrix_name + '_' + str(i), ':', file=file) matr_print(matr, file=file) print('Average intensity:', self.avg_intensity, file=file) print('Average batch intensity:', self.batch_intensity, file=file)...
BMAP stream class. Contains list of transition matrices, stream average intensity, stream batches intensity, variation coefficient and correlation coefficient.
BMAPStream
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BMAPStream: """BMAP stream class. Contains list of transition matrices, stream average intensity, stream batches intensity, variation coefficient and correlation coefficient.""" def print_characteristics(self, matrix_name, file=sys.stdout): """Prints characteristics of BMAP stream: M...
stack_v2_sparse_classes_36k_train_001828
15,627
no_license
[ { "docstring": "Prints characteristics of BMAP stream: Matrices Average intensity Average batch intensity Variation coefficient Correlation coefficient :return: None", "name": "print_characteristics", "signature": "def print_characteristics(self, matrix_name, file=sys.stdout)" }, { "docstring": ...
3
stack_v2_sparse_classes_30k_train_018477
Implement the Python class `BMAPStream` described below. Class description: BMAP stream class. Contains list of transition matrices, stream average intensity, stream batches intensity, variation coefficient and correlation coefficient. Method signatures and docstrings: - def print_characteristics(self, matrix_name, f...
Implement the Python class `BMAPStream` described below. Class description: BMAP stream class. Contains list of transition matrices, stream average intensity, stream batches intensity, variation coefficient and correlation coefficient. Method signatures and docstrings: - def print_characteristics(self, matrix_name, f...
6173e0d279893f0da4f8ad09b824cd5897c4e5e7
<|skeleton|> class BMAPStream: """BMAP stream class. Contains list of transition matrices, stream average intensity, stream batches intensity, variation coefficient and correlation coefficient.""" def print_characteristics(self, matrix_name, file=sys.stdout): """Prints characteristics of BMAP stream: M...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BMAPStream: """BMAP stream class. Contains list of transition matrices, stream average intensity, stream batches intensity, variation coefficient and correlation coefficient.""" def print_characteristics(self, matrix_name, file=sys.stdout): """Prints characteristics of BMAP stream: Matrices Avera...
the_stack_v2_python_sparse
streams.py
pishchynski/magister_work
train
0
d9d3eaa9d356f048e0815dc6e82d2cdfb377e3a3
[ "self.trainloader = trainloader\nself.N_trn = len(trainloader.sampler.data_source)\nself.online = online\nself.indices = None\nself.gammas = None", "if self.online or self.indices is None:\n self.indices = np.random.choice(self.N_trn, size=budget, replace=False)\n self.gammas = torch.ones(budget)\nreturn (s...
<|body_start_0|> self.trainloader = trainloader self.N_trn = len(trainloader.sampler.data_source) self.online = online self.indices = None self.gammas = None <|end_body_0|> <|body_start_1|> if self.online or self.indices is None: self.indices = np.random.choi...
This is the Random Selection Strategy class where we select a set of random points as a datasubset and often acts as baselines to compare other subset selection strategies. Parameters ---------- trainloader: class Loading the training data using pytorch DataLoader
RandomStrategy
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomStrategy: """This is the Random Selection Strategy class where we select a set of random points as a datasubset and often acts as baselines to compare other subset selection strategies. Parameters ---------- trainloader: class Loading the training data using pytorch DataLoader""" def _...
stack_v2_sparse_classes_36k_train_001829
1,305
permissive
[ { "docstring": "Constructor method", "name": "__init__", "signature": "def __init__(self, trainloader, online=False)" }, { "docstring": "Perform random sampling of indices of size budget. Parameters ---------- budget: int The number of data points to be selected Returns ---------- indices: ndarr...
2
stack_v2_sparse_classes_30k_train_003671
Implement the Python class `RandomStrategy` described below. Class description: This is the Random Selection Strategy class where we select a set of random points as a datasubset and often acts as baselines to compare other subset selection strategies. Parameters ---------- trainloader: class Loading the training data...
Implement the Python class `RandomStrategy` described below. Class description: This is the Random Selection Strategy class where we select a set of random points as a datasubset and often acts as baselines to compare other subset selection strategies. Parameters ---------- trainloader: class Loading the training data...
8d10c7f5d96e071f98c20e4e9ff4c41c2c4ea2af
<|skeleton|> class RandomStrategy: """This is the Random Selection Strategy class where we select a set of random points as a datasubset and often acts as baselines to compare other subset selection strategies. Parameters ---------- trainloader: class Loading the training data using pytorch DataLoader""" def _...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RandomStrategy: """This is the Random Selection Strategy class where we select a set of random points as a datasubset and often acts as baselines to compare other subset selection strategies. Parameters ---------- trainloader: class Loading the training data using pytorch DataLoader""" def __init__(self,...
the_stack_v2_python_sparse
cords/selectionstrategies/SSL/randomstrategy.py
decile-team/cords
train
289
dd0e79641c04113ec232cca837850e2b1e1faa84
[ "super(AngularPenaltySMLoss, self).__init__()\nloss_type = loss_type.lower()\nassert loss_type in ['arcface', 'sphereface', 'cosface']\nif loss_type == 'arcface':\n self.s = 64.0 if not s else s\n self.m = 0.5 if not m else m\nif loss_type == 'sphereface':\n self.s = 64.0 if not s else s\n self.m = 1.35...
<|body_start_0|> super(AngularPenaltySMLoss, self).__init__() loss_type = loss_type.lower() assert loss_type in ['arcface', 'sphereface', 'cosface'] if loss_type == 'arcface': self.s = 64.0 if not s else s self.m = 0.5 if not m else m if loss_type == 'sphe...
AngularPenaltySMLoss
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AngularPenaltySMLoss: def __init__(self, loss_type='arcface', eps=1e-07, s=None, m=None): """Angular Penalty Softmax Loss Three 'loss_types' available: ['arcface', 'sphereface', 'cosface'] These losses are described in the following papers: ArcFace: https://arxiv.org/abs/1801.07698 Spher...
stack_v2_sparse_classes_36k_train_001830
4,130
no_license
[ { "docstring": "Angular Penalty Softmax Loss Three 'loss_types' available: ['arcface', 'sphereface', 'cosface'] These losses are described in the following papers: ArcFace: https://arxiv.org/abs/1801.07698 SphereFace: https://arxiv.org/abs/1704.08063 CosFace/Ad Margin: https://arxiv.org/abs/1801.05599", "na...
2
stack_v2_sparse_classes_30k_train_021318
Implement the Python class `AngularPenaltySMLoss` described below. Class description: Implement the AngularPenaltySMLoss class. Method signatures and docstrings: - def __init__(self, loss_type='arcface', eps=1e-07, s=None, m=None): Angular Penalty Softmax Loss Three 'loss_types' available: ['arcface', 'sphereface', '...
Implement the Python class `AngularPenaltySMLoss` described below. Class description: Implement the AngularPenaltySMLoss class. Method signatures and docstrings: - def __init__(self, loss_type='arcface', eps=1e-07, s=None, m=None): Angular Penalty Softmax Loss Three 'loss_types' available: ['arcface', 'sphereface', '...
5acd3faaffb4e1de798f236a2733620ce36fb9e9
<|skeleton|> class AngularPenaltySMLoss: def __init__(self, loss_type='arcface', eps=1e-07, s=None, m=None): """Angular Penalty Softmax Loss Three 'loss_types' available: ['arcface', 'sphereface', 'cosface'] These losses are described in the following papers: ArcFace: https://arxiv.org/abs/1801.07698 Spher...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AngularPenaltySMLoss: def __init__(self, loss_type='arcface', eps=1e-07, s=None, m=None): """Angular Penalty Softmax Loss Three 'loss_types' available: ['arcface', 'sphereface', 'cosface'] These losses are described in the following papers: ArcFace: https://arxiv.org/abs/1801.07698 SphereFace: https:/...
the_stack_v2_python_sparse
b06504102_hw2/Mynet_.py
brianw0924/ML2021
train
0
d4961af8d2a99ad6e323ac347f155cec722e519e
[ "self.id1 = id1\nself.id2 = id2\nself.path = path\nself.max_size = max_size\nself.file1 = None\nself.file2 = None\nself.written = 0\nself.counter = 0\nself.next_files()", "if self.file1:\n self.file1.close()\nif self.file2:\n self.file2.close()\npath1 = os.path.join(self.path, '{}-{}.txt'.format(self.id1, s...
<|body_start_0|> self.id1 = id1 self.id2 = id2 self.path = path self.max_size = max_size self.file1 = None self.file2 = None self.written = 0 self.counter = 0 self.next_files() <|end_body_0|> <|body_start_1|> if self.file1: sel...
FileStorage allows store text corpora in parallel files
FileStorage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileStorage: """FileStorage allows store text corpora in parallel files""" def __init__(self, id1, id2, path, max_size): """:id1: prefix for first file :id2: prifix for second file :path: path for storing files :max_size: maximal file size in symbols""" <|body_0|> def ne...
stack_v2_sparse_classes_36k_train_001831
1,803
no_license
[ { "docstring": ":id1: prefix for first file :id2: prifix for second file :path: path for storing files :max_size: maximal file size in symbols", "name": "__init__", "signature": "def __init__(self, id1, id2, path, max_size)" }, { "docstring": "@todo: Docstring for next_files. :returns: @todo", ...
3
null
Implement the Python class `FileStorage` described below. Class description: FileStorage allows store text corpora in parallel files Method signatures and docstrings: - def __init__(self, id1, id2, path, max_size): :id1: prefix for first file :id2: prifix for second file :path: path for storing files :max_size: maxim...
Implement the Python class `FileStorage` described below. Class description: FileStorage allows store text corpora in parallel files Method signatures and docstrings: - def __init__(self, id1, id2, path, max_size): :id1: prefix for first file :id2: prifix for second file :path: path for storing files :max_size: maxim...
6da94fbb74e803bea337e0c171c8abff3b17d7ee
<|skeleton|> class FileStorage: """FileStorage allows store text corpora in parallel files""" def __init__(self, id1, id2, path, max_size): """:id1: prefix for first file :id2: prifix for second file :path: path for storing files :max_size: maximal file size in symbols""" <|body_0|> def ne...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FileStorage: """FileStorage allows store text corpora in parallel files""" def __init__(self, id1, id2, path, max_size): """:id1: prefix for first file :id2: prifix for second file :path: path for storing files :max_size: maximal file size in symbols""" self.id1 = id1 self.id2 = i...
the_stack_v2_python_sparse
pc/filestorage.py
CLARIN-PL/yalign
train
0
329c87cb4e874d5aaa281b7afd07ba72a0709dee
[ "header('Content-Type', 'application/json')\ntry:\n scopes = get_scopes(account, vo=ctx.env.get('vo'))\nexcept AccountNotFound as error:\n raise generate_http_error(404, 'AccountNotFound', error.args[0])\nexcept RucioException as error:\n raise generate_http_error(500, error.__class__.__name__, error.args[...
<|body_start_0|> header('Content-Type', 'application/json') try: scopes = get_scopes(account, vo=ctx.env.get('vo')) except AccountNotFound as error: raise generate_http_error(404, 'AccountNotFound', error.args[0]) except RucioException as error: raise ...
Scopes
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Scopes: def GET(self, account): """list all scopes for an account. HTTP Success: 200 OK HTTP Error: 401 Unauthorized 404 Not Found 406 Not Acceptable 500 InternalError :param Rucio-Account: Account identifier. :param Rucio-Auth-Token: as an 32 character hex string. :returns: A list conta...
stack_v2_sparse_classes_36k_train_001832
27,871
permissive
[ { "docstring": "list all scopes for an account. HTTP Success: 200 OK HTTP Error: 401 Unauthorized 404 Not Found 406 Not Acceptable 500 InternalError :param Rucio-Account: Account identifier. :param Rucio-Auth-Token: as an 32 character hex string. :returns: A list containing all scope names for an account.", ...
2
null
Implement the Python class `Scopes` described below. Class description: Implement the Scopes class. Method signatures and docstrings: - def GET(self, account): list all scopes for an account. HTTP Success: 200 OK HTTP Error: 401 Unauthorized 404 Not Found 406 Not Acceptable 500 InternalError :param Rucio-Account: Acc...
Implement the Python class `Scopes` described below. Class description: Implement the Scopes class. Method signatures and docstrings: - def GET(self, account): list all scopes for an account. HTTP Success: 200 OK HTTP Error: 401 Unauthorized 404 Not Found 406 Not Acceptable 500 InternalError :param Rucio-Account: Acc...
bf33d9441d3b4ff160a392eed56724f635a03fe6
<|skeleton|> class Scopes: def GET(self, account): """list all scopes for an account. HTTP Success: 200 OK HTTP Error: 401 Unauthorized 404 Not Found 406 Not Acceptable 500 InternalError :param Rucio-Account: Account identifier. :param Rucio-Auth-Token: as an 32 character hex string. :returns: A list conta...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Scopes: def GET(self, account): """list all scopes for an account. HTTP Success: 200 OK HTTP Error: 401 Unauthorized 404 Not Found 406 Not Acceptable 500 InternalError :param Rucio-Account: Account identifier. :param Rucio-Auth-Token: as an 32 character hex string. :returns: A list containing all scop...
the_stack_v2_python_sparse
lib/rucio/web/rest/webpy/v1/account.py
viveknigam3003/rucio
train
1
67a4b43d67a9b41c295d91ba4769a25ee64c2738
[ "self.all_annotators = {}\nself.all_importers = {}\nself.all_exporters = {}\nself.all_installers = {}\nself.all_uninstallers = {}\nself.all_custom_annotators = {}\nself.all_preloaders = {}\nself.named_targets = []\nself.export_targets = []\nself.import_targets = []\nself.install_targets = []\nself.uninstall_targets...
<|body_start_0|> self.all_annotators = {} self.all_importers = {} self.all_exporters = {} self.all_installers = {} self.all_uninstallers = {} self.all_custom_annotators = {} self.all_preloaders = {} self.named_targets = [] self.export_targets = [] ...
Object to store variables involving all rules.
SnakeStorage
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SnakeStorage: """Object to store variables involving all rules.""" def __init__(self): """Init attributes.""" <|body_0|> def source_files(self) -> List[str]: """Get list of all available source files.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_001833
40,470
permissive
[ { "docstring": "Init attributes.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Get list of all available source files.", "name": "source_files", "signature": "def source_files(self) -> List[str]" } ]
2
null
Implement the Python class `SnakeStorage` described below. Class description: Object to store variables involving all rules. Method signatures and docstrings: - def __init__(self): Init attributes. - def source_files(self) -> List[str]: Get list of all available source files.
Implement the Python class `SnakeStorage` described below. Class description: Object to store variables involving all rules. Method signatures and docstrings: - def __init__(self): Init attributes. - def source_files(self) -> List[str]: Get list of all available source files. <|skeleton|> class SnakeStorage: """...
d3eb0db9de7fca6b6945192dd7f0c9e4bbeebb55
<|skeleton|> class SnakeStorage: """Object to store variables involving all rules.""" def __init__(self): """Init attributes.""" <|body_0|> def source_files(self) -> List[str]: """Get list of all available source files.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SnakeStorage: """Object to store variables involving all rules.""" def __init__(self): """Init attributes.""" self.all_annotators = {} self.all_importers = {} self.all_exporters = {} self.all_installers = {} self.all_uninstallers = {} self.all_custo...
the_stack_v2_python_sparse
sparv/core/snake_utils.py
spraakbanken/sparv-pipeline
train
22
241ef0f5d59ff12b9faee262aa85915498c394a6
[ "denvec = self[self['frame'] == frame]['coef'].values\nsquare = pd.DataFrame(density_as_square(denvec))\nsquare.index.name = 'chi0'\nsquare.columns.name = 'chi1'\nreturn square", "cmat = momatrix.square(column=mocoefs).values\nchi0, chi1, dens, frame = density_from_momatrix(cmat, occvec)\nreturn cls.from_dict({'c...
<|body_start_0|> denvec = self[self['frame'] == frame]['coef'].values square = pd.DataFrame(density_as_square(denvec)) square.index.name = 'chi0' square.columns.name = 'chi1' return square <|end_body_0|> <|body_start_1|> cmat = momatrix.square(column=mocoefs).values ...
The density matrix in a contracted basis set. As it is square symmetric, only n_basis_functions * (n_basis_functions + 1) / 2 rows are stored. +-------------------+----------+-------------------------------------------+ | Column | Type | Description | +===================+==========+====================================...
DensityMatrix
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DensityMatrix: """The density matrix in a contracted basis set. As it is square symmetric, only n_basis_functions * (n_basis_functions + 1) / 2 rows are stored. +-------------------+----------+-------------------------------------------+ | Column | Type | Description | +===================+======...
stack_v2_sparse_classes_36k_train_001834
21,790
permissive
[ { "docstring": "Returns a square dataframe of the density matrix.", "name": "square", "signature": "def square(self, frame=0)" }, { "docstring": "A density matrix can be constructed from an MOMatrix by: .. math:: D_{uv} = \\\\sum_{i}^{N} C_{ui} C_{vi} n_{i} Args: momatrix (:class:`~exatomic.orbi...
3
null
Implement the Python class `DensityMatrix` described below. Class description: The density matrix in a contracted basis set. As it is square symmetric, only n_basis_functions * (n_basis_functions + 1) / 2 rows are stored. +-------------------+----------+-------------------------------------------+ | Column | Type | De...
Implement the Python class `DensityMatrix` described below. Class description: The density matrix in a contracted basis set. As it is square symmetric, only n_basis_functions * (n_basis_functions + 1) / 2 rows are stored. +-------------------+----------+-------------------------------------------+ | Column | Type | De...
2e87bae3e043e6958129fc823c83ab0b46add8b5
<|skeleton|> class DensityMatrix: """The density matrix in a contracted basis set. As it is square symmetric, only n_basis_functions * (n_basis_functions + 1) / 2 rows are stored. +-------------------+----------+-------------------------------------------+ | Column | Type | Description | +===================+======...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DensityMatrix: """The density matrix in a contracted basis set. As it is square symmetric, only n_basis_functions * (n_basis_functions + 1) / 2 rows are stored. +-------------------+----------+-------------------------------------------+ | Column | Type | Description | +===================+==========+========...
the_stack_v2_python_sparse
exatomic/core/orbital.py
exa-analytics/exatomic
train
15
f405fb4fef1954a8e71a7b7ac0a4120c50d1c07b
[ "self.__k = 300\nself.__dq = collections.deque()\nself.__count = 0", "self.getHits(timestamp)\nif self.__dq and self.__dq[-1][0] == timestamp:\n self.__dq[-1][1] += 1\nelse:\n self.__dq.append([timestamp, 1])\nself.__count += 1", "while self.__dq and self.__dq[0][0] <= timestamp - self.__k:\n self.__co...
<|body_start_0|> self.__k = 300 self.__dq = collections.deque() self.__count = 0 <|end_body_0|> <|body_start_1|> self.getHits(timestamp) if self.__dq and self.__dq[-1][0] == timestamp: self.__dq[-1][1] += 1 else: self.__dq.append([timestamp, 1]) ...
HitCounter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HitCounter: def __init__(self): """Initialize your data structure here.""" <|body_0|> def hit(self, timestamp: int) -> None: """Record a hit. @param timestamp - The current timestamp (in seconds granularity).""" <|body_1|> def getHits(self, timestamp: in...
stack_v2_sparse_classes_36k_train_001835
4,308
no_license
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Record a hit. @param timestamp - The current timestamp (in seconds granularity).", "name": "hit", "signature": "def hit(self, timestamp: int) -> None" }, { ...
3
null
Implement the Python class `HitCounter` described below. Class description: Implement the HitCounter class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def hit(self, timestamp: int) -> None: Record a hit. @param timestamp - The current timestamp (in seconds granulari...
Implement the Python class `HitCounter` described below. Class description: Implement the HitCounter class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def hit(self, timestamp: int) -> None: Record a hit. @param timestamp - The current timestamp (in seconds granulari...
44765a7d89423b7ec2c159f70b1a6f6e446523c2
<|skeleton|> class HitCounter: def __init__(self): """Initialize your data structure here.""" <|body_0|> def hit(self, timestamp: int) -> None: """Record a hit. @param timestamp - The current timestamp (in seconds granularity).""" <|body_1|> def getHits(self, timestamp: in...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HitCounter: def __init__(self): """Initialize your data structure here.""" self.__k = 300 self.__dq = collections.deque() self.__count = 0 def hit(self, timestamp: int) -> None: """Record a hit. @param timestamp - The current timestamp (in seconds granularity).""" ...
the_stack_v2_python_sparse
python/_0001_0500/0362_design-hit-counter.py
Wang-Yann/LeetCodeMe
train
0
1ba68903d537747d9e6327c7d491a9385220f8b4
[ "def check(t1: 'TreeNode', t2: 'TreeNode') -> bool:\n if not t1 and (not t2):\n return True\n if not t1 or not t2:\n return False\n if t1.val != t2.val:\n return False\n return True\nfrom collections import deque\ndeq = deque([(t1, t2)])\nwhile deq:\n t1, t2 = deque.popleft()\n ...
<|body_start_0|> def check(t1: 'TreeNode', t2: 'TreeNode') -> bool: if not t1 and (not t2): return True if not t1 or not t2: return False if t1.val != t2.val: return False return True from collections import ...
Tree
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Tree: def is_same(self, t1: 'TreeNode', t2: 'TreeNode') -> bool: """Approach: Iteration Time Complexity: O(N) Space Complexity: O(log N) :param t1: :param t2: :return:""" <|body_0|> def is_same_(self, t1: 'TreeNode', t2: 'TreeNode') -> bool: """Approach: Recursion Ti...
stack_v2_sparse_classes_36k_train_001836
1,496
no_license
[ { "docstring": "Approach: Iteration Time Complexity: O(N) Space Complexity: O(log N) :param t1: :param t2: :return:", "name": "is_same", "signature": "def is_same(self, t1: 'TreeNode', t2: 'TreeNode') -> bool" }, { "docstring": "Approach: Recursion Time Complexity: O(N) Space Complexity: O(log N...
2
null
Implement the Python class `Tree` described below. Class description: Implement the Tree class. Method signatures and docstrings: - def is_same(self, t1: 'TreeNode', t2: 'TreeNode') -> bool: Approach: Iteration Time Complexity: O(N) Space Complexity: O(log N) :param t1: :param t2: :return: - def is_same_(self, t1: 'T...
Implement the Python class `Tree` described below. Class description: Implement the Tree class. Method signatures and docstrings: - def is_same(self, t1: 'TreeNode', t2: 'TreeNode') -> bool: Approach: Iteration Time Complexity: O(N) Space Complexity: O(log N) :param t1: :param t2: :return: - def is_same_(self, t1: 'T...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class Tree: def is_same(self, t1: 'TreeNode', t2: 'TreeNode') -> bool: """Approach: Iteration Time Complexity: O(N) Space Complexity: O(log N) :param t1: :param t2: :return:""" <|body_0|> def is_same_(self, t1: 'TreeNode', t2: 'TreeNode') -> bool: """Approach: Recursion Ti...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Tree: def is_same(self, t1: 'TreeNode', t2: 'TreeNode') -> bool: """Approach: Iteration Time Complexity: O(N) Space Complexity: O(log N) :param t1: :param t2: :return:""" def check(t1: 'TreeNode', t2: 'TreeNode') -> bool: if not t1 and (not t2): return True ...
the_stack_v2_python_sparse
revisited_2021/tree/same_tree.py
Shiv2157k/leet_code
train
1
3bebf16c316320c3646a4f90dcb238cd5e8bd28c
[ "cpu_stats = psutil.cpu_times_percent(percpu=False)\ncpu_stats_dict = {StatsKeys.CPU: {StatsKeys.IDLE: cpu_stats.idle, StatsKeys.SYSTEM: cpu_stats.system, StatsKeys.USER: cpu_stats.user, StatsKeys.COUNT: len(psutil.cpu_times(percpu=True))}}\nlogger.debug('CPU stats: {}'.format(cpu_stats_dict))\nreturn cpu_stats_dic...
<|body_start_0|> cpu_stats = psutil.cpu_times_percent(percpu=False) cpu_stats_dict = {StatsKeys.CPU: {StatsKeys.IDLE: cpu_stats.idle, StatsKeys.SYSTEM: cpu_stats.system, StatsKeys.USER: cpu_stats.user, StatsKeys.COUNT: len(psutil.cpu_times(percpu=True))}} logger.debug('CPU stats: {}'.format(cpu_...
SystemManager class is the entry point for queries regarding system stats. This service reports statistics about disk, memory and CPU usage, Monit summary, and number of running appservers, if any.
SystemManager
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SystemManager: """SystemManager class is the entry point for queries regarding system stats. This service reports statistics about disk, memory and CPU usage, Monit summary, and number of running appservers, if any.""" def get_cpu_usage(cls): """Discovers CPU usage on this node. Retu...
stack_v2_sparse_classes_36k_train_001837
5,532
permissive
[ { "docstring": "Discovers CPU usage on this node. Returns: A dictionary containing the idle, system and user percentages.", "name": "get_cpu_usage", "signature": "def get_cpu_usage(cls)" }, { "docstring": "Discovers disk usage per mount point on this node. Returns: A dictionary containing free b...
6
stack_v2_sparse_classes_30k_train_020072
Implement the Python class `SystemManager` described below. Class description: SystemManager class is the entry point for queries regarding system stats. This service reports statistics about disk, memory and CPU usage, Monit summary, and number of running appservers, if any. Method signatures and docstrings: - def g...
Implement the Python class `SystemManager` described below. Class description: SystemManager class is the entry point for queries regarding system stats. This service reports statistics about disk, memory and CPU usage, Monit summary, and number of running appservers, if any. Method signatures and docstrings: - def g...
4940c719df1b50ad4af5af4adf675414e225e5a6
<|skeleton|> class SystemManager: """SystemManager class is the entry point for queries regarding system stats. This service reports statistics about disk, memory and CPU usage, Monit summary, and number of running appservers, if any.""" def get_cpu_usage(cls): """Discovers CPU usage on this node. Retu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SystemManager: """SystemManager class is the entry point for queries regarding system stats. This service reports statistics about disk, memory and CPU usage, Monit summary, and number of running appservers, if any.""" def get_cpu_usage(cls): """Discovers CPU usage on this node. Returns: A dictio...
the_stack_v2_python_sparse
InfrastructureManager/appscale/infrastructure/system_manager.py
whoarethebritons/appscale
train
0
092fcb63eadda58ea620701802e49bfe0340abbb
[ "__path = '/_features'\n__query: t.Dict[str, t.Any] = {}\nif error_trace is not None:\n __query['error_trace'] = error_trace\nif filter_path is not None:\n __query['filter_path'] = filter_path\nif human is not None:\n __query['human'] = human\nif pretty is not None:\n __query['pretty'] = pretty\n__heade...
<|body_start_0|> __path = '/_features' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query['error_trace'] = error_trace if filter_path is not None: __query['filter_path'] = filter_path if human is not None: __query['human'] = h...
FeaturesClient
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-generic-cla" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FeaturesClient: async def get_features(self, *, error_trace: t.Optional[bool]=None, filter_path: t.Optional[t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]]]=None, human: t.Optional[bool]=None, pretty: t.Optional[bool]=None) -> ObjectApiResponse[t.Any]: """Gets a list of features wh...
stack_v2_sparse_classes_36k_train_001838
3,309
permissive
[ { "docstring": "Gets a list of features which can be included in snapshots using the feature_states field when creating a snapshot `<https://www.elastic.co/guide/en/elasticsearch/reference/master/get-features-api.html>`_", "name": "get_features", "signature": "async def get_features(self, *, error_trace...
2
stack_v2_sparse_classes_30k_train_010240
Implement the Python class `FeaturesClient` described below. Class description: Implement the FeaturesClient class. Method signatures and docstrings: - async def get_features(self, *, error_trace: t.Optional[bool]=None, filter_path: t.Optional[t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]]]=None, human: t.Opti...
Implement the Python class `FeaturesClient` described below. Class description: Implement the FeaturesClient class. Method signatures and docstrings: - async def get_features(self, *, error_trace: t.Optional[bool]=None, filter_path: t.Optional[t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]]]=None, human: t.Opti...
915bbd784831ccb84e1559af0f829736652d2e78
<|skeleton|> class FeaturesClient: async def get_features(self, *, error_trace: t.Optional[bool]=None, filter_path: t.Optional[t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]]]=None, human: t.Optional[bool]=None, pretty: t.Optional[bool]=None) -> ObjectApiResponse[t.Any]: """Gets a list of features wh...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FeaturesClient: async def get_features(self, *, error_trace: t.Optional[bool]=None, filter_path: t.Optional[t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]]]=None, human: t.Optional[bool]=None, pretty: t.Optional[bool]=None) -> ObjectApiResponse[t.Any]: """Gets a list of features which can be inc...
the_stack_v2_python_sparse
elasticsearch/_async/client/features.py
elastic/elasticsearch-py
train
3,845
6f07312fa13518413ccaa6d8a4b00f67d49a1d93
[ "self._check_access(request)\nawait self._check_login(data[ATTR_USERNAME], data[ATTR_PASSWORD])\nreturn web.Response(status=HTTP_OK)", "provider = self._get_provider()\ntry:\n await provider.async_validate_login(username, password)\nexcept HomeAssistantError:\n raise HTTPUnauthorized() from None" ]
<|body_start_0|> self._check_access(request) await self._check_login(data[ATTR_USERNAME], data[ATTR_PASSWORD]) return web.Response(status=HTTP_OK) <|end_body_0|> <|body_start_1|> provider = self._get_provider() try: await provider.async_validate_login(username, passw...
Hass.io view to handle auth requests.
HassIOAuth
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HassIOAuth: """Hass.io view to handle auth requests.""" async def post(self, request, data): """Handle auth requests.""" <|body_0|> async def _check_login(self, username, password): """Check User credentials.""" <|body_1|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_36k_train_001839
4,251
permissive
[ { "docstring": "Handle auth requests.", "name": "post", "signature": "async def post(self, request, data)" }, { "docstring": "Check User credentials.", "name": "_check_login", "signature": "async def _check_login(self, username, password)" } ]
2
null
Implement the Python class `HassIOAuth` described below. Class description: Hass.io view to handle auth requests. Method signatures and docstrings: - async def post(self, request, data): Handle auth requests. - async def _check_login(self, username, password): Check User credentials.
Implement the Python class `HassIOAuth` described below. Class description: Hass.io view to handle auth requests. Method signatures and docstrings: - async def post(self, request, data): Handle auth requests. - async def _check_login(self, username, password): Check User credentials. <|skeleton|> class HassIOAuth: ...
ba55b4b8338a2dc0ba3f1d750efea49d86571291
<|skeleton|> class HassIOAuth: """Hass.io view to handle auth requests.""" async def post(self, request, data): """Handle auth requests.""" <|body_0|> async def _check_login(self, username, password): """Check User credentials.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HassIOAuth: """Hass.io view to handle auth requests.""" async def post(self, request, data): """Handle auth requests.""" self._check_access(request) await self._check_login(data[ATTR_USERNAME], data[ATTR_PASSWORD]) return web.Response(status=HTTP_OK) async def _check_...
the_stack_v2_python_sparse
homeassistant/components/hassio/auth.py
basnijholt/home-assistant
train
5
0fce2b0191799408092d7ff9a62a5fe807552d7a
[ "params = dict(((key, val) for key, val in request.QUERY_PARAMS.iteritems()))\nform = MultiGetForm(params)\nif not form.is_valid():\n raise BadRequestException()\nreturn Response(form.submit(request))", "params = dict(((key, val) for key, val in request.DATA.iteritems()))\nparams.update(request.QUERY_PARAMS)\n...
<|body_start_0|> params = dict(((key, val) for key, val in request.QUERY_PARAMS.iteritems())) form = MultiGetForm(params) if not form.is_valid(): raise BadRequestException() return Response(form.submit(request)) <|end_body_0|> <|body_start_1|> params = dict(((key, va...
Class for rendering the view for creating PublicationRequests and searching through the PublicationRequests.
PublicationRequestList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PublicationRequestList: """Class for rendering the view for creating PublicationRequests and searching through the PublicationRequests.""" def get(self, request): """Method for getting multiple PublicationRequests either through search or general listing.""" <|body_0|> d...
stack_v2_sparse_classes_36k_train_001840
3,336
no_license
[ { "docstring": "Method for getting multiple PublicationRequests either through search or general listing.", "name": "get", "signature": "def get(self, request)" }, { "docstring": "Method for creating a new PublicationRequest.", "name": "post", "signature": "def post(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_015834
Implement the Python class `PublicationRequestList` described below. Class description: Class for rendering the view for creating PublicationRequests and searching through the PublicationRequests. Method signatures and docstrings: - def get(self, request): Method for getting multiple PublicationRequests either throug...
Implement the Python class `PublicationRequestList` described below. Class description: Class for rendering the view for creating PublicationRequests and searching through the PublicationRequests. Method signatures and docstrings: - def get(self, request): Method for getting multiple PublicationRequests either throug...
22c1ce3c5a8e4ed99c2f014672d60ad3c5a4003c
<|skeleton|> class PublicationRequestList: """Class for rendering the view for creating PublicationRequests and searching through the PublicationRequests.""" def get(self, request): """Method for getting multiple PublicationRequests either through search or general listing.""" <|body_0|> d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PublicationRequestList: """Class for rendering the view for creating PublicationRequests and searching through the PublicationRequests.""" def get(self, request): """Method for getting multiple PublicationRequests either through search or general listing.""" params = dict(((key, val) for ...
the_stack_v2_python_sparse
biodig/rest/v2/PublicationRequests/views.py
asmariyaz23/BioDIG
train
0
30e73f6250f205a9661885c894af206e954dec9d
[ "import re\nself.regexes = set()\nif regex_strings is not None:\n for regex_string in regex_strings:\n self.regexes.add(re.compile(regex_string))\nif use_default:\n default_regex_string = 'SG\\\\.[0-9a-zA-Z]+\\\\.[0-9a-zA-Z]+'\n self.regexes.add(re.compile(default_regex_string))", "if isinstance(r...
<|body_start_0|> import re self.regexes = set() if regex_strings is not None: for regex_string in regex_strings: self.regexes.add(re.compile(regex_string)) if use_default: default_regex_string = 'SG\\.[0-9a-zA-Z]+\\.[0-9a-zA-Z]+' self.r...
Validates content to ensure SendGrid API key is not present
ValidateApiKey
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ValidateApiKey: """Validates content to ensure SendGrid API key is not present""" def __init__(self, regex_strings=None, use_default=True): """Create an API key validator :param regex_strings: list of regex strings :type regex_strings: list(str) :param use_default: Whether or not to ...
stack_v2_sparse_classes_36k_train_001841
2,652
permissive
[ { "docstring": "Create an API key validator :param regex_strings: list of regex strings :type regex_strings: list(str) :param use_default: Whether or not to include default regex :type use_default: bool", "name": "__init__", "signature": "def __init__(self, regex_strings=None, use_default=True)" }, ...
3
stack_v2_sparse_classes_30k_train_014472
Implement the Python class `ValidateApiKey` described below. Class description: Validates content to ensure SendGrid API key is not present Method signatures and docstrings: - def __init__(self, regex_strings=None, use_default=True): Create an API key validator :param regex_strings: list of regex strings :type regex_...
Implement the Python class `ValidateApiKey` described below. Class description: Validates content to ensure SendGrid API key is not present Method signatures and docstrings: - def __init__(self, regex_strings=None, use_default=True): Create an API key validator :param regex_strings: list of regex strings :type regex_...
2fe145956a1ee50355f5da8deab401e1e118c736
<|skeleton|> class ValidateApiKey: """Validates content to ensure SendGrid API key is not present""" def __init__(self, regex_strings=None, use_default=True): """Create an API key validator :param regex_strings: list of regex strings :type regex_strings: list(str) :param use_default: Whether or not to ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ValidateApiKey: """Validates content to ensure SendGrid API key is not present""" def __init__(self, regex_strings=None, use_default=True): """Create an API key validator :param regex_strings: list of regex strings :type regex_strings: list(str) :param use_default: Whether or not to include defau...
the_stack_v2_python_sparse
sendgrid/helpers/mail/validators.py
sendgrid/sendgrid-python
train
1,470
402bad30f81c9bf2a3c4faca5e710825b32eb91a
[ "self.criteria = kwargs.pop('criteria')\nsuper().__init__(*args, **kwargs)\nself.fields['levels_of_attainment'].initial = ', '.join(self.criteria[0].categories)", "form_data = super().clean()\nn_loas = len([loa for loa in form_data['levels_of_attainment'].split(',') if loa])\nif n_loas != len(self.criteria[0].cat...
<|body_start_0|> self.criteria = kwargs.pop('criteria') super().__init__(*args, **kwargs) self.fields['levels_of_attainment'].initial = ', '.join(self.criteria[0].categories) <|end_body_0|> <|body_start_1|> form_data = super().clean() n_loas = len([loa for loa in form_data['leve...
Edit the levels of attainment of a rubric.
RubricLOAForm
[ "LGPL-2.0-or-later", "BSD-3-Clause", "MIT", "Apache-2.0", "LGPL-2.1-only", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RubricLOAForm: """Edit the levels of attainment of a rubric.""" def __init__(self, *args, **kwargs): """Store the criteria.""" <|body_0|> def clean(self) -> Dict: """Check that the number of LOAs didn't change.""" <|body_1|> <|end_skeleton|> <|body_star...
stack_v2_sparse_classes_36k_train_001842
4,556
permissive
[ { "docstring": "Store the criteria.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Check that the number of LOAs didn't change.", "name": "clean", "signature": "def clean(self) -> Dict" } ]
2
stack_v2_sparse_classes_30k_train_020120
Implement the Python class `RubricLOAForm` described below. Class description: Edit the levels of attainment of a rubric. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Store the criteria. - def clean(self) -> Dict: Check that the number of LOAs didn't change.
Implement the Python class `RubricLOAForm` described below. Class description: Edit the levels of attainment of a rubric. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Store the criteria. - def clean(self) -> Dict: Check that the number of LOAs didn't change. <|skeleton|> class RubricLOAFo...
c432745dfff932cbe7397100422d49df78f0a882
<|skeleton|> class RubricLOAForm: """Edit the levels of attainment of a rubric.""" def __init__(self, *args, **kwargs): """Store the criteria.""" <|body_0|> def clean(self) -> Dict: """Check that the number of LOAs didn't change.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RubricLOAForm: """Edit the levels of attainment of a rubric.""" def __init__(self, *args, **kwargs): """Store the criteria.""" self.criteria = kwargs.pop('criteria') super().__init__(*args, **kwargs) self.fields['levels_of_attainment'].initial = ', '.join(self.criteria[0]....
the_stack_v2_python_sparse
ontask/action/forms/crud.py
abelardopardo/ontask_b
train
43
5a9daab4114da3539b8233b71115e085b5a9a4fe
[ "paginated = Paginator(models.SiteInvite.objects.filter(user=request.user).order_by('-created_date'), PAGE_LENGTH)\npage = paginated.get_page(request.GET.get('page'))\ndata = {'invites': page, 'page_range': paginated.get_elided_page_range(page.number, on_each_side=2, on_ends=1), 'form': forms.CreateInviteForm()}\nr...
<|body_start_0|> paginated = Paginator(models.SiteInvite.objects.filter(user=request.user).order_by('-created_date'), PAGE_LENGTH) page = paginated.get_page(request.GET.get('page')) data = {'invites': page, 'page_range': paginated.get_elided_page_range(page.number, on_each_side=2, on_ends=1), 'f...
create invites
ManageInvites
[ "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ManageInvites: """create invites""" def get(self, request): """invite management page""" <|body_0|> def post(self, request): """creates an invite database entry""" <|body_1|> <|end_skeleton|> <|body_start_0|> paginated = Paginator(models.SiteInv...
stack_v2_sparse_classes_36k_train_001843
6,414
no_license
[ { "docstring": "invite management page", "name": "get", "signature": "def get(self, request)" }, { "docstring": "creates an invite database entry", "name": "post", "signature": "def post(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_021061
Implement the Python class `ManageInvites` described below. Class description: create invites Method signatures and docstrings: - def get(self, request): invite management page - def post(self, request): creates an invite database entry
Implement the Python class `ManageInvites` described below. Class description: create invites Method signatures and docstrings: - def get(self, request): invite management page - def post(self, request): creates an invite database entry <|skeleton|> class ManageInvites: """create invites""" def get(self, re...
0f8da5b738047f3c34d60d93f59bdedd8f797224
<|skeleton|> class ManageInvites: """create invites""" def get(self, request): """invite management page""" <|body_0|> def post(self, request): """creates an invite database entry""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ManageInvites: """create invites""" def get(self, request): """invite management page""" paginated = Paginator(models.SiteInvite.objects.filter(user=request.user).order_by('-created_date'), PAGE_LENGTH) page = paginated.get_page(request.GET.get('page')) data = {'invites': ...
the_stack_v2_python_sparse
bookwyrm/views/admin/invite.py
bookwyrm-social/bookwyrm
train
1,398
964426d5b91a14f8753ff1b5145b2912c09f1b67
[ "super().__init__(driver)\nself.driver = driver\nself.util = Util()", "try:\n actualTitle = self.getTitle()\n return self.util.verifyTextContains(actualTitle, textToVerify)\nexcept:\n self.log.error('Failed to get the page title')\n traceback.print_exc()\n return False" ]
<|body_start_0|> super().__init__(driver) self.driver = driver self.util = Util() <|end_body_0|> <|body_start_1|> try: actualTitle = self.getTitle() return self.util.verifyTextContains(actualTitle, textToVerify) except: self.log.error('Failed ...
Basepage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Basepage: def __init__(self, driver): """Base page inherites from the selenium driver which takes care of all the operations related to selenium driver So further we can just inherit this Base page into all our prages so we can have both the functionality :param driver:""" <|body...
stack_v2_sparse_classes_36k_train_001844
1,243
no_license
[ { "docstring": "Base page inherites from the selenium driver which takes care of all the operations related to selenium driver So further we can just inherit this Base page into all our prages so we can have both the functionality :param driver:", "name": "__init__", "signature": "def __init__(self, dri...
2
stack_v2_sparse_classes_30k_train_013569
Implement the Python class `Basepage` described below. Class description: Implement the Basepage class. Method signatures and docstrings: - def __init__(self, driver): Base page inherites from the selenium driver which takes care of all the operations related to selenium driver So further we can just inherit this Bas...
Implement the Python class `Basepage` described below. Class description: Implement the Basepage class. Method signatures and docstrings: - def __init__(self, driver): Base page inherites from the selenium driver which takes care of all the operations related to selenium driver So further we can just inherit this Bas...
8afe6771a96d5a70ca1dcee98b7a6123218dc0d1
<|skeleton|> class Basepage: def __init__(self, driver): """Base page inherites from the selenium driver which takes care of all the operations related to selenium driver So further we can just inherit this Base page into all our prages so we can have both the functionality :param driver:""" <|body...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Basepage: def __init__(self, driver): """Base page inherites from the selenium driver which takes care of all the operations related to selenium driver So further we can just inherit this Base page into all our prages so we can have both the functionality :param driver:""" super().__init__(dri...
the_stack_v2_python_sparse
base/basepage.py
karthikpalameri/PythonFramework
train
0
7831333ba65890712bf632196c9181d7696f0464
[ "self.tx_table = dict()\nself.tx_table['#'] = []\nself.tx_table['Agent Role'] = []\nself.tx_table['Counterparty'] = []\nself.tx_table['Amount'] = []\nself.tx_table['Goods Exchanged'] = []", "self.tx_table['#'].append(str(len(self.tx_table['#'])))\nself.tx_table['Agent Role'].append('Buyer' if tx.is_sender_buyer e...
<|body_start_0|> self.tx_table = dict() self.tx_table['#'] = [] self.tx_table['Agent Role'] = [] self.tx_table['Counterparty'] = [] self.tx_table['Amount'] = [] self.tx_table['Goods Exchanged'] = [] <|end_body_0|> <|body_start_1|> self.tx_table['#'].append(str(le...
Class maintaining a html table of transactions.
TransactionTable
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TransactionTable: """Class maintaining a html table of transactions.""" def __init__(self): """Instantiate a TransactionTable.""" <|body_0|> def add_transaction(self, tx: Transaction, agent_name: Optional[str]=None) -> None: """Add a transaction to the table. :pa...
stack_v2_sparse_classes_36k_train_001845
11,245
permissive
[ { "docstring": "Instantiate a TransactionTable.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Add a transaction to the table. :param tx: the Transaction object :param agent_name: the name of the agent :return: None", "name": "add_transaction", "signature": "d...
3
null
Implement the Python class `TransactionTable` described below. Class description: Class maintaining a html table of transactions. Method signatures and docstrings: - def __init__(self): Instantiate a TransactionTable. - def add_transaction(self, tx: Transaction, agent_name: Optional[str]=None) -> None: Add a transact...
Implement the Python class `TransactionTable` described below. Class description: Class maintaining a html table of transactions. Method signatures and docstrings: - def __init__(self): Instantiate a TransactionTable. - def add_transaction(self, tx: Transaction, agent_name: Optional[str]=None) -> None: Add a transact...
33c4aa24ca8daf26f2c8f2d2fa38d7f4bf750cfa
<|skeleton|> class TransactionTable: """Class maintaining a html table of transactions.""" def __init__(self): """Instantiate a TransactionTable.""" <|body_0|> def add_transaction(self, tx: Transaction, agent_name: Optional[str]=None) -> None: """Add a transaction to the table. :pa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TransactionTable: """Class maintaining a html table of transactions.""" def __init__(self): """Instantiate a TransactionTable.""" self.tx_table = dict() self.tx_table['#'] = [] self.tx_table['Agent Role'] = [] self.tx_table['Counterparty'] = [] self.tx_tabl...
the_stack_v2_python_sparse
tac/gui/dashboards/agent.py
fetchai/agents-tac
train
30
be2644616b6b0ede0bd3af743843ea8b722aeb0e
[ "if not root:\n return '_'\nelse:\n left_repr = f'({self.serialize(root.left)})' if root.left else '_'\n right_repr = f'({self.serialize(root.right)})' if root.right else '_'\n return f'{root.val} {left_repr} {right_repr}'", "if data[0] == '_':\n return None\narr = data.split()\nrootVal = arr[0]\nd...
<|body_start_0|> if not root: return '_' else: left_repr = f'({self.serialize(root.left)})' if root.left else '_' right_repr = f'({self.serialize(root.right)})' if root.right else '_' return f'{root.val} {left_repr} {right_repr}' <|end_body_0|> <|body_sta...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root: ...
stack_v2_sparse_classes_36k_train_001846
1,743
no_license
[ { "docstring": "Encodes a tree to a single string.", "name": "serialize", "signature": "def serialize(self, root: TreeNode) -> str" }, { "docstring": "Decodes your encoded data to tree.", "name": "deserialize", "signature": "def deserialize(self, data: str) -> TreeNode" } ]
2
stack_v2_sparse_classes_30k_train_012806
Implement the Python class `Codec` described below. Class description: Implement the Codec 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 your encoded data to tree.
Implement the Python class `Codec` described below. Class description: Implement the Codec 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 your encoded data to tree. <|skeleton|> class Co...
ec14ad04893073ff911b6d11aacc26b372766b6d
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" if not root: return '_' else: left_repr = f'({self.serialize(root.left)})' if root.left else '_' right_repr = f'({self.serialize(root.right)})' if root.right ...
the_stack_v2_python_sparse
problems/Medium/serialize-and-deserialize-binary-tree/sol.py
Zahidsqldba07/leetcode-3
train
0
8cc0dc9633f9b9cee52b2c36367c06a63ea75666
[ "self.terms = terms\n\ndef form():\n res = 0\n for x in terms:\n res += x.base ** x.power\n return res\nself.form = form", "if isinstance(target, Formula) == False:\n raise ValueError('Require Formula instance!')\n\ndef form():\n res = 0\n for t in target.terms:\n for x in self.ter...
<|body_start_0|> self.terms = terms def form(): res = 0 for x in terms: res += x.base ** x.power return res self.form = form <|end_body_0|> <|body_start_1|> if isinstance(target, Formula) == False: raise ValueError('Requir...
Formula class. Have base number and multiplier.
Formula
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Formula: """Formula class. Have base number and multiplier.""" def __init__(self, terms): """Recieved Term object list.""" <|body_0|> def __mul__(self, target): """Multiply out.""" <|body_1|> def calc(self): """Retaining formula caluculate.""...
stack_v2_sparse_classes_36k_train_001847
7,281
no_license
[ { "docstring": "Recieved Term object list.", "name": "__init__", "signature": "def __init__(self, terms)" }, { "docstring": "Multiply out.", "name": "__mul__", "signature": "def __mul__(self, target)" }, { "docstring": "Retaining formula caluculate.", "name": "calc", "sig...
3
stack_v2_sparse_classes_30k_train_019529
Implement the Python class `Formula` described below. Class description: Formula class. Have base number and multiplier. Method signatures and docstrings: - def __init__(self, terms): Recieved Term object list. - def __mul__(self, target): Multiply out. - def calc(self): Retaining formula caluculate.
Implement the Python class `Formula` described below. Class description: Formula class. Have base number and multiplier. Method signatures and docstrings: - def __init__(self, terms): Recieved Term object list. - def __mul__(self, target): Multiply out. - def calc(self): Retaining formula caluculate. <|skeleton|> cl...
0c4f79ce5c370027b76ec9a336b392ee61b12a7a
<|skeleton|> class Formula: """Formula class. Have base number and multiplier.""" def __init__(self, terms): """Recieved Term object list.""" <|body_0|> def __mul__(self, target): """Multiply out.""" <|body_1|> def calc(self): """Retaining formula caluculate.""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Formula: """Formula class. Have base number and multiplier.""" def __init__(self, terms): """Recieved Term object list.""" self.terms = terms def form(): res = 0 for x in terms: res += x.base ** x.power return res self.f...
the_stack_v2_python_sparse
pheasant/numtheory.py
moguonyanko/pheasant
train
0
8ad5bc49a6aaeb048c0caf0b861c4cdfd88c7334
[ "if not root or (not root.left and (not root.right)):\n return True\nleft_depth = self.get_depth(root.left)\nright_depth = self.get_depth(root.right)\nreturn abs(left_depth - right_depth) <= 1 and self.isBalanced(root.left) and self.isBalanced(root.right)", "if not tree:\n return 0\nreturn 1 + max(self.get_...
<|body_start_0|> if not root or (not root.left and (not root.right)): return True left_depth = self.get_depth(root.left) right_depth = self.get_depth(root.right) return abs(left_depth - right_depth) <= 1 and self.isBalanced(root.left) and self.isBalanced(root.right) <|end_bod...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isBalanced(self, root: TreeNode) -> bool: """判断根节点左右节点的高度差,依次递归,记得采用functools; 也可以直接在计算高度时进行判断,返回高度差,采用全局变量获取是否平衡的结果; :param root: :return:""" <|body_0|> def get_depth(self, tree): """:param tree: :return:""" <|body_1|> <|end_skeleton|> <|body...
stack_v2_sparse_classes_36k_train_001848
1,203
no_license
[ { "docstring": "判断根节点左右节点的高度差,依次递归,记得采用functools; 也可以直接在计算高度时进行判断,返回高度差,采用全局变量获取是否平衡的结果; :param root: :return:", "name": "isBalanced", "signature": "def isBalanced(self, root: TreeNode) -> bool" }, { "docstring": ":param tree: :return:", "name": "get_depth", "signature": "def get_depth(s...
2
stack_v2_sparse_classes_30k_train_015267
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isBalanced(self, root: TreeNode) -> bool: 判断根节点左右节点的高度差,依次递归,记得采用functools; 也可以直接在计算高度时进行判断,返回高度差,采用全局变量获取是否平衡的结果; :param root: :return: - def get_depth(self, tree): :param t...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isBalanced(self, root: TreeNode) -> bool: 判断根节点左右节点的高度差,依次递归,记得采用functools; 也可以直接在计算高度时进行判断,返回高度差,采用全局变量获取是否平衡的结果; :param root: :return: - def get_depth(self, tree): :param t...
f2c162654a83c51495ebd161f42a1d0b69caf72d
<|skeleton|> class Solution: def isBalanced(self, root: TreeNode) -> bool: """判断根节点左右节点的高度差,依次递归,记得采用functools; 也可以直接在计算高度时进行判断,返回高度差,采用全局变量获取是否平衡的结果; :param root: :return:""" <|body_0|> def get_depth(self, tree): """:param tree: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isBalanced(self, root: TreeNode) -> bool: """判断根节点左右节点的高度差,依次递归,记得采用functools; 也可以直接在计算高度时进行判断,返回高度差,采用全局变量获取是否平衡的结果; :param root: :return:""" if not root or (not root.left and (not root.right)): return True left_depth = self.get_depth(root.left) right...
the_stack_v2_python_sparse
110 isBalanced.py
ABenxj/leetcode
train
1
a60711a7d4477f72c22695b57ddd9e31403a92c4
[ "self.screen_width = 800\nself.screen_height = 600\nself.bg_color = (30, 30, 30)\nself.ship_limit = 3\nself.ship_slow_speed_factor = 1 / 7\nself.bullet_width = 1\nself.bullet_height = 30\nself.bullet_color = (255, 255, 0)\nself.speedup_scale = 1.01\nself.score_scale = 1.5\nself.yellow_prob = 20.0\nself.red_prob = s...
<|body_start_0|> self.screen_width = 800 self.screen_height = 600 self.bg_color = (30, 30, 30) self.ship_limit = 3 self.ship_slow_speed_factor = 1 / 7 self.bullet_width = 1 self.bullet_height = 30 self.bullet_color = (255, 255, 0) self.speedup_scal...
A class to store all settings for Alien Invasion.
Settings
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Settings: """A class to store all settings for Alien Invasion.""" def __init__(self): """Initialize the game's static settings.""" <|body_0|> def initialize_dynamic_settings(self): """Initialize settings that change throughout the game.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_001849
2,834
no_license
[ { "docstring": "Initialize the game's static settings.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Initialize settings that change throughout the game.", "name": "initialize_dynamic_settings", "signature": "def initialize_dynamic_settings(self)" }, { ...
3
stack_v2_sparse_classes_30k_train_015412
Implement the Python class `Settings` described below. Class description: A class to store all settings for Alien Invasion. Method signatures and docstrings: - def __init__(self): Initialize the game's static settings. - def initialize_dynamic_settings(self): Initialize settings that change throughout the game. - def...
Implement the Python class `Settings` described below. Class description: A class to store all settings for Alien Invasion. Method signatures and docstrings: - def __init__(self): Initialize the game's static settings. - def initialize_dynamic_settings(self): Initialize settings that change throughout the game. - def...
61d8a85c33f54cd138c94433f062b74d396cc57f
<|skeleton|> class Settings: """A class to store all settings for Alien Invasion.""" def __init__(self): """Initialize the game's static settings.""" <|body_0|> def initialize_dynamic_settings(self): """Initialize settings that change throughout the game.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Settings: """A class to store all settings for Alien Invasion.""" def __init__(self): """Initialize the game's static settings.""" self.screen_width = 800 self.screen_height = 600 self.bg_color = (30, 30, 30) self.ship_limit = 3 self.ship_slow_speed_factor ...
the_stack_v2_python_sparse
settings.py
JankaGramofonomanka/alien_invasion
train
0
446bf7099ab4ed6cb081b1b6c553ef8b568e75e1
[ "super().__init__(description.key, api, coordinator)\nself.field = description.field\nself.entity_description = description\nself.data_type = description.field.field_type\nself.raw_format = description.raw_format", "all_data = self.coordinator.data\nvalue = self.api.get_field_value(all_data, self.field.name)\nif ...
<|body_start_0|> super().__init__(description.key, api, coordinator) self.field = description.field self.entity_description = description self.data_type = description.field.field_type self.raw_format = description.raw_format <|end_body_0|> <|body_start_1|> all_data = sel...
Get a sensor data from the Renson API and store it in the state of the class.
RensonSensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RensonSensor: """Get a sensor data from the Renson API and store it in the state of the class.""" def __init__(self, description: RensonSensorEntityDescription, api: RensonVentilation, coordinator: RensonCoordinator) -> None: """Initialize class.""" <|body_0|> def _handl...
stack_v2_sparse_classes_36k_train_001850
10,303
permissive
[ { "docstring": "Initialize class.", "name": "__init__", "signature": "def __init__(self, description: RensonSensorEntityDescription, api: RensonVentilation, coordinator: RensonCoordinator) -> None" }, { "docstring": "Handle updated data from the coordinator.", "name": "_handle_coordinator_up...
2
null
Implement the Python class `RensonSensor` described below. Class description: Get a sensor data from the Renson API and store it in the state of the class. Method signatures and docstrings: - def __init__(self, description: RensonSensorEntityDescription, api: RensonVentilation, coordinator: RensonCoordinator) -> None...
Implement the Python class `RensonSensor` described below. Class description: Get a sensor data from the Renson API and store it in the state of the class. Method signatures and docstrings: - def __init__(self, description: RensonSensorEntityDescription, api: RensonVentilation, coordinator: RensonCoordinator) -> None...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class RensonSensor: """Get a sensor data from the Renson API and store it in the state of the class.""" def __init__(self, description: RensonSensorEntityDescription, api: RensonVentilation, coordinator: RensonCoordinator) -> None: """Initialize class.""" <|body_0|> def _handl...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RensonSensor: """Get a sensor data from the Renson API and store it in the state of the class.""" def __init__(self, description: RensonSensorEntityDescription, api: RensonVentilation, coordinator: RensonCoordinator) -> None: """Initialize class.""" super().__init__(description.key, api, ...
the_stack_v2_python_sparse
homeassistant/components/renson/sensor.py
home-assistant/core
train
35,501
5f5c9015bfe5d81e4f9b193024f9317e73164efa
[ "if regrid_mode not in self.REGRID_REQUIRES_LANDMASK:\n msg = 'Unrecognised regrid mode {}'\n raise ValueError(msg.format(regrid_mode))\nif landmask is None and self.REGRID_REQUIRES_LANDMASK[regrid_mode]:\n msg = 'Regrid mode {} requires an input landmask cube'\n raise ValueError(msg.format(regrid_mode)...
<|body_start_0|> if regrid_mode not in self.REGRID_REQUIRES_LANDMASK: msg = 'Unrecognised regrid mode {}' raise ValueError(msg.format(regrid_mode)) if landmask is None and self.REGRID_REQUIRES_LANDMASK[regrid_mode]: msg = 'Regrid mode {} requires an input landmask cub...
Nearest-neighbour and bilinear regridding with or without land-sea mask awareness. When land-sea mask considered, surface-type-mismatched source points are excluded from field regridding calculation for target points. For example, for regridding a field using nearest-neighbour approach with land-sea awareness, regridde...
RegridLandSea
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegridLandSea: """Nearest-neighbour and bilinear regridding with or without land-sea mask awareness. When land-sea mask considered, surface-type-mismatched source points are excluded from field regridding calculation for target points. For example, for regridding a field using nearest-neighbour a...
stack_v2_sparse_classes_36k_train_001851
17,882
permissive
[ { "docstring": "Initialise regridding parameters. Args: regrid_mode: Mode of interpolation in regridding. Valid options are \"bilinear\", \"nearest\", \"nearest-with-mask\", \"bilinear-2\",\"nearest-2\", \"nearest-with-mask-2\" or \"bilinear-with-mask-2\". \"***-with-mask**\" option triggers adjustment of regri...
3
stack_v2_sparse_classes_30k_train_007510
Implement the Python class `RegridLandSea` described below. Class description: Nearest-neighbour and bilinear regridding with or without land-sea mask awareness. When land-sea mask considered, surface-type-mismatched source points are excluded from field regridding calculation for target points. For example, for regri...
Implement the Python class `RegridLandSea` described below. Class description: Nearest-neighbour and bilinear regridding with or without land-sea mask awareness. When land-sea mask considered, surface-type-mismatched source points are excluded from field regridding calculation for target points. For example, for regri...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class RegridLandSea: """Nearest-neighbour and bilinear regridding with or without land-sea mask awareness. When land-sea mask considered, surface-type-mismatched source points are excluded from field regridding calculation for target points. For example, for regridding a field using nearest-neighbour a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RegridLandSea: """Nearest-neighbour and bilinear regridding with or without land-sea mask awareness. When land-sea mask considered, surface-type-mismatched source points are excluded from field regridding calculation for target points. For example, for regridding a field using nearest-neighbour approach with ...
the_stack_v2_python_sparse
improver/regrid/landsea.py
metoppv/improver
train
101
1fade49394ddb6490be49c5a9a6c02e2f2af05e7
[ "len_s = len(strs)\ndp = [[[0] * (n + 1) for i in range(m + 1)] for j in range(len_s + 1)]\nfor k in range(1, len_s + 1):\n count_0 = strs[k - 1].count('0')\n count_1 = strs[k - 1].count('1')\n for i in range(m + 1):\n for j in range(n + 1):\n dp[k][i][j] = dp[k - 1][i][j]\n if...
<|body_start_0|> len_s = len(strs) dp = [[[0] * (n + 1) for i in range(m + 1)] for j in range(len_s + 1)] for k in range(1, len_s + 1): count_0 = strs[k - 1].count('0') count_1 = strs[k - 1].count('1') for i in range(m + 1): for j in range(n + ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMaxForm(self, strs: List[str], m: int, n: int) -> int: """执行用时: 5960 ms , 在所有 Python3 提交中击败了 12.47% 的用户 内存消耗: 70.1 MB , 在所有 Python3 提交中击败了 10.96% 的用户""" <|body_0|> def findMaxForm1(self, strs: List[str], m: int, n: int) -> int: """执行用时: 3024 ms , 在所...
stack_v2_sparse_classes_36k_train_001852
2,621
no_license
[ { "docstring": "执行用时: 5960 ms , 在所有 Python3 提交中击败了 12.47% 的用户 内存消耗: 70.1 MB , 在所有 Python3 提交中击败了 10.96% 的用户", "name": "findMaxForm", "signature": "def findMaxForm(self, strs: List[str], m: int, n: int) -> int" }, { "docstring": "执行用时: 3024 ms , 在所有 Python3 提交中击败了 75.50% 的用户 内存消耗: 15 MB , 在所有 Pyt...
2
stack_v2_sparse_classes_30k_train_005199
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMaxForm(self, strs: List[str], m: int, n: int) -> int: 执行用时: 5960 ms , 在所有 Python3 提交中击败了 12.47% 的用户 内存消耗: 70.1 MB , 在所有 Python3 提交中击败了 10.96% 的用户 - def findMaxForm1(self...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMaxForm(self, strs: List[str], m: int, n: int) -> int: 执行用时: 5960 ms , 在所有 Python3 提交中击败了 12.47% 的用户 内存消耗: 70.1 MB , 在所有 Python3 提交中击败了 10.96% 的用户 - def findMaxForm1(self...
d613ed8a5a2c15ace7d513965b372d128845d66a
<|skeleton|> class Solution: def findMaxForm(self, strs: List[str], m: int, n: int) -> int: """执行用时: 5960 ms , 在所有 Python3 提交中击败了 12.47% 的用户 内存消耗: 70.1 MB , 在所有 Python3 提交中击败了 10.96% 的用户""" <|body_0|> def findMaxForm1(self, strs: List[str], m: int, n: int) -> int: """执行用时: 3024 ms , 在所...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findMaxForm(self, strs: List[str], m: int, n: int) -> int: """执行用时: 5960 ms , 在所有 Python3 提交中击败了 12.47% 的用户 内存消耗: 70.1 MB , 在所有 Python3 提交中击败了 10.96% 的用户""" len_s = len(strs) dp = [[[0] * (n + 1) for i in range(m + 1)] for j in range(len_s + 1)] for k in range(1, ...
the_stack_v2_python_sparse
一和零.py
nomboy/leetcode
train
0
aae9886c497007d76f76c70320050dbe0dabddec
[ "size = len(candidates)\nif size <= 0:\n return []\ncandidates.sort()\npath = []\nres = []\nself._find_path(target, path, res, candidates, 0, size)\nreturn res", "if target == 0:\n res.append(path.copy())\nelse:\n for i in range(begin, size):\n left_num = target - candidates[i]\n if left_nu...
<|body_start_0|> size = len(candidates) if size <= 0: return [] candidates.sort() path = [] res = [] self._find_path(target, path, res, candidates, 0, size) return res <|end_body_0|> <|body_start_1|> if target == 0: res.append(path...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def combinationSum(self, candidates: List[int], target: int) -> List[List[int]]: """回溯法,层层递减,得到符合条件的路径就加入结果集中,超出则剪枝; 主要是要注意一些细节,避免重复等;""" <|body_0|> def _find_path(self, target, path, res, candidates, begin, size): """沿着路径往下走""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_36k_train_001853
2,269
no_license
[ { "docstring": "回溯法,层层递减,得到符合条件的路径就加入结果集中,超出则剪枝; 主要是要注意一些细节,避免重复等;", "name": "combinationSum", "signature": "def combinationSum(self, candidates: List[int], target: int) -> List[List[int]]" }, { "docstring": "沿着路径往下走", "name": "_find_path", "signature": "def _find_path(self, target, path...
2
stack_v2_sparse_classes_30k_test_000658
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def combinationSum(self, candidates: List[int], target: int) -> List[List[int]]: 回溯法,层层递减,得到符合条件的路径就加入结果集中,超出则剪枝; 主要是要注意一些细节,避免重复等; - def _find_path(self, target, path, res, cand...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def combinationSum(self, candidates: List[int], target: int) -> List[List[int]]: 回溯法,层层递减,得到符合条件的路径就加入结果集中,超出则剪枝; 主要是要注意一些细节,避免重复等; - def _find_path(self, target, path, res, cand...
13e9f74be18949875b271a742b1dfe87485ff3a2
<|skeleton|> class Solution: def combinationSum(self, candidates: List[int], target: int) -> List[List[int]]: """回溯法,层层递减,得到符合条件的路径就加入结果集中,超出则剪枝; 主要是要注意一些细节,避免重复等;""" <|body_0|> def _find_path(self, target, path, res, candidates, begin, size): """沿着路径往下走""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def combinationSum(self, candidates: List[int], target: int) -> List[List[int]]: """回溯法,层层递减,得到符合条件的路径就加入结果集中,超出则剪枝; 主要是要注意一些细节,避免重复等;""" size = len(candidates) if size <= 0: return [] candidates.sort() path = [] res = [] self._find...
the_stack_v2_python_sparse
39_Combination_Sum.py
Joker-Jerome/leetcode
train
1
6dc481e5f463f2677c05316be025fe7e4c5214b2
[ "self.udp_target = udp_target\nself.udp_port = udp_port\nself.verbosity = verbosity\nself.peer = '{}:{}'.format(self.udp_target, self.udp_port)\nif is_ipv4(self.udp_target):\n self.udp_client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\nelif is_ipv6(self.udp_target):\n self.udp_client = socket.socket(s...
<|body_start_0|> self.udp_target = udp_target self.udp_port = udp_port self.verbosity = verbosity self.peer = '{}:{}'.format(self.udp_target, self.udp_port) if is_ipv4(self.udp_target): self.udp_client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) elif is...
UDP Client provides methods to handle communication with UDP server
UDPCli
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UDPCli: """UDP Client provides methods to handle communication with UDP server""" def __init__(self, udp_target: str, udp_port: int, verbosity: bool=False) -> None: """UDP client constructor :param str udp_target: target UDP server ip address :param int udp_port: target UDP server po...
stack_v2_sparse_classes_36k_train_001854
3,289
permissive
[ { "docstring": "UDP client constructor :param str udp_target: target UDP server ip address :param int udp_port: target UDP server port :param bool verbosity: display verbose output :return None:", "name": "__init__", "signature": "def __init__(self, udp_target: str, udp_port: int, verbosity: bool=False)...
4
null
Implement the Python class `UDPCli` described below. Class description: UDP Client provides methods to handle communication with UDP server Method signatures and docstrings: - def __init__(self, udp_target: str, udp_port: int, verbosity: bool=False) -> None: UDP client constructor :param str udp_target: target UDP se...
Implement the Python class `UDPCli` described below. Class description: UDP Client provides methods to handle communication with UDP server Method signatures and docstrings: - def __init__(self, udp_target: str, udp_port: int, verbosity: bool=False) -> None: UDP client constructor :param str udp_target: target UDP se...
56ae6325c08bcedd22c57b9fe11b58f1b38314ca
<|skeleton|> class UDPCli: """UDP Client provides methods to handle communication with UDP server""" def __init__(self, udp_target: str, udp_port: int, verbosity: bool=False) -> None: """UDP client constructor :param str udp_target: target UDP server ip address :param int udp_port: target UDP server po...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UDPCli: """UDP Client provides methods to handle communication with UDP server""" def __init__(self, udp_target: str, udp_port: int, verbosity: bool=False) -> None: """UDP client constructor :param str udp_target: target UDP server ip address :param int udp_port: target UDP server port :param boo...
the_stack_v2_python_sparse
maza/core/udp/udp_client.py
ArturSpirin/maza
train
2
e1bba41fb22da447998c05e1ec3c5c3ff2c1ebf1
[ "self.ad_restore_params = ad_restore_params\nself.clone_task_id = clone_task_id\nself.exchange_restore_params = exchange_restore_params\nself.oracle_restore_params = oracle_restore_params\nself.sql_restore_params = sql_restore_params\nself.target_host = target_host\nself.target_host_parent_source = target_host_pare...
<|body_start_0|> self.ad_restore_params = ad_restore_params self.clone_task_id = clone_task_id self.exchange_restore_params = exchange_restore_params self.oracle_restore_params = oracle_restore_params self.sql_restore_params = sql_restore_params self.target_host = target_...
Implementation of the 'RestoreAppObjectParams' model. TODO: type description here. Attributes: ad_restore_params (RestoreADAppObjectParams): The AD specific application object restore params. Only applicable if the RestoreAppObject.app_entity is of type kAD. clone_task_id (long|int): Id of finished clone task which has...
RestoreAppObjectParams
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RestoreAppObjectParams: """Implementation of the 'RestoreAppObjectParams' model. TODO: type description here. Attributes: ad_restore_params (RestoreADAppObjectParams): The AD specific application object restore params. Only applicable if the RestoreAppObject.app_entity is of type kAD. clone_task_...
stack_v2_sparse_classes_36k_train_001855
5,270
permissive
[ { "docstring": "Constructor for the RestoreAppObjectParams class", "name": "__init__", "signature": "def __init__(self, ad_restore_params=None, clone_task_id=None, exchange_restore_params=None, oracle_restore_params=None, sql_restore_params=None, target_host=None, target_host_parent_source=None)" }, ...
2
null
Implement the Python class `RestoreAppObjectParams` described below. Class description: Implementation of the 'RestoreAppObjectParams' model. TODO: type description here. Attributes: ad_restore_params (RestoreADAppObjectParams): The AD specific application object restore params. Only applicable if the RestoreAppObject...
Implement the Python class `RestoreAppObjectParams` described below. Class description: Implementation of the 'RestoreAppObjectParams' model. TODO: type description here. Attributes: ad_restore_params (RestoreADAppObjectParams): The AD specific application object restore params. Only applicable if the RestoreAppObject...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class RestoreAppObjectParams: """Implementation of the 'RestoreAppObjectParams' model. TODO: type description here. Attributes: ad_restore_params (RestoreADAppObjectParams): The AD specific application object restore params. Only applicable if the RestoreAppObject.app_entity is of type kAD. clone_task_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RestoreAppObjectParams: """Implementation of the 'RestoreAppObjectParams' model. TODO: type description here. Attributes: ad_restore_params (RestoreADAppObjectParams): The AD specific application object restore params. Only applicable if the RestoreAppObject.app_entity is of type kAD. clone_task_id (long|int)...
the_stack_v2_python_sparse
cohesity_management_sdk/models/restore_app_object_params.py
cohesity/management-sdk-python
train
24
42aa0adc6de70271db0420d402122aa7be5401b5
[ "startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('vinwah', 'vinwah')\nuri = 'https://data.boston.gov/api/3/action/datastore_search?resource_id=062fc6fa-b5ff-4270-86cf-202225e40858&limit=171000'\nresponse = urllib.request.urlopen(uri).read().decode('utf-...
<|body_start_0|> startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('vinwah', 'vinwah') uri = 'https://data.boston.gov/api/3/action/datastore_search?resource_id=062fc6fa-b5ff-4270-86cf-202225e40858&limit=171000' res...
retrieveProperties
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class retrieveProperties: def execute(trial=False): """Retrieves data about properties in Boston from Analyze Boston""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everything happening...
stack_v2_sparse_classes_36k_train_001856
3,579
no_license
[ { "docstring": "Retrieves data about properties in Boston from Analyze Boston", "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 document describ...
2
null
Implement the Python class `retrieveProperties` described below. Class description: Implement the retrieveProperties class. Method signatures and docstrings: - def execute(trial=False): Retrieves data about properties in Boston from Analyze Boston - def provenance(doc=prov.model.ProvDocument(), startTime=None, endTim...
Implement the Python class `retrieveProperties` described below. Class description: Implement the retrieveProperties class. Method signatures and docstrings: - def execute(trial=False): Retrieves data about properties in Boston from Analyze Boston - def provenance(doc=prov.model.ProvDocument(), startTime=None, endTim...
b5ccaad97f6e35f9580e645ca764f36eb3406f43
<|skeleton|> class retrieveProperties: def execute(trial=False): """Retrieves data about properties in Boston from Analyze Boston""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everything happening...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class retrieveProperties: def execute(trial=False): """Retrieves data about properties in Boston from Analyze Boston""" startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('vinwah', 'vinwah') uri = 'https://data....
the_stack_v2_python_sparse
vinwah/retrieveProperties.py
dwang1995/course-2018-spr-proj
train
1
755d7f98a52f0deb4da9799518bc1bf3c096ebda
[ "super(QuestionRightsDomainTest, self).setUp()\nself.question_id = 'question_id'\nself.signup('user@example.com', 'User')\nself.skill_ids = ['skill_1']\nself.question = question_domain.Question.create_default_question(self.question_id, self.skill_ids)\nself.user_id = self.get_user_id_from_email('user@example.com')"...
<|body_start_0|> super(QuestionRightsDomainTest, self).setUp() self.question_id = 'question_id' self.signup('user@example.com', 'User') self.skill_ids = ['skill_1'] self.question = question_domain.Question.create_default_question(self.question_id, self.skill_ids) self.use...
Test for Question Rights Domain object.
QuestionRightsDomainTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuestionRightsDomainTest: """Test for Question Rights Domain object.""" def setUp(self): """Before each individual test, create a question and user.""" <|body_0|> def test_to_dict(self): """Test to verify to_dict method of the Question Rights Domain object.""" ...
stack_v2_sparse_classes_36k_train_001857
20,931
permissive
[ { "docstring": "Before each individual test, create a question and user.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test to verify to_dict method of the Question Rights Domain object.", "name": "test_to_dict", "signature": "def test_to_dict(self)" }, { "...
3
null
Implement the Python class `QuestionRightsDomainTest` described below. Class description: Test for Question Rights Domain object. Method signatures and docstrings: - def setUp(self): Before each individual test, create a question and user. - def test_to_dict(self): Test to verify to_dict method of the Question Rights...
Implement the Python class `QuestionRightsDomainTest` described below. Class description: Test for Question Rights Domain object. Method signatures and docstrings: - def setUp(self): Before each individual test, create a question and user. - def test_to_dict(self): Test to verify to_dict method of the Question Rights...
899b9755a6b795a8991e596055ac24065a8435e0
<|skeleton|> class QuestionRightsDomainTest: """Test for Question Rights Domain object.""" def setUp(self): """Before each individual test, create a question and user.""" <|body_0|> def test_to_dict(self): """Test to verify to_dict method of the Question Rights Domain object.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QuestionRightsDomainTest: """Test for Question Rights Domain object.""" def setUp(self): """Before each individual test, create a question and user.""" super(QuestionRightsDomainTest, self).setUp() self.question_id = 'question_id' self.signup('user@example.com', 'User') ...
the_stack_v2_python_sparse
core/domain/question_domain_test.py
import-keshav/oppia
train
4
570467c274b2d03c6f3dee82a79b7dd7c5c31759
[ "if isinstance(event_data.values, list) and event_data.data_type in ('windows:registry:key_value', 'windows:registry:service'):\n values = []\n for name, data_type, data in sorted(event_data.values):\n if isinstance(data, bytes):\n byte_stream = base64.urlsafe_b64encode(data)\n da...
<|body_start_0|> if isinstance(event_data.values, list) and event_data.data_type in ('windows:registry:key_value', 'windows:registry:service'): values = [] for name, data_type, data in sorted(event_data.values): if isinstance(data, bytes): byte_stream ...
JSON output module field formatting helper.
JSONFieldFormattingHelper
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JSONFieldFormattingHelper: """JSON output module field formatting helper.""" def _FormatValues(self, output_mediator, event, event_data, event_data_stream): """Formats a values. Args: output_mediator (OutputMediator): mediates interactions between output modules and other components,...
stack_v2_sparse_classes_36k_train_001858
7,537
permissive
[ { "docstring": "Formats a values. Args: output_mediator (OutputMediator): mediates interactions between output modules and other components, such as storage and dfVFS. event (EventObject): event. event_data (EventData): event data. event_data_stream (EventDataStream): event data stream. Returns: list[dict[str, ...
2
null
Implement the Python class `JSONFieldFormattingHelper` described below. Class description: JSON output module field formatting helper. Method signatures and docstrings: - def _FormatValues(self, output_mediator, event, event_data, event_data_stream): Formats a values. Args: output_mediator (OutputMediator): mediates ...
Implement the Python class `JSONFieldFormattingHelper` described below. Class description: JSON output module field formatting helper. Method signatures and docstrings: - def _FormatValues(self, output_mediator, event, event_data, event_data_stream): Formats a values. Args: output_mediator (OutputMediator): mediates ...
d6022f8cfebfddf2d08ab2d300a41b61f3349933
<|skeleton|> class JSONFieldFormattingHelper: """JSON output module field formatting helper.""" def _FormatValues(self, output_mediator, event, event_data, event_data_stream): """Formats a values. Args: output_mediator (OutputMediator): mediates interactions between output modules and other components,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JSONFieldFormattingHelper: """JSON output module field formatting helper.""" def _FormatValues(self, output_mediator, event, event_data, event_data_stream): """Formats a values. Args: output_mediator (OutputMediator): mediates interactions between output modules and other components, such as stor...
the_stack_v2_python_sparse
plaso/output/shared_json.py
log2timeline/plaso
train
1,506
3b6dc827ac0d21d3013b82b46121a4ee3c1fb239
[ "handler = logging.FileHandler(filename)\nhandler.setFormatter(logging.Formatter(output_format))\nlogger = logging.getLogger(loggername)\nlogger.setLevel(level)\nlogger.addHandler(handler)\nreturn logger", "data = json.load(open('crypto_tulips/config/logger_setting.json'))\nif level == LoggingLevel.DEBUG:\n lo...
<|body_start_0|> handler = logging.FileHandler(filename) handler.setFormatter(logging.Formatter(output_format)) logger = logging.getLogger(loggername) logger.setLevel(level) logger.addHandler(handler) return logger <|end_body_0|> <|body_start_1|> data = json.load...
The Logger Class that has static methods to help with different logging
Logger
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Logger: """The Logger Class that has static methods to help with different logging""" def generate_logger(level, filename, output_format, loggername): """Generates and returns the logger object Keyword arugments: level -- Type of Logging Level filename -- The file that the logged mes...
stack_v2_sparse_classes_36k_train_001859
4,339
no_license
[ { "docstring": "Generates and returns the logger object Keyword arugments: level -- Type of Logging Level filename -- The file that the logged messages will be saved to output_format -- The format the data will be logged in loggername -- the logger id name Returns: logger -- the logger object so the log functio...
3
null
Implement the Python class `Logger` described below. Class description: The Logger Class that has static methods to help with different logging Method signatures and docstrings: - def generate_logger(level, filename, output_format, loggername): Generates and returns the logger object Keyword arugments: level -- Type ...
Implement the Python class `Logger` described below. Class description: The Logger Class that has static methods to help with different logging Method signatures and docstrings: - def generate_logger(level, filename, output_format, loggername): Generates and returns the logger object Keyword arugments: level -- Type ...
b0f168293dbb06bf0d95935de2b3b3b86f07069f
<|skeleton|> class Logger: """The Logger Class that has static methods to help with different logging""" def generate_logger(level, filename, output_format, loggername): """Generates and returns the logger object Keyword arugments: level -- Type of Logging Level filename -- The file that the logged mes...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Logger: """The Logger Class that has static methods to help with different logging""" def generate_logger(level, filename, output_format, loggername): """Generates and returns the logger object Keyword arugments: level -- Type of Logging Level filename -- The file that the logged messages will be...
the_stack_v2_python_sparse
crypto_tulips/logger/crypt_logger.py
StevenJohnston/py-crypto-tulips
train
0
a09e42d3aa5b1a4c5c364fc1c7004a80c9f86acf
[ "if isinstance(paths, six.string_types):\n self._paths = [paths]\nelse:\n self._paths = paths", "event_files = []\nfor path in paths:\n dirs = tf.gfile.Glob(path)\n dirs = filter(lambda x: tf.gfile.IsDirectory(x), dirs)\n for dir in dirs:\n if recursive:\n dir_files_pair = [(root,...
<|body_start_0|> if isinstance(paths, six.string_types): self._paths = [paths] else: self._paths = paths <|end_body_0|> <|body_start_1|> event_files = [] for path in paths: dirs = tf.gfile.Glob(path) dirs = filter(lambda x: tf.gfile.IsDire...
Represents TensorFlow summary events from files under specified directories.
Summary
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Summary: """Represents TensorFlow summary events from files under specified directories.""" def __init__(self, paths): """Initializes an instance of a Summary. Args: path: a path or a list of paths to directories which hold TensorFlow events files. Can be local path or GCS paths. Wil...
stack_v2_sparse_classes_36k_train_001860
5,983
permissive
[ { "docstring": "Initializes an instance of a Summary. Args: path: a path or a list of paths to directories which hold TensorFlow events files. Can be local path or GCS paths. Wild cards allowed.", "name": "__init__", "signature": "def __init__(self, paths)" }, { "docstring": "Find all tf events ...
5
stack_v2_sparse_classes_30k_train_019173
Implement the Python class `Summary` described below. Class description: Represents TensorFlow summary events from files under specified directories. Method signatures and docstrings: - def __init__(self, paths): Initializes an instance of a Summary. Args: path: a path or a list of paths to directories which hold Ten...
Implement the Python class `Summary` described below. Class description: Represents TensorFlow summary events from files under specified directories. Method signatures and docstrings: - def __init__(self, paths): Initializes an instance of a Summary. Args: path: a path or a list of paths to directories which hold Ten...
8bf007da3e43096aa3a3dca158fc56b286ba6f5c
<|skeleton|> class Summary: """Represents TensorFlow summary events from files under specified directories.""" def __init__(self, paths): """Initializes an instance of a Summary. Args: path: a path or a list of paths to directories which hold TensorFlow events files. Can be local path or GCS paths. Wil...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Summary: """Represents TensorFlow summary events from files under specified directories.""" def __init__(self, paths): """Initializes an instance of a Summary. Args: path: a path or a list of paths to directories which hold TensorFlow events files. Can be local path or GCS paths. Wild cards allow...
the_stack_v2_python_sparse
google/datalab/ml/_summary.py
googledatalab/pydatalab
train
200
a8b07d767c6a6536dfa0ffc4a1aeac856bcd547f
[ "super(EmCgwshUniRouteMerge, self).__init__()\nsuper(EmCgwshServiceFlavor, self).__init__()\nself.service = GlobalModule.SERVICE_CGWSH_UNI_ROUTE\nself.order_type = GlobalModule.ORDER_MERGE\nself._xml_ns = '{%s}' % GlobalModule.EM_NAME_SPACES[self.service]\nself._scenario_name = 'CgwshUniRouteMerge'", "xml_elm = e...
<|body_start_0|> super(EmCgwshUniRouteMerge, self).__init__() super(EmCgwshServiceFlavor, self).__init__() self.service = GlobalModule.SERVICE_CGWSH_UNI_ROUTE self.order_type = GlobalModule.ORDER_MERGE self._xml_ns = '{%s}' % GlobalModule.EM_NAME_SPACES[self.service] self...
Class for adding Cgwsh servive UNI static route.
EmCgwshUniRouteMerge
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EmCgwshUniRouteMerge: """Class for adding Cgwsh servive UNI static route.""" def __init__(self): """Constructor""" <|body_0|> def _creating_json(self, device_message): """EC message(XML) divided into that for device is converted to JSON. Parameter: device_message...
stack_v2_sparse_classes_36k_train_001861
1,731
permissive
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "EC message(XML) divided into that for device is converted to JSON. Parameter: device_message: message for ech device Return value: device_json_message: JSON message", "name": "_creating_jso...
2
null
Implement the Python class `EmCgwshUniRouteMerge` described below. Class description: Class for adding Cgwsh servive UNI static route. Method signatures and docstrings: - def __init__(self): Constructor - def _creating_json(self, device_message): EC message(XML) divided into that for device is converted to JSON. Para...
Implement the Python class `EmCgwshUniRouteMerge` described below. Class description: Class for adding Cgwsh servive UNI static route. Method signatures and docstrings: - def __init__(self): Constructor - def _creating_json(self, device_message): EC message(XML) divided into that for device is converted to JSON. Para...
e550d1b5ec9419f1fb3eb6e058ce46b57c92ee2f
<|skeleton|> class EmCgwshUniRouteMerge: """Class for adding Cgwsh servive UNI static route.""" def __init__(self): """Constructor""" <|body_0|> def _creating_json(self, device_message): """EC message(XML) divided into that for device is converted to JSON. Parameter: device_message...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EmCgwshUniRouteMerge: """Class for adding Cgwsh servive UNI static route.""" def __init__(self): """Constructor""" super(EmCgwshUniRouteMerge, self).__init__() super(EmCgwshServiceFlavor, self).__init__() self.service = GlobalModule.SERVICE_CGWSH_UNI_ROUTE self.ord...
the_stack_v2_python_sparse
lib/Scenario/CGW-SH/EmCgwshUniRouteMerge.py
lixiaochun/element-manager
train
0
6851df1936dfa6ca1718231b09f74df8edd44c82
[ "self.images = np.array(images).astype(np.float32)\nif labels is not None:\n self.labels = np.array(labels).astype(np.int32)\n self.n_labels = len(np.unique(labels))\nelse:\n self.labels = None\nself.num_examples = len(self.images)", "current_permutation = np.random.permutation(range(len(self.images)))\n...
<|body_start_0|> self.images = np.array(images).astype(np.float32) if labels is not None: self.labels = np.array(labels).astype(np.int32) self.n_labels = len(np.unique(labels)) else: self.labels = None self.num_examples = len(self.images) <|end_body_0|...
Utility class for batching data and handling multiple splits. Attributes ---------- current_batch_idx : int Description images : np.ndarray Xs of the dataset. Not necessarily images. labels : np.ndarray ys of the dataset. n_labels : int Number of possible labels num_examples : int Number of total observations
DatasetSplit
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DatasetSplit: """Utility class for batching data and handling multiple splits. Attributes ---------- current_batch_idx : int Description images : np.ndarray Xs of the dataset. Not necessarily images. labels : np.ndarray ys of the dataset. n_labels : int Number of possible labels num_examples : in...
stack_v2_sparse_classes_36k_train_001862
6,886
no_license
[ { "docstring": "Initialize a DatasetSplit object. Parameters ---------- images : np.ndarray Xs/inputs labels : np.ndarray ys/outputs", "name": "__init__", "signature": "def __init__(self, images, labels)" }, { "docstring": "Batch generator with randomization. Parameters ---------- batch_size : i...
2
stack_v2_sparse_classes_30k_train_012071
Implement the Python class `DatasetSplit` described below. Class description: Utility class for batching data and handling multiple splits. Attributes ---------- current_batch_idx : int Description images : np.ndarray Xs of the dataset. Not necessarily images. labels : np.ndarray ys of the dataset. n_labels : int Numb...
Implement the Python class `DatasetSplit` described below. Class description: Utility class for batching data and handling multiple splits. Attributes ---------- current_batch_idx : int Description images : np.ndarray Xs of the dataset. Not necessarily images. labels : np.ndarray ys of the dataset. n_labels : int Numb...
431e991e8e61f741f5b6739619ab2379301091e2
<|skeleton|> class DatasetSplit: """Utility class for batching data and handling multiple splits. Attributes ---------- current_batch_idx : int Description images : np.ndarray Xs of the dataset. Not necessarily images. labels : np.ndarray ys of the dataset. n_labels : int Number of possible labels num_examples : in...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DatasetSplit: """Utility class for batching data and handling multiple splits. Attributes ---------- current_batch_idx : int Description images : np.ndarray Xs of the dataset. Not necessarily images. labels : np.ndarray ys of the dataset. n_labels : int Number of possible labels num_examples : int Number of t...
the_stack_v2_python_sparse
Submission/VAE-model/libs/dataset_utils.py
parijitkedia/ETH_CIL_Cosmology_VAE_CNN
train
0
4de260c1ed7876014a08e354a78ffa139202e792
[ "E2ETransformer.add_arguments(parser)\nE2E.add_conformer_arguments(parser)\nreturn parser", "group = parser.add_argument_group('conformer model specific setting')\ngroup = add_arguments_conformer_common(group)\nreturn parser", "super().__init__(idim, odim, args, ignore_id)\nif args.transformer_attn_dropout_rate...
<|body_start_0|> E2ETransformer.add_arguments(parser) E2E.add_conformer_arguments(parser) return parser <|end_body_0|> <|body_start_1|> group = parser.add_argument_group('conformer model specific setting') group = add_arguments_conformer_common(group) return parser <|end...
E2E module. :param int idim: dimension of inputs :param int odim: dimension of outputs :param Namespace args: argument Namespace containing options
E2E
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class E2E: """E2E module. :param int idim: dimension of inputs :param int odim: dimension of outputs :param Namespace args: argument Namespace containing options""" def add_arguments(parser): """Add arguments.""" <|body_0|> def add_conformer_arguments(parser): """Add a...
stack_v2_sparse_classes_36k_train_001863
2,955
permissive
[ { "docstring": "Add arguments.", "name": "add_arguments", "signature": "def add_arguments(parser)" }, { "docstring": "Add arguments for conformer model.", "name": "add_conformer_arguments", "signature": "def add_conformer_arguments(parser)" }, { "docstring": "Construct an E2E obj...
3
stack_v2_sparse_classes_30k_test_000351
Implement the Python class `E2E` described below. Class description: E2E module. :param int idim: dimension of inputs :param int odim: dimension of outputs :param Namespace args: argument Namespace containing options Method signatures and docstrings: - def add_arguments(parser): Add arguments. - def add_conformer_arg...
Implement the Python class `E2E` described below. Class description: E2E module. :param int idim: dimension of inputs :param int odim: dimension of outputs :param Namespace args: argument Namespace containing options Method signatures and docstrings: - def add_arguments(parser): Add arguments. - def add_conformer_arg...
bcd20948db7846ee523443ef9fd78c7a1248c95e
<|skeleton|> class E2E: """E2E module. :param int idim: dimension of inputs :param int odim: dimension of outputs :param Namespace args: argument Namespace containing options""" def add_arguments(parser): """Add arguments.""" <|body_0|> def add_conformer_arguments(parser): """Add a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class E2E: """E2E module. :param int idim: dimension of inputs :param int odim: dimension of outputs :param Namespace args: argument Namespace containing options""" def add_arguments(parser): """Add arguments.""" E2ETransformer.add_arguments(parser) E2E.add_conformer_arguments(parser) ...
the_stack_v2_python_sparse
espnet/nets/pytorch_backend/e2e_asr_conformer.py
espnet/espnet
train
7,242
3fb00a21f97f646ba4ab320e994df23835338d57
[ "self.rects = rects\nself.rands = []\ntotal_area = 0\nfor i in range(len(rects)):\n total_area += (rects[i][2] - rects[i][0] + 1) * (rects[i][3] - rects[i][1] + 1)\n self.rands.append(total_area)", "rand_area = randint(0, self.rands[-1] - 1)\nrect = self.rects[bisect.bisect_right(self.rands, rand_area)]\nra...
<|body_start_0|> self.rects = rects self.rands = [] total_area = 0 for i in range(len(rects)): total_area += (rects[i][2] - rects[i][0] + 1) * (rects[i][3] - rects[i][1] + 1) self.rands.append(total_area) <|end_body_0|> <|body_start_1|> rand_area = randin...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, rects): """:type rects: List[List[int]]""" <|body_0|> def pick(self): """:rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.rects = rects self.rands = [] total_area = 0 for i i...
stack_v2_sparse_classes_36k_train_001864
2,656
no_license
[ { "docstring": ":type rects: List[List[int]]", "name": "__init__", "signature": "def __init__(self, rects)" }, { "docstring": ":rtype: List[int]", "name": "pick", "signature": "def pick(self)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, rects): :type rects: List[List[int]] - def pick(self): :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, rects): :type rects: List[List[int]] - def pick(self): :rtype: List[int] <|skeleton|> class Solution: def __init__(self, rects): """:type rects: ...
8595b04cf5a024c2cd8a97f750d890a818568401
<|skeleton|> class Solution: def __init__(self, rects): """:type rects: List[List[int]]""" <|body_0|> def pick(self): """:rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, rects): """:type rects: List[List[int]]""" self.rects = rects self.rands = [] total_area = 0 for i in range(len(rects)): total_area += (rects[i][2] - rects[i][0] + 1) * (rects[i][3] - rects[i][1] + 1) self.rands.appen...
the_stack_v2_python_sparse
python/497.random-point-in-non-overlapping-rectangles.py
tainenko/Leetcode2019
train
5
dd2546313d4a79311c0115b1d873bac1821667c7
[ "tmp = []\nwhile head:\n tmp.append(head.val)\n head = head.next\ni, j = (0, len(tmp) - 1)\nwhile i <= j:\n if tmp[i] == tmp[j]:\n i += 1\n j -= 1\n else:\n return False\nreturn True", "nod1, nod2 = (head, head)\nwhile nod2.next and nod2.next.next:\n nod1 = nod1.next\n nod2 ...
<|body_start_0|> tmp = [] while head: tmp.append(head.val) head = head.next i, j = (0, len(tmp) - 1) while i <= j: if tmp[i] == tmp[j]: i += 1 j -= 1 else: return False return True <|e...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isPalindrome(self, head: ListNode) -> bool: """先遍历全都放到数组里判断 时间复杂度:O(n) 空间复杂度:O(n) 用了额外数组 :param head: :return:""" <|body_0|> def isPalindrome2(self, head: ListNode) -> bool: """先用快慢指针找到中点,然后反转后面的链表,最后再与原链表进行比较 :param head: :return:""" <|body_1|>...
stack_v2_sparse_classes_36k_train_001865
1,780
no_license
[ { "docstring": "先遍历全都放到数组里判断 时间复杂度:O(n) 空间复杂度:O(n) 用了额外数组 :param head: :return:", "name": "isPalindrome", "signature": "def isPalindrome(self, head: ListNode) -> bool" }, { "docstring": "先用快慢指针找到中点,然后反转后面的链表,最后再与原链表进行比较 :param head: :return:", "name": "isPalindrome2", "signature": "def i...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome(self, head: ListNode) -> bool: 先遍历全都放到数组里判断 时间复杂度:O(n) 空间复杂度:O(n) 用了额外数组 :param head: :return: - def isPalindrome2(self, head: ListNode) -> bool: 先用快慢指针找到中点,然后反转...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome(self, head: ListNode) -> bool: 先遍历全都放到数组里判断 时间复杂度:O(n) 空间复杂度:O(n) 用了额外数组 :param head: :return: - def isPalindrome2(self, head: ListNode) -> bool: 先用快慢指针找到中点,然后反转...
578cacff5851c5c2522981693c34e3c318002d30
<|skeleton|> class Solution: def isPalindrome(self, head: ListNode) -> bool: """先遍历全都放到数组里判断 时间复杂度:O(n) 空间复杂度:O(n) 用了额外数组 :param head: :return:""" <|body_0|> def isPalindrome2(self, head: ListNode) -> bool: """先用快慢指针找到中点,然后反转后面的链表,最后再与原链表进行比较 :param head: :return:""" <|body_1|>...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isPalindrome(self, head: ListNode) -> bool: """先遍历全都放到数组里判断 时间复杂度:O(n) 空间复杂度:O(n) 用了额外数组 :param head: :return:""" tmp = [] while head: tmp.append(head.val) head = head.next i, j = (0, len(tmp) - 1) while i <= j: if tmp[i...
the_stack_v2_python_sparse
回文链表.py
cjrzs/MyLeetCode
train
8
b32971aa817e7716fadef1467c16697b7dcbb8d1
[ "cnp = self.cleaned_data.get('cnp')\nqs = User.objects.filter(cnp=cnp)\nif qs.exists():\n raise forms.ValidationError('cnp is taken')\nif CNP.validation(cnp) != 'Good CNP':\n raise forms.ValidationError('cnp is not corect')\nreturn cnp", "email = self.cleaned_data.get('email')\nqs = User.objects.filter(emai...
<|body_start_0|> cnp = self.cleaned_data.get('cnp') qs = User.objects.filter(cnp=cnp) if qs.exists(): raise forms.ValidationError('cnp is taken') if CNP.validation(cnp) != 'Good CNP': raise forms.ValidationError('cnp is not corect') return cnp <|end_body_0...
UserUpdateForm
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserUpdateForm: def clean_cnp(self) -> str: """Verifies the availability and validity of the CNP""" <|body_0|> def clean_email(self) -> str: """Verify email is available.""" <|body_1|> def clean_username(self) -> str: """Verifies the username is ...
stack_v2_sparse_classes_36k_train_001866
7,415
permissive
[ { "docstring": "Verifies the availability and validity of the CNP", "name": "clean_cnp", "signature": "def clean_cnp(self) -> str" }, { "docstring": "Verify email is available.", "name": "clean_email", "signature": "def clean_email(self) -> str" }, { "docstring": "Verifies the us...
4
stack_v2_sparse_classes_30k_train_010348
Implement the Python class `UserUpdateForm` described below. Class description: Implement the UserUpdateForm class. Method signatures and docstrings: - def clean_cnp(self) -> str: Verifies the availability and validity of the CNP - def clean_email(self) -> str: Verify email is available. - def clean_username(self) ->...
Implement the Python class `UserUpdateForm` described below. Class description: Implement the UserUpdateForm class. Method signatures and docstrings: - def clean_cnp(self) -> str: Verifies the availability and validity of the CNP - def clean_email(self) -> str: Verify email is available. - def clean_username(self) ->...
7f7cde94939f02f13df5afa865cddc72981481e2
<|skeleton|> class UserUpdateForm: def clean_cnp(self) -> str: """Verifies the availability and validity of the CNP""" <|body_0|> def clean_email(self) -> str: """Verify email is available.""" <|body_1|> def clean_username(self) -> str: """Verifies the username is ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserUpdateForm: def clean_cnp(self) -> str: """Verifies the availability and validity of the CNP""" cnp = self.cleaned_data.get('cnp') qs = User.objects.filter(cnp=cnp) if qs.exists(): raise forms.ValidationError('cnp is taken') if CNP.validation(cnp) != 'Go...
the_stack_v2_python_sparse
CustomUsers/forms.py
PopaGabriel/Food-Ecommerce-Site
train
1
ba095f8d49006181f7700d1b4b4db7099af1f932
[ "context = super(NewUserView, self).get_context_data(**kwargs)\nif 'user_is_active' in self.request.session:\n context['user_is_active'] = self.request.session['user_is_active']\nif 'user_is_none' in self.request.session:\n context['user_is_none'] = self.request.session['user_is_none']\nreturn context", "ne...
<|body_start_0|> context = super(NewUserView, self).get_context_data(**kwargs) if 'user_is_active' in self.request.session: context['user_is_active'] = self.request.session['user_is_active'] if 'user_is_none' in self.request.session: context['user_is_none'] = self.request...
Base generic view for user login or registration.
NewUserView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NewUserView: """Base generic view for user login or registration.""" def get_context_data(self, **kwargs): """Method for get_context_date implementing from generic.DetailView class.""" <|body_0|> def new_user_form_valid(self, form): """Method for new user registr...
stack_v2_sparse_classes_36k_train_001867
5,315
permissive
[ { "docstring": "Method for get_context_date implementing from generic.DetailView class.", "name": "get_context_data", "signature": "def get_context_data(self, **kwargs)" }, { "docstring": "Method for new user registration.", "name": "new_user_form_valid", "signature": "def new_user_form_...
3
stack_v2_sparse_classes_30k_train_015241
Implement the Python class `NewUserView` described below. Class description: Base generic view for user login or registration. Method signatures and docstrings: - def get_context_data(self, **kwargs): Method for get_context_date implementing from generic.DetailView class. - def new_user_form_valid(self, form): Method...
Implement the Python class `NewUserView` described below. Class description: Base generic view for user login or registration. Method signatures and docstrings: - def get_context_data(self, **kwargs): Method for get_context_date implementing from generic.DetailView class. - def new_user_form_valid(self, form): Method...
5effabfaee8ff5d1294d1b4de576cde718cd24ae
<|skeleton|> class NewUserView: """Base generic view for user login or registration.""" def get_context_data(self, **kwargs): """Method for get_context_date implementing from generic.DetailView class.""" <|body_0|> def new_user_form_valid(self, form): """Method for new user registr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NewUserView: """Base generic view for user login or registration.""" def get_context_data(self, **kwargs): """Method for get_context_date implementing from generic.DetailView class.""" context = super(NewUserView, self).get_context_data(**kwargs) if 'user_is_active' in self.reques...
the_stack_v2_python_sparse
user_account/views.py
piemar1/Schedule_django
train
0
7ada38ce3f9e547a2bbc91c707b9c16f68211b33
[ "view = ElasticListAPIView()\nview.Meta.model = MagicMock()\nview.Meta.model.field_has_raw.return_value = False\nexpectation = {'query': {'match': {'param1': 'value1'}}}\nelasticfilter = ElasticFilter()\nqueryset = Search()\nresult = elasticfilter._add_query('param1', 'value1', view, queryset)\nself.assertTrue(view...
<|body_start_0|> view = ElasticListAPIView() view.Meta.model = MagicMock() view.Meta.model.field_has_raw.return_value = False expectation = {'query': {'match': {'param1': 'value1'}}} elasticfilter = ElasticFilter() queryset = Search() result = elasticfilter._add_q...
Filter tests.
FilterTests
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FilterTests: """Filter tests.""" def test__add_query_no_raw(self): """Test proper handling of mapping without raw field.""" <|body_0|> def test__add_query_with_raw(self): """Test proper handling of mapping with raw field.""" <|body_1|> def test__coer...
stack_v2_sparse_classes_36k_train_001868
12,045
permissive
[ { "docstring": "Test proper handling of mapping without raw field.", "name": "test__add_query_no_raw", "signature": "def test__add_query_no_raw(self)" }, { "docstring": "Test proper handling of mapping with raw field.", "name": "test__add_query_with_raw", "signature": "def test__add_quer...
6
stack_v2_sparse_classes_30k_train_011281
Implement the Python class `FilterTests` described below. Class description: Filter tests. Method signatures and docstrings: - def test__add_query_no_raw(self): Test proper handling of mapping without raw field. - def test__add_query_with_raw(self): Test proper handling of mapping with raw field. - def test__coerce_v...
Implement the Python class `FilterTests` described below. Class description: Filter tests. Method signatures and docstrings: - def test__add_query_no_raw(self): Test proper handling of mapping without raw field. - def test__add_query_with_raw(self): Test proper handling of mapping with raw field. - def test__coerce_v...
73d334a9f0df7c044c06989977a9a22dd2ff9b7a
<|skeleton|> class FilterTests: """Filter tests.""" def test__add_query_no_raw(self): """Test proper handling of mapping without raw field.""" <|body_0|> def test__add_query_with_raw(self): """Test proper handling of mapping with raw field.""" <|body_1|> def test__coer...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FilterTests: """Filter tests.""" def test__add_query_no_raw(self): """Test proper handling of mapping without raw field.""" view = ElasticListAPIView() view.Meta.model = MagicMock() view.Meta.model.field_has_raw.return_value = False expectation = {'query': {'match'...
the_stack_v2_python_sparse
goldstone/drfes/tests.py
bhuvan-rk/goldstone-server
train
0
575be922c01f426a914e348146a7ef462b34d296
[ "super(SanMenNoFengDealer, self).__init__()\nself.__card_colors = [MTile.TILE_WAN, MTile.TILE_TONG, MTile.TILE_TIAO]\nself.__card_count = len(self.__card_colors)\nself.setCardTiles(MTile.getTiles(self.__card_colors))\nftlog.debug(self.cardTiles)", "for color in self.__card_colors:\n random.shuffle(self.cardTil...
<|body_start_0|> super(SanMenNoFengDealer, self).__init__() self.__card_colors = [MTile.TILE_WAN, MTile.TILE_TONG, MTile.TILE_TIAO] self.__card_count = len(self.__card_colors) self.setCardTiles(MTile.getTiles(self.__card_colors)) ftlog.debug(self.cardTiles) <|end_body_0|> <|body...
SanMenNoFengDealer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SanMenNoFengDealer: def __init__(self): """初始化 子类在自己的初始化方法里,初始化麻将牌池范围,准备发牌 四川玩法,只有三门,没有风""" <|body_0|> def shuffle(self, goodPointCount, cardCountPerHand): """参数说明 goodPointCount : 好牌点的人数 cardCountPerHand : 每手牌的麻将牌张数""" <|body_1|> def getGoodCard(self, c...
stack_v2_sparse_classes_36k_train_001869
3,073
no_license
[ { "docstring": "初始化 子类在自己的初始化方法里,初始化麻将牌池范围,准备发牌 四川玩法,只有三门,没有风", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "参数说明 goodPointCount : 好牌点的人数 cardCountPerHand : 每手牌的麻将牌张数", "name": "shuffle", "signature": "def shuffle(self, goodPointCount, cardCountPerHand)" }, ...
4
null
Implement the Python class `SanMenNoFengDealer` described below. Class description: Implement the SanMenNoFengDealer class. Method signatures and docstrings: - def __init__(self): 初始化 子类在自己的初始化方法里,初始化麻将牌池范围,准备发牌 四川玩法,只有三门,没有风 - def shuffle(self, goodPointCount, cardCountPerHand): 参数说明 goodPointCount : 好牌点的人数 cardCoun...
Implement the Python class `SanMenNoFengDealer` described below. Class description: Implement the SanMenNoFengDealer class. Method signatures and docstrings: - def __init__(self): 初始化 子类在自己的初始化方法里,初始化麻将牌池范围,准备发牌 四川玩法,只有三门,没有风 - def shuffle(self, goodPointCount, cardCountPerHand): 参数说明 goodPointCount : 好牌点的人数 cardCoun...
b5b08a85d49c3bed460255a62dc5201b998d88d4
<|skeleton|> class SanMenNoFengDealer: def __init__(self): """初始化 子类在自己的初始化方法里,初始化麻将牌池范围,准备发牌 四川玩法,只有三门,没有风""" <|body_0|> def shuffle(self, goodPointCount, cardCountPerHand): """参数说明 goodPointCount : 好牌点的人数 cardCountPerHand : 每手牌的麻将牌张数""" <|body_1|> def getGoodCard(self, c...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SanMenNoFengDealer: def __init__(self): """初始化 子类在自己的初始化方法里,初始化麻将牌池范围,准备发牌 四川玩法,只有三门,没有风""" super(SanMenNoFengDealer, self).__init__() self.__card_colors = [MTile.TILE_WAN, MTile.TILE_TONG, MTile.TILE_TIAO] self.__card_count = len(self.__card_colors) self.setCardTiles(M...
the_stack_v2_python_sparse
majiang2/src/majiang2/dealer/dealer_sanmen_nofeng.py
cnbcloud/mjserver
train
1
18515dc63d418c56d9edbc4931ab80fe02984372
[ "if is_zip(path):\n hosts, services, vulns, notes = (Pdict(), Pdict(), Pdict(), Pdict())\n with ZipFile(path) as fzip:\n for ftmp in [fname for fname in fzip.namelist() if re.match(cls.ARCHIVE_PATHS, fname)]:\n thosts, tservices, tvulns, tnotes = NmapParser._parse_data(file_from_zip(path, ft...
<|body_start_0|> if is_zip(path): hosts, services, vulns, notes = (Pdict(), Pdict(), Pdict(), Pdict()) with ZipFile(path) as fzip: for ftmp in [fname for fname in fzip.namelist() if re.match(cls.ARCHIVE_PATHS, fname)]: thosts, tservices, tvulns, tnotes...
nmap xml output parser
NmapParser
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NmapParser: """nmap xml output parser""" def parse_path(cls, path): """parse data from path""" <|body_0|> def _parse_data(data): """parse raw string data""" <|body_1|> def _parse_hosts(report): """parse hosts""" <|body_2|> def _p...
stack_v2_sparse_classes_36k_train_001870
4,535
permissive
[ { "docstring": "parse data from path", "name": "parse_path", "signature": "def parse_path(cls, path)" }, { "docstring": "parse raw string data", "name": "_parse_data", "signature": "def _parse_data(data)" }, { "docstring": "parse hosts", "name": "_parse_hosts", "signature...
5
stack_v2_sparse_classes_30k_train_003391
Implement the Python class `NmapParser` described below. Class description: nmap xml output parser Method signatures and docstrings: - def parse_path(cls, path): parse data from path - def _parse_data(data): parse raw string data - def _parse_hosts(report): parse hosts - def _parse_services(report): parse services - ...
Implement the Python class `NmapParser` described below. Class description: nmap xml output parser Method signatures and docstrings: - def parse_path(cls, path): parse data from path - def _parse_data(data): parse raw string data - def _parse_hosts(report): parse hosts - def _parse_services(report): parse services - ...
dc382da4fb60f2cfba69a4456a4fa430d6cb77ba
<|skeleton|> class NmapParser: """nmap xml output parser""" def parse_path(cls, path): """parse data from path""" <|body_0|> def _parse_data(data): """parse raw string data""" <|body_1|> def _parse_hosts(report): """parse hosts""" <|body_2|> def _p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NmapParser: """nmap xml output parser""" def parse_path(cls, path): """parse data from path""" if is_zip(path): hosts, services, vulns, notes = (Pdict(), Pdict(), Pdict(), Pdict()) with ZipFile(path) as fzip: for ftmp in [fname for fname in fzip.nam...
the_stack_v2_python_sparse
sner/server/parser/nmap.py
kovariktomas/sner4
train
0
4ecb8a240e7df6395d900f382e37fdcf3f608dcb
[ "form = super(AddAlbumView, self).get_form()\nform.fields['cover_photo'].queryset = self.request.user.profile.photos.all()\nform.fields['photos'].queryset = self.request.user.profile.photos.all()\nreturn form", "self.object = form.save()\nself.object.owner = self.request.user.profile\nself.object.save()\nreturn H...
<|body_start_0|> form = super(AddAlbumView, self).get_form() form.fields['cover_photo'].queryset = self.request.user.profile.photos.all() form.fields['photos'].queryset = self.request.user.profile.photos.all() return form <|end_body_0|> <|body_start_1|> self.object = form.save()...
Add a new album.
AddAlbumView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AddAlbumView: """Add a new album.""" def get_form(self): """Retrieve form and customize some fields.""" <|body_0|> def form_valid(self, form): """If form post is successful, set the object's owner.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_001871
6,669
permissive
[ { "docstring": "Retrieve form and customize some fields.", "name": "get_form", "signature": "def get_form(self)" }, { "docstring": "If form post is successful, set the object's owner.", "name": "form_valid", "signature": "def form_valid(self, form)" } ]
2
stack_v2_sparse_classes_30k_train_008943
Implement the Python class `AddAlbumView` described below. Class description: Add a new album. Method signatures and docstrings: - def get_form(self): Retrieve form and customize some fields. - def form_valid(self, form): If form post is successful, set the object's owner.
Implement the Python class `AddAlbumView` described below. Class description: Add a new album. Method signatures and docstrings: - def get_form(self): Retrieve form and customize some fields. - def form_valid(self, form): If form post is successful, set the object's owner. <|skeleton|> class AddAlbumView: """Add...
ae0dd708fe29e9b2aec9125d649b06fc7b724e45
<|skeleton|> class AddAlbumView: """Add a new album.""" def get_form(self): """Retrieve form and customize some fields.""" <|body_0|> def form_valid(self, form): """If form post is successful, set the object's owner.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AddAlbumView: """Add a new album.""" def get_form(self): """Retrieve form and customize some fields.""" form = super(AddAlbumView, self).get_form() form.fields['cover_photo'].queryset = self.request.user.profile.photos.all() form.fields['photos'].queryset = self.request.us...
the_stack_v2_python_sparse
imagersite/imager_images/views.py
fordf/django-imager
train
0
99788cb75b4f5ef4f4da740a7c66f487329af00d
[ "path_, savedir = os.path.split(saveloc)\nif path_ == '':\n path_ = '.'\nif not os.path.exists(path_):\n raise ValueError('\"{0}\" does not exist. \\nCannot create \"{1}\"'.format(path_, savedir))\nif not os.path.exists(saveloc):\n os.mkdir(saveloc)\nself.saveloc = saveloc\nself.model = model\nself._certai...
<|body_start_0|> path_, savedir = os.path.split(saveloc) if path_ == '': path_ = '.' if not os.path.exists(path_): raise ValueError('"{0}" does not exist. \nCannot create "{1}"'.format(path_, savedir)) if not os.path.exists(saveloc): os.mkdir(saveloc) ...
Create a class that contains functionality to load/save a model scenario
Scenario
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Scenario: """Create a class that contains functionality to load/save a model scenario""" def __init__(self, saveloc, model=None): """Constructor for a Scenario object. It's main function is to either 'save' and model or to 'load' an already existing model. If a model is loaded from s...
stack_v2_sparse_classes_36k_train_001872
16,771
no_license
[ { "docstring": "Constructor for a Scenario object. It's main function is to either 'save' and model or to 'load' an already existing model. If a model is loaded from saveloc, the 'model' attribute will contain the re-created model object. 'saveloc' is given as /path_to_save_directory/save_directory if /path_to_...
6
null
Implement the Python class `Scenario` described below. Class description: Create a class that contains functionality to load/save a model scenario Method signatures and docstrings: - def __init__(self, saveloc, model=None): Constructor for a Scenario object. It's main function is to either 'save' and model or to 'loa...
Implement the Python class `Scenario` described below. Class description: Create a class that contains functionality to load/save a model scenario Method signatures and docstrings: - def __init__(self, saveloc, model=None): Constructor for a Scenario object. It's main function is to either 'save' and model or to 'loa...
81f0e73b50b83022bf8327e181a3799fa2d980c1
<|skeleton|> class Scenario: """Create a class that contains functionality to load/save a model scenario""" def __init__(self, saveloc, model=None): """Constructor for a Scenario object. It's main function is to either 'save' and model or to 'load' an already existing model. If a model is loaded from s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Scenario: """Create a class that contains functionality to load/save a model scenario""" def __init__(self, saveloc, model=None): """Constructor for a Scenario object. It's main function is to either 'save' and model or to 'load' an already existing model. If a model is loaded from saveloc, the '...
the_stack_v2_python_sparse
py_gnome/gnome/persist/scenario.py
kthyng/GNOME2
train
1
891f56b5c63b41812626f1a4c927af7165e88396
[ "d.screen_on()\ntime.sleep(1)\nd.drag(0.5, 0.8, 0.5, 0.1)\ntime.sleep(2)\nfor i in range(4):\n d(resourceId='com.android.systemui:id/key7').click()", "d.app_start('com.guodong.guodong')\ntime.sleep(2)\nd.set_fastinput_ime(True)\nd.clear_text()\nd(text='请输入手机号').set_text('18008062016')\ntime.sleep(2)\nd.click(0...
<|body_start_0|> d.screen_on() time.sleep(1) d.drag(0.5, 0.8, 0.5, 0.1) time.sleep(2) for i in range(4): d(resourceId='com.android.systemui:id/key7').click() <|end_body_0|> <|body_start_1|> d.app_start('com.guodong.guodong') time.sleep(2) d.se...
LiveWaveTestCase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LiveWaveTestCase: def test_01(self): """打开手机""" <|body_0|> def test_02(self): """登录""" <|body_1|> def test_03(self): """首页""" <|body_2|> <|end_skeleton|> <|body_start_0|> d.screen_on() time.sleep(1) d.drag(0.5, 0...
stack_v2_sparse_classes_36k_train_001873
2,310
no_license
[ { "docstring": "打开手机", "name": "test_01", "signature": "def test_01(self)" }, { "docstring": "登录", "name": "test_02", "signature": "def test_02(self)" }, { "docstring": "首页", "name": "test_03", "signature": "def test_03(self)" } ]
3
stack_v2_sparse_classes_30k_train_003867
Implement the Python class `LiveWaveTestCase` described below. Class description: Implement the LiveWaveTestCase class. Method signatures and docstrings: - def test_01(self): 打开手机 - def test_02(self): 登录 - def test_03(self): 首页
Implement the Python class `LiveWaveTestCase` described below. Class description: Implement the LiveWaveTestCase class. Method signatures and docstrings: - def test_01(self): 打开手机 - def test_02(self): 登录 - def test_03(self): 首页 <|skeleton|> class LiveWaveTestCase: def test_01(self): """打开手机""" <...
fe221e4187a26da9b5f93d5f68bf6ff64d581d73
<|skeleton|> class LiveWaveTestCase: def test_01(self): """打开手机""" <|body_0|> def test_02(self): """登录""" <|body_1|> def test_03(self): """首页""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LiveWaveTestCase: def test_01(self): """打开手机""" d.screen_on() time.sleep(1) d.drag(0.5, 0.8, 0.5, 0.1) time.sleep(2) for i in range(4): d(resourceId='com.android.systemui:id/key7').click() def test_02(self): """登录""" d.app_start(...
the_stack_v2_python_sparse
uiautomator2/LiveWave.py
quqiao/eshare
train
0
980e7804901a30bc37d9f3ff8fa6e30ab1f8211c
[ "self.data_format = data_format\nself.channel_axis = 1 if data_format == 'channels_first' else 3\nself.load_path = load_path", "shortcut = x\nif expansion != 1:\n x = tf.layers.conv2d(x, input_filters * expansion, kernel_size=1, use_bias=False, padding='same', data_format=self.data_format)\n x = tf.layers.b...
<|body_start_0|> self.data_format = data_format self.channel_axis = 1 if data_format == 'channels_first' else 3 self.load_path = load_path <|end_body_0|> <|body_start_1|> shortcut = x if expansion != 1: x = tf.layers.conv2d(x, input_filters * expansion, kernel_size=1...
Backbone of mobilenet v2.
MobileNetV2Backbone
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MobileNetV2Backbone: """Backbone of mobilenet v2.""" def __init__(self, load_path=None, data_format='channels_first'): """Construct MobileNetV2 class. :param load_path: path for saved model""" <|body_0|> def block(self, x, input_filters, output_filters, expansion, stride...
stack_v2_sparse_classes_36k_train_001874
3,285
permissive
[ { "docstring": "Construct MobileNetV2 class. :param load_path: path for saved model", "name": "__init__", "signature": "def __init__(self, load_path=None, data_format='channels_first')" }, { "docstring": "Mobilenetv2 block.", "name": "block", "signature": "def block(self, x, input_filter...
4
null
Implement the Python class `MobileNetV2Backbone` described below. Class description: Backbone of mobilenet v2. Method signatures and docstrings: - def __init__(self, load_path=None, data_format='channels_first'): Construct MobileNetV2 class. :param load_path: path for saved model - def block(self, x, input_filters, o...
Implement the Python class `MobileNetV2Backbone` described below. Class description: Backbone of mobilenet v2. Method signatures and docstrings: - def __init__(self, load_path=None, data_format='channels_first'): Construct MobileNetV2 class. :param load_path: path for saved model - def block(self, x, input_filters, o...
df51ed9c1d6dbde1deef63f2a037a369f8554406
<|skeleton|> class MobileNetV2Backbone: """Backbone of mobilenet v2.""" def __init__(self, load_path=None, data_format='channels_first'): """Construct MobileNetV2 class. :param load_path: path for saved model""" <|body_0|> def block(self, x, input_filters, output_filters, expansion, stride...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MobileNetV2Backbone: """Backbone of mobilenet v2.""" def __init__(self, load_path=None, data_format='channels_first'): """Construct MobileNetV2 class. :param load_path: path for saved model""" self.data_format = data_format self.channel_axis = 1 if data_format == 'channels_first' ...
the_stack_v2_python_sparse
built-in/TensorFlow/Official/cv/image_classification/ResnetVariant_for_TensorFlow/automl/vega/search_space/networks/tensorflow/customs/adelaide_nn/mobilenetv2_backbone.py
Huawei-Ascend/modelzoo
train
1
3372b3a9694e8b64f8b2b6d5e411dd76e992a929
[ "if id is not None:\n self.id = id\nelse:\n Base.__nb_objects += 1\n self.id = Base.__nb_objects", "if list_dictionaries is not None or []:\n return json.dumps(list_dictionaries)\nelse:\n return '[]'", "filename = cls.__name__ + '.json'\nelements = []\nif list_objs is not None:\n for el in lis...
<|body_start_0|> if id is not None: self.id = id else: Base.__nb_objects += 1 self.id = Base.__nb_objects <|end_body_0|> <|body_start_1|> if list_dictionaries is not None or []: return json.dumps(list_dictionaries) else: return...
private class attribute __nb_objects = 0 class constructor: def __init__(self, id=None)::
Base
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Base: """private class attribute __nb_objects = 0 class constructor: def __init__(self, id=None)::""" def __init__(self, id=None): """constructor""" <|body_0|> def to_json_string(list_dictionaries): """Returns a json string""" <|body_1|> def save_to_...
stack_v2_sparse_classes_36k_train_001875
2,507
no_license
[ { "docstring": "constructor", "name": "__init__", "signature": "def __init__(self, id=None)" }, { "docstring": "Returns a json string", "name": "to_json_string", "signature": "def to_json_string(list_dictionaries)" }, { "docstring": "filename, contains class name + .json extensio...
6
stack_v2_sparse_classes_30k_train_003503
Implement the Python class `Base` described below. Class description: private class attribute __nb_objects = 0 class constructor: def __init__(self, id=None):: Method signatures and docstrings: - def __init__(self, id=None): constructor - def to_json_string(list_dictionaries): Returns a json string - def save_to_file...
Implement the Python class `Base` described below. Class description: private class attribute __nb_objects = 0 class constructor: def __init__(self, id=None):: Method signatures and docstrings: - def __init__(self, id=None): constructor - def to_json_string(list_dictionaries): Returns a json string - def save_to_file...
83b0c509580d2ef0daf0e5be2a597a9bd39f2f26
<|skeleton|> class Base: """private class attribute __nb_objects = 0 class constructor: def __init__(self, id=None)::""" def __init__(self, id=None): """constructor""" <|body_0|> def to_json_string(list_dictionaries): """Returns a json string""" <|body_1|> def save_to_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Base: """private class attribute __nb_objects = 0 class constructor: def __init__(self, id=None)::""" def __init__(self, id=None): """constructor""" if id is not None: self.id = id else: Base.__nb_objects += 1 self.id = Base.__nb_objects de...
the_stack_v2_python_sparse
0x0C-python-almost_a_circle/models/base.py
sandovbarr/holbertonschool-higher_level_programming
train
0
466ce09f4213dd5a6caa416605f696f5679d1a71
[ "self.user = username\nself.address = server_address\nself.dest_path = dest_path\nself.comp_filename = comp_filename\nself.zip_path = zip_path\nself.send_cmd = 'scp %s %s@%s:%s' % (self.comp_filename, self.user, self.address, self.dest_path)\nself.copy_cmd = 'cp -R %s/%s %s' % (self.zip_path, self.comp_filename, se...
<|body_start_0|> self.user = username self.address = server_address self.dest_path = dest_path self.comp_filename = comp_filename self.zip_path = zip_path self.send_cmd = 'scp %s %s@%s:%s' % (self.comp_filename, self.user, self.address, self.dest_path) self.copy_c...
S2S (Send 2 Server) is designed for use with a public ssh key.
S2S
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class S2S: """S2S (Send 2 Server) is designed for use with a public ssh key.""" def __init__(self, username=None, server_address=None, dest_path=None, remote=True, comp_filename='', zip_path=None, compressed=True, auto=False): """:param username (string): Remote server username. :param ser...
stack_v2_sparse_classes_36k_train_001876
3,888
no_license
[ { "docstring": ":param username (string): Remote server username. :param server_address (string): Remote server address. :param dest_path (string): Remote server destination. :param comp_filename (string): This is the name of the compressed file that will be generated (eg 'test.zip') :param zip_path: This is th...
5
stack_v2_sparse_classes_30k_train_007713
Implement the Python class `S2S` described below. Class description: S2S (Send 2 Server) is designed for use with a public ssh key. Method signatures and docstrings: - def __init__(self, username=None, server_address=None, dest_path=None, remote=True, comp_filename='', zip_path=None, compressed=True, auto=False): :pa...
Implement the Python class `S2S` described below. Class description: S2S (Send 2 Server) is designed for use with a public ssh key. Method signatures and docstrings: - def __init__(self, username=None, server_address=None, dest_path=None, remote=True, comp_filename='', zip_path=None, compressed=True, auto=False): :pa...
e207046ec36387751fe2bba8b6782fdc2a580107
<|skeleton|> class S2S: """S2S (Send 2 Server) is designed for use with a public ssh key.""" def __init__(self, username=None, server_address=None, dest_path=None, remote=True, comp_filename='', zip_path=None, compressed=True, auto=False): """:param username (string): Remote server username. :param ser...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class S2S: """S2S (Send 2 Server) is designed for use with a public ssh key.""" def __init__(self, username=None, server_address=None, dest_path=None, remote=True, comp_filename='', zip_path=None, compressed=True, auto=False): """:param username (string): Remote server username. :param server_address (...
the_stack_v2_python_sparse
OrthoEvol/Tools/send2server/s2s.py
datasnakes/OrthoEvolution
train
19
edbc0a6dd17a9328f386a10ad5496d3c02ef4c38
[ "sql = \" select s.student_id, pbc.full_name as student_name, s.up_station_id, s.off_station_id, s1.bus_station_name as up_station_name, s2.bus_station_name as off_station_name, aa.up_station_id as original_up_station_id, aa.off_station_id as original_off_station_id, s3.bus_station_name as original_up_station_na...
<|body_start_0|> sql = " select s.student_id, pbc.full_name as student_name, s.up_station_id, s.off_station_id, s1.bus_station_name as up_station_name, s2.bus_station_name as off_station_name, aa.up_station_id as original_up_station_id, aa.off_station_id as original_off_station_id, s3.bus_station_name as ori...
StudentLineSeatLog
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StudentLineSeatLog: def query_sa_line_tooltips(self, login_user_id, create_dt): """获取有无学生调整线路 :param login_user_id :param create_dt :return:""" <|body_0|> def add_student_line_seat_log(self, student_obj, login_user_id, now_time): """插入一条学生座位日志 :return:""" <|b...
stack_v2_sparse_classes_36k_train_001877
4,377
no_license
[ { "docstring": "获取有无学生调整线路 :param login_user_id :param create_dt :return:", "name": "query_sa_line_tooltips", "signature": "def query_sa_line_tooltips(self, login_user_id, create_dt)" }, { "docstring": "插入一条学生座位日志 :return:", "name": "add_student_line_seat_log", "signature": "def add_stud...
2
stack_v2_sparse_classes_30k_train_014949
Implement the Python class `StudentLineSeatLog` described below. Class description: Implement the StudentLineSeatLog class. Method signatures and docstrings: - def query_sa_line_tooltips(self, login_user_id, create_dt): 获取有无学生调整线路 :param login_user_id :param create_dt :return: - def add_student_line_seat_log(self, st...
Implement the Python class `StudentLineSeatLog` described below. Class description: Implement the StudentLineSeatLog class. Method signatures and docstrings: - def query_sa_line_tooltips(self, login_user_id, create_dt): 获取有无学生调整线路 :param login_user_id :param create_dt :return: - def add_student_line_seat_log(self, st...
a7cf5a0b6daa372ed860dc43d92c55fcde764eb9
<|skeleton|> class StudentLineSeatLog: def query_sa_line_tooltips(self, login_user_id, create_dt): """获取有无学生调整线路 :param login_user_id :param create_dt :return:""" <|body_0|> def add_student_line_seat_log(self, student_obj, login_user_id, now_time): """插入一条学生座位日志 :return:""" <|b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StudentLineSeatLog: def query_sa_line_tooltips(self, login_user_id, create_dt): """获取有无学生调整线路 :param login_user_id :param create_dt :return:""" sql = " select s.student_id, pbc.full_name as student_name, s.up_station_id, s.off_station_id, s1.bus_station_name as up_station_name, s2.bus_station...
the_stack_v2_python_sparse
python_project/smart_schoolBus_project/app/schoolbus_situation/models/student_line_seat_log_model.py
malqch/aibus
train
0
92038d1c9c73a6d572035f4fcee28ffa11cafb53
[ "streamList = Stream.Stream.query.filter_by(id=streamID).all()\ndb.session.commit()\nreturn {'results': [ob.serialize() for ob in streamList]}", "if 'X-API-KEY' in request.headers:\n requestAPIKey = apikey.apikey.query.filter_by(key=request.headers['X-API-KEY']).first()\n if requestAPIKey is not None:\n ...
<|body_start_0|> streamList = Stream.Stream.query.filter_by(id=streamID).all() db.session.commit() return {'results': [ob.serialize() for ob in streamList]} <|end_body_0|> <|body_start_1|> if 'X-API-KEY' in request.headers: requestAPIKey = apikey.apikey.query.filter_by(key=r...
api_1_ListStream
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class api_1_ListStream: def get(self, streamID): """Returns Info on a Single Active Streams""" <|body_0|> def put(self, streamID): """Change a Streams's Name or Topic""" <|body_1|> <|end_skeleton|> <|body_start_0|> streamList = Stream.Stream.query.filter_...
stack_v2_sparse_classes_36k_train_001878
3,398
permissive
[ { "docstring": "Returns Info on a Single Active Streams", "name": "get", "signature": "def get(self, streamID)" }, { "docstring": "Change a Streams's Name or Topic", "name": "put", "signature": "def put(self, streamID)" } ]
2
stack_v2_sparse_classes_30k_test_001029
Implement the Python class `api_1_ListStream` described below. Class description: Implement the api_1_ListStream class. Method signatures and docstrings: - def get(self, streamID): Returns Info on a Single Active Streams - def put(self, streamID): Change a Streams's Name or Topic
Implement the Python class `api_1_ListStream` described below. Class description: Implement the api_1_ListStream class. Method signatures and docstrings: - def get(self, streamID): Returns Info on a Single Active Streams - def put(self, streamID): Change a Streams's Name or Topic <|skeleton|> class api_1_ListStream:...
9088c44616a2e94f6771216af6f22c241064e321
<|skeleton|> class api_1_ListStream: def get(self, streamID): """Returns Info on a Single Active Streams""" <|body_0|> def put(self, streamID): """Change a Streams's Name or Topic""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class api_1_ListStream: def get(self, streamID): """Returns Info on a Single Active Streams""" streamList = Stream.Stream.query.filter_by(id=streamID).all() db.session.commit() return {'results': [ob.serialize() for ob in streamList]} def put(self, streamID): """Change a...
the_stack_v2_python_sparse
blueprints/apis/stream_ns.py
codions-forks/flask-nginx-rtmp-manager
train
1
cf0a99d362c3982a82258fef1c7ad9b13fa50320
[ "n = len(s)\nt = [None for i in range(n)]\nreturn self.word_break_aux(s, wordDict, n - 1, t)", "if s[:i + 1] in wordDict:\n return True\nelif t[i] is not None:\n return t[i]\nelse:\n for j in range(i):\n if self.word_break_aux(s, wordDict, j, t) is True and s[j + 1:i + 1] in wordDict:\n ...
<|body_start_0|> n = len(s) t = [None for i in range(n)] return self.word_break_aux(s, wordDict, n - 1, t) <|end_body_0|> <|body_start_1|> if s[:i + 1] in wordDict: return True elif t[i] is not None: return t[i] else: for j in range(i)...
Solution
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def wordBreak(self, s, wordDict): """:type s: str :type wordDict: Set[str] :rtype: bool""" <|body_0|> def word_break_aux(self, s, wordDict, i, t): """Determine if s[:i + 1] can be segmented by dict wordDict""" <|body_1|> <|end_skeleton|> <|body_st...
stack_v2_sparse_classes_36k_train_001879
1,231
permissive
[ { "docstring": ":type s: str :type wordDict: Set[str] :rtype: bool", "name": "wordBreak", "signature": "def wordBreak(self, s, wordDict)" }, { "docstring": "Determine if s[:i + 1] can be segmented by dict wordDict", "name": "word_break_aux", "signature": "def word_break_aux(self, s, word...
2
stack_v2_sparse_classes_30k_train_015166
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def wordBreak(self, s, wordDict): :type s: str :type wordDict: Set[str] :rtype: bool - def word_break_aux(self, s, wordDict, i, t): Determine if s[:i + 1] can be segmented by dic...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def wordBreak(self, s, wordDict): :type s: str :type wordDict: Set[str] :rtype: bool - def word_break_aux(self, s, wordDict, i, t): Determine if s[:i + 1] can be segmented by dic...
38acc65fa4315f86acb62874ca488620c5d77e17
<|skeleton|> class Solution: def wordBreak(self, s, wordDict): """:type s: str :type wordDict: Set[str] :rtype: bool""" <|body_0|> def word_break_aux(self, s, wordDict, i, t): """Determine if s[:i + 1] can be segmented by dict wordDict""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def wordBreak(self, s, wordDict): """:type s: str :type wordDict: Set[str] :rtype: bool""" n = len(s) t = [None for i in range(n)] return self.word_break_aux(s, wordDict, n - 1, t) def word_break_aux(self, s, wordDict, i, t): """Determine if s[:i + 1] can...
the_stack_v2_python_sparse
word_break/solution2.py
mahimadubey/leetcode-python
train
0
60d4b3a8df552bebc24e6433a3652920e7cfdae5
[ "response = self.get(reverse('api-user-list'), expected_code=200)\nself.assertEqual(len(response.data), User.objects.count())\nfor key in ['username', 'pk', 'email']:\n self.assertIn(key, response.data[0])\npk = response.data[0]['pk']\nresponse = self.get(reverse('api-user-detail', kwargs={'pk': pk}), expected_c...
<|body_start_0|> response = self.get(reverse('api-user-list'), expected_code=200) self.assertEqual(len(response.data), User.objects.count()) for key in ['username', 'pk', 'email']: self.assertIn(key, response.data[0]) pk = response.data[0]['pk'] response = self.get(re...
Tests for user API endpoints
UserAPITests
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserAPITests: """Tests for user API endpoints""" def test_user_api(self): """Tests for User API endpoints""" <|body_0|> def test_group_api(self): """Tests for the Group API endpoints""" <|body_1|> <|end_skeleton|> <|body_start_0|> response = sel...
stack_v2_sparse_classes_36k_train_001880
1,498
permissive
[ { "docstring": "Tests for User API endpoints", "name": "test_user_api", "signature": "def test_user_api(self)" }, { "docstring": "Tests for the Group API endpoints", "name": "test_group_api", "signature": "def test_group_api(self)" } ]
2
stack_v2_sparse_classes_30k_train_021414
Implement the Python class `UserAPITests` described below. Class description: Tests for user API endpoints Method signatures and docstrings: - def test_user_api(self): Tests for User API endpoints - def test_group_api(self): Tests for the Group API endpoints
Implement the Python class `UserAPITests` described below. Class description: Tests for user API endpoints Method signatures and docstrings: - def test_user_api(self): Tests for User API endpoints - def test_group_api(self): Tests for the Group API endpoints <|skeleton|> class UserAPITests: """Tests for user API...
e88a8e99a5f0b201c67a95cba097c729f090d5e2
<|skeleton|> class UserAPITests: """Tests for user API endpoints""" def test_user_api(self): """Tests for User API endpoints""" <|body_0|> def test_group_api(self): """Tests for the Group API endpoints""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserAPITests: """Tests for user API endpoints""" def test_user_api(self): """Tests for User API endpoints""" response = self.get(reverse('api-user-list'), expected_code=200) self.assertEqual(len(response.data), User.objects.count()) for key in ['username', 'pk', 'email']: ...
the_stack_v2_python_sparse
InvenTree/users/test_api.py
inventree/InvenTree
train
3,077
0e8cc52db41cde801e0436c78f04692eeae707b0
[ "if len(prices) <= 1:\n return 0\nmaxPro = 0\nminPrice = prices[0]\nfor i in range(1, len(prices)):\n maxPro = max(maxPro, prices[i] - minPrice)\n minPrice = min(minPrice, prices[i])\nreturn maxPro", "minPirce = prices[0]\nmaxPro = 0\nlength = len(prices)\nfor i in range(1, length):\n if prices[i] < m...
<|body_start_0|> if len(prices) <= 1: return 0 maxPro = 0 minPrice = prices[0] for i in range(1, len(prices)): maxPro = max(maxPro, prices[i] - minPrice) minPrice = min(minPrice, prices[i]) return maxPro <|end_body_0|> <|body_start_1|> ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int 动态规划""" <|body_0|> def maxProfit(self, prices): """:type prices: List[int] :rtype: int 非动态规划""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(prices) <= 1: ...
stack_v2_sparse_classes_36k_train_001881
854
permissive
[ { "docstring": ":type prices: List[int] :rtype: int 动态规划", "name": "maxProfit", "signature": "def maxProfit(self, prices)" }, { "docstring": ":type prices: List[int] :rtype: int 非动态规划", "name": "maxProfit", "signature": "def maxProfit(self, prices)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices): :type prices: List[int] :rtype: int 动态规划 - def maxProfit(self, prices): :type prices: List[int] :rtype: int 非动态规划
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices): :type prices: List[int] :rtype: int 动态规划 - def maxProfit(self, prices): :type prices: List[int] :rtype: int 非动态规划 <|skeleton|> class Solution: ...
d2b8a1dfe986d71d02d2568b55bad6e5b1c81492
<|skeleton|> class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int 动态规划""" <|body_0|> def maxProfit(self, prices): """:type prices: List[int] :rtype: int 非动态规划""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int 动态规划""" if len(prices) <= 1: return 0 maxPro = 0 minPrice = prices[0] for i in range(1, len(prices)): maxPro = max(maxPro, prices[i] - minPrice) minPrice = ...
the_stack_v2_python_sparse
Easy/Que121.py
HuangZengPei/LeetCode
train
2
7cf88e1645d8accf7097a420974ba659944b7549
[ "self.g = g\nself.user_type = user_type\nself.item_type = item_type\nself.user_to_item_etype = list(g.metagraph()[user_type][item_type])[0]\nself.item_to_user_etype = list(g.metagraph()[item_type][user_type])[0]\nself.samplers = [dgl.sampling.PinSAGESampler(g, item_type, user_type, random_walk_length, random_walk_r...
<|body_start_0|> self.g = g self.user_type = user_type self.item_type = item_type self.user_to_item_etype = list(g.metagraph()[user_type][item_type])[0] self.item_to_user_etype = list(g.metagraph()[item_type][user_type])[0] self.samplers = [dgl.sampling.PinSAGESampler(g, ...
Neighbor Sampler class that uses PinSAGE Sampler.
NeighborSampler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NeighborSampler: """Neighbor Sampler class that uses PinSAGE Sampler.""" def __init__(self, g, user_type, item_type, random_walk_length, random_walk_restart_prob, num_random_walks, num_neighbors, num_layers): """Constructor for NeighborSampler class. Args: g (dgl.DGLGraph): graph of ...
stack_v2_sparse_classes_36k_train_001882
12,447
no_license
[ { "docstring": "Constructor for NeighborSampler class. Args: g (dgl.DGLGraph): graph of training datset user_type (str): user node name item_type (str): item node name random_walk_length (int): the maximum number traversals for a single random walk random_walk_restart_prob (int): termination probability after e...
3
stack_v2_sparse_classes_30k_train_016960
Implement the Python class `NeighborSampler` described below. Class description: Neighbor Sampler class that uses PinSAGE Sampler. Method signatures and docstrings: - def __init__(self, g, user_type, item_type, random_walk_length, random_walk_restart_prob, num_random_walks, num_neighbors, num_layers): Constructor for...
Implement the Python class `NeighborSampler` described below. Class description: Neighbor Sampler class that uses PinSAGE Sampler. Method signatures and docstrings: - def __init__(self, g, user_type, item_type, random_walk_length, random_walk_restart_prob, num_random_walks, num_neighbors, num_layers): Constructor for...
f1c385e46d2d5475b28dec91b57a933ac81c23c5
<|skeleton|> class NeighborSampler: """Neighbor Sampler class that uses PinSAGE Sampler.""" def __init__(self, g, user_type, item_type, random_walk_length, random_walk_restart_prob, num_random_walks, num_neighbors, num_layers): """Constructor for NeighborSampler class. Args: g (dgl.DGLGraph): graph of ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NeighborSampler: """Neighbor Sampler class that uses PinSAGE Sampler.""" def __init__(self, g, user_type, item_type, random_walk_length, random_walk_restart_prob, num_random_walks, num_neighbors, num_layers): """Constructor for NeighborSampler class. Args: g (dgl.DGLGraph): graph of training dats...
the_stack_v2_python_sparse
projects/project_19/src/pinsage/sampler.py
amuamushu/projects-2020-2021
train
0
fcfa8741c846c2fd476e85ad1a2446adca5a3c43
[ "if node is not self:\n self.vertices.add(node)\n node.vertices.add(self)", "for vertex in self.vertices:\n vertex.vertices.discard(self)\ndel self.vertices" ]
<|body_start_0|> if node is not self: self.vertices.add(node) node.vertices.add(self) <|end_body_0|> <|body_start_1|> for vertex in self.vertices: vertex.vertices.discard(self) del self.vertices <|end_body_1|>
An internal graph node class for the proximity handler.
GraphNode
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GraphNode: """An internal graph node class for the proximity handler.""" def link(self, node): """Link this node with another vertex. Parameters ---------- node : GraphNode The node to link with this vertex.""" <|body_0|> def unlink(self): """Unlink this node fro...
stack_v2_sparse_classes_36k_train_001883
5,910
permissive
[ { "docstring": "Link this node with another vertex. Parameters ---------- node : GraphNode The node to link with this vertex.", "name": "link", "signature": "def link(self, node)" }, { "docstring": "Unlink this node from the connected vertices.", "name": "unlink", "signature": "def unlin...
2
stack_v2_sparse_classes_30k_train_000589
Implement the Python class `GraphNode` described below. Class description: An internal graph node class for the proximity handler. Method signatures and docstrings: - def link(self, node): Link this node with another vertex. Parameters ---------- node : GraphNode The node to link with this vertex. - def unlink(self):...
Implement the Python class `GraphNode` described below. Class description: An internal graph node class for the proximity handler. Method signatures and docstrings: - def link(self, node): Link this node with another vertex. Parameters ---------- node : GraphNode The node to link with this vertex. - def unlink(self):...
1544e7fb371b8f941cfa2fde682795e479380284
<|skeleton|> class GraphNode: """An internal graph node class for the proximity handler.""" def link(self, node): """Link this node with another vertex. Parameters ---------- node : GraphNode The node to link with this vertex.""" <|body_0|> def unlink(self): """Unlink this node fro...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GraphNode: """An internal graph node class for the proximity handler.""" def link(self, node): """Link this node with another vertex. Parameters ---------- node : GraphNode The node to link with this vertex.""" if node is not self: self.vertices.add(node) node.vert...
the_stack_v2_python_sparse
enaml/qt/docking/proximity_handler.py
MatthieuDartiailh/enaml
train
26
a9e3820380e53c537b1714c713958b46f295e37d
[ "self.server = server\nself.name = name\nself.meta_data = None\nself.controllers = {}\nself.models = {}\nself.repositories = {}\nself.views = {}\nself.routes = {}", "fs_root = self.server.user_directory\nmetadatas_path = os.path.join(fs_root, 'bundles', self.name, 'bundle.yml')\nself.meta_datas = MetadatasConfigu...
<|body_start_0|> self.server = server self.name = name self.meta_data = None self.controllers = {} self.models = {} self.repositories = {} self.views = {} self.routes = {} <|end_body_0|> <|body_start_1|> fs_root = self.server.user_directory ...
Class representing a user bundle, part of a Python Aboard application. The bundles defined by the user contains part of his application. The whole bundles almost constitute the entire application itself. As a matter of fact, the bundle contains: * Configuration (like, for instance, routing informations) * Controllers a...
Bundle
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Bundle: """Class representing a user bundle, part of a Python Aboard application. The bundles defined by the user contains part of his application. The whole bundles almost constitute the entire application itself. As a matter of fact, the bundle contains: * Configuration (like, for instance, rou...
stack_v2_sparse_classes_36k_train_001884
6,504
permissive
[ { "docstring": "Create a new bundle.", "name": "__init__", "signature": "def __init__(self, server, name)" }, { "docstring": "Setup the bundle following the setup process. Note that the bundles dictionary is passed to the setup method. It allows the bundle, when reading its meta-datas, to check ...
3
stack_v2_sparse_classes_30k_train_010674
Implement the Python class `Bundle` described below. Class description: Class representing a user bundle, part of a Python Aboard application. The bundles defined by the user contains part of his application. The whole bundles almost constitute the entire application itself. As a matter of fact, the bundle contains: *...
Implement the Python class `Bundle` described below. Class description: Class representing a user bundle, part of a Python Aboard application. The bundles defined by the user contains part of his application. The whole bundles almost constitute the entire application itself. As a matter of fact, the bundle contains: *...
f459733c9307c2f843dd9ad5d1d82feafc065816
<|skeleton|> class Bundle: """Class representing a user bundle, part of a Python Aboard application. The bundles defined by the user contains part of his application. The whole bundles almost constitute the entire application itself. As a matter of fact, the bundle contains: * Configuration (like, for instance, rou...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Bundle: """Class representing a user bundle, part of a Python Aboard application. The bundles defined by the user contains part of his application. The whole bundles almost constitute the entire application itself. As a matter of fact, the bundle contains: * Configuration (like, for instance, routing informat...
the_stack_v2_python_sparse
src/bundle/bundle.py
v-legoff/pa-poc3
train
0
30d2e156aa3e4b2352c8b054cd03835d444e1a85
[ "pdata_current_point = pv.PolyData(curr_animal_point)\npc_current_point = pdata_current_point.glyph(scale=False, geom=point_location_circle)\nself.plots_data[plot_name] = {'pdata_current_point': pdata_current_point, 'pc_current_point': pc_current_point}\nself.plots[plot_name] = self.p.add_mesh(pc_current_point, nam...
<|body_start_0|> pdata_current_point = pv.PolyData(curr_animal_point) pc_current_point = pdata_current_point.glyph(scale=False, geom=point_location_circle) self.plots_data[plot_name] = {'pdata_current_point': pdata_current_point, 'pc_current_point': pc_current_point} self.plots[plot_name...
Implementor can render location points and paths/trails in the plotter Requires (Implementor Must Provide): p plots plots_data Provides: Provided Properties: None Provided Methods: perform_plot_location_point(...) perform_plot_location_trail(...)
InteractivePyvistaPlotter_PointAndPathPlottingMixin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InteractivePyvistaPlotter_PointAndPathPlottingMixin: """Implementor can render location points and paths/trails in the plotter Requires (Implementor Must Provide): p plots plots_data Provides: Provided Properties: None Provided Methods: perform_plot_location_point(...) perform_plot_location_trail...
stack_v2_sparse_classes_36k_train_001885
7,895
permissive
[ { "docstring": "will render a flat indicator of a single point like is used for the animal's current location. Updates the existing plot if the same plot_name is reused.", "name": "perform_plot_location_point", "signature": "def perform_plot_location_point(self, plot_name, curr_animal_point, render=True...
2
null
Implement the Python class `InteractivePyvistaPlotter_PointAndPathPlottingMixin` described below. Class description: Implementor can render location points and paths/trails in the plotter Requires (Implementor Must Provide): p plots plots_data Provides: Provided Properties: None Provided Methods: perform_plot_location...
Implement the Python class `InteractivePyvistaPlotter_PointAndPathPlottingMixin` described below. Class description: Implementor can render location points and paths/trails in the plotter Requires (Implementor Must Provide): p plots plots_data Provides: Provided Properties: None Provided Methods: perform_plot_location...
212399d826284b394fce8894ff1a93133aef783f
<|skeleton|> class InteractivePyvistaPlotter_PointAndPathPlottingMixin: """Implementor can render location points and paths/trails in the plotter Requires (Implementor Must Provide): p plots plots_data Provides: Provided Properties: None Provided Methods: perform_plot_location_point(...) perform_plot_location_trail...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InteractivePyvistaPlotter_PointAndPathPlottingMixin: """Implementor can render location points and paths/trails in the plotter Requires (Implementor Must Provide): p plots plots_data Provides: Provided Properties: None Provided Methods: perform_plot_location_point(...) perform_plot_location_trail(...)""" ...
the_stack_v2_python_sparse
src/pyphoplacecellanalysis/GUI/PyVista/InteractivePlotter/Mixins/InteractivePlotterMixins.py
CommanderPho/pyPhoPlaceCellAnalysis
train
1
6e92ecd8c43ecccb67746ae75ed6fef2be8cb177
[ "result, odd, even = ([], [], [])\nfor i in A:\n if i % 2 == 0:\n odd.append(i)\n else:\n even.append(i)\nwhile odd and even:\n result.append(odd.pop(0))\n result.append(even.pop(0))\nreturn result", "n = len(A)\ni, j = (0, 1)\nresult = [0] * n\nfor a in A:\n if a & 1 == 0:\n r...
<|body_start_0|> result, odd, even = ([], [], []) for i in A: if i % 2 == 0: odd.append(i) else: even.append(i) while odd and even: result.append(odd.pop(0)) result.append(even.pop(0)) return result <|end_bod...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def sortArrayByParityII(self, A): """:type A: List[int] :rtype: List[int]""" <|body_0|> def sortArrayByParityII2(self, A): """:type A: List[int] :rtype: List[int]""" <|body_1|> def sortArrayByParityII3(self, A): """:type A: List[int] :r...
stack_v2_sparse_classes_36k_train_001886
2,735
no_license
[ { "docstring": ":type A: List[int] :rtype: List[int]", "name": "sortArrayByParityII", "signature": "def sortArrayByParityII(self, A)" }, { "docstring": ":type A: List[int] :rtype: List[int]", "name": "sortArrayByParityII2", "signature": "def sortArrayByParityII2(self, A)" }, { "d...
4
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortArrayByParityII(self, A): :type A: List[int] :rtype: List[int] - def sortArrayByParityII2(self, A): :type A: List[int] :rtype: List[int] - def sortArrayByParityII3(self, ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortArrayByParityII(self, A): :type A: List[int] :rtype: List[int] - def sortArrayByParityII2(self, A): :type A: List[int] :rtype: List[int] - def sortArrayByParityII3(self, ...
f022677c042db3598003df1a320a70f0edc4f870
<|skeleton|> class Solution: def sortArrayByParityII(self, A): """:type A: List[int] :rtype: List[int]""" <|body_0|> def sortArrayByParityII2(self, A): """:type A: List[int] :rtype: List[int]""" <|body_1|> def sortArrayByParityII3(self, A): """:type A: List[int] :r...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def sortArrayByParityII(self, A): """:type A: List[int] :rtype: List[int]""" result, odd, even = ([], [], []) for i in A: if i % 2 == 0: odd.append(i) else: even.append(i) while odd and even: result.a...
the_stack_v2_python_sparse
ArrayDeal/anjioupaixushuzu2.py
daisyzl/program-exercise-python
train
0
3270429165a2922e01dae4ea6667dba020249e6c
[ "if 'password1' in self.cleaned_data and 'password2' in self.cleaned_data:\n if self.cleaned_data['password1'] != self.cleaned_data['password2']:\n raise forms.ValidationError(_(u'Passwords do not match. Please enter the same password in both fields.'))\nreturn self.cleaned_data", "email = self.cleaned_...
<|body_start_0|> if 'password1' in self.cleaned_data and 'password2' in self.cleaned_data: if self.cleaned_data['password1'] != self.cleaned_data['password2']: raise forms.ValidationError(_(u'Passwords do not match. Please enter the same password in both fields.')) return sel...
RegisterForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegisterForm: def clean(self): """Verify that the values entered into the two password fields match. Note that an error here will end up in non_field_errors() because it doesn't apply to a single field.""" <|body_0|> def clean_email(self): """Verify that the email en...
stack_v2_sparse_classes_36k_train_001887
15,236
no_license
[ { "docstring": "Verify that the values entered into the two password fields match. Note that an error here will end up in non_field_errors() because it doesn't apply to a single field.", "name": "clean", "signature": "def clean(self)" }, { "docstring": "Verify that the email entered does not exi...
3
null
Implement the Python class `RegisterForm` described below. Class description: Implement the RegisterForm class. Method signatures and docstrings: - def clean(self): Verify that the values entered into the two password fields match. Note that an error here will end up in non_field_errors() because it doesn't apply to ...
Implement the Python class `RegisterForm` described below. Class description: Implement the RegisterForm class. Method signatures and docstrings: - def clean(self): Verify that the values entered into the two password fields match. Note that an error here will end up in non_field_errors() because it doesn't apply to ...
8c2163320d4381e815524dc322c76602bea212c7
<|skeleton|> class RegisterForm: def clean(self): """Verify that the values entered into the two password fields match. Note that an error here will end up in non_field_errors() because it doesn't apply to a single field.""" <|body_0|> def clean_email(self): """Verify that the email en...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RegisterForm: def clean(self): """Verify that the values entered into the two password fields match. Note that an error here will end up in non_field_errors() because it doesn't apply to a single field.""" if 'password1' in self.cleaned_data and 'password2' in self.cleaned_data: if...
the_stack_v2_python_sparse
akvo/rsr/forms.py
supermari0/akvo-rsr
train
0
8a88a22ace11fa29fa287a4d0ba89ec06e9ecc0b
[ "if num == 1:\n return 1\nreturn num * Solution.factorial(num - 1)", "result = 1\nstack = []\nstack.append(num)\nwhile result == 1:\n num = stack[-1]\n if stack[-1] == 1:\n for item in stack:\n result *= item\n else:\n stack.append(num - 1)\n print(stack)\nreturn result" ]
<|body_start_0|> if num == 1: return 1 return num * Solution.factorial(num - 1) <|end_body_0|> <|body_start_1|> result = 1 stack = [] stack.append(num) while result == 1: num = stack[-1] if stack[-1] == 1: for item in s...
Solution
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """Solution""" def factorial(num): """Factorial recursive approach""" <|body_0|> def fac_iterative(num): """Factorial iterative approach""" <|body_1|> <|end_skeleton|> <|body_start_0|> if num == 1: return 1 return n...
stack_v2_sparse_classes_36k_train_001888
802
no_license
[ { "docstring": "Factorial recursive approach", "name": "factorial", "signature": "def factorial(num)" }, { "docstring": "Factorial iterative approach", "name": "fac_iterative", "signature": "def fac_iterative(num)" } ]
2
stack_v2_sparse_classes_30k_train_008549
Implement the Python class `Solution` described below. Class description: Solution Method signatures and docstrings: - def factorial(num): Factorial recursive approach - def fac_iterative(num): Factorial iterative approach
Implement the Python class `Solution` described below. Class description: Solution Method signatures and docstrings: - def factorial(num): Factorial recursive approach - def fac_iterative(num): Factorial iterative approach <|skeleton|> class Solution: """Solution""" def factorial(num): """Factorial ...
139a20063476f9847652b334a8495b7df1e80e27
<|skeleton|> class Solution: """Solution""" def factorial(num): """Factorial recursive approach""" <|body_0|> def fac_iterative(num): """Factorial iterative approach""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """Solution""" def factorial(num): """Factorial recursive approach""" if num == 1: return 1 return num * Solution.factorial(num - 1) def fac_iterative(num): """Factorial iterative approach""" result = 1 stack = [] stack.ap...
the_stack_v2_python_sparse
archive-20200922/math/factorial_iterative.py
clarkngo/python-projects
train
0
c7482a4492bc592cc99600fee56a50122fb06b53
[ "self.kw = kwargs\nStep.__init__(self, *args, routine=routine, **kwargs)\nqscale_settings = self.parse_settings(self.get_requested_settings())\nqbcal.QScale.__init__(self, dev=self.dev, **qscale_settings)", "kwargs = {}\ntask_list = []\nfor qb in self.qubits:\n task = {}\n task_list_fields = requested_kwarg...
<|body_start_0|> self.kw = kwargs Step.__init__(self, *args, routine=routine, **kwargs) qscale_settings = self.parse_settings(self.get_requested_settings()) qbcal.QScale.__init__(self, dev=self.dev, **qscale_settings) <|end_body_0|> <|body_start_1|> kwargs = {} task_list...
A wrapper class for the QScale experiment.
QScaleStep
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QScaleStep: """A wrapper class for the QScale experiment.""" def __init__(self, routine, *args, **kwargs): """Initializes the QScaleStep class, which also includes initialization of the QScale experiment. Arguments: routine (Step): The parent routine. Keyword args: qubits (list): Lis...
stack_v2_sparse_classes_36k_train_001889
48,290
permissive
[ { "docstring": "Initializes the QScaleStep class, which also includes initialization of the QScale experiment. Arguments: routine (Step): The parent routine. Keyword args: qubits (list): List of qubits to be used in the routine. Configuration parameters (coming from the configuration parameter dictionary): tran...
3
stack_v2_sparse_classes_30k_train_011662
Implement the Python class `QScaleStep` described below. Class description: A wrapper class for the QScale experiment. Method signatures and docstrings: - def __init__(self, routine, *args, **kwargs): Initializes the QScaleStep class, which also includes initialization of the QScale experiment. Arguments: routine (St...
Implement the Python class `QScaleStep` described below. Class description: A wrapper class for the QScale experiment. Method signatures and docstrings: - def __init__(self, routine, *args, **kwargs): Initializes the QScaleStep class, which also includes initialization of the QScale experiment. Arguments: routine (St...
bc6733d774fe31a23f4c7e73e5eb0beed8d30e7d
<|skeleton|> class QScaleStep: """A wrapper class for the QScale experiment.""" def __init__(self, routine, *args, **kwargs): """Initializes the QScaleStep class, which also includes initialization of the QScale experiment. Arguments: routine (Step): The parent routine. Keyword args: qubits (list): Lis...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QScaleStep: """A wrapper class for the QScale experiment.""" def __init__(self, routine, *args, **kwargs): """Initializes the QScaleStep class, which also includes initialization of the QScale experiment. Arguments: routine (Step): The parent routine. Keyword args: qubits (list): List of qubits t...
the_stack_v2_python_sparse
pycqed/measurement/calibration/automatic_calibration_routines/single_qubit_routines.py
QudevETH/PycQED_py3
train
8
f36544964ab2a32eec870eed70a41fc7979871be
[ "super().parse_command_line(argv)\nself.build_kernel_argv(self.extra_args)\nself.filenames_to_run = self.extra_args[:]", "self.log.debug('jupyter run: initialize...')\nsuper().initialize(argv)\nJupyterConsoleApp.initialize(self)\nsignal.signal(signal.SIGINT, self.handle_sigint)\nself.init_kernel_info()", "if se...
<|body_start_0|> super().parse_command_line(argv) self.build_kernel_argv(self.extra_args) self.filenames_to_run = self.extra_args[:] <|end_body_0|> <|body_start_1|> self.log.debug('jupyter run: initialize...') super().initialize(argv) JupyterConsoleApp.initialize(self) ...
An Jupyter Console app to run files.
RunApp
[ "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RunApp: """An Jupyter Console app to run files.""" def parse_command_line(self, argv=None): """Parse the command line arguments.""" <|body_0|> def initialize(self, argv=None): """Initialize the app.""" <|body_1|> def handle_sigint(self, *args): ...
stack_v2_sparse_classes_36k_train_001890
4,496
permissive
[ { "docstring": "Parse the command line arguments.", "name": "parse_command_line", "signature": "def parse_command_line(self, argv=None)" }, { "docstring": "Initialize the app.", "name": "initialize", "signature": "def initialize(self, argv=None)" }, { "docstring": "Handle SIGINT....
5
stack_v2_sparse_classes_30k_val_001066
Implement the Python class `RunApp` described below. Class description: An Jupyter Console app to run files. Method signatures and docstrings: - def parse_command_line(self, argv=None): Parse the command line arguments. - def initialize(self, argv=None): Initialize the app. - def handle_sigint(self, *args): Handle SI...
Implement the Python class `RunApp` described below. Class description: An Jupyter Console app to run files. Method signatures and docstrings: - def parse_command_line(self, argv=None): Parse the command line arguments. - def initialize(self, argv=None): Initialize the app. - def handle_sigint(self, *args): Handle SI...
f5042e35b945aded77b23470ead62d7eacefde92
<|skeleton|> class RunApp: """An Jupyter Console app to run files.""" def parse_command_line(self, argv=None): """Parse the command line arguments.""" <|body_0|> def initialize(self, argv=None): """Initialize the app.""" <|body_1|> def handle_sigint(self, *args): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RunApp: """An Jupyter Console app to run files.""" def parse_command_line(self, argv=None): """Parse the command line arguments.""" super().parse_command_line(argv) self.build_kernel_argv(self.extra_args) self.filenames_to_run = self.extra_args[:] def initialize(self,...
the_stack_v2_python_sparse
contrib/python/jupyter-client/py3/jupyter_client/runapp.py
catboost/catboost
train
8,012
45844ad7c7b92b2fd86013ea9b9ae8d4052b01d9
[ "self.settings = ai_game.settings\nself.reset_stats()\nself.game_active = False\nself.second_game_active = False\nwith open('highscoreThirteen.txt') as f:\n score = int(f.readline())\nself.high_score = score", "self.ships_left = self.settings.ship_limit\nself.score = 0\nself.level = 1" ]
<|body_start_0|> self.settings = ai_game.settings self.reset_stats() self.game_active = False self.second_game_active = False with open('highscoreThirteen.txt') as f: score = int(f.readline()) self.high_score = score <|end_body_0|> <|body_start_1|> se...
Track statistics for Alien Invasion
GameStats
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GameStats: """Track statistics for Alien Invasion""" def __init__(self, ai_game): """Initialize statistics""" <|body_0|> def reset_stats(self): """Inits stats that can change during game""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.setti...
stack_v2_sparse_classes_36k_train_001891
689
no_license
[ { "docstring": "Initialize statistics", "name": "__init__", "signature": "def __init__(self, ai_game)" }, { "docstring": "Inits stats that can change during game", "name": "reset_stats", "signature": "def reset_stats(self)" } ]
2
stack_v2_sparse_classes_30k_test_000157
Implement the Python class `GameStats` described below. Class description: Track statistics for Alien Invasion Method signatures and docstrings: - def __init__(self, ai_game): Initialize statistics - def reset_stats(self): Inits stats that can change during game
Implement the Python class `GameStats` described below. Class description: Track statistics for Alien Invasion Method signatures and docstrings: - def __init__(self, ai_game): Initialize statistics - def reset_stats(self): Inits stats that can change during game <|skeleton|> class GameStats: """Track statistics ...
7c49f8f05afa58c99979bf490f7bc4ff85a87167
<|skeleton|> class GameStats: """Track statistics for Alien Invasion""" def __init__(self, ai_game): """Initialize statistics""" <|body_0|> def reset_stats(self): """Inits stats that can change during game""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GameStats: """Track statistics for Alien Invasion""" def __init__(self, ai_game): """Initialize statistics""" self.settings = ai_game.settings self.reset_stats() self.game_active = False self.second_game_active = False with open('highscoreThirteen.txt') as ...
the_stack_v2_python_sparse
chapter_13/thirteenSix_gamestats.py
kelvDp/CC_python_cc_projects
train
0
95da979057c51bcc76a88baa12c8c2ff63d10d91
[ "super().__init__()\nself.dims = dims\nself.__model_fn()", "layers = []\nfor i in range(len(self.dims) - 1):\n layers.append(torch.nn.Linear(self.dims[i], self.dims[i + 1]))\nself.layers = nn.ModuleList(layers)", "for layer in self.layers:\n X = F.relu(layer(X))\nreturn X" ]
<|body_start_0|> super().__init__() self.dims = dims self.__model_fn() <|end_body_0|> <|body_start_1|> layers = [] for i in range(len(self.dims) - 1): layers.append(torch.nn.Linear(self.dims[i], self.dims[i + 1])) self.layers = nn.ModuleList(layers) <|end_bod...
Class Net.
Net
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Net: """Class Net.""" def __init__(self, dims): """Constructor. :param dims: layer dimensionalities""" <|body_0|> def __model_fn(self): """Specifies the network.""" <|body_1|> def forward(self, X): """Performs a forward-pass on the data. :par...
stack_v2_sparse_classes_36k_train_001892
4,225
no_license
[ { "docstring": "Constructor. :param dims: layer dimensionalities", "name": "__init__", "signature": "def __init__(self, dims)" }, { "docstring": "Specifies the network.", "name": "__model_fn", "signature": "def __model_fn(self)" }, { "docstring": "Performs a forward-pass on the d...
3
stack_v2_sparse_classes_30k_train_020379
Implement the Python class `Net` described below. Class description: Class Net. Method signatures and docstrings: - def __init__(self, dims): Constructor. :param dims: layer dimensionalities - def __model_fn(self): Specifies the network. - def forward(self, X): Performs a forward-pass on the data. :param X: network i...
Implement the Python class `Net` described below. Class description: Class Net. Method signatures and docstrings: - def __init__(self, dims): Constructor. :param dims: layer dimensionalities - def __model_fn(self): Specifies the network. - def forward(self, X): Performs a forward-pass on the data. :param X: network i...
98b71b76f664d5f6493bd7f90036531d8f6644a7
<|skeleton|> class Net: """Class Net.""" def __init__(self, dims): """Constructor. :param dims: layer dimensionalities""" <|body_0|> def __model_fn(self): """Specifies the network.""" <|body_1|> def forward(self, X): """Performs a forward-pass on the data. :par...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Net: """Class Net.""" def __init__(self, dims): """Constructor. :param dims: layer dimensionalities""" super().__init__() self.dims = dims self.__model_fn() def __model_fn(self): """Specifies the network.""" layers = [] for i in range(len(self....
the_stack_v2_python_sparse
06_python/unsupervised/decomposition/auto_encoder.py
pfisterer/Applied_ML_Fundamentals
train
0
e9ee9f9afcb5ec4266e57963e3065a2b9d2cf24e
[ "self.encode_type = hyper_parameters['model'].get('encode_type', 'MAX')\nself.n_win = hyper_parameters['model'].get('n_win', 3)\nsuper().__init__(hyper_parameters)", "super().create_model(hyper_parameters)\nembedding = self.word_embedding.output\n\ndef win_mean(x):\n res_list = []\n for i in range(self.len_...
<|body_start_0|> self.encode_type = hyper_parameters['model'].get('encode_type', 'MAX') self.n_win = hyper_parameters['model'].get('n_win', 3) super().__init__(hyper_parameters) <|end_body_0|> <|body_start_1|> super().create_model(hyper_parameters) embedding = self.word_embeddin...
SWEMGraph
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SWEMGraph: def __init__(self, hyper_parameters): """初始化 :param hyper_parameters: json,超参""" <|body_0|> def create_model(self, hyper_parameters): """构建神经网络 :param hyper_parameters:json, hyper parameters of network :return: tensor, moedl""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_36k_train_001893
2,341
permissive
[ { "docstring": "初始化 :param hyper_parameters: json,超参", "name": "__init__", "signature": "def __init__(self, hyper_parameters)" }, { "docstring": "构建神经网络 :param hyper_parameters:json, hyper parameters of network :return: tensor, moedl", "name": "create_model", "signature": "def create_mod...
2
stack_v2_sparse_classes_30k_train_014633
Implement the Python class `SWEMGraph` described below. Class description: Implement the SWEMGraph class. Method signatures and docstrings: - def __init__(self, hyper_parameters): 初始化 :param hyper_parameters: json,超参 - def create_model(self, hyper_parameters): 构建神经网络 :param hyper_parameters:json, hyper parameters of ...
Implement the Python class `SWEMGraph` described below. Class description: Implement the SWEMGraph class. Method signatures and docstrings: - def __init__(self, hyper_parameters): 初始化 :param hyper_parameters: json,超参 - def create_model(self, hyper_parameters): 构建神经网络 :param hyper_parameters:json, hyper parameters of ...
640e3f44f90d9d8046546f7e1a93a29ebe5c8d30
<|skeleton|> class SWEMGraph: def __init__(self, hyper_parameters): """初始化 :param hyper_parameters: json,超参""" <|body_0|> def create_model(self, hyper_parameters): """构建神经网络 :param hyper_parameters:json, hyper parameters of network :return: tensor, moedl""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SWEMGraph: def __init__(self, hyper_parameters): """初始化 :param hyper_parameters: json,超参""" self.encode_type = hyper_parameters['model'].get('encode_type', 'MAX') self.n_win = hyper_parameters['model'].get('n_win', 3) super().__init__(hyper_parameters) def create_model(sel...
the_stack_v2_python_sparse
keras_textclassification/m15_SWEM/graph.py
wzjames/Keras-TextClassification
train
1
a64ce38bc6d8d72d593e2af71603b61b7ef07503
[ "self.nets.encoder = encoder\nif task_idx != {}:\n self.task_idx = task_idx\nelif config is None:\n raise ValueError('config and classifier_task_idx not provided.')\nelif 'classifier_idx' not in config.keys():\n raise ValueError('classifier_idx must be provided in config')\nelse:\n self.task_idx = confi...
<|body_start_0|> self.nets.encoder = encoder if task_idx != {}: self.task_idx = task_idx elif config is None: raise ValueError('config and classifier_task_idx not provided.') elif 'classifier_idx' not in config.keys(): raise ValueError('classifier_idx ...
Basic classification module. This module forms several classifiers which plug into the encoder.
ClassificationEval
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClassificationEval: """Basic classification module. This module forms several classifiers which plug into the encoder.""" def build(self, encoder, config, task_idx={}, layers=[dict(layer='linear', args=(200,), bn=True, do=0.1, act='ReLU', bias=True)]): """Builds the classifiers. Args...
stack_v2_sparse_classes_36k_train_001894
3,743
permissive
[ { "docstring": "Builds the classifiers. Args: task_idx: Dictionary of (name, index) pairs of encoder output to classify. layers: Layers for classifiers.", "name": "build", "signature": "def build(self, encoder, config, task_idx={}, layers=[dict(layer='linear', args=(200,), bn=True, do=0.1, act='ReLU', b...
2
stack_v2_sparse_classes_30k_train_011786
Implement the Python class `ClassificationEval` described below. Class description: Basic classification module. This module forms several classifiers which plug into the encoder. Method signatures and docstrings: - def build(self, encoder, config, task_idx={}, layers=[dict(layer='linear', args=(200,), bn=True, do=0....
Implement the Python class `ClassificationEval` described below. Class description: Basic classification module. This module forms several classifiers which plug into the encoder. Method signatures and docstrings: - def build(self, encoder, config, task_idx={}, layers=[dict(layer='linear', args=(200,), bn=True, do=0....
980c91c3d997ce2bfb10c052842d39e2c416913c
<|skeleton|> class ClassificationEval: """Basic classification module. This module forms several classifiers which plug into the encoder.""" def build(self, encoder, config, task_idx={}, layers=[dict(layer='linear', args=(200,), bn=True, do=0.1, act='ReLU', bias=True)]): """Builds the classifiers. Args...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ClassificationEval: """Basic classification module. This module forms several classifiers which plug into the encoder.""" def build(self, encoder, config, task_idx={}, layers=[dict(layer='linear', args=(200,), bn=True, do=0.1, act='ReLU', bias=True)]): """Builds the classifiers. Args: task_idx: D...
the_stack_v2_python_sparse
cortex_DIM/evaluation_models/classification_eval.py
tanimutomo/DIM
train
1
71d467ecf86b110fb80d9ae771e67fc874cc1f5e
[ "work_time = WorkTime.objects.all().first()\nif work_time:\n data = {'id': id, 'morning_start_time': work_time.morning_start_time, 'morning_end_time': work_time.morning_end_time, 'afternoon_start_time': work_time.afternoon_start_time, 'afternoon_end_time': work_time.afternoon_end_time}\nelse:\n data = {}\nret...
<|body_start_0|> work_time = WorkTime.objects.all().first() if work_time: data = {'id': id, 'morning_start_time': work_time.morning_start_time, 'morning_end_time': work_time.morning_end_time, 'afternoon_start_time': work_time.afternoon_start_time, 'afternoon_end_time': work_time.afternoon_en...
查询一天的工作时间
WorkTimeView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WorkTimeView: """查询一天的工作时间""" def get(self, request): """获取工作时间信息""" <|body_0|> def post(self, request): """# "添加或者修改工作时间信息" :param request: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> work_time = WorkTime.objects.all().first() ...
stack_v2_sparse_classes_36k_train_001895
2,556
no_license
[ { "docstring": "获取工作时间信息", "name": "get", "signature": "def get(self, request)" }, { "docstring": "# \"添加或者修改工作时间信息\" :param request: :return:", "name": "post", "signature": "def post(self, request)" } ]
2
null
Implement the Python class `WorkTimeView` described below. Class description: 查询一天的工作时间 Method signatures and docstrings: - def get(self, request): 获取工作时间信息 - def post(self, request): # "添加或者修改工作时间信息" :param request: :return:
Implement the Python class `WorkTimeView` described below. Class description: 查询一天的工作时间 Method signatures and docstrings: - def get(self, request): 获取工作时间信息 - def post(self, request): # "添加或者修改工作时间信息" :param request: :return: <|skeleton|> class WorkTimeView: """查询一天的工作时间""" def get(self, request): "...
d6e025d7e9d9e3aecfd399c77f376130edd8a2df
<|skeleton|> class WorkTimeView: """查询一天的工作时间""" def get(self, request): """获取工作时间信息""" <|body_0|> def post(self, request): """# "添加或者修改工作时间信息" :param request: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WorkTimeView: """查询一天的工作时间""" def get(self, request): """获取工作时间信息""" work_time = WorkTime.objects.all().first() if work_time: data = {'id': id, 'morning_start_time': work_time.morning_start_time, 'morning_end_time': work_time.morning_end_time, 'afternoon_start_time': w...
the_stack_v2_python_sparse
soc_user/views/work_time.py
sundw2015/841
train
4
b8352ef22b3ff5ab3435bfae9ae27192c503ac9f
[ "self.token = {'access_token': Mytest.access_token}\ntag_name = {'tag': {'name': '545656'}}\nhost = 'https://api.weixin.qq.com/cgi-bin/tags/create'\nr6 = ApiDefine().creatertagname(self.session, host, params=self.token, data=json.dumps(tag_name))\ntime.sleep(2)\nprint('创建标签', r6.text)", "self.token = {'assess_tok...
<|body_start_0|> self.token = {'access_token': Mytest.access_token} tag_name = {'tag': {'name': '545656'}} host = 'https://api.weixin.qq.com/cgi-bin/tags/create' r6 = ApiDefine().creatertagname(self.session, host, params=self.token, data=json.dumps(tag_name)) time.sleep(2) ...
Mytest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Mytest: def test_createtag(self): """创建标签""" <|body_0|> def test_createtag30(self): """超过30个字符""" <|body_1|> def test_gettag(self): """获取标签列表""" <|body_2|> <|end_skeleton|> <|body_start_0|> self.token = {'access_token': Mytest.a...
stack_v2_sparse_classes_36k_train_001896
1,828
no_license
[ { "docstring": "创建标签", "name": "test_createtag", "signature": "def test_createtag(self)" }, { "docstring": "超过30个字符", "name": "test_createtag30", "signature": "def test_createtag30(self)" }, { "docstring": "获取标签列表", "name": "test_gettag", "signature": "def test_gettag(sel...
3
null
Implement the Python class `Mytest` described below. Class description: Implement the Mytest class. Method signatures and docstrings: - def test_createtag(self): 创建标签 - def test_createtag30(self): 超过30个字符 - def test_gettag(self): 获取标签列表
Implement the Python class `Mytest` described below. Class description: Implement the Mytest class. Method signatures and docstrings: - def test_createtag(self): 创建标签 - def test_createtag30(self): 超过30个字符 - def test_gettag(self): 获取标签列表 <|skeleton|> class Mytest: def test_createtag(self): """创建标签""" ...
7b790f675419224bfdbe1542eddc5a638982e68a
<|skeleton|> class Mytest: def test_createtag(self): """创建标签""" <|body_0|> def test_createtag30(self): """超过30个字符""" <|body_1|> def test_gettag(self): """获取标签列表""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Mytest: def test_createtag(self): """创建标签""" self.token = {'access_token': Mytest.access_token} tag_name = {'tag': {'name': '545656'}} host = 'https://api.weixin.qq.com/cgi-bin/tags/create' r6 = ApiDefine().creatertagname(self.session, host, params=self.token, data=json...
the_stack_v2_python_sparse
P9/weixin_apitest/testcases/weixin_createtag.py
liousAlready/NewDream_learning
train
0
b994c3f6a80a2d7889e40b81438638aee0dfda64
[ "super().__init__()\nself.conv = nn.Conv1d(in_channels=in_channels, out_channels=out_channels, dilation=dilation, padding=dilation, kernel_size=3, bias=False)\nnn.init.xavier_uniform_(self.conv.weight)\nself.leaky_relu = nn.LeakyReLU(negative_slope=0.2)\nself.adaptive_batch_norm = AdaptiveBatchNorm1d(num_features=o...
<|body_start_0|> super().__init__() self.conv = nn.Conv1d(in_channels=in_channels, out_channels=out_channels, dilation=dilation, padding=dilation, kernel_size=3, bias=False) nn.init.xavier_uniform_(self.conv.weight) self.leaky_relu = nn.LeakyReLU(negative_slope=0.2) self.adaptive...
Single convolutional unit for the speech denoising network. Input tensor: (batch_size, in_channels, length) Output tensor: (batch_size, out_channels, length)
ConvLayer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConvLayer: """Single convolutional unit for the speech denoising network. Input tensor: (batch_size, in_channels, length) Output tensor: (batch_size, out_channels, length)""" def __init__(self, in_channels, out_channels, dilation): """Setup the layer. in_channels: number of input cha...
stack_v2_sparse_classes_36k_train_001897
3,173
no_license
[ { "docstring": "Setup the layer. in_channels: number of input channels to be convoluted out_channels: number of output channels to be produced", "name": "__init__", "signature": "def __init__(self, in_channels, out_channels, dilation)" }, { "docstring": "Compute output tensor from input tensor",...
2
stack_v2_sparse_classes_30k_train_008981
Implement the Python class `ConvLayer` described below. Class description: Single convolutional unit for the speech denoising network. Input tensor: (batch_size, in_channels, length) Output tensor: (batch_size, out_channels, length) Method signatures and docstrings: - def __init__(self, in_channels, out_channels, dil...
Implement the Python class `ConvLayer` described below. Class description: Single convolutional unit for the speech denoising network. Input tensor: (batch_size, in_channels, length) Output tensor: (batch_size, out_channels, length) Method signatures and docstrings: - def __init__(self, in_channels, out_channels, dil...
af986a9a86060ce661e62cc444baf0e6d6757cc9
<|skeleton|> class ConvLayer: """Single convolutional unit for the speech denoising network. Input tensor: (batch_size, in_channels, length) Output tensor: (batch_size, out_channels, length)""" def __init__(self, in_channels, out_channels, dilation): """Setup the layer. in_channels: number of input cha...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConvLayer: """Single convolutional unit for the speech denoising network. Input tensor: (batch_size, in_channels, length) Output tensor: (batch_size, out_channels, length)""" def __init__(self, in_channels, out_channels, dilation): """Setup the layer. in_channels: number of input channels to be c...
the_stack_v2_python_sparse
src/tasks/speech_denoise/model.py
MattSegal/speech-enhancement
train
22
8dd64a58b95182ccdba65de699b9dad39646f26f
[ "self.screen_width = 1200\nself.screen_height = 800\nself.bg_color = (230, 230, 230)\nself.ship_limit = 3\nself.fleet_drop_factor = 100\nself.bullet_width = 6\nself.bullet_height = 30\nself.bullet_color = (60, 60, 60)\nself.bullets_allowed = 100\nself.speedup_scale = 1.1\nself.score_scale = 1.5\nself.initialize_dyn...
<|body_start_0|> self.screen_width = 1200 self.screen_height = 800 self.bg_color = (230, 230, 230) self.ship_limit = 3 self.fleet_drop_factor = 100 self.bullet_width = 6 self.bullet_height = 30 self.bullet_color = (60, 60, 60) self.bullets_allowed ...
存储《外星人入侵》的所有设置的类
Settings
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Settings: """存储《外星人入侵》的所有设置的类""" def __init__(self): """初始化游戏的设置""" <|body_0|> def initialize_dynamic_settings(self): """初始化随游戏进行而变化的设置""" <|body_1|> def increase_speed(self): """提高速度设置""" <|body_2|> <|end_skeleton|> <|body_start_0|...
stack_v2_sparse_classes_36k_train_001898
1,291
no_license
[ { "docstring": "初始化游戏的设置", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "初始化随游戏进行而变化的设置", "name": "initialize_dynamic_settings", "signature": "def initialize_dynamic_settings(self)" }, { "docstring": "提高速度设置", "name": "increase_speed", "signatur...
3
stack_v2_sparse_classes_30k_val_000474
Implement the Python class `Settings` described below. Class description: 存储《外星人入侵》的所有设置的类 Method signatures and docstrings: - def __init__(self): 初始化游戏的设置 - def initialize_dynamic_settings(self): 初始化随游戏进行而变化的设置 - def increase_speed(self): 提高速度设置
Implement the Python class `Settings` described below. Class description: 存储《外星人入侵》的所有设置的类 Method signatures and docstrings: - def __init__(self): 初始化游戏的设置 - def initialize_dynamic_settings(self): 初始化随游戏进行而变化的设置 - def increase_speed(self): 提高速度设置 <|skeleton|> class Settings: """存储《外星人入侵》的所有设置的类""" def __ini...
aee7092ad4af2e61996ddab5fa29f62b79174b14
<|skeleton|> class Settings: """存储《外星人入侵》的所有设置的类""" def __init__(self): """初始化游戏的设置""" <|body_0|> def initialize_dynamic_settings(self): """初始化随游戏进行而变化的设置""" <|body_1|> def increase_speed(self): """提高速度设置""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Settings: """存储《外星人入侵》的所有设置的类""" def __init__(self): """初始化游戏的设置""" self.screen_width = 1200 self.screen_height = 800 self.bg_color = (230, 230, 230) self.ship_limit = 3 self.fleet_drop_factor = 100 self.bullet_width = 6 self.bullet_height =...
the_stack_v2_python_sparse
12/alien_invasion/settings.py
Zandela/Python_Work
train
0
bb6461316648e8f55465aca457bb4b121ca710cb
[ "self.ensure_one()\nexpense_obj = self.env['hr.expense']\njournal = self.env['account.journal']\nif emp_contribution + company_contribution > expense_total:\n raise UserError(_('Contribution should be either greater then 0 or should not be more that total expense'))\nif not product_id:\n raise UserError(_('Pl...
<|body_start_0|> self.ensure_one() expense_obj = self.env['hr.expense'] journal = self.env['account.journal'] if emp_contribution + company_contribution > expense_total: raise UserError(_('Contribution should be either greater then 0 or should not be more that total expense')...
HrExpensePayment
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HrExpensePayment: def generate_expense_payment(self, catch_obj, description, emp_contribution, company_contribution, payment_mode, name, product_id, expense_total): """Generate total expense of employee. return: created expense ID""" <|body_0|> def redirect_to_expense(self, ...
stack_v2_sparse_classes_36k_train_001899
5,650
no_license
[ { "docstring": "Generate total expense of employee. return: created expense ID", "name": "generate_expense_payment", "signature": "def generate_expense_payment(self, catch_obj, description, emp_contribution, company_contribution, payment_mode, name, product_id, expense_total)" }, { "docstring": ...
2
stack_v2_sparse_classes_30k_train_003146
Implement the Python class `HrExpensePayment` described below. Class description: Implement the HrExpensePayment class. Method signatures and docstrings: - def generate_expense_payment(self, catch_obj, description, emp_contribution, company_contribution, payment_mode, name, product_id, expense_total): Generate total ...
Implement the Python class `HrExpensePayment` described below. Class description: Implement the HrExpensePayment class. Method signatures and docstrings: - def generate_expense_payment(self, catch_obj, description, emp_contribution, company_contribution, payment_mode, name, product_id, expense_total): Generate total ...
59cd55edd536ce9feb85c772e163a2560c224cad
<|skeleton|> class HrExpensePayment: def generate_expense_payment(self, catch_obj, description, emp_contribution, company_contribution, payment_mode, name, product_id, expense_total): """Generate total expense of employee. return: created expense ID""" <|body_0|> def redirect_to_expense(self, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HrExpensePayment: def generate_expense_payment(self, catch_obj, description, emp_contribution, company_contribution, payment_mode, name, product_id, expense_total): """Generate total expense of employee. return: created expense ID""" self.ensure_one() expense_obj = self.env['hr.expense...
the_stack_v2_python_sparse
hr_expense_payment/models/hr_expense.py
zamzamintl/SLNEE-MASTER
train
0