blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
378
8.64k
id
stringlengths
44
44
length_bytes
int64
505
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.88k
prompted_full_text
stringlengths
565
12.5k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
5.05k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
snapshot_total_rows
int64
75.8k
75.8k
solution
stringlengths
242
8.3k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
662423ab416d826e04f11ca0e33e718f6e0c9e1a
[ "self.sum = w[0:]\nif len(w) <= 0:\n return\nfor i in range(1, len(w)):\n self.sum[i] = self.sum[i - 1] + w[i]\nprint(self.sum)", "import numpy as np\nrnd = np.random.randint(0, self.sum[-1])\nlow = 0\nhigh = len(self.sum) - 1\nwhile low < high:\n mid = low + (high - low) / 2\n if self.sum[mid] <= rnd...
<|body_start_0|> self.sum = w[0:] if len(w) <= 0: return for i in range(1, len(w)): self.sum[i] = self.sum[i - 1] + w[i] print(self.sum) <|end_body_0|> <|body_start_1|> import numpy as np rnd = np.random.randint(0, self.sum[-1]) low = 0 ...
Solution1
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution1: def __init__(self, w): """:type w: List[int]""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.sum = w[0:] if len(w) <= 0: return for i in range(1, len(w)): ...
stack_v2_sparse_classes_75kplus_train_066900
1,927
no_license
[ { "docstring": ":type w: List[int]", "name": "__init__", "signature": "def __init__(self, w)" }, { "docstring": ":rtype: int", "name": "pickIndex", "signature": "def pickIndex(self)" } ]
2
stack_v2_sparse_classes_30k_train_015571
Implement the Python class `Solution1` described below. Class description: Implement the Solution1 class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int
Implement the Python class `Solution1` described below. Class description: Implement the Solution1 class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int <|skeleton|> class Solution1: def __init__(self, w): """:type w: List[int]""" ...
176cc1db3291843fb068f06d0180766dd8c3122c
<|skeleton|> class Solution1: def __init__(self, w): """:type w: List[int]""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution1: def __init__(self, w): """:type w: List[int]""" self.sum = w[0:] if len(w) <= 0: return for i in range(1, len(w)): self.sum[i] = self.sum[i - 1] + w[i] print(self.sum) def pickIndex(self): """:rtype: int""" import ...
the_stack_v2_python_sparse
2019/sampling/random_pick_with_weight_528.py
yehongyu/acode
train
0
0bb290f4b07d6ed5a00eabd0551cc0df5ca722cd
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn WorkbookTableColumn()", "from .entity import Entity\nfrom .json import Json\nfrom .workbook_filter import WorkbookFilter\nfrom .entity import Entity\nfrom .json import Json\nfrom .workbook_filter import WorkbookFilter\nfields: Dict[str...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return WorkbookTableColumn() <|end_body_0|> <|body_start_1|> from .entity import Entity from .json import Json from .workbook_filter import WorkbookFilter from .entity import En...
WorkbookTableColumn
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WorkbookTableColumn: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookTableColumn: """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 ob...
stack_v2_sparse_classes_75kplus_train_066901
3,081
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: WorkbookTableColumn", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator...
3
stack_v2_sparse_classes_30k_train_004455
Implement the Python class `WorkbookTableColumn` described below. Class description: Implement the WorkbookTableColumn class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookTableColumn: Creates a new instance of the appropriate class based on d...
Implement the Python class `WorkbookTableColumn` described below. Class description: Implement the WorkbookTableColumn class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookTableColumn: Creates a new instance of the appropriate class based on d...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class WorkbookTableColumn: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookTableColumn: """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 ob...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WorkbookTableColumn: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookTableColumn: """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: ...
the_stack_v2_python_sparse
msgraph/generated/models/workbook_table_column.py
microsoftgraph/msgraph-sdk-python
train
135
e9433dda7638aade544bd5e12915d806c35cff27
[ "error_messages = {'incomplete': _('Must fill all coordinates')}\ndimensions = kwargs.get('dimensions', self.DIMENSIONS)\nfields = [forms.FloatField() for i in range(dimensions)]\nfor field in fields:\n field.error_messages = {}\nkwargs['widget'] = VectorWidget(attrs={'dimensions': dimensions})\nif 'max_length' ...
<|body_start_0|> error_messages = {'incomplete': _('Must fill all coordinates')} dimensions = kwargs.get('dimensions', self.DIMENSIONS) fields = [forms.FloatField() for i in range(dimensions)] for field in fields: field.error_messages = {} kwargs['widget'] = VectorWid...
N dimensional vector field
VectorFormField
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VectorFormField: """N dimensional vector field""" def __init__(self, *args, **kwargs): """Class initialization method""" <|body_0|> def compress(self, data_list): """Data compression method""" <|body_1|> <|end_skeleton|> <|body_start_0|> error_m...
stack_v2_sparse_classes_75kplus_train_066902
6,288
permissive
[ { "docstring": "Class initialization method", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Data compression method", "name": "compress", "signature": "def compress(self, data_list)" } ]
2
stack_v2_sparse_classes_30k_train_032112
Implement the Python class `VectorFormField` described below. Class description: N dimensional vector field Method signatures and docstrings: - def __init__(self, *args, **kwargs): Class initialization method - def compress(self, data_list): Data compression method
Implement the Python class `VectorFormField` described below. Class description: N dimensional vector field Method signatures and docstrings: - def __init__(self, *args, **kwargs): Class initialization method - def compress(self, data_list): Data compression method <|skeleton|> class VectorFormField: """N dimens...
be9d747b8ca4c5d18f9725b2dad08dba6119d810
<|skeleton|> class VectorFormField: """N dimensional vector field""" def __init__(self, *args, **kwargs): """Class initialization method""" <|body_0|> def compress(self, data_list): """Data compression method""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VectorFormField: """N dimensional vector field""" def __init__(self, *args, **kwargs): """Class initialization method""" error_messages = {'incomplete': _('Must fill all coordinates')} dimensions = kwargs.get('dimensions', self.DIMENSIONS) fields = [forms.FloatField() for ...
the_stack_v2_python_sparse
sitetools/forms/fields.py
olivergs/django-sitetools
train
0
d69c48471a57ac1f5cb05db09889aecda6a5ff9b
[ "self.input = fileInput\nself.output = fileOutput\nself.language = language\nself.minSilenceLen = 500\nself.silenceThresh = 14\nself.keepSilence = 500\nself.__check_files_valid()\nself.rec = sr.Recognizer()", "self.__check_files_valid()\nsound = AudioSegment.from_file(self.input, format=pathlib.Path(self.input).s...
<|body_start_0|> self.input = fileInput self.output = fileOutput self.language = language self.minSilenceLen = 500 self.silenceThresh = 14 self.keepSilence = 500 self.__check_files_valid() self.rec = sr.Recognizer() <|end_body_0|> <|body_start_1|> ...
Converts an audio file to text.
AudioToText
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AudioToText: """Converts an audio file to text.""" def __init__(self, fileInput, fileOutput, language): """Initialize.""" <|body_0|> def get_text(self): """Returns the text recognized from the input file.""" <|body_1|> def write_to_text_file(self, te...
stack_v2_sparse_classes_75kplus_train_066903
4,397
permissive
[ { "docstring": "Initialize.", "name": "__init__", "signature": "def __init__(self, fileInput, fileOutput, language)" }, { "docstring": "Returns the text recognized from the input file.", "name": "get_text", "signature": "def get_text(self)" }, { "docstring": "Write a text to a fi...
4
stack_v2_sparse_classes_30k_train_052952
Implement the Python class `AudioToText` described below. Class description: Converts an audio file to text. Method signatures and docstrings: - def __init__(self, fileInput, fileOutput, language): Initialize. - def get_text(self): Returns the text recognized from the input file. - def write_to_text_file(self, text):...
Implement the Python class `AudioToText` described below. Class description: Converts an audio file to text. Method signatures and docstrings: - def __init__(self, fileInput, fileOutput, language): Initialize. - def get_text(self): Returns the text recognized from the input file. - def write_to_text_file(self, text):...
2cb4b45dd14a230aa0e800042e893f8dfb23beda
<|skeleton|> class AudioToText: """Converts an audio file to text.""" def __init__(self, fileInput, fileOutput, language): """Initialize.""" <|body_0|> def get_text(self): """Returns the text recognized from the input file.""" <|body_1|> def write_to_text_file(self, te...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AudioToText: """Converts an audio file to text.""" def __init__(self, fileInput, fileOutput, language): """Initialize.""" self.input = fileInput self.output = fileOutput self.language = language self.minSilenceLen = 500 self.silenceThresh = 14 self....
the_stack_v2_python_sparse
_RESOURCES/my-gists/__CONTAINER/825aa98d8f/825aa98d8fddbff215dadd41125cc487f503d563f1179583c1502bfebdb87cf8/audio-2-text.py
bgoonz/UsefulResourceRepo2.0
train
10
8ca51a317e94f584c2e4d2816f032db93a3332ba
[ "self.last_data_time: Optional[int] = None\nself.last_data_used_time_list: list = list()\nself.last_data_used_time_size = last_data_used_time_size", "data_progress_display_str = self.draw_data_progress(current_value, total_value, data_progress_display_len)\ntime_progress_display_str = self.draw_time_progress(curr...
<|body_start_0|> self.last_data_time: Optional[int] = None self.last_data_used_time_list: list = list() self.last_data_used_time_size = last_data_used_time_size <|end_body_0|> <|body_start_1|> data_progress_display_str = self.draw_data_progress(current_value, total_value, data_progress_...
数据进度
DataProgress
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataProgress: """数据进度""" def __init__(self, last_data_used_time_size=50): """初始化""" <|body_0|> def print_data_progress(self, current_value: int, total_value: int, data_progress_display_len=50): """打印进度条 :param current_value: :param total_value: :param data_progre...
stack_v2_sparse_classes_75kplus_train_066904
6,281
no_license
[ { "docstring": "初始化", "name": "__init__", "signature": "def __init__(self, last_data_used_time_size=50)" }, { "docstring": "打印进度条 :param current_value: :param total_value: :param data_progress_display_len: :return:", "name": "print_data_progress", "signature": "def print_data_progress(se...
4
stack_v2_sparse_classes_30k_train_019473
Implement the Python class `DataProgress` described below. Class description: 数据进度 Method signatures and docstrings: - def __init__(self, last_data_used_time_size=50): 初始化 - def print_data_progress(self, current_value: int, total_value: int, data_progress_display_len=50): 打印进度条 :param current_value: :param total_valu...
Implement the Python class `DataProgress` described below. Class description: 数据进度 Method signatures and docstrings: - def __init__(self, last_data_used_time_size=50): 初始化 - def print_data_progress(self, current_value: int, total_value: int, data_progress_display_len=50): 打印进度条 :param current_value: :param total_valu...
c447c94c367c029fc13af458c668eb1f87a7b67c
<|skeleton|> class DataProgress: """数据进度""" def __init__(self, last_data_used_time_size=50): """初始化""" <|body_0|> def print_data_progress(self, current_value: int, total_value: int, data_progress_display_len=50): """打印进度条 :param current_value: :param total_value: :param data_progre...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DataProgress: """数据进度""" def __init__(self, last_data_used_time_size=50): """初始化""" self.last_data_time: Optional[int] = None self.last_data_used_time_list: list = list() self.last_data_used_time_size = last_data_used_time_size def print_data_progress(self, current_va...
the_stack_v2_python_sparse
base_spider.py
xiphodon/spider_hs_code
train
4
2e1ca49fb763d986e1920e6b7dbce5a606c8bf1d
[ "contacts = CompanyContact.get_contacts(gets_email=True)\nemail_tuple = (self.email_contact(contact) for contact in contacts)\nsend_mass_mail(email_tuple)", "if mig_alum:\n replace_text = self.mig_alum_text\nelif other_alum:\n replace_text = self.other_tbp_alum_text\nelif previous_contact:\n replace_text...
<|body_start_0|> contacts = CompanyContact.get_contacts(gets_email=True) email_tuple = (self.email_contact(contact) for contact in contacts) send_mass_mail(email_tuple) <|end_body_0|> <|body_start_1|> if mig_alum: replace_text = self.mig_alum_text elif other_alum: ...
Represents an email to be sent to the corporate contacts list. Provides an interface for creating and sending such emails.
CorporateEmail
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CorporateEmail: """Represents an email to be sent to the corporate contacts list. Provides an interface for creating and sending such emails.""" def send_corporate_email(self): """Sends the email to all company contacts who should receive it.""" <|body_0|> def preview_em...
stack_v2_sparse_classes_75kplus_train_066905
18,793
permissive
[ { "docstring": "Sends the email to all company contacts who should receive it.", "name": "send_corporate_email", "signature": "def send_corporate_email(self)" }, { "docstring": "Returns an example email based on the flags provided. Used to spot check emails before sending.", "name": "preview...
3
stack_v2_sparse_classes_30k_val_002097
Implement the Python class `CorporateEmail` described below. Class description: Represents an email to be sent to the corporate contacts list. Provides an interface for creating and sending such emails. Method signatures and docstrings: - def send_corporate_email(self): Sends the email to all company contacts who sho...
Implement the Python class `CorporateEmail` described below. Class description: Represents an email to be sent to the corporate contacts list. Provides an interface for creating and sending such emails. Method signatures and docstrings: - def send_corporate_email(self): Sends the email to all company contacts who sho...
527f9dd39a6b50caa24ea5d0d97b19a0c9b675d1
<|skeleton|> class CorporateEmail: """Represents an email to be sent to the corporate contacts list. Provides an interface for creating and sending such emails.""" def send_corporate_email(self): """Sends the email to all company contacts who should receive it.""" <|body_0|> def preview_em...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CorporateEmail: """Represents an email to be sent to the corporate contacts list. Provides an interface for creating and sending such emails.""" def send_corporate_email(self): """Sends the email to all company contacts who should receive it.""" contacts = CompanyContact.get_contacts(gets...
the_stack_v2_python_sparse
corporate/models.py
tbpmig/mig-website
train
7
b73f67c30a8632085dba56aff0e0ada7b3ee1a40
[ "super(PromoTextRemover, self).__init__()\nself._language = language\nif flask.current_app:\n self._config = config_parser.get_config_contents(_PROMO_TEXT_REMOVAL_OPTIMIZER_CONFIG_OVERRIDE_KEY, _PROMO_TEXT_REMOVAL_OPTIMIZER_CONFIG_FILE_NAME.format(language))\nelse:\n self._config = PROMO_TEXT_REMOVER_CONFIG\n...
<|body_start_0|> super(PromoTextRemover, self).__init__() self._language = language if flask.current_app: self._config = config_parser.get_config_contents(_PROMO_TEXT_REMOVAL_OPTIMIZER_CONFIG_OVERRIDE_KEY, _PROMO_TEXT_REMOVAL_OPTIMIZER_CONFIG_FILE_NAME.format(language)) else:...
A class that removes text from a field of a product.
PromoTextRemover
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PromoTextRemover: """A class that removes text from a field of a product.""" def __init__(self, language: str) -> None: """Initializes PromoTextRemover. Args: language: The configured language code.""" <|body_0|> def remove_text_from_field(self, product: Dict[str, Any], ...
stack_v2_sparse_classes_75kplus_train_066906
5,102
permissive
[ { "docstring": "Initializes PromoTextRemover. Args: language: The configured language code.", "name": "__init__", "signature": "def __init__(self, language: str) -> None" }, { "docstring": "Removes text and regex patterns in the config file from a product field. Args: product: A product data. fi...
5
stack_v2_sparse_classes_30k_train_044366
Implement the Python class `PromoTextRemover` described below. Class description: A class that removes text from a field of a product. Method signatures and docstrings: - def __init__(self, language: str) -> None: Initializes PromoTextRemover. Args: language: The configured language code. - def remove_text_from_field...
Implement the Python class `PromoTextRemover` described below. Class description: A class that removes text from a field of a product. Method signatures and docstrings: - def __init__(self, language: str) -> None: Initializes PromoTextRemover. Args: language: The configured language code. - def remove_text_from_field...
58588ce54f8ea065fdc7501398b1b2e10f8adc41
<|skeleton|> class PromoTextRemover: """A class that removes text from a field of a product.""" def __init__(self, language: str) -> None: """Initializes PromoTextRemover. Args: language: The configured language code.""" <|body_0|> def remove_text_from_field(self, product: Dict[str, Any], ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PromoTextRemover: """A class that removes text from a field of a product.""" def __init__(self, language: str) -> None: """Initializes PromoTextRemover. Args: language: The configured language code.""" super(PromoTextRemover, self).__init__() self._language = language if f...
the_stack_v2_python_sparse
shoptimizer_api/util/promo_text_remover.py
google/shoptimizer
train
43
022fb2f9a7f0f5aa9375428969e7cfdd0f387277
[ "node = head\nwhile n and node:\n node = node.next\n n -= 1\nif n:\n return head\npp = None\np = head\nwhile node:\n node = node.next\n pp = p\n p = p.next\nif not pp:\n return p.next\npp.next = p.next\nreturn head", "def length(node: ListNode):\n l = 0\n while node:\n l += 1\n ...
<|body_start_0|> node = head while n and node: node = node.next n -= 1 if n: return head pp = None p = head while node: node = node.next pp = p p = p.next if not pp: return p.next ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode: """One pass using two pointers Time complexity: O(n) Space complexity: O(1)""" <|body_0|> def removeNthFromEnd(self, head: Optional[ListNode], n: int) -> Optional[ListNode]: """10/16/2022 16:33...
stack_v2_sparse_classes_75kplus_train_066907
2,249
no_license
[ { "docstring": "One pass using two pointers Time complexity: O(n) Space complexity: O(1)", "name": "removeNthFromEnd", "signature": "def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode" }, { "docstring": "10/16/2022 16:33", "name": "removeNthFromEnd", "signature": "def removeN...
2
stack_v2_sparse_classes_30k_train_015380
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode: One pass using two pointers Time complexity: O(n) Space complexity: O(1) - def removeNthFromEnd(self, head: Option...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode: One pass using two pointers Time complexity: O(n) Space complexity: O(1) - def removeNthFromEnd(self, head: Option...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode: """One pass using two pointers Time complexity: O(n) Space complexity: O(1)""" <|body_0|> def removeNthFromEnd(self, head: Optional[ListNode], n: int) -> Optional[ListNode]: """10/16/2022 16:33...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode: """One pass using two pointers Time complexity: O(n) Space complexity: O(1)""" node = head while n and node: node = node.next n -= 1 if n: return head pp = None...
the_stack_v2_python_sparse
leetcode/solved/19_Remove_nth_Node_From_End_of_List/solution.py
sungminoh/algorithms
train
0
ffc0db7ee5b498a806685836c5fc25c4ab534c6d
[ "host = aggregate.hosts[0]\nnuma_count = 2\ncpus = get_cpu_distribition_per_numa_node(env)\nflavors[0].set_keys({'hw:numa_nodes': numa_count, 'hw:numa_cpus.0': self.cpu_numa0, 'hw:numa_cpus.1': self.cpu_numa1, 'hw:numa_mem.0': self.mem_numa0, 'hw:numa_mem.1': self.mem_numa1})\nexp_mem = {'0': self.mem_numa0, '1': s...
<|body_start_0|> host = aggregate.hosts[0] numa_count = 2 cpus = get_cpu_distribition_per_numa_node(env) flavors[0].set_keys({'hw:numa_nodes': numa_count, 'hw:numa_cpus.0': self.cpu_numa0, 'hw:numa_cpus.1': self.cpu_numa1, 'hw:numa_mem.0': self.mem_numa0, 'hw:numa_mem.1': self.mem_numa1}...
TestResourceDistribution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestResourceDistribution: def test_cpu_and_memory_distribution(self, env, os_conn, networks, flavors, security_group, aggregate, keypair): """This test checks distribution of cpu for vm with cpu pinning Steps: 1. Create flavor with custom numa_cpu and numa_mem distribution 2. Create net1...
stack_v2_sparse_classes_75kplus_train_066908
38,361
no_license
[ { "docstring": "This test checks distribution of cpu for vm with cpu pinning Steps: 1. Create flavor with custom numa_cpu and numa_mem distribution 2. Create net1 with subnet, net2 with subnet and router1 with interfaces to both nets 3. Launch vm using created flavor 4. Check memory allocation per numa node 5. ...
2
stack_v2_sparse_classes_30k_train_006877
Implement the Python class `TestResourceDistribution` described below. Class description: Implement the TestResourceDistribution class. Method signatures and docstrings: - def test_cpu_and_memory_distribution(self, env, os_conn, networks, flavors, security_group, aggregate, keypair): This test checks distribution of ...
Implement the Python class `TestResourceDistribution` described below. Class description: Implement the TestResourceDistribution class. Method signatures and docstrings: - def test_cpu_and_memory_distribution(self, env, os_conn, networks, flavors, security_group, aggregate, keypair): This test checks distribution of ...
8aced2855b78b5f123195d188c80e27b43888a2e
<|skeleton|> class TestResourceDistribution: def test_cpu_and_memory_distribution(self, env, os_conn, networks, flavors, security_group, aggregate, keypair): """This test checks distribution of cpu for vm with cpu pinning Steps: 1. Create flavor with custom numa_cpu and numa_mem distribution 2. Create net1...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestResourceDistribution: def test_cpu_and_memory_distribution(self, env, os_conn, networks, flavors, security_group, aggregate, keypair): """This test checks distribution of cpu for vm with cpu pinning Steps: 1. Create flavor with custom numa_cpu and numa_mem distribution 2. Create net1 with subnet, ...
the_stack_v2_python_sparse
mos_tests/nfv/test_cpu_pinning.py
Mirantis/mos-integration-tests
train
16
e3d85df34b0a5fedd9f2565fd3055c3174b890d0
[ "try:\n self.sqlhandler = None\n if self.getTeaList():\n self.write(self.teaList)\n self.finish()\n else:\n raise RuntimeError\nexcept Exception:\n self.write('error')\n self.finish()\nfinally:\n if self.sqlhandler is not None:\n self.sqlhandler.closeMySql()\n tornad...
<|body_start_0|> try: self.sqlhandler = None if self.getTeaList(): self.write(self.teaList) self.finish() else: raise RuntimeError except Exception: self.write('error') self.finish() final...
AdmGetTeaListRequestHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdmGetTeaListRequestHandler: def get(self): """从数据库获取老师列表返回给管理员""" <|body_0|> def getTeaList(self): """从数据库读取老师列表""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: self.sqlhandler = None if self.getTeaList(): ...
stack_v2_sparse_classes_75kplus_train_066909
1,561
no_license
[ { "docstring": "从数据库获取老师列表返回给管理员", "name": "get", "signature": "def get(self)" }, { "docstring": "从数据库读取老师列表", "name": "getTeaList", "signature": "def getTeaList(self)" } ]
2
stack_v2_sparse_classes_30k_train_023544
Implement the Python class `AdmGetTeaListRequestHandler` described below. Class description: Implement the AdmGetTeaListRequestHandler class. Method signatures and docstrings: - def get(self): 从数据库获取老师列表返回给管理员 - def getTeaList(self): 从数据库读取老师列表
Implement the Python class `AdmGetTeaListRequestHandler` described below. Class description: Implement the AdmGetTeaListRequestHandler class. Method signatures and docstrings: - def get(self): 从数据库获取老师列表返回给管理员 - def getTeaList(self): 从数据库读取老师列表 <|skeleton|> class AdmGetTeaListRequestHandler: def get(self): ...
b28eb4163b02bd0a931653b94851592f2654b199
<|skeleton|> class AdmGetTeaListRequestHandler: def get(self): """从数据库获取老师列表返回给管理员""" <|body_0|> def getTeaList(self): """从数据库读取老师列表""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AdmGetTeaListRequestHandler: def get(self): """从数据库获取老师列表返回给管理员""" try: self.sqlhandler = None if self.getTeaList(): self.write(self.teaList) self.finish() else: raise RuntimeError except Exception: ...
the_stack_v2_python_sparse
app/src/main/pythonWork/AdmGetTeaListRequestHandler.py
lyh-ADT/edu-app
train
1
0eb46111eb08edbfa80309766168c1a44dc046b7
[ "n = len(nums)\noutput = []\nfor i in range(2 ** n):\n bitmask = bin(i | 1 << n)[3:]\n output.append([nums[j] for j in range(n) if bitmask[j] == '1'])\nreturn output", "n = len(nums)\noutput = []\nfor i in range(2 ** n, 2 ** (n + 1)):\n bitmask = bin(i)[3:]\n output.append([nums[j] for j in range(n) i...
<|body_start_0|> n = len(nums) output = [] for i in range(2 ** n): bitmask = bin(i | 1 << n)[3:] output.append([nums[j] for j in range(n) if bitmask[j] == '1']) return output <|end_body_0|> <|body_start_1|> n = len(nums) output = [] for i ...
Subsets
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Subsets: def generated(self, nums: List[int]) -> List[List[int]]: """Approach: Lexographic Binary Sorted Time Complexity: O(N * 2^N) Space Complexity: O(N * 2^N) :param nums: :return:""" <|body_0|> def generate(self, nums: List[int]) -> List[List[int]]: """Approach: ...
stack_v2_sparse_classes_75kplus_train_066910
2,118
no_license
[ { "docstring": "Approach: Lexographic Binary Sorted Time Complexity: O(N * 2^N) Space Complexity: O(N * 2^N) :param nums: :return:", "name": "generated", "signature": "def generated(self, nums: List[int]) -> List[List[int]]" }, { "docstring": "Approach: Lexographic Binary Sorted Time Complexity:...
4
null
Implement the Python class `Subsets` described below. Class description: Implement the Subsets class. Method signatures and docstrings: - def generated(self, nums: List[int]) -> List[List[int]]: Approach: Lexographic Binary Sorted Time Complexity: O(N * 2^N) Space Complexity: O(N * 2^N) :param nums: :return: - def ge...
Implement the Python class `Subsets` described below. Class description: Implement the Subsets class. Method signatures and docstrings: - def generated(self, nums: List[int]) -> List[List[int]]: Approach: Lexographic Binary Sorted Time Complexity: O(N * 2^N) Space Complexity: O(N * 2^N) :param nums: :return: - def ge...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class Subsets: def generated(self, nums: List[int]) -> List[List[int]]: """Approach: Lexographic Binary Sorted Time Complexity: O(N * 2^N) Space Complexity: O(N * 2^N) :param nums: :return:""" <|body_0|> def generate(self, nums: List[int]) -> List[List[int]]: """Approach: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Subsets: def generated(self, nums: List[int]) -> List[List[int]]: """Approach: Lexographic Binary Sorted Time Complexity: O(N * 2^N) Space Complexity: O(N * 2^N) :param nums: :return:""" n = len(nums) output = [] for i in range(2 ** n): bitmask = bin(i | 1 << n)[3:]...
the_stack_v2_python_sparse
revisited/permutations_combinations_subsets/subsets.py
Shiv2157k/leet_code
train
1
023776c9402f0f5915c2378c604e27879993da21
[ "self.description = description\nself.domain = domain\nself.name = name\nself.nfs_access = nfs_access\nself.nfs_squash = nfs_squash", "if dictionary is None:\n return None\ndescription = dictionary.get('description')\ndomain = dictionary.get('domain')\nname = dictionary.get('name')\nnfs_access = dictionary.get...
<|body_start_0|> self.description = description self.domain = domain self.name = name self.nfs_access = nfs_access self.nfs_squash = nfs_squash <|end_body_0|> <|body_start_1|> if dictionary is None: return None description = dictionary.get('descriptio...
Implementation of the 'NisNetgroup' model. Defines an NIS Netgroup. Attributes: description (string): Description of the netgroup. domain (string): Specifies the domain of the netgroup. name (string): Specifies the name of the netgroup. nfs_access (NfsAccessEnum): Specifies whether clients from this netgroup can mount ...
NisNetgroup
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NisNetgroup: """Implementation of the 'NisNetgroup' model. Defines an NIS Netgroup. Attributes: description (string): Description of the netgroup. domain (string): Specifies the domain of the netgroup. name (string): Specifies the name of the netgroup. nfs_access (NfsAccessEnum): Specifies whethe...
stack_v2_sparse_classes_75kplus_train_066911
2,471
permissive
[ { "docstring": "Constructor for the NisNetgroup class", "name": "__init__", "signature": "def __init__(self, description=None, domain=None, name=None, nfs_access=None, nfs_squash=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictio...
2
stack_v2_sparse_classes_30k_train_046607
Implement the Python class `NisNetgroup` described below. Class description: Implementation of the 'NisNetgroup' model. Defines an NIS Netgroup. Attributes: description (string): Description of the netgroup. domain (string): Specifies the domain of the netgroup. name (string): Specifies the name of the netgroup. nfs_a...
Implement the Python class `NisNetgroup` described below. Class description: Implementation of the 'NisNetgroup' model. Defines an NIS Netgroup. Attributes: description (string): Description of the netgroup. domain (string): Specifies the domain of the netgroup. name (string): Specifies the name of the netgroup. nfs_a...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class NisNetgroup: """Implementation of the 'NisNetgroup' model. Defines an NIS Netgroup. Attributes: description (string): Description of the netgroup. domain (string): Specifies the domain of the netgroup. name (string): Specifies the name of the netgroup. nfs_access (NfsAccessEnum): Specifies whethe...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NisNetgroup: """Implementation of the 'NisNetgroup' model. Defines an NIS Netgroup. Attributes: description (string): Description of the netgroup. domain (string): Specifies the domain of the netgroup. name (string): Specifies the name of the netgroup. nfs_access (NfsAccessEnum): Specifies whether clients fro...
the_stack_v2_python_sparse
cohesity_management_sdk/models/nis_netgroup.py
cohesity/management-sdk-python
train
24
c1be3b6f21ccbf8fdf053412d3a910fc58fd8956
[ "if create and extracted:\n for moira_list in extracted:\n self.admin_lists.add(moira_list)", "if create and extracted:\n for moira_list in extracted:\n self.view_lists.add(moira_list)" ]
<|body_start_0|> if create and extracted: for moira_list in extracted: self.admin_lists.add(moira_list) <|end_body_0|> <|body_start_1|> if create and extracted: for moira_list in extracted: self.view_lists.add(moira_list) <|end_body_1|>
Factory for a Collection
CollectionFactory
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CollectionFactory: """Factory for a Collection""" def admin_lists(self, create, extracted, **kwargs): """Post-generation hook to handle admin_lists (if provided)""" <|body_0|> def view_lists(self, create, extracted, **kwargs): """Post-generation hook to handle ad...
stack_v2_sparse_classes_75kplus_train_066912
5,608
permissive
[ { "docstring": "Post-generation hook to handle admin_lists (if provided)", "name": "admin_lists", "signature": "def admin_lists(self, create, extracted, **kwargs)" }, { "docstring": "Post-generation hook to handle admin_lists (if provided)", "name": "view_lists", "signature": "def view_l...
2
stack_v2_sparse_classes_30k_train_012589
Implement the Python class `CollectionFactory` described below. Class description: Factory for a Collection Method signatures and docstrings: - def admin_lists(self, create, extracted, **kwargs): Post-generation hook to handle admin_lists (if provided) - def view_lists(self, create, extracted, **kwargs): Post-generat...
Implement the Python class `CollectionFactory` described below. Class description: Factory for a Collection Method signatures and docstrings: - def admin_lists(self, create, extracted, **kwargs): Post-generation hook to handle admin_lists (if provided) - def view_lists(self, create, extracted, **kwargs): Post-generat...
7d731ce94b1fa4baba1c1b3752e2d03949a88ea0
<|skeleton|> class CollectionFactory: """Factory for a Collection""" def admin_lists(self, create, extracted, **kwargs): """Post-generation hook to handle admin_lists (if provided)""" <|body_0|> def view_lists(self, create, extracted, **kwargs): """Post-generation hook to handle ad...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CollectionFactory: """Factory for a Collection""" def admin_lists(self, create, extracted, **kwargs): """Post-generation hook to handle admin_lists (if provided)""" if create and extracted: for moira_list in extracted: self.admin_lists.add(moira_list) def ...
the_stack_v2_python_sparse
ui/factories.py
mitodl/odl-video-service
train
4
192104c1630bf16a017743a7269bf8f5888ac02d
[ "if instance.channel:\n return instance.channel.name\nelse:\n return None", "if instance.channel:\n return instance.channel.title\nelse:\n return None" ]
<|body_start_0|> if instance.channel: return instance.channel.name else: return None <|end_body_0|> <|body_start_1|> if instance.channel: return instance.channel.title else: return None <|end_body_1|>
Serializer for NotificationSettings
NotificationSettingsSerializer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NotificationSettingsSerializer: """Serializer for NotificationSettings""" def get_channel_name(self, instance): """get the channel name""" <|body_0|> def get_channel_title(self, instance): """get the channel title""" <|body_1|> <|end_skeleton|> <|body_s...
stack_v2_sparse_classes_75kplus_train_066913
1,015
permissive
[ { "docstring": "get the channel name", "name": "get_channel_name", "signature": "def get_channel_name(self, instance)" }, { "docstring": "get the channel title", "name": "get_channel_title", "signature": "def get_channel_title(self, instance)" } ]
2
stack_v2_sparse_classes_30k_train_007383
Implement the Python class `NotificationSettingsSerializer` described below. Class description: Serializer for NotificationSettings Method signatures and docstrings: - def get_channel_name(self, instance): get the channel name - def get_channel_title(self, instance): get the channel title
Implement the Python class `NotificationSettingsSerializer` described below. Class description: Serializer for NotificationSettings Method signatures and docstrings: - def get_channel_name(self, instance): get the channel name - def get_channel_title(self, instance): get the channel title <|skeleton|> class Notifica...
ba7442482da97d463302658c0aac989567ee1241
<|skeleton|> class NotificationSettingsSerializer: """Serializer for NotificationSettings""" def get_channel_name(self, instance): """get the channel name""" <|body_0|> def get_channel_title(self, instance): """get the channel title""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NotificationSettingsSerializer: """Serializer for NotificationSettings""" def get_channel_name(self, instance): """get the channel name""" if instance.channel: return instance.channel.name else: return None def get_channel_title(self, instance): ...
the_stack_v2_python_sparse
notifications/serializers.py
mitodl/open-discussions
train
13
3469d8599593f2db97cadec09075909c80df7baf
[ "QLabel.__init__(self, parent)\nself.start_animation(self.SLOW_DURATION)\nfont = QFont('Arial', 20)\nself.setFont(font)\nself.setText('Click to start')\nself.setFixedHeight(100)\nself.setAlignment(Qt.AlignCenter)\nself.setStyleSheet('color: ' + color)", "self.effect = QGraphicsOpacityEffect()\nself.setGraphicsEff...
<|body_start_0|> QLabel.__init__(self, parent) self.start_animation(self.SLOW_DURATION) font = QFont('Arial', 20) self.setFont(font) self.setText('Click to start') self.setFixedHeight(100) self.setAlignment(Qt.AlignCenter) self.setStyleSheet('color: ' + co...
This class extends the functionality of the default QLabel to add a fadein-fadeout animation
AnimatedLabel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AnimatedLabel: """This class extends the functionality of the default QLabel to add a fadein-fadeout animation""" def __init__(self, parent=None, color='yellow'): """Constructor of the class Keyword Arguments: parent {ui.gui.views.title.TitleWindow} -- Parent of this widget (default:...
stack_v2_sparse_classes_75kplus_train_066914
5,803
no_license
[ { "docstring": "Constructor of the class Keyword Arguments: parent {ui.gui.views.title.TitleWindow} -- Parent of this widget (default: {None}) color {str} -- Color of the start text (default: {'yellow'})", "name": "__init__", "signature": "def __init__(self, parent=None, color='yellow')" }, { "d...
2
stack_v2_sparse_classes_30k_train_022049
Implement the Python class `AnimatedLabel` described below. Class description: This class extends the functionality of the default QLabel to add a fadein-fadeout animation Method signatures and docstrings: - def __init__(self, parent=None, color='yellow'): Constructor of the class Keyword Arguments: parent {ui.gui.vi...
Implement the Python class `AnimatedLabel` described below. Class description: This class extends the functionality of the default QLabel to add a fadein-fadeout animation Method signatures and docstrings: - def __init__(self, parent=None, color='yellow'): Constructor of the class Keyword Arguments: parent {ui.gui.vi...
a6e40f9778284426a15c05ef362dde243e687888
<|skeleton|> class AnimatedLabel: """This class extends the functionality of the default QLabel to add a fadein-fadeout animation""" def __init__(self, parent=None, color='yellow'): """Constructor of the class Keyword Arguments: parent {ui.gui.views.title.TitleWindow} -- Parent of this widget (default:...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AnimatedLabel: """This class extends the functionality of the default QLabel to add a fadein-fadeout animation""" def __init__(self, parent=None, color='yellow'): """Constructor of the class Keyword Arguments: parent {ui.gui.views.title.TitleWindow} -- Parent of this widget (default: {None}) colo...
the_stack_v2_python_sparse
behavior_studio/ui/gui/views/title.py
dcharrezt/BehaviorStudio
train
0
a9031d35c957a3509f566a19af661eee70e8d6e1
[ "person = model.Person.get(self.repo, self.params.id)\nif not person:\n return self.error(400, 'No person with ID: %r' % self.params.id)\nself.render('enable_notes.html', person=person, view_url=self.get_url('/view', id=self.params.id), captcha_html=self.get_captcha_html())", "person = model.Person.get(self.re...
<|body_start_0|> person = model.Person.get(self.repo, self.params.id) if not person: return self.error(400, 'No person with ID: %r' % self.params.id) self.render('enable_notes.html', person=person, view_url=self.get_url('/view', id=self.params.id), captcha_html=self.get_captcha_html(...
Handles an author request to disable comments to a person record.
Handler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Handler: """Handles an author request to disable comments to a person record.""" def get(self): """Prompts the user with a CAPTCHA before proceeding the request.""" <|body_0|> def post(self): """If the user passed the CAPTCHA, send the confirmation email.""" ...
stack_v2_sparse_classes_75kplus_train_066915
3,055
permissive
[ { "docstring": "Prompts the user with a CAPTCHA before proceeding the request.", "name": "get", "signature": "def get(self)" }, { "docstring": "If the user passed the CAPTCHA, send the confirmation email.", "name": "post", "signature": "def post(self)" } ]
2
null
Implement the Python class `Handler` described below. Class description: Handles an author request to disable comments to a person record. Method signatures and docstrings: - def get(self): Prompts the user with a CAPTCHA before proceeding the request. - def post(self): If the user passed the CAPTCHA, send the confir...
Implement the Python class `Handler` described below. Class description: Handles an author request to disable comments to a person record. Method signatures and docstrings: - def get(self): Prompts the user with a CAPTCHA before proceeding the request. - def post(self): If the user passed the CAPTCHA, send the confir...
7e40f2783ac89b91efd1d8497f1acc5b006361fa
<|skeleton|> class Handler: """Handles an author request to disable comments to a person record.""" def get(self): """Prompts the user with a CAPTCHA before proceeding the request.""" <|body_0|> def post(self): """If the user passed the CAPTCHA, send the confirmation email.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Handler: """Handles an author request to disable comments to a person record.""" def get(self): """Prompts the user with a CAPTCHA before proceeding the request.""" person = model.Person.get(self.repo, self.params.id) if not person: return self.error(400, 'No person wi...
the_stack_v2_python_sparse
app/enable_notes.py
ZhengC1/personfinder
train
2
c87fe27c1723ac436172bcc6e911e7809e0d8363
[ "super(Encoder, self).__init__(d_model, d_k, d_v, sequence_length, h, batch_size, num_layer=num_layer)\nself.Q = Q\nself.K_s = K_s\nself.mask = mask\nself.initializer = tf.random_normal_initializer(stddev=0.1)\nself.dropout_keep_prob = dropout_keep_prob\nself.use_residual_conn = use_residual_conn", "start = time....
<|body_start_0|> super(Encoder, self).__init__(d_model, d_k, d_v, sequence_length, h, batch_size, num_layer=num_layer) self.Q = Q self.K_s = K_s self.mask = mask self.initializer = tf.random_normal_initializer(stddev=0.1) self.dropout_keep_prob = dropout_keep_prob ...
Encoder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Encoder: def __init__(self, d_model, d_k, d_v, sequence_length, h, batch_size, num_layer, Q, K_s, mask=None, dropout_keep_prob=0.9, use_residual_conn=True): """:param d_model: :param d_k: :param d_v: :param sequence_length: :param h: :param batch_size: :param embedded_words: shape:[batch...
stack_v2_sparse_classes_75kplus_train_066916
6,839
permissive
[ { "docstring": ":param d_model: :param d_k: :param d_v: :param sequence_length: :param h: :param batch_size: :param embedded_words: shape:[batch_size*sequence_length,embed_size]", "name": "__init__", "signature": "def __init__(self, d_model, d_k, d_v, sequence_length, h, batch_size, num_layer, Q, K_s, m...
3
stack_v2_sparse_classes_30k_train_049355
Implement the Python class `Encoder` described below. Class description: Implement the Encoder class. Method signatures and docstrings: - def __init__(self, d_model, d_k, d_v, sequence_length, h, batch_size, num_layer, Q, K_s, mask=None, dropout_keep_prob=0.9, use_residual_conn=True): :param d_model: :param d_k: :par...
Implement the Python class `Encoder` described below. Class description: Implement the Encoder class. Method signatures and docstrings: - def __init__(self, d_model, d_k, d_v, sequence_length, h, batch_size, num_layer, Q, K_s, mask=None, dropout_keep_prob=0.9, use_residual_conn=True): :param d_model: :param d_k: :par...
480c909e0835a455606e829310ff949c9dd23549
<|skeleton|> class Encoder: def __init__(self, d_model, d_k, d_v, sequence_length, h, batch_size, num_layer, Q, K_s, mask=None, dropout_keep_prob=0.9, use_residual_conn=True): """:param d_model: :param d_k: :param d_v: :param sequence_length: :param h: :param batch_size: :param embedded_words: shape:[batch...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Encoder: def __init__(self, d_model, d_k, d_v, sequence_length, h, batch_size, num_layer, Q, K_s, mask=None, dropout_keep_prob=0.9, use_residual_conn=True): """:param d_model: :param d_k: :param d_v: :param sequence_length: :param h: :param batch_size: :param embedded_words: shape:[batch_size*sequence...
the_stack_v2_python_sparse
bert_language_understanding-master/bert_language_understanding-master/model/encoder.py
yyht/BERT
train
37
308f5573477079878a37f4bf2f3b33606b41d745
[ "self.output_image = output_image\nself.output = output\nself.width = 550\nself.height = 600\nself.image_format = '.png'\nif not path.exists(self.output):\n mkdir(self.output)", "if self.output_image:\n fig.write_image('images//' + name + self.image_format, scale=3)\nelse:\n fig.write_html(name + '.html'...
<|body_start_0|> self.output_image = output_image self.output = output self.width = 550 self.height = 600 self.image_format = '.png' if not path.exists(self.output): mkdir(self.output) <|end_body_0|> <|body_start_1|> if self.output_image: ...
PlotChart
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PlotChart: def __init__(self, output_image=True, output='image'): """:param output_image: {Boolean} Ture: output image; False: output html :param output: {String} output path""" <|body_0|> def create_chart(self, fig, name): """:param fig: (PLotlt) 生成的PLotlt对象 :param ...
stack_v2_sparse_classes_75kplus_train_066917
6,826
no_license
[ { "docstring": ":param output_image: {Boolean} Ture: output image; False: output html :param output: {String} output path", "name": "__init__", "signature": "def __init__(self, output_image=True, output='image')" }, { "docstring": ":param fig: (PLotlt) 生成的PLotlt对象 :param name: 名字 :return:", ...
2
stack_v2_sparse_classes_30k_train_019346
Implement the Python class `PlotChart` described below. Class description: Implement the PlotChart class. Method signatures and docstrings: - def __init__(self, output_image=True, output='image'): :param output_image: {Boolean} Ture: output image; False: output html :param output: {String} output path - def create_ch...
Implement the Python class `PlotChart` described below. Class description: Implement the PlotChart class. Method signatures and docstrings: - def __init__(self, output_image=True, output='image'): :param output_image: {Boolean} Ture: output image; False: output html :param output: {String} output path - def create_ch...
dcbff7abe3300c1a4c668cf6a96370a53be99ac5
<|skeleton|> class PlotChart: def __init__(self, output_image=True, output='image'): """:param output_image: {Boolean} Ture: output image; False: output html :param output: {String} output path""" <|body_0|> def create_chart(self, fig, name): """:param fig: (PLotlt) 生成的PLotlt对象 :param ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PlotChart: def __init__(self, output_image=True, output='image'): """:param output_image: {Boolean} Ture: output image; False: output html :param output: {String} output path""" self.output_image = output_image self.output = output self.width = 550 self.height = 600 ...
the_stack_v2_python_sparse
study_book/general_analysis.py
hygnic/boomboost
train
0
3400dbab0f9a3edb08d4b4528b4c878bc68bf906
[ "out_file = open(file_path, 'w')\njson.dump(data, out_file, indent=4)\nout_file.close()", "try:\n with open(file_path) as f:\n return json.load(f)\nexcept IOError as e:\n print('could not read ' + file_path)" ]
<|body_start_0|> out_file = open(file_path, 'w') json.dump(data, out_file, indent=4) out_file.close() <|end_body_0|> <|body_start_1|> try: with open(file_path) as f: return json.load(f) except IOError as e: print('could not read ' + file_p...
This class handles writing data objects to files and loading in data objects
MyJsonHandler
[ "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyJsonHandler: """This class handles writing data objects to files and loading in data objects""" def save_data_to_json_file(data, file_path): """Store data as json in designated file_path""" <|body_0|> def get_data_from_json_file(file_path): """get data as json ...
stack_v2_sparse_classes_75kplus_train_066918
704
permissive
[ { "docstring": "Store data as json in designated file_path", "name": "save_data_to_json_file", "signature": "def save_data_to_json_file(data, file_path)" }, { "docstring": "get data as json in designated file_path and returns the loaded json", "name": "get_data_from_json_file", "signatur...
2
stack_v2_sparse_classes_30k_train_013362
Implement the Python class `MyJsonHandler` described below. Class description: This class handles writing data objects to files and loading in data objects Method signatures and docstrings: - def save_data_to_json_file(data, file_path): Store data as json in designated file_path - def get_data_from_json_file(file_pat...
Implement the Python class `MyJsonHandler` described below. Class description: This class handles writing data objects to files and loading in data objects Method signatures and docstrings: - def save_data_to_json_file(data, file_path): Store data as json in designated file_path - def get_data_from_json_file(file_pat...
20d8df6172906337f81583dabb841d66b8f31857
<|skeleton|> class MyJsonHandler: """This class handles writing data objects to files and loading in data objects""" def save_data_to_json_file(data, file_path): """Store data as json in designated file_path""" <|body_0|> def get_data_from_json_file(file_path): """get data as json ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MyJsonHandler: """This class handles writing data objects to files and loading in data objects""" def save_data_to_json_file(data, file_path): """Store data as json in designated file_path""" out_file = open(file_path, 'w') json.dump(data, out_file, indent=4) out_file.clos...
the_stack_v2_python_sparse
new_algs/Number+theoretic+algorithms/Euclidean+algorithm/myjsonhandler.py
coolsnake/JupyterNotebook
train
0
9066e186cb56c17fcb07e3ee243f561a8c2b9024
[ "self.first_name = first_name\nself.last_name = last_name\nself.salary = salary", "bonus = 5000\nif new_raise:\n bonus = new_raise\n new_amount = self.salary + bonus\nelse:\n new_amount = self.salary + bonus\nreturn new_amount" ]
<|body_start_0|> self.first_name = first_name self.last_name = last_name self.salary = salary <|end_body_0|> <|body_start_1|> bonus = 5000 if new_raise: bonus = new_raise new_amount = self.salary + bonus else: new_amount = self.salary ...
Will store attributes of an employee Including first name, last name, and annual salary
Employee
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Employee: """Will store attributes of an employee Including first name, last name, and annual salary""" def __init__(self, first_name, last_name, salary): """Stores the attributes of the employee""" <|body_0|> def give_raise(self, new_raise=''): """Increases the ...
stack_v2_sparse_classes_75kplus_train_066919
985
no_license
[ { "docstring": "Stores the attributes of the employee", "name": "__init__", "signature": "def __init__(self, first_name, last_name, salary)" }, { "docstring": "Increases the salary of the employee", "name": "give_raise", "signature": "def give_raise(self, new_raise='')" } ]
2
null
Implement the Python class `Employee` described below. Class description: Will store attributes of an employee Including first name, last name, and annual salary Method signatures and docstrings: - def __init__(self, first_name, last_name, salary): Stores the attributes of the employee - def give_raise(self, new_rais...
Implement the Python class `Employee` described below. Class description: Will store attributes of an employee Including first name, last name, and annual salary Method signatures and docstrings: - def __init__(self, first_name, last_name, salary): Stores the attributes of the employee - def give_raise(self, new_rais...
3d4a2405f37bb53860fa34ae1efc1aa4ef9b5bdc
<|skeleton|> class Employee: """Will store attributes of an employee Including first name, last name, and annual salary""" def __init__(self, first_name, last_name, salary): """Stores the attributes of the employee""" <|body_0|> def give_raise(self, new_raise=''): """Increases the ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Employee: """Will store attributes of an employee Including first name, last name, and annual salary""" def __init__(self, first_name, last_name, salary): """Stores the attributes of the employee""" self.first_name = first_name self.last_name = last_name self.salary = sala...
the_stack_v2_python_sparse
employees.py
Olelewe-PROHUB/Python-Projects
train
0
84f2a9dd32dbe0a1b8b58f1709b1c232477458ad
[ "super(NeighborAggregator, self).__init__()\nassert aggr_method in ['mean', 'sum', 'max']\nself.use_bias = use_bias\nself.aggr_method = aggr_method\nself.weight = nn.Parameter(torch.Tensor(input_dim, output_dim))\nif self.use_bias:\n self.bias = nn.Parameter(torch.Tensor(output_dim))\nself.__init_parameters()\nr...
<|body_start_0|> super(NeighborAggregator, self).__init__() assert aggr_method in ['mean', 'sum', 'max'] self.use_bias = use_bias self.aggr_method = aggr_method self.weight = nn.Parameter(torch.Tensor(input_dim, output_dim)) if self.use_bias: self.bias = nn.Pa...
定义邻居特征聚合方式
NeighborAggregator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NeighborAggregator: """定义邻居特征聚合方式""" def __init__(self, input_dim, output_dim, use_bias=True, aggr_method='mean'): """定义邻居特征聚合方式 Inputs: ------- input_dim: int, 输入特征维度 output_dim: int, 输出特征维度 use_bias: boolean, 是否使用偏置 aggr_method: string, 聚合方式, 可选'mean', 'sum', 'max'""" <|bod...
stack_v2_sparse_classes_75kplus_train_066920
2,112
permissive
[ { "docstring": "定义邻居特征聚合方式 Inputs: ------- input_dim: int, 输入特征维度 output_dim: int, 输出特征维度 use_bias: boolean, 是否使用偏置 aggr_method: string, 聚合方式, 可选'mean', 'sum', 'max'", "name": "__init__", "signature": "def __init__(self, input_dim, output_dim, use_bias=True, aggr_method='mean')" }, { "docstring"...
3
null
Implement the Python class `NeighborAggregator` described below. Class description: 定义邻居特征聚合方式 Method signatures and docstrings: - def __init__(self, input_dim, output_dim, use_bias=True, aggr_method='mean'): 定义邻居特征聚合方式 Inputs: ------- input_dim: int, 输入特征维度 output_dim: int, 输出特征维度 use_bias: boolean, 是否使用偏置 aggr_meth...
Implement the Python class `NeighborAggregator` described below. Class description: 定义邻居特征聚合方式 Method signatures and docstrings: - def __init__(self, input_dim, output_dim, use_bias=True, aggr_method='mean'): 定义邻居特征聚合方式 Inputs: ------- input_dim: int, 输入特征维度 output_dim: int, 输出特征维度 use_bias: boolean, 是否使用偏置 aggr_meth...
ee16c37fd065ba4c732138096f715f04c0ad6fcf
<|skeleton|> class NeighborAggregator: """定义邻居特征聚合方式""" def __init__(self, input_dim, output_dim, use_bias=True, aggr_method='mean'): """定义邻居特征聚合方式 Inputs: ------- input_dim: int, 输入特征维度 output_dim: int, 输出特征维度 use_bias: boolean, 是否使用偏置 aggr_method: string, 聚合方式, 可选'mean', 'sum', 'max'""" <|bod...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NeighborAggregator: """定义邻居特征聚合方式""" def __init__(self, input_dim, output_dim, use_bias=True, aggr_method='mean'): """定义邻居特征聚合方式 Inputs: ------- input_dim: int, 输入特征维度 output_dim: int, 输出特征维度 use_bias: boolean, 是否使用偏置 aggr_method: string, 聚合方式, 可选'mean', 'sum', 'max'""" super(NeighborAggr...
the_stack_v2_python_sparse
Node/GraphSAGE/script/aggregate.py
robbinc91/GNN-Pytorch
train
0
713b8427f8e6c60ab2470f8515a03ae8dd3eb73e
[ "if self.category:\n return models.Vendor.objects.filter(active=True, category_id__gte=self.category.gte, category_id__lt=self.category.lt)\nreturn models.Vendor.objects.filter(active=True)", "context = super().get_context_data(*args, **kwargs)\ncontext.update(vendors_count=models.Vendor.objects.filter(active=...
<|body_start_0|> if self.category: return models.Vendor.objects.filter(active=True, category_id__gte=self.category.gte, category_id__lt=self.category.lt) return models.Vendor.objects.filter(active=True) <|end_body_0|> <|body_start_1|> context = super().get_context_data(*args, **kwar...
Show vendors according to categories.
Vendors
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Vendors: """Show vendors according to categories.""" def get_queryset(self): """Show vendors according to categories.""" <|body_0|> def get_context_data(self, *args, **kwargs): """Add total vendors count.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_066921
5,601
permissive
[ { "docstring": "Show vendors according to categories.", "name": "get_queryset", "signature": "def get_queryset(self)" }, { "docstring": "Add total vendors count.", "name": "get_context_data", "signature": "def get_context_data(self, *args, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_025644
Implement the Python class `Vendors` described below. Class description: Show vendors according to categories. Method signatures and docstrings: - def get_queryset(self): Show vendors according to categories. - def get_context_data(self, *args, **kwargs): Add total vendors count.
Implement the Python class `Vendors` described below. Class description: Show vendors according to categories. Method signatures and docstrings: - def get_queryset(self): Show vendors according to categories. - def get_context_data(self, *args, **kwargs): Add total vendors count. <|skeleton|> class Vendors: """S...
84c4fa10aefbd792a956cef3d727623ca78cb5fd
<|skeleton|> class Vendors: """Show vendors according to categories.""" def get_queryset(self): """Show vendors according to categories.""" <|body_0|> def get_context_data(self, *args, **kwargs): """Add total vendors count.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Vendors: """Show vendors according to categories.""" def get_queryset(self): """Show vendors according to categories.""" if self.category: return models.Vendor.objects.filter(active=True, category_id__gte=self.category.gte, category_id__lt=self.category.lt) return mode...
the_stack_v2_python_sparse
market/core/views/base.py
katomaso/django-market
train
0
013edbd8447129b361126f345c19579d4e313d93
[ "log.debug('Getting bee record with ID')\nengine = database.get_engine()\nbee = database.beerecord\nif id == -1:\n query = sql.select([bee.c.bee_dict_id, bee.c.bee_name, bee.c.loc_info, bee.c.time])\nelse:\n query = sql.select([bee.c.beerecord_id, bee.c.user_id, bee.c.bee_dict_id, bee.c.bee_name, bee.c.colora...
<|body_start_0|> log.debug('Getting bee record with ID') engine = database.get_engine() bee = database.beerecord if id == -1: query = sql.select([bee.c.bee_dict_id, bee.c.bee_name, bee.c.loc_info, bee.c.time]) else: query = sql.select([bee.c.beerecord_id, ...
BeeRecord
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BeeRecord: def get(self, id: int, user=None): """Get a bee record by ID""" <|body_0|> def put(self, id: int, user=None): """Update a bee record by ID""" <|body_1|> def delete(self, id: int, user): """Delete a bee record by ID""" <|body_2|...
stack_v2_sparse_classes_75kplus_train_066922
12,437
no_license
[ { "docstring": "Get a bee record by ID", "name": "get", "signature": "def get(self, id: int, user=None)" }, { "docstring": "Update a bee record by ID", "name": "put", "signature": "def put(self, id: int, user=None)" }, { "docstring": "Delete a bee record by ID", "name": "dele...
3
stack_v2_sparse_classes_30k_train_028591
Implement the Python class `BeeRecord` described below. Class description: Implement the BeeRecord class. Method signatures and docstrings: - def get(self, id: int, user=None): Get a bee record by ID - def put(self, id: int, user=None): Update a bee record by ID - def delete(self, id: int, user): Delete a bee record ...
Implement the Python class `BeeRecord` described below. Class description: Implement the BeeRecord class. Method signatures and docstrings: - def get(self, id: int, user=None): Get a bee record by ID - def put(self, id: int, user=None): Update a bee record by ID - def delete(self, id: int, user): Delete a bee record ...
ab45d78d207b957bb31381b0df12f4e318fb1e41
<|skeleton|> class BeeRecord: def get(self, id: int, user=None): """Get a bee record by ID""" <|body_0|> def put(self, id: int, user=None): """Update a bee record by ID""" <|body_1|> def delete(self, id: int, user): """Delete a bee record by ID""" <|body_2|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BeeRecord: def get(self, id: int, user=None): """Get a bee record by ID""" log.debug('Getting bee record with ID') engine = database.get_engine() bee = database.beerecord if id == -1: query = sql.select([bee.c.bee_dict_id, bee.c.bee_name, bee.c.loc_info, bee...
the_stack_v2_python_sparse
beecology_api/bee_data_api/endpoints/bee_record.py
C7C8/beecology-api-v7
train
0
330c746b8fc75b8d698c83bbbbae41a9a077c913
[ "if type(self) != type(other):\n return False\nreturn True", "shape = x.shape\nparties = x.parties\nnr_parties = len(parties)\nkwargs = {'seed_id_locations': secrets.randbits(64)}\ndecomposed_shares = [share.bit_decomposition(share, ring_size, False, **kwargs) for share in x.child]\nres_shares: List[MPCTensor]...
<|body_start_0|> if type(self) != type(other): return False return True <|end_body_0|> <|body_start_1|> shape = x.shape parties = x.parties nr_parties = len(parties) kwargs = {'seed_id_locations': secrets.randbits(64)} decomposed_shares = [share.bit_d...
ABY3 Protocol Implementation.
ABY3
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ABY3: """ABY3 Protocol Implementation.""" def __eq__(self, other: Any) -> bool: """Check if "self" is equal with another object given a set of attributes to compare. Args: other (Any): Object to compare Returns: bool: True if equal False if not.""" <|body_0|> def bit_inj...
stack_v2_sparse_classes_75kplus_train_066923
4,866
permissive
[ { "docstring": "Check if \"self\" is equal with another object given a set of attributes to compare. Args: other (Any): Object to compare Returns: bool: True if equal False if not.", "name": "__eq__", "signature": "def __eq__(self, other: Any) -> bool" }, { "docstring": "Perform ABY3 bit injecti...
4
stack_v2_sparse_classes_30k_train_027494
Implement the Python class `ABY3` described below. Class description: ABY3 Protocol Implementation. Method signatures and docstrings: - def __eq__(self, other: Any) -> bool: Check if "self" is equal with another object given a set of attributes to compare. Args: other (Any): Object to compare Returns: bool: True if e...
Implement the Python class `ABY3` described below. Class description: ABY3 Protocol Implementation. Method signatures and docstrings: - def __eq__(self, other: Any) -> bool: Check if "self" is equal with another object given a set of attributes to compare. Args: other (Any): Object to compare Returns: bool: True if e...
1d2c6928b95a2f8164167a8c53f350b188e4533c
<|skeleton|> class ABY3: """ABY3 Protocol Implementation.""" def __eq__(self, other: Any) -> bool: """Check if "self" is equal with another object given a set of attributes to compare. Args: other (Any): Object to compare Returns: bool: True if equal False if not.""" <|body_0|> def bit_inj...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ABY3: """ABY3 Protocol Implementation.""" def __eq__(self, other: Any) -> bool: """Check if "self" is equal with another object given a set of attributes to compare. Args: other (Any): Object to compare Returns: bool: True if equal False if not.""" if type(self) != type(other): ...
the_stack_v2_python_sparse
packages/syft/src/syft/core/smpc/protocol/aby3/aby3.py
aanurraj/PySyft
train
0
d5b3d57a7ca5f8a5a5466c97d2966f91430abc00
[ "filter_kwargs = {}\nregion_name = self.request.GET.get('region')\nif region_name is not None and region_name != '':\n filter_kwargs['region__name'] = region_name\nreturn self.model.awaiting_fulfillment.filter(**filter_kwargs).prefetch_related('region')", "context = super().get_context_data(*args, **kwargs)\nc...
<|body_start_0|> filter_kwargs = {} region_name = self.request.GET.get('region') if region_name is not None and region_name != '': filter_kwargs['region__name'] = region_name return self.model.awaiting_fulfillment.filter(**filter_kwargs).prefetch_related('region') <|end_body_...
Display a filterable list of orders.
Awaitingfulfillment
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Awaitingfulfillment: """Display a filterable list of orders.""" def get_queryset(self): """Return a queryset of orders awaiting fulillment.""" <|body_0|> def get_context_data(self, *args, **kwargs): """Return the template context.""" <|body_1|> def g...
stack_v2_sparse_classes_75kplus_train_066924
25,252
no_license
[ { "docstring": "Return a queryset of orders awaiting fulillment.", "name": "get_queryset", "signature": "def get_queryset(self)" }, { "docstring": "Return the template context.", "name": "get_context_data", "signature": "def get_context_data(self, *args, **kwargs)" }, { "docstrin...
3
stack_v2_sparse_classes_30k_train_018982
Implement the Python class `Awaitingfulfillment` described below. Class description: Display a filterable list of orders. Method signatures and docstrings: - def get_queryset(self): Return a queryset of orders awaiting fulillment. - def get_context_data(self, *args, **kwargs): Return the template context. - def get_p...
Implement the Python class `Awaitingfulfillment` described below. Class description: Display a filterable list of orders. Method signatures and docstrings: - def get_queryset(self): Return a queryset of orders awaiting fulillment. - def get_context_data(self, *args, **kwargs): Return the template context. - def get_p...
ba51d4e304b1aeb296fa2fe16611c892fcdbd471
<|skeleton|> class Awaitingfulfillment: """Display a filterable list of orders.""" def get_queryset(self): """Return a queryset of orders awaiting fulillment.""" <|body_0|> def get_context_data(self, *args, **kwargs): """Return the template context.""" <|body_1|> def g...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Awaitingfulfillment: """Display a filterable list of orders.""" def get_queryset(self): """Return a queryset of orders awaiting fulillment.""" filter_kwargs = {} region_name = self.request.GET.get('region') if region_name is not None and region_name != '': filt...
the_stack_v2_python_sparse
fba/views/fba.py
stcstores/stcadmin
train
0
fb10f6d6998c8c810fe9818015376f0b41ba7a02
[ "if value is not None:\n assert value.tzinfo == timezone.utc, f\"Expected '{value}' to be UTC\"\nreturn value", "if value is not None:\n assert value.tzinfo is None\n return value.replace(tzinfo=timezone.utc)\nreturn None" ]
<|body_start_0|> if value is not None: assert value.tzinfo == timezone.utc, f"Expected '{value}' to be UTC" return value <|end_body_0|> <|body_start_1|> if value is not None: assert value.tzinfo is None return value.replace(tzinfo=timezone.utc) return...
A SQL column type to store UTC datetimes. Usage example: table = sqlalchemy.Table( ... sqlalchemy.Column("my_datetime_column", UTCDateTime) ) Opentrons robot-server code should always use this instead of SQLAlchemy's built-in DateTime type. Motivation: We generally want our datetimes to have a UTC timezone so they're u...
UTCDateTime
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UTCDateTime: """A SQL column type to store UTC datetimes. Usage example: table = sqlalchemy.Table( ... sqlalchemy.Column("my_datetime_column", UTCDateTime) ) Opentrons robot-server code should always use this instead of SQLAlchemy's built-in DateTime type. Motivation: We generally want our dateti...
stack_v2_sparse_classes_75kplus_train_066925
2,273
permissive
[ { "docstring": "Prepare a Python datetime object to inserted into SQL via SQLAlchemy.", "name": "process_bind_param", "signature": "def process_bind_param(self, value: Optional[datetime], dialect: object) -> Optional[datetime]" }, { "docstring": "Process a Python datetime object that SQLAlchemy ...
2
stack_v2_sparse_classes_30k_train_038152
Implement the Python class `UTCDateTime` described below. Class description: A SQL column type to store UTC datetimes. Usage example: table = sqlalchemy.Table( ... sqlalchemy.Column("my_datetime_column", UTCDateTime) ) Opentrons robot-server code should always use this instead of SQLAlchemy's built-in DateTime type. M...
Implement the Python class `UTCDateTime` described below. Class description: A SQL column type to store UTC datetimes. Usage example: table = sqlalchemy.Table( ... sqlalchemy.Column("my_datetime_column", UTCDateTime) ) Opentrons robot-server code should always use this instead of SQLAlchemy's built-in DateTime type. M...
026b523c8c9e5d45910c490efb89194d72595be9
<|skeleton|> class UTCDateTime: """A SQL column type to store UTC datetimes. Usage example: table = sqlalchemy.Table( ... sqlalchemy.Column("my_datetime_column", UTCDateTime) ) Opentrons robot-server code should always use this instead of SQLAlchemy's built-in DateTime type. Motivation: We generally want our dateti...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UTCDateTime: """A SQL column type to store UTC datetimes. Usage example: table = sqlalchemy.Table( ... sqlalchemy.Column("my_datetime_column", UTCDateTime) ) Opentrons robot-server code should always use this instead of SQLAlchemy's built-in DateTime type. Motivation: We generally want our datetimes to have a...
the_stack_v2_python_sparse
robot-server/robot_server/persistence/_utc_datetime.py
Opentrons/opentrons
train
326
5c7dd48719ad1f842445bb763666cf8b956170d9
[ "if len(S) == 0:\n return ['']\nqueue = []\nqueue.append(S)\nfor i in range(len(S)):\n if ord(S[i]) >= ord('0') and ord(S[i]) <= ord('9'):\n continue\n for j in range(len(queue)):\n cur = queue.pop(0)\n newStr = cur[:i] + cur[i].upper() + cur[i + 1:]\n queue.append(newStr)\n ...
<|body_start_0|> if len(S) == 0: return [''] queue = [] queue.append(S) for i in range(len(S)): if ord(S[i]) >= ord('0') and ord(S[i]) <= ord('9'): continue for j in range(len(queue)): cur = queue.pop(0) ...
https://leetcode.com/problems/letter-case-permutation/description/
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """https://leetcode.com/problems/letter-case-permutation/description/""" def letterCasePermutation(self, S): """:type S: str :rtype: List[str] BFS solution""" <|body_0|> def letterCasePermutation2(self, S): """:type S: str :rtype: List[str] DFS solution...
stack_v2_sparse_classes_75kplus_train_066926
2,798
no_license
[ { "docstring": ":type S: str :rtype: List[str] BFS solution", "name": "letterCasePermutation", "signature": "def letterCasePermutation(self, S)" }, { "docstring": ":type S: str :rtype: List[str] DFS solution", "name": "letterCasePermutation2", "signature": "def letterCasePermutation2(sel...
4
null
Implement the Python class `Solution` described below. Class description: https://leetcode.com/problems/letter-case-permutation/description/ Method signatures and docstrings: - def letterCasePermutation(self, S): :type S: str :rtype: List[str] BFS solution - def letterCasePermutation2(self, S): :type S: str :rtype: L...
Implement the Python class `Solution` described below. Class description: https://leetcode.com/problems/letter-case-permutation/description/ Method signatures and docstrings: - def letterCasePermutation(self, S): :type S: str :rtype: List[str] BFS solution - def letterCasePermutation2(self, S): :type S: str :rtype: L...
54d3d9530b25272d4a2e5dc33e7035c44f506dc5
<|skeleton|> class Solution: """https://leetcode.com/problems/letter-case-permutation/description/""" def letterCasePermutation(self, S): """:type S: str :rtype: List[str] BFS solution""" <|body_0|> def letterCasePermutation2(self, S): """:type S: str :rtype: List[str] DFS solution...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: """https://leetcode.com/problems/letter-case-permutation/description/""" def letterCasePermutation(self, S): """:type S: str :rtype: List[str] BFS solution""" if len(S) == 0: return [''] queue = [] queue.append(S) for i in range(len(S)): ...
the_stack_v2_python_sparse
old/Session002/Backtracking/LetterCasePermutation.py
MaxIakovliev/algorithms
train
0
20b019f7b14eb857bbc29b4770f5a8a382bfe157
[ "count = 0\nfor s in range(len(A) - 2):\n d = A[s + 1] - A[s]\n for e in range(s + 2, len(A)):\n if A[e] - A[e - 1] == d:\n count += 1\n else:\n break\nreturn count", "dp = [0] * len(A)\nsum = 0\nfor i in range(2, len(A)):\n if A[i] - A[i - 1] == A[i - 1] - A[i - 2]:\n...
<|body_start_0|> count = 0 for s in range(len(A) - 2): d = A[s + 1] - A[s] for e in range(s + 2, len(A)): if A[e] - A[e - 1] == d: count += 1 else: break return count <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numberOfArithmeticSlices_bruteforce(self, A): """time O(n^2) space O(1) :type A: List[int] :rtype: int""" <|body_0|> def numberOfArithmeticSlices_dp(self, A): """time O(n) space O(n) :param A: :return:""" <|body_1|> def numberOfArithmeticSl...
stack_v2_sparse_classes_75kplus_train_066927
1,251
no_license
[ { "docstring": "time O(n^2) space O(1) :type A: List[int] :rtype: int", "name": "numberOfArithmeticSlices_bruteforce", "signature": "def numberOfArithmeticSlices_bruteforce(self, A)" }, { "docstring": "time O(n) space O(n) :param A: :return:", "name": "numberOfArithmeticSlices_dp", "sign...
3
stack_v2_sparse_classes_30k_test_000112
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numberOfArithmeticSlices_bruteforce(self, A): time O(n^2) space O(1) :type A: List[int] :rtype: int - def numberOfArithmeticSlices_dp(self, A): time O(n) space O(n) :param A:...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numberOfArithmeticSlices_bruteforce(self, A): time O(n^2) space O(1) :type A: List[int] :rtype: int - def numberOfArithmeticSlices_dp(self, A): time O(n) space O(n) :param A:...
85f71621c54f6b0029f3a2746f022f89dd7419d9
<|skeleton|> class Solution: def numberOfArithmeticSlices_bruteforce(self, A): """time O(n^2) space O(1) :type A: List[int] :rtype: int""" <|body_0|> def numberOfArithmeticSlices_dp(self, A): """time O(n) space O(n) :param A: :return:""" <|body_1|> def numberOfArithmeticSl...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def numberOfArithmeticSlices_bruteforce(self, A): """time O(n^2) space O(1) :type A: List[int] :rtype: int""" count = 0 for s in range(len(A) - 2): d = A[s + 1] - A[s] for e in range(s + 2, len(A)): if A[e] - A[e - 1] == d: ...
the_stack_v2_python_sparse
LeetCode/DynamicProgramming/413_arithmetric_slices.py
XyK0907/for_work
train
0
90784e64bbeacfeb1a5014661fdb9ddbdae445cc
[ "res1 = SqlQuery('select * from \"Лицо\"')\nres2 = SqlQuery(query='select * from \"Лицо\"')\nself.assertEqual(res1.get().Size(), 15)\nself.assertEqual(res2.get().Size(), 15)", "ans = SqlQuery('select * from \"Лицо\" where \"@Лицо\"=$1', 1)\nself.assertEqual(ans.get().Size(), 1)\nself.assertEqual(str(ans.get()[0][...
<|body_start_0|> res1 = SqlQuery('select * from "Лицо"') res2 = SqlQuery(query='select * from "Лицо"') self.assertEqual(res1.get().Size(), 15) self.assertEqual(res2.get().Size(), 15) <|end_body_0|> <|body_start_1|> ans = SqlQuery('select * from "Лицо" where "@Лицо"=$1', 1) ...
TestSqlQuery
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestSqlQuery: def test_clean(self): """Автор: Рыбаков М.А""" <|body_0|> def test_args(self): """Автор: Рыбаков М.А""" <|body_1|> def test_rec(self): """Автор: Рыбаков М.А""" <|body_2|> def test_format(self): """Автор: Рыбаков...
stack_v2_sparse_classes_75kplus_train_066928
3,928
no_license
[ { "docstring": "Автор: Рыбаков М.А", "name": "test_clean", "signature": "def test_clean(self)" }, { "docstring": "Автор: Рыбаков М.А", "name": "test_args", "signature": "def test_args(self)" }, { "docstring": "Автор: Рыбаков М.А", "name": "test_rec", "signature": "def tes...
6
null
Implement the Python class `TestSqlQuery` described below. Class description: Implement the TestSqlQuery class. Method signatures and docstrings: - def test_clean(self): Автор: Рыбаков М.А - def test_args(self): Автор: Рыбаков М.А - def test_rec(self): Автор: Рыбаков М.А - def test_format(self): Автор: Рыбаков М.А - ...
Implement the Python class `TestSqlQuery` described below. Class description: Implement the TestSqlQuery class. Method signatures and docstrings: - def test_clean(self): Автор: Рыбаков М.А - def test_args(self): Автор: Рыбаков М.А - def test_rec(self): Автор: Рыбаков М.А - def test_format(self): Автор: Рыбаков М.А - ...
5559275accbfda0cb75c8c90d79090c10524e815
<|skeleton|> class TestSqlQuery: def test_clean(self): """Автор: Рыбаков М.А""" <|body_0|> def test_args(self): """Автор: Рыбаков М.А""" <|body_1|> def test_rec(self): """Автор: Рыбаков М.А""" <|body_2|> def test_format(self): """Автор: Рыбаков...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestSqlQuery: def test_clean(self): """Автор: Рыбаков М.А""" res1 = SqlQuery('select * from "Лицо"') res2 = SqlQuery(query='select * from "Лицо"') self.assertEqual(res1.get().Size(), 15) self.assertEqual(res2.get().Size(), 15) def test_args(self): """Автор:...
the_stack_v2_python_sparse
test_api/sqlquery.py
4l1fe/miscellaneous
train
0
918ea9b37cf9ddc6b8bba942907fb87ed0c765ca
[ "super(FullyConnectedNNB, self).__init__(name=name)\nself._num_sites = num_sites\nself._num_layers = num_layers\nself._layer_sizes = layer_sizes\nnonlinearity = tf.nn.relu\nself._components = []\nwith self._enter_variable_scope():\n for _, layer_size in zip(range(num_layers), layer_sizes):\n self._compone...
<|body_start_0|> super(FullyConnectedNNB, self).__init__(name=name) self._num_sites = num_sites self._num_layers = num_layers self._layer_sizes = layer_sizes nonlinearity = tf.nn.relu self._components = [] with self._enter_variable_scope(): for _, laye...
BCS neural network backflow module.
FullyConnectedNNB
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FullyConnectedNNB: """BCS neural network backflow module.""" def __init__(self, num_sites: int, num_layers: int, layer_sizes: List[int], name: str='fully_connected_nnb'): """Constructs a neural net backflow module. Args: num_sites: Number of sites in the system. num_layers: Number of...
stack_v2_sparse_classes_75kplus_train_066929
40,960
permissive
[ { "docstring": "Constructs a neural net backflow module. Args: num_sites: Number of sites in the system. num_layers: Number of neural networks. layer_sizes: Sizes of fully connected networks. name: Name of the module.", "name": "__init__", "signature": "def __init__(self, num_sites: int, num_layers: int...
3
stack_v2_sparse_classes_30k_train_021455
Implement the Python class `FullyConnectedNNB` described below. Class description: BCS neural network backflow module. Method signatures and docstrings: - def __init__(self, num_sites: int, num_layers: int, layer_sizes: List[int], name: str='fully_connected_nnb'): Constructs a neural net backflow module. Args: num_si...
Implement the Python class `FullyConnectedNNB` described below. Class description: BCS neural network backflow module. Method signatures and docstrings: - def __init__(self, num_sites: int, num_layers: int, layer_sizes: List[int], name: str='fully_connected_nnb'): Constructs a neural net backflow module. Args: num_si...
3a298ceab53bf6403c1a4037cb22431499891d79
<|skeleton|> class FullyConnectedNNB: """BCS neural network backflow module.""" def __init__(self, num_sites: int, num_layers: int, layer_sizes: List[int], name: str='fully_connected_nnb'): """Constructs a neural net backflow module. Args: num_sites: Number of sites in the system. num_layers: Number of...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FullyConnectedNNB: """BCS neural network backflow module.""" def __init__(self, num_sites: int, num_layers: int, layer_sizes: List[int], name: str='fully_connected_nnb'): """Constructs a neural net backflow module. Args: num_sites: Number of sites in the system. num_layers: Number of neural netwo...
the_stack_v2_python_sparse
cgs_vmc/wavefunctions.py
ClarkResearchGroup/cgs-vmc
train
18
aa02375b03fe3920c23046f6fd00d9120c8304a8
[ "rv = self.get(ident)\nif rv is None:\n abort(404)\nreturn rv", "rv = self.first()\nif rv is None:\n abort(404)\nreturn rv", "if error_out and page < 1:\n abort(404)\nitems = self.limit(per_page).offset((page - 1) * per_page).all()\nif not items and page != 1 and error_out:\n abort(404)\nreturn Pagi...
<|body_start_0|> rv = self.get(ident) if rv is None: abort(404) return rv <|end_body_0|> <|body_start_1|> rv = self.first() if rv is None: abort(404) return rv <|end_body_1|> <|body_start_2|> if error_out and page < 1: abort(4...
The default query object used for models, and exposed as :attr:`~SQLAlchemy.Query`. This can be subclassed and replaced for individual models by setting the :attr:`~Model.query_class` attribute. This is a subclass of a standard SQLAlchemy :class:`~sqlalchemy.orm.query.Query` class and has all the methods of a standard ...
BaseQuery
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseQuery: """The default query object used for models, and exposed as :attr:`~SQLAlchemy.Query`. This can be subclassed and replaced for individual models by setting the :attr:`~Model.query_class` attribute. This is a subclass of a standard SQLAlchemy :class:`~sqlalchemy.orm.query.Query` class a...
stack_v2_sparse_classes_75kplus_train_066930
30,678
permissive
[ { "docstring": "Like :meth:`get` but aborts with 404 if not found instead of returning `None`.", "name": "get_or_404", "signature": "def get_or_404(self, ident)" }, { "docstring": "Like :meth:`first` but aborts with 404 if not found instead of returning `None`.", "name": "first_or_404", ...
3
stack_v2_sparse_classes_30k_test_002163
Implement the Python class `BaseQuery` described below. Class description: The default query object used for models, and exposed as :attr:`~SQLAlchemy.Query`. This can be subclassed and replaced for individual models by setting the :attr:`~Model.query_class` attribute. This is a subclass of a standard SQLAlchemy :clas...
Implement the Python class `BaseQuery` described below. Class description: The default query object used for models, and exposed as :attr:`~SQLAlchemy.Query`. This can be subclassed and replaced for individual models by setting the :attr:`~Model.query_class` attribute. This is a subclass of a standard SQLAlchemy :clas...
7053de769a3a7093f84cb6117a361ed394472ef0
<|skeleton|> class BaseQuery: """The default query object used for models, and exposed as :attr:`~SQLAlchemy.Query`. This can be subclassed and replaced for individual models by setting the :attr:`~Model.query_class` attribute. This is a subclass of a standard SQLAlchemy :class:`~sqlalchemy.orm.query.Query` class a...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BaseQuery: """The default query object used for models, and exposed as :attr:`~SQLAlchemy.Query`. This can be subclassed and replaced for individual models by setting the :attr:`~Model.query_class` attribute. This is a subclass of a standard SQLAlchemy :class:`~sqlalchemy.orm.query.Query` class and has all th...
the_stack_v2_python_sparse
1/chartnet/flask_sqlalchemy.py
catsky/rebang
train
30
05d3c1e0dbc1523cd98da14d955a1e866336697c
[ "super().__init__(name=name)\npos_encoding = PositionalEmbedding.get_sinusoid_encoding(config['n_seq'], config['d_model'])\nself.embedding = new_embedding(config['n_seq'], config['d_model'], trainable=False, weights=[pos_encoding])", "position = tf.cast(tf.math.cumsum(tf.ones_like(inputs), axis=1, exclusive=True)...
<|body_start_0|> super().__init__(name=name) pos_encoding = PositionalEmbedding.get_sinusoid_encoding(config['n_seq'], config['d_model']) self.embedding = new_embedding(config['n_seq'], config['d_model'], trainable=False, weights=[pos_encoding]) <|end_body_0|> <|body_start_1|> position ...
Positional Embedding Class
PositionalEmbedding
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PositionalEmbedding: """Positional Embedding Class""" def __init__(self, config, name='position_embedding'): """생성자 :param config: Config 객체 :param name: layer name""" <|body_0|> def call(self, inputs): """layer 실행 :param inputs: 입력 :return embed: positional embe...
stack_v2_sparse_classes_75kplus_train_066931
14,325
permissive
[ { "docstring": "생성자 :param config: Config 객체 :param name: layer name", "name": "__init__", "signature": "def __init__(self, config, name='position_embedding')" }, { "docstring": "layer 실행 :param inputs: 입력 :return embed: positional embedding lookup 결과", "name": "call", "signature": "def ...
3
null
Implement the Python class `PositionalEmbedding` described below. Class description: Positional Embedding Class Method signatures and docstrings: - def __init__(self, config, name='position_embedding'): 생성자 :param config: Config 객체 :param name: layer name - def call(self, inputs): layer 실행 :param inputs: 입력 :return e...
Implement the Python class `PositionalEmbedding` described below. Class description: Positional Embedding Class Method signatures and docstrings: - def __init__(self, config, name='position_embedding'): 생성자 :param config: Config 객체 :param name: layer name - def call(self, inputs): layer 실행 :param inputs: 입력 :return e...
cf8588ead07a098de9dd1e4f177374ba7ce08d74
<|skeleton|> class PositionalEmbedding: """Positional Embedding Class""" def __init__(self, config, name='position_embedding'): """생성자 :param config: Config 객체 :param name: layer name""" <|body_0|> def call(self, inputs): """layer 실행 :param inputs: 입력 :return embed: positional embe...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PositionalEmbedding: """Positional Embedding Class""" def __init__(self, config, name='position_embedding'): """생성자 :param config: Config 객체 :param name: layer name""" super().__init__(name=name) pos_encoding = PositionalEmbedding.get_sinusoid_encoding(config['n_seq'], config['d_m...
the_stack_v2_python_sparse
transformer/model.py
paul-hyun/tf_transformers
train
10
71276ce46cf6055be31820b149f8d1edf19235a1
[ "super().pre_trigger_run(trigger=trigger, **kwargs)\nrr_location = os.path.join(get_global_conf().getdir('utilities', 'install_directory'), 'rr')\ntrigger.cmd = '{} record {}'.format(os.path.join(rr_location, 'bin/rr'), trigger.cmd)", "mozilla_rr = get_plugin_conf('base', 'rr')\ninstaller = Installer.factory(mozi...
<|body_start_0|> super().pre_trigger_run(trigger=trigger, **kwargs) rr_location = os.path.join(get_global_conf().getdir('utilities', 'install_directory'), 'rr') trigger.cmd = '{} record {}'.format(os.path.join(rr_location, 'bin/rr'), trigger.cmd) <|end_body_0|> <|body_start_1|> mozilla_...
Record Replay by Mozilla
RR
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RR: """Record Replay by Mozilla""" def pre_trigger_run(self, trigger: RawTrigger, *args, **kwargs) -> None: """Updates the trigger command to run rr on top of the plugin's command :param trigger: the trigger that will run :param args: other arguments to pass to parents :param kwargs:...
stack_v2_sparse_classes_75kplus_train_066932
1,421
no_license
[ { "docstring": "Updates the trigger command to run rr on top of the plugin's command :param trigger: the trigger that will run :param args: other arguments to pass to parents :param kwargs: other keywords arguments to pass to parents", "name": "pre_trigger_run", "signature": "def pre_trigger_run(self, t...
2
null
Implement the Python class `RR` described below. Class description: Record Replay by Mozilla Method signatures and docstrings: - def pre_trigger_run(self, trigger: RawTrigger, *args, **kwargs) -> None: Updates the trigger command to run rr on top of the plugin's command :param trigger: the trigger that will run :para...
Implement the Python class `RR` described below. Class description: Record Replay by Mozilla Method signatures and docstrings: - def pre_trigger_run(self, trigger: RawTrigger, *args, **kwargs) -> None: Updates the trigger command to run rr on top of the plugin's command :param trigger: the trigger that will run :para...
e9f914fb6c4eb1bc97f7dfc665e8dd6c7e7ad068
<|skeleton|> class RR: """Record Replay by Mozilla""" def pre_trigger_run(self, trigger: RawTrigger, *args, **kwargs) -> None: """Updates the trigger command to run rr on top of the plugin's command :param trigger: the trigger that will run :param args: other arguments to pass to parents :param kwargs:...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RR: """Record Replay by Mozilla""" def pre_trigger_run(self, trigger: RawTrigger, *args, **kwargs) -> None: """Updates the trigger command to run rr on top of the plugin's command :param trigger: the trigger that will run :param args: other arguments to pass to parents :param kwargs: other keywor...
the_stack_v2_python_sparse
plugins/base/rr.py
holaymzhang/bugbase
train
0
c4db367989c2bc27f682738600241add92175873
[ "global rsonline_CONN\ncursor = None\ntry:\n cursor = rsonline_CONN.cursor(buffered=True, dictionary=True)\n sql = 'insert into lie_brand(brand_name, brand_logo, brand_desc,site_url, web_url) values(%(brand_name)s,%(brand_logo)s,%(brand_desc)s,%(site_url)s, %(web_url)s)'\n cursor.execute(sql, lieBrand)\nex...
<|body_start_0|> global rsonline_CONN cursor = None try: cursor = rsonline_CONN.cursor(buffered=True, dictionary=True) sql = 'insert into lie_brand(brand_name, brand_logo, brand_desc,site_url, web_url) values(%(brand_name)s,%(brand_logo)s,%(brand_desc)s,%(site_url)s, %(we...
LieBrand
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LieBrand: def addLieBrand(cls, lieBrand): """method: addLieBrand params: lieBrand-type: LieBrand""" <|body_0|> def get_brand_id_by_brand_name(cls, brand_name): """method: get_brand_id_by_brand_name params: brand_name-type: str return: brand_id return-type: int""" ...
stack_v2_sparse_classes_75kplus_train_066933
18,849
no_license
[ { "docstring": "method: addLieBrand params: lieBrand-type: LieBrand", "name": "addLieBrand", "signature": "def addLieBrand(cls, lieBrand)" }, { "docstring": "method: get_brand_id_by_brand_name params: brand_name-type: str return: brand_id return-type: int", "name": "get_brand_id_by_brand_nam...
2
stack_v2_sparse_classes_30k_train_042391
Implement the Python class `LieBrand` described below. Class description: Implement the LieBrand class. Method signatures and docstrings: - def addLieBrand(cls, lieBrand): method: addLieBrand params: lieBrand-type: LieBrand - def get_brand_id_by_brand_name(cls, brand_name): method: get_brand_id_by_brand_name params: ...
Implement the Python class `LieBrand` described below. Class description: Implement the LieBrand class. Method signatures and docstrings: - def addLieBrand(cls, lieBrand): method: addLieBrand params: lieBrand-type: LieBrand - def get_brand_id_by_brand_name(cls, brand_name): method: get_brand_id_by_brand_name params: ...
1e49a6e13ea4b11427f47999c13a609be9ae3ecf
<|skeleton|> class LieBrand: def addLieBrand(cls, lieBrand): """method: addLieBrand params: lieBrand-type: LieBrand""" <|body_0|> def get_brand_id_by_brand_name(cls, brand_name): """method: get_brand_id_by_brand_name params: brand_name-type: str return: brand_id return-type: int""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LieBrand: def addLieBrand(cls, lieBrand): """method: addLieBrand params: lieBrand-type: LieBrand""" global rsonline_CONN cursor = None try: cursor = rsonline_CONN.cursor(buffered=True, dictionary=True) sql = 'insert into lie_brand(brand_name, brand_logo,...
the_stack_v2_python_sparse
rsonline/server/db/rsonline/mysql_client.py
yunhao-qing/PythonScrapy
train
0
059bc78567a53d132a0850affd650fae82af9d97
[ "if package:\n if not cls.load_module(package):\n return None\n if not mod_path.startswith('.'):\n mod_path = f'.{mod_path}'\nfull_path = resolve_name(mod_path, package)\nif full_path in sys.modules:\n return sys.modules[full_path]\nif '.' in mod_path:\n parent_mod_path, mod_name = mod_pat...
<|body_start_0|> if package: if not cls.load_module(package): return None if not mod_path.startswith('.'): mod_path = f'.{mod_path}' full_path = resolve_name(mod_path, package) if full_path in sys.modules: return sys.modules[ful...
Class used to load classes from modules dynamically.
ClassLoader
[ "LicenseRef-scancode-dco-1.1", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClassLoader: """Class used to load classes from modules dynamically.""" def load_module(cls, mod_path: str, package: str=None) -> ModuleType: """Load a module by its absolute path. Args: mod_path: the absolute or relative module path package: the parent package to search for the modu...
stack_v2_sparse_classes_75kplus_train_066934
6,454
permissive
[ { "docstring": "Load a module by its absolute path. Args: mod_path: the absolute or relative module path package: the parent package to search for the module Returns: The resolved module or `None` if the module cannot be found Raises: ModuleLoadError: If there was an error loading the module", "name": "load...
4
stack_v2_sparse_classes_30k_train_017157
Implement the Python class `ClassLoader` described below. Class description: Class used to load classes from modules dynamically. Method signatures and docstrings: - def load_module(cls, mod_path: str, package: str=None) -> ModuleType: Load a module by its absolute path. Args: mod_path: the absolute or relative modul...
Implement the Python class `ClassLoader` described below. Class description: Class used to load classes from modules dynamically. Method signatures and docstrings: - def load_module(cls, mod_path: str, package: str=None) -> ModuleType: Load a module by its absolute path. Args: mod_path: the absolute or relative modul...
39cac36d8937ce84a9307ce100aaefb8bc05ec04
<|skeleton|> class ClassLoader: """Class used to load classes from modules dynamically.""" def load_module(cls, mod_path: str, package: str=None) -> ModuleType: """Load a module by its absolute path. Args: mod_path: the absolute or relative module path package: the parent package to search for the modu...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ClassLoader: """Class used to load classes from modules dynamically.""" def load_module(cls, mod_path: str, package: str=None) -> ModuleType: """Load a module by its absolute path. Args: mod_path: the absolute or relative module path package: the parent package to search for the module Returns: T...
the_stack_v2_python_sparse
aries_cloudagent/utils/classloader.py
hyperledger/aries-cloudagent-python
train
370
761f2361f030c896fb58b4cf4d8e99ad710b62a4
[ "tmp = self.score_model.predict(x)\nif not pred is None:\n tmp = np.array([t[:, p:p + 1] for t, p in zip(tmp, pred)])\ntmp = [np.array([tmp[i][j] for j in range(tmp.shape[1]) if x[i][j] != 0]) for i in range(tmp.shape[0])]\nreturn tmp", "assert self.score_model.output_shape == (None,) + self.orig.model.output_...
<|body_start_0|> tmp = self.score_model.predict(x) if not pred is None: tmp = np.array([t[:, p:p + 1] for t, p in zip(tmp, pred)]) tmp = [np.array([tmp[i][j] for j in range(tmp.shape[1]) if x[i][j] != 0]) for i in range(tmp.shape[0])] return tmp <|end_body_0|> <|body_start_1...
ScoreModel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScoreModel: def score(self, x, pred): """Return relevance scores for x. pred: if none, return scores for all possible classes else, assume that pred is a list of target classes""" <|body_0|> def check(self): """Basic sanity check (e.g., output shapes ...)""" ...
stack_v2_sparse_classes_75kplus_train_066935
16,087
no_license
[ { "docstring": "Return relevance scores for x. pred: if none, return scores for all possible classes else, assume that pred is a list of target classes", "name": "score", "signature": "def score(self, x, pred)" }, { "docstring": "Basic sanity check (e.g., output shapes ...)", "name": "check"...
2
stack_v2_sparse_classes_30k_train_012755
Implement the Python class `ScoreModel` described below. Class description: Implement the ScoreModel class. Method signatures and docstrings: - def score(self, x, pred): Return relevance scores for x. pred: if none, return scores for all possible classes else, assume that pred is a list of target classes - def check(...
Implement the Python class `ScoreModel` described below. Class description: Implement the ScoreModel class. Method signatures and docstrings: - def score(self, x, pred): Return relevance scores for x. pred: if none, return scores for all possible classes else, assume that pred is a list of target classes - def check(...
4f116264791a84655e2469cc274c0c7e0c478755
<|skeleton|> class ScoreModel: def score(self, x, pred): """Return relevance scores for x. pred: if none, return scores for all possible classes else, assume that pred is a list of target classes""" <|body_0|> def check(self): """Basic sanity check (e.g., output shapes ...)""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ScoreModel: def score(self, x, pred): """Return relevance scores for x. pred: if none, return scores for all possible classes else, assume that pred is a list of target classes""" tmp = self.score_model.predict(x) if not pred is None: tmp = np.array([t[:, p:p + 1] for t, p ...
the_stack_v2_python_sparse
HybridDocuments/SRC/explanation_methods.py
NPoe/neural-nlp-explanation-experiment
train
14
904d06c17a1b4784ca8c04cb77dea6b2a2998e80
[ "def buildTree(nums, left, right):\n if left > right:\n return\n if left == right:\n root = Node(left, right)\n root.total = nums[left]\n return root\n mid = (left + right) // 2\n root = Node(left, right)\n root.left = buildTree(nums, left, mid)\n root.right = buildTree...
<|body_start_0|> def buildTree(nums, left, right): if left > right: return if left == right: root = Node(left, right) root.total = nums[left] return root mid = (left + right) // 2 root = Node(left, ri...
NumMatrix
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" <|body_0|> def update(self, row, col, val): """:type row: int :type col: int :type val: int :rtype: void""" <|body_1|> def sumRegion(self, row1, col1, row2, col2): """:typ...
stack_v2_sparse_classes_75kplus_train_066936
2,584
no_license
[ { "docstring": ":type matrix: List[List[int]]", "name": "__init__", "signature": "def __init__(self, matrix)" }, { "docstring": ":type row: int :type col: int :type val: int :rtype: void", "name": "update", "signature": "def update(self, row, col, val)" }, { "docstring": ":type r...
3
stack_v2_sparse_classes_30k_train_051612
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): :type matrix: List[List[int]] - def update(self, row, col, val): :type row: int :type col: int :type val: int :rtype: void - def sumRegion(self, row...
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): :type matrix: List[List[int]] - def update(self, row, col, val): :type row: int :type col: int :type val: int :rtype: void - def sumRegion(self, row...
28219fbc5e2e96f59e9d2b9d1da18f05187898c8
<|skeleton|> class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" <|body_0|> def update(self, row, col, val): """:type row: int :type col: int :type val: int :rtype: void""" <|body_1|> def sumRegion(self, row1, col1, row2, col2): """:typ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" def buildTree(nums, left, right): if left > right: return if left == right: root = Node(left, right) root.total = nums[left] return...
the_stack_v2_python_sparse
2018/308-range-sum-query-2d.py
the-potato-man/lc
train
0
249e8426053c90f49b40b87972fdd531a8ef3597
[ "ctrl = wx.TextCtrl(parent)\nself._bg = ctrl.GetBackgroundColour().GetRGB()\nbg = Color('red')\nbg.mix(Color.from_wxbgr(ctrl.GetBackgroundColour().GetRGBA()), 0.5, in_place=True)\nself._error_bg = wx.Colour(bg.to_wxbgr(alpha=False)).GetRGB()\nsuper().__init__(parent, *args, **kwargs)\nfont = ctrl.GetFont()\nself.Se...
<|body_start_0|> ctrl = wx.TextCtrl(parent) self._bg = ctrl.GetBackgroundColour().GetRGB() bg = Color('red') bg.mix(Color.from_wxbgr(ctrl.GetBackgroundColour().GetRGBA()), 0.5, in_place=True) self._error_bg = wx.Colour(bg.to_wxbgr(alpha=False)).GetRGB() super().__init__(p...
Time picker that we can force proper colors on.
TimePickerCtrl
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TimePickerCtrl: """Time picker that we can force proper colors on.""" def __init__(self, parent, *args, **kwargs): """Initialize. Create a temporary text control so we can get proper background and foreground colors.""" <|body_0|> def on_color_change(self, event): ...
stack_v2_sparse_classes_75kplus_train_066937
2,245
permissive
[ { "docstring": "Initialize. Create a temporary text control so we can get proper background and foreground colors.", "name": "__init__", "signature": "def __init__(self, parent, *args, **kwargs)" }, { "docstring": "Handle color change.", "name": "on_color_change", "signature": "def on_co...
4
stack_v2_sparse_classes_30k_train_025571
Implement the Python class `TimePickerCtrl` described below. Class description: Time picker that we can force proper colors on. Method signatures and docstrings: - def __init__(self, parent, *args, **kwargs): Initialize. Create a temporary text control so we can get proper background and foreground colors. - def on_c...
Implement the Python class `TimePickerCtrl` described below. Class description: Time picker that we can force proper colors on. Method signatures and docstrings: - def __init__(self, parent, *args, **kwargs): Initialize. Create a temporary text control so we can get proper background and foreground colors. - def on_c...
95129ca054384a4c59a4effdb3fe32a7a66af6ff
<|skeleton|> class TimePickerCtrl: """Time picker that we can force proper colors on.""" def __init__(self, parent, *args, **kwargs): """Initialize. Create a temporary text control so we can get proper background and foreground colors.""" <|body_0|> def on_color_change(self, event): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TimePickerCtrl: """Time picker that we can force proper colors on.""" def __init__(self, parent, *args, **kwargs): """Initialize. Create a temporary text control so we can get proper background and foreground colors.""" ctrl = wx.TextCtrl(parent) self._bg = ctrl.GetBackgroundColou...
the_stack_v2_python_sparse
rummage/lib/gui/controls/time_picker.py
facelessuser/Rummage
train
70
940509c4b44b76042893e9e9e08161c547052fab
[ "if kwargs.get('username') is None:\n kwargs['username'] = git.GetProjectUserEmail(os.path.dirname(__file__))\nif kwargs.get('host') is None:\n kwargs['host'] = cros_build_lib.GetHostName(fully_qualified=True)\nfor attr in ('cmd_args', 'cmd_base', 'cmd_line'):\n val = kwargs.get(attr)\n if isinstance(va...
<|body_start_0|> if kwargs.get('username') is None: kwargs['username'] = git.GetProjectUserEmail(os.path.dirname(__file__)) if kwargs.get('host') is None: kwargs['host'] = cros_build_lib.GetHostName(fully_qualified=True) for attr in ('cmd_args', 'cmd_base', 'cmd_line'): ...
Entity object for a stats entry.
Stats
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference", "LGPL-2.0-or-later", "GPL-1.0-or-later", "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Stats: """Entity object for a stats entry.""" def __init__(self, **kwargs): """Initialize the record. **kwargs keys need to correspond to elements in __slots__. These arguments can be lists: - cmd_args - cmd_base - cmd_line If unset, the |username| and |host| attributes will be deter...
stack_v2_sparse_classes_75kplus_train_066938
6,553
permissive
[ { "docstring": "Initialize the record. **kwargs keys need to correspond to elements in __slots__. These arguments can be lists: - cmd_args - cmd_base - cmd_line If unset, the |username| and |host| attributes will be determined automatically.", "name": "__init__", "signature": "def __init__(self, **kwarg...
3
stack_v2_sparse_classes_30k_train_037010
Implement the Python class `Stats` described below. Class description: Entity object for a stats entry. Method signatures and docstrings: - def __init__(self, **kwargs): Initialize the record. **kwargs keys need to correspond to elements in __slots__. These arguments can be lists: - cmd_args - cmd_base - cmd_line If ...
Implement the Python class `Stats` described below. Class description: Entity object for a stats entry. Method signatures and docstrings: - def __init__(self, **kwargs): Initialize the record. **kwargs keys need to correspond to elements in __slots__. These arguments can be lists: - cmd_args - cmd_base - cmd_line If ...
72a05af97787001756bae2511b7985e61498c965
<|skeleton|> class Stats: """Entity object for a stats entry.""" def __init__(self, **kwargs): """Initialize the record. **kwargs keys need to correspond to elements in __slots__. These arguments can be lists: - cmd_args - cmd_base - cmd_line If unset, the |username| and |host| attributes will be deter...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Stats: """Entity object for a stats entry.""" def __init__(self, **kwargs): """Initialize the record. **kwargs keys need to correspond to elements in __slots__. These arguments can be lists: - cmd_args - cmd_base - cmd_line If unset, the |username| and |host| attributes will be determined automat...
the_stack_v2_python_sparse
third_party/chromite/lib/stats.py
metux/chromium-suckless
train
5
949909c103bfbcd9b9b0f1250e66cc2695491108
[ "if RedisPool.__pool == None:\n RedisPool()\nreturn RedisPool.__pool", "if RedisPool.__pool != None:\n logger.info('Using redis pool singleton')\nelse:\n try:\n RedisPool.__pool = redis.ConnectionPool(host=REDIS_HOST, port=int(REDIS_PORT), db=0, decode_responses=True)\n except Exception as e:\n...
<|body_start_0|> if RedisPool.__pool == None: RedisPool() return RedisPool.__pool <|end_body_0|> <|body_start_1|> if RedisPool.__pool != None: logger.info('Using redis pool singleton') else: try: RedisPool.__pool = redis.ConnectionPool...
RedisPool
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RedisPool: def getPool(): """Static access method.""" <|body_0|> def __init__(self): """Virtually private constructor.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if RedisPool.__pool == None: RedisPool() return RedisPool.__po...
stack_v2_sparse_classes_75kplus_train_066939
2,420
permissive
[ { "docstring": "Static access method.", "name": "getPool", "signature": "def getPool()" }, { "docstring": "Virtually private constructor.", "name": "__init__", "signature": "def __init__(self)" } ]
2
stack_v2_sparse_classes_30k_train_037098
Implement the Python class `RedisPool` described below. Class description: Implement the RedisPool class. Method signatures and docstrings: - def getPool(): Static access method. - def __init__(self): Virtually private constructor.
Implement the Python class `RedisPool` described below. Class description: Implement the RedisPool class. Method signatures and docstrings: - def getPool(): Static access method. - def __init__(self): Virtually private constructor. <|skeleton|> class RedisPool: def getPool(): """Static access method."""...
7da0de453163130e116611f0ed750414d6d5c107
<|skeleton|> class RedisPool: def getPool(): """Static access method.""" <|body_0|> def __init__(self): """Virtually private constructor.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RedisPool: def getPool(): """Static access method.""" if RedisPool.__pool == None: RedisPool() return RedisPool.__pool def __init__(self): """Virtually private constructor.""" if RedisPool.__pool != None: logger.info('Using redis pool single...
the_stack_v2_python_sparse
gamechangerml/api/utils/redisdriver.py
iamjoshbinder/gamechanger-ml
train
0
cc15e2111cd96a422debe0d6bf491ae7cdd6723a
[ "self.x = kwargs.get('x')\nself.y = kwargs.get('y')\nself.z = kwargs.get('z')", "self.x = kwargs['x']\nself.y = kwargs['y']\nself.z = kwargs['z']", "ret = {}\nret['x'] = sockutil.dump(self.x)\nret['y'] = sockutil.dump(self.y)\nret['z'] = sockutil.dump(self.z)\nreturn ret" ]
<|body_start_0|> self.x = kwargs.get('x') self.y = kwargs.get('y') self.z = kwargs.get('z') <|end_body_0|> <|body_start_1|> self.x = kwargs['x'] self.y = kwargs['y'] self.z = kwargs['z'] <|end_body_1|> <|body_start_2|> ret = {} ret['x'] = sockutil.dump(s...
Vector3
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Vector3: def __init__(self, **kwargs): """Params: x: float y: float z: float""" <|body_0|> def load(self, **kwargs): """load from dict Exception: KeyError""" <|body_1|> def dump(self): """dump -> dict""" <|body_2|> <|end_skeleton|> <|bo...
stack_v2_sparse_classes_75kplus_train_066940
26,590
no_license
[ { "docstring": "Params: x: float y: float z: float", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "load from dict Exception: KeyError", "name": "load", "signature": "def load(self, **kwargs)" }, { "docstring": "dump -> dict", "name": "dump...
3
stack_v2_sparse_classes_30k_train_009414
Implement the Python class `Vector3` described below. Class description: Implement the Vector3 class. Method signatures and docstrings: - def __init__(self, **kwargs): Params: x: float y: float z: float - def load(self, **kwargs): load from dict Exception: KeyError - def dump(self): dump -> dict
Implement the Python class `Vector3` described below. Class description: Implement the Vector3 class. Method signatures and docstrings: - def __init__(self, **kwargs): Params: x: float y: float z: float - def load(self, **kwargs): load from dict Exception: KeyError - def dump(self): dump -> dict <|skeleton|> class V...
aa0b2697e295889e8c23a7104889ea95f2a4b6b1
<|skeleton|> class Vector3: def __init__(self, **kwargs): """Params: x: float y: float z: float""" <|body_0|> def load(self, **kwargs): """load from dict Exception: KeyError""" <|body_1|> def dump(self): """dump -> dict""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Vector3: def __init__(self, **kwargs): """Params: x: float y: float z: float""" self.x = kwargs.get('x') self.y = kwargs.get('y') self.z = kwargs.get('z') def load(self, **kwargs): """load from dict Exception: KeyError""" self.x = kwargs['x'] self.y...
the_stack_v2_python_sparse
message.py
songhui17/Server
train
0
82bb39dbb7391161dd61f37312a2e56b4923b0f9
[ "is_cloud_admin = self.helper.is_user_cloud_admin()\napps_user_is_admin_on = self.helper.get_owned_apps()\napp_name = self.request.get('appid')\nif not is_cloud_admin and app_name not in apps_user_is_admin_on:\n response = json.dumps({'error': True, 'message': 'Not authorized'})\n self.response.out.write(resp...
<|body_start_0|> is_cloud_admin = self.helper.is_user_cloud_admin() apps_user_is_admin_on = self.helper.get_owned_apps() app_name = self.request.get('appid') if not is_cloud_admin and app_name not in apps_user_is_admin_on: response = json.dumps({'error': True, 'message': 'Not...
Class that returns instance statistics in JSON relating to the number of AppServer processes running for a particular App Engine application.
InstanceStats
[ "Apache-2.0", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InstanceStats: """Class that returns instance statistics in JSON relating to the number of AppServer processes running for a particular App Engine application.""" def get(self): """Makes sure the user is allowed to see instance data for the named application, and if so, retrieves it ...
stack_v2_sparse_classes_75kplus_train_066941
37,207
permissive
[ { "docstring": "Makes sure the user is allowed to see instance data for the named application, and if so, retrieves it for them.", "name": "get", "signature": "def get(self)" }, { "docstring": "Adds information about one or more instances to the Datastore, for later viewing.", "name": "post"...
4
stack_v2_sparse_classes_30k_train_051257
Implement the Python class `InstanceStats` described below. Class description: Class that returns instance statistics in JSON relating to the number of AppServer processes running for a particular App Engine application. Method signatures and docstrings: - def get(self): Makes sure the user is allowed to see instance...
Implement the Python class `InstanceStats` described below. Class description: Class that returns instance statistics in JSON relating to the number of AppServer processes running for a particular App Engine application. Method signatures and docstrings: - def get(self): Makes sure the user is allowed to see instance...
aa36e8dfaa295d53bec616ed07f91ec8c02fa4e1
<|skeleton|> class InstanceStats: """Class that returns instance statistics in JSON relating to the number of AppServer processes running for a particular App Engine application.""" def get(self): """Makes sure the user is allowed to see instance data for the named application, and if so, retrieves it ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InstanceStats: """Class that returns instance statistics in JSON relating to the number of AppServer processes running for a particular App Engine application.""" def get(self): """Makes sure the user is allowed to see instance data for the named application, and if so, retrieves it for them.""" ...
the_stack_v2_python_sparse
AppDashboard/dashboard.py
shatterednirvana/appscale
train
6
c5aebebcdb80e7bb2c9bfc9455db58b8cb505858
[ "self.name = 'Alien Invasion'\nself.screen_width = 1200\nself.screen_height = 800\nself.bg_color = (230, 230, 230)\nself.ship_limit = 3\nself.bullet_width = 10\nself.bullet_height = 15\nself.bullet_color = (60, 60, 60)\nself.bullet_allowed = 10\nself.fleet_drop_speed = 20.0\nself.speedup_scale = 1.1\nself.score_sca...
<|body_start_0|> self.name = 'Alien Invasion' self.screen_width = 1200 self.screen_height = 800 self.bg_color = (230, 230, 230) self.ship_limit = 3 self.bullet_width = 10 self.bullet_height = 15 self.bullet_color = (60, 60, 60) self.bullet_allowed ...
存储《外星人入侵》所有设置的类
Settings
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Settings: """存储《外星人入侵》所有设置的类""" def __init__(self): """初始化游戏设置""" <|body_0|> def initialize_dyanmic_settings(self): """初始化随游戏进行而变化的设置""" <|body_1|> def increase_speed(self): """提高速度设置和外星人点数""" <|body_2|> <|end_skeleton|> <|body_star...
stack_v2_sparse_classes_75kplus_train_066942
1,683
no_license
[ { "docstring": "初始化游戏设置", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "初始化随游戏进行而变化的设置", "name": "initialize_dyanmic_settings", "signature": "def initialize_dyanmic_settings(self)" }, { "docstring": "提高速度设置和外星人点数", "name": "increase_speed", "sig...
3
stack_v2_sparse_classes_30k_train_051296
Implement the Python class `Settings` described below. Class description: 存储《外星人入侵》所有设置的类 Method signatures and docstrings: - def __init__(self): 初始化游戏设置 - def initialize_dyanmic_settings(self): 初始化随游戏进行而变化的设置 - def increase_speed(self): 提高速度设置和外星人点数
Implement the Python class `Settings` described below. Class description: 存储《外星人入侵》所有设置的类 Method signatures and docstrings: - def __init__(self): 初始化游戏设置 - def initialize_dyanmic_settings(self): 初始化随游戏进行而变化的设置 - def increase_speed(self): 提高速度设置和外星人点数 <|skeleton|> class Settings: """存储《外星人入侵》所有设置的类""" def __...
11145f9fe4d9b0d5a9cb351c75dd673004b8f30d
<|skeleton|> class Settings: """存储《外星人入侵》所有设置的类""" def __init__(self): """初始化游戏设置""" <|body_0|> def initialize_dyanmic_settings(self): """初始化随游戏进行而变化的设置""" <|body_1|> def increase_speed(self): """提高速度设置和外星人点数""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Settings: """存储《外星人入侵》所有设置的类""" def __init__(self): """初始化游戏设置""" self.name = 'Alien Invasion' self.screen_width = 1200 self.screen_height = 800 self.bg_color = (230, 230, 230) self.ship_limit = 3 self.bullet_width = 10 self.bullet_height = ...
the_stack_v2_python_sparse
alien_invasion/settings.py
shijiegong123/myPythonProject
train
0
a6a81615763395e47f8090e701dc97339f80e756
[ "if data.ndim != 2:\n print('Data must be a 2d array')\n return None\nn, m = data.shape\nself.num = n\nself.semean = [np.mean(data[:, i]) for i in range(m)]\nself.semedian = [np.median(data[:, i]) for i in range(m)]\nself.lowerquart = np.zeros(m)\nself.upperquart = np.zeros(m)\nfor i in range(m):\n dum = n...
<|body_start_0|> if data.ndim != 2: print('Data must be a 2d array') return None n, m = data.shape self.num = n self.semean = [np.mean(data[:, i]) for i in range(m)] self.semedian = [np.median(data[:, i]) for i in range(m)] self.lowerquart = np.zer...
Class to conduct a superposed epoch analysis on dataset returning the mean,median, and quartile information
sea
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class sea: """Class to conduct a superposed epoch analysis on dataset returning the mean,median, and quartile information""" def __init__(self, data): """User provides a (n,m) data array with n being the number of epochs and m being the length of the analysis window Returns the mean,median...
stack_v2_sparse_classes_75kplus_train_066943
1,538
no_license
[ { "docstring": "User provides a (n,m) data array with n being the number of epochs and m being the length of the analysis window Returns the mean,median, lower quartile, and upper quartile as numpy arrays of size m", "name": "__init__", "signature": "def __init__(self, data)" }, { "docstring": "...
2
null
Implement the Python class `sea` described below. Class description: Class to conduct a superposed epoch analysis on dataset returning the mean,median, and quartile information Method signatures and docstrings: - def __init__(self, data): User provides a (n,m) data array with n being the number of epochs and m being ...
Implement the Python class `sea` described below. Class description: Class to conduct a superposed epoch analysis on dataset returning the mean,median, and quartile information Method signatures and docstrings: - def __init__(self, data): User provides a (n,m) data array with n being the number of epochs and m being ...
bb00b8292bf5f3e191cb48b981c25453a3615b65
<|skeleton|> class sea: """Class to conduct a superposed epoch analysis on dataset returning the mean,median, and quartile information""" def __init__(self, data): """User provides a (n,m) data array with n being the number of epochs and m being the length of the analysis window Returns the mean,median...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class sea: """Class to conduct a superposed epoch analysis on dataset returning the mean,median, and quartile information""" def __init__(self, data): """User provides a (n,m) data array with n being the number of epochs and m being the length of the analysis window Returns the mean,median, lower quart...
the_stack_v2_python_sparse
pyLTR/Tools/sea.py
erigler-usgs/pyLTR
train
0
ad6a05892e617584bcbda7ad6b4e46120f97f57a
[ "n = len(nums)\ndp = [[[]] for _ in range(n + 1)]\nfor i in range(1, n + 1):\n dp[i] = dp[i - 1] + [x + [nums[i - 1]] for x in dp[i - 1]]\nreturn dp[-1]", "res = [[]]\nfor i in nums:\n res += [t + [i] for t in res]\nreturn res" ]
<|body_start_0|> n = len(nums) dp = [[[]] for _ in range(n + 1)] for i in range(1, n + 1): dp[i] = dp[i - 1] + [x + [nums[i - 1]] for x in dp[i - 1]] return dp[-1] <|end_body_0|> <|body_start_1|> res = [[]] for i in nums: res += [t + [i] for t in ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def subsets(self, nums): """从前往后遍历,遇到一个数则就把上一个的所有子集 加上该数组成新的子集 [1]的子集: [[],[1]] [1,2]的子集: [[],[1]] + [[]+[2],[1]+[2]] dp[i] 前i个数的所有子集 :param nums: :return:""" <|body_0|> def subsets2(self, nums): """节省空间 dp[i]只与dp[i-1]有关 所以只需要记录最后一个res就行了""" <|body_...
stack_v2_sparse_classes_75kplus_train_066944
1,185
no_license
[ { "docstring": "从前往后遍历,遇到一个数则就把上一个的所有子集 加上该数组成新的子集 [1]的子集: [[],[1]] [1,2]的子集: [[],[1]] + [[]+[2],[1]+[2]] dp[i] 前i个数的所有子集 :param nums: :return:", "name": "subsets", "signature": "def subsets(self, nums)" }, { "docstring": "节省空间 dp[i]只与dp[i-1]有关 所以只需要记录最后一个res就行了", "name": "subsets2", "si...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subsets(self, nums): 从前往后遍历,遇到一个数则就把上一个的所有子集 加上该数组成新的子集 [1]的子集: [[],[1]] [1,2]的子集: [[],[1]] + [[]+[2],[1]+[2]] dp[i] 前i个数的所有子集 :param nums: :return: - def subsets2(self, nums...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subsets(self, nums): 从前往后遍历,遇到一个数则就把上一个的所有子集 加上该数组成新的子集 [1]的子集: [[],[1]] [1,2]的子集: [[],[1]] + [[]+[2],[1]+[2]] dp[i] 前i个数的所有子集 :param nums: :return: - def subsets2(self, nums...
5d3574ccd282d0146c83c286ae28d8baaabd4910
<|skeleton|> class Solution: def subsets(self, nums): """从前往后遍历,遇到一个数则就把上一个的所有子集 加上该数组成新的子集 [1]的子集: [[],[1]] [1,2]的子集: [[],[1]] + [[]+[2],[1]+[2]] dp[i] 前i个数的所有子集 :param nums: :return:""" <|body_0|> def subsets2(self, nums): """节省空间 dp[i]只与dp[i-1]有关 所以只需要记录最后一个res就行了""" <|body_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def subsets(self, nums): """从前往后遍历,遇到一个数则就把上一个的所有子集 加上该数组成新的子集 [1]的子集: [[],[1]] [1,2]的子集: [[],[1]] + [[]+[2],[1]+[2]] dp[i] 前i个数的所有子集 :param nums: :return:""" n = len(nums) dp = [[[]] for _ in range(n + 1)] for i in range(1, n + 1): dp[i] = dp[i - 1] + [x ...
the_stack_v2_python_sparse
78_子集.py
lovehhf/LeetCode
train
0
e767234d860b04d844ab98d7e41aa068f97f0efb
[ "if dispatch in self.poll_answers and (not self.voted):\n temp_poll_answers = self.poll_answers\n temp_poll_answers[dispatch] += 1\n self.poll_answers = temp_poll_answers\n self.voted = True\n self.poll_answer = dispatch\n return json.dumps({'poll_answers': self.poll_answers, 'total': sum(self.pol...
<|body_start_0|> if dispatch in self.poll_answers and (not self.voted): temp_poll_answers = self.poll_answers temp_poll_answers[dispatch] += 1 self.poll_answers = temp_poll_answers self.voted = True self.poll_answer = dispatch return json.d...
Poll Module
PollBlock
[ "AGPL-3.0-only", "AGPL-3.0-or-later", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PollBlock: """Poll Module""" def handle_ajax(self, dispatch, data): """Ajax handler. Args: dispatch: string request slug data: dict request data parameters Returns: json string""" <|body_0|> def student_view(self, _context): """Renders the student view.""" ...
stack_v2_sparse_classes_75kplus_train_066945
9,113
permissive
[ { "docstring": "Ajax handler. Args: dispatch: string request slug data: dict request data parameters Returns: json string", "name": "handle_ajax", "signature": "def handle_ajax(self, dispatch, data)" }, { "docstring": "Renders the student view.", "name": "student_view", "signature": "def...
5
stack_v2_sparse_classes_30k_val_000605
Implement the Python class `PollBlock` described below. Class description: Poll Module Method signatures and docstrings: - def handle_ajax(self, dispatch, data): Ajax handler. Args: dispatch: string request slug data: dict request data parameters Returns: json string - def student_view(self, _context): Renders the st...
Implement the Python class `PollBlock` described below. Class description: Poll Module Method signatures and docstrings: - def handle_ajax(self, dispatch, data): Ajax handler. Args: dispatch: string request slug data: dict request data parameters Returns: json string - def student_view(self, _context): Renders the st...
5809eaca7079a15ee56b0b7fcfea425337046c97
<|skeleton|> class PollBlock: """Poll Module""" def handle_ajax(self, dispatch, data): """Ajax handler. Args: dispatch: string request slug data: dict request data parameters Returns: json string""" <|body_0|> def student_view(self, _context): """Renders the student view.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PollBlock: """Poll Module""" def handle_ajax(self, dispatch, data): """Ajax handler. Args: dispatch: string request slug data: dict request data parameters Returns: json string""" if dispatch in self.poll_answers and (not self.voted): temp_poll_answers = self.poll_answers ...
the_stack_v2_python_sparse
Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/common/lib/xmodule/xmodule/poll_module.py
luque/better-ways-of-thinking-about-software
train
3
cc4a92e6c57e061dde4c4601695171de66c6e4dc
[ "ratio_product = 1\nfor i in ratio:\n ratio_product *= i\naddress_space_size = int(math.log(ratio_product, 2))\nword_size = Vector(*word_size)\nsuper(MemoryAccessUnit, self).__init__(address_space_size)\nself.input_address = self.add_input(input_address)\nself.ratio = Vector(*ratio)\nself.word_size = word_size\n...
<|body_start_0|> ratio_product = 1 for i in ratio: ratio_product *= i address_space_size = int(math.log(ratio_product, 2)) word_size = Vector(*word_size) super(MemoryAccessUnit, self).__init__(address_space_size) self.input_address = self.add_input(input_addre...
This unit provides basic functionality for accessing memory and preforming some user-defined action. See example of use in the ReadUnit.
MemoryAccessUnit
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MemoryAccessUnit: """This unit provides basic functionality for accessing memory and preforming some user-defined action. See example of use in the ReadUnit.""" def __init__(self, ratio=(1, 16, 16), word_size=(8, 1, 1), raw_memory=None, input_address=std_logic.InputRegister): """:par...
stack_v2_sparse_classes_75kplus_train_066946
6,650
no_license
[ { "docstring": ":param ratio: The ration of words distributed in 3D space. :param word_size: the size of a word. by default it is a 8 bits facing east. :param raw_memory: This is the actual \"raw\" memory on which this access unit is operating. If no is specified, Memory block will be generated from the ratios ...
2
stack_v2_sparse_classes_30k_train_044225
Implement the Python class `MemoryAccessUnit` described below. Class description: This unit provides basic functionality for accessing memory and preforming some user-defined action. See example of use in the ReadUnit. Method signatures and docstrings: - def __init__(self, ratio=(1, 16, 16), word_size=(8, 1, 1), raw_...
Implement the Python class `MemoryAccessUnit` described below. Class description: This unit provides basic functionality for accessing memory and preforming some user-defined action. See example of use in the ReadUnit. Method signatures and docstrings: - def __init__(self, ratio=(1, 16, 16), word_size=(8, 1, 1), raw_...
8bbb26b2c3bbaa0712b5321d85b9f3834a0016fb
<|skeleton|> class MemoryAccessUnit: """This unit provides basic functionality for accessing memory and preforming some user-defined action. See example of use in the ReadUnit.""" def __init__(self, ratio=(1, 16, 16), word_size=(8, 1, 1), raw_memory=None, input_address=std_logic.InputRegister): """:par...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MemoryAccessUnit: """This unit provides basic functionality for accessing memory and preforming some user-defined action. See example of use in the ReadUnit.""" def __init__(self, ratio=(1, 16, 16), word_size=(8, 1, 1), raw_memory=None, input_address=std_logic.InputRegister): """:param ratio: The...
the_stack_v2_python_sparse
cbac/std_unit/ram_unit.py
bowiz2/cbac
train
1
97c8f9bf93a7fb14a83ce34d692cfce38d97cca4
[ "self.entry_id = entry_id\nself.entry_markers = entry_markers\nself._idgen = IDGenerator('LX')\nself._idset = set()\nself.entries = sfm.SFM()", "new_entry, rest = split_by_pred(lambda pair: pair[0] in self.entry_markers, entry, constructor=sfm.Entry)\nif not new_entry:\n return False\noriginal_id = entry.get(s...
<|body_start_0|> self.entry_id = entry_id self.entry_markers = entry_markers self._idgen = IDGenerator('LX') self._idset = set() self.entries = sfm.SFM() <|end_body_0|> <|body_start_1|> new_entry, rest = split_by_pred(lambda pair: pair[0] in self.entry_markers, entry, co...
Visitor for extracting Entry information from an SFM entry.
EntryExtractor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EntryExtractor: """Visitor for extracting Entry information from an SFM entry.""" def __init__(self, entry_id, entry_markers): """Create an entry extractor. :arg entry_id: marker, which contains the entry's original ID :arg entry_markers: collection of markers, which make up an entry...
stack_v2_sparse_classes_75kplus_train_066947
44,273
permissive
[ { "docstring": "Create an entry extractor. :arg entry_id: marker, which contains the entry's original ID :arg entry_markers: collection of markers, which make up an entry (as opposed to a sense or an example)", "name": "__init__", "signature": "def __init__(self, entry_id, entry_markers)" }, { "...
2
stack_v2_sparse_classes_30k_train_051417
Implement the Python class `EntryExtractor` described below. Class description: Visitor for extracting Entry information from an SFM entry. Method signatures and docstrings: - def __init__(self, entry_id, entry_markers): Create an entry extractor. :arg entry_id: marker, which contains the entry's original ID :arg ent...
Implement the Python class `EntryExtractor` described below. Class description: Visitor for extracting Entry information from an SFM entry. Method signatures and docstrings: - def __init__(self, entry_id, entry_markers): Create an entry extractor. :arg entry_id: marker, which contains the entry's original ID :arg ent...
9fcb35608ab7ce0df3f02a88aba893ce3920e48a
<|skeleton|> class EntryExtractor: """Visitor for extracting Entry information from an SFM entry.""" def __init__(self, entry_id, entry_markers): """Create an entry extractor. :arg entry_id: marker, which contains the entry's original ID :arg entry_markers: collection of markers, which make up an entry...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EntryExtractor: """Visitor for extracting Entry information from an SFM entry.""" def __init__(self, entry_id, entry_markers): """Create an entry extractor. :arg entry_id: marker, which contains the entry's original ID :arg entry_markers: collection of markers, which make up an entry (as opposed ...
the_stack_v2_python_sparse
src/pydictionaria/sfm2cldf.py
dictionaria/pydictionaria
train
1
9dd7e373e2490f0bffea69098130256586d35efb
[ "assert type(var_scope) == str\nassert type(config) == dict\nassert X.shape == (config['n_batches'], config['n_input'])\nwith tf.variable_scope(var_scope):\n W = tf.get_variable('W', shape=(config['n_input'], config['n_classes']))\n b = tf.get_variable('bias', shape=config['n_classes'])\n prediction = tf.n...
<|body_start_0|> assert type(var_scope) == str assert type(config) == dict assert X.shape == (config['n_batches'], config['n_input']) with tf.variable_scope(var_scope): W = tf.get_variable('W', shape=(config['n_input'], config['n_classes'])) b = tf.get_variable('b...
Standard TF components.
StandardLayers
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StandardLayers: """Standard TF components.""" def _prediction_layer(self, X, var_scope, config): """Predicts end result Args: - X: input data of shape (batch, features) - var_scope: string name of tf variable scope. - config { 'n_batches': number of batches, 'n_input': number of inpu...
stack_v2_sparse_classes_75kplus_train_066948
4,722
permissive
[ { "docstring": "Predicts end result Args: - X: input data of shape (batch, features) - var_scope: string name of tf variable scope. - config { 'n_batches': number of batches, 'n_input': number of input features, 'n_classes': number of potential output classes }", "name": "_prediction_layer", "signature"...
4
stack_v2_sparse_classes_30k_train_002826
Implement the Python class `StandardLayers` described below. Class description: Standard TF components. Method signatures and docstrings: - def _prediction_layer(self, X, var_scope, config): Predicts end result Args: - X: input data of shape (batch, features) - var_scope: string name of tf variable scope. - config { ...
Implement the Python class `StandardLayers` described below. Class description: Standard TF components. Method signatures and docstrings: - def _prediction_layer(self, X, var_scope, config): Predicts end result Args: - X: input data of shape (batch, features) - var_scope: string name of tf variable scope. - config { ...
6bf608d61722d86e8fab4087b2e725df1cd236ab
<|skeleton|> class StandardLayers: """Standard TF components.""" def _prediction_layer(self, X, var_scope, config): """Predicts end result Args: - X: input data of shape (batch, features) - var_scope: string name of tf variable scope. - config { 'n_batches': number of batches, 'n_input': number of inpu...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class StandardLayers: """Standard TF components.""" def _prediction_layer(self, X, var_scope, config): """Predicts end result Args: - X: input data of shape (batch, features) - var_scope: string name of tf variable scope. - config { 'n_batches': number of batches, 'n_input': number of input features, '...
the_stack_v2_python_sparse
NetDetect/src/model_base/standard_layers.py
joaoceron/NetDetect
train
0
a0a268d7fedd1574c3913652b0e3749cbf222223
[ "test_dictionary = {'donor': 'ME', 'amount': round(float(100), 2)}\nexpected = '\\nDear ME,\\n\\nThank you for your generous donation of $100.00\\n\\nSincerely,\\nThe Charity\\n'\nactual = mailroom4.letter(test_dictionary)\nself.assertEqual(expected, actual)", "expected = [['William Gates, III', '$', 653784.49, 2...
<|body_start_0|> test_dictionary = {'donor': 'ME', 'amount': round(float(100), 2)} expected = '\nDear ME,\n\nThank you for your generous donation of $100.00\n\nSincerely,\nThe Charity\n' actual = mailroom4.letter(test_dictionary) self.assertEqual(expected, actual) <|end_body_0|> <|body_...
Write a class containing a full suite of tests
TestMailroom
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestMailroom: """Write a class containing a full suite of tests""" def test_letter(self): """Test letter output""" <|body_0|> def test_calculation(self): """Test average and donation count calculations""" <|body_1|> def test_table(self): """T...
stack_v2_sparse_classes_75kplus_train_066949
2,174
no_license
[ { "docstring": "Test letter output", "name": "test_letter", "signature": "def test_letter(self)" }, { "docstring": "Test average and donation count calculations", "name": "test_calculation", "signature": "def test_calculation(self)" }, { "docstring": "Test table output format", ...
4
stack_v2_sparse_classes_30k_train_020865
Implement the Python class `TestMailroom` described below. Class description: Write a class containing a full suite of tests Method signatures and docstrings: - def test_letter(self): Test letter output - def test_calculation(self): Test average and donation count calculations - def test_table(self): Test table outpu...
Implement the Python class `TestMailroom` described below. Class description: Write a class containing a full suite of tests Method signatures and docstrings: - def test_letter(self): Test letter output - def test_calculation(self): Test average and donation count calculations - def test_table(self): Test table outpu...
e298b1151dab639659d8dfa56f47bcb43dd3438f
<|skeleton|> class TestMailroom: """Write a class containing a full suite of tests""" def test_letter(self): """Test letter output""" <|body_0|> def test_calculation(self): """Test average and donation count calculations""" <|body_1|> def test_table(self): """T...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestMailroom: """Write a class containing a full suite of tests""" def test_letter(self): """Test letter output""" test_dictionary = {'donor': 'ME', 'amount': round(float(100), 2)} expected = '\nDear ME,\n\nThank you for your generous donation of $100.00\n\nSincerely,\nThe Charity...
the_stack_v2_python_sparse
students/Daniel_Spray/Lesson06/test_mailroom4.py
UWPCE-PythonCert-ClassRepos/Self_Paced-Online
train
13
63be88ee34c7a7c99cee6fb3528d4ecf9bfd7578
[ "self._with_bkg_par = bool(with_bkg_par)\nself._t_start = float(t_start)\nself._exposure = float(exposure)\nself._seed = int(seed)\nself._simput = simput\nself._data_dir = data_dir\nself._ra_cen = ra_cen\nself._dec_cen = dec_cen", "try:\n os.makedirs(self._data_dir)\nexcept OSError as e:\n print('already ex...
<|body_start_0|> self._with_bkg_par = bool(with_bkg_par) self._t_start = float(t_start) self._exposure = float(exposure) self._seed = int(seed) self._simput = simput self._data_dir = data_dir self._ra_cen = ra_cen self._dec_cen = dec_cen <|end_body_0|> <|...
SIXTE simulator for eROSITA observations. 1. Compute GTI file for given simput 2. Simulate eROSITA observations of simput, using GTI to speed things up.
Simulator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Simulator: """SIXTE simulator for eROSITA observations. 1. Compute GTI file for given simput 2. Simulate eROSITA observations of simput, using GTI to speed things up.""" def __init__(self, with_bkg_par, t_start, exposure, seed, simput, data_dir, ra_cen, dec_cen): """:param with_bkg_p...
stack_v2_sparse_classes_75kplus_train_066950
5,418
no_license
[ { "docstring": ":param with_bkg_par: Simulate with particle background. :param t_start: Start time of simulation. Input units of [s] :param exposure: Length of time to simulate for after t_start :param seed: Seed for random number generator. :param simput: Simput file (ie. the sky model)", "name": "__init__...
5
stack_v2_sparse_classes_30k_train_039203
Implement the Python class `Simulator` described below. Class description: SIXTE simulator for eROSITA observations. 1. Compute GTI file for given simput 2. Simulate eROSITA observations of simput, using GTI to speed things up. Method signatures and docstrings: - def __init__(self, with_bkg_par, t_start, exposure, se...
Implement the Python class `Simulator` described below. Class description: SIXTE simulator for eROSITA observations. 1. Compute GTI file for given simput 2. Simulate eROSITA observations of simput, using GTI to speed things up. Method signatures and docstrings: - def __init__(self, with_bkg_par, t_start, exposure, se...
2b8ac686b1d445a39fcd28dbe07ef467c0b14c7e
<|skeleton|> class Simulator: """SIXTE simulator for eROSITA observations. 1. Compute GTI file for given simput 2. Simulate eROSITA observations of simput, using GTI to speed things up.""" def __init__(self, with_bkg_par, t_start, exposure, seed, simput, data_dir, ra_cen, dec_cen): """:param with_bkg_p...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Simulator: """SIXTE simulator for eROSITA observations. 1. Compute GTI file for given simput 2. Simulate eROSITA observations of simput, using GTI to speed things up.""" def __init__(self, with_bkg_par, t_start, exposure, seed, simput, data_dir, ra_cen, dec_cen): """:param with_bkg_par: Simulate ...
the_stack_v2_python_sparse
python/sixte/simulate_agn_only.py
HuiboZhou/mocks_high_fidelity
train
0
0a57c5a3170437619a128837257a2b49a44eddab
[ "super(PingCommand, self).__init__()\nself.target = target\nself.connection = connection\nself.operating_system = operating_system\nself._arguments = None\nself._expression = None\nreturn", "if self._arguments is None:\n try:\n self._arguments = PingArguments.arguments[self.operating_system] + self.targ...
<|body_start_0|> super(PingCommand, self).__init__() self.target = target self.connection = connection self.operating_system = operating_system self._arguments = None self._expression = None return <|end_body_0|> <|body_start_1|> if self._arguments is Non...
A ping is a simple ping-command.
PingCommand
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PingCommand: """A ping is a simple ping-command.""" def __init__(self, target=None, connection=None, operating_system=None): """PingCommand constructor :param: - `target`: An IP Address to ping. - `connection`: A Connection to the device - `operating_system`: The operating system of ...
stack_v2_sparse_classes_75kplus_train_066951
4,487
permissive
[ { "docstring": "PingCommand constructor :param: - `target`: An IP Address to ping. - `connection`: A Connection to the device - `operating_system`: The operating system of the device", "name": "__init__", "signature": "def __init__(self, target=None, connection=None, operating_system=None)" }, { ...
5
stack_v2_sparse_classes_30k_train_051355
Implement the Python class `PingCommand` described below. Class description: A ping is a simple ping-command. Method signatures and docstrings: - def __init__(self, target=None, connection=None, operating_system=None): PingCommand constructor :param: - `target`: An IP Address to ping. - `connection`: A Connection to ...
Implement the Python class `PingCommand` described below. Class description: A ping is a simple ping-command. Method signatures and docstrings: - def __init__(self, target=None, connection=None, operating_system=None): PingCommand constructor :param: - `target`: An IP Address to ping. - `connection`: A Connection to ...
b4d1c77e1d611fe2b30768b42bdc7493afb0ea95
<|skeleton|> class PingCommand: """A ping is a simple ping-command.""" def __init__(self, target=None, connection=None, operating_system=None): """PingCommand constructor :param: - `target`: An IP Address to ping. - `connection`: A Connection to the device - `operating_system`: The operating system of ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PingCommand: """A ping is a simple ping-command.""" def __init__(self, target=None, connection=None, operating_system=None): """PingCommand constructor :param: - `target`: An IP Address to ping. - `connection`: A Connection to the device - `operating_system`: The operating system of the device"""...
the_stack_v2_python_sparse
apetools/commands/ping.py
russell-n/oldape
train
0
763c7d589872762f7d6902eaf1f32c03aab70192
[ "eobjreader = ExtObjReader.ExtObjReader()\ndatlist = [['1'], ['1', '2'], ['1', '2', '3'], ['1', '', '3'], ['1', '2', ''], ['1', '', '']]\nanslist = [[True, False, False], [True, True, False], [True, True, True], [True, False, True], [True, True, False], [True, False, False]]\nn = len(datlist)\ni = 0\nwhile i < n:\n...
<|body_start_0|> eobjreader = ExtObjReader.ExtObjReader() datlist = [['1'], ['1', '2'], ['1', '2', '3'], ['1', '', '3'], ['1', '2', ''], ['1', '', '']] anslist = [[True, False, False], [True, True, False], [True, True, True], [True, False, True], [True, True, False], [True, False, False]] ...
test for extended obj file reader
TestExtObjReader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestExtObjReader: """test for extended obj file reader""" def test_extobjreader_unit0(self): """extended objreader test 0""" <|body_0|> def test_extobjreader_sample0(self): """extended objreader sample0""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_066952
2,184
no_license
[ { "docstring": "extended objreader test 0", "name": "test_extobjreader_unit0", "signature": "def test_extobjreader_unit0(self)" }, { "docstring": "extended objreader sample0", "name": "test_extobjreader_sample0", "signature": "def test_extobjreader_sample0(self)" } ]
2
null
Implement the Python class `TestExtObjReader` described below. Class description: test for extended obj file reader Method signatures and docstrings: - def test_extobjreader_unit0(self): extended objreader test 0 - def test_extobjreader_sample0(self): extended objreader sample0
Implement the Python class `TestExtObjReader` described below. Class description: test for extended obj file reader Method signatures and docstrings: - def test_extobjreader_unit0(self): extended objreader test 0 - def test_extobjreader_sample0(self): extended objreader sample0 <|skeleton|> class TestExtObjReader: ...
f163b6b9e15100d223ddf4e180727a2b63fbae2d
<|skeleton|> class TestExtObjReader: """test for extended obj file reader""" def test_extobjreader_unit0(self): """extended objreader test 0""" <|body_0|> def test_extobjreader_sample0(self): """extended objreader sample0""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestExtObjReader: """test for extended obj file reader""" def test_extobjreader_unit0(self): """extended objreader test 0""" eobjreader = ExtObjReader.ExtObjReader() datlist = [['1'], ['1', '2'], ['1', '2', '3'], ['1', '', '3'], ['1', '2', ''], ['1', '', '']] anslist = [[T...
the_stack_v2_python_sparse
obsolete/test_ExtObjReader.py
yamauchih/ifgi-path-tracer
train
0
e8ef54e7460905bdb5b9d2ebc0dc9e7dfa41b1fc
[ "self.output_path = Path(output_path)\nself.games_list = games_list\nself.should_append_to_file = append", "headers = self.games_list[0].keys()\nfile_exists = self.output_path.exists()\nif file_exists and (not self.should_append_to_file):\n os.remove(self.output_path)\nwith self.output_path.open('a') as games_...
<|body_start_0|> self.output_path = Path(output_path) self.games_list = games_list self.should_append_to_file = append <|end_body_0|> <|body_start_1|> headers = self.games_list[0].keys() file_exists = self.output_path.exists() if file_exists and (not self.should_append_t...
Writes data for games to output csv as series of features
GameWriter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GameWriter: """Writes data for games to output csv as series of features""" def __init__(self, output_path, games_list, append=False): """:param output_path: specify the output path for the csv file :param games_list: list of games to write (each game gets its own row) :param append:...
stack_v2_sparse_classes_75kplus_train_066953
1,346
no_license
[ { "docstring": ":param output_path: specify the output path for the csv file :param games_list: list of games to write (each game gets its own row) :param append: open in append mode", "name": "__init__", "signature": "def __init__(self, output_path, games_list, append=False)" }, { "docstring": ...
2
stack_v2_sparse_classes_30k_train_023464
Implement the Python class `GameWriter` described below. Class description: Writes data for games to output csv as series of features Method signatures and docstrings: - def __init__(self, output_path, games_list, append=False): :param output_path: specify the output path for the csv file :param games_list: list of g...
Implement the Python class `GameWriter` described below. Class description: Writes data for games to output csv as series of features Method signatures and docstrings: - def __init__(self, output_path, games_list, append=False): :param output_path: specify the output path for the csv file :param games_list: list of g...
c2c833a7de6a63cbd058929fb992f28740851e4a
<|skeleton|> class GameWriter: """Writes data for games to output csv as series of features""" def __init__(self, output_path, games_list, append=False): """:param output_path: specify the output path for the csv file :param games_list: list of games to write (each game gets its own row) :param append:...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GameWriter: """Writes data for games to output csv as series of features""" def __init__(self, output_path, games_list, append=False): """:param output_path: specify the output path for the csv file :param games_list: list of games to write (each game gets its own row) :param append: open in appe...
the_stack_v2_python_sparse
score_writer/game_writer.py
CHeffernan087/NBA_Machine_Learning_Model
train
0
42e276dba5736f372e79251e55eb095fa8cd7a88
[ "super(BayesianLinearRegression, self).__init__(basis_function, mu, s, deg)\nself.S = None\nself.M = None\nself.N = 0\nself.alpha = alpha\nself.beta = beta", "self.N = X.shape[0]\nif optimize_evidence:\n self._optimize_evidence(X, y, max_iter, threshold)\ndesign_mat = self.make_design_mat(X)\nself.M = design_m...
<|body_start_0|> super(BayesianLinearRegression, self).__init__(basis_function, mu, s, deg) self.S = None self.M = None self.N = 0 self.alpha = alpha self.beta = beta <|end_body_0|> <|body_start_1|> self.N = X.shape[0] if optimize_evidence: se...
BayesianLinearRegression
BayesianLinearRegression
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BayesianLinearRegression: """BayesianLinearRegression""" def __init__(self, alpha=0.1, beta=0.1, basis_function='gauss', mu=None, s=None, deg=None): """Args: alpha (float) : regularization parameter beta (float) : precision parameter basis_funtion (str) : "gauss" or "sigmoid" or "pol...
stack_v2_sparse_classes_75kplus_train_066954
8,340
permissive
[ { "docstring": "Args: alpha (float) : regularization parameter beta (float) : precision parameter basis_funtion (str) : \"gauss\" or \"sigmoid\" or \"polynomial\" mu (1-D array) : mean parameter s (1-D array) : standard deviation parameter deg (int) : max degree of polynomial features Node: alpha/beta performs ...
6
stack_v2_sparse_classes_30k_train_006889
Implement the Python class `BayesianLinearRegression` described below. Class description: BayesianLinearRegression Method signatures and docstrings: - def __init__(self, alpha=0.1, beta=0.1, basis_function='gauss', mu=None, s=None, deg=None): Args: alpha (float) : regularization parameter beta (float) : precision par...
Implement the Python class `BayesianLinearRegression` described below. Class description: BayesianLinearRegression Method signatures and docstrings: - def __init__(self, alpha=0.1, beta=0.1, basis_function='gauss', mu=None, s=None, deg=None): Args: alpha (float) : regularization parameter beta (float) : precision par...
992f2c07e88b2bad331e08303bdba84684f04d40
<|skeleton|> class BayesianLinearRegression: """BayesianLinearRegression""" def __init__(self, alpha=0.1, beta=0.1, basis_function='gauss', mu=None, s=None, deg=None): """Args: alpha (float) : regularization parameter beta (float) : precision parameter basis_funtion (str) : "gauss" or "sigmoid" or "pol...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BayesianLinearRegression: """BayesianLinearRegression""" def __init__(self, alpha=0.1, beta=0.1, basis_function='gauss', mu=None, s=None, deg=None): """Args: alpha (float) : regularization parameter beta (float) : precision parameter basis_funtion (str) : "gauss" or "sigmoid" or "polynomial" mu (...
the_stack_v2_python_sparse
prml/linear_regression.py
hedwig100/PRML
train
1
166d255aab158dab1c97c2b8db277b8e6a76c206
[ "n = len(nums)\nresult = []\n\ndef backtrack(first=0):\n if first == n:\n result.append(nums[:])\n for i in range(first, n):\n nums[first], nums[i] = (nums[i], nums[first])\n backtrack(first + 1)\n nums[first], nums[i] = (nums[i], nums[first])\nbacktrack()\nreturn result", "def b...
<|body_start_0|> n = len(nums) result = [] def backtrack(first=0): if first == n: result.append(nums[:]) for i in range(first, n): nums[first], nums[i] = (nums[i], nums[first]) backtrack(first + 1) nums[firs...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def permute(self, nums: List[int]) -> List[List[int]]: """46. 全排列 给定一个 没有重复 数字的序列,返回其所有可能的全排列。""" <|body_0|> def permuteUnique(self, nums: List[int]) -> List[List[int]]: """47. 全排列 II 给定一个可包含重复数字的序列,返回所有不重复的全排列。""" <|body_1|> <|end_skeleton|> <|bo...
stack_v2_sparse_classes_75kplus_train_066955
1,593
no_license
[ { "docstring": "46. 全排列 给定一个 没有重复 数字的序列,返回其所有可能的全排列。", "name": "permute", "signature": "def permute(self, nums: List[int]) -> List[List[int]]" }, { "docstring": "47. 全排列 II 给定一个可包含重复数字的序列,返回所有不重复的全排列。", "name": "permuteUnique", "signature": "def permuteUnique(self, nums: List[int]) -> Li...
2
stack_v2_sparse_classes_30k_train_029500
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def permute(self, nums: List[int]) -> List[List[int]]: 46. 全排列 给定一个 没有重复 数字的序列,返回其所有可能的全排列。 - def permuteUnique(self, nums: List[int]) -> List[List[int]]: 47. 全排列 II 给定一个可包含重复数字的...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def permute(self, nums: List[int]) -> List[List[int]]: 46. 全排列 给定一个 没有重复 数字的序列,返回其所有可能的全排列。 - def permuteUnique(self, nums: List[int]) -> List[List[int]]: 47. 全排列 II 给定一个可包含重复数字的...
6580c7fd9a62494f82cedf69edda793865b5bd2d
<|skeleton|> class Solution: def permute(self, nums: List[int]) -> List[List[int]]: """46. 全排列 给定一个 没有重复 数字的序列,返回其所有可能的全排列。""" <|body_0|> def permuteUnique(self, nums: List[int]) -> List[List[int]]: """47. 全排列 II 给定一个可包含重复数字的序列,返回所有不重复的全排列。""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def permute(self, nums: List[int]) -> List[List[int]]: """46. 全排列 给定一个 没有重复 数字的序列,返回其所有可能的全排列。""" n = len(nums) result = [] def backtrack(first=0): if first == n: result.append(nums[:]) for i in range(first, n): ...
the_stack_v2_python_sparse
Week_03/permutations.py
ZGingko/algorithm008-class02
train
0
83bbcf4648a55d6e84c5f8ee27b27ce040b290e1
[ "extra_data = {}\nif instance.profile:\n extra_data.update(SocialAuthProfileSerializer(instance.profile).data)\nreturn extra_data", "if 'next' in data:\n backend = self.context['backend']\n redirect_uri = data['next']\n if backend.setting('SANITIZE_REDIRECTS', True):\n allowed_hosts = backend.s...
<|body_start_0|> extra_data = {} if instance.profile: extra_data.update(SocialAuthProfileSerializer(instance.profile).data) return extra_data <|end_body_0|> <|body_start_1|> if 'next' in data: backend = self.context['backend'] redirect_uri = data['nex...
Serializer for social auth
SocialAuthSerializer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SocialAuthSerializer: """Serializer for social auth""" def get_extra_data(self, instance): """Serialize extra_data""" <|body_0|> def _save_next(self, data): """Persists the next url to the session""" <|body_1|> def _authenticate(self, flow): ...
stack_v2_sparse_classes_75kplus_train_066956
11,156
permissive
[ { "docstring": "Serialize extra_data", "name": "get_extra_data", "signature": "def get_extra_data(self, instance)" }, { "docstring": "Persists the next url to the session", "name": "_save_next", "signature": "def _save_next(self, data)" }, { "docstring": "Authenticate the current...
4
stack_v2_sparse_classes_30k_train_027605
Implement the Python class `SocialAuthSerializer` described below. Class description: Serializer for social auth Method signatures and docstrings: - def get_extra_data(self, instance): Serialize extra_data - def _save_next(self, data): Persists the next url to the session - def _authenticate(self, flow): Authenticate...
Implement the Python class `SocialAuthSerializer` described below. Class description: Serializer for social auth Method signatures and docstrings: - def get_extra_data(self, instance): Serialize extra_data - def _save_next(self, data): Persists the next url to the session - def _authenticate(self, flow): Authenticate...
ba7442482da97d463302658c0aac989567ee1241
<|skeleton|> class SocialAuthSerializer: """Serializer for social auth""" def get_extra_data(self, instance): """Serialize extra_data""" <|body_0|> def _save_next(self, data): """Persists the next url to the session""" <|body_1|> def _authenticate(self, flow): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SocialAuthSerializer: """Serializer for social auth""" def get_extra_data(self, instance): """Serialize extra_data""" extra_data = {} if instance.profile: extra_data.update(SocialAuthProfileSerializer(instance.profile).data) return extra_data def _save_nex...
the_stack_v2_python_sparse
authentication/serializers.py
mitodl/open-discussions
train
13
4656602306d83d8f4bffb11f375f730a7639a065
[ "odooclient = odoo_client.get_odoo_client()\nproject_id = request.keystone_user['project_id']\nproject_search = [('tenant_id', '=', project_id)]\ntry:\n odoo_project_id = odooclient.projects.list(project_search, read=True)[0]['id']\nexcept IndexError:\n return Response({'errors': ['Project not found']}, statu...
<|body_start_0|> odooclient = odoo_client.get_odoo_client() project_id = request.keystone_user['project_id'] project_search = [('tenant_id', '=', project_id)] try: odoo_project_id = odooclient.projects.list(project_search, read=True)[0]['id'] except IndexError: ...
AccountDetailsManagement
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AccountDetailsManagement: def get(self, request): """View Account Details""" <|body_0|> def post(self, request): """Update Account Details""" <|body_1|> <|end_skeleton|> <|body_start_0|> odooclient = odoo_client.get_odoo_client() project_id ...
stack_v2_sparse_classes_75kplus_train_066957
7,915
permissive
[ { "docstring": "View Account Details", "name": "get", "signature": "def get(self, request)" }, { "docstring": "Update Account Details", "name": "post", "signature": "def post(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_020014
Implement the Python class `AccountDetailsManagement` described below. Class description: Implement the AccountDetailsManagement class. Method signatures and docstrings: - def get(self, request): View Account Details - def post(self, request): Update Account Details
Implement the Python class `AccountDetailsManagement` described below. Class description: Implement the AccountDetailsManagement class. Method signatures and docstrings: - def get(self, request): View Account Details - def post(self, request): Update Account Details <|skeleton|> class AccountDetailsManagement: ...
6d1e473710e1757b92b4344d65d5bd106677fe36
<|skeleton|> class AccountDetailsManagement: def get(self, request): """View Account Details""" <|body_0|> def post(self, request): """Update Account Details""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AccountDetailsManagement: def get(self, request): """View Account Details""" odooclient = odoo_client.get_odoo_client() project_id = request.keystone_user['project_id'] project_search = [('tenant_id', '=', project_id)] try: odoo_project_id = odooclient.proje...
the_stack_v2_python_sparse
odoo_views/views.py
catalyst-cloud/adjutant-odoo
train
1
39b2110306ffbf176b3fc00fee4e37696b58f44c
[ "group1, group2 = data\ntest_stat = abs(group1.mean() - group2.mean())\nreturn test_stat", "group1, group2 = self.data\nself.n, self.m = (len(group1), len(group2))\nself.pool = np.hstack((group1, group2))", "np.random.shuffle(self.pool)\ndata = (self.pool[:self.n], self.pool[self.n:])\nreturn data" ]
<|body_start_0|> group1, group2 = data test_stat = abs(group1.mean() - group2.mean()) return test_stat <|end_body_0|> <|body_start_1|> group1, group2 = self.data self.n, self.m = (len(group1), len(group2)) self.pool = np.hstack((group1, group2)) <|end_body_1|> <|body_st...
Tests a difference in means by permutation.
DiffMeansPermute
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DiffMeansPermute: """Tests a difference in means by permutation.""" def TestStatistic(self, data): """Computes the test statistic. data: data in whatever form is relevant""" <|body_0|> def MakeModel(self): """Build a model of the null hypothesis.""" <|bod...
stack_v2_sparse_classes_75kplus_train_066958
10,162
permissive
[ { "docstring": "Computes the test statistic. data: data in whatever form is relevant", "name": "TestStatistic", "signature": "def TestStatistic(self, data)" }, { "docstring": "Build a model of the null hypothesis.", "name": "MakeModel", "signature": "def MakeModel(self)" }, { "do...
3
stack_v2_sparse_classes_30k_train_043665
Implement the Python class `DiffMeansPermute` described below. Class description: Tests a difference in means by permutation. Method signatures and docstrings: - def TestStatistic(self, data): Computes the test statistic. data: data in whatever form is relevant - def MakeModel(self): Build a model of the null hypothe...
Implement the Python class `DiffMeansPermute` described below. Class description: Tests a difference in means by permutation. Method signatures and docstrings: - def TestStatistic(self, data): Computes the test statistic. data: data in whatever form is relevant - def MakeModel(self): Build a model of the null hypothe...
30a85d5137db95e01461ad21519bc1bdf294044b
<|skeleton|> class DiffMeansPermute: """Tests a difference in means by permutation.""" def TestStatistic(self, data): """Computes the test statistic. data: data in whatever form is relevant""" <|body_0|> def MakeModel(self): """Build a model of the null hypothesis.""" <|bod...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DiffMeansPermute: """Tests a difference in means by permutation.""" def TestStatistic(self, data): """Computes the test statistic. data: data in whatever form is relevant""" group1, group2 = data test_stat = abs(group1.mean() - group2.mean()) return test_stat def Make...
the_stack_v2_python_sparse
CompStats/hypothesis.py
sunny2309/scipy_conf_notebooks
train
2
c2744166669b99c6e32a885d92505d613db28787
[ "point_cloud_1 = [[[1.0, 1.0, 1.0], [2.0, 2.0, 2.0], [3.0, 3.0, 3.0]]]\npoint_cloud_2 = [[[1.0, 1.0, 1.0], [2.0, 2.0, 2.0], [3.0, 3.0, 3.0]]]\ntf_point_cloud_1 = tf.constant(point_cloud_1)\ntf_point_cloud_2 = tf.constant(point_cloud_2)\ndist1, idx1, dist2, idx2 = tf_nndistance.nn_distance(tf_point_cloud_1, tf_point...
<|body_start_0|> point_cloud_1 = [[[1.0, 1.0, 1.0], [2.0, 2.0, 2.0], [3.0, 3.0, 3.0]]] point_cloud_2 = [[[1.0, 1.0, 1.0], [2.0, 2.0, 2.0], [3.0, 3.0, 3.0]]] tf_point_cloud_1 = tf.constant(point_cloud_1) tf_point_cloud_2 = tf.constant(point_cloud_2) dist1, idx1, dist2, idx2 = tf_n...
NearestNeighborTest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NearestNeighborTest: def test_nn_distance(self): """Test for nearest neighbor algorithm where distance should be 0.""" <|body_0|> def test_nn_distance_2(self): """Test for nearest neighbor algorithm where distance is non-zero.""" <|body_1|> def test_nn_d...
stack_v2_sparse_classes_75kplus_train_066959
4,084
permissive
[ { "docstring": "Test for nearest neighbor algorithm where distance should be 0.", "name": "test_nn_distance", "signature": "def test_nn_distance(self)" }, { "docstring": "Test for nearest neighbor algorithm where distance is non-zero.", "name": "test_nn_distance_2", "signature": "def tes...
5
stack_v2_sparse_classes_30k_train_007708
Implement the Python class `NearestNeighborTest` described below. Class description: Implement the NearestNeighborTest class. Method signatures and docstrings: - def test_nn_distance(self): Test for nearest neighbor algorithm where distance should be 0. - def test_nn_distance_2(self): Test for nearest neighbor algori...
Implement the Python class `NearestNeighborTest` described below. Class description: Implement the NearestNeighborTest class. Method signatures and docstrings: - def test_nn_distance(self): Test for nearest neighbor algorithm where distance should be 0. - def test_nn_distance_2(self): Test for nearest neighbor algori...
f3cb31909666012dfcf38e5fe0b0f6feb3801560
<|skeleton|> class NearestNeighborTest: def test_nn_distance(self): """Test for nearest neighbor algorithm where distance should be 0.""" <|body_0|> def test_nn_distance_2(self): """Test for nearest neighbor algorithm where distance is non-zero.""" <|body_1|> def test_nn_d...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NearestNeighborTest: def test_nn_distance(self): """Test for nearest neighbor algorithm where distance should be 0.""" point_cloud_1 = [[[1.0, 1.0, 1.0], [2.0, 2.0, 2.0], [3.0, 3.0, 3.0]]] point_cloud_2 = [[[1.0, 1.0, 1.0], [2.0, 2.0, 2.0], [3.0, 3.0, 3.0]]] tf_point_cloud_1 = ...
the_stack_v2_python_sparse
src/tf_ops/nn_distance/tf_nndistance_test.py
minghanz/monopsr
train
0
1396cb1b6303a56eddc253b2ebd7b84bc20bae4f
[ "xo = x[:-dt]\nxt = x[dt:]\nmuo = np.mean(xo, axis=0)\nmut = np.mean(xt, axis=0)\ncoo = (xo - muo).T @ (xo - muo) + (xt - mut).T @ (xt - mut)\ncot = (xo - muo).T @ (xt - mut) + (xt - mut).T @ (xo - muo)\neigvals, eigvecs = eig(cot.astype(np.double), coo.astype(np.double))\nself.kinetic_map_scaling = kinetic_map_sca...
<|body_start_0|> xo = x[:-dt] xt = x[dt:] muo = np.mean(xo, axis=0) mut = np.mean(xt, axis=0) coo = (xo - muo).T @ (xo - muo) + (xt - mut).T @ (xt - mut) cot = (xo - muo).T @ (xt - mut) + (xt - mut).T @ (xo - muo) eigvals, eigvecs = eig(cot.astype(np.double), coo....
Implemented based on description in Frank Noé, Machine Learning for Molecular Dynamics on Long Timescales, 2018 (https://arxiv.org/abs/1812.07669)
TICA
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TICA: """Implemented based on description in Frank Noé, Machine Learning for Molecular Dynamics on Long Timescales, 2018 (https://arxiv.org/abs/1812.07669)""" def __init__(self, x, dt, kinetic_map_scaling=True): """Takes time series data""" <|body_0|> def transform(self,...
stack_v2_sparse_classes_75kplus_train_066960
2,287
no_license
[ { "docstring": "Takes time series data", "name": "__init__", "signature": "def __init__(self, x, dt, kinetic_map_scaling=True)" }, { "docstring": "Transforms to tIC space", "name": "transform", "signature": "def transform(self, xx)" }, { "docstring": "Transforms from tIC space to...
3
stack_v2_sparse_classes_30k_train_049375
Implement the Python class `TICA` described below. Class description: Implemented based on description in Frank Noé, Machine Learning for Molecular Dynamics on Long Timescales, 2018 (https://arxiv.org/abs/1812.07669) Method signatures and docstrings: - def __init__(self, x, dt, kinetic_map_scaling=True): Takes time s...
Implement the Python class `TICA` described below. Class description: Implemented based on description in Frank Noé, Machine Learning for Molecular Dynamics on Long Timescales, 2018 (https://arxiv.org/abs/1812.07669) Method signatures and docstrings: - def __init__(self, x, dt, kinetic_map_scaling=True): Takes time s...
7961815a329c5643f3fc740feeb776c71965a383
<|skeleton|> class TICA: """Implemented based on description in Frank Noé, Machine Learning for Molecular Dynamics on Long Timescales, 2018 (https://arxiv.org/abs/1812.07669)""" def __init__(self, x, dt, kinetic_map_scaling=True): """Takes time series data""" <|body_0|> def transform(self,...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TICA: """Implemented based on description in Frank Noé, Machine Learning for Molecular Dynamics on Long Timescales, 2018 (https://arxiv.org/abs/1812.07669)""" def __init__(self, x, dt, kinetic_map_scaling=True): """Takes time series data""" xo = x[:-dt] xt = x[dt:] muo = n...
the_stack_v2_python_sparse
BarstarBarnase/tica.py
oortsang/BiophysLearning
train
0
dea3f0798ae58931974ad967d03a7035f185d213
[ "if not self:\n return []\nlen_vector = []\nstatus_vector = []\nfor i in range(0, len(self)):\n status_vector.append(0)\n if type(self[i]) == list:\n len_vector.append(len(self[i]))\n else:\n len_vector.append(1)\nsolution = []\nwhile 1:\n solution.append(self.extract_vector(status_vect...
<|body_start_0|> if not self: return [] len_vector = [] status_vector = [] for i in range(0, len(self)): status_vector.append(0) if type(self[i]) == list: len_vector.append(len(self[i])) else: len_vector.appe...
a list of list
Multi_list
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Multi_list: """a list of list""" def give_combinaison(self): """return all the combinatory possibility in a list""" <|body_0|> def extract_vector(self, pos_list): """return the list of element corresponding at position in pos_list""" <|body_1|> def g...
stack_v2_sparse_classes_75kplus_train_066961
7,736
no_license
[ { "docstring": "return all the combinatory possibility in a list", "name": "give_combinaison", "signature": "def give_combinaison(self)" }, { "docstring": "return the list of element corresponding at position in pos_list", "name": "extract_vector", "signature": "def extract_vector(self, ...
3
stack_v2_sparse_classes_30k_train_038206
Implement the Python class `Multi_list` described below. Class description: a list of list Method signatures and docstrings: - def give_combinaison(self): return all the combinatory possibility in a list - def extract_vector(self, pos_list): return the list of element corresponding at position in pos_list - def give_...
Implement the Python class `Multi_list` described below. Class description: a list of list Method signatures and docstrings: - def give_combinaison(self): return all the combinatory possibility in a list - def extract_vector(self, pos_list): return the list of element corresponding at position in pos_list - def give_...
c77b09fda48877ef6f1d2db85237b220f696e512
<|skeleton|> class Multi_list: """a list of list""" def give_combinaison(self): """return all the combinatory possibility in a list""" <|body_0|> def extract_vector(self, pos_list): """return the list of element corresponding at position in pos_list""" <|body_1|> def g...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Multi_list: """a list of list""" def give_combinaison(self): """return all the combinatory possibility in a list""" if not self: return [] len_vector = [] status_vector = [] for i in range(0, len(self)): status_vector.append(0) i...
the_stack_v2_python_sparse
AprimeAlAlpha1/Source/MadWeight_File/Python/MW_fct.py
JeffersonLab/BDXEventGenerator
train
1
048fda669d0a9d79d22253633f0437b2406081c7
[ "cache_dir = os.getenv('GREENFLOW_CACHE_DIR', self.cache_dir)\nif filename is None:\n filename = cache_dir + '/' + self.uid + '.hdf5'\noutput_df = {}\nwith pd.HDFStore(filename, mode='r') as hf:\n for oport, pspec in self._get_output_ports(full_port_spec=True).items():\n ptype = pspec.get(PortsSpecSche...
<|body_start_0|> cache_dir = os.getenv('GREENFLOW_CACHE_DIR', self.cache_dir) if filename is None: filename = cache_dir + '/' + self.uid + '.hdf5' output_df = {} with pd.HDFStore(filename, mode='r') as hf: for oport, pspec in self._get_output_ports(full_port_spec=...
NodeHDFCacheMixin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NodeHDFCacheMixin: def load_cache(self, filename=None) -> dict: """Defines the behavior of how to load the cache file from the `filename`. Node can override this method. Default implementation assumes cudf dataframes. Arguments ------- filename: str filename of the cache file. Leave as n...
stack_v2_sparse_classes_75kplus_train_066962
3,546
permissive
[ { "docstring": "Defines the behavior of how to load the cache file from the `filename`. Node can override this method. Default implementation assumes cudf dataframes. Arguments ------- filename: str filename of the cache file. Leave as none to use default. returns: dict dictionary of the output from this node",...
2
null
Implement the Python class `NodeHDFCacheMixin` described below. Class description: Implement the NodeHDFCacheMixin class. Method signatures and docstrings: - def load_cache(self, filename=None) -> dict: Defines the behavior of how to load the cache file from the `filename`. Node can override this method. Default impl...
Implement the Python class `NodeHDFCacheMixin` described below. Class description: Implement the NodeHDFCacheMixin class. Method signatures and docstrings: - def load_cache(self, filename=None) -> dict: Defines the behavior of how to load the cache file from the `filename`. Node can override this method. Default impl...
94ac1d1ca7b0f04660edd2a773f76c752610b2bd
<|skeleton|> class NodeHDFCacheMixin: def load_cache(self, filename=None) -> dict: """Defines the behavior of how to load the cache file from the `filename`. Node can override this method. Default implementation assumes cudf dataframes. Arguments ------- filename: str filename of the cache file. Leave as n...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NodeHDFCacheMixin: def load_cache(self, filename=None) -> dict: """Defines the behavior of how to load the cache file from the `filename`. Node can override this method. Default implementation assumes cudf dataframes. Arguments ------- filename: str filename of the cache file. Leave as none to use def...
the_stack_v2_python_sparse
gQuant/plugins/gquant_plugin/greenflow_gquant_plugin/node_hdf_cache.py
Anhmike/gQuant
train
0
5e2285e371fddee1e6fb7f840be35fa0b3d943ec
[ "self.ident = ident\nself.func = func\nself.forceKeepArgsCasing = forceKeepArgsCasing\nself.forceKeepCommandCasing = forceKeepCommandCasing\nself.allowDM = allowDM\nself.allowHelp = allowHelp\nself.aliases = aliases\nself.signatureStr = signatureStr\nself.shortHelp = shortHelp\nself.longHelp = longHelp\nself.helpSe...
<|body_start_0|> self.ident = ident self.func = func self.forceKeepArgsCasing = forceKeepArgsCasing self.forceKeepCommandCasing = forceKeepCommandCasing self.allowDM = allowDM self.allowHelp = allowHelp self.aliases = aliases self.signatureStr = signatureS...
Represents a registration of a command in a HeirarchicalCommandsDB. TODO: Make allowDM so we dont have to make two HeirarchicalCommandsDBs to handle DM commands :var ident: The string command name by which this command is identified and called :vartype ident: str :var func: A reference to the function to call upon call...
CommandRegistry
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommandRegistry: """Represents a registration of a command in a HeirarchicalCommandsDB. TODO: Make allowDM so we dont have to make two HeirarchicalCommandsDBs to handle DM commands :var ident: The string command name by which this command is identified and called :vartype ident: str :var func: A ...
stack_v2_sparse_classes_75kplus_train_066963
15,557
permissive
[ { "docstring": ":param str ident: The string command name by which this command is identified and called :param FunctionType func: A reference to the function to call upon calling this CommandRegistry :param bool forceKeepArgsCasing: Whether to pass arguments to the function with their original casing. If False...
2
stack_v2_sparse_classes_30k_train_028272
Implement the Python class `CommandRegistry` described below. Class description: Represents a registration of a command in a HeirarchicalCommandsDB. TODO: Make allowDM so we dont have to make two HeirarchicalCommandsDBs to handle DM commands :var ident: The string command name by which this command is identified and c...
Implement the Python class `CommandRegistry` described below. Class description: Represents a registration of a command in a HeirarchicalCommandsDB. TODO: Make allowDM so we dont have to make two HeirarchicalCommandsDBs to handle DM commands :var ident: The string command name by which this command is identified and c...
b4fe3d765b764ab169284ce0869a810825013389
<|skeleton|> class CommandRegistry: """Represents a registration of a command in a HeirarchicalCommandsDB. TODO: Make allowDM so we dont have to make two HeirarchicalCommandsDBs to handle DM commands :var ident: The string command name by which this command is identified and called :vartype ident: str :var func: A ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CommandRegistry: """Represents a registration of a command in a HeirarchicalCommandsDB. TODO: Make allowDM so we dont have to make two HeirarchicalCommandsDBs to handle DM commands :var ident: The string command name by which this command is identified and called :vartype ident: str :var func: A reference to ...
the_stack_v2_python_sparse
BB/bbDatabases/HeirarchicalCommandsDB.py
Trimatix/GOF2BountyBot
train
7
80961b4353ea6e194afb9ba47c2780dabccd9865
[ "super(FasterRCNN, self).__init__()\nself.backbone = self.define_props('backbone', backbone, dtype=ClassType.NETWORK)\nself.neck = self.define_props('neck', neck, dtype=ClassType.NETWORK)\nbackbone_neck = Sequential(self.backbone, self.neck)\nself.head = ClassFactory.get_cls(ClassType.NETWORK, network_name)(backbon...
<|body_start_0|> super(FasterRCNN, self).__init__() self.backbone = self.define_props('backbone', backbone, dtype=ClassType.NETWORK) self.neck = self.define_props('neck', neck, dtype=ClassType.NETWORK) backbone_neck = Sequential(self.backbone, self.neck) self.head = ClassFactory....
Create ResNet Network.
FasterRCNN
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FasterRCNN: """Create ResNet Network.""" def __init__(self, num_classes, backbone='ResNetDet', neck='FPN', network_name='torchvision_FasterRCNN', **kwargs): """Create layers. :param num_class: number of class :type num_class: int""" <|body_0|> def call(self, inputs, targ...
stack_v2_sparse_classes_75kplus_train_066964
1,588
permissive
[ { "docstring": "Create layers. :param num_class: number of class :type num_class: int", "name": "__init__", "signature": "def __init__(self, num_classes, backbone='ResNetDet', neck='FPN', network_name='torchvision_FasterRCNN', **kwargs)" }, { "docstring": "Call inputs.", "name": "call", ...
2
null
Implement the Python class `FasterRCNN` described below. Class description: Create ResNet Network. Method signatures and docstrings: - def __init__(self, num_classes, backbone='ResNetDet', neck='FPN', network_name='torchvision_FasterRCNN', **kwargs): Create layers. :param num_class: number of class :type num_class: i...
Implement the Python class `FasterRCNN` described below. Class description: Create ResNet Network. Method signatures and docstrings: - def __init__(self, num_classes, backbone='ResNetDet', neck='FPN', network_name='torchvision_FasterRCNN', **kwargs): Create layers. :param num_class: number of class :type num_class: i...
e4ef3a1c92d19d1d08c3ef0e2156b6fecefdbe04
<|skeleton|> class FasterRCNN: """Create ResNet Network.""" def __init__(self, num_classes, backbone='ResNetDet', neck='FPN', network_name='torchvision_FasterRCNN', **kwargs): """Create layers. :param num_class: number of class :type num_class: int""" <|body_0|> def call(self, inputs, targ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FasterRCNN: """Create ResNet Network.""" def __init__(self, num_classes, backbone='ResNetDet', neck='FPN', network_name='torchvision_FasterRCNN', **kwargs): """Create layers. :param num_class: number of class :type num_class: int""" super(FasterRCNN, self).__init__() self.backbone...
the_stack_v2_python_sparse
zeus/networks/faster_rcnn.py
huawei-noah/xingtian
train
308
ca01656d31d6477a77b67a888efa91bbe24cc9ae
[ "super(MVAEdecoder, self).__init__()\nself.experts = []\nself.num_experts = FLAGS.num_experts\nfor _ in range(self.num_experts):\n self.experts.append(nn.ModuleList([nn.Linear(FLAGS.input_dim * 3 + FLAGS.latent_dim + FLAGS.c_dim, FLAGS.dec_hidden_units), nn.Linear(FLAGS.dec_hidden_units + FLAGS.latent_dim, FLAGS...
<|body_start_0|> super(MVAEdecoder, self).__init__() self.experts = [] self.num_experts = FLAGS.num_experts for _ in range(self.num_experts): self.experts.append(nn.ModuleList([nn.Linear(FLAGS.input_dim * 3 + FLAGS.latent_dim + FLAGS.c_dim, FLAGS.dec_hidden_units), nn.Linear(...
MVAEdecoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MVAEdecoder: def __init__(self, FLAGS): """Decoder module for the char motion decoder :param FLAGS: abseil flags""" <|body_0|> def forward(self, x, z): """forward pass through the module :param x: input to the module :param z: random variable :return: output""" ...
stack_v2_sparse_classes_75kplus_train_066965
2,731
no_license
[ { "docstring": "Decoder module for the char motion decoder :param FLAGS: abseil flags", "name": "__init__", "signature": "def __init__(self, FLAGS)" }, { "docstring": "forward pass through the module :param x: input to the module :param z: random variable :return: output", "name": "forward",...
2
stack_v2_sparse_classes_30k_train_035841
Implement the Python class `MVAEdecoder` described below. Class description: Implement the MVAEdecoder class. Method signatures and docstrings: - def __init__(self, FLAGS): Decoder module for the char motion decoder :param FLAGS: abseil flags - def forward(self, x, z): forward pass through the module :param x: input ...
Implement the Python class `MVAEdecoder` described below. Class description: Implement the MVAEdecoder class. Method signatures and docstrings: - def __init__(self, FLAGS): Decoder module for the char motion decoder :param FLAGS: abseil flags - def forward(self, x, z): forward pass through the module :param x: input ...
87e8b0554ba979d0e409235de728c01edb0a48a6
<|skeleton|> class MVAEdecoder: def __init__(self, FLAGS): """Decoder module for the char motion decoder :param FLAGS: abseil flags""" <|body_0|> def forward(self, x, z): """forward pass through the module :param x: input to the module :param z: random variable :return: output""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MVAEdecoder: def __init__(self, FLAGS): """Decoder module for the char motion decoder :param FLAGS: abseil flags""" super(MVAEdecoder, self).__init__() self.experts = [] self.num_experts = FLAGS.num_experts for _ in range(self.num_experts): self.experts.appe...
the_stack_v2_python_sparse
net/basemodel/MVAEdecoder.py
peacekurella/sell-it
train
4
075e296054c81222723d21f76aa52c0d6eec0c9b
[ "if model._meta.app_label in self.route_app_labels:\n return 'data_db'\nreturn None", "if model._meta.app_label in self.route_app_labels:\n return 'data_db'\nreturn None", "if obj1._meta.app_label in self.route_app_labels or obj2._meta.app_label in self.route_app_labels:\n return True\nreturn None", ...
<|body_start_0|> if model._meta.app_label in self.route_app_labels: return 'data_db' return None <|end_body_0|> <|body_start_1|> if model._meta.app_label in self.route_app_labels: return 'data_db' return None <|end_body_1|> <|body_start_2|> if obj1._meta...
A router to control all database operations on models in the certain applications.
DataRouter
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataRouter: """A router to control all database operations on models in the certain applications.""" def db_for_read(self, model, **hints): """Attempts to read certain models go to data_db.""" <|body_0|> def db_for_write(self, model, **hints): """Attempts to writ...
stack_v2_sparse_classes_75kplus_train_066966
1,292
permissive
[ { "docstring": "Attempts to read certain models go to data_db.", "name": "db_for_read", "signature": "def db_for_read(self, model, **hints)" }, { "docstring": "Attempts to write certain models go to data_db.", "name": "db_for_write", "signature": "def db_for_write(self, model, **hints)" ...
4
stack_v2_sparse_classes_30k_train_016182
Implement the Python class `DataRouter` described below. Class description: A router to control all database operations on models in the certain applications. Method signatures and docstrings: - def db_for_read(self, model, **hints): Attempts to read certain models go to data_db. - def db_for_write(self, model, **hin...
Implement the Python class `DataRouter` described below. Class description: A router to control all database operations on models in the certain applications. Method signatures and docstrings: - def db_for_read(self, model, **hints): Attempts to read certain models go to data_db. - def db_for_write(self, model, **hin...
dfe0533d4359806ff8f90bd7aa1c679b4a016d09
<|skeleton|> class DataRouter: """A router to control all database operations on models in the certain applications.""" def db_for_read(self, model, **hints): """Attempts to read certain models go to data_db.""" <|body_0|> def db_for_write(self, model, **hints): """Attempts to writ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DataRouter: """A router to control all database operations on models in the certain applications.""" def db_for_read(self, model, **hints): """Attempts to read certain models go to data_db.""" if model._meta.app_label in self.route_app_labels: return 'data_db' return N...
the_stack_v2_python_sparse
volebni_kalkulacka/utils/dataRouter.py
tmajerech/volebni_kalkulacka
train
0
1556d0bf24457c169b637de4ca77be4c6916e18f
[ "self.total_count = total_count\nself.page_info = page_info\nself.messages = messages", "if dictionary is None:\n return None\ntotal_count = dictionary.get('totalCount')\npage_info = PageInfo.from_dictionary(dictionary.get('pageInfo')) if dictionary.get('pageInfo') else None\nmessages = None\nif dictionary.get...
<|body_start_0|> self.total_count = total_count self.page_info = page_info self.messages = messages <|end_body_0|> <|body_start_1|> if dictionary is None: return None total_count = dictionary.get('totalCount') page_info = PageInfo.from_dictionary(dictionary.g...
Implementation of the 'BandwidthMessagesList' model. TODO: type model description here. Attributes: total_count (int): Total number of messages matched by the search page_info (PageInfo): TODO: type description here. messages (list of BandwidthMessageItem): TODO: type description here.
BandwidthMessagesList
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BandwidthMessagesList: """Implementation of the 'BandwidthMessagesList' model. TODO: type model description here. Attributes: total_count (int): Total number of messages matched by the search page_info (PageInfo): TODO: type description here. messages (list of BandwidthMessageItem): TODO: type de...
stack_v2_sparse_classes_75kplus_train_066967
2,301
permissive
[ { "docstring": "Constructor for the BandwidthMessagesList class", "name": "__init__", "signature": "def __init__(self, total_count=None, page_info=None, messages=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representati...
2
null
Implement the Python class `BandwidthMessagesList` described below. Class description: Implementation of the 'BandwidthMessagesList' model. TODO: type model description here. Attributes: total_count (int): Total number of messages matched by the search page_info (PageInfo): TODO: type description here. messages (list ...
Implement the Python class `BandwidthMessagesList` described below. Class description: Implementation of the 'BandwidthMessagesList' model. TODO: type model description here. Attributes: total_count (int): Total number of messages matched by the search page_info (PageInfo): TODO: type description here. messages (list ...
447df3cc8cb7acaf3361d842630c432a9c31ce6e
<|skeleton|> class BandwidthMessagesList: """Implementation of the 'BandwidthMessagesList' model. TODO: type model description here. Attributes: total_count (int): Total number of messages matched by the search page_info (PageInfo): TODO: type description here. messages (list of BandwidthMessageItem): TODO: type de...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BandwidthMessagesList: """Implementation of the 'BandwidthMessagesList' model. TODO: type model description here. Attributes: total_count (int): Total number of messages matched by the search page_info (PageInfo): TODO: type description here. messages (list of BandwidthMessageItem): TODO: type description her...
the_stack_v2_python_sparse
bandwidth/messaging/models/bandwidth_messages_list.py
Bandwidth/python-sdk
train
10
76d61f95b2f041bdddabff067593ee2c7547499a
[ "from torch.nn import AvgPool2d, LeakyReLU\nfrom torch.nn import Conv2d\nsuper().__init__()\nself.conv_1 = Conv2d(in_channels, in_channels, (3, 3), dilation=dilation, padding=dilation, bias=True)\nself.conv_2 = Conv2d(in_channels, out_channels, (3, 3), dilation=dilation, padding=dilation, bias=True)\nself.downSampl...
<|body_start_0|> from torch.nn import AvgPool2d, LeakyReLU from torch.nn import Conv2d super().__init__() self.conv_1 = Conv2d(in_channels, in_channels, (3, 3), dilation=dilation, padding=dilation, bias=True) self.conv_2 = Conv2d(in_channels, out_channels, (3, 3), dilation=dilati...
General block in the discriminator
DisGeneralConvBlock
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DisGeneralConvBlock: """General block in the discriminator""" def __init__(self, in_channels, out_channels, dilation=1): """constructor of the class :param in_channels: number of input channels :param out_channels: number of output channels""" <|body_0|> def forward(self...
stack_v2_sparse_classes_75kplus_train_066968
14,685
no_license
[ { "docstring": "constructor of the class :param in_channels: number of input channels :param out_channels: number of output channels", "name": "__init__", "signature": "def __init__(self, in_channels, out_channels, dilation=1)" }, { "docstring": "forward pass of the module :param x: input :retur...
2
stack_v2_sparse_classes_30k_train_040487
Implement the Python class `DisGeneralConvBlock` described below. Class description: General block in the discriminator Method signatures and docstrings: - def __init__(self, in_channels, out_channels, dilation=1): constructor of the class :param in_channels: number of input channels :param out_channels: number of ou...
Implement the Python class `DisGeneralConvBlock` described below. Class description: General block in the discriminator Method signatures and docstrings: - def __init__(self, in_channels, out_channels, dilation=1): constructor of the class :param in_channels: number of input channels :param out_channels: number of ou...
428abe1fefe5ea4ef00290155e7e59657bc83444
<|skeleton|> class DisGeneralConvBlock: """General block in the discriminator""" def __init__(self, in_channels, out_channels, dilation=1): """constructor of the class :param in_channels: number of input channels :param out_channels: number of output channels""" <|body_0|> def forward(self...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DisGeneralConvBlock: """General block in the discriminator""" def __init__(self, in_channels, out_channels, dilation=1): """constructor of the class :param in_channels: number of input channels :param out_channels: number of output channels""" from torch.nn import AvgPool2d, LeakyReLU ...
the_stack_v2_python_sparse
src/msg_stylegan2.py
blakecheng/lafin
train
0
f71043721417d00212bc58287a844aacdc4aca5b
[ "if not self.instance:\n raise RuntimeError('Manager method should be called: instance.images.get_or_download()')\nimage = Image.objects.get_image_from_url(url=url)\nif image.id:\n image_link = self.get_or_create(image=image, object_id=self.instance.id, content_type=ContentType.objects.get_for_model(self.inst...
<|body_start_0|> if not self.instance: raise RuntimeError('Manager method should be called: instance.images.get_or_download()') image = Image.objects.get_image_from_url(url=url) if image.id: image_link = self.get_or_create(image=image, object_id=self.instance.id, content_...
ImageLinkManager
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageLinkManager: def get_or_download(self, url, **kwargs): """Try to get already downloaded or download image using self.download() method Return tuple with image_link instance and boolean flag equal True if image was downloaded""" <|body_0|> def download(self, url, **kwarg...
stack_v2_sparse_classes_75kplus_train_066969
5,904
permissive
[ { "docstring": "Try to get already downloaded or download image using self.download() method Return tuple with image_link instance and boolean flag equal True if image was downloaded", "name": "get_or_download", "signature": "def get_or_download(self, url, **kwargs)" }, { "docstring": "Download ...
2
stack_v2_sparse_classes_30k_train_041961
Implement the Python class `ImageLinkManager` described below. Class description: Implement the ImageLinkManager class. Method signatures and docstrings: - def get_or_download(self, url, **kwargs): Try to get already downloaded or download image using self.download() method Return tuple with image_link instance and b...
Implement the Python class `ImageLinkManager` described below. Class description: Implement the ImageLinkManager class. Method signatures and docstrings: - def get_or_download(self, url, **kwargs): Try to get already downloaded or download image using self.download() method Return tuple with image_link instance and b...
c393dc8c2d59dc99aa2c3314d3372b6e2bf5497f
<|skeleton|> class ImageLinkManager: def get_or_download(self, url, **kwargs): """Try to get already downloaded or download image using self.download() method Return tuple with image_link instance and boolean flag equal True if image was downloaded""" <|body_0|> def download(self, url, **kwarg...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ImageLinkManager: def get_or_download(self, url, **kwargs): """Try to get already downloaded or download image using self.download() method Return tuple with image_link instance and boolean flag equal True if image was downloaded""" if not self.instance: raise RuntimeError('Manager...
the_stack_v2_python_sparse
cinemanio/images/models.py
cinemanio/backend
train
4
2df4ccc94811bbbea5d5bc9ef22f5f56b0c66963
[ "running_instances = session.query(FtaSolutionsAppAlarminstance).filter_by(status=status)\nrunning_instance_ids = [a.id for a in running_instances]\nlogger.info('running alarm[%s](%s): %s', status, running_instances.count(), running_instance_ids)\nredis_key = 'QOS_RUNNING_%s' % status\nhis_data = redis_cache.get(re...
<|body_start_0|> running_instances = session.query(FtaSolutionsAppAlarminstance).filter_by(status=status) running_instance_ids = [a.id for a in running_instances] logger.info('running alarm[%s](%s): %s', status, running_instances.count(), running_instance_ids) redis_key = 'QOS_RUNNING_%s...
Qos
[ "MIT", "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference", "BSL-1.0", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Qos: def check_blocked(self, status): """get block whether happened in sqecial topic by alarm_instance's status :param status: which status""" <|body_0|> def _mark_alarm_to_notice(self, status, tot_count, blocked_instance_ids): """mark alarm_instance status to 'for_n...
stack_v2_sparse_classes_75kplus_train_066970
7,722
permissive
[ { "docstring": "get block whether happened in sqecial topic by alarm_instance's status :param status: which status", "name": "check_blocked", "signature": "def check_blocked(self, status)" }, { "docstring": "mark alarm_instance status to 'for_notice' and pass solution :param status: which status...
4
stack_v2_sparse_classes_30k_train_004501
Implement the Python class `Qos` described below. Class description: Implement the Qos class. Method signatures and docstrings: - def check_blocked(self, status): get block whether happened in sqecial topic by alarm_instance's status :param status: which status - def _mark_alarm_to_notice(self, status, tot_count, blo...
Implement the Python class `Qos` described below. Class description: Implement the Qos class. Method signatures and docstrings: - def check_blocked(self, status): get block whether happened in sqecial topic by alarm_instance's status :param status: which status - def _mark_alarm_to_notice(self, status, tot_count, blo...
a50a3c498c39b14e7df4a0a960c2a1499b1ec6bb
<|skeleton|> class Qos: def check_blocked(self, status): """get block whether happened in sqecial topic by alarm_instance's status :param status: which status""" <|body_0|> def _mark_alarm_to_notice(self, status, tot_count, blocked_instance_ids): """mark alarm_instance status to 'for_n...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Qos: def check_blocked(self, status): """get block whether happened in sqecial topic by alarm_instance's status :param status: which status""" running_instances = session.query(FtaSolutionsAppAlarminstance).filter_by(status=status) running_instance_ids = [a.id for a in running_instance...
the_stack_v2_python_sparse
server/fta/qos/process.py
huang1125677925/fta
train
0
f556af0554511ed6caea20ed6d3fabec1fb4d79a
[ "super(Decoder, self).__init__()\nself.upscale = UpscaleBlockBlock(input_dim, 256, num_convblocks)\nresulting_channels = 256 // 2 ** (num_convblocks - 1)\nself.conv = nn.Conv2d(resulting_channels, 3, kernel_size=5, padding=2)\nself.sigmoid = nn.Sigmoid()", "x = self.upscale(x)\nx = self.conv(x)\nx = self.sigmoid(...
<|body_start_0|> super(Decoder, self).__init__() self.upscale = UpscaleBlockBlock(input_dim, 256, num_convblocks) resulting_channels = 256 // 2 ** (num_convblocks - 1) self.conv = nn.Conv2d(resulting_channels, 3, kernel_size=5, padding=2) self.sigmoid = nn.Sigmoid() <|end_body_0|...
This is just a simple decoder with some upscaling convolutions. The last layer ends with a sigmoid to compress the output between 0 and 1 for a RGB image.
Decoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Decoder: """This is just a simple decoder with some upscaling convolutions. The last layer ends with a sigmoid to compress the output between 0 and 1 for a RGB image.""" def __init__(self, input_dim, num_convblocks=3): """Initialize a new decoder network. Inputs: - latent_dim: dimens...
stack_v2_sparse_classes_75kplus_train_066971
1,116
no_license
[ { "docstring": "Initialize a new decoder network. Inputs: - latent_dim: dimension of the latent space.", "name": "__init__", "signature": "def __init__(self, input_dim, num_convblocks=3)" }, { "docstring": "Forward pass of the encoder network. Should not be called manually but by calling a model...
2
stack_v2_sparse_classes_30k_train_019119
Implement the Python class `Decoder` described below. Class description: This is just a simple decoder with some upscaling convolutions. The last layer ends with a sigmoid to compress the output between 0 and 1 for a RGB image. Method signatures and docstrings: - def __init__(self, input_dim, num_convblocks=3): Initi...
Implement the Python class `Decoder` described below. Class description: This is just a simple decoder with some upscaling convolutions. The last layer ends with a sigmoid to compress the output between 0 and 1 for a RGB image. Method signatures and docstrings: - def __init__(self, input_dim, num_convblocks=3): Initi...
05d959c9c41c9e4bff7ec12a69afd98dba14da00
<|skeleton|> class Decoder: """This is just a simple decoder with some upscaling convolutions. The last layer ends with a sigmoid to compress the output between 0 and 1 for a RGB image.""" def __init__(self, input_dim, num_convblocks=3): """Initialize a new decoder network. Inputs: - latent_dim: dimens...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Decoder: """This is just a simple decoder with some upscaling convolutions. The last layer ends with a sigmoid to compress the output between 0 and 1 for a RGB image.""" def __init__(self, input_dim, num_convblocks=3): """Initialize a new decoder network. Inputs: - latent_dim: dimension of the la...
the_stack_v2_python_sparse
implementation/Models/DeepFake/Decoder.py
JanFschr/FaceSwap-1
train
0
fb42951a51294cfff88ca441eb07fc9529dc8ddd
[ "self.msg_id = msg_id\nif failure_info is not None:\n ex_class = failure_info[0]\n ex = failure_info[1]\n tb = traceback.format_exception(*failure_info)\n if issubclass(ex_class, RemoteExceptionMixin):\n failure_data = {'c': ex.clazz, 'm': ex.module, 's': ex.message, 't': tb}\n else:\n ...
<|body_start_0|> self.msg_id = msg_id if failure_info is not None: ex_class = failure_info[0] ex = failure_info[1] tb = traceback.format_exception(*failure_info) if issubclass(ex_class, RemoteExceptionMixin): failure_data = {'c': ex.clazz, ...
PikaOutgoingMessage implementation for RPC reply messages. It sets correlation_id AMQP property to link this reply with response
RpcReplyPikaOutgoingMessage
[ "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RpcReplyPikaOutgoingMessage: """PikaOutgoingMessage implementation for RPC reply messages. It sets correlation_id AMQP property to link this reply with response""" def __init__(self, pika_engine, msg_id, reply=None, failure_info=None, content_type=None): """Initialize with reply info...
stack_v2_sparse_classes_75kplus_train_066972
24,684
permissive
[ { "docstring": "Initialize with reply information for sending :param pika_engine: PikaEngine, shared object with configuration and shared driver functionality :param msg_id: String, msg_id of RPC request, which waits for reply :param reply: Dictionary, reply. In case of exception should be None :param failure_i...
2
stack_v2_sparse_classes_30k_train_037144
Implement the Python class `RpcReplyPikaOutgoingMessage` described below. Class description: PikaOutgoingMessage implementation for RPC reply messages. It sets correlation_id AMQP property to link this reply with response Method signatures and docstrings: - def __init__(self, pika_engine, msg_id, reply=None, failure_...
Implement the Python class `RpcReplyPikaOutgoingMessage` described below. Class description: PikaOutgoingMessage implementation for RPC reply messages. It sets correlation_id AMQP property to link this reply with response Method signatures and docstrings: - def __init__(self, pika_engine, msg_id, reply=None, failure_...
c01951b33e278de9e769c2d0609c0be61d2cb26b
<|skeleton|> class RpcReplyPikaOutgoingMessage: """PikaOutgoingMessage implementation for RPC reply messages. It sets correlation_id AMQP property to link this reply with response""" def __init__(self, pika_engine, msg_id, reply=None, failure_info=None, content_type=None): """Initialize with reply info...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RpcReplyPikaOutgoingMessage: """PikaOutgoingMessage implementation for RPC reply messages. It sets correlation_id AMQP property to link this reply with response""" def __init__(self, pika_engine, msg_id, reply=None, failure_info=None, content_type=None): """Initialize with reply information for s...
the_stack_v2_python_sparse
filesystems/vnx_rootfs_lxc_ubuntu64-16.04-v025-openstack-compute/rootfs/usr/lib/python2.7/dist-packages/oslo_messaging/_drivers/pika_driver/pika_message.py
juancarlosdiaztorres/Ansible-OpenStack
train
0
cbd0ef0ecb4c751f9bcaad01ca19239cb985318c
[ "id_asignacion = request.data['primary_key']\nasignacion = Asignacion.objects.get(id=id_asignacion)\nasignacion.delete()\nreturn Response({'mensaje': 'Cambio Aceptado'}, status=status.HTTP_200_OK)", "participante_id = request.data['participante']\ngrupo_id = request.data['grupo']\ngrupos = Grupo.objects.get(id=gr...
<|body_start_0|> id_asignacion = request.data['primary_key'] asignacion = Asignacion.objects.get(id=id_asignacion) asignacion.delete() return Response({'mensaje': 'Cambio Aceptado'}, status=status.HTTP_200_OK) <|end_body_0|> <|body_start_1|> participante_id = request.data['parti...
AsignacionViewSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AsignacionViewSet: def desactivar_asignacion(self, request, pk=None): """Método que elimina una asignación""" <|body_0|> def verificar_duplicidad(self, request, pk=None): """Metodo para ver si el participante esta asignado en otro grupo""" <|body_1|> <|end_s...
stack_v2_sparse_classes_75kplus_train_066973
13,765
no_license
[ { "docstring": "Método que elimina una asignación", "name": "desactivar_asignacion", "signature": "def desactivar_asignacion(self, request, pk=None)" }, { "docstring": "Metodo para ver si el participante esta asignado en otro grupo", "name": "verificar_duplicidad", "signature": "def veri...
2
stack_v2_sparse_classes_30k_train_019323
Implement the Python class `AsignacionViewSet` described below. Class description: Implement the AsignacionViewSet class. Method signatures and docstrings: - def desactivar_asignacion(self, request, pk=None): Método que elimina una asignación - def verificar_duplicidad(self, request, pk=None): Metodo para ver si el p...
Implement the Python class `AsignacionViewSet` described below. Class description: Implement the AsignacionViewSet class. Method signatures and docstrings: - def desactivar_asignacion(self, request, pk=None): Método que elimina una asignación - def verificar_duplicidad(self, request, pk=None): Metodo para ver si el p...
0e37786d7173abe820fd10b094ffcc2db9593a9c
<|skeleton|> class AsignacionViewSet: def desactivar_asignacion(self, request, pk=None): """Método que elimina una asignación""" <|body_0|> def verificar_duplicidad(self, request, pk=None): """Metodo para ver si el participante esta asignado en otro grupo""" <|body_1|> <|end_s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AsignacionViewSet: def desactivar_asignacion(self, request, pk=None): """Método que elimina una asignación""" id_asignacion = request.data['primary_key'] asignacion = Asignacion.objects.get(id=id_asignacion) asignacion.delete() return Response({'mensaje': 'Cambio Acepta...
the_stack_v2_python_sparse
src/apps/cyd/api_views.py
jinchuika/app-suni
train
7
a0c114483329b253162e84fc8b70f93bd9eaa3e2
[ "value = None\ncache = None\nprefix = None\nif self.should_cache():\n prefix = '%s:%s:string' % (self.get_cache_version(), self.get_cache_prefix())\n cache = router.router.get_cache(prefix)\n value = cache.get(prefix)\nif not value:\n value = super(CacheView, self).get_as_string(request, *args, **kwargs...
<|body_start_0|> value = None cache = None prefix = None if self.should_cache(): prefix = '%s:%s:string' % (self.get_cache_version(), self.get_cache_prefix()) cache = router.router.get_cache(prefix) value = cache.get(prefix) if not value: ...
A class based view that overrides the default dispatch method to determine the cache_prefix. If the cms view is available this class will inherit from there otherwise it will inherit from django's generic class View. :param cache_time: How long should we cache this attribute. This gets passed to django middleware and d...
CacheView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CacheView: """A class based view that overrides the default dispatch method to determine the cache_prefix. If the cms view is available this class will inherit from there otherwise it will inherit from django's generic class View. :param cache_time: How long should we cache this attribute. This g...
stack_v2_sparse_classes_75kplus_train_066974
7,096
permissive
[ { "docstring": "Should only be used when inheriting from cms View. Gets the response as a string and caches it with a separate prefix", "name": "get_as_string", "signature": "def get_as_string(self, request, *args, **kwargs)" }, { "docstring": "Overrides Django's default dispatch to provide cach...
2
stack_v2_sparse_classes_30k_test_001934
Implement the Python class `CacheView` described below. Class description: A class based view that overrides the default dispatch method to determine the cache_prefix. If the cms view is available this class will inherit from there otherwise it will inherit from django's generic class View. :param cache_time: How long...
Implement the Python class `CacheView` described below. Class description: A class based view that overrides the default dispatch method to determine the cache_prefix. If the cms view is available this class will inherit from there otherwise it will inherit from django's generic class View. :param cache_time: How long...
9f5ac28618059eef99152214c7a90ad78151629e
<|skeleton|> class CacheView: """A class based view that overrides the default dispatch method to determine the cache_prefix. If the cms view is available this class will inherit from there otherwise it will inherit from django's generic class View. :param cache_time: How long should we cache this attribute. This g...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CacheView: """A class based view that overrides the default dispatch method to determine the cache_prefix. If the cms view is available this class will inherit from there otherwise it will inherit from django's generic class View. :param cache_time: How long should we cache this attribute. This gets passed to...
the_stack_v2_python_sparse
scarlet/cache/views.py
markmiscavage/scarlet
train
1
28539162ad213c238aa4d68bfe1f299cbb3069e9
[ "self.global_weight = 1\nself.prevention_reductions = prevention_reductions\nself.env_scalars = env_type_scalars", "weight = self.global_weight * self.env_scalars[environment.quality]\nif environment.preventions != None:\n n_masks = environment.mask_status[personA] + environment.mask_status[personB]\n weigh...
<|body_start_0|> self.global_weight = 1 self.prevention_reductions = prevention_reductions self.env_scalars = env_type_scalars <|end_body_0|> <|body_start_1|> weight = self.global_weight * self.env_scalars[environment.quality] if environment.preventions != None: n_ma...
a transmission weighter object carries all parameters and functions that involve calculating weight for edges in the graph
TransmissionWeighter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TransmissionWeighter: """a transmission weighter object carries all parameters and functions that involve calculating weight for edges in the graph""" def __init__(self, env_type_scalars, prevention_reductions): """:param env_type_scalars: dict must map to a scalar for each environme...
stack_v2_sparse_classes_75kplus_train_066975
45,926
no_license
[ { "docstring": ":param env_type_scalars: dict must map to a scalar for each environment type, for scaling weights :param prevention_reductions: dict must map prevention names, currently either 'masking' or 'distancing' to scalars", "name": "__init__", "signature": "def __init__(self, env_type_scalars, p...
2
null
Implement the Python class `TransmissionWeighter` described below. Class description: a transmission weighter object carries all parameters and functions that involve calculating weight for edges in the graph Method signatures and docstrings: - def __init__(self, env_type_scalars, prevention_reductions): :param env_t...
Implement the Python class `TransmissionWeighter` described below. Class description: a transmission weighter object carries all parameters and functions that involve calculating weight for edges in the graph Method signatures and docstrings: - def __init__(self, env_type_scalars, prevention_reductions): :param env_t...
666dea33ca22347e9c0656b15cd80cc5cb42eae7
<|skeleton|> class TransmissionWeighter: """a transmission weighter object carries all parameters and functions that involve calculating weight for edges in the graph""" def __init__(self, env_type_scalars, prevention_reductions): """:param env_type_scalars: dict must map to a scalar for each environme...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TransmissionWeighter: """a transmission weighter object carries all parameters and functions that involve calculating weight for edges in the graph""" def __init__(self, env_type_scalars, prevention_reductions): """:param env_type_scalars: dict must map to a scalar for each environment type, for ...
the_stack_v2_python_sparse
PopulaceGraphModel/ge_simResults_good/2020-10-19_21-50-18/src/ModelToolkit_bak.py
FiveCrows/SIRsims
train
0
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_75kplus_train_066976
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
stack_v2_sparse_classes_30k_train_028692
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_75kplus
data/stack_v2_sparse_classes_30k
75,829
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
689aaed9359e63811b14a442acac827911ed8811
[ "super().__init__()\nself.subsections = []\nself.create(pars)", "self.heading = pars[0].title().replace('\\t', '')\nself.paragraphs = [self.parse_paragraph(p) for p in pars[1:]]\nself.create_subsections()\nself.strip_pars()", "split_indices = [i for i in range(len(self.paragraphs)) if self.paragraphs[i] == '']\...
<|body_start_0|> super().__init__() self.subsections = [] self.create(pars) <|end_body_0|> <|body_start_1|> self.heading = pars[0].title().replace('\t', '') self.paragraphs = [self.parse_paragraph(p) for p in pars[1:]] self.create_subsections() self.strip_pars() ...
TODO Docs
Section
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Section: """TODO Docs""" def __init__(self, pars): """TODO Docs""" <|body_0|> def create(self, pars): """TODO Docs""" <|body_1|> def create_subsections(self): """TODO Docs""" <|body_2|> def parse_paragraph(par: str): """T...
stack_v2_sparse_classes_75kplus_train_066977
6,946
permissive
[ { "docstring": "TODO Docs", "name": "__init__", "signature": "def __init__(self, pars)" }, { "docstring": "TODO Docs", "name": "create", "signature": "def create(self, pars)" }, { "docstring": "TODO Docs", "name": "create_subsections", "signature": "def create_subsections...
5
stack_v2_sparse_classes_30k_train_038905
Implement the Python class `Section` described below. Class description: TODO Docs Method signatures and docstrings: - def __init__(self, pars): TODO Docs - def create(self, pars): TODO Docs - def create_subsections(self): TODO Docs - def parse_paragraph(par: str): TODO Docs - def __str__(self): TODO Docs
Implement the Python class `Section` described below. Class description: TODO Docs Method signatures and docstrings: - def __init__(self, pars): TODO Docs - def create(self, pars): TODO Docs - def create_subsections(self): TODO Docs - def parse_paragraph(par: str): TODO Docs - def __str__(self): TODO Docs <|skeleton...
6090f7b1c82e36625939edaa47a846abc10e70a0
<|skeleton|> class Section: """TODO Docs""" def __init__(self, pars): """TODO Docs""" <|body_0|> def create(self, pars): """TODO Docs""" <|body_1|> def create_subsections(self): """TODO Docs""" <|body_2|> def parse_paragraph(par: str): """T...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Section: """TODO Docs""" def __init__(self, pars): """TODO Docs""" super().__init__() self.subsections = [] self.create(pars) def create(self, pars): """TODO Docs""" self.heading = pars[0].title().replace('\t', '') self.paragraphs = [self.parse...
the_stack_v2_python_sparse
backend/backend/resume/scripts.py
epm0dev/personal-website
train
1
cdd6d3f86cb6b835fb751b5260be3eaa29ee6a31
[ "response = await self.response\nif not response.code.is_successful():\n raise error.ResponseWrappingError(response)\nreturn response", "try:\n return await self.response\nexcept error.RenderableError as e:\n return e.to_message()\nexcept Exception:\n return Message(code=INTERNAL_SERVER_ERROR)" ]
<|body_start_0|> response = await self.response if not response.code.is_successful(): raise error.ResponseWrappingError(response) return response <|end_body_0|> <|body_start_1|> try: return await self.response except error.RenderableError as e: ...
A utility class that offers the :attr:`response_raising` and :attr:`response_nonraising` alternatives to waiting for the :attr:`response` future whose error states can be presented either as an unsuccessful response (eg. 4.04) or an exception. It also provides some internal tools for handling anything that has a :attr:...
BaseUnicastRequest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseUnicastRequest: """A utility class that offers the :attr:`response_raising` and :attr:`response_nonraising` alternatives to waiting for the :attr:`response` future whose error states can be presented either as an unsuccessful response (eg. 4.04) or an exception. It also provides some internal...
stack_v2_sparse_classes_75kplus_train_066978
43,955
permissive
[ { "docstring": "An awaitable that returns if a response comes in and is successful, otherwise raises generic network exception or a :class:`.error.ResponseWrappingError` for unsuccessful responses. Experimental Interface.", "name": "response_raising", "signature": "async def response_raising(self)" },...
2
stack_v2_sparse_classes_30k_train_018966
Implement the Python class `BaseUnicastRequest` described below. Class description: A utility class that offers the :attr:`response_raising` and :attr:`response_nonraising` alternatives to waiting for the :attr:`response` future whose error states can be presented either as an unsuccessful response (eg. 4.04) or an ex...
Implement the Python class `BaseUnicastRequest` described below. Class description: A utility class that offers the :attr:`response_raising` and :attr:`response_nonraising` alternatives to waiting for the :attr:`response` future whose error states can be presented either as an unsuccessful response (eg. 4.04) or an ex...
66bd6f66b5ba9f17c5c688dfae51a3aace7e0070
<|skeleton|> class BaseUnicastRequest: """A utility class that offers the :attr:`response_raising` and :attr:`response_nonraising` alternatives to waiting for the :attr:`response` future whose error states can be presented either as an unsuccessful response (eg. 4.04) or an exception. It also provides some internal...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BaseUnicastRequest: """A utility class that offers the :attr:`response_raising` and :attr:`response_nonraising` alternatives to waiting for the :attr:`response` future whose error states can be presented either as an unsuccessful response (eg. 4.04) or an exception. It also provides some internal tools for ha...
the_stack_v2_python_sparse
aiocoap/protocol.py
chrysn/aiocoap
train
258
942f7e2ac06f33815a91e6f04e0527deb23a6d66
[ "expected_result = np.array([[0.0125, 0.03125, 0.196875, 0.03125, 0.0125], [0.025, 0.0625, 0.29375, 0.0625, 0.025], [0.05, 0.125, 0.3375, 0.125, 0.05], [0.0, 0.0, 0.175, 0.0, 0.0], [0.0, 0.0, 0.1, 0.0, 0.0]])\nresult = RecursiveFilter(edge_width=1)._recurse_backward(self.cube.data[0, :], self.smoothing_coefficients...
<|body_start_0|> expected_result = np.array([[0.0125, 0.03125, 0.196875, 0.03125, 0.0125], [0.025, 0.0625, 0.29375, 0.0625, 0.025], [0.05, 0.125, 0.3375, 0.125, 0.05], [0.0, 0.0, 0.175, 0.0, 0.0], [0.0, 0.0, 0.1, 0.0, 0.0]]) result = RecursiveFilter(edge_width=1)._recurse_backward(self.cube.data[0, :], ...
Test the _recurse_backward method
Test__recurse_backward
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test__recurse_backward: """Test the _recurse_backward method""" def test_first_axis(self): """Test that the returned _recurse_backward array has the expected type and result.""" <|body_0|> def test_second_axis(self): """Test that the returned _recurse_backward ar...
stack_v2_sparse_classes_75kplus_train_066979
22,857
permissive
[ { "docstring": "Test that the returned _recurse_backward array has the expected type and result.", "name": "test_first_axis", "signature": "def test_first_axis(self)" }, { "docstring": "Test that the returned _recurse_backward array has the expected type and result.", "name": "test_second_ax...
2
stack_v2_sparse_classes_30k_train_041409
Implement the Python class `Test__recurse_backward` described below. Class description: Test the _recurse_backward method Method signatures and docstrings: - def test_first_axis(self): Test that the returned _recurse_backward array has the expected type and result. - def test_second_axis(self): Test that the returned...
Implement the Python class `Test__recurse_backward` described below. Class description: Test the _recurse_backward method Method signatures and docstrings: - def test_first_axis(self): Test that the returned _recurse_backward array has the expected type and result. - def test_second_axis(self): Test that the returned...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test__recurse_backward: """Test the _recurse_backward method""" def test_first_axis(self): """Test that the returned _recurse_backward array has the expected type and result.""" <|body_0|> def test_second_axis(self): """Test that the returned _recurse_backward ar...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Test__recurse_backward: """Test the _recurse_backward method""" def test_first_axis(self): """Test that the returned _recurse_backward array has the expected type and result.""" expected_result = np.array([[0.0125, 0.03125, 0.196875, 0.03125, 0.0125], [0.025, 0.0625, 0.29375, 0.0625, 0.02...
the_stack_v2_python_sparse
improver_tests/nbhood/recursive_filter/test_RecursiveFilter.py
metoppv/improver
train
101
204837e6365227f2b5c9259cee61720831530093
[ "f = self.RequiredForm()\np = f.as_p()\nself.assert_('<input type=\"file\" name=\"files[]\" id=\"id_files0\" />' in p)", "f = self.MultiForm()\np = f.as_p()\nself.assert_('<input type=\"file\" name=\"files[]\" id=\"id_files0\" />' in p)\nself.assert_('<input type=\"file\" name=\"files[]\" id=\"id_files1\" />' in ...
<|body_start_0|> f = self.RequiredForm() p = f.as_p() self.assert_('<input type="file" name="files[]" id="id_files0" />' in p) <|end_body_0|> <|body_start_1|> f = self.MultiForm() p = f.as_p() self.assert_('<input type="file" name="files[]" id="id_files0" />' in p) ...
Tests that MultiFileField field.
MultiFileFieldTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiFileFieldTest: """Tests that MultiFileField field.""" def testOneRender(self): """Test the rendering of a MultiFileField with 1 input box.""" <|body_0|> def testTwoRender(self): """Test the rendering of a MultiFileField with 2 input boxes.""" <|body_...
stack_v2_sparse_classes_75kplus_train_066980
3,598
no_license
[ { "docstring": "Test the rendering of a MultiFileField with 1 input box.", "name": "testOneRender", "signature": "def testOneRender(self)" }, { "docstring": "Test the rendering of a MultiFileField with 2 input boxes.", "name": "testTwoRender", "signature": "def testTwoRender(self)" }, ...
4
stack_v2_sparse_classes_30k_test_002566
Implement the Python class `MultiFileFieldTest` described below. Class description: Tests that MultiFileField field. Method signatures and docstrings: - def testOneRender(self): Test the rendering of a MultiFileField with 1 input box. - def testTwoRender(self): Test the rendering of a MultiFileField with 2 input boxe...
Implement the Python class `MultiFileFieldTest` described below. Class description: Tests that MultiFileField field. Method signatures and docstrings: - def testOneRender(self): Test the rendering of a MultiFileField with 1 input box. - def testTwoRender(self): Test the rendering of a MultiFileField with 2 input boxe...
2791145f62a7e296be859a400499812b394249e9
<|skeleton|> class MultiFileFieldTest: """Tests that MultiFileField field.""" def testOneRender(self): """Test the rendering of a MultiFileField with 1 input box.""" <|body_0|> def testTwoRender(self): """Test the rendering of a MultiFileField with 2 input boxes.""" <|body_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MultiFileFieldTest: """Tests that MultiFileField field.""" def testOneRender(self): """Test the rendering of a MultiFileField with 1 input box.""" f = self.RequiredForm() p = f.as_p() self.assert_('<input type="file" name="files[]" id="id_files0" />' in p) def testTwo...
the_stack_v2_python_sparse
combaragi/ccboard/tests.py
yonseics/yonseics
train
1
951d03847e11ef5a80a9a7becd95a904fac31a6f
[ "try:\n self.wait(5).until(EC.presence_of_element_located(self.login_locator))\n user_is_loggedin = False\nexcept:\n user_is_loggedin = True\nreturn user_is_loggedin", "if self.is_user_loggedin() != True:\n user_name_element = self.wait().until(EC.visibility_of_element_located(self.user_name_locator),...
<|body_start_0|> try: self.wait(5).until(EC.presence_of_element_located(self.login_locator)) user_is_loggedin = False except: user_is_loggedin = True return user_is_loggedin <|end_body_0|> <|body_start_1|> if self.is_user_loggedin() != True: ...
Contains Login UI page locators Login function
LoginPage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoginPage: """Contains Login UI page locators Login function""" def is_user_loggedin(self): """Check if the user is already logged in or not :return: True/False""" <|body_0|> def perform_login(self, user_name, password): """Implementing Login functionality :param...
stack_v2_sparse_classes_75kplus_train_066981
1,890
no_license
[ { "docstring": "Check if the user is already logged in or not :return: True/False", "name": "is_user_loggedin", "signature": "def is_user_loggedin(self)" }, { "docstring": "Implementing Login functionality :param user_name: :param password: :return:", "name": "perform_login", "signature"...
2
stack_v2_sparse_classes_30k_train_001204
Implement the Python class `LoginPage` described below. Class description: Contains Login UI page locators Login function Method signatures and docstrings: - def is_user_loggedin(self): Check if the user is already logged in or not :return: True/False - def perform_login(self, user_name, password): Implementing Login...
Implement the Python class `LoginPage` described below. Class description: Contains Login UI page locators Login function Method signatures and docstrings: - def is_user_loggedin(self): Check if the user is already logged in or not :return: True/False - def perform_login(self, user_name, password): Implementing Login...
6b8830b702e41b73d3b55b9db957635890453414
<|skeleton|> class LoginPage: """Contains Login UI page locators Login function""" def is_user_loggedin(self): """Check if the user is already logged in or not :return: True/False""" <|body_0|> def perform_login(self, user_name, password): """Implementing Login functionality :param...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LoginPage: """Contains Login UI page locators Login function""" def is_user_loggedin(self): """Check if the user is already logged in or not :return: True/False""" try: self.wait(5).until(EC.presence_of_element_located(self.login_locator)) user_is_loggedin = False ...
the_stack_v2_python_sparse
Test_Automation/TestFramework/Libraries/Pages/login_page.py
praveenreddynarala/RobotFramework
train
0
1b8966dab0538a1e9b8ed464c26ff46fe285eed0
[ "if not intervals:\n return 0\nintervals.sort()\nroom_num = 1\nrooms = [[] for _ in intervals]\nrooms[0].append(intervals[0])\nfor i in range(1, len(intervals)):\n for j in range(len(rooms)):\n if rooms[j] != []:\n last_int = rooms[j][-1]\n if intervals[i][0] >= last_int[1]:\n ...
<|body_start_0|> if not intervals: return 0 intervals.sort() room_num = 1 rooms = [[] for _ in intervals] rooms[0].append(intervals[0]) for i in range(1, len(intervals)): for j in range(len(rooms)): if rooms[j] != []: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minMeetingRooms(self, intervals): """Algorithm: go through all the intervals, and see if current interval can be added to a existing room, if not, create a new room for current interval return the final number of rooms created""" <|body_0|> def minMeetingRoomsH...
stack_v2_sparse_classes_75kplus_train_066982
2,318
no_license
[ { "docstring": "Algorithm: go through all the intervals, and see if current interval can be added to a existing room, if not, create a new room for current interval return the final number of rooms created", "name": "minMeetingRooms", "signature": "def minMeetingRooms(self, intervals)" }, { "doc...
2
stack_v2_sparse_classes_30k_train_051814
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minMeetingRooms(self, intervals): Algorithm: go through all the intervals, and see if current interval can be added to a existing room, if not, create a new room for current ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minMeetingRooms(self, intervals): Algorithm: go through all the intervals, and see if current interval can be added to a existing room, if not, create a new room for current ...
7eddbc93a237d1d5cabcdc67806b01ff55ea8562
<|skeleton|> class Solution: def minMeetingRooms(self, intervals): """Algorithm: go through all the intervals, and see if current interval can be added to a existing room, if not, create a new room for current interval return the final number of rooms created""" <|body_0|> def minMeetingRoomsH...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def minMeetingRooms(self, intervals): """Algorithm: go through all the intervals, and see if current interval can be added to a existing room, if not, create a new room for current interval return the final number of rooms created""" if not intervals: return 0 int...
the_stack_v2_python_sparse
LeetCode Problems/Array/Meeting Rooms II.py
GZHOUW/Algorithm
train
0
63ecff1f4c873a82cf948bd1b905c127a90cbd43
[ "in0 = np.random.rand(1, 1)\nin1 = np.random.rand(4000, 4000)\ncheck0 = sps.medfilt2d(in0, 5)\ncheck1 = sps.medfilt2d(in1, 5)\nself.assertTrue(np.allclose(check0, mf.MedianFilter(kernel_size=5, input=[in0])[0]))\nself.assertTrue(np.allclose(check1, mf.MedianFilter(kernel_size=5, input=[in1])[0]))", "in0 = np.rand...
<|body_start_0|> in0 = np.random.rand(1, 1) in1 = np.random.rand(4000, 4000) check0 = sps.medfilt2d(in0, 5) check1 = sps.medfilt2d(in1, 5) self.assertTrue(np.allclose(check0, mf.MedianFilter(kernel_size=5, input=[in0])[0])) self.assertTrue(np.allclose(check1, mf.MedianFil...
BigTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BigTest: def testFivebyFive(self): """Test using a 5x5 window""" <|body_0|> def testNinebyNine(self): """Test using a 9x9 window""" <|body_1|> <|end_skeleton|> <|body_start_0|> in0 = np.random.rand(1, 1) in1 = np.random.rand(4000, 4000) ...
stack_v2_sparse_classes_75kplus_train_066983
902
no_license
[ { "docstring": "Test using a 5x5 window", "name": "testFivebyFive", "signature": "def testFivebyFive(self)" }, { "docstring": "Test using a 9x9 window", "name": "testNinebyNine", "signature": "def testNinebyNine(self)" } ]
2
null
Implement the Python class `BigTest` described below. Class description: Implement the BigTest class. Method signatures and docstrings: - def testFivebyFive(self): Test using a 5x5 window - def testNinebyNine(self): Test using a 9x9 window
Implement the Python class `BigTest` described below. Class description: Implement the BigTest class. Method signatures and docstrings: - def testFivebyFive(self): Test using a 5x5 window - def testNinebyNine(self): Test using a 9x9 window <|skeleton|> class BigTest: def testFivebyFive(self): """Test us...
c02e4d3bb3b3959e1be43e46cbc0fa38c900ee7d
<|skeleton|> class BigTest: def testFivebyFive(self): """Test using a 5x5 window""" <|body_0|> def testNinebyNine(self): """Test using a 9x9 window""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BigTest: def testFivebyFive(self): """Test using a 5x5 window""" in0 = np.random.rand(1, 1) in1 = np.random.rand(4000, 4000) check0 = sps.medfilt2d(in0, 5) check1 = sps.medfilt2d(in1, 5) self.assertTrue(np.allclose(check0, mf.MedianFilter(kernel_size=5, input=[i...
the_stack_v2_python_sparse
mf/test_big.py
Jackmastr/cuda_sandbox
train
0
d3cf85de89fc4da88cb6c583465f2d232ee3017d
[ "engine = db_connect()\ncreate_table(engine)\nself.Session = sessionmaker(bind=engine)", "session = self.Session()\nyoutube_db = YoutubeCelebrityInfoDB()\nyoutube_db.keyword = item['keyword']\nyoutube_db.name = item['name']\nyoutube_db.homepage_link = item['homepage_link']\nyoutube_db.description = item['descript...
<|body_start_0|> engine = db_connect() create_table(engine) self.Session = sessionmaker(bind=engine) <|end_body_0|> <|body_start_1|> session = self.Session() youtube_db = YoutubeCelebrityInfoDB() youtube_db.keyword = item['keyword'] youtube_db.name = item['name']...
YoutubeCelebrityInfoPipeline
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class YoutubeCelebrityInfoPipeline: def __init__(self): """Initializes database connection and sessionmaker. Creates deals table.""" <|body_0|> def process_item(self, item, spider): """Save deals in the database. This method is called for every item pipeline component.""" ...
stack_v2_sparse_classes_75kplus_train_066984
2,658
no_license
[ { "docstring": "Initializes database connection and sessionmaker. Creates deals table.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Save deals in the database. This method is called for every item pipeline component.", "name": "process_item", "signature": "d...
2
null
Implement the Python class `YoutubeCelebrityInfoPipeline` described below. Class description: Implement the YoutubeCelebrityInfoPipeline class. Method signatures and docstrings: - def __init__(self): Initializes database connection and sessionmaker. Creates deals table. - def process_item(self, item, spider): Save de...
Implement the Python class `YoutubeCelebrityInfoPipeline` described below. Class description: Implement the YoutubeCelebrityInfoPipeline class. Method signatures and docstrings: - def __init__(self): Initializes database connection and sessionmaker. Creates deals table. - def process_item(self, item, spider): Save de...
2af304f7971a60569ed51a1fb157299426919b08
<|skeleton|> class YoutubeCelebrityInfoPipeline: def __init__(self): """Initializes database connection and sessionmaker. Creates deals table.""" <|body_0|> def process_item(self, item, spider): """Save deals in the database. This method is called for every item pipeline component.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class YoutubeCelebrityInfoPipeline: def __init__(self): """Initializes database connection and sessionmaker. Creates deals table.""" engine = db_connect() create_table(engine) self.Session = sessionmaker(bind=engine) def process_item(self, item, spider): """Save deals in...
the_stack_v2_python_sparse
scrapy_spider/pipelines_.py
windshallow/youtube_scraper
train
1
a57776d7e32d4849b590e837cbcf4b5fd735f187
[ "cmd = 'sound = ' + self._val(reg)\nself.exc.execs(cmd)\nreturn f'{self.i}: ' + cmd", "if int(self._val(reg)) != 0:\n m = '{}: sound = {}'.format(self.i, self.exc.sbox_locals['sound'])\n raise StopIteration(m)" ]
<|body_start_0|> cmd = 'sound = ' + self._val(reg) self.exc.execs(cmd) return f'{self.i}: ' + cmd <|end_body_0|> <|body_start_1|> if int(self._val(reg)) != 0: m = '{}: sound = {}'.format(self.i, self.exc.sbox_locals['sound']) raise StopIteration(m) <|end_body_1|>...
Part1Program
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Part1Program: def _snd(self, reg: str) -> str: """An implementation of Interpreter.snd() for Part 1 of the puzzle""" <|body_0|> def _rcv(self, reg: str): """An implementation of Interpreter.rcv() for Part 1 of the puzzle""" <|body_1|> <|end_skeleton|> <|bod...
stack_v2_sparse_classes_75kplus_train_066985
6,238
no_license
[ { "docstring": "An implementation of Interpreter.snd() for Part 1 of the puzzle", "name": "_snd", "signature": "def _snd(self, reg: str) -> str" }, { "docstring": "An implementation of Interpreter.rcv() for Part 1 of the puzzle", "name": "_rcv", "signature": "def _rcv(self, reg: str)" ...
2
stack_v2_sparse_classes_30k_train_016555
Implement the Python class `Part1Program` described below. Class description: Implement the Part1Program class. Method signatures and docstrings: - def _snd(self, reg: str) -> str: An implementation of Interpreter.snd() for Part 1 of the puzzle - def _rcv(self, reg: str): An implementation of Interpreter.rcv() for Pa...
Implement the Python class `Part1Program` described below. Class description: Implement the Part1Program class. Method signatures and docstrings: - def _snd(self, reg: str) -> str: An implementation of Interpreter.snd() for Part 1 of the puzzle - def _rcv(self, reg: str): An implementation of Interpreter.rcv() for Pa...
60d33ddbc138e265e1248259fb6777fc02407f0f
<|skeleton|> class Part1Program: def _snd(self, reg: str) -> str: """An implementation of Interpreter.snd() for Part 1 of the puzzle""" <|body_0|> def _rcv(self, reg: str): """An implementation of Interpreter.rcv() for Part 1 of the puzzle""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Part1Program: def _snd(self, reg: str) -> str: """An implementation of Interpreter.snd() for Part 1 of the puzzle""" cmd = 'sound = ' + self._val(reg) self.exc.execs(cmd) return f'{self.i}: ' + cmd def _rcv(self, reg: str): """An implementation of Interpreter.rcv()...
the_stack_v2_python_sparse
18_duet.py
davidstaab/AOC17
train
0
5b82728ecdb8af261742df9cdf47c4237b1d2a6e
[ "osh = ObjectStateHolder('mscsresource')\nosh.setAttribute('data_name', resource.name)\nif resource.details:\n details = resource.details\n if details.description:\n osh.setStringAttribute('data_description', details.description)\n if details.type is not None:\n osh.setStringAttribute('type',...
<|body_start_0|> osh = ObjectStateHolder('mscsresource') osh.setAttribute('data_name', resource.name) if resource.details: details = resource.details if details.description: osh.setStringAttribute('data_description', details.description) if det...
ResourceBuilder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResourceBuilder: def buildResource(self, resource): """@types: Resource -> ObjectStateHolder""" <|body_0|> def buildResourcePdo(self, pdo): """@types: Builder.Pdo -> ObjectStateHolder""" <|body_1|> <|end_skeleton|> <|body_start_0|> osh = ObjectState...
stack_v2_sparse_classes_75kplus_train_066986
15,554
no_license
[ { "docstring": "@types: Resource -> ObjectStateHolder", "name": "buildResource", "signature": "def buildResource(self, resource)" }, { "docstring": "@types: Builder.Pdo -> ObjectStateHolder", "name": "buildResourcePdo", "signature": "def buildResourcePdo(self, pdo)" } ]
2
stack_v2_sparse_classes_30k_train_047844
Implement the Python class `ResourceBuilder` described below. Class description: Implement the ResourceBuilder class. Method signatures and docstrings: - def buildResource(self, resource): @types: Resource -> ObjectStateHolder - def buildResourcePdo(self, pdo): @types: Builder.Pdo -> ObjectStateHolder
Implement the Python class `ResourceBuilder` described below. Class description: Implement the ResourceBuilder class. Method signatures and docstrings: - def buildResource(self, resource): @types: Resource -> ObjectStateHolder - def buildResourcePdo(self, pdo): @types: Builder.Pdo -> ObjectStateHolder <|skeleton|> c...
c431e809e8d0f82e1bca7e3429dd0245560b5680
<|skeleton|> class ResourceBuilder: def buildResource(self, resource): """@types: Resource -> ObjectStateHolder""" <|body_0|> def buildResourcePdo(self, pdo): """@types: Builder.Pdo -> ObjectStateHolder""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ResourceBuilder: def buildResource(self, resource): """@types: Resource -> ObjectStateHolder""" osh = ObjectStateHolder('mscsresource') osh.setAttribute('data_name', resource.name) if resource.details: details = resource.details if details.description: ...
the_stack_v2_python_sparse
reference/ucmdb/discovery/ms_cluster.py
madmonkyang/cda-record
train
0
5c85b8021c67cf302622c215b1e7b4d784c0cb2d
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn IntelligenceProfile()", "from ..entity import Entity\nfrom .formatted_content import FormattedContent\nfrom .intelligence_profile_country_or_region_of_origin import IntelligenceProfileCountryOrRegionOfOrigin\nfrom .intelligence_profile...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return IntelligenceProfile() <|end_body_0|> <|body_start_1|> from ..entity import Entity from .formatted_content import FormattedContent from .intelligence_profile_country_or_region_of_...
IntelligenceProfile
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IntelligenceProfile: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IntelligenceProfile: """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 ob...
stack_v2_sparse_classes_75kplus_train_066987
6,060
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: IntelligenceProfile", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator...
3
stack_v2_sparse_classes_30k_train_041896
Implement the Python class `IntelligenceProfile` described below. Class description: Implement the IntelligenceProfile class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IntelligenceProfile: Creates a new instance of the appropriate class based on d...
Implement the Python class `IntelligenceProfile` described below. Class description: Implement the IntelligenceProfile class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IntelligenceProfile: Creates a new instance of the appropriate class based on d...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class IntelligenceProfile: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IntelligenceProfile: """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 ob...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class IntelligenceProfile: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IntelligenceProfile: """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: ...
the_stack_v2_python_sparse
msgraph/generated/models/security/intelligence_profile.py
microsoftgraph/msgraph-sdk-python
train
135
0fc1fb19b44468dcc64c18ab486eba23e4edf1a4
[ "if not txt:\n raise error.BadArgument('Empty Object ID')\nobjid_s = string.split(txt, '.')\nobjid_s = filter(lambda x: len(x), objid_s)\ntry:\n objid_n = map(lambda x: string.atol(x), objid_s)\nexcept:\n raise error.BadArgument('Malformed Object ID: ' + str(txt))\nif not len(objid_n):\n raise error.Bad...
<|body_start_0|> if not txt: raise error.BadArgument('Empty Object ID') objid_s = string.split(txt, '.') objid_s = filter(lambda x: len(x), objid_s) try: objid_n = map(lambda x: string.atol(x), objid_s) except: raise error.BadArgument('Malforme...
Implement various convertions of ASN1 Object ID's value
objid
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class objid: """Implement various convertions of ASN1 Object ID's value""" def str2nums(self, txt): """str2nums(obj_id) -> object id Convert Object ID (given as string) into a list of integer sub IDs.""" <|body_0|> def nums2str(self, objid_n): """nums2str(obj_id) -> ob...
stack_v2_sparse_classes_75kplus_train_066988
1,815
no_license
[ { "docstring": "str2nums(obj_id) -> object id Convert Object ID (given as string) into a list of integer sub IDs.", "name": "str2nums", "signature": "def str2nums(self, txt)" }, { "docstring": "nums2str(obj_id) -> object id Convert Object ID (given as a list of integer sub Object IDs) into strin...
2
stack_v2_sparse_classes_30k_val_000771
Implement the Python class `objid` described below. Class description: Implement various convertions of ASN1 Object ID's value Method signatures and docstrings: - def str2nums(self, txt): str2nums(obj_id) -> object id Convert Object ID (given as string) into a list of integer sub IDs. - def nums2str(self, objid_n): n...
Implement the Python class `objid` described below. Class description: Implement various convertions of ASN1 Object ID's value Method signatures and docstrings: - def str2nums(self, txt): str2nums(obj_id) -> object id Convert Object ID (given as string) into a list of integer sub IDs. - def nums2str(self, objid_n): n...
f7f5edd58527a3ad98497b994f5d1b6d4c2c8b25
<|skeleton|> class objid: """Implement various convertions of ASN1 Object ID's value""" def str2nums(self, txt): """str2nums(obj_id) -> object id Convert Object ID (given as string) into a list of integer sub IDs.""" <|body_0|> def nums2str(self, objid_n): """nums2str(obj_id) -> ob...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class objid: """Implement various convertions of ASN1 Object ID's value""" def str2nums(self, txt): """str2nums(obj_id) -> object id Convert Object ID (given as string) into a list of integer sub IDs.""" if not txt: raise error.BadArgument('Empty Object ID') objid_s = string...
the_stack_v2_python_sparse
eddie/eddietool/common/Extra/pysnmp/objid.py
dimasajipangestu/belajarpostgres2
train
0
79197e702409d13ab78abb8bb7dec1b13ca98275
[ "if not root:\n return ''\nqueue = deque([root])\nret = []\nwhile queue:\n n = queue.popleft()\n if n is not None:\n ret.append(str(n.val))\n queue.append(n.left)\n queue.append(n.right)\n else:\n ret.append('.')\nwhile ret[-1] == '.':\n ret.pop()\nreturn '_'.join(ret)", ...
<|body_start_0|> if not root: return '' queue = deque([root]) ret = [] while queue: n = queue.popleft() if n is not None: ret.append(str(n.val)) queue.append(n.left) queue.append(n.right) else...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_75kplus_train_066989
3,577
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_050875
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: return '' queue = deque([root]) ret = [] while queue: n = queue.popleft() if n is not None: ret.a...
the_stack_v2_python_sparse
leetcode/solved/297_Serialize_and_Deserialize_Binary_Tree/solution.py
sungminoh/algorithms
train
0
00a16404f30a7f2e6baa4e684ec4435e5ae5287a
[ "self.corpora = self.process_corpora(corporaList, stopwords_f)\nprint('loading pre-trained w2v model...')\ntic = time.time()\nif pretrained_w2v:\n self.w2v_model = pretrained_w2v\nelif w2v_f.endswith('.bin'):\n self.w2v_model = gensim.models.KeyedVectors.load_word2vec_format(w2v_f, binary=True)\nelse:\n se...
<|body_start_0|> self.corpora = self.process_corpora(corporaList, stopwords_f) print('loading pre-trained w2v model...') tic = time.time() if pretrained_w2v: self.w2v_model = pretrained_w2v elif w2v_f.endswith('.bin'): self.w2v_model = gensim.models.KeyedV...
W2VModel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class W2VModel: def __init__(self, corporaList, w2v_f, stopwords_f, pretrained_w2v=None, saved_corpora_vec_M=None): """实现使用语言模型对句子和句子, 词语对句子的匹配. 初始化模型: StatisticModel(corpora) Args: corporaList: 多个语料组成的列表, 应该是一个嵌套Python列表. For example: [["There", "is", "a", "cat"], ["There", "is", "a", "dog"],...
stack_v2_sparse_classes_75kplus_train_066990
8,398
no_license
[ { "docstring": "实现使用语言模型对句子和句子, 词语对句子的匹配. 初始化模型: StatisticModel(corpora) Args: corporaList: 多个语料组成的列表, 应该是一个嵌套Python列表. For example: [[\"There\", \"is\", \"a\", \"cat\"], [\"There\", \"is\", \"a\", \"dog\"], [\"There\", \"is\", \"a\", \"wolf\"]] w2v_f: str, 预训练的词向量文件路径 stopwords_f: str, 停用词文件 pretrained_w2v: ge...
6
stack_v2_sparse_classes_30k_train_024885
Implement the Python class `W2VModel` described below. Class description: Implement the W2VModel class. Method signatures and docstrings: - def __init__(self, corporaList, w2v_f, stopwords_f, pretrained_w2v=None, saved_corpora_vec_M=None): 实现使用语言模型对句子和句子, 词语对句子的匹配. 初始化模型: StatisticModel(corpora) Args: corporaList: 多个...
Implement the Python class `W2VModel` described below. Class description: Implement the W2VModel class. Method signatures and docstrings: - def __init__(self, corporaList, w2v_f, stopwords_f, pretrained_w2v=None, saved_corpora_vec_M=None): 实现使用语言模型对句子和句子, 词语对句子的匹配. 初始化模型: StatisticModel(corpora) Args: corporaList: 多个...
c2a20a430de197d06dca5ada96160388730a5db5
<|skeleton|> class W2VModel: def __init__(self, corporaList, w2v_f, stopwords_f, pretrained_w2v=None, saved_corpora_vec_M=None): """实现使用语言模型对句子和句子, 词语对句子的匹配. 初始化模型: StatisticModel(corpora) Args: corporaList: 多个语料组成的列表, 应该是一个嵌套Python列表. For example: [["There", "is", "a", "cat"], ["There", "is", "a", "dog"],...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class W2VModel: def __init__(self, corporaList, w2v_f, stopwords_f, pretrained_w2v=None, saved_corpora_vec_M=None): """实现使用语言模型对句子和句子, 词语对句子的匹配. 初始化模型: StatisticModel(corpora) Args: corporaList: 多个语料组成的列表, 应该是一个嵌套Python列表. For example: [["There", "is", "a", "cat"], ["There", "is", "a", "dog"], ["There", "is...
the_stack_v2_python_sparse
Models/Word2Vec/API/Word2VecModel.py
JaMesLiMers/Image_Retrieval_Framework_FYP
train
2
56183902770fadcf1e11ffbfda8ff0b569ab8b12
[ "self._buff = ''\nself._termDeferred = termDeferred\nself._escalation = 0\nself._stopCall = None", "self._buff += data\nlines = [line for line in self._buff.split('\\n')]\nself._buff = lines[-1]\nfor line in lines[:-1]:\n log.msg(line)", "if reason.value.exitCode != 0:\n log.msg(reason)\nself._escalation ...
<|body_start_0|> self._buff = '' self._termDeferred = termDeferred self._escalation = 0 self._stopCall = None <|end_body_0|> <|body_start_1|> self._buff += data lines = [line for line in self._buff.split('\n')] self._buff = lines[-1] for line in lines[:-1...
Simple ProcessProtocol which forwards the stdout of the subprocesses to the stdout of this process in a orderly fashion.
LoggerProtocol
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoggerProtocol: """Simple ProcessProtocol which forwards the stdout of the subprocesses to the stdout of this process in a orderly fashion.""" def __init__(self, termDeferred): """Initialize the LoggerProtocol.""" <|body_0|> def outReceived(self, data): """Callba...
stack_v2_sparse_classes_75kplus_train_066991
6,407
permissive
[ { "docstring": "Initialize the LoggerProtocol.", "name": "__init__", "signature": "def __init__(self, termDeferred)" }, { "docstring": "Callback which is called by twisted when new data has arrived from subprocess.", "name": "outReceived", "signature": "def outReceived(self, data)" }, ...
4
stack_v2_sparse_classes_30k_train_008111
Implement the Python class `LoggerProtocol` described below. Class description: Simple ProcessProtocol which forwards the stdout of the subprocesses to the stdout of this process in a orderly fashion. Method signatures and docstrings: - def __init__(self, termDeferred): Initialize the LoggerProtocol. - def outReceive...
Implement the Python class `LoggerProtocol` described below. Class description: Simple ProcessProtocol which forwards the stdout of the subprocesses to the stdout of this process in a orderly fashion. Method signatures and docstrings: - def __init__(self, termDeferred): Initialize the LoggerProtocol. - def outReceive...
c277efd809fce8f0f18b009fb3b9c7f785cc3739
<|skeleton|> class LoggerProtocol: """Simple ProcessProtocol which forwards the stdout of the subprocesses to the stdout of this process in a orderly fashion.""" def __init__(self, termDeferred): """Initialize the LoggerProtocol.""" <|body_0|> def outReceived(self, data): """Callba...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LoggerProtocol: """Simple ProcessProtocol which forwards the stdout of the subprocesses to the stdout of this process in a orderly fashion.""" def __init__(self, termDeferred): """Initialize the LoggerProtocol.""" self._buff = '' self._termDeferred = termDeferred self._esc...
the_stack_v2_python_sparse
framework/initMachine.py
LCROBOT/rce
train
0
16e2ed0a28c699ed0b8a52e24fd15417c9207ada
[ "if measurement.fingerprint == 'type=elasticsearch, operation=search, search_type=aggs':\n agg_dsl = measurement.cfg.get('dsl') if measurement.cfg.get('dsl') else None\n if 'size' not in agg_dsl:\n agg_dsl['size'] = 0\n es_msearch_body.extend(({'index': es_index_info['index']}, measurement.cfg.get('...
<|body_start_0|> if measurement.fingerprint == 'type=elasticsearch, operation=search, search_type=aggs': agg_dsl = measurement.cfg.get('dsl') if measurement.cfg.get('dsl') else None if 'size' not in agg_dsl: agg_dsl['size'] = 0 es_msearch_body.extend(({'index'...
ES aggregation 采集器, 已经废弃,统一使用EsSearchCollector
EsAggregationCollector
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EsAggregationCollector: """ES aggregation 采集器, 已经废弃,统一使用EsSearchCollector""" def _get_es_msearch_dsl(self, es_index_info, measurement, es_msearch_body): """获取ES msearch dsl :param es_index_info: :param measurement: :param es_msearch_body: :return:""" <|body_0|> def _pars...
stack_v2_sparse_classes_75kplus_train_066992
12,040
permissive
[ { "docstring": "获取ES msearch dsl :param es_index_info: :param measurement: :param es_msearch_body: :return:", "name": "_get_es_msearch_dsl", "signature": "def _get_es_msearch_dsl(self, es_index_info, measurement, es_msearch_body)" }, { "docstring": "解析ES msearch aggs result :param es_index_list:...
2
null
Implement the Python class `EsAggregationCollector` described below. Class description: ES aggregation 采集器, 已经废弃,统一使用EsSearchCollector Method signatures and docstrings: - def _get_es_msearch_dsl(self, es_index_info, measurement, es_msearch_body): 获取ES msearch dsl :param es_index_info: :param measurement: :param es_ms...
Implement the Python class `EsAggregationCollector` described below. Class description: ES aggregation 采集器, 已经废弃,统一使用EsSearchCollector Method signatures and docstrings: - def _get_es_msearch_dsl(self, es_index_info, measurement, es_msearch_body): 获取ES msearch dsl :param es_index_info: :param measurement: :param es_ms...
a72b4e4d78b4375f69887e75abcc1e6a6782c551
<|skeleton|> class EsAggregationCollector: """ES aggregation 采集器, 已经废弃,统一使用EsSearchCollector""" def _get_es_msearch_dsl(self, es_index_info, measurement, es_msearch_body): """获取ES msearch dsl :param es_index_info: :param measurement: :param es_msearch_body: :return:""" <|body_0|> def _pars...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EsAggregationCollector: """ES aggregation 采集器, 已经废弃,统一使用EsSearchCollector""" def _get_es_msearch_dsl(self, es_index_info, measurement, es_msearch_body): """获取ES msearch dsl :param es_index_info: :param measurement: :param es_msearch_body: :return:""" if measurement.fingerprint == 'type=el...
the_stack_v2_python_sparse
measure/collectors.py
RitterHou/search_platform
train
0
655dbf220ed4a0350fcfe145acc66a8ee0df94ae
[ "ndim = len(shape)\nassert ndim in [2, 3]\nheight, width = shape[:2]\ndepth = 1 if ndim == 2 else shape[2]\nreturn cls(shape, ndim, height, width, depth)", "if self.ndim != data.ndim:\n return False\nif self.ndim == 3 and self.depth != data.shape[2]:\n return False\nif data.shape[0] > self.height or data.sh...
<|body_start_0|> ndim = len(shape) assert ndim in [2, 3] height, width = shape[:2] depth = 1 if ndim == 2 else shape[2] return cls(shape, ndim, height, width, depth) <|end_body_0|> <|body_start_1|> if self.ndim != data.ndim: return False if self.ndim ...
Specification for the tiles in the atlas. Parameters ---------- shape : np.darray The shape of single tile. ndim : int The number of dimension in the shape of the tile. height : int The height of a tile. width : int The width of a tile. depth : int The depth of a tile, 1 for grayscale or RGB/RGBA.
TileSpec
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TileSpec: """Specification for the tiles in the atlas. Parameters ---------- shape : np.darray The shape of single tile. ndim : int The number of dimension in the shape of the tile. height : int The height of a tile. width : int The width of a tile. depth : int The depth of a tile, 1 for grayscal...
stack_v2_sparse_classes_75kplus_train_066993
11,936
permissive
[ { "docstring": "Create a TileSpec from just the shape. Parameters ---------- shape : np.darray Create a TileSpec based on this shape.", "name": "from_shape", "signature": "def from_shape(cls, shape: np.ndarray)" }, { "docstring": "Return True if the given data is compatible with our tiles. Param...
2
stack_v2_sparse_classes_30k_train_000220
Implement the Python class `TileSpec` described below. Class description: Specification for the tiles in the atlas. Parameters ---------- shape : np.darray The shape of single tile. ndim : int The number of dimension in the shape of the tile. height : int The height of a tile. width : int The width of a tile. depth : ...
Implement the Python class `TileSpec` described below. Class description: Specification for the tiles in the atlas. Parameters ---------- shape : np.darray The shape of single tile. ndim : int The number of dimension in the shape of the tile. height : int The height of a tile. width : int The width of a tile. depth : ...
19867df427b1eb1e503618a1ab109e7210ae8a83
<|skeleton|> class TileSpec: """Specification for the tiles in the atlas. Parameters ---------- shape : np.darray The shape of single tile. ndim : int The number of dimension in the shape of the tile. height : int The height of a tile. width : int The width of a tile. depth : int The depth of a tile, 1 for grayscal...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TileSpec: """Specification for the tiles in the atlas. Parameters ---------- shape : np.darray The shape of single tile. ndim : int The number of dimension in the shape of the tile. height : int The height of a tile. width : int The width of a tile. depth : int The depth of a tile, 1 for grayscale or RGB/RGBA...
the_stack_v2_python_sparse
napari/_vispy/experimental/texture_atlas.py
tlambert03/napari
train
5
63b20e14c2da68189f08d842fa9a0fab436892f6
[ "meta = self.model._meta\nif self.field_names:\n field_names = self.field_names\nelse:\n field_names = [field.name for field in meta.fields]\nresponse = HttpResponse(content_type='text/csv')\nresponse['Content-Disposition'] = 'attachment; filename={}.csv'.format(meta)\nwriter = csv.writer(response)\nwriter.wr...
<|body_start_0|> meta = self.model._meta if self.field_names: field_names = self.field_names else: field_names = [field.name for field in meta.fields] response = HttpResponse(content_type='text/csv') response['Content-Disposition'] = 'attachment; filename=...
CSV Export 기능 제공용 Mixin.
ExportCsvMixin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExportCsvMixin: """CSV Export 기능 제공용 Mixin.""" def export_as_csv(self, request, queryset): """CSV으로 Export.""" <|body_0|> def get_urls(self): """Get urls.""" <|body_1|> def import_csv(self, request): """Import CSV File.""" <|body_2|> ...
stack_v2_sparse_classes_75kplus_train_066994
4,479
no_license
[ { "docstring": "CSV으로 Export.", "name": "export_as_csv", "signature": "def export_as_csv(self, request, queryset)" }, { "docstring": "Get urls.", "name": "get_urls", "signature": "def get_urls(self)" }, { "docstring": "Import CSV File.", "name": "import_csv", "signature":...
3
null
Implement the Python class `ExportCsvMixin` described below. Class description: CSV Export 기능 제공용 Mixin. Method signatures and docstrings: - def export_as_csv(self, request, queryset): CSV으로 Export. - def get_urls(self): Get urls. - def import_csv(self, request): Import CSV File.
Implement the Python class `ExportCsvMixin` described below. Class description: CSV Export 기능 제공용 Mixin. Method signatures and docstrings: - def export_as_csv(self, request, queryset): CSV으로 Export. - def get_urls(self): Get urls. - def import_csv(self, request): Import CSV File. <|skeleton|> class ExportCsvMixin: ...
f6688ca670d983ee683df4032e61c86fd56be74b
<|skeleton|> class ExportCsvMixin: """CSV Export 기능 제공용 Mixin.""" def export_as_csv(self, request, queryset): """CSV으로 Export.""" <|body_0|> def get_urls(self): """Get urls.""" <|body_1|> def import_csv(self, request): """Import CSV File.""" <|body_2|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ExportCsvMixin: """CSV Export 기능 제공용 Mixin.""" def export_as_csv(self, request, queryset): """CSV으로 Export.""" meta = self.model._meta if self.field_names: field_names = self.field_names else: field_names = [field.name for field in meta.fields] ...
the_stack_v2_python_sparse
dashboard/book/utils.py
paryoja/dashboard
train
1
5013b22e1ed34dbb63ec0d1962aea665a67c5e8f
[ "self.prefix_sums = []\nprefix_sum = 0\nfor weight in w:\n prefix_sum += weight\n self.prefix_sums.append(prefix_sum)\nself.total_sum = prefix_sum", "target = self.total_sum * random.random()\nprint(f'target is {target}')\nfor i, prefix_sum in enumerate(self.prefix_sums):\n if target < prefix_sum:\n ...
<|body_start_0|> self.prefix_sums = [] prefix_sum = 0 for weight in w: prefix_sum += weight self.prefix_sums.append(prefix_sum) self.total_sum = prefix_sum <|end_body_0|> <|body_start_1|> target = self.total_sum * random.random() print(f'target is...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, w: [int]): """:type w: List[int]""" <|body_0|> def pickIndex(self) -> int: """:rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.prefix_sums = [] prefix_sum = 0 for weight in w: ...
stack_v2_sparse_classes_75kplus_train_066995
714
no_license
[ { "docstring": ":type w: List[int]", "name": "__init__", "signature": "def __init__(self, w: [int])" }, { "docstring": ":rtype: int", "name": "pickIndex", "signature": "def pickIndex(self) -> int" } ]
2
stack_v2_sparse_classes_30k_train_041074
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, w: [int]): :type w: List[int] - def pickIndex(self) -> int: :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, w: [int]): :type w: List[int] - def pickIndex(self) -> int: :rtype: int <|skeleton|> class Solution: def __init__(self, w: [int]): """:type w: Li...
a09bd0105c0ac9e76e9b4ef1946faa2fb8797660
<|skeleton|> class Solution: def __init__(self, w: [int]): """:type w: List[int]""" <|body_0|> def pickIndex(self) -> int: """:rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def __init__(self, w: [int]): """:type w: List[int]""" self.prefix_sums = [] prefix_sum = 0 for weight in w: prefix_sum += weight self.prefix_sums.append(prefix_sum) self.total_sum = prefix_sum def pickIndex(self) -> int: "...
the_stack_v2_python_sparse
528. Random Pick with Weight.py
yaoyu2001/LeetCode_Practice_Python
train
1
b3ac2504aa8a11a80ff4d33d2fb3bd8f509571d9
[ "test_args = list(kwargs.get('test_args') or [])\ntest_args.append('--enable-run-ios-unittests-with-xctest')\nkwargs['test_args'] = test_args\nsuper(SimulatorXCTestUnitTestsApp, self).__init__(tests_app, **kwargs)", "plugins_dir = os.path.join(self.test_app_path, 'PlugIns')\nif not os.path.exists(plugins_dir):\n ...
<|body_start_0|> test_args = list(kwargs.get('test_args') or []) test_args.append('--enable-run-ios-unittests-with-xctest') kwargs['test_args'] = test_args super(SimulatorXCTestUnitTestsApp, self).__init__(tests_app, **kwargs) <|end_body_0|> <|body_start_1|> plugins_dir = os.pat...
XCTest hosted unit tests to run on simulators. This is for the XCTest framework hosted unit tests running on simulators. Stores data about tests: tests_app: full path to tests app. project_path: root project folder. module_name: egtests module name. included_tests: List of tests to run. excluded_tests: List of tests no...
SimulatorXCTestUnitTestsApp
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimulatorXCTestUnitTestsApp: """XCTest hosted unit tests to run on simulators. This is for the XCTest framework hosted unit tests running on simulators. Stores data about tests: tests_app: full path to tests app. project_path: root project folder. module_name: egtests module name. included_tests:...
stack_v2_sparse_classes_75kplus_train_066996
24,623
permissive
[ { "docstring": "Initialize the class. Args: tests_app: (str) full path to tests app. (Following are potential args in **kwargs) included_tests: (list) Specific tests to run E.g. [ 'TestCaseClass1/testMethod1', 'TestCaseClass2/testMethod2'] excluded_tests: (list) Specific tests not to run E.g. [ 'TestCaseClass1'...
3
stack_v2_sparse_classes_30k_train_016700
Implement the Python class `SimulatorXCTestUnitTestsApp` described below. Class description: XCTest hosted unit tests to run on simulators. This is for the XCTest framework hosted unit tests running on simulators. Stores data about tests: tests_app: full path to tests app. project_path: root project folder. module_nam...
Implement the Python class `SimulatorXCTestUnitTestsApp` described below. Class description: XCTest hosted unit tests to run on simulators. This is for the XCTest framework hosted unit tests running on simulators. Stores data about tests: tests_app: full path to tests app. project_path: root project folder. module_nam...
a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c
<|skeleton|> class SimulatorXCTestUnitTestsApp: """XCTest hosted unit tests to run on simulators. This is for the XCTest framework hosted unit tests running on simulators. Stores data about tests: tests_app: full path to tests app. project_path: root project folder. module_name: egtests module name. included_tests:...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SimulatorXCTestUnitTestsApp: """XCTest hosted unit tests to run on simulators. This is for the XCTest framework hosted unit tests running on simulators. Stores data about tests: tests_app: full path to tests app. project_path: root project folder. module_name: egtests module name. included_tests: List of test...
the_stack_v2_python_sparse
ios/build/bots/scripts/test_apps.py
chromium/chromium
train
17,408
de44cd149c7525e8f4a255a66461ad19f5b4f823
[ "logger.info('Compressing sky')\nif image.data.shape[1] % blocksize != 0 or image.data.shape[0] % blocksize != 0:\n raise skyinfo.SkyError('blocksize {:d} does not evenly divide image ({:d}x{:d})'.format(blocksize, image.data.shape[0], image.data.shape[1]))\n exit(1)\nnx = int(image.data.shape[1] / blocksize)...
<|body_start_0|> logger.info('Compressing sky') if image.data.shape[1] % blocksize != 0 or image.data.shape[0] % blocksize != 0: raise skyinfo.SkyError('blocksize {:d} does not evenly divide image ({:d}x{:d})'.format(blocksize, image.data.shape[0], image.data.shape[1])) exit(1) ...
SkyCompress
[ "NCSA" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SkyCompress: def __call__(cls, image, skyfilename, blocksize, bitmask): """Produce compressed image of sky background :Parameters: - `image`: the DESImage to be compressed. - `skyfilename`: filename for the output compressed sky image - `blocksize`: side length of squares in which median...
stack_v2_sparse_classes_75kplus_train_066997
5,208
permissive
[ { "docstring": "Produce compressed image of sky background :Parameters: - `image`: the DESImage to be compressed. - `skyfilename`: filename for the output compressed sky image - `blocksize`: side length of squares in which medians are taken - `bitmask`: Bitmask that will be or'ed with mask plane of image (if an...
4
null
Implement the Python class `SkyCompress` described below. Class description: Implement the SkyCompress class. Method signatures and docstrings: - def __call__(cls, image, skyfilename, blocksize, bitmask): Produce compressed image of sky background :Parameters: - `image`: the DESImage to be compressed. - `skyfilename`...
Implement the Python class `SkyCompress` described below. Class description: Implement the SkyCompress class. Method signatures and docstrings: - def __call__(cls, image, skyfilename, blocksize, bitmask): Produce compressed image of sky background :Parameters: - `image`: the DESImage to be compressed. - `skyfilename`...
8a299e9368d01cac51f53af6e4937e797f378d7a
<|skeleton|> class SkyCompress: def __call__(cls, image, skyfilename, blocksize, bitmask): """Produce compressed image of sky background :Parameters: - `image`: the DESImage to be compressed. - `skyfilename`: filename for the output compressed sky image - `blocksize`: side length of squares in which median...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SkyCompress: def __call__(cls, image, skyfilename, blocksize, bitmask): """Produce compressed image of sky background :Parameters: - `image`: the DESImage to be compressed. - `skyfilename`: filename for the output compressed sky image - `blocksize`: side length of squares in which medians are taken - ...
the_stack_v2_python_sparse
python/pixcorrect/sky_compress.py
DarkEnergySurvey/pixcorrect
train
1
e3bc578e03846f97d1463077d8a11d9321e84435
[ "length = longest = 0\nfor num in nums:\n if num == 1:\n length += 1\n else:\n longest = longest if longest > length else length\n length = 0\nreturn longest if longest > length else length", "length = longest = 0\nfor num in nums:\n if num == 1:\n length += 1\n else:\n ...
<|body_start_0|> length = longest = 0 for num in nums: if num == 1: length += 1 else: longest = longest if longest > length else length length = 0 return longest if longest > length else length <|end_body_0|> <|body_start_1...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def _findMaxConsecutiveOnes(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def findMaxConsecutiveOnes(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> length = longest = 0 ...
stack_v2_sparse_classes_75kplus_train_066998
1,591
permissive
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "_findMaxConsecutiveOnes", "signature": "def _findMaxConsecutiveOnes(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "findMaxConsecutiveOnes", "signature": "def findMaxConsecutiveOnes(self, nums)" }...
2
stack_v2_sparse_classes_30k_train_015218
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _findMaxConsecutiveOnes(self, nums): :type nums: List[int] :rtype: int - def findMaxConsecutiveOnes(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 _findMaxConsecutiveOnes(self, nums): :type nums: List[int] :rtype: int - def findMaxConsecutiveOnes(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solutio...
0dd67edca4e0b0323cb5a7239f02ea46383cd15a
<|skeleton|> class Solution: def _findMaxConsecutiveOnes(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def findMaxConsecutiveOnes(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def _findMaxConsecutiveOnes(self, nums): """:type nums: List[int] :rtype: int""" length = longest = 0 for num in nums: if num == 1: length += 1 else: longest = longest if longest > length else length leng...
the_stack_v2_python_sparse
485.max-consecutive-ones.py
windard/leeeeee
train
0
31ea009c064d8563d71e44c719094fbb9f03f610
[ "data['uuid'] = self.context['kwargs']['uuid']\ndata = FavoriteModelSerializer(data).data\nself.context['data'] = data\nreturn data", "request = self.context['request']\nif not request.user.is_authenticated:\n return status_code(status=status.HTTP_401_UNAUTHORIZED)\nreturn create_item(get_authentication(reques...
<|body_start_0|> data['uuid'] = self.context['kwargs']['uuid'] data = FavoriteModelSerializer(data).data self.context['data'] = data return data <|end_body_0|> <|body_start_1|> request = self.context['request'] if not request.user.is_authenticated: return sta...
Favorite delete serializer.
FavoriteCreateSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FavoriteCreateSerializer: """Favorite delete serializer.""" def validate(self, data): """Validate data to the model.""" <|body_0|> def create(self): """It will create an favorite item only if the user is authenticated.""" <|body_1|> <|end_skeleton|> <|b...
stack_v2_sparse_classes_75kplus_train_066999
10,323
no_license
[ { "docstring": "Validate data to the model.", "name": "validate", "signature": "def validate(self, data)" }, { "docstring": "It will create an favorite item only if the user is authenticated.", "name": "create", "signature": "def create(self)" } ]
2
null
Implement the Python class `FavoriteCreateSerializer` described below. Class description: Favorite delete serializer. Method signatures and docstrings: - def validate(self, data): Validate data to the model. - def create(self): It will create an favorite item only if the user is authenticated.
Implement the Python class `FavoriteCreateSerializer` described below. Class description: Favorite delete serializer. Method signatures and docstrings: - def validate(self, data): Validate data to the model. - def create(self): It will create an favorite item only if the user is authenticated. <|skeleton|> class Fav...
cd8767b5eeaef3a09d77c936781b4126fd8591de
<|skeleton|> class FavoriteCreateSerializer: """Favorite delete serializer.""" def validate(self, data): """Validate data to the model.""" <|body_0|> def create(self): """It will create an favorite item only if the user is authenticated.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FavoriteCreateSerializer: """Favorite delete serializer.""" def validate(self, data): """Validate data to the model.""" data['uuid'] = self.context['kwargs']['uuid'] data = FavoriteModelSerializer(data).data self.context['data'] = data return data def create(s...
the_stack_v2_python_sparse
api/services/serializers.py
ignite7/backproject
train
0