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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7f48e77790dac742ac97cb74d9eb4a7b17f2cfcb | [
"self.client_id = client_id\nself.is_worm_enabled = is_worm_enabled\nself.storage_access_key = storage_access_key\nself.storage_account_name = storage_account_name\nself.tier_type = tier_type\nself.tiers = tiers",
"if dictionary is None:\n return None\nclient_id = dictionary.get('clientId')\nis_worm_enabled = ... | <|body_start_0|>
self.client_id = client_id
self.is_worm_enabled = is_worm_enabled
self.storage_access_key = storage_access_key
self.storage_account_name = storage_account_name
self.tier_type = tier_type
self.tiers = tiers
<|end_body_0|>
<|body_start_1|>
if dicti... | Implementation of the 'AzureCloudCredentials' model. Specifies the cloud credentials to connect to a Microsoft Azure service account. Attributes: client_id (string): Specifies the client id of the managed identity assigned to the cluster. This is used only for clusters running as Azure VMs where authentication is done ... | AzureCloudCredentials | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AzureCloudCredentials:
"""Implementation of the 'AzureCloudCredentials' model. Specifies the cloud credentials to connect to a Microsoft Azure service account. Attributes: client_id (string): Specifies the client id of the managed identity assigned to the cluster. This is used only for clusters r... | stack_v2_sparse_classes_75kplus_train_069600 | 3,634 | permissive | [
{
"docstring": "Constructor for the AzureCloudCredentials class",
"name": "__init__",
"signature": "def __init__(self, client_id=None, is_worm_enabled=None, storage_access_key=None, storage_account_name=None, tier_type=None, tiers=None)"
},
{
"docstring": "Creates an instance of this model from ... | 2 | stack_v2_sparse_classes_30k_val_000163 | Implement the Python class `AzureCloudCredentials` described below.
Class description:
Implementation of the 'AzureCloudCredentials' model. Specifies the cloud credentials to connect to a Microsoft Azure service account. Attributes: client_id (string): Specifies the client id of the managed identity assigned to the cl... | Implement the Python class `AzureCloudCredentials` described below.
Class description:
Implementation of the 'AzureCloudCredentials' model. Specifies the cloud credentials to connect to a Microsoft Azure service account. Attributes: client_id (string): Specifies the client id of the managed identity assigned to the cl... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class AzureCloudCredentials:
"""Implementation of the 'AzureCloudCredentials' model. Specifies the cloud credentials to connect to a Microsoft Azure service account. Attributes: client_id (string): Specifies the client id of the managed identity assigned to the cluster. This is used only for clusters r... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AzureCloudCredentials:
"""Implementation of the 'AzureCloudCredentials' model. Specifies the cloud credentials to connect to a Microsoft Azure service account. Attributes: client_id (string): Specifies the client id of the managed identity assigned to the cluster. This is used only for clusters running as Azu... | the_stack_v2_python_sparse | cohesity_management_sdk/models/azure_cloud_credentials.py | cohesity/management-sdk-python | train | 24 |
524f9579aa7abb2173c4a27cfad49130a60da5c2 | [
"self.csv = file\nself.col = coluna\nself.orig = orig\nself.fin = fin\nif auto == True:\n self.organize_dic()",
"df = pd.read_csv(self.csv)\nIDs = df[self.col]\nALL = []\nfor i in IDs:\n ALL.append(i)\nreturn ALL",
"lista = self.isolar_IDs()\nstr = ' '.join(lista)\nreturn str",
"query = self.create_quer... | <|body_start_0|>
self.csv = file
self.col = coluna
self.orig = orig
self.fin = fin
if auto == True:
self.organize_dic()
<|end_body_0|>
<|body_start_1|>
df = pd.read_csv(self.csv)
IDs = df[self.col]
ALL = []
for i in IDs:
AL... | Convert | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Convert:
def __init__(self, file, coluna, orig, fin, auto=True):
""":param file: ficheio .csv para converter :param coluna: Coluna onde está o ID Uniprot :param out: Nome para ficheiro gerado :param auto: fazer o processo inteiro devolvendo um dicionario"""
<|body_0|>
def is... | stack_v2_sparse_classes_75kplus_train_069601 | 2,069 | no_license | [
{
"docstring": ":param file: ficheio .csv para converter :param coluna: Coluna onde está o ID Uniprot :param out: Nome para ficheiro gerado :param auto: fazer o processo inteiro devolvendo um dicionario",
"name": "__init__",
"signature": "def __init__(self, file, coluna, orig, fin, auto=True)"
},
{
... | 5 | stack_v2_sparse_classes_30k_train_042725 | Implement the Python class `Convert` described below.
Class description:
Implement the Convert class.
Method signatures and docstrings:
- def __init__(self, file, coluna, orig, fin, auto=True): :param file: ficheio .csv para converter :param coluna: Coluna onde está o ID Uniprot :param out: Nome para ficheiro gerado ... | Implement the Python class `Convert` described below.
Class description:
Implement the Convert class.
Method signatures and docstrings:
- def __init__(self, file, coluna, orig, fin, auto=True): :param file: ficheio .csv para converter :param coluna: Coluna onde está o ID Uniprot :param out: Nome para ficheiro gerado ... | e73c83b0896f81b96f7499a48ee9e794895c71b9 | <|skeleton|>
class Convert:
def __init__(self, file, coluna, orig, fin, auto=True):
""":param file: ficheio .csv para converter :param coluna: Coluna onde está o ID Uniprot :param out: Nome para ficheiro gerado :param auto: fazer o processo inteiro devolvendo um dicionario"""
<|body_0|>
def is... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Convert:
def __init__(self, file, coluna, orig, fin, auto=True):
""":param file: ficheio .csv para converter :param coluna: Coluna onde está o ID Uniprot :param out: Nome para ficheiro gerado :param auto: fazer o processo inteiro devolvendo um dicionario"""
self.csv = file
self.col = c... | the_stack_v2_python_sparse | Database_converter.py | MiguelBarros99/Projeto_PG42877 | train | 0 | |
afd2f719e4b272cfe0882469aeea77e30b4d0068 | [
"context = super().get_context_data(**kwargs)\nchannel = self.object\nfilename = channel.get_log_filename()\nbucket = []\nfor log in (x.strip() for x in tail_log_file(filename, 0, self.max_num_lines)):\n if not log:\n continue\n try:\n time, msg = log.split(' [-] ')\n time_key = time.spli... | <|body_start_0|>
context = super().get_context_data(**kwargs)
channel = self.object
filename = channel.get_log_filename()
bucket = []
for log in (x.strip() for x in tail_log_file(filename, 0, self.max_num_lines)):
if not log:
continue
try:
... | Returns the log entries for a given channel. | ChannelDetailView | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ChannelDetailView:
"""Returns the log entries for a given channel."""
def get_context_data(self, **kwargs):
"""Django hook; before we can display the channel logs, we need to recall the logfile and read its lines. Returns: context (dict): Django context object"""
<|body_0|>
... | stack_v2_sparse_classes_75kplus_train_069602 | 5,329 | permissive | [
{
"docstring": "Django hook; before we can display the channel logs, we need to recall the logfile and read its lines. Returns: context (dict): Django context object",
"name": "get_context_data",
"signature": "def get_context_data(self, **kwargs)"
},
{
"docstring": "Override of Django hook that ... | 2 | stack_v2_sparse_classes_30k_test_000497 | Implement the Python class `ChannelDetailView` described below.
Class description:
Returns the log entries for a given channel.
Method signatures and docstrings:
- def get_context_data(self, **kwargs): Django hook; before we can display the channel logs, we need to recall the logfile and read its lines. Returns: cont... | Implement the Python class `ChannelDetailView` described below.
Class description:
Returns the log entries for a given channel.
Method signatures and docstrings:
- def get_context_data(self, **kwargs): Django hook; before we can display the channel logs, we need to recall the logfile and read its lines. Returns: cont... | b3ca58b5c1325a3bf57051dfe23560a08d2947b7 | <|skeleton|>
class ChannelDetailView:
"""Returns the log entries for a given channel."""
def get_context_data(self, **kwargs):
"""Django hook; before we can display the channel logs, we need to recall the logfile and read its lines. Returns: context (dict): Django context object"""
<|body_0|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ChannelDetailView:
"""Returns the log entries for a given channel."""
def get_context_data(self, **kwargs):
"""Django hook; before we can display the channel logs, we need to recall the logfile and read its lines. Returns: context (dict): Django context object"""
context = super().get_con... | the_stack_v2_python_sparse | evennia/web/website/views/channels.py | evennia/evennia | train | 1,781 |
581ec5db4a01dac41a9d66756a7b5da45b83e275 | [
"self.observation_payload = self._build_prolog(request)\nself._build_project(self.observation_payload, request)\nself._build_inst_schedule(instname, self.observation_payload, request)",
"exp_time = request.payload['exposure_time']\nexp_count = int(request.payload['exposure_counts'])\nfor filt in request.payload['... | <|body_start_0|>
self.observation_payload = self._build_prolog(request)
self._build_project(self.observation_payload, request)
self._build_inst_schedule(instname, self.observation_payload, request)
<|end_body_0|>
<|body_start_1|>
exp_time = request.payload['exposure_time']
exp_c... | An XML structure for LT IOO/IOI requests. | IOOIOIRequest | [
"BSD-3-Clause",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IOOIOIRequest:
"""An XML structure for LT IOO/IOI requests."""
def __init__(self, instname, request):
"""Initialize IOO/IOI request. Parameters ---------- instname: str IO:O or IO:I. request: skyportal.models.FollowupRequest The request to add to the queue and the SkyPortal database.... | stack_v2_sparse_classes_75kplus_train_069603 | 27,052 | permissive | [
{
"docstring": "Initialize IOO/IOI request. Parameters ---------- instname: str IO:O or IO:I. request: skyportal.models.FollowupRequest The request to add to the queue and the SkyPortal database.",
"name": "__init__",
"signature": "def __init__(self, instname, request)"
},
{
"docstring": "Payloa... | 3 | stack_v2_sparse_classes_30k_train_030841 | Implement the Python class `IOOIOIRequest` described below.
Class description:
An XML structure for LT IOO/IOI requests.
Method signatures and docstrings:
- def __init__(self, instname, request): Initialize IOO/IOI request. Parameters ---------- instname: str IO:O or IO:I. request: skyportal.models.FollowupRequest Th... | Implement the Python class `IOOIOIRequest` described below.
Class description:
An XML structure for LT IOO/IOI requests.
Method signatures and docstrings:
- def __init__(self, instname, request): Initialize IOO/IOI request. Parameters ---------- instname: str IO:O or IO:I. request: skyportal.models.FollowupRequest Th... | 161d3532ba3ba059446addcdac58ca96f39e9636 | <|skeleton|>
class IOOIOIRequest:
"""An XML structure for LT IOO/IOI requests."""
def __init__(self, instname, request):
"""Initialize IOO/IOI request. Parameters ---------- instname: str IO:O or IO:I. request: skyportal.models.FollowupRequest The request to add to the queue and the SkyPortal database.... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class IOOIOIRequest:
"""An XML structure for LT IOO/IOI requests."""
def __init__(self, instname, request):
"""Initialize IOO/IOI request. Parameters ---------- instname: str IO:O or IO:I. request: skyportal.models.FollowupRequest The request to add to the queue and the SkyPortal database."""
s... | the_stack_v2_python_sparse | skyportal/facility_apis/lt.py | skyportal/skyportal | train | 80 |
82287abc7ea64f27e75a93e51cc2b55dd18b1efa | [
"nsr_opdata = proxy(RwNsrYang).get('/ns-instance-opdata')\nnsr = nsr_opdata.nsr[0]\nxpath = \"/ns-instance-opdata/nsr[ns-instance-config-ref='{}']/operational-status\".format(nsr.ns_instance_config_ref)\nproxy(RwNsrYang).wait_for(xpath, state, timeout=240)",
"nsr_opdata = proxy(RwNsrYang).get('/ns-instance-opdata... | <|body_start_0|>
nsr_opdata = proxy(RwNsrYang).get('/ns-instance-opdata')
nsr = nsr_opdata.nsr[0]
xpath = "/ns-instance-opdata/nsr[ns-instance-config-ref='{}']/operational-status".format(nsr.ns_instance_config_ref)
proxy(RwNsrYang).wait_for(xpath, state, timeout=240)
<|end_body_0|>
<|bo... | TestScaling | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestScaling:
def wait_for_nsr_state(self, proxy, state):
"""Wait till the NSR reaches a desired state. Args: proxy (Callable): Proxy for launchpad session. state (str): Expected state"""
<|body_0|>
def verify_scaling_group(self, proxy, group_name, scale_out=True):
""... | stack_v2_sparse_classes_75kplus_train_069604 | 5,176 | permissive | [
{
"docstring": "Wait till the NSR reaches a desired state. Args: proxy (Callable): Proxy for launchpad session. state (str): Expected state",
"name": "wait_for_nsr_state",
"signature": "def wait_for_nsr_state(self, proxy, state)"
},
{
"docstring": "Args: proxy (Callable): LP session group_name (... | 6 | null | Implement the Python class `TestScaling` described below.
Class description:
Implement the TestScaling class.
Method signatures and docstrings:
- def wait_for_nsr_state(self, proxy, state): Wait till the NSR reaches a desired state. Args: proxy (Callable): Proxy for launchpad session. state (str): Expected state
- de... | Implement the Python class `TestScaling` described below.
Class description:
Implement the TestScaling class.
Method signatures and docstrings:
- def wait_for_nsr_state(self, proxy, state): Wait till the NSR reaches a desired state. Args: proxy (Callable): Proxy for launchpad session. state (str): Expected state
- de... | 45884f1e2b7b0028afae19eb0243dbfeb71edaff | <|skeleton|>
class TestScaling:
def wait_for_nsr_state(self, proxy, state):
"""Wait till the NSR reaches a desired state. Args: proxy (Callable): Proxy for launchpad session. state (str): Expected state"""
<|body_0|>
def verify_scaling_group(self, proxy, group_name, scale_out=True):
""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestScaling:
def wait_for_nsr_state(self, proxy, state):
"""Wait till the NSR reaches a desired state. Args: proxy (Callable): Proxy for launchpad session. state (str): Expected state"""
nsr_opdata = proxy(RwNsrYang).get('/ns-instance-opdata')
nsr = nsr_opdata.nsr[0]
xpath = "/... | the_stack_v2_python_sparse | modules/core/mano/rwlaunchpad/ra/pytest/test_scaling.py | gonotes/RIFT.ware | train | 0 | |
c1fb96d281ff340126642b38e421cb45381803dd | [
"config = current_app.cea_config\ndashboards = cea.plots.read_dashboards(config, current_app.plot_cache)\nreturn dashboard_to_dict(dashboards[dashboard_index])['plots'][plot_index]",
"form = api.payload\nconfig = current_app.cea_config\ntemp_config = cea.config.Configuration()\ndashboards = cea.plots.read_dashboa... | <|body_start_0|>
config = current_app.cea_config
dashboards = cea.plots.read_dashboards(config, current_app.plot_cache)
return dashboard_to_dict(dashboards[dashboard_index])['plots'][plot_index]
<|end_body_0|>
<|body_start_1|>
form = api.payload
config = current_app.cea_config
... | DashboardPlot | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DashboardPlot:
def get(self, dashboard_index, plot_index):
"""Get Dashboard Plot"""
<|body_0|>
def put(self, dashboard_index, plot_index):
"""Create/Replace a new Plot at specified index"""
<|body_1|>
def delete(self, dashboard_index, plot_index):
... | stack_v2_sparse_classes_75kplus_train_069605 | 9,106 | permissive | [
{
"docstring": "Get Dashboard Plot",
"name": "get",
"signature": "def get(self, dashboard_index, plot_index)"
},
{
"docstring": "Create/Replace a new Plot at specified index",
"name": "put",
"signature": "def put(self, dashboard_index, plot_index)"
},
{
"docstring": "Delete Plot ... | 3 | stack_v2_sparse_classes_30k_train_015212 | Implement the Python class `DashboardPlot` described below.
Class description:
Implement the DashboardPlot class.
Method signatures and docstrings:
- def get(self, dashboard_index, plot_index): Get Dashboard Plot
- def put(self, dashboard_index, plot_index): Create/Replace a new Plot at specified index
- def delete(s... | Implement the Python class `DashboardPlot` described below.
Class description:
Implement the DashboardPlot class.
Method signatures and docstrings:
- def get(self, dashboard_index, plot_index): Get Dashboard Plot
- def put(self, dashboard_index, plot_index): Create/Replace a new Plot at specified index
- def delete(s... | b84bcefdfdfc2bc0e009b5284b74391a957995ac | <|skeleton|>
class DashboardPlot:
def get(self, dashboard_index, plot_index):
"""Get Dashboard Plot"""
<|body_0|>
def put(self, dashboard_index, plot_index):
"""Create/Replace a new Plot at specified index"""
<|body_1|>
def delete(self, dashboard_index, plot_index):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DashboardPlot:
def get(self, dashboard_index, plot_index):
"""Get Dashboard Plot"""
config = current_app.cea_config
dashboards = cea.plots.read_dashboards(config, current_app.plot_cache)
return dashboard_to_dict(dashboards[dashboard_index])['plots'][plot_index]
def put(sel... | the_stack_v2_python_sparse | cea/interfaces/dashboard/api/dashboard.py | architecture-building-systems/CityEnergyAnalyst | train | 166 | |
3d88ed7ecde5967eada75377484ad62fbda16c1c | [
"self.id = id\nself.transform = transform\nself.bounding_box = bounding_box\nself.forward_speed = forward_speed\nself.label = label\nif label == 'vehicle':\n self.segmentation_class = 10\nelif label == 'person':\n self.segmentation_class = 4\nelse:\n raise ValueError('label should be: vehicle or person')\n... | <|body_start_0|>
self.id = id
self.transform = transform
self.bounding_box = bounding_box
self.forward_speed = forward_speed
self.label = label
if label == 'vehicle':
self.segmentation_class = 10
elif label == 'person':
self.segmentation_cl... | An Obstacle represents a dynamic obstacle that we could encounter on the road. This class provides helper functions to detect obstacles and provide bounding boxes for them. | Obstacle | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Obstacle:
"""An Obstacle represents a dynamic obstacle that we could encounter on the road. This class provides helper functions to detect obstacles and provide bounding boxes for them."""
def __init__(self, id, label, transform, bounding_box, forward_speed):
"""Initialize an obstacl... | stack_v2_sparse_classes_75kplus_train_069606 | 6,605 | permissive | [
{
"docstring": "Initialize an obstacle. Args: id: The id of the obstacle. label: The label of the obstacle. transform: The transform of the obstacle. bounding_box: A perception.detection.utils.BoundingBox3D of the obstacle. forward_speed: The forward speed of the obstacle.",
"name": "__init__",
"signatu... | 4 | null | Implement the Python class `Obstacle` described below.
Class description:
An Obstacle represents a dynamic obstacle that we could encounter on the road. This class provides helper functions to detect obstacles and provide bounding boxes for them.
Method signatures and docstrings:
- def __init__(self, id, label, trans... | Implement the Python class `Obstacle` described below.
Class description:
An Obstacle represents a dynamic obstacle that we could encounter on the road. This class provides helper functions to detect obstacles and provide bounding boxes for them.
Method signatures and docstrings:
- def __init__(self, id, label, trans... | ab49647236fcbc8aa08ec9650e0596e778e9ef85 | <|skeleton|>
class Obstacle:
"""An Obstacle represents a dynamic obstacle that we could encounter on the road. This class provides helper functions to detect obstacles and provide bounding boxes for them."""
def __init__(self, id, label, transform, bounding_box, forward_speed):
"""Initialize an obstacl... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Obstacle:
"""An Obstacle represents a dynamic obstacle that we could encounter on the road. This class provides helper functions to detect obstacles and provide bounding boxes for them."""
def __init__(self, id, label, transform, bounding_box, forward_speed):
"""Initialize an obstacle. Args: id: ... | the_stack_v2_python_sparse | pylot/perception/detection/obstacle.py | alvkao58/pylot | train | 0 |
8e72a725bfc835a848667a61e5f9859dc40ad804 | [
"start_date, end_date = CommonAnalytics.convert_dates(self, start_date, end_date)\nrooms_available = CommonAnalytics.get_room_details(self, query)\nres = []\nfor room in rooms_available:\n all_events = CommonAnalytics.get_all_events_in_a_room(self, room['room_id'], start_date, end_date)\n room_details = RoomS... | <|body_start_0|>
start_date, end_date = CommonAnalytics.convert_dates(self, start_date, end_date)
rooms_available = CommonAnalytics.get_room_details(self, query)
res = []
for room in rooms_available:
all_events = CommonAnalytics.get_all_events_in_a_room(self, room['room_id'],... | Get room analytics :methods get_meetings_per_room_analytics get_meetings_duration_analytics | RoomAnalytics | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RoomAnalytics:
"""Get room analytics :methods get_meetings_per_room_analytics get_meetings_duration_analytics"""
def get_meetings_per_room_analytics(self, query, start_date, end_date):
"""Get analytics for meetings per room :params - query - start_date, end_date(Time range)"""
... | stack_v2_sparse_classes_75kplus_train_069607 | 3,882 | no_license | [
{
"docstring": "Get analytics for meetings per room :params - query - start_date, end_date(Time range)",
"name": "get_meetings_per_room_analytics",
"signature": "def get_meetings_per_room_analytics(self, query, start_date, end_date)"
},
{
"docstring": "Get analytics for meetings durations in roo... | 3 | null | Implement the Python class `RoomAnalytics` described below.
Class description:
Get room analytics :methods get_meetings_per_room_analytics get_meetings_duration_analytics
Method signatures and docstrings:
- def get_meetings_per_room_analytics(self, query, start_date, end_date): Get analytics for meetings per room :pa... | Implement the Python class `RoomAnalytics` described below.
Class description:
Get room analytics :methods get_meetings_per_room_analytics get_meetings_duration_analytics
Method signatures and docstrings:
- def get_meetings_per_room_analytics(self, query, start_date, end_date): Get analytics for meetings per room :pa... | 03c5c1350f3e1c97ebe9e9fa95bb90517721ec72 | <|skeleton|>
class RoomAnalytics:
"""Get room analytics :methods get_meetings_per_room_analytics get_meetings_duration_analytics"""
def get_meetings_per_room_analytics(self, query, start_date, end_date):
"""Get analytics for meetings per room :params - query - start_date, end_date(Time range)"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RoomAnalytics:
"""Get room analytics :methods get_meetings_per_room_analytics get_meetings_duration_analytics"""
def get_meetings_per_room_analytics(self, query, start_date, end_date):
"""Get analytics for meetings per room :params - query - start_date, end_date(Time range)"""
start_date,... | the_stack_v2_python_sparse | helpers/calendar/analytics.py | andela/mrm_api | train | 15 |
b9ba8bc514f92951ddf1f5fa1ea52ec657739105 | [
"ksizes = [1] + ksizes + [1]\nstrides = [1] + strides + [1]\nfor dtype in [np.float16, np.float32, np.float64, dtypes.bfloat16.as_numpy_dtype]:\n out_tensor = array_ops.extract_volume_patches(constant_op.constant(image.astype(dtype)), ksizes=ksizes, strides=strides, padding=padding, name='im2col_3d')\n self.a... | <|body_start_0|>
ksizes = [1] + ksizes + [1]
strides = [1] + strides + [1]
for dtype in [np.float16, np.float32, np.float64, dtypes.bfloat16.as_numpy_dtype]:
out_tensor = array_ops.extract_volume_patches(constant_op.constant(image.astype(dtype)), ksizes=ksizes, strides=strides, paddi... | Functional tests for ExtractVolumePatches op. | ExtractVolumePatches | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExtractVolumePatches:
"""Functional tests for ExtractVolumePatches op."""
def _VerifyValues(self, image, ksizes, strides, padding, patches):
"""Tests input-output pairs for the ExtractVolumePatches op. Args: image: Input tensor with shape: [batch, in_planes, in_rows, in_cols, depth].... | stack_v2_sparse_classes_75kplus_train_069608 | 4,639 | permissive | [
{
"docstring": "Tests input-output pairs for the ExtractVolumePatches op. Args: image: Input tensor with shape: [batch, in_planes, in_rows, in_cols, depth]. ksizes: Patch size specified as: [ksize_planes, ksize_rows, ksize_cols]. strides: Output strides, specified as: [stride_planes, stride_rows, stride_cols]. ... | 6 | stack_v2_sparse_classes_30k_train_003809 | Implement the Python class `ExtractVolumePatches` described below.
Class description:
Functional tests for ExtractVolumePatches op.
Method signatures and docstrings:
- def _VerifyValues(self, image, ksizes, strides, padding, patches): Tests input-output pairs for the ExtractVolumePatches op. Args: image: Input tensor... | Implement the Python class `ExtractVolumePatches` described below.
Class description:
Functional tests for ExtractVolumePatches op.
Method signatures and docstrings:
- def _VerifyValues(self, image, ksizes, strides, padding, patches): Tests input-output pairs for the ExtractVolumePatches op. Args: image: Input tensor... | a7f3934a67900720af3d3b15389551483bee50b8 | <|skeleton|>
class ExtractVolumePatches:
"""Functional tests for ExtractVolumePatches op."""
def _VerifyValues(self, image, ksizes, strides, padding, patches):
"""Tests input-output pairs for the ExtractVolumePatches op. Args: image: Input tensor with shape: [batch, in_planes, in_rows, in_cols, depth].... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ExtractVolumePatches:
"""Functional tests for ExtractVolumePatches op."""
def _VerifyValues(self, image, ksizes, strides, padding, patches):
"""Tests input-output pairs for the ExtractVolumePatches op. Args: image: Input tensor with shape: [batch, in_planes, in_rows, in_cols, depth]. ksizes: Patc... | the_stack_v2_python_sparse | tensorflow/python/kernel_tests/image_ops/extract_volume_patches_op_test.py | tensorflow/tensorflow | train | 208,740 |
223bb689ef5b3df86a8c63a222cf6b8111d06da6 | [
"ret = []\nif not root:\n return ret\nque = Queue.Queue()\nque.put(root)\nque.put(None)\nlevel = []\nwhile not que.empty():\n cur = que.get()\n if cur is None:\n ret.append(level)\n level = []\n if not que.empty():\n que.put(None)\n else:\n level.append(cur.val)\n ... | <|body_start_0|>
ret = []
if not root:
return ret
que = Queue.Queue()
que.put(root)
que.put(None)
level = []
while not que.empty():
cur = que.get()
if cur is None:
ret.append(level)
level = []
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def levelOrder(self, root):
""":type root: TreeNode :rtype: List[List[int]]"""
<|body_0|>
def levelOrderBottom(self, root):
""":type root: TreeNode :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
ret = []
if... | stack_v2_sparse_classes_75kplus_train_069609 | 1,143 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: List[List[int]]",
"name": "levelOrder",
"signature": "def levelOrder(self, root)"
},
{
"docstring": ":type root: TreeNode :rtype: List[List[int]]",
"name": "levelOrderBottom",
"signature": "def levelOrderBottom(self, root)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def levelOrder(self, root): :type root: TreeNode :rtype: List[List[int]]
- def levelOrderBottom(self, root): :type root: TreeNode :rtype: List[List[int]] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def levelOrder(self, root): :type root: TreeNode :rtype: List[List[int]]
- def levelOrderBottom(self, root): :type root: TreeNode :rtype: List[List[int]]
<|skeleton|>
class Solu... | 1d162674e29ca1344a21d4d5d79f487945f288de | <|skeleton|>
class Solution:
def levelOrder(self, root):
""":type root: TreeNode :rtype: List[List[int]]"""
<|body_0|>
def levelOrderBottom(self, root):
""":type root: TreeNode :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def levelOrder(self, root):
""":type root: TreeNode :rtype: List[List[int]]"""
ret = []
if not root:
return ret
que = Queue.Queue()
que.put(root)
que.put(None)
level = []
while not que.empty():
cur = que.get()
... | the_stack_v2_python_sparse | leetcode-master/107/main.py | bradelement/coding_exercise | train | 0 | |
dadce8f0c0d72440a185643d9870bf284018e0e4 | [
"uid = None\nif tag.product == 'NXP NTAG215':\n bytes_array = tag.read(21)[0:8]\n uid = '0x{0}'.format(binascii.hexlify(bytes_array).decode('utf-8'))\nelse:\n logging.debug('Unknown tag product: {0:s}'.format(tag.product))\nreturn uid",
"pages = []\nfor i in range(0, NFC215.TAG_FILE_SIZE / NFC215.PAGE_SI... | <|body_start_0|>
uid = None
if tag.product == 'NXP NTAG215':
bytes_array = tag.read(21)[0:8]
uid = '0x{0}'.format(binascii.hexlify(bytes_array).decode('utf-8'))
else:
logging.debug('Unknown tag product: {0:s}'.format(tag.product))
return uid
<|end_body... | Handles read operations on NFC215 tags. | NFC215 | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NFC215:
"""Handles read operations on NFC215 tags."""
def ReadUIDFromTag(tag):
"""Reads UID from a tag. Args: tag(nfc.tag.tt2_nxp.NTAG215): the input data read from the tag. Returns: uid(str): the tag uid in form 0x0580000000050002."""
<|body_0|>
def ReadAllPages(tag):
... | stack_v2_sparse_classes_75kplus_train_069610 | 4,786 | permissive | [
{
"docstring": "Reads UID from a tag. Args: tag(nfc.tag.tt2_nxp.NTAG215): the input data read from the tag. Returns: uid(str): the tag uid in form 0x0580000000050002.",
"name": "ReadUIDFromTag",
"signature": "def ReadUIDFromTag(tag)"
},
{
"docstring": "Displays all pages from tag Args: tag(nfc.t... | 2 | null | Implement the Python class `NFC215` described below.
Class description:
Handles read operations on NFC215 tags.
Method signatures and docstrings:
- def ReadUIDFromTag(tag): Reads UID from a tag. Args: tag(nfc.tag.tt2_nxp.NTAG215): the input data read from the tag. Returns: uid(str): the tag uid in form 0x058000000005... | Implement the Python class `NFC215` described below.
Class description:
Handles read operations on NFC215 tags.
Method signatures and docstrings:
- def ReadUIDFromTag(tag): Reads UID from a tag. Args: tag(nfc.tag.tt2_nxp.NTAG215): the input data read from the tag. Returns: uid(str): the tag uid in form 0x058000000005... | b8fae71b5d4bde468fd1f6adc4858a68d4fb8dc5 | <|skeleton|>
class NFC215:
"""Handles read operations on NFC215 tags."""
def ReadUIDFromTag(tag):
"""Reads UID from a tag. Args: tag(nfc.tag.tt2_nxp.NTAG215): the input data read from the tag. Returns: uid(str): the tag uid in form 0x0580000000050002."""
<|body_0|>
def ReadAllPages(tag):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NFC215:
"""Handles read operations on NFC215 tags."""
def ReadUIDFromTag(tag):
"""Reads UID from a tag. Args: tag(nfc.tag.tt2_nxp.NTAG215): the input data read from the tag. Returns: uid(str): the tag uid in form 0x0580000000050002."""
uid = None
if tag.product == 'NXP NTAG215':
... | the_stack_v2_python_sparse | beerlog/bnfc/base.py | conchyliculture/beerlog | train | 2 |
b5343630cc6fab3f7710a3209f3f9736ea9892e0 | [
"super(CSVWindowsWriter, self).__init__(filename)\nself.data_file = None\nself.writer = None\nif filename:\n with open(filename, 'wb') as fp:\n fp.write(codecs.BOM_UTF8)\n self.data_file = open(filename, 'a', encoding='utf-8', newline='')\n self.writer = csv.writer(self.data_file, dialect='excel')",... | <|body_start_0|>
super(CSVWindowsWriter, self).__init__(filename)
self.data_file = None
self.writer = None
if filename:
with open(filename, 'wb') as fp:
fp.write(codecs.BOM_UTF8)
self.data_file = open(filename, 'a', encoding='utf-8', newline='')
... | CSV file's writer. | CSVWindowsWriter | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CSVWindowsWriter:
"""CSV file's writer."""
def __init__(self, filename=None):
"""Args: filename: (String) data file's name. Returns: None"""
<|body_0|>
def writeln(self, line):
"""Write data line. Args: line: (List) Line data. Returns: boolean: Write success."""
... | stack_v2_sparse_classes_75kplus_train_069611 | 6,679 | permissive | [
{
"docstring": "Args: filename: (String) data file's name. Returns: None",
"name": "__init__",
"signature": "def __init__(self, filename=None)"
},
{
"docstring": "Write data line. Args: line: (List) Line data. Returns: boolean: Write success.",
"name": "writeln",
"signature": "def writel... | 3 | stack_v2_sparse_classes_30k_train_006875 | Implement the Python class `CSVWindowsWriter` described below.
Class description:
CSV file's writer.
Method signatures and docstrings:
- def __init__(self, filename=None): Args: filename: (String) data file's name. Returns: None
- def writeln(self, line): Write data line. Args: line: (List) Line data. Returns: boolea... | Implement the Python class `CSVWindowsWriter` described below.
Class description:
CSV file's writer.
Method signatures and docstrings:
- def __init__(self, filename=None): Args: filename: (String) data file's name. Returns: None
- def writeln(self, line): Write data line. Args: line: (List) Line data. Returns: boolea... | 5fa06b29bf800646dc4da5851fdf7a1f299f15a7 | <|skeleton|>
class CSVWindowsWriter:
"""CSV file's writer."""
def __init__(self, filename=None):
"""Args: filename: (String) data file's name. Returns: None"""
<|body_0|>
def writeln(self, line):
"""Write data line. Args: line: (List) Line data. Returns: boolean: Write success."""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CSVWindowsWriter:
"""CSV file's writer."""
def __init__(self, filename=None):
"""Args: filename: (String) data file's name. Returns: None"""
super(CSVWindowsWriter, self).__init__(filename)
self.data_file = None
self.writer = None
if filename:
with open... | the_stack_v2_python_sparse | muddery/common/utils/writers.py | muddery/muddery | train | 139 |
5c336c4021ba4d34d56a4bdd14fbf635dd7c5eea | [
"super().__init__()\nassert _type in ['ID3', 'C4.5', 'CART']\nassert predict_type in ['classification', 'regression']\nself.tree_count = tree_count\nself.attr_ratio = attr_ratio\nself.type = _type\nself.predict_type = predict_type\nself.split_count = split_count\nself.thread_count = min(thread_count, tree_count)\ni... | <|body_start_0|>
super().__init__()
assert _type in ['ID3', 'C4.5', 'CART']
assert predict_type in ['classification', 'regression']
self.tree_count = tree_count
self.attr_ratio = attr_ratio
self.type = _type
self.predict_type = predict_type
self.split_coun... | RandomForest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RandomForest:
def __init__(self, tree_count=50, attr_ratio=0.5, _type='CART', predict_type='classification', split_count=10, thread_count=5) -> None:
"""tree_count 决策树数量 attr_ratio 每一次决策树分裂时随机所选属性数目占总属性数目的比例 _type 决策树类型 predict_type 预测类型 classification 分类 regression 回归 split_count 对于连续属性... | stack_v2_sparse_classes_75kplus_train_069612 | 6,222 | no_license | [
{
"docstring": "tree_count 决策树数量 attr_ratio 每一次决策树分裂时随机所选属性数目占总属性数目的比例 _type 决策树类型 predict_type 预测类型 classification 分类 regression 回归 split_count 对于连续属性切分的次数 process_count 建立随机森林的进程数",
"name": "__init__",
"signature": "def __init__(self, tree_count=50, attr_ratio=0.5, _type='CART', predict_type='classifi... | 5 | stack_v2_sparse_classes_30k_train_013686 | Implement the Python class `RandomForest` described below.
Class description:
Implement the RandomForest class.
Method signatures and docstrings:
- def __init__(self, tree_count=50, attr_ratio=0.5, _type='CART', predict_type='classification', split_count=10, thread_count=5) -> None: tree_count 决策树数量 attr_ratio 每一次决策树... | Implement the Python class `RandomForest` described below.
Class description:
Implement the RandomForest class.
Method signatures and docstrings:
- def __init__(self, tree_count=50, attr_ratio=0.5, _type='CART', predict_type='classification', split_count=10, thread_count=5) -> None: tree_count 决策树数量 attr_ratio 每一次决策树... | cc9520554682172ba690cbcf517ac8fc5ec180b0 | <|skeleton|>
class RandomForest:
def __init__(self, tree_count=50, attr_ratio=0.5, _type='CART', predict_type='classification', split_count=10, thread_count=5) -> None:
"""tree_count 决策树数量 attr_ratio 每一次决策树分裂时随机所选属性数目占总属性数目的比例 _type 决策树类型 predict_type 预测类型 classification 分类 regression 回归 split_count 对于连续属性... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RandomForest:
def __init__(self, tree_count=50, attr_ratio=0.5, _type='CART', predict_type='classification', split_count=10, thread_count=5) -> None:
"""tree_count 决策树数量 attr_ratio 每一次决策树分裂时随机所选属性数目占总属性数目的比例 _type 决策树类型 predict_type 预测类型 classification 分类 regression 回归 split_count 对于连续属性切分的次数 process_... | the_stack_v2_python_sparse | Code/random_forest.py | zgood9527/Basic4AI | train | 2 | |
0b5c0bc93c815bcb606b9619ae06fa36284a7cca | [
"queryset = models.Teacher.objects.all()\nname = self.request.query_params.get('name', None)\nupna_id = self.request.query_params.get('upna_id', None)\ndegree_id = self.request.query_params.get('degree_id', None)\nupna_degree_id = self.request.query_params.get('upna_degree_id', None)\nsubject_id = self.request.quer... | <|body_start_0|>
queryset = models.Teacher.objects.all()
name = self.request.query_params.get('name', None)
upna_id = self.request.query_params.get('upna_id', None)
degree_id = self.request.query_params.get('degree_id', None)
upna_degree_id = self.request.query_params.get('upna_d... | Listado y vista en detalle de los profesores de la Universidad | TeacherViewSet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TeacherViewSet:
"""Listado y vista en detalle de los profesores de la Universidad"""
def get_queryset(self):
"""Método para gestionar los filtros sobre las asignaturas. Puede pedirse: - Un subconjunto de los profesores dado un string que coincide total o parcialmente con su nombre. -... | stack_v2_sparse_classes_75kplus_train_069613 | 9,178 | no_license | [
{
"docstring": "Método para gestionar los filtros sobre las asignaturas. Puede pedirse: - Un subconjunto de los profesores dado un string que coincide total o parcialmente con su nombre. - Un subconjunto de los profesores dado el identificador que se les concede en la UPNA. - Un subconjunto de las asignaturas d... | 2 | stack_v2_sparse_classes_30k_train_005677 | Implement the Python class `TeacherViewSet` described below.
Class description:
Listado y vista en detalle de los profesores de la Universidad
Method signatures and docstrings:
- def get_queryset(self): Método para gestionar los filtros sobre las asignaturas. Puede pedirse: - Un subconjunto de los profesores dado un ... | Implement the Python class `TeacherViewSet` described below.
Class description:
Listado y vista en detalle de los profesores de la Universidad
Method signatures and docstrings:
- def get_queryset(self): Método para gestionar los filtros sobre las asignaturas. Puede pedirse: - Un subconjunto de los profesores dado un ... | 13e369bc4ca64cb406046af319f1bdfdaabc8ee1 | <|skeleton|>
class TeacherViewSet:
"""Listado y vista en detalle de los profesores de la Universidad"""
def get_queryset(self):
"""Método para gestionar los filtros sobre las asignaturas. Puede pedirse: - Un subconjunto de los profesores dado un string que coincide total o parcialmente con su nombre. -... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TeacherViewSet:
"""Listado y vista en detalle de los profesores de la Universidad"""
def get_queryset(self):
"""Método para gestionar los filtros sobre las asignaturas. Puede pedirse: - Un subconjunto de los profesores dado un string que coincide total o parcialmente con su nombre. - Un subconjun... | the_stack_v2_python_sparse | mobile_app/views.py | CEUPNA/backend-ceupna | train | 1 |
f67f192f0fcaac18f9124f919626d24f3a1d2670 | [
"self.mp = {}\nfor idx, word in enumerate(words):\n if word not in self.mp:\n self.mp[word] = []\n self.mp[word] += [idx]",
"w1 = self.mp[word1]\nw2 = self.mp[word2]\nmin_diff = abs(min(w1) - max(w2))\ni, j = (0, 0)\nwhile i < len(w1) and j < len(w2):\n min_diff = min(min_diff, abs(w1[i] - w2[j]))... | <|body_start_0|>
self.mp = {}
for idx, word in enumerate(words):
if word not in self.mp:
self.mp[word] = []
self.mp[word] += [idx]
<|end_body_0|>
<|body_start_1|>
w1 = self.mp[word1]
w2 = self.mp[word2]
min_diff = abs(min(w1) - max(w2))
... | WordDistance | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WordDistance:
def __init__(self, words):
""":type words: List[str]"""
<|body_0|>
def shortest(self, word1, word2):
""":type word1: str :type word2: str :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.mp = {}
for idx, word in... | stack_v2_sparse_classes_75kplus_train_069614 | 1,804 | no_license | [
{
"docstring": ":type words: List[str]",
"name": "__init__",
"signature": "def __init__(self, words)"
},
{
"docstring": ":type word1: str :type word2: str :rtype: int",
"name": "shortest",
"signature": "def shortest(self, word1, word2)"
}
] | 2 | stack_v2_sparse_classes_30k_test_001588 | Implement the Python class `WordDistance` described below.
Class description:
Implement the WordDistance class.
Method signatures and docstrings:
- def __init__(self, words): :type words: List[str]
- def shortest(self, word1, word2): :type word1: str :type word2: str :rtype: int | Implement the Python class `WordDistance` described below.
Class description:
Implement the WordDistance class.
Method signatures and docstrings:
- def __init__(self, words): :type words: List[str]
- def shortest(self, word1, word2): :type word1: str :type word2: str :rtype: int
<|skeleton|>
class WordDistance:
... | 182c864ec8b9d62d40a7a91ccc323d37de1dc223 | <|skeleton|>
class WordDistance:
def __init__(self, words):
""":type words: List[str]"""
<|body_0|>
def shortest(self, word1, word2):
""":type word1: str :type word2: str :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class WordDistance:
def __init__(self, words):
""":type words: List[str]"""
self.mp = {}
for idx, word in enumerate(words):
if word not in self.mp:
self.mp[word] = []
self.mp[word] += [idx]
def shortest(self, word1, word2):
""":type word1:... | the_stack_v2_python_sparse | hash-table/shortest-word-distance-ii.py | rootid23/fft-py | train | 0 | |
88db16947d7725b0567c56cac151ad10a48b9f0d | [
"super(NagiosEventLogTailer, self).__init__(log_path, logger)\nself.hostname = hostname\nself._event = event_func\nself._tags = tags\nself._passive_checks = passive_checks",
"try:\n m = RE_LINE_REG.match(line)\n if m is None:\n m = RE_LINE_EXT.match(line)\n if m is None:\n return False\n ... | <|body_start_0|>
super(NagiosEventLogTailer, self).__init__(log_path, logger)
self.hostname = hostname
self._event = event_func
self._tags = tags
self._passive_checks = passive_checks
<|end_body_0|>
<|body_start_1|>
try:
m = RE_LINE_REG.match(line)
... | NagiosEventLogTailer | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference",
"MIT",
"BSD-3-Clause-Modification",
"Unlicense",
"Apache-2.0",
"LGPL-3.0-only",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"CC0-1.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NagiosEventLogTailer:
def __init__(self, log_path, logger, hostname, event_func, tags, passive_checks):
""":param log_path: string, path to the file to parse :param logger: Logger object :param hostname: string, name of the host this agent is running on :param event_func: function to cre... | stack_v2_sparse_classes_75kplus_train_069615 | 18,227 | permissive | [
{
"docstring": ":param log_path: string, path to the file to parse :param logger: Logger object :param hostname: string, name of the host this agent is running on :param event_func: function to create event, should accept dict :param passive_checks: bool, enable or not passive checks events",
"name": "__ini... | 3 | stack_v2_sparse_classes_30k_train_043816 | Implement the Python class `NagiosEventLogTailer` described below.
Class description:
Implement the NagiosEventLogTailer class.
Method signatures and docstrings:
- def __init__(self, log_path, logger, hostname, event_func, tags, passive_checks): :param log_path: string, path to the file to parse :param logger: Logger... | Implement the Python class `NagiosEventLogTailer` described below.
Class description:
Implement the NagiosEventLogTailer class.
Method signatures and docstrings:
- def __init__(self, log_path, logger, hostname, event_func, tags, passive_checks): :param log_path: string, path to the file to parse :param logger: Logger... | 406072e4294edff5b46b513f0cdf7c2c00fac9d2 | <|skeleton|>
class NagiosEventLogTailer:
def __init__(self, log_path, logger, hostname, event_func, tags, passive_checks):
""":param log_path: string, path to the file to parse :param logger: Logger object :param hostname: string, name of the host this agent is running on :param event_func: function to cre... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NagiosEventLogTailer:
def __init__(self, log_path, logger, hostname, event_func, tags, passive_checks):
""":param log_path: string, path to the file to parse :param logger: Logger object :param hostname: string, name of the host this agent is running on :param event_func: function to create event, sho... | the_stack_v2_python_sparse | nagios/datadog_checks/nagios/nagios.py | DataDog/integrations-core | train | 852 | |
60b1c56d9b242ac1aed38b51f6bf8096bafed5c9 | [
"queue = collections.deque([root])\nresult = ['#']\nwhile queue:\n node = queue.popleft()\n if node:\n queue.append(node.left)\n queue.append(node.right)\n result.append(str(node.val))\n else:\n result.append('#')\nreturn ' '.join(result)",
"if data == '# #':\n return None\... | <|body_start_0|>
queue = collections.deque([root])
result = ['#']
while queue:
node = queue.popleft()
if node:
queue.append(node.left)
queue.append(node.right)
result.append(str(node.val))
else:
r... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root: TreeNode) -> str:
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data: str) -> TreeNode:
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|b... | stack_v2_sparse_classes_75kplus_train_069616 | 3,026 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root: TreeNode) -> str"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode",
"name": "deserialize",
"signature"... | 2 | stack_v2_sparse_classes_30k_train_032949 | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data: str) -> TreeNode: Decodes your encoded dat... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data: str) -> TreeNode: Decodes your encoded dat... | 1c9528e26752b723e1d128b020f6c5291ed5ca19 | <|skeleton|>
class Codec:
def serialize(self, root: TreeNode) -> str:
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data: str) -> TreeNode:
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|b... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Codec:
def serialize(self, root: TreeNode) -> str:
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
queue = collections.deque([root])
result = ['#']
while queue:
node = queue.popleft()
if node:
queue.append(node.l... | the_stack_v2_python_sparse | leetcode/most_liked/297_serialize_and_deserialize_binary_tree.py | eunjungchoi/algorithm | train | 1 | |
3f8b4cee730b7a4a63e2cededb9c5441f860c244 | [
"super(TransformerEncoderLayer, self).__init__()\nself.layer_norm = nn.LayerNorm(size, eps=1e-06)\nself.src_src_att = MultiHeadedAttention(num_heads, size, dropout=dropout, attn_func=attn_func, attn_alpha=attn_alpha)\nself.feed_forward = PositionwiseFeedForward(size, ff_size, dropout)\nself.dropout = nn.Dropout(dro... | <|body_start_0|>
super(TransformerEncoderLayer, self).__init__()
self.layer_norm = nn.LayerNorm(size, eps=1e-06)
self.src_src_att = MultiHeadedAttention(num_heads, size, dropout=dropout, attn_func=attn_func, attn_alpha=attn_alpha)
self.feed_forward = PositionwiseFeedForward(size, ff_size... | One Transformer encoder layer has a Multi-head attention layer plus a position-wise feed-forward layer. | TransformerEncoderLayer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TransformerEncoderLayer:
"""One Transformer encoder layer has a Multi-head attention layer plus a position-wise feed-forward layer."""
def __init__(self, size: int, ff_size: int, num_heads: int=8, dropout: float=0.1, attn_func: str='softmax', attn_alpha: float=1.5):
"""A single Trans... | stack_v2_sparse_classes_75kplus_train_069617 | 10,098 | permissive | [
{
"docstring": "A single Transformer layer. :param size: :param ff_size: :param num_heads: :param dropout:",
"name": "__init__",
"signature": "def __init__(self, size: int, ff_size: int, num_heads: int=8, dropout: float=0.1, attn_func: str='softmax', attn_alpha: float=1.5)"
},
{
"docstring": "Fo... | 2 | null | Implement the Python class `TransformerEncoderLayer` described below.
Class description:
One Transformer encoder layer has a Multi-head attention layer plus a position-wise feed-forward layer.
Method signatures and docstrings:
- def __init__(self, size: int, ff_size: int, num_heads: int=8, dropout: float=0.1, attn_fu... | Implement the Python class `TransformerEncoderLayer` described below.
Class description:
One Transformer encoder layer has a Multi-head attention layer plus a position-wise feed-forward layer.
Method signatures and docstrings:
- def __init__(self, size: int, ff_size: int, num_heads: int=8, dropout: float=0.1, attn_fu... | c987906b032eaa727c8bcbec53f48befb467e515 | <|skeleton|>
class TransformerEncoderLayer:
"""One Transformer encoder layer has a Multi-head attention layer plus a position-wise feed-forward layer."""
def __init__(self, size: int, ff_size: int, num_heads: int=8, dropout: float=0.1, attn_func: str='softmax', attn_alpha: float=1.5):
"""A single Trans... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TransformerEncoderLayer:
"""One Transformer encoder layer has a Multi-head attention layer plus a position-wise feed-forward layer."""
def __init__(self, size: int, ff_size: int, num_heads: int=8, dropout: float=0.1, attn_func: str='softmax', attn_alpha: float=1.5):
"""A single Transformer layer.... | the_stack_v2_python_sparse | joeynmt/transformer_layers.py | deep-spin/S7 | train | 7 |
10de8d543c7c703bdbb720befb22297ac9103456 | [
"dp = [[0 for _ in range(n)] for _ in range(m)]\nfor i in range(m):\n dp[i][0] = 1\nfor j in range(n):\n dp[0][j] = 1\nfor i in range(1, m):\n for j in range(1, n):\n dp[i][j] = dp[i - 1][j] + dp[i][j - 1]\nreturn dp[m - 1][n - 1]",
"dp = [1 for _ in range(n)]\nfor i in range(1, m):\n for j in ... | <|body_start_0|>
dp = [[0 for _ in range(n)] for _ in range(m)]
for i in range(m):
dp[i][0] = 1
for j in range(n):
dp[0][j] = 1
for i in range(1, m):
for j in range(1, n):
dp[i][j] = dp[i - 1][j] + dp[i][j - 1]
return dp[m - 1][... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def uniquePaths1(self, m: int, n: int) -> int:
"""动态规划: (1) 定义目标: 到Finish(m, n)的路径f(m,n) 总共有total条 (2)迁移方程: f(m ,n) = f(m-1, n) + f(m , n-1) (3) 初始状态: f(1, n) = 1, f(m, 1) = 1 (只能一直向一个方向走)"""
<|body_0|>
def uniquePaths(self, m: int, n: int) -> int:
"""上面的解法... | stack_v2_sparse_classes_75kplus_train_069618 | 1,167 | no_license | [
{
"docstring": "动态规划: (1) 定义目标: 到Finish(m, n)的路径f(m,n) 总共有total条 (2)迁移方程: f(m ,n) = f(m-1, n) + f(m , n-1) (3) 初始状态: f(1, n) = 1, f(m, 1) = 1 (只能一直向一个方向走)",
"name": "uniquePaths1",
"signature": "def uniquePaths1(self, m: int, n: int) -> int"
},
{
"docstring": "上面的解法 使用了二维数组,实际上下一行的值只依赖上一行的值, 所以只... | 2 | stack_v2_sparse_classes_30k_train_027471 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def uniquePaths1(self, m: int, n: int) -> int: 动态规划: (1) 定义目标: 到Finish(m, n)的路径f(m,n) 总共有total条 (2)迁移方程: f(m ,n) = f(m-1, n) + f(m , n-1) (3) 初始状态: f(1, n) = 1, f(m, 1) = 1 (只能一直... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def uniquePaths1(self, m: int, n: int) -> int: 动态规划: (1) 定义目标: 到Finish(m, n)的路径f(m,n) 总共有total条 (2)迁移方程: f(m ,n) = f(m-1, n) + f(m , n-1) (3) 初始状态: f(1, n) = 1, f(m, 1) = 1 (只能一直... | f0f4ba0cb91096e55e21b7a2240afbd347187351 | <|skeleton|>
class Solution:
def uniquePaths1(self, m: int, n: int) -> int:
"""动态规划: (1) 定义目标: 到Finish(m, n)的路径f(m,n) 总共有total条 (2)迁移方程: f(m ,n) = f(m-1, n) + f(m , n-1) (3) 初始状态: f(1, n) = 1, f(m, 1) = 1 (只能一直向一个方向走)"""
<|body_0|>
def uniquePaths(self, m: int, n: int) -> int:
"""上面的解法... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def uniquePaths1(self, m: int, n: int) -> int:
"""动态规划: (1) 定义目标: 到Finish(m, n)的路径f(m,n) 总共有total条 (2)迁移方程: f(m ,n) = f(m-1, n) + f(m , n-1) (3) 初始状态: f(1, n) = 1, f(m, 1) = 1 (只能一直向一个方向走)"""
dp = [[0 for _ in range(n)] for _ in range(m)]
for i in range(m):
dp[i][... | the_stack_v2_python_sparse | coding_test/62_uniquePath.py | zhuheng-mark/myDL | train | 2 | |
d023acc1c4325ff61f82d807b3be1b96634aa056 | [
"resource = f'/luban-glxx-user/permission/saveMenu'\nresponse = item_fixture.request('POST', resource, body)\nreturn response",
"resource = f'/luban-glxx-user/permission/select'\nquery_params = {'roleId': roleId}\nresponse = item_fixture.request('GET', resource, params=query_params)\nreturn response",
"resource... | <|body_start_0|>
resource = f'/luban-glxx-user/permission/saveMenu'
response = item_fixture.request('POST', resource, body)
return response
<|end_body_0|>
<|body_start_1|>
resource = f'/luban-glxx-user/permission/select'
query_params = {'roleId': roleId}
response = item_... | 功能权限模块 | Permission | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Permission:
"""功能权限模块"""
def saveRoleMenuUsingPOST(self, item_fixture, body):
"""角色和权限绑定接口(新的) :param item_fixture: item fixture, :param moduleType: 系统模块,0:质检评定,1:电子档案 :param perm: 权限码 :param roleId: 角色id"""
<|body_0|>
def findPermissionUsingGET(self, item_fixture, roleI... | stack_v2_sparse_classes_75kplus_train_069619 | 2,350 | no_license | [
{
"docstring": "角色和权限绑定接口(新的) :param item_fixture: item fixture, :param moduleType: 系统模块,0:质检评定,1:电子档案 :param perm: 权限码 :param roleId: 角色id",
"name": "saveRoleMenuUsingPOST",
"signature": "def saveRoleMenuUsingPOST(self, item_fixture, body)"
},
{
"docstring": "查询权限列表接口 :param item_fixture: item ... | 4 | null | Implement the Python class `Permission` described below.
Class description:
功能权限模块
Method signatures and docstrings:
- def saveRoleMenuUsingPOST(self, item_fixture, body): 角色和权限绑定接口(新的) :param item_fixture: item fixture, :param moduleType: 系统模块,0:质检评定,1:电子档案 :param perm: 权限码 :param roleId: 角色id
- def findPermissionUs... | Implement the Python class `Permission` described below.
Class description:
功能权限模块
Method signatures and docstrings:
- def saveRoleMenuUsingPOST(self, item_fixture, body): 角色和权限绑定接口(新的) :param item_fixture: item fixture, :param moduleType: 系统模块,0:质检评定,1:电子档案 :param perm: 权限码 :param roleId: 角色id
- def findPermissionUs... | f875de62f7f505c596ea5567e1fc2c8a64010f87 | <|skeleton|>
class Permission:
"""功能权限模块"""
def saveRoleMenuUsingPOST(self, item_fixture, body):
"""角色和权限绑定接口(新的) :param item_fixture: item fixture, :param moduleType: 系统模块,0:质检评定,1:电子档案 :param perm: 权限码 :param roleId: 角色id"""
<|body_0|>
def findPermissionUsingGET(self, item_fixture, roleI... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Permission:
"""功能权限模块"""
def saveRoleMenuUsingPOST(self, item_fixture, body):
"""角色和权限绑定接口(新的) :param item_fixture: item fixture, :param moduleType: 系统模块,0:质检评定,1:电子档案 :param perm: 权限码 :param roleId: 角色id"""
resource = f'/luban-glxx-user/permission/saveMenu'
response = item_fixtur... | the_stack_v2_python_sparse | swagger/api/luban_glxx_user/permission.py | zhangjingwen198817/pytest-api-allure | train | 1 |
95a00bf540728437bb745b9e5ca5eb3cdfbb087e | [
"super(ResNet, self).__init__()\nself.conv1 = nn.Conv2d(num_channels, 16, 3, 1, 1)\nself.norm1 = nn.BatchNorm2d(16)\nself.relu1 = nn.ReLU(inplace=True)\nself.layers1 = self._make_layer(n, 16, 16, 1)\nself.layers2 = self._make_layer(n, 32, 16, 2)\nself.layers3 = self._make_layer(n, 64, 32, 2)\nself.avgpool = nn.AvgP... | <|body_start_0|>
super(ResNet, self).__init__()
self.conv1 = nn.Conv2d(num_channels, 16, 3, 1, 1)
self.norm1 = nn.BatchNorm2d(16)
self.relu1 = nn.ReLU(inplace=True)
self.layers1 = self._make_layer(n, 16, 16, 1)
self.layers2 = self._make_layer(n, 32, 16, 2)
self.la... | Class for a ResNet classifier. | ResNet | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ResNet:
"""Class for a ResNet classifier."""
def __init__(self, num_channels, num_classes, n=2):
"""Class initializer."""
<|body_0|>
def _make_layer(n, num_filters, channels_in, stride):
"""Make a single layer."""
<|body_1|>
def forward(self, x):
... | stack_v2_sparse_classes_75kplus_train_069620 | 4,467 | permissive | [
{
"docstring": "Class initializer.",
"name": "__init__",
"signature": "def __init__(self, num_channels, num_classes, n=2)"
},
{
"docstring": "Make a single layer.",
"name": "_make_layer",
"signature": "def _make_layer(n, num_filters, channels_in, stride)"
},
{
"docstring": "Forwa... | 5 | stack_v2_sparse_classes_30k_train_047735 | Implement the Python class `ResNet` described below.
Class description:
Class for a ResNet classifier.
Method signatures and docstrings:
- def __init__(self, num_channels, num_classes, n=2): Class initializer.
- def _make_layer(n, num_filters, channels_in, stride): Make a single layer.
- def forward(self, x): Forward... | Implement the Python class `ResNet` described below.
Class description:
Class for a ResNet classifier.
Method signatures and docstrings:
- def __init__(self, num_channels, num_classes, n=2): Class initializer.
- def _make_layer(n, num_filters, channels_in, stride): Make a single layer.
- def forward(self, x): Forward... | fe5d1eb5ab5453be70c4be473fd3da71afe4b06c | <|skeleton|>
class ResNet:
"""Class for a ResNet classifier."""
def __init__(self, num_channels, num_classes, n=2):
"""Class initializer."""
<|body_0|>
def _make_layer(n, num_filters, channels_in, stride):
"""Make a single layer."""
<|body_1|>
def forward(self, x):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ResNet:
"""Class for a ResNet classifier."""
def __init__(self, num_channels, num_classes, n=2):
"""Class initializer."""
super(ResNet, self).__init__()
self.conv1 = nn.Conv2d(num_channels, 16, 3, 1, 1)
self.norm1 = nn.BatchNorm2d(16)
self.relu1 = nn.ReLU(inplace=T... | the_stack_v2_python_sparse | src/kegnet/classifier/models/resnet.py | videoturingtest/KegNet | train | 0 |
8d3d27038283206696aba8ec44b610695ebfc842 | [
"cust_list = []\nwith open('data_layer/data_files/customers.csv', encoding='utf-8') as file_stream:\n cust_reader = csv.DictReader(file_stream)\n for row in cust_reader:\n cust = Customer(row['name'], row['ssn'], row['address'], row['postal_code'], row['phone'], row['email'], row['country'], row['licen... | <|body_start_0|>
cust_list = []
with open('data_layer/data_files/customers.csv', encoding='utf-8') as file_stream:
cust_reader = csv.DictReader(file_stream)
for row in cust_reader:
cust = Customer(row['name'], row['ssn'], row['address'], row['postal_code'], row['p... | CustomerData | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CustomerData:
def get_customers(self):
"""returns a list with instances of all customers"""
<|body_0|>
def add_customer(self, cust):
"""writes new customer to database"""
<|body_1|>
def change_customer_info(self, atttribute_list):
"""Takes in a l... | stack_v2_sparse_classes_75kplus_train_069621 | 1,941 | no_license | [
{
"docstring": "returns a list with instances of all customers",
"name": "get_customers",
"signature": "def get_customers(self)"
},
{
"docstring": "writes new customer to database",
"name": "add_customer",
"signature": "def add_customer(self, cust)"
},
{
"docstring": "Takes in a ... | 3 | stack_v2_sparse_classes_30k_train_007081 | Implement the Python class `CustomerData` described below.
Class description:
Implement the CustomerData class.
Method signatures and docstrings:
- def get_customers(self): returns a list with instances of all customers
- def add_customer(self, cust): writes new customer to database
- def change_customer_info(self, a... | Implement the Python class `CustomerData` described below.
Class description:
Implement the CustomerData class.
Method signatures and docstrings:
- def get_customers(self): returns a list with instances of all customers
- def add_customer(self, cust): writes new customer to database
- def change_customer_info(self, a... | 917c6c6c29ac998e58a4f9807f63e660a1b2bf54 | <|skeleton|>
class CustomerData:
def get_customers(self):
"""returns a list with instances of all customers"""
<|body_0|>
def add_customer(self, cust):
"""writes new customer to database"""
<|body_1|>
def change_customer_info(self, atttribute_list):
"""Takes in a l... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CustomerData:
def get_customers(self):
"""returns a list with instances of all customers"""
cust_list = []
with open('data_layer/data_files/customers.csv', encoding='utf-8') as file_stream:
cust_reader = csv.DictReader(file_stream)
for row in cust_reader:
... | the_stack_v2_python_sparse | src/data_layer/customer_data.py | ThorRafnar/NaNAirCarRental | train | 0 | |
98060b4873157f332869b13137b4263e473d0e4e | [
"self.logger = logger\nself._loop = loop\nself._in_path = in_path\nself._out_path = out_path\nself._pipe = None\nself.last_exception: Optional[Exception] = None",
"if self._loop is None:\n self._loop = asyncio.get_event_loop()\nself._pipe = PosixNamedPipeProtocol(self._in_path, self._out_path, logger=self.logg... | <|body_start_0|>
self.logger = logger
self._loop = loop
self._in_path = in_path
self._out_path = out_path
self._pipe = None
self.last_exception: Optional[Exception] = None
<|end_body_0|>
<|body_start_1|>
if self._loop is None:
self._loop = asyncio.get... | Interprocess communication channel client using Posix named pipes. | PosixNamedPipeChannelClient | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PosixNamedPipeChannelClient:
"""Interprocess communication channel client using Posix named pipes."""
def __init__(self, in_path: str, out_path: str, logger: logging.Logger=_default_logger, loop: Optional[AbstractEventLoop]=None) -> None:
"""Initialize a posix named pipe communicatio... | stack_v2_sparse_classes_75kplus_train_069622 | 23,051 | permissive | [
{
"docstring": "Initialize a posix named pipe communication channel client. :param in_path: rendezvous point for incoming data :param out_path: rendezvous point for outgoing data :param logger: the logger :param loop: the event loop",
"name": "__init__",
"signature": "def __init__(self, in_path: str, ou... | 5 | stack_v2_sparse_classes_30k_train_005651 | Implement the Python class `PosixNamedPipeChannelClient` described below.
Class description:
Interprocess communication channel client using Posix named pipes.
Method signatures and docstrings:
- def __init__(self, in_path: str, out_path: str, logger: logging.Logger=_default_logger, loop: Optional[AbstractEventLoop]=... | Implement the Python class `PosixNamedPipeChannelClient` described below.
Class description:
Interprocess communication channel client using Posix named pipes.
Method signatures and docstrings:
- def __init__(self, in_path: str, out_path: str, logger: logging.Logger=_default_logger, loop: Optional[AbstractEventLoop]=... | bec49adaeba661d8d0f03ac9935dc89f39d95a0d | <|skeleton|>
class PosixNamedPipeChannelClient:
"""Interprocess communication channel client using Posix named pipes."""
def __init__(self, in_path: str, out_path: str, logger: logging.Logger=_default_logger, loop: Optional[AbstractEventLoop]=None) -> None:
"""Initialize a posix named pipe communicatio... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PosixNamedPipeChannelClient:
"""Interprocess communication channel client using Posix named pipes."""
def __init__(self, in_path: str, out_path: str, logger: logging.Logger=_default_logger, loop: Optional[AbstractEventLoop]=None) -> None:
"""Initialize a posix named pipe communication channel cli... | the_stack_v2_python_sparse | aea/helpers/pipe.py | fetchai/agents-aea | train | 192 |
7556a5b4a26081f1b04ac88b64486ede82e59291 | [
"from vistrails.db.services.io import open_bundle_from_zip_xml\nfrom vistrails.core.system import vistrails_root_directory\nimport os\nsave_bundle, vt_save_dir = open_bundle_from_zip_xml(DBVistrail.vtType, os.path.join(vistrails_root_directory(), 'tests/resources/paramexp-1.0.3.vt'))\nvistrail = translateVistrail(s... | <|body_start_0|>
from vistrails.db.services.io import open_bundle_from_zip_xml
from vistrails.core.system import vistrails_root_directory
import os
save_bundle, vt_save_dir = open_bundle_from_zip_xml(DBVistrail.vtType, os.path.join(vistrails_root_directory(), 'tests/resources/paramexp-1.... | TestTranslate | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestTranslate:
def testParamexp(self):
"""test translating parameter explorations from 1.0.3 to 1.0.2"""
<|body_0|>
def testVistrailvars(self):
"""test translating vistrail variables from 1.0.3 to 1.0.2"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_069623 | 9,080 | permissive | [
{
"docstring": "test translating parameter explorations from 1.0.3 to 1.0.2",
"name": "testParamexp",
"signature": "def testParamexp(self)"
},
{
"docstring": "test translating vistrail variables from 1.0.3 to 1.0.2",
"name": "testVistrailvars",
"signature": "def testVistrailvars(self)"
... | 2 | stack_v2_sparse_classes_30k_train_020940 | Implement the Python class `TestTranslate` described below.
Class description:
Implement the TestTranslate class.
Method signatures and docstrings:
- def testParamexp(self): test translating parameter explorations from 1.0.3 to 1.0.2
- def testVistrailvars(self): test translating vistrail variables from 1.0.3 to 1.0.... | Implement the Python class `TestTranslate` described below.
Class description:
Implement the TestTranslate class.
Method signatures and docstrings:
- def testParamexp(self): test translating parameter explorations from 1.0.3 to 1.0.2
- def testVistrailvars(self): test translating vistrail variables from 1.0.3 to 1.0.... | 23ef56ec24b85c82416e1437a08381635328abe5 | <|skeleton|>
class TestTranslate:
def testParamexp(self):
"""test translating parameter explorations from 1.0.3 to 1.0.2"""
<|body_0|>
def testVistrailvars(self):
"""test translating vistrail variables from 1.0.3 to 1.0.2"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestTranslate:
def testParamexp(self):
"""test translating parameter explorations from 1.0.3 to 1.0.2"""
from vistrails.db.services.io import open_bundle_from_zip_xml
from vistrails.core.system import vistrails_root_directory
import os
save_bundle, vt_save_dir = open_bu... | the_stack_v2_python_sparse | vistrails_current/vistrails/db/versions/v1_0_2/translate/v1_0_3.py | lumig242/VisTrailsRecommendation | train | 3 | |
9653ae6ed0165980de46719b99bf6e02ed032ed0 | [
"objects = self.__simpletxt_parse__(annotpath, imgpath)\ncoco_annotations = []\nfor object_struct in objects:\n bbox = object_struct['bbox']\n segmentation = object_struct['segmentation']\n label = object_struct['label']\n width = bbox[2]\n height = bbox[3]\n area = height * width\n if area <= ... | <|body_start_0|>
objects = self.__simpletxt_parse__(annotpath, imgpath)
coco_annotations = []
for object_struct in objects:
bbox = object_struct['bbox']
segmentation = object_struct['segmentation']
label = object_struct['label']
width = bbox[2]
... | SIMPLETXT2COCO | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SIMPLETXT2COCO:
def __generate_coco_annotation__(self, annotpath, imgpath):
"""docstring here :param self: :param annotpath: the path of each annotation :param return: dict()"""
<|body_0|>
def __simpletxt_parse__(self, label_file, image_file):
"""(xmin, ymin, xmax, y... | stack_v2_sparse_classes_75kplus_train_069624 | 5,149 | no_license | [
{
"docstring": "docstring here :param self: :param annotpath: the path of each annotation :param return: dict()",
"name": "__generate_coco_annotation__",
"signature": "def __generate_coco_annotation__(self, annotpath, imgpath)"
},
{
"docstring": "(xmin, ymin, xmax, ymax)",
"name": "__simplet... | 2 | stack_v2_sparse_classes_30k_train_023111 | Implement the Python class `SIMPLETXT2COCO` described below.
Class description:
Implement the SIMPLETXT2COCO class.
Method signatures and docstrings:
- def __generate_coco_annotation__(self, annotpath, imgpath): docstring here :param self: :param annotpath: the path of each annotation :param return: dict()
- def __si... | Implement the Python class `SIMPLETXT2COCO` described below.
Class description:
Implement the SIMPLETXT2COCO class.
Method signatures and docstrings:
- def __generate_coco_annotation__(self, annotpath, imgpath): docstring here :param self: :param annotpath: the path of each annotation :param return: dict()
- def __si... | 2f462a3d028b766234d62a3ef706a0f08f10680a | <|skeleton|>
class SIMPLETXT2COCO:
def __generate_coco_annotation__(self, annotpath, imgpath):
"""docstring here :param self: :param annotpath: the path of each annotation :param return: dict()"""
<|body_0|>
def __simpletxt_parse__(self, label_file, image_file):
"""(xmin, ymin, xmax, y... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SIMPLETXT2COCO:
def __generate_coco_annotation__(self, annotpath, imgpath):
"""docstring here :param self: :param annotpath: the path of each annotation :param return: dict()"""
objects = self.__simpletxt_parse__(annotpath, imgpath)
coco_annotations = []
for object_struct in ob... | the_stack_v2_python_sparse | tools/datasets/buildchange/simpletxt_buildchange2coco.py | Sebastixian/wwtool | train | 0 | |
8c273a8d99ea1f8cbb5f91fc013cc89770d5a32b | [
"super(NormalCombat, self).start()\nfor char in self.characters.values():\n character = char['char']\n if not character.is_player():\n character.start_auto_combat_skill()",
"for char in self.characters.values():\n char['char'].stop_auto_combat_skill()\nawait super(NormalCombat, self).finish()"
] | <|body_start_0|>
super(NormalCombat, self).start()
for char in self.characters.values():
character = char['char']
if not character.is_player():
character.start_auto_combat_skill()
<|end_body_0|>
<|body_start_1|>
for char in self.characters.values():
... | This implements the normal combat handler. | NormalCombat | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NormalCombat:
"""This implements the normal combat handler."""
def start(self):
"""Start a combat, make all NPCs to cast skills automatically."""
<|body_0|>
async def finish(self):
"""Finish a combat. Send results to players, and kill all failed characters."""
... | stack_v2_sparse_classes_75kplus_train_069625 | 887 | permissive | [
{
"docstring": "Start a combat, make all NPCs to cast skills automatically.",
"name": "start",
"signature": "def start(self)"
},
{
"docstring": "Finish a combat. Send results to players, and kill all failed characters.",
"name": "finish",
"signature": "async def finish(self)"
}
] | 2 | null | Implement the Python class `NormalCombat` described below.
Class description:
This implements the normal combat handler.
Method signatures and docstrings:
- def start(self): Start a combat, make all NPCs to cast skills automatically.
- async def finish(self): Finish a combat. Send results to players, and kill all fai... | Implement the Python class `NormalCombat` described below.
Class description:
This implements the normal combat handler.
Method signatures and docstrings:
- def start(self): Start a combat, make all NPCs to cast skills automatically.
- async def finish(self): Finish a combat. Send results to players, and kill all fai... | 5fa06b29bf800646dc4da5851fdf7a1f299f15a7 | <|skeleton|>
class NormalCombat:
"""This implements the normal combat handler."""
def start(self):
"""Start a combat, make all NPCs to cast skills automatically."""
<|body_0|>
async def finish(self):
"""Finish a combat. Send results to players, and kill all failed characters."""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NormalCombat:
"""This implements the normal combat handler."""
def start(self):
"""Start a combat, make all NPCs to cast skills automatically."""
super(NormalCombat, self).start()
for char in self.characters.values():
character = char['char']
if not charact... | the_stack_v2_python_sparse | muddery/server/combat/combat_runner/normal_combat.py | muddery/muddery | train | 139 |
a0c30ae2fc23ad9b7141fba5a3427f83b5cb362a | [
"params = {'os-volume-type-access:is_public': False}\nvolume_type = self.create_volume_type(**params)\nself.assertRaises(lib_exc.NotFound, self.volumes_client.create_volume, volume_type=volume_type['id'], size=CONF.volume.volume_size)\nself.admin_volume_types_client.add_type_access(volume_type['id'], project=self.v... | <|body_start_0|>
params = {'os-volume-type-access:is_public': False}
volume_type = self.create_volume_type(**params)
self.assertRaises(lib_exc.NotFound, self.volumes_client.create_volume, volume_type=volume_type['id'], size=CONF.volume.volume_size)
self.admin_volume_types_client.add_type... | Test volume type access | VolumeTypesAccessTest | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VolumeTypesAccessTest:
"""Test volume type access"""
def test_volume_type_access_add(self):
"""Test adding volume type access for non-admin project"""
<|body_0|>
def test_volume_type_access_list(self):
"""Test listing volume type access"""
<|body_1|>
<|e... | stack_v2_sparse_classes_75kplus_train_069626 | 4,034 | permissive | [
{
"docstring": "Test adding volume type access for non-admin project",
"name": "test_volume_type_access_add",
"signature": "def test_volume_type_access_add(self)"
},
{
"docstring": "Test listing volume type access",
"name": "test_volume_type_access_list",
"signature": "def test_volume_ty... | 2 | null | Implement the Python class `VolumeTypesAccessTest` described below.
Class description:
Test volume type access
Method signatures and docstrings:
- def test_volume_type_access_add(self): Test adding volume type access for non-admin project
- def test_volume_type_access_list(self): Test listing volume type access | Implement the Python class `VolumeTypesAccessTest` described below.
Class description:
Test volume type access
Method signatures and docstrings:
- def test_volume_type_access_add(self): Test adding volume type access for non-admin project
- def test_volume_type_access_list(self): Test listing volume type access
<|sk... | 3932a799e620a20d7abf7b89e21b520683a1809b | <|skeleton|>
class VolumeTypesAccessTest:
"""Test volume type access"""
def test_volume_type_access_add(self):
"""Test adding volume type access for non-admin project"""
<|body_0|>
def test_volume_type_access_list(self):
"""Test listing volume type access"""
<|body_1|>
<|e... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class VolumeTypesAccessTest:
"""Test volume type access"""
def test_volume_type_access_add(self):
"""Test adding volume type access for non-admin project"""
params = {'os-volume-type-access:is_public': False}
volume_type = self.create_volume_type(**params)
self.assertRaises(lib_... | the_stack_v2_python_sparse | tempest/api/volume/admin/test_volume_type_access.py | openstack/tempest | train | 270 |
6e1e87874670cb74f2ab96d177ef448f7dbc4b93 | [
"super(GainMatrix, self).__init__()\nDEFAULT_PARAM = {'N': None, 'nb_ft': None, 'initialize_to_one': True, 'scalar_gain': False}\nN = get_value('N', param, DEFAULT_PARAM)\nnb_ft = get_value('nb_ft', param, DEFAULT_PARAM)\ninitialize_to_one = get_value('initialize_to_one', param, DEFAULT_PARAM)\nscalar_gain = get_va... | <|body_start_0|>
super(GainMatrix, self).__init__()
DEFAULT_PARAM = {'N': None, 'nb_ft': None, 'initialize_to_one': True, 'scalar_gain': False}
N = get_value('N', param, DEFAULT_PARAM)
nb_ft = get_value('nb_ft', param, DEFAULT_PARAM)
initialize_to_one = get_value('initialize_to_o... | GainMatrix | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GainMatrix:
def __init__(self, param):
"""A gain matrix gathers 2N gain vectors : - N for the encoder - N for the decoder It is design to work at N different rates. One gain vector is composed of nb_ft elements as it needs to weight nb_ft channels in the bottleneck"""
<|body_0|>
... | stack_v2_sparse_classes_75kplus_train_069627 | 6,967 | permissive | [
{
"docstring": "A gain matrix gathers 2N gain vectors : - N for the encoder - N for the decoder It is design to work at N different rates. One gain vector is composed of nb_ft elements as it needs to weight nb_ft channels in the bottleneck",
"name": "__init__",
"signature": "def __init__(self, param)"
... | 4 | null | Implement the Python class `GainMatrix` described below.
Class description:
Implement the GainMatrix class.
Method signatures and docstrings:
- def __init__(self, param): A gain matrix gathers 2N gain vectors : - N for the encoder - N for the decoder It is design to work at N different rates. One gain vector is compo... | Implement the Python class `GainMatrix` described below.
Class description:
Implement the GainMatrix class.
Method signatures and docstrings:
- def __init__(self, param): A gain matrix gathers 2N gain vectors : - N for the encoder - N for the decoder It is design to work at N different rates. One gain vector is compo... | 68ec3d7ea6e0f6eaecf411b51f7e4c3992ddd46b | <|skeleton|>
class GainMatrix:
def __init__(self, param):
"""A gain matrix gathers 2N gain vectors : - N for the encoder - N for the decoder It is design to work at N different rates. One gain vector is composed of nb_ft elements as it needs to weight nb_ft channels in the bottleneck"""
<|body_0|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GainMatrix:
def __init__(self, param):
"""A gain matrix gathers 2N gain vectors : - N for the encoder - N for the decoder It is design to work at N different rates. One gain vector is composed of nb_ft elements as it needs to weight nb_ft channels in the bottleneck"""
super(GainMatrix, self)._... | the_stack_v2_python_sparse | src/layers/multi_rate/gain_matrix.py | thinkall/AIVC | train | 0 | |
a8ef28be87004bcd6d936df1350d6bbdea4b415c | [
"super(BahdanauAttention, self).__init__()\nself.W1 = tf.keras.layers.Dense(units)\nself.W2 = tf.keras.layers.Dense(units)\nself.V = tf.keras.layers.Dense(1)",
"query_with_time_axis = tf.expand_dims(query, 1)\nscore = self.V(tf.nn.tanh(self.W1(query_with_time_axis) + self.W2(values)))\nattention_weights = tf.nn.s... | <|body_start_0|>
super(BahdanauAttention, self).__init__()
self.W1 = tf.keras.layers.Dense(units)
self.W2 = tf.keras.layers.Dense(units)
self.V = tf.keras.layers.Dense(1)
<|end_body_0|>
<|body_start_1|>
query_with_time_axis = tf.expand_dims(query, 1)
score = self.V(tf.nn... | Attention layer used with the gru model. | BahdanauAttention | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BahdanauAttention:
"""Attention layer used with the gru model."""
def __init__(self, units):
"""Create the attention layer."""
<|body_0|>
def call(self, query, values):
"""Call of the attention layer. Note that the call must be for one caracter/word at a time."""... | stack_v2_sparse_classes_75kplus_train_069628 | 8,984 | no_license | [
{
"docstring": "Create the attention layer.",
"name": "__init__",
"signature": "def __init__(self, units)"
},
{
"docstring": "Call of the attention layer. Note that the call must be for one caracter/word at a time.",
"name": "call",
"signature": "def call(self, query, values)"
}
] | 2 | stack_v2_sparse_classes_30k_train_014769 | Implement the Python class `BahdanauAttention` described below.
Class description:
Attention layer used with the gru model.
Method signatures and docstrings:
- def __init__(self, units): Create the attention layer.
- def call(self, query, values): Call of the attention layer. Note that the call must be for one caract... | Implement the Python class `BahdanauAttention` described below.
Class description:
Attention layer used with the gru model.
Method signatures and docstrings:
- def __init__(self, units): Create the attention layer.
- def call(self, query, values): Call of the attention layer. Note that the call must be for one caract... | 4502d9e7461520664e72165a91bedd8e65464bae | <|skeleton|>
class BahdanauAttention:
"""Attention layer used with the gru model."""
def __init__(self, units):
"""Create the attention layer."""
<|body_0|>
def call(self, query, values):
"""Call of the attention layer. Note that the call must be for one caracter/word at a time."""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BahdanauAttention:
"""Attention layer used with the gru model."""
def __init__(self, units):
"""Create the attention layer."""
super(BahdanauAttention, self).__init__()
self.W1 = tf.keras.layers.Dense(units)
self.W2 = tf.keras.layers.Dense(units)
self.V = tf.keras.... | the_stack_v2_python_sparse | src/model/gru_attention.py | nathanielsimard/Low-Resource-Machine-Translation | train | 0 |
d0b554282c62bd19c811832d5841482acabd6817 | [
"self._parent = parent\nself.window = gtk.Dialog(flags=gtk.DIALOG_MODAL)\nself.window.set_transient_for(self._parent.window.builder.get_object('main_window'))\nself.window.set_position(gtk.WIN_POS_CENTER_ON_PARENT)\nself.buttons = []\nfor name, icon, dialog_class in loaders.iter_loaders():\n bt = gtk.Button(name... | <|body_start_0|>
self._parent = parent
self.window = gtk.Dialog(flags=gtk.DIALOG_MODAL)
self.window.set_transient_for(self._parent.window.builder.get_object('main_window'))
self.window.set_position(gtk.WIN_POS_CENTER_ON_PARENT)
self.buttons = []
for name, icon, dialog_cla... | rief dialog class showing buttons calling the appropriate loaders | loader_dialog | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class loader_dialog:
"""rief dialog class showing buttons calling the appropriate loaders"""
def __init__(self, parent):
"""rief constructor \\param parent - gtk_view class instance"""
<|body_0|>
def button_clicked(self, button, dialog_class):
"""rief executed when ... | stack_v2_sparse_classes_75kplus_train_069629 | 1,726 | no_license | [
{
"docstring": "\brief constructor \\\\param parent - gtk_view class instance",
"name": "__init__",
"signature": "def __init__(self, parent)"
},
{
"docstring": "\brief executed when dialog button is clicked \\\\param button \\\\param dialog_class - dialog class given from",
"name": "button_c... | 3 | stack_v2_sparse_classes_30k_train_025391 | Implement the Python class `loader_dialog` described below.
Class description:
rief dialog class showing buttons calling the appropriate loaders
Method signatures and docstrings:
- def __init__(self, parent): rief constructor \\param parent - gtk_view class instance
- def button_clicked(self, button, dialog_class):... | Implement the Python class `loader_dialog` described below.
Class description:
rief dialog class showing buttons calling the appropriate loaders
Method signatures and docstrings:
- def __init__(self, parent): rief constructor \\param parent - gtk_view class instance
- def button_clicked(self, button, dialog_class):... | eb151afa9ee939ed7943da9eeed1e976ac816fec | <|skeleton|>
class loader_dialog:
"""rief dialog class showing buttons calling the appropriate loaders"""
def __init__(self, parent):
"""rief constructor \\param parent - gtk_view class instance"""
<|body_0|>
def button_clicked(self, button, dialog_class):
"""rief executed when ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class loader_dialog:
"""rief dialog class showing buttons calling the appropriate loaders"""
def __init__(self, parent):
"""rief constructor \\param parent - gtk_view class instance"""
self._parent = parent
self.window = gtk.Dialog(flags=gtk.DIALOG_MODAL)
self.window.set_trans... | the_stack_v2_python_sparse | src/loader_dialog.py | s9gf4ult/track-deal | train | 1 |
3602e6f05c7258f8c3089c3e81ceee2ef033a08c | [
"super(ConvGRUNet, self).__init__(params=params, model_name=model_name, expand_dims=True)\ninput_shape = (None, None, None, None)\nself.conv_1 = tf.keras.layers.Conv2D(16, (7, 7), padding='same', input_shape=input_shape, activation='relu')\nself.max_pooling_1 = tf.keras.layers.MaxPool2D((3, 3), strides=(2, 1), padd... | <|body_start_0|>
super(ConvGRUNet, self).__init__(params=params, model_name=model_name, expand_dims=True)
input_shape = (None, None, None, None)
self.conv_1 = tf.keras.layers.Conv2D(16, (7, 7), padding='same', input_shape=input_shape, activation='relu')
self.max_pooling_1 = tf.keras.laye... | A 2-dimensional CNN model with an additional GRU layer before the fully connected one. | ConvGRUNet | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConvGRUNet:
"""A 2-dimensional CNN model with an additional GRU layer before the fully connected one."""
def __init__(self, params, model_name='ConvGRUNet'):
"""Initialises the model. Calls the initialise method of the super class. :param params: the global hyperparameters for initia... | stack_v2_sparse_classes_75kplus_train_069630 | 4,037 | permissive | [
{
"docstring": "Initialises the model. Calls the initialise method of the super class. :param params: the global hyperparameters for initialising the model. :param model_name: the name of the model.",
"name": "__init__",
"signature": "def __init__(self, params, model_name='ConvGRUNet')"
},
{
"do... | 3 | null | Implement the Python class `ConvGRUNet` described below.
Class description:
A 2-dimensional CNN model with an additional GRU layer before the fully connected one.
Method signatures and docstrings:
- def __init__(self, params, model_name='ConvGRUNet'): Initialises the model. Calls the initialise method of the super cl... | Implement the Python class `ConvGRUNet` described below.
Class description:
A 2-dimensional CNN model with an additional GRU layer before the fully connected one.
Method signatures and docstrings:
- def __init__(self, params, model_name='ConvGRUNet'): Initialises the model. Calls the initialise method of the super cl... | 9ca6d5588bf025ae6feb848412261c10ac012e1f | <|skeleton|>
class ConvGRUNet:
"""A 2-dimensional CNN model with an additional GRU layer before the fully connected one."""
def __init__(self, params, model_name='ConvGRUNet'):
"""Initialises the model. Calls the initialise method of the super class. :param params: the global hyperparameters for initia... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ConvGRUNet:
"""A 2-dimensional CNN model with an additional GRU layer before the fully connected one."""
def __init__(self, params, model_name='ConvGRUNet'):
"""Initialises the model. Calls the initialise method of the super class. :param params: the global hyperparameters for initialising the mo... | the_stack_v2_python_sparse | src/models_embedding/conv_gru_net.py | dhockaday/deep-embedded-music | train | 0 |
b106e8915426a6ccc66b8ed18831621a5a47a2eb | [
"self.qsys_infos = json.load(open('etc/clusters.json'))\nself.work_dir = work_dir\nif qsys_id not in self.qsys_infos:\n raise ValueError('Invalid queue system, must be one of %s' % repr(list(self.qsys_infos.keys())))\nself.qsys_id = qsys_id",
"qsys = self.qsys_infos[self.qsys_id]\nqsub = qsys['qsub_cmd']\nscri... | <|body_start_0|>
self.qsys_infos = json.load(open('etc/clusters.json'))
self.work_dir = work_dir
if qsys_id not in self.qsys_infos:
raise ValueError('Invalid queue system, must be one of %s' % repr(list(self.qsys_infos.keys())))
self.qsys_id = qsys_id
<|end_body_0|>
<|body_s... | Class that abstract jobs that must be submitted to a queue manager. | Submitter | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Submitter:
"""Class that abstract jobs that must be submitted to a queue manager."""
def __init__(self, work_dir, qsys_id):
"""Initialize with working directory and queue manager id. :param work_dir: where the job is to be run :param qsys_id: the id of the queue system/template to us... | stack_v2_sparse_classes_75kplus_train_069631 | 12,418 | permissive | [
{
"docstring": "Initialize with working directory and queue manager id. :param work_dir: where the job is to be run :param qsys_id: the id of the queue system/template to use (points to etc/clusters.json)",
"name": "__init__",
"signature": "def __init__(self, work_dir, qsys_id)"
},
{
"docstring"... | 2 | stack_v2_sparse_classes_30k_train_036231 | Implement the Python class `Submitter` described below.
Class description:
Class that abstract jobs that must be submitted to a queue manager.
Method signatures and docstrings:
- def __init__(self, work_dir, qsys_id): Initialize with working directory and queue manager id. :param work_dir: where the job is to be run ... | Implement the Python class `Submitter` described below.
Class description:
Class that abstract jobs that must be submitted to a queue manager.
Method signatures and docstrings:
- def __init__(self, work_dir, qsys_id): Initialize with working directory and queue manager id. :param work_dir: where the job is to be run ... | bda51547d3bac812181449df4b4cec487f9a2b3d | <|skeleton|>
class Submitter:
"""Class that abstract jobs that must be submitted to a queue manager."""
def __init__(self, work_dir, qsys_id):
"""Initialize with working directory and queue manager id. :param work_dir: where the job is to be run :param qsys_id: the id of the queue system/template to us... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Submitter:
"""Class that abstract jobs that must be submitted to a queue manager."""
def __init__(self, work_dir, qsys_id):
"""Initialize with working directory and queue manager id. :param work_dir: where the job is to be run :param qsys_id: the id of the queue system/template to use (points to ... | the_stack_v2_python_sparse | src/wrf/wrf_exec.py | openwfm/wrfxpy | train | 28 |
58b16c98bfc6e89d450693396de17af5b8ef63e6 | [
"Questionnaire.__init__(self, df)\nself.code_dic = beck_dep\nself.name = 'BDI'\nself.labels = ['Beck depression questionnaire']\nself.values = {'BDI': {}}",
"beck_df = pd.DataFrame(index=self.df.index, columns=self.df.columns)\nfor i in range(self.df.shape[0]):\n for j in range(self.df.shape[1]):\n beck... | <|body_start_0|>
Questionnaire.__init__(self, df)
self.code_dic = beck_dep
self.name = 'BDI'
self.labels = ['Beck depression questionnaire']
self.values = {'BDI': {}}
<|end_body_0|>
<|body_start_1|>
beck_df = pd.DataFrame(index=self.df.index, columns=self.df.columns)
... | A class used to represent an the Beck Depression Questionnaire Attributes ---------- df : DataFrame A Pandas data frame with the specific columns for the questionnaire Methods ------- grade() Calculates the grading of the questionnaire. In this case the same values as the input (hours) | BeckDepression | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BeckDepression:
"""A class used to represent an the Beck Depression Questionnaire Attributes ---------- df : DataFrame A Pandas data frame with the specific columns for the questionnaire Methods ------- grade() Calculates the grading of the questionnaire. In this case the same values as the input... | stack_v2_sparse_classes_75kplus_train_069632 | 7,730 | no_license | [
{
"docstring": "Init the following arguments: names = the new columns' names (after grading) labels = labels for the columns to be written in the SPSS output file values = explanation for the value for SPSS columns - empty for this questionaire code_dic = a dictionary from each sentence to a number Parameters -... | 2 | stack_v2_sparse_classes_30k_train_027277 | Implement the Python class `BeckDepression` described below.
Class description:
A class used to represent an the Beck Depression Questionnaire Attributes ---------- df : DataFrame A Pandas data frame with the specific columns for the questionnaire Methods ------- grade() Calculates the grading of the questionnaire. In... | Implement the Python class `BeckDepression` described below.
Class description:
A class used to represent an the Beck Depression Questionnaire Attributes ---------- df : DataFrame A Pandas data frame with the specific columns for the questionnaire Methods ------- grade() Calculates the grading of the questionnaire. In... | 26b8a2847d7202b61e67e2cd0074278a46a9f8f3 | <|skeleton|>
class BeckDepression:
"""A class used to represent an the Beck Depression Questionnaire Attributes ---------- df : DataFrame A Pandas data frame with the specific columns for the questionnaire Methods ------- grade() Calculates the grading of the questionnaire. In this case the same values as the input... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BeckDepression:
"""A class used to represent an the Beck Depression Questionnaire Attributes ---------- df : DataFrame A Pandas data frame with the specific columns for the questionnaire Methods ------- grade() Calculates the grading of the questionnaire. In this case the same values as the input (hours)"""
... | the_stack_v2_python_sparse | Questionnaires/BeckDepression.py | TechnionENIC/ENIC_scoring_program | train | 0 |
1b740044bf2f88a262d3a46f3d2d8fae1f7d38c2 | [
"conn, cursor = get_db_cursor()\nbuild = 'toy_build'\nexon_lens = lu.get_all_exon_lengths(cursor, build)\nassert exon_lens[1] == 100\nconn.close()",
"conn, cursor = get_db_cursor()\nbuild = 'toy_build'\nexon_lens = lu.get_all_exon_lengths(cursor, build)\nassert exon_lens[6] == 501\nconn.close()"
] | <|body_start_0|>
conn, cursor = get_db_cursor()
build = 'toy_build'
exon_lens = lu.get_all_exon_lengths(cursor, build)
assert exon_lens[1] == 100
conn.close()
<|end_body_0|>
<|body_start_1|>
conn, cursor = get_db_cursor()
build = 'toy_build'
exon_lens = l... | TestComputeExonLens | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestComputeExonLens:
def test_compute_exon_len_plus(self):
"""Plus strand example: chr1:1-100"""
<|body_0|>
def test_compute_exon_len_minus(self):
"""Minus strand example: chr1:2000-1500"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
conn, cursor =... | stack_v2_sparse_classes_75kplus_train_069633 | 715 | permissive | [
{
"docstring": "Plus strand example: chr1:1-100",
"name": "test_compute_exon_len_plus",
"signature": "def test_compute_exon_len_plus(self)"
},
{
"docstring": "Minus strand example: chr1:2000-1500",
"name": "test_compute_exon_len_minus",
"signature": "def test_compute_exon_len_minus(self)... | 2 | stack_v2_sparse_classes_30k_test_003039 | Implement the Python class `TestComputeExonLens` described below.
Class description:
Implement the TestComputeExonLens class.
Method signatures and docstrings:
- def test_compute_exon_len_plus(self): Plus strand example: chr1:1-100
- def test_compute_exon_len_minus(self): Minus strand example: chr1:2000-1500 | Implement the Python class `TestComputeExonLens` described below.
Class description:
Implement the TestComputeExonLens class.
Method signatures and docstrings:
- def test_compute_exon_len_plus(self): Plus strand example: chr1:1-100
- def test_compute_exon_len_minus(self): Minus strand example: chr1:2000-1500
<|skele... | 8014faed5f982e5e106ec05239e47d65878e76c3 | <|skeleton|>
class TestComputeExonLens:
def test_compute_exon_len_plus(self):
"""Plus strand example: chr1:1-100"""
<|body_0|>
def test_compute_exon_len_minus(self):
"""Minus strand example: chr1:2000-1500"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestComputeExonLens:
def test_compute_exon_len_plus(self):
"""Plus strand example: chr1:1-100"""
conn, cursor = get_db_cursor()
build = 'toy_build'
exon_lens = lu.get_all_exon_lengths(cursor, build)
assert exon_lens[1] == 100
conn.close()
def test_compute_e... | the_stack_v2_python_sparse | testing_suite/test_compute_exon_lengths.py | kopardev/TALON | train | 0 | |
37b28e64af619c0e5d98194caab3f15a16fa00e4 | [
"threading.Thread.__init__(self)\nself._parent = parent\nself._motnums = motnums\nself._positions = positions",
"self._parent.ic.DriveMultiMotor(self._motnums, self._positions)\nevt = DoneEvent(myEVT_DONE, -1, None)\nwx.PostEvent(self._parent, evt)"
] | <|body_start_0|>
threading.Thread.__init__(self)
self._parent = parent
self._motnums = motnums
self._positions = positions
<|end_body_0|>
<|body_start_1|>
self._parent.ic.DriveMultiMotor(self._motnums, self._positions)
evt = DoneEvent(myEVT_DONE, -1, None)
wx.Pos... | MoverThread | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MoverThread:
def __init__(self, parent, motnums, positions):
"""@param parent: The gui object that should recieve the value @param value: value to 'calculate' to"""
<|body_0|>
def run(self):
"""Overrides Thread.run. Don't call this directly its called internally when... | stack_v2_sparse_classes_75kplus_train_069634 | 7,803 | no_license | [
{
"docstring": "@param parent: The gui object that should recieve the value @param value: value to 'calculate' to",
"name": "__init__",
"signature": "def __init__(self, parent, motnums, positions)"
},
{
"docstring": "Overrides Thread.run. Don't call this directly its called internally when you c... | 2 | stack_v2_sparse_classes_30k_train_028740 | Implement the Python class `MoverThread` described below.
Class description:
Implement the MoverThread class.
Method signatures and docstrings:
- def __init__(self, parent, motnums, positions): @param parent: The gui object that should recieve the value @param value: value to 'calculate' to
- def run(self): Overrides... | Implement the Python class `MoverThread` described below.
Class description:
Implement the MoverThread class.
Method signatures and docstrings:
- def __init__(self, parent, motnums, positions): @param parent: The gui object that should recieve the value @param value: value to 'calculate' to
- def run(self): Overrides... | 29468ae4d8a4a9de5cac8988fd3620f806a71907 | <|skeleton|>
class MoverThread:
def __init__(self, parent, motnums, positions):
"""@param parent: The gui object that should recieve the value @param value: value to 'calculate' to"""
<|body_0|>
def run(self):
"""Overrides Thread.run. Don't call this directly its called internally when... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MoverThread:
def __init__(self, parent, motnums, positions):
"""@param parent: The gui object that should recieve the value @param value: value to 'calculate' to"""
threading.Thread.__init__(self)
self._parent = parent
self._motnums = motnums
self._positions = positions... | the_stack_v2_python_sparse | pyrecs/RapidScanCombinedGui.py | bmaranville/pyrecs | train | 0 | |
b29fc02bb1aac85072cd6cb47b0fb97734409404 | [
"super().__init__()\nself.attr_other_index = other_index\nself.attr_num_accepted = 0\nself.attr_name = self.__class__.__name__\nself.attr_global_name = 'balance'",
"if len(classification_label[classification_label > 0]) == 1 and np.argmax(classification_label) == self.attr_other_index:\n return True\nself.attr... | <|body_start_0|>
super().__init__()
self.attr_other_index = other_index
self.attr_num_accepted = 0
self.attr_name = self.__class__.__name__
self.attr_global_name = 'balance'
<|end_body_0|>
<|body_start_1|>
if len(classification_label[classification_label > 0]) == 1 and n... | BalanceClassesNoOther | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BalanceClassesNoOther:
def __init__(self, other_index):
"""Balance classes by excluding patches where there is only the other class Args: other_index: index of the class other"""
<|body_0|>
def filter(self, classification_label):
"""method called during training to k... | stack_v2_sparse_classes_75kplus_train_069635 | 1,496 | no_license | [
{
"docstring": "Balance classes by excluding patches where there is only the other class Args: other_index: index of the class other",
"name": "__init__",
"signature": "def __init__(self, other_index)"
},
{
"docstring": "method called during training to know if we have to filter this sample or n... | 2 | null | Implement the Python class `BalanceClassesNoOther` described below.
Class description:
Implement the BalanceClassesNoOther class.
Method signatures and docstrings:
- def __init__(self, other_index): Balance classes by excluding patches where there is only the other class Args: other_index: index of the class other
- ... | Implement the Python class `BalanceClassesNoOther` described below.
Class description:
Implement the BalanceClassesNoOther class.
Method signatures and docstrings:
- def __init__(self, other_index): Balance classes by excluding patches where there is only the other class Args: other_index: index of the class other
- ... | fa0ba3ccc4aa13fd03de79191d2d0de4c26107aa | <|skeleton|>
class BalanceClassesNoOther:
def __init__(self, other_index):
"""Balance classes by excluding patches where there is only the other class Args: other_index: index of the class other"""
<|body_0|>
def filter(self, classification_label):
"""method called during training to k... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BalanceClassesNoOther:
def __init__(self, other_index):
"""Balance classes by excluding patches where there is only the other class Args: other_index: index of the class other"""
super().__init__()
self.attr_other_index = other_index
self.attr_num_accepted = 0
self.attr... | the_stack_v2_python_sparse | main/src/data/balance_classes/BalanceClassesNoOther.py | Rob174/detection_nappe_hydrocarbures_IMT_cefrem | train | 0 | |
92ded508134e88b411bac6c1ce170937a24aa1ec | [
"self.kernel_type = kernel_type\nself.dim = dim\nself.lamb = lamb\nself.gamma = gamma\nif clf == 'knn':\n self.clf = KNeighborsClassifier(n_neighbors=1)\nelif clf == 'svm':\n self.clf = svm.SVC(C=1, gamma='auto', kernel='rbf', decision_function_shape='ovr')\nprint('kernel_type:[{}], dimension:[{}], classifier... | <|body_start_0|>
self.kernel_type = kernel_type
self.dim = dim
self.lamb = lamb
self.gamma = gamma
if clf == 'knn':
self.clf = KNeighborsClassifier(n_neighbors=1)
elif clf == 'svm':
self.clf = svm.SVC(C=1, gamma='auto', kernel='rbf', decision_funct... | TCA | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TCA:
def __init__(self, kernel_type='primal', dim=30, lamb=1, gamma=1, clf='knn'):
"""Init func :param kernel_type: kernel, values: 'primal' | 'linear' | 'rbf' :param dim: dimension after transfer :param lamb: lambda value in equation :param gamma: kernel bandwidth for rbf kernel"""
... | stack_v2_sparse_classes_75kplus_train_069636 | 10,474 | no_license | [
{
"docstring": "Init func :param kernel_type: kernel, values: 'primal' | 'linear' | 'rbf' :param dim: dimension after transfer :param lamb: lambda value in equation :param gamma: kernel bandwidth for rbf kernel",
"name": "__init__",
"signature": "def __init__(self, kernel_type='primal', dim=30, lamb=1, ... | 3 | stack_v2_sparse_classes_30k_train_047435 | Implement the Python class `TCA` described below.
Class description:
Implement the TCA class.
Method signatures and docstrings:
- def __init__(self, kernel_type='primal', dim=30, lamb=1, gamma=1, clf='knn'): Init func :param kernel_type: kernel, values: 'primal' | 'linear' | 'rbf' :param dim: dimension after transfer... | Implement the Python class `TCA` described below.
Class description:
Implement the TCA class.
Method signatures and docstrings:
- def __init__(self, kernel_type='primal', dim=30, lamb=1, gamma=1, clf='knn'): Init func :param kernel_type: kernel, values: 'primal' | 'linear' | 'rbf' :param dim: dimension after transfer... | ea0ff8204cd6649892704c90909eb08e8102fc11 | <|skeleton|>
class TCA:
def __init__(self, kernel_type='primal', dim=30, lamb=1, gamma=1, clf='knn'):
"""Init func :param kernel_type: kernel, values: 'primal' | 'linear' | 'rbf' :param dim: dimension after transfer :param lamb: lambda value in equation :param gamma: kernel bandwidth for rbf kernel"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TCA:
def __init__(self, kernel_type='primal', dim=30, lamb=1, gamma=1, clf='knn'):
"""Init func :param kernel_type: kernel, values: 'primal' | 'linear' | 'rbf' :param dim: dimension after transfer :param lamb: lambda value in equation :param gamma: kernel bandwidth for rbf kernel"""
self.kerne... | the_stack_v2_python_sparse | Comparison_model/venv/Include/TCA.py | yephm/DASMN | train | 0 | |
8134be26b083bea97f14a1f9d00d6aa12556a004 | [
"super().__init__(n_head, n_feat, dropout_rate)\nself.linear_pos = nn.Linear(n_feat, n_feat, bias=False)\nself.pos_bias_u = nn.Parameter(torch.Tensor(self.h, self.d_k))\nself.pos_bias_v = nn.Parameter(torch.Tensor(self.h, self.d_k))\ntorch.nn.init.xavier_uniform_(self.pos_bias_u)\ntorch.nn.init.xavier_uniform_(self... | <|body_start_0|>
super().__init__(n_head, n_feat, dropout_rate)
self.linear_pos = nn.Linear(n_feat, n_feat, bias=False)
self.pos_bias_u = nn.Parameter(torch.Tensor(self.h, self.d_k))
self.pos_bias_v = nn.Parameter(torch.Tensor(self.h, self.d_k))
torch.nn.init.xavier_uniform_(self... | Multi-Head Attention layer with relative position encoding. Paper: https://arxiv.org/abs/1901.02860 Args: n_head (int): The number of heads. n_feat (int): The number of features. dropout_rate (float): Dropout rate. | RelPositionMultiHeadedAttention | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RelPositionMultiHeadedAttention:
"""Multi-Head Attention layer with relative position encoding. Paper: https://arxiv.org/abs/1901.02860 Args: n_head (int): The number of heads. n_feat (int): The number of features. dropout_rate (float): Dropout rate."""
def __init__(self, n_head, n_feat, dro... | stack_v2_sparse_classes_75kplus_train_069637 | 37,737 | permissive | [
{
"docstring": "Construct an RelPositionMultiHeadedAttention object.",
"name": "__init__",
"signature": "def __init__(self, n_head, n_feat, dropout_rate)"
},
{
"docstring": "Compute relative positinal encoding. Args: x (torch.Tensor): Input tensor (batch, time, size). zero_triu (bool): If true, ... | 3 | stack_v2_sparse_classes_30k_train_012541 | Implement the Python class `RelPositionMultiHeadedAttention` described below.
Class description:
Multi-Head Attention layer with relative position encoding. Paper: https://arxiv.org/abs/1901.02860 Args: n_head (int): The number of heads. n_feat (int): The number of features. dropout_rate (float): Dropout rate.
Method... | Implement the Python class `RelPositionMultiHeadedAttention` described below.
Class description:
Multi-Head Attention layer with relative position encoding. Paper: https://arxiv.org/abs/1901.02860 Args: n_head (int): The number of heads. n_feat (int): The number of features. dropout_rate (float): Dropout rate.
Method... | 31d50b1ea1dea92f4182c5b2b6fe9fe4c981ae39 | <|skeleton|>
class RelPositionMultiHeadedAttention:
"""Multi-Head Attention layer with relative position encoding. Paper: https://arxiv.org/abs/1901.02860 Args: n_head (int): The number of heads. n_feat (int): The number of features. dropout_rate (float): Dropout rate."""
def __init__(self, n_head, n_feat, dro... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RelPositionMultiHeadedAttention:
"""Multi-Head Attention layer with relative position encoding. Paper: https://arxiv.org/abs/1901.02860 Args: n_head (int): The number of heads. n_feat (int): The number of features. dropout_rate (float): Dropout rate."""
def __init__(self, n_head, n_feat, dropout_rate):
... | the_stack_v2_python_sparse | SVS/model/layers/conformer_related.py | SJTMusicTeam/SVS_system | train | 85 |
5fe145a1aeb76b0077354b3aed1e60df037819ba | [
"actual_hashtags = tweets.extract_hashtags('this is a tweet!')\nexpected_hashtags = []\nself.assertEqual(actual_hashtags, expected_hashtags, 'empty list')",
"actual_hashtags = tweets.extract_hashtags('#Life #keep #hi-')\nexpected_hashtags = ['life', 'keep', 'hi']\nself.assertEqual(actual_hashtags, expected_hashta... | <|body_start_0|>
actual_hashtags = tweets.extract_hashtags('this is a tweet!')
expected_hashtags = []
self.assertEqual(actual_hashtags, expected_hashtags, 'empty list')
<|end_body_0|>
<|body_start_1|>
actual_hashtags = tweets.extract_hashtags('#Life #keep #hi-')
expected_hashtag... | TestExtractHashtags | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestExtractHashtags:
def test_no_hashtags(self):
"""Test extract_hashtags with a tweet with no hashtags."""
<|body_0|>
def test_unique_hashtags(self):
"""Test extract_hashtags with a tweet with unique hashtags."""
<|body_1|>
def test_repeated_hashtags(se... | stack_v2_sparse_classes_75kplus_train_069638 | 1,113 | permissive | [
{
"docstring": "Test extract_hashtags with a tweet with no hashtags.",
"name": "test_no_hashtags",
"signature": "def test_no_hashtags(self)"
},
{
"docstring": "Test extract_hashtags with a tweet with unique hashtags.",
"name": "test_unique_hashtags",
"signature": "def test_unique_hashtag... | 3 | null | Implement the Python class `TestExtractHashtags` described below.
Class description:
Implement the TestExtractHashtags class.
Method signatures and docstrings:
- def test_no_hashtags(self): Test extract_hashtags with a tweet with no hashtags.
- def test_unique_hashtags(self): Test extract_hashtags with a tweet with u... | Implement the Python class `TestExtractHashtags` described below.
Class description:
Implement the TestExtractHashtags class.
Method signatures and docstrings:
- def test_no_hashtags(self): Test extract_hashtags with a tweet with no hashtags.
- def test_unique_hashtags(self): Test extract_hashtags with a tweet with u... | 214525afeeb2da2409f451bf269e792c6940a1ba | <|skeleton|>
class TestExtractHashtags:
def test_no_hashtags(self):
"""Test extract_hashtags with a tweet with no hashtags."""
<|body_0|>
def test_unique_hashtags(self):
"""Test extract_hashtags with a tweet with unique hashtags."""
<|body_1|>
def test_repeated_hashtags(se... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestExtractHashtags:
def test_no_hashtags(self):
"""Test extract_hashtags with a tweet with no hashtags."""
actual_hashtags = tweets.extract_hashtags('this is a tweet!')
expected_hashtags = []
self.assertEqual(actual_hashtags, expected_hashtags, 'empty list')
def test_uniq... | the_stack_v2_python_sparse | Python/Tweet/test_extract_hashtags.py | LilyYC/legendary-train | train | 0 | |
47d16eeb748e349095bc5441d7639003bc621299 | [
"self.rows = height\nself.cols = width\nself.food = food\ninitial = self.Position(0, 0)\nself.snake = deque([initial])\nself.length = 0",
"curr = self.Position(self.snake[0].x, self.snake[0].y)\nif direction == 'U':\n curr.x -= 1\nif direction == 'D':\n curr.x += 1\nif direction == 'L':\n curr.y -= 1\nif... | <|body_start_0|>
self.rows = height
self.cols = width
self.food = food
initial = self.Position(0, 0)
self.snake = deque([initial])
self.length = 0
<|end_body_0|>
<|body_start_1|>
curr = self.Position(self.snake[0].x, self.snake[0].y)
if direction == 'U':
... | SnakeGame | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SnakeGame:
def __init__(self, width, height, food):
"""Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :typ... | stack_v2_sparse_classes_75kplus_train_069639 | 2,301 | no_license | [
{
"docstring": "Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :type width: int :type height: int :type food: List[List[int]]",
... | 2 | stack_v2_sparse_classes_30k_train_015401 | Implement the Python class `SnakeGame` described below.
Class description:
Implement the SnakeGame class.
Method signatures and docstrings:
- def __init__(self, width, height, food): Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E... | Implement the Python class `SnakeGame` described below.
Class description:
Implement the SnakeGame class.
Method signatures and docstrings:
- def __init__(self, width, height, food): Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E... | e42ec45d98f990d446bbf4f1a568b70855af5380 | <|skeleton|>
class SnakeGame:
def __init__(self, width, height, food):
"""Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :typ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SnakeGame:
def __init__(self, width, height, food):
"""Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :type width: int :... | the_stack_v2_python_sparse | designSnakeGame.py | LYoung-Hub/Algorithm-Data-Structure | train | 0 | |
835c11110426b0d72f953c8c02ff52299585588e | [
"print('BookCopyChecker.create_copy()')\nif BookDao.contains(book_id):\n return BookCopyDao.create(book_id)\nelse:\n abort(404, 'Resource not found: book_id')",
"if BookCopyDao.contains(book_copy_id):\n return BookCopyDao.get_book_copy(book_copy_id)\nelse:\n abort(404, 'Resource not found: book_copy_i... | <|body_start_0|>
print('BookCopyChecker.create_copy()')
if BookDao.contains(book_id):
return BookCopyDao.create(book_id)
else:
abort(404, 'Resource not found: book_id')
<|end_body_0|>
<|body_start_1|>
if BookCopyDao.contains(book_copy_id):
return Book... | BookCopyChecker | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BookCopyChecker:
def create_copy(book_id):
"""Method to create a new copy for a book. :param book_id: Book record to create a copy for. :return: Dictionary of created Copy."""
<|body_0|>
def get_copy(book_copy_id):
"""Method to get a copy of a book by copy id. :param... | stack_v2_sparse_classes_75kplus_train_069640 | 1,361 | no_license | [
{
"docstring": "Method to create a new copy for a book. :param book_id: Book record to create a copy for. :return: Dictionary of created Copy.",
"name": "create_copy",
"signature": "def create_copy(book_id)"
},
{
"docstring": "Method to get a copy of a book by copy id. :param book_copy_id: Integ... | 3 | stack_v2_sparse_classes_30k_train_025153 | Implement the Python class `BookCopyChecker` described below.
Class description:
Implement the BookCopyChecker class.
Method signatures and docstrings:
- def create_copy(book_id): Method to create a new copy for a book. :param book_id: Book record to create a copy for. :return: Dictionary of created Copy.
- def get_c... | Implement the Python class `BookCopyChecker` described below.
Class description:
Implement the BookCopyChecker class.
Method signatures and docstrings:
- def create_copy(book_id): Method to create a new copy for a book. :param book_id: Book record to create a copy for. :return: Dictionary of created Copy.
- def get_c... | 4c3fdf41a43a56c253faecacac5f9d977d9c99be | <|skeleton|>
class BookCopyChecker:
def create_copy(book_id):
"""Method to create a new copy for a book. :param book_id: Book record to create a copy for. :return: Dictionary of created Copy."""
<|body_0|>
def get_copy(book_copy_id):
"""Method to get a copy of a book by copy id. :param... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BookCopyChecker:
def create_copy(book_id):
"""Method to create a new copy for a book. :param book_id: Book record to create a copy for. :return: Dictionary of created Copy."""
print('BookCopyChecker.create_copy()')
if BookDao.contains(book_id):
return BookCopyDao.create(boo... | the_stack_v2_python_sparse | controller/book_copy_checker.py | neu-seattle-cs5500-fall18/book-library-web-service-scrumptious | train | 0 | |
dd0a49f6b734d7192259104b8762d21bd99d292f | [
"self.name = name\nself.parameters = OrderedDict([('density', '_D'), ('vzero', '_V'), ('dr', '_R'), ('N', '_N'), ('init_frame', '_I')])\nself.extension = '.eps'\nif 'ext_parameters' in kwargs:\n self.parameters = self.add_ext(kwargs['ext_parameters'], self.extension).parameters\nif 'BOX_SIZE' in envvar:\n sel... | <|body_start_0|>
self.name = name
self.parameters = OrderedDict([('density', '_D'), ('vzero', '_V'), ('dr', '_R'), ('N', '_N'), ('init_frame', '_I')])
self.extension = '.eps'
if 'ext_parameters' in kwargs:
self.parameters = self.add_ext(kwargs['ext_parameters'], self.extensio... | Naming system image files. | _FrameFile | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _FrameFile:
"""Naming system image files."""
def __init__(self, name, **kwargs):
"""Architecture of file name. Parameters ---------- name : string Generic name of image file. Optional keyword arguments -------------------------- ext_parameters : ordered dictionary Hash table of addit... | stack_v2_sparse_classes_75kplus_train_069641 | 23,503 | permissive | [
{
"docstring": "Architecture of file name. Parameters ---------- name : string Generic name of image file. Optional keyword arguments -------------------------- ext_parameters : ordered dictionary Hash table of additional parameters and their abbreviations.",
"name": "__init__",
"signature": "def __init... | 2 | stack_v2_sparse_classes_30k_train_030885 | Implement the Python class `_FrameFile` described below.
Class description:
Naming system image files.
Method signatures and docstrings:
- def __init__(self, name, **kwargs): Architecture of file name. Parameters ---------- name : string Generic name of image file. Optional keyword arguments -------------------------... | Implement the Python class `_FrameFile` described below.
Class description:
Naming system image files.
Method signatures and docstrings:
- def __init__(self, name, **kwargs): Architecture of file name. Parameters ---------- name : string Generic name of image file. Optional keyword arguments -------------------------... | b065544639a483dda48cda89bcbb11c1772232aa | <|skeleton|>
class _FrameFile:
"""Naming system image files."""
def __init__(self, name, **kwargs):
"""Architecture of file name. Parameters ---------- name : string Generic name of image file. Optional keyword arguments -------------------------- ext_parameters : ordered dictionary Hash table of addit... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class _FrameFile:
"""Naming system image files."""
def __init__(self, name, **kwargs):
"""Architecture of file name. Parameters ---------- name : string Generic name of image file. Optional keyword arguments -------------------------- ext_parameters : ordered dictionary Hash table of additional paramet... | the_stack_v2_python_sparse | naming.py | interesting-codes/active_particles | train | 0 |
bc8a215543521ef3ef199f05a63b6e51d4ddb9c0 | [
"res = set()\n\ndef isSquare(n):\n k = int(n ** 0.5)\n return k * k == n\n\ndef dfs(seq, current):\n if not seq:\n res.add(tuple(current))\n return\n for i, v in enumerate(seq):\n if i - 1 >= 0 and v == seq[i - 1]:\n continue\n if not current or isSquare(current[-1... | <|body_start_0|>
res = set()
def isSquare(n):
k = int(n ** 0.5)
return k * k == n
def dfs(seq, current):
if not seq:
res.add(tuple(current))
return
for i, v in enumerate(seq):
if i - 1 >= 0 and v ==... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def numSquarefulPerms(self, A):
""":type A: List[int] :rtype: int"""
<|body_0|>
def numSquarefulPermsFast(self, A):
""":type A: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
res = set()
def isSquare(n):
... | stack_v2_sparse_classes_75kplus_train_069642 | 1,947 | no_license | [
{
"docstring": ":type A: List[int] :rtype: int",
"name": "numSquarefulPerms",
"signature": "def numSquarefulPerms(self, A)"
},
{
"docstring": ":type A: List[int] :rtype: int",
"name": "numSquarefulPermsFast",
"signature": "def numSquarefulPermsFast(self, A)"
}
] | 2 | stack_v2_sparse_classes_30k_train_000599 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numSquarefulPerms(self, A): :type A: List[int] :rtype: int
- def numSquarefulPermsFast(self, A): :type A: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numSquarefulPerms(self, A): :type A: List[int] :rtype: int
- def numSquarefulPermsFast(self, A): :type A: List[int] :rtype: int
<|skeleton|>
class Solution:
def numSqua... | 810575368ecffa97677bdb51744d1f716140bbb1 | <|skeleton|>
class Solution:
def numSquarefulPerms(self, A):
""":type A: List[int] :rtype: int"""
<|body_0|>
def numSquarefulPermsFast(self, A):
""":type A: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def numSquarefulPerms(self, A):
""":type A: List[int] :rtype: int"""
res = set()
def isSquare(n):
k = int(n ** 0.5)
return k * k == n
def dfs(seq, current):
if not seq:
res.add(tuple(current))
retur... | the_stack_v2_python_sparse | N/NumberofSquarefulArrays.py | bssrdf/pyleet | train | 2 | |
dbe2546e676a3005a2118ced54cf7487f5bb8fd7 | [
"dd_s = {}\ndd_t = {}\nfor i in range(len(s)):\n if s[i] not in dd_s and t[i] not in dd_t:\n dd_s[s[i]] = t[i]\n dd_t[t[i]] = s[i]\n elif s[i] in dd_s:\n if dd_s[s[i]] != t[i]:\n return False\n elif t[i] in dd_t:\n if dd_t[t[i]] != s[i]:\n return False\nret... | <|body_start_0|>
dd_s = {}
dd_t = {}
for i in range(len(s)):
if s[i] not in dd_s and t[i] not in dd_t:
dd_s[s[i]] = t[i]
dd_t[t[i]] = s[i]
elif s[i] in dd_s:
if dd_s[s[i]] != t[i]:
return False
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isIsomorphic(self, s, t):
""":type s: str :type t: str :rtype: bool"""
<|body_0|>
def isIsomorphic1(self, s, t):
""":type s: str :type t: str :rtype: bool"""
<|body_1|>
def isIsomorphic2(self, s, t):
""":type s: str :type t: str :rt... | stack_v2_sparse_classes_75kplus_train_069643 | 1,972 | no_license | [
{
"docstring": ":type s: str :type t: str :rtype: bool",
"name": "isIsomorphic",
"signature": "def isIsomorphic(self, s, t)"
},
{
"docstring": ":type s: str :type t: str :rtype: bool",
"name": "isIsomorphic1",
"signature": "def isIsomorphic1(self, s, t)"
},
{
"docstring": ":type ... | 3 | stack_v2_sparse_classes_30k_val_000127 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isIsomorphic(self, s, t): :type s: str :type t: str :rtype: bool
- def isIsomorphic1(self, s, t): :type s: str :type t: str :rtype: bool
- def isIsomorphic2(self, s, t): :typ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isIsomorphic(self, s, t): :type s: str :type t: str :rtype: bool
- def isIsomorphic1(self, s, t): :type s: str :type t: str :rtype: bool
- def isIsomorphic2(self, s, t): :typ... | c55b0cfd2967a2221c27ed738e8de15034775945 | <|skeleton|>
class Solution:
def isIsomorphic(self, s, t):
""":type s: str :type t: str :rtype: bool"""
<|body_0|>
def isIsomorphic1(self, s, t):
""":type s: str :type t: str :rtype: bool"""
<|body_1|>
def isIsomorphic2(self, s, t):
""":type s: str :type t: str :rt... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def isIsomorphic(self, s, t):
""":type s: str :type t: str :rtype: bool"""
dd_s = {}
dd_t = {}
for i in range(len(s)):
if s[i] not in dd_s and t[i] not in dd_t:
dd_s[s[i]] = t[i]
dd_t[t[i]] = s[i]
elif s[i] in dd... | the_stack_v2_python_sparse | PycharmProjects/leetcode/Find/isomorphicStrings205.py | crystal30/DataStructure | train | 0 | |
3917395df17d219e2444abb475fe5293b8a3a7f7 | [
"if not root:\n return '[]'\nqueue = collections.deque()\nqueue.append(root)\nres = []\nwhile queue:\n node = queue.popleft()\n if node:\n res.append(str(node.val))\n queue.append(node.left)\n queue.append(node.right)\n else:\n res.append('null')\nreturn '[' + ','.join(res) +... | <|body_start_0|>
if not root:
return '[]'
queue = collections.deque()
queue.append(root)
res = []
while queue:
node = queue.popleft()
if node:
res.append(str(node.val))
queue.append(node.left)
que... | 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_069644 | 2,208 | 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_045593 | 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:... | b365ba85036e51f7a9e018767914ef22314a6780 | <|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 = collections.deque()
queue.append(root)
res = []
while queue:
node = queue.popleft()
i... | the_stack_v2_python_sparse | 剑指offer/剑指 Offer 37. 序列化二叉树.py | f1amingo/leetcode-python | train | 1 | |
e57919dfc5ba9a24158dcfc01602dc1ae27fb439 | [
"self.name = 'firefox'\nself.firefox_path = os.path.expanduser('~') + '\\\\AppData\\\\Roaming\\\\Mozilla\\\\Firefox\\\\Profiles\\\\'\nif not ut.file_exists(self.firefox_path):\n self.is_valid = False\nelse:\n self.is_valid = True\nif self.is_valid:\n self.info_bank = {}",
"info = firefox_bookmarks.bookma... | <|body_start_0|>
self.name = 'firefox'
self.firefox_path = os.path.expanduser('~') + '\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\'
if not ut.file_exists(self.firefox_path):
self.is_valid = False
else:
self.is_valid = True
if self.is_valid:
... | FireFoxEngine | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FireFoxEngine:
def __init__(self):
"""This is the init function that comes up when the object is created. Its defining if its possible to to extract data from firefox."""
<|body_0|>
def get_bookmarks(self):
"""Calling a function to receive the firefox bookmarks. Writ... | stack_v2_sparse_classes_75kplus_train_069645 | 2,610 | no_license | [
{
"docstring": "This is the init function that comes up when the object is created. Its defining if its possible to to extract data from firefox.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Calling a function to receive the firefox bookmarks. Writing to a file if e... | 5 | stack_v2_sparse_classes_30k_train_039478 | Implement the Python class `FireFoxEngine` described below.
Class description:
Implement the FireFoxEngine class.
Method signatures and docstrings:
- def __init__(self): This is the init function that comes up when the object is created. Its defining if its possible to to extract data from firefox.
- def get_bookmark... | Implement the Python class `FireFoxEngine` described below.
Class description:
Implement the FireFoxEngine class.
Method signatures and docstrings:
- def __init__(self): This is the init function that comes up when the object is created. Its defining if its possible to to extract data from firefox.
- def get_bookmark... | d4bed0246709f89e652eeaa43a2b43faaae6eab7 | <|skeleton|>
class FireFoxEngine:
def __init__(self):
"""This is the init function that comes up when the object is created. Its defining if its possible to to extract data from firefox."""
<|body_0|>
def get_bookmarks(self):
"""Calling a function to receive the firefox bookmarks. Writ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FireFoxEngine:
def __init__(self):
"""This is the init function that comes up when the object is created. Its defining if its possible to to extract data from firefox."""
self.name = 'firefox'
self.firefox_path = os.path.expanduser('~') + '\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles... | the_stack_v2_python_sparse | Firefox/FireFoxEngine.py | toko214/logsProject | train | 1 | |
23858010535979d3d6fe95149b47d6f16827f100 | [
"if not head:\n return None\nslow = head\nfast = head.next\nwhile fast:\n if fast.val == slow.val:\n p = fast\n fast = fast.next\n slow.next = fast\n del p\n else:\n fast = fast.next\n slow = slow.next\nreturn head",
"if not head or not head.next:\n return hea... | <|body_start_0|>
if not head:
return None
slow = head
fast = head.next
while fast:
if fast.val == slow.val:
p = fast
fast = fast.next
slow.next = fast
del p
else:
fast = fa... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def deleteDuplicates1(self, head):
""":type head: ListNode :rtype: ListNode"""
<|body_0|>
def deleteDuplicates2(self, head):
""":type head: ListNode :rtype: ListNode"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not head:
... | stack_v2_sparse_classes_75kplus_train_069646 | 1,621 | no_license | [
{
"docstring": ":type head: ListNode :rtype: ListNode",
"name": "deleteDuplicates1",
"signature": "def deleteDuplicates1(self, head)"
},
{
"docstring": ":type head: ListNode :rtype: ListNode",
"name": "deleteDuplicates2",
"signature": "def deleteDuplicates2(self, head)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def deleteDuplicates1(self, head): :type head: ListNode :rtype: ListNode
- def deleteDuplicates2(self, head): :type head: ListNode :rtype: ListNode | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def deleteDuplicates1(self, head): :type head: ListNode :rtype: ListNode
- def deleteDuplicates2(self, head): :type head: ListNode :rtype: ListNode
<|skeleton|>
class Solution:
... | 8dfbb10a87d8a3fdde466ab16fff8b67503e41f4 | <|skeleton|>
class Solution:
def deleteDuplicates1(self, head):
""":type head: ListNode :rtype: ListNode"""
<|body_0|>
def deleteDuplicates2(self, head):
""":type head: ListNode :rtype: ListNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def deleteDuplicates1(self, head):
""":type head: ListNode :rtype: ListNode"""
if not head:
return None
slow = head
fast = head.next
while fast:
if fast.val == slow.val:
p = fast
fast = fast.next
... | the_stack_v2_python_sparse | easy/0083.remove-duplicates-from-sorted-list.py | codershenghai/PyLeetcode | train | 0 | |
273fd515a2ad0acacc9ac3f66a695636ff50e555 | [
"SysPolicy.__init__(self)\ncheck_for_gpu(cuda_device)\nif not os.path.isfile(archive_file):\n if not model_file:\n raise Exception('No model for MILU is specified!')\n archive_file = cached_path(model_file)\narchive = load_archive(archive_file, cuda_device=cuda_device)\ndataset_reader_params = archive.... | <|body_start_0|>
SysPolicy.__init__(self)
check_for_gpu(cuda_device)
if not os.path.isfile(archive_file):
if not model_file:
raise Exception('No model for MILU is specified!')
archive_file = cached_path(model_file)
archive = load_archive(archive_fi... | Vanilla MLE trained policy. | VanillaMLEPolicy | [
"MIT",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VanillaMLEPolicy:
"""Vanilla MLE trained policy."""
def __init__(self, archive_file=DEFAULT_ARCHIVE_FILE, cuda_device=DEFAULT_CUDA_DEVICE, model_file=None):
"""Constructor for NLU class."""
<|body_0|>
def predict(self, state):
"""Predict the dialog act of a natur... | stack_v2_sparse_classes_75kplus_train_069647 | 2,639 | permissive | [
{
"docstring": "Constructor for NLU class.",
"name": "__init__",
"signature": "def __init__(self, archive_file=DEFAULT_ARCHIVE_FILE, cuda_device=DEFAULT_CUDA_DEVICE, model_file=None)"
},
{
"docstring": "Predict the dialog act of a natural language utterance and apply error model. Args: utterance... | 2 | null | Implement the Python class `VanillaMLEPolicy` described below.
Class description:
Vanilla MLE trained policy.
Method signatures and docstrings:
- def __init__(self, archive_file=DEFAULT_ARCHIVE_FILE, cuda_device=DEFAULT_CUDA_DEVICE, model_file=None): Constructor for NLU class.
- def predict(self, state): Predict the ... | Implement the Python class `VanillaMLEPolicy` described below.
Class description:
Vanilla MLE trained policy.
Method signatures and docstrings:
- def __init__(self, archive_file=DEFAULT_ARCHIVE_FILE, cuda_device=DEFAULT_CUDA_DEVICE, model_file=None): Constructor for NLU class.
- def predict(self, state): Predict the ... | 3bbae1c53d6ba8aa699364a36ec534f6bdf8ef55 | <|skeleton|>
class VanillaMLEPolicy:
"""Vanilla MLE trained policy."""
def __init__(self, archive_file=DEFAULT_ARCHIVE_FILE, cuda_device=DEFAULT_CUDA_DEVICE, model_file=None):
"""Constructor for NLU class."""
<|body_0|>
def predict(self, state):
"""Predict the dialog act of a natur... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class VanillaMLEPolicy:
"""Vanilla MLE trained policy."""
def __init__(self, archive_file=DEFAULT_ARCHIVE_FILE, cuda_device=DEFAULT_CUDA_DEVICE, model_file=None):
"""Constructor for NLU class."""
SysPolicy.__init__(self)
check_for_gpu(cuda_device)
if not os.path.isfile(archive_f... | the_stack_v2_python_sparse | ConvLab/convlab/modules/policy/system/multiwoz/vanilla_mle/policy.py | KAIST-AILab/NeuralPipeline_DSTC8 | train | 38 |
c8c69eeb76a952a5d513aaf6b8cabbfe5803e075 | [
"QUiLoader.__init__(self, baseinstance)\nself.baseinstance = baseinstance\nif customWidgets is None:\n self.customWidgets = {}\nelse:\n self.customWidgets = customWidgets",
"if parent is None and self.baseinstance:\n return self.baseinstance\nelse:\n if class_name in self.availableWidgets() or class_n... | <|body_start_0|>
QUiLoader.__init__(self, baseinstance)
self.baseinstance = baseinstance
if customWidgets is None:
self.customWidgets = {}
else:
self.customWidgets = customWidgets
<|end_body_0|>
<|body_start_1|>
if parent is None and self.baseinstance:
... | Subclass of :class:`~PySide.QtUiTools.QUiLoader` to create the user interface in a base instance. Unlike :class:`~PySide.QtUiTools.QUiLoader` itself this class does not create a new instance of the top-level widget, but creates the user interface in an existing instance of the top-level class if needed. This mimics the... | UiLoader | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UiLoader:
"""Subclass of :class:`~PySide.QtUiTools.QUiLoader` to create the user interface in a base instance. Unlike :class:`~PySide.QtUiTools.QUiLoader` itself this class does not create a new instance of the top-level widget, but creates the user interface in an existing instance of the top-le... | stack_v2_sparse_classes_75kplus_train_069648 | 11,582 | permissive | [
{
"docstring": "Create a loader for the given ``baseinstance``. The user interface is created in ``baseinstance``, which must be an instance of the top-level class in the user interface to load, or a subclass thereof. ``customWidgets`` is a dictionary mapping from class name to class object for custom widgets. ... | 2 | stack_v2_sparse_classes_30k_train_023593 | Implement the Python class `UiLoader` described below.
Class description:
Subclass of :class:`~PySide.QtUiTools.QUiLoader` to create the user interface in a base instance. Unlike :class:`~PySide.QtUiTools.QUiLoader` itself this class does not create a new instance of the top-level widget, but creates the user interfac... | Implement the Python class `UiLoader` described below.
Class description:
Subclass of :class:`~PySide.QtUiTools.QUiLoader` to create the user interface in a base instance. Unlike :class:`~PySide.QtUiTools.QUiLoader` itself this class does not create a new instance of the top-level widget, but creates the user interfac... | 323c6fef4100220a84daf964ed0b78058862bc29 | <|skeleton|>
class UiLoader:
"""Subclass of :class:`~PySide.QtUiTools.QUiLoader` to create the user interface in a base instance. Unlike :class:`~PySide.QtUiTools.QUiLoader` itself this class does not create a new instance of the top-level widget, but creates the user interface in an existing instance of the top-le... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UiLoader:
"""Subclass of :class:`~PySide.QtUiTools.QUiLoader` to create the user interface in a base instance. Unlike :class:`~PySide.QtUiTools.QUiLoader` itself this class does not create a new instance of the top-level widget, but creates the user interface in an existing instance of the top-level class if ... | the_stack_v2_python_sparse | winpython/_vendor/qtpy/uic.py | winpython/winpython | train | 1,796 |
4cfe5c4b03850fac545fa0387224e0ca0f480d2f | [
"products = response.css('.itdetail01')\nfor _, product in enumerate(products):\n product = products[_]\n price = product.xpath(f\".//input[contains(@name, 'price[{_ + 1}]')]/@value\").get()\n if float(price) > 0.0:\n yield {'VENDORID': 25, 'VENDOR': 'PLATES AND BEYOND', 'ITEMNO': product.xpath(f\".... | <|body_start_0|>
products = response.css('.itdetail01')
for _, product in enumerate(products):
product = products[_]
price = product.xpath(f".//input[contains(@name, 'price[{_ + 1}]')]/@value").get()
if float(price) > 0.0:
yield {'VENDORID': 25, 'VENDO... | platesandbeyondSpider | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class platesandbeyondSpider:
def parse_category(self, response, category):
"""Grabbing items from a category page. @cb_kwargs {"category": "Health and Beauty"} @url http://platesandbeyond.com/ais101/itemdisp.php?action=Menu&dept=HEALT @returns items 3 @partial { "VENDORID": 25, "VENDOR": "PLAT... | stack_v2_sparse_classes_75kplus_train_069649 | 3,300 | no_license | [
{
"docstring": "Grabbing items from a category page. @cb_kwargs {\"category\": \"Health and Beauty\"} @url http://platesandbeyond.com/ais101/itemdisp.php?action=Menu&dept=HEALT @returns items 3 @partial { \"VENDORID\": 25, \"VENDOR\": \"PLATES AND BEYOND\", \"ITEMNO\": \"10298-12\", \"CATEGORY\": \"Health and B... | 2 | stack_v2_sparse_classes_30k_train_004931 | Implement the Python class `platesandbeyondSpider` described below.
Class description:
Implement the platesandbeyondSpider class.
Method signatures and docstrings:
- def parse_category(self, response, category): Grabbing items from a category page. @cb_kwargs {"category": "Health and Beauty"} @url http://platesandbey... | Implement the Python class `platesandbeyondSpider` described below.
Class description:
Implement the platesandbeyondSpider class.
Method signatures and docstrings:
- def parse_category(self, response, category): Grabbing items from a category page. @cb_kwargs {"category": "Health and Beauty"} @url http://platesandbey... | 025babe4a03553d720806828f89929c6e773d683 | <|skeleton|>
class platesandbeyondSpider:
def parse_category(self, response, category):
"""Grabbing items from a category page. @cb_kwargs {"category": "Health and Beauty"} @url http://platesandbeyond.com/ais101/itemdisp.php?action=Menu&dept=HEALT @returns items 3 @partial { "VENDORID": 25, "VENDOR": "PLAT... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class platesandbeyondSpider:
def parse_category(self, response, category):
"""Grabbing items from a category page. @cb_kwargs {"category": "Health and Beauty"} @url http://platesandbeyond.com/ais101/itemdisp.php?action=Menu&dept=HEALT @returns items 3 @partial { "VENDORID": 25, "VENDOR": "PLATES AND BEYOND"... | the_stack_v2_python_sparse | data_scraping/gmd/spiders/platesandbeyond.py | panky2202/scrapy-dev | train | 1 | |
40ec335f69e287cadb29b36456a3ca93df9851cd | [
"try:\n movie = mq.get_movie_by_id(movie_id=id)\nexcept NoResultFound as e:\n return ({'status': 'error', 'message': 'movie with ID {0} was not found'.format(id)}, 404)\nreturn jsonify(movie)",
"try:\n mq.delete_movie_by_id(movie_id=id)\nexcept NoResultFound:\n return ({'status': 'error', 'message': '... | <|body_start_0|>
try:
movie = mq.get_movie_by_id(movie_id=id)
except NoResultFound as e:
return ({'status': 'error', 'message': 'movie with ID {0} was not found'.format(id)}, 404)
return jsonify(movie)
<|end_body_0|>
<|body_start_1|>
try:
mq.delete_mo... | MovieQueueManageAPI | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MovieQueueManageAPI:
def get(self, id, session=None):
"""Returns a movie from queue by ID"""
<|body_0|>
def delete(self, id, session=None):
"""Delete movies from movie queue"""
<|body_1|>
def put(self, id, session=None):
"""Updates movie quality ... | stack_v2_sparse_classes_75kplus_train_069650 | 9,040 | permissive | [
{
"docstring": "Returns a movie from queue by ID",
"name": "get",
"signature": "def get(self, id, session=None)"
},
{
"docstring": "Delete movies from movie queue",
"name": "delete",
"signature": "def delete(self, id, session=None)"
},
{
"docstring": "Updates movie quality or dow... | 3 | stack_v2_sparse_classes_30k_train_022878 | Implement the Python class `MovieQueueManageAPI` described below.
Class description:
Implement the MovieQueueManageAPI class.
Method signatures and docstrings:
- def get(self, id, session=None): Returns a movie from queue by ID
- def delete(self, id, session=None): Delete movies from movie queue
- def put(self, id, s... | Implement the Python class `MovieQueueManageAPI` described below.
Class description:
Implement the MovieQueueManageAPI class.
Method signatures and docstrings:
- def get(self, id, session=None): Returns a movie from queue by ID
- def delete(self, id, session=None): Delete movies from movie queue
- def put(self, id, s... | 900bd353a70c5a41176eb505af68ed3fc65a796d | <|skeleton|>
class MovieQueueManageAPI:
def get(self, id, session=None):
"""Returns a movie from queue by ID"""
<|body_0|>
def delete(self, id, session=None):
"""Delete movies from movie queue"""
<|body_1|>
def put(self, id, session=None):
"""Updates movie quality ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MovieQueueManageAPI:
def get(self, id, session=None):
"""Returns a movie from queue by ID"""
try:
movie = mq.get_movie_by_id(movie_id=id)
except NoResultFound as e:
return ({'status': 'error', 'message': 'movie with ID {0} was not found'.format(id)}, 404)
... | the_stack_v2_python_sparse | flexget/plugins/api/movie_queue.py | ashumkin/Flexget | train | 1 | |
e5d918d68c629cf44b8cf97dad3accfb61d37aed | [
"Environment_Base.__init__(self)\nself.num_grid = num_grid\nself.num_actions = num_actions\nself.done = False\nself.reward = None\nself.terminate_state = [(0, 0), (num_grid - 1, num_grid - 1)]",
"if num >= self.num_grid:\n return self.num_grid - 1\nelif num < 0:\n return 0\nelse:\n return num",
"old_pl... | <|body_start_0|>
Environment_Base.__init__(self)
self.num_grid = num_grid
self.num_actions = num_actions
self.done = False
self.reward = None
self.terminate_state = [(0, 0), (num_grid - 1, num_grid - 1)]
<|end_body_0|>
<|body_start_1|>
if num >= self.num_grid:
... | Rewrite the Env_base and realize the file of grid_world | Grid_World | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Grid_World:
"""Rewrite the Env_base and realize the file of grid_world"""
def __init__(self, num_grid, num_actions):
"""for init the env arg: num_grid: the num of the grids num_action: the num of the action"""
<|body_0|>
def range_check(self, num):
"""this func f... | stack_v2_sparse_classes_75kplus_train_069651 | 2,003 | no_license | [
{
"docstring": "for init the env arg: num_grid: the num of the grids num_action: the num of the action",
"name": "__init__",
"signature": "def __init__(self, num_grid, num_actions)"
},
{
"docstring": "this func for number check return the right number arg: num: the num should be checked",
"n... | 3 | null | Implement the Python class `Grid_World` described below.
Class description:
Rewrite the Env_base and realize the file of grid_world
Method signatures and docstrings:
- def __init__(self, num_grid, num_actions): for init the env arg: num_grid: the num of the grids num_action: the num of the action
- def range_check(se... | Implement the Python class `Grid_World` described below.
Class description:
Rewrite the Env_base and realize the file of grid_world
Method signatures and docstrings:
- def __init__(self, num_grid, num_actions): for init the env arg: num_grid: the num of the grids num_action: the num of the action
- def range_check(se... | 180cc4d6370953e52b02822e7f7b54030ba656fa | <|skeleton|>
class Grid_World:
"""Rewrite the Env_base and realize the file of grid_world"""
def __init__(self, num_grid, num_actions):
"""for init the env arg: num_grid: the num of the grids num_action: the num of the action"""
<|body_0|>
def range_check(self, num):
"""this func f... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Grid_World:
"""Rewrite the Env_base and realize the file of grid_world"""
def __init__(self, num_grid, num_actions):
"""for init the env arg: num_grid: the num of the grids num_action: the num of the action"""
Environment_Base.__init__(self)
self.num_grid = num_grid
self.n... | the_stack_v2_python_sparse | gridworld/grid_world.py | DKuan/Reinforcement_Learning2018 | train | 0 |
2b5ae912190d192c9800f906ef4ce1e338138b5b | [
"if value is self.field.missing_value:\n return []\nterms = self.widget.updateTerms()\ntry:\n return [terms.getTerm(value).token]\nexcept LookupError:\n return []",
"widget = self.widget\nif not len(value) or value[0] == widget.noValueToken:\n return self.field.missing_value\nwidget.updateTerms()\nret... | <|body_start_0|>
if value is self.field.missing_value:
return []
terms = self.widget.updateTerms()
try:
return [terms.getTerm(value).token]
except LookupError:
return []
<|end_body_0|>
<|body_start_1|>
widget = self.widget
if not len(v... | Basic data converter for ISequenceWidget. | SequenceDataConverter | [
"ZPL-2.1"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SequenceDataConverter:
"""Basic data converter for ISequenceWidget."""
def toWidgetValue(self, value):
"""Convert from Python bool to HTML representation."""
<|body_0|>
def toFieldValue(self, value):
"""See interfaces.IDataConverter"""
<|body_1|>
<|end_s... | stack_v2_sparse_classes_75kplus_train_069652 | 15,934 | permissive | [
{
"docstring": "Convert from Python bool to HTML representation.",
"name": "toWidgetValue",
"signature": "def toWidgetValue(self, value)"
},
{
"docstring": "See interfaces.IDataConverter",
"name": "toFieldValue",
"signature": "def toFieldValue(self, value)"
}
] | 2 | stack_v2_sparse_classes_30k_train_054005 | Implement the Python class `SequenceDataConverter` described below.
Class description:
Basic data converter for ISequenceWidget.
Method signatures and docstrings:
- def toWidgetValue(self, value): Convert from Python bool to HTML representation.
- def toFieldValue(self, value): See interfaces.IDataConverter | Implement the Python class `SequenceDataConverter` described below.
Class description:
Basic data converter for ISequenceWidget.
Method signatures and docstrings:
- def toWidgetValue(self, value): Convert from Python bool to HTML representation.
- def toFieldValue(self, value): See interfaces.IDataConverter
<|skelet... | aa47e9b109ad2d7de600fc1d4ea7359d8144f356 | <|skeleton|>
class SequenceDataConverter:
"""Basic data converter for ISequenceWidget."""
def toWidgetValue(self, value):
"""Convert from Python bool to HTML representation."""
<|body_0|>
def toFieldValue(self, value):
"""See interfaces.IDataConverter"""
<|body_1|>
<|end_s... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SequenceDataConverter:
"""Basic data converter for ISequenceWidget."""
def toWidgetValue(self, value):
"""Convert from Python bool to HTML representation."""
if value is self.field.missing_value:
return []
terms = self.widget.updateTerms()
try:
retu... | the_stack_v2_python_sparse | src/z3c/form/converter.py | zopefoundation/z3c.form | train | 6 |
b81790009ff02e0b56764083d8ceca130011f3d3 | [
"self.Whh = randn(hidden_size, hidden_size) * (2 / hidden_size ** 0.5)\nself.Wxh = randn(hidden_size, input_size) * (2 / hidden_size ** 0.5)\nself.Why = randn(output_size, hidden_size) * (2 / output_size ** 0.5)\nself.bh = np.zeros((hidden_size, 1))\nself.by = np.zeros((output_size, 1))\nself.x = None\nself.h = dic... | <|body_start_0|>
self.Whh = randn(hidden_size, hidden_size) * (2 / hidden_size ** 0.5)
self.Wxh = randn(hidden_size, input_size) * (2 / hidden_size ** 0.5)
self.Why = randn(output_size, hidden_size) * (2 / output_size ** 0.5)
self.bh = np.zeros((hidden_size, 1))
self.by = np.zero... | RNN | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RNN:
def __init__(self, input_size, output_size, hidden_size=64):
""":param input_size: :param output_size: :param hidden_size:"""
<|body_0|>
def forward(self, x):
"""RNN forward. :param x: :return:"""
<|body_1|>
def backward(self, eta, lr=0.01):
... | stack_v2_sparse_classes_75kplus_train_069653 | 2,861 | no_license | [
{
"docstring": ":param input_size: :param output_size: :param hidden_size:",
"name": "__init__",
"signature": "def __init__(self, input_size, output_size, hidden_size=64)"
},
{
"docstring": "RNN forward. :param x: :return:",
"name": "forward",
"signature": "def forward(self, x)"
},
{... | 3 | stack_v2_sparse_classes_30k_test_001231 | Implement the Python class `RNN` described below.
Class description:
Implement the RNN class.
Method signatures and docstrings:
- def __init__(self, input_size, output_size, hidden_size=64): :param input_size: :param output_size: :param hidden_size:
- def forward(self, x): RNN forward. :param x: :return:
- def backwa... | Implement the Python class `RNN` described below.
Class description:
Implement the RNN class.
Method signatures and docstrings:
- def __init__(self, input_size, output_size, hidden_size=64): :param input_size: :param output_size: :param hidden_size:
- def forward(self, x): RNN forward. :param x: :return:
- def backwa... | f361c91788e1cfed2b0eb5a5bc6ee855aaf1f956 | <|skeleton|>
class RNN:
def __init__(self, input_size, output_size, hidden_size=64):
""":param input_size: :param output_size: :param hidden_size:"""
<|body_0|>
def forward(self, x):
"""RNN forward. :param x: :return:"""
<|body_1|>
def backward(self, eta, lr=0.01):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RNN:
def __init__(self, input_size, output_size, hidden_size=64):
""":param input_size: :param output_size: :param hidden_size:"""
self.Whh = randn(hidden_size, hidden_size) * (2 / hidden_size ** 0.5)
self.Wxh = randn(hidden_size, input_size) * (2 / hidden_size ** 0.5)
self.Why... | the_stack_v2_python_sparse | python/alea/rnn.py | WJHoddish/kata | train | 0 | |
9296b5b8ca3074009d4a4e85131127413ce9a90c | [
"self.kgs_url = kgs_url\nself.index_page = index_page\nself.data_directory = data_directory\nself.file_info = []\nself.urls = []\nself.load_index()",
"if not os.path.isdir(self.data_directory):\n os.makedirs(self.data_directory)\nurls_to_download = []\nfor file_info in self.file_info:\n url = file_info['url... | <|body_start_0|>
self.kgs_url = kgs_url
self.index_page = index_page
self.data_directory = data_directory
self.file_info = []
self.urls = []
self.load_index()
<|end_body_0|>
<|body_start_1|>
if not os.path.isdir(self.data_directory):
os.makedirs(self.... | KGSIndex | [
"MIT",
"MPL-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KGSIndex:
def __init__(self, kgs_url='http://u-go.net/gamerecords/', index_page='kgs_index.html', data_directory='data'):
"""Create an index of zip files containing SGF data of actual Go Games on KGS. Parameters: ----------- kgs_url: URL with links to zip files of games index_page: Name ... | stack_v2_sparse_classes_75kplus_train_069654 | 4,131 | permissive | [
{
"docstring": "Create an index of zip files containing SGF data of actual Go Games on KGS. Parameters: ----------- kgs_url: URL with links to zip files of games index_page: Name of local html file of kgs_url data_directory: name of directory relative to current path to store SGF data",
"name": "__init__",
... | 4 | null | Implement the Python class `KGSIndex` described below.
Class description:
Implement the KGSIndex class.
Method signatures and docstrings:
- def __init__(self, kgs_url='http://u-go.net/gamerecords/', index_page='kgs_index.html', data_directory='data'): Create an index of zip files containing SGF data of actual Go Game... | Implement the Python class `KGSIndex` described below.
Class description:
Implement the KGSIndex class.
Method signatures and docstrings:
- def __init__(self, kgs_url='http://u-go.net/gamerecords/', index_page='kgs_index.html', data_directory='data'): Create an index of zip files containing SGF data of actual Go Game... | ff06b467e16d7a7a22555d14181b723d853e1a70 | <|skeleton|>
class KGSIndex:
def __init__(self, kgs_url='http://u-go.net/gamerecords/', index_page='kgs_index.html', data_directory='data'):
"""Create an index of zip files containing SGF data of actual Go Games on KGS. Parameters: ----------- kgs_url: URL with links to zip files of games index_page: Name ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class KGSIndex:
def __init__(self, kgs_url='http://u-go.net/gamerecords/', index_page='kgs_index.html', data_directory='data'):
"""Create an index of zip files containing SGF data of actual Go Games on KGS. Parameters: ----------- kgs_url: URL with links to zip files of games index_page: Name of local html ... | the_stack_v2_python_sparse | betago/dataloader/index_processor.py | maxpumperla/betago | train | 747 | |
82459b1f606a4525a12d66682100324516a9b64b | [
"if globals.G_TUNNEL_NUM > len(globals.G_TUNNEL_GROUP_INFO):\n self._TunnelGroupNumber = len(globals.G_TUNNEL_GROUP_INFO)\nelse:\n self._TunnelGroupNumber = globals.G_TUNNEL_NUM\nself._TunnelGroupInfo = globals.G_TUNNEL_GROUP_INFO\nself._TunnelGroupList = tunnelgrouplist\nself._TunnelWorkerQueue = tunnelworke... | <|body_start_0|>
if globals.G_TUNNEL_NUM > len(globals.G_TUNNEL_GROUP_INFO):
self._TunnelGroupNumber = len(globals.G_TUNNEL_GROUP_INFO)
else:
self._TunnelGroupNumber = globals.G_TUNNEL_NUM
self._TunnelGroupInfo = globals.G_TUNNEL_GROUP_INFO
self._TunnelGroupList =... | ListenService服务 监听本地连接,并读取数据存放到队列中 | ListenService | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ListenService:
"""ListenService服务 监听本地连接,并读取数据存放到队列中"""
def __init__(self, tunnelgrouplist, tunnelworkerqueue, tunnelworksmanager):
"""监听服务初始化"""
<|body_0|>
def start(self):
"""监听服务启动"""
<|body_1|>
def stop(self):
"""监听服务停止"""
<|body_... | stack_v2_sparse_classes_75kplus_train_069655 | 4,968 | no_license | [
{
"docstring": "监听服务初始化",
"name": "__init__",
"signature": "def __init__(self, tunnelgrouplist, tunnelworkerqueue, tunnelworksmanager)"
},
{
"docstring": "监听服务启动",
"name": "start",
"signature": "def start(self)"
},
{
"docstring": "监听服务停止",
"name": "stop",
"signature": "de... | 4 | stack_v2_sparse_classes_30k_train_035513 | Implement the Python class `ListenService` described below.
Class description:
ListenService服务 监听本地连接,并读取数据存放到队列中
Method signatures and docstrings:
- def __init__(self, tunnelgrouplist, tunnelworkerqueue, tunnelworksmanager): 监听服务初始化
- def start(self): 监听服务启动
- def stop(self): 监听服务停止
- def generator(self, tunnelgroup... | Implement the Python class `ListenService` described below.
Class description:
ListenService服务 监听本地连接,并读取数据存放到队列中
Method signatures and docstrings:
- def __init__(self, tunnelgrouplist, tunnelworkerqueue, tunnelworksmanager): 监听服务初始化
- def start(self): 监听服务启动
- def stop(self): 监听服务停止
- def generator(self, tunnelgroup... | c19d8c7ad189b84943abde6684d31f279fca4b21 | <|skeleton|>
class ListenService:
"""ListenService服务 监听本地连接,并读取数据存放到队列中"""
def __init__(self, tunnelgrouplist, tunnelworkerqueue, tunnelworksmanager):
"""监听服务初始化"""
<|body_0|>
def start(self):
"""监听服务启动"""
<|body_1|>
def stop(self):
"""监听服务停止"""
<|body_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ListenService:
"""ListenService服务 监听本地连接,并读取数据存放到队列中"""
def __init__(self, tunnelgrouplist, tunnelworkerqueue, tunnelworksmanager):
"""监听服务初始化"""
if globals.G_TUNNEL_NUM > len(globals.G_TUNNEL_GROUP_INFO):
self._TunnelGroupNumber = len(globals.G_TUNNEL_GROUP_INFO)
else... | the_stack_v2_python_sparse | Client/ListenService.py | lixingke3650/OrTunnel | train | 1 |
1e4f9bbdb4a588afbde1174286cd83b793bc9738 | [
"self.n_estimators = n_estimators\nself.random = random\nself.split = split\nself.meta_model = list(map(lambda x: copy.deepcopy(meta_model), range(n_estimators)))\nself.model = model",
"dataset_blend_feature = np.zeros((x_pred.shape[0], self.n_estimators))\nfor index, estimator in enumerate(self.meta_model):\n ... | <|body_start_0|>
self.n_estimators = n_estimators
self.random = random
self.split = split
self.meta_model = list(map(lambda x: copy.deepcopy(meta_model), range(n_estimators)))
self.model = model
<|end_body_0|>
<|body_start_1|>
dataset_blend_feature = np.zeros((x_pred.sha... | Stacking | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Stacking:
def __init__(self, n_estimators, meta_model, model, split=0.8, random=0):
""":param n_estimators: 元模型的数量 :param random: 随机数种子 :param split: 训练集和测试集分割比例,训练集用于元模型进行训练,测试集用于元模型生成给决策模型的数据"""
<|body_0|>
def predict(self, x_pred):
"""把元模型的输出作为最终模型的特征 :param x_pre... | stack_v2_sparse_classes_75kplus_train_069656 | 2,589 | no_license | [
{
"docstring": ":param n_estimators: 元模型的数量 :param random: 随机数种子 :param split: 训练集和测试集分割比例,训练集用于元模型进行训练,测试集用于元模型生成给决策模型的数据",
"name": "__init__",
"signature": "def __init__(self, n_estimators, meta_model, model, split=0.8, random=0)"
},
{
"docstring": "把元模型的输出作为最终模型的特征 :param x_pred: 原始数据 :return... | 3 | stack_v2_sparse_classes_30k_train_018754 | Implement the Python class `Stacking` described below.
Class description:
Implement the Stacking class.
Method signatures and docstrings:
- def __init__(self, n_estimators, meta_model, model, split=0.8, random=0): :param n_estimators: 元模型的数量 :param random: 随机数种子 :param split: 训练集和测试集分割比例,训练集用于元模型进行训练,测试集用于元模型生成给决策模型的... | Implement the Python class `Stacking` described below.
Class description:
Implement the Stacking class.
Method signatures and docstrings:
- def __init__(self, n_estimators, meta_model, model, split=0.8, random=0): :param n_estimators: 元模型的数量 :param random: 随机数种子 :param split: 训练集和测试集分割比例,训练集用于元模型进行训练,测试集用于元模型生成给决策模型的... | 1e8d30add10ae46043b76e664e4250a3e2b22e3f | <|skeleton|>
class Stacking:
def __init__(self, n_estimators, meta_model, model, split=0.8, random=0):
""":param n_estimators: 元模型的数量 :param random: 随机数种子 :param split: 训练集和测试集分割比例,训练集用于元模型进行训练,测试集用于元模型生成给决策模型的数据"""
<|body_0|>
def predict(self, x_pred):
"""把元模型的输出作为最终模型的特征 :param x_pre... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Stacking:
def __init__(self, n_estimators, meta_model, model, split=0.8, random=0):
""":param n_estimators: 元模型的数量 :param random: 随机数种子 :param split: 训练集和测试集分割比例,训练集用于元模型进行训练,测试集用于元模型生成给决策模型的数据"""
self.n_estimators = n_estimators
self.random = random
self.split = split
... | the_stack_v2_python_sparse | ensemble_learning/algorithm/stacking.py | cherryMonth/machine_learning | train | 2 | |
e31b38478eeaa124b93cf7078e530ffe1552f6c2 | [
"if len(strs) == 0:\n return ''\ntmp = [strs[0][i] for i in range(len(strs[0]))]\nres = []\nj = 0\nwhile j < len(tmp):\n for i in strs:\n if j >= len(i) or i[j] != tmp[j]:\n return ''.join(res)\n res.append(tmp[j])\n j += 1\nreturn strs[0]",
"if not strs:\n return ''\nfor i, ch in... | <|body_start_0|>
if len(strs) == 0:
return ''
tmp = [strs[0][i] for i in range(len(strs[0]))]
res = []
j = 0
while j < len(tmp):
for i in strs:
if j >= len(i) or i[j] != tmp[j]:
return ''.join(res)
res.append... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def longestCommonPrefix(self, strs):
""":type strs: List[str] :rtype: str"""
<|body_0|>
def longestCommonPrefix0(self, strs):
""":type strs: List[str] :rtype: str ["flower","flow","flight"]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
i... | stack_v2_sparse_classes_75kplus_train_069657 | 849 | no_license | [
{
"docstring": ":type strs: List[str] :rtype: str",
"name": "longestCommonPrefix",
"signature": "def longestCommonPrefix(self, strs)"
},
{
"docstring": ":type strs: List[str] :rtype: str [\"flower\",\"flow\",\"flight\"]",
"name": "longestCommonPrefix0",
"signature": "def longestCommonPre... | 2 | stack_v2_sparse_classes_30k_train_027021 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def longestCommonPrefix(self, strs): :type strs: List[str] :rtype: str
- def longestCommonPrefix0(self, strs): :type strs: List[str] :rtype: str ["flower","flow","flight"] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def longestCommonPrefix(self, strs): :type strs: List[str] :rtype: str
- def longestCommonPrefix0(self, strs): :type strs: List[str] :rtype: str ["flower","flow","flight"]
<|ske... | 9e49b2c6003b957276737005d4aaac276b44d251 | <|skeleton|>
class Solution:
def longestCommonPrefix(self, strs):
""":type strs: List[str] :rtype: str"""
<|body_0|>
def longestCommonPrefix0(self, strs):
""":type strs: List[str] :rtype: str ["flower","flow","flight"]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def longestCommonPrefix(self, strs):
""":type strs: List[str] :rtype: str"""
if len(strs) == 0:
return ''
tmp = [strs[0][i] for i in range(len(strs[0]))]
res = []
j = 0
while j < len(tmp):
for i in strs:
if j >= ... | the_stack_v2_python_sparse | PythonCode/src/0014_Longest_Common_Prefix.py | oneyuan/CodeforFun | train | 0 | |
6a98f55297744e78bb9f9b18aace527e3f882fbe | [
"gobject.GObject.__init__(self)\nself.__root = gio.File(root_dir)\nself.__monitored = False\nself.__monitors = {}\nself.__queue = []\nself.__lock = threading.RLock()",
"if property.name == 'monitored':\n return self.__monitored\nelse:\n raise AttributeError('unkown property %s' % property.name)",
"if prop... | <|body_start_0|>
gobject.GObject.__init__(self)
self.__root = gio.File(root_dir)
self.__monitored = False
self.__monitors = {}
self.__queue = []
self.__lock = threading.RLock()
<|end_body_0|>
<|body_start_1|>
if property.name == 'monitored':
return se... | Monitors library locations for changes | LibraryMonitor | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LibraryMonitor:
"""Monitors library locations for changes"""
def __init__(self, root_dir):
""":param library: the library to monitor :type library: :class:`Library`"""
<|body_0|>
def do_get_property(self, property):
"""Gets GObject properties"""
<|body_1|... | stack_v2_sparse_classes_75kplus_train_069658 | 4,974 | no_license | [
{
"docstring": ":param library: the library to monitor :type library: :class:`Library`",
"name": "__init__",
"signature": "def __init__(self, root_dir)"
},
{
"docstring": "Gets GObject properties",
"name": "do_get_property",
"signature": "def do_get_property(self, property)"
},
{
... | 5 | stack_v2_sparse_classes_30k_train_016632 | Implement the Python class `LibraryMonitor` described below.
Class description:
Monitors library locations for changes
Method signatures and docstrings:
- def __init__(self, root_dir): :param library: the library to monitor :type library: :class:`Library`
- def do_get_property(self, property): Gets GObject properties... | Implement the Python class `LibraryMonitor` described below.
Class description:
Monitors library locations for changes
Method signatures and docstrings:
- def __init__(self, root_dir): :param library: the library to monitor :type library: :class:`Library`
- def do_get_property(self, property): Gets GObject properties... | 1b83a035a4dfd57a2ba87c453f6b394d506c98f1 | <|skeleton|>
class LibraryMonitor:
"""Monitors library locations for changes"""
def __init__(self, root_dir):
""":param library: the library to monitor :type library: :class:`Library`"""
<|body_0|>
def do_get_property(self, property):
"""Gets GObject properties"""
<|body_1|... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LibraryMonitor:
"""Monitors library locations for changes"""
def __init__(self, root_dir):
""":param library: the library to monitor :type library: :class:`Library`"""
gobject.GObject.__init__(self)
self.__root = gio.File(root_dir)
self.__monitored = False
self.__m... | the_stack_v2_python_sparse | modules/individuation/src/monitor.py | electricface/deepin-system-settings | train | 0 |
6d69aabe095d6bc0f94bcd37aeb91bbb279ec2a3 | [
"def serializeHelper(root, string):\n if not root:\n return 'None,'\n leftSerialization = serializeHelper(root.left, string)\n rightSerialization = serializeHelper(root.right, string)\n return str(root.val) + ',' + leftSerialization + rightSerialization\nreturn serializeHelper(root, '')",
"def ... | <|body_start_0|>
def serializeHelper(root, string):
if not root:
return 'None,'
leftSerialization = serializeHelper(root.left, string)
rightSerialization = serializeHelper(root.right, string)
return str(root.val) + ',' + leftSerialization + rightSe... | Codec | [
"MIT"
] | 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_069659 | 2,737 | permissive | [
{
"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 | null | 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:... | bc656fd655617407856e0ce45b68585fa81c5035 | <|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"""
def serializeHelper(root, string):
if not root:
return 'None,'
leftSerialization = serializeHelper(root.left, string)
rightSerializati... | the_stack_v2_python_sparse | Leetcode/Python Solutions/Binary Trees/SerializeandDeserializeBinaryTree.py | Mostofa-Najmus-Sakib/Applied-Algorithm | train | 0 | |
d79f2816b17191de965916d12fbc286b26d17434 | [
"if self.validate_model():\n self.save()\n return True\nreturn False",
"if str(self.date).strip() == '' or self.hardness.strip() == '':\n return False\ntry:\n datetime.datetime.strptime(self.date, '%d.%m.%Y')\nexcept ValueError:\n return False\nreturn True"
] | <|body_start_0|>
if self.validate_model():
self.save()
return True
return False
<|end_body_0|>
<|body_start_1|>
if str(self.date).strip() == '' or self.hardness.strip() == '':
return False
try:
datetime.datetime.strptime(self.date, '%d.%m.... | Basis model for measurements which contains all values. | Measurement | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Measurement:
"""Basis model for measurements which contains all values."""
def add_measurement(self):
"""Add a measurement to database after validating it. :return:"""
<|body_0|>
def validate_model(self):
"""Validate model values. :return: false on error"""
... | stack_v2_sparse_classes_75kplus_train_069660 | 3,108 | permissive | [
{
"docstring": "Add a measurement to database after validating it. :return:",
"name": "add_measurement",
"signature": "def add_measurement(self)"
},
{
"docstring": "Validate model values. :return: false on error",
"name": "validate_model",
"signature": "def validate_model(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_054555 | Implement the Python class `Measurement` described below.
Class description:
Basis model for measurements which contains all values.
Method signatures and docstrings:
- def add_measurement(self): Add a measurement to database after validating it. :return:
- def validate_model(self): Validate model values. :return: fa... | Implement the Python class `Measurement` described below.
Class description:
Basis model for measurements which contains all values.
Method signatures and docstrings:
- def add_measurement(self): Add a measurement to database after validating it. :return:
- def validate_model(self): Validate model values. :return: fa... | 27394b810c15d4591abba3a71ba37715d3a75d4a | <|skeleton|>
class Measurement:
"""Basis model for measurements which contains all values."""
def add_measurement(self):
"""Add a measurement to database after validating it. :return:"""
<|body_0|>
def validate_model(self):
"""Validate model values. :return: false on error"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Measurement:
"""Basis model for measurements which contains all values."""
def add_measurement(self):
"""Add a measurement to database after validating it. :return:"""
if self.validate_model():
self.save()
return True
return False
def validate_model(se... | the_stack_v2_python_sparse | python-app/wasser/users/models.py | opendata-heilbronn/tapwater | train | 0 |
304f726f08b371ded8567a002c4eabed8624e2a1 | [
"super().__init__()\nself.factor_dependencies = factor_dependencies\nfor factor_type, model in factor_models.items():\n self.__setattr__(factor_type + '_factor_model', model)\nself.factor_models = factor_models\nself.factor_label_indices = dict()\nfor factor_type, dependencies in factor_dependencies.items():\n ... | <|body_start_0|>
super().__init__()
self.factor_dependencies = factor_dependencies
for factor_type, model in factor_models.items():
self.__setattr__(factor_type + '_factor_model', model)
self.factor_models = factor_models
self.factor_label_indices = dict()
for... | FactorGraph interface to work with cpp implementations. It manages the models for the factors and the inference of their scores. | FactorGraphCpp | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FactorGraphCpp:
"""FactorGraph interface to work with cpp implementations. It manages the models for the factors and the inference of their scores."""
def __init__(self, factor_dependencies: Dict[str, List[Tuple[int]]], factor_models: Dict[str, nn.Module]):
"""See nsr.graph.factor_gr... | stack_v2_sparse_classes_75kplus_train_069661 | 2,129 | permissive | [
{
"docstring": "See nsr.graph.factor_graph.FactorGraph.",
"name": "__init__",
"signature": "def __init__(self, factor_dependencies: Dict[str, List[Tuple[int]]], factor_models: Dict[str, nn.Module])"
},
{
"docstring": "Evaluate all the factor Tensors. Args: input_states: states for each label nod... | 2 | stack_v2_sparse_classes_30k_train_037189 | Implement the Python class `FactorGraphCpp` described below.
Class description:
FactorGraph interface to work with cpp implementations. It manages the models for the factors and the inference of their scores.
Method signatures and docstrings:
- def __init__(self, factor_dependencies: Dict[str, List[Tuple[int]]], fact... | Implement the Python class `FactorGraphCpp` described below.
Class description:
FactorGraph interface to work with cpp implementations. It manages the models for the factors and the inference of their scores.
Method signatures and docstrings:
- def __init__(self, factor_dependencies: Dict[str, List[Tuple[int]]], fact... | 8b4a7a40cc34bff608f19d3f7eb64bda76669c5b | <|skeleton|>
class FactorGraphCpp:
"""FactorGraph interface to work with cpp implementations. It manages the models for the factors and the inference of their scores."""
def __init__(self, factor_dependencies: Dict[str, List[Tuple[int]]], factor_models: Dict[str, nn.Module]):
"""See nsr.graph.factor_gr... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FactorGraphCpp:
"""FactorGraph interface to work with cpp implementations. It manages the models for the factors and the inference of their scores."""
def __init__(self, factor_dependencies: Dict[str, List[Tuple[int]]], factor_models: Dict[str, nn.Module]):
"""See nsr.graph.factor_graph.FactorGra... | the_stack_v2_python_sparse | nsr/graph_cpp/factor_graph_cpp.py | GaoSida/Neural-SampleRank | train | 3 |
4e2e8b44210597b2de6c53fc426f4f2bbb0e30ef | [
"threading.Thread.__init__(self)\nself.peer_active = False\nself.threadID = threadID\nself.name = name",
"print('Starting ' + self.name)\nself.peer_active = True\nself._peer = peer.Peer()\nprint('Exiting ' + self.name)"
] | <|body_start_0|>
threading.Thread.__init__(self)
self.peer_active = False
self.threadID = threadID
self.name = name
<|end_body_0|>
<|body_start_1|>
print('Starting ' + self.name)
self.peer_active = True
self._peer = peer.Peer()
print('Exiting ' + self.nam... | Starts peers in new Thread. | Peer_Thread | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Peer_Thread:
"""Starts peers in new Thread."""
def __init__(self, threadID, name):
"""Initialise thread with parameters parameters. @param : threadID @param : name Thread name"""
<|body_0|>
def run(self):
"""Peer is now active. A new P2PSP Peer object is created.... | stack_v2_sparse_classes_75kplus_train_069662 | 1,914 | no_license | [
{
"docstring": "Initialise thread with parameters parameters. @param : threadID @param : name Thread name",
"name": "__init__",
"signature": "def __init__(self, threadID, name)"
},
{
"docstring": "Peer is now active. A new P2PSP Peer object is created.",
"name": "run",
"signature": "def ... | 2 | stack_v2_sparse_classes_30k_train_011683 | Implement the Python class `Peer_Thread` described below.
Class description:
Starts peers in new Thread.
Method signatures and docstrings:
- def __init__(self, threadID, name): Initialise thread with parameters parameters. @param : threadID @param : name Thread name
- def run(self): Peer is now active. A new P2PSP Pe... | Implement the Python class `Peer_Thread` described below.
Class description:
Starts peers in new Thread.
Method signatures and docstrings:
- def __init__(self, threadID, name): Initialise thread with parameters parameters. @param : threadID @param : name Thread name
- def run(self): Peer is now active. A new P2PSP Pe... | 2e0da519f2227f99d29f19ec9ef9ac2edd9a4cfd | <|skeleton|>
class Peer_Thread:
"""Starts peers in new Thread."""
def __init__(self, threadID, name):
"""Initialise thread with parameters parameters. @param : threadID @param : name Thread name"""
<|body_0|>
def run(self):
"""Peer is now active. A new P2PSP Peer object is created.... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Peer_Thread:
"""Starts peers in new Thread."""
def __init__(self, threadID, name):
"""Initialise thread with parameters parameters. @param : threadID @param : name Thread name"""
threading.Thread.__init__(self)
self.peer_active = False
self.threadID = threadID
self... | the_stack_v2_python_sparse | src/gui/model/peer_thread.py | iharsh234/p2psp | train | 4 |
6a1c82f57b7816e95e6eb168d95d180981a42487 | [
"dialog = Gtk.MessageDialog(None, 0, Gtk.MessageType.INFO, Gtk.ButtonsType.OK, 'Error')\ndialog.format_secondary_text(self.messages(list_error))\ndialog.run()\ndialog.destroy()",
"text = 'Ingrese:'\nif list_error[0] == 1:\n text += '\\n - Function.'\nif list_error[1] == 1:\n text += '\\n - GFunction.'\nif l... | <|body_start_0|>
dialog = Gtk.MessageDialog(None, 0, Gtk.MessageType.INFO, Gtk.ButtonsType.OK, 'Error')
dialog.format_secondary_text(self.messages(list_error))
dialog.run()
dialog.destroy()
<|end_body_0|>
<|body_start_1|>
text = 'Ingrese:'
if list_error[0] == 1:
... | Errors | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Errors:
def non_lineal_errors(self, list_error):
"""list_error[0]: Function list_error[1]: GFunction list_error[2]: Iterations list_error[3]: Increments list_error[4]: Initial list_error[5]: Superior list_error[6]: Tolerance"""
<|body_0|>
def messages(self, list_error):
... | stack_v2_sparse_classes_75kplus_train_069663 | 1,520 | permissive | [
{
"docstring": "list_error[0]: Function list_error[1]: GFunction list_error[2]: Iterations list_error[3]: Increments list_error[4]: Initial list_error[5]: Superior list_error[6]: Tolerance",
"name": "non_lineal_errors",
"signature": "def non_lineal_errors(self, list_error)"
},
{
"docstring": "li... | 2 | stack_v2_sparse_classes_30k_train_023516 | Implement the Python class `Errors` described below.
Class description:
Implement the Errors class.
Method signatures and docstrings:
- def non_lineal_errors(self, list_error): list_error[0]: Function list_error[1]: GFunction list_error[2]: Iterations list_error[3]: Increments list_error[4]: Initial list_error[5]: Su... | Implement the Python class `Errors` described below.
Class description:
Implement the Errors class.
Method signatures and docstrings:
- def non_lineal_errors(self, list_error): list_error[0]: Function list_error[1]: GFunction list_error[2]: Iterations list_error[3]: Increments list_error[4]: Initial list_error[5]: Su... | d6c4eb3de51c627c2489c2289738ec567cfa5cc9 | <|skeleton|>
class Errors:
def non_lineal_errors(self, list_error):
"""list_error[0]: Function list_error[1]: GFunction list_error[2]: Iterations list_error[3]: Increments list_error[4]: Initial list_error[5]: Superior list_error[6]: Tolerance"""
<|body_0|>
def messages(self, list_error):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Errors:
def non_lineal_errors(self, list_error):
"""list_error[0]: Function list_error[1]: GFunction list_error[2]: Iterations list_error[3]: Increments list_error[4]: Initial list_error[5]: Superior list_error[6]: Tolerance"""
dialog = Gtk.MessageDialog(None, 0, Gtk.MessageType.INFO, Gtk.Butt... | the_stack_v2_python_sparse | UI/NonLineal/Messages/errors.py | tdnavarrom/Numerical-Analytics-App | train | 0 | |
3d6b8ed2b738f72c44192e9651c032b8b3002f92 | [
"self.r_smiles = r_smiles\nself.p_smiles = p_smiles\nself.gold_reagents = reagent\nself.gold_solvents = solvent\nself.temperatures = torch.Tensor([float(temperature)])\nrxn_fp = create_rxn_Morgan2FP_concatenate(self.r_smiles, self.p_smiles, fpsize=args.fpsize, radius=args.radius)\nself.rxn_fp = torch.Tensor(rxn_fp)... | <|body_start_0|>
self.r_smiles = r_smiles
self.p_smiles = p_smiles
self.gold_reagents = reagent
self.gold_solvents = solvent
self.temperatures = torch.Tensor([float(temperature)])
rxn_fp = create_rxn_Morgan2FP_concatenate(self.r_smiles, self.p_smiles, fpsize=args.fpsize, ... | Temperature regression. | TemperatureDatapoint | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TemperatureDatapoint:
"""Temperature regression."""
def __init__(self, r_smiles: str, p_smiles: str, reagent: str, solvent: str, temperature: str, solvent_classes, reagent_classes, args: TrainArgs_rxn):
""":param r_smiles: The SMILES string for the reactant molecule. :param p_smiles:... | stack_v2_sparse_classes_75kplus_train_069664 | 25,621 | permissive | [
{
"docstring": ":param r_smiles: The SMILES string for the reactant molecule. :param p_smiles: The SMILES string fot the product molecule. :param reagent: Gold true reagent for this reaction condition (ex: sodium tris(acetoxy)borohydride). :param solvent: Gold true solvent for this reaction condition (ex: chlor... | 2 | null | Implement the Python class `TemperatureDatapoint` described below.
Class description:
Temperature regression.
Method signatures and docstrings:
- def __init__(self, r_smiles: str, p_smiles: str, reagent: str, solvent: str, temperature: str, solvent_classes, reagent_classes, args: TrainArgs_rxn): :param r_smiles: The ... | Implement the Python class `TemperatureDatapoint` described below.
Class description:
Temperature regression.
Method signatures and docstrings:
- def __init__(self, r_smiles: str, p_smiles: str, reagent: str, solvent: str, temperature: str, solvent_classes, reagent_classes, args: TrainArgs_rxn): :param r_smiles: The ... | 116d6f21a1b6dc39016d87c001dc5b142cfb697a | <|skeleton|>
class TemperatureDatapoint:
"""Temperature regression."""
def __init__(self, r_smiles: str, p_smiles: str, reagent: str, solvent: str, temperature: str, solvent_classes, reagent_classes, args: TrainArgs_rxn):
""":param r_smiles: The SMILES string for the reactant molecule. :param p_smiles:... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TemperatureDatapoint:
"""Temperature regression."""
def __init__(self, r_smiles: str, p_smiles: str, reagent: str, solvent: str, temperature: str, solvent_classes, reagent_classes, args: TrainArgs_rxn):
""":param r_smiles: The SMILES string for the reactant molecule. :param p_smiles: The SMILES s... | the_stack_v2_python_sparse | rxn_yield_context/train_multilabel/data_utils/data_for_context.py | rnaimehaom/rxn_yield_context | train | 0 |
a02aae8b0ad9829c94253ecbd7d633c80ff9b73a | [
"super().__init__(config)\nself.in_proj_weight = nn.Parameter(torch.cat([vilt_layer.attention.attention.query.weight, vilt_layer.attention.attention.key.weight, vilt_layer.attention.attention.value.weight]))\nself.in_proj_bias = nn.Parameter(torch.cat([vilt_layer.attention.attention.query.bias, vilt_layer.attention... | <|body_start_0|>
super().__init__(config)
self.in_proj_weight = nn.Parameter(torch.cat([vilt_layer.attention.attention.query.weight, vilt_layer.attention.attention.key.weight, vilt_layer.attention.attention.value.weight]))
self.in_proj_bias = nn.Parameter(torch.cat([vilt_layer.attention.attentio... | ViltLayerBetterTransformer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ViltLayerBetterTransformer:
def __init__(self, vilt_layer, config):
"""A simple conversion of the VilTLayer to its `BetterTransformer` implementation. Args: vilt_layer (`torch.nn.Module`): The original `VilTLayer` where the weights needs to be retrieved."""
<|body_0|>
def fo... | stack_v2_sparse_classes_75kplus_train_069665 | 43,670 | no_license | [
{
"docstring": "A simple conversion of the VilTLayer to its `BetterTransformer` implementation. Args: vilt_layer (`torch.nn.Module`): The original `VilTLayer` where the weights needs to be retrieved.",
"name": "__init__",
"signature": "def __init__(self, vilt_layer, config)"
},
{
"docstring": "T... | 2 | stack_v2_sparse_classes_30k_train_000832 | Implement the Python class `ViltLayerBetterTransformer` described below.
Class description:
Implement the ViltLayerBetterTransformer class.
Method signatures and docstrings:
- def __init__(self, vilt_layer, config): A simple conversion of the VilTLayer to its `BetterTransformer` implementation. Args: vilt_layer (`tor... | Implement the Python class `ViltLayerBetterTransformer` described below.
Class description:
Implement the ViltLayerBetterTransformer class.
Method signatures and docstrings:
- def __init__(self, vilt_layer, config): A simple conversion of the VilTLayer to its `BetterTransformer` implementation. Args: vilt_layer (`tor... | 7e55a422588c1d1e00f35a3d3a3ff896cce59e18 | <|skeleton|>
class ViltLayerBetterTransformer:
def __init__(self, vilt_layer, config):
"""A simple conversion of the VilTLayer to its `BetterTransformer` implementation. Args: vilt_layer (`torch.nn.Module`): The original `VilTLayer` where the weights needs to be retrieved."""
<|body_0|>
def fo... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ViltLayerBetterTransformer:
def __init__(self, vilt_layer, config):
"""A simple conversion of the VilTLayer to its `BetterTransformer` implementation. Args: vilt_layer (`torch.nn.Module`): The original `VilTLayer` where the weights needs to be retrieved."""
super().__init__(config)
sel... | the_stack_v2_python_sparse | generated/test_huggingface_optimum.py | jansel/pytorch-jit-paritybench | train | 35 | |
1bf36e0a628b420712ed774573a5788398be10fb | [
"self.dir = dir\nself.tstRatio = tstRatio\nself.batch_size = batch_size\nsplit_test_train_data(dir, tstRatio)\ntrnTransform = data_transforms['train']\nself.trainSet = DroneDataset(train=True, transform=trnTransform)\ntstTransform = data_transforms['val']\nself.testSet = DroneDataset(train=False, transform=tstTrans... | <|body_start_0|>
self.dir = dir
self.tstRatio = tstRatio
self.batch_size = batch_size
split_test_train_data(dir, tstRatio)
trnTransform = data_transforms['train']
self.trainSet = DroneDataset(train=True, transform=trnTransform)
tstTransform = data_transforms['val'... | A class to dataset with its loader. ... Attributes ---------- dataloaders : torch dataloader dataset_sizes : length of train and validation dataset class_names : class names Methods ------- show_batch: Shows five sample images for verification of dataloaders | LoadDataset | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LoadDataset:
"""A class to dataset with its loader. ... Attributes ---------- dataloaders : torch dataloader dataset_sizes : length of train and validation dataset class_names : class names Methods ------- show_batch: Shows five sample images for verification of dataloaders"""
def __init__(s... | stack_v2_sparse_classes_75kplus_train_069666 | 9,192 | permissive | [
{
"docstring": "Initialize the class object. Dataset class ojbect",
"name": "__init__",
"signature": "def __init__(self, dir, tstRatio, batch_size)"
},
{
"docstring": "Show five sample images for verification of dataloaders. Get item internal fuction",
"name": "show_batch",
"signature": ... | 2 | stack_v2_sparse_classes_30k_train_010580 | Implement the Python class `LoadDataset` described below.
Class description:
A class to dataset with its loader. ... Attributes ---------- dataloaders : torch dataloader dataset_sizes : length of train and validation dataset class_names : class names Methods ------- show_batch: Shows five sample images for verificatio... | Implement the Python class `LoadDataset` described below.
Class description:
A class to dataset with its loader. ... Attributes ---------- dataloaders : torch dataloader dataset_sizes : length of train and validation dataset class_names : class names Methods ------- show_batch: Shows five sample images for verificatio... | 7c551e3894979cc425dd51baeddbfa5a51b7878d | <|skeleton|>
class LoadDataset:
"""A class to dataset with its loader. ... Attributes ---------- dataloaders : torch dataloader dataset_sizes : length of train and validation dataset class_names : class names Methods ------- show_batch: Shows five sample images for verification of dataloaders"""
def __init__(s... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LoadDataset:
"""A class to dataset with its loader. ... Attributes ---------- dataloaders : torch dataloader dataset_sizes : length of train and validation dataset class_names : class names Methods ------- show_batch: Shows five sample images for verification of dataloaders"""
def __init__(self, dir, tst... | the_stack_v2_python_sparse | Modules/data_loader.py | EVA4-RS-Group/Phase2 | train | 0 |
a50d8418ee1d0d5808512bacdd93e3ee752e468b | [
"if not nums:\n return 0\nsize = len(nums)\ndp = [1] * size\nfor i in range(size):\n for j in range(i):\n if nums[j] < nums[i]:\n dp[i] = max(dp[i], dp[j] + 1)\nreturn max(dp)",
"if not nums:\n return 0\nsize = len(nums)\ntop, piles = ([0] * size, 0)\nfor i in range(size):\n poker = ... | <|body_start_0|>
if not nums:
return 0
size = len(nums)
dp = [1] * size
for i in range(size):
for j in range(i):
if nums[j] < nums[i]:
dp[i] = max(dp[i], dp[j] + 1)
return max(dp)
<|end_body_0|>
<|body_start_1|>
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lengthOfLIS(self, nums: List[int]) -> int:
"""动态规划 O(n^2) time"""
<|body_0|>
def lengthOfLIS_1(self, nums: List[int]) -> int:
"""耐心排序(就是蜘蛛纸牌的玩法)"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not nums:
return 0
... | stack_v2_sparse_classes_75kplus_train_069667 | 1,357 | no_license | [
{
"docstring": "动态规划 O(n^2) time",
"name": "lengthOfLIS",
"signature": "def lengthOfLIS(self, nums: List[int]) -> int"
},
{
"docstring": "耐心排序(就是蜘蛛纸牌的玩法)",
"name": "lengthOfLIS_1",
"signature": "def lengthOfLIS_1(self, nums: List[int]) -> int"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLIS(self, nums: List[int]) -> int: 动态规划 O(n^2) time
- def lengthOfLIS_1(self, nums: List[int]) -> int: 耐心排序(就是蜘蛛纸牌的玩法) | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLIS(self, nums: List[int]) -> int: 动态规划 O(n^2) time
- def lengthOfLIS_1(self, nums: List[int]) -> int: 耐心排序(就是蜘蛛纸牌的玩法)
<|skeleton|>
class Solution:
def lengthOf... | 3508e1ce089131b19603c3206aab4cf43023bb19 | <|skeleton|>
class Solution:
def lengthOfLIS(self, nums: List[int]) -> int:
"""动态规划 O(n^2) time"""
<|body_0|>
def lengthOfLIS_1(self, nums: List[int]) -> int:
"""耐心排序(就是蜘蛛纸牌的玩法)"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def lengthOfLIS(self, nums: List[int]) -> int:
"""动态规划 O(n^2) time"""
if not nums:
return 0
size = len(nums)
dp = [1] * size
for i in range(size):
for j in range(i):
if nums[j] < nums[i]:
dp[i] = max(... | the_stack_v2_python_sparse | algorithm/leetcode/dp/15-最长上升序列.py | lxconfig/UbuntuCode_bak | train | 0 | |
0cabedfadb79d035c5e8bbd8a8b5155911fe6fe4 | [
"super().__init__(img=bullet_img, x=x, y=y)\nself.set_sprite_center()\nself.speed = 300\nself.visible = True",
"if self.visible:\n self.move(self.speed * dt)\n if self.x < 0 or self.x > 1024 or self.y > 768:\n self.visible = False"
] | <|body_start_0|>
super().__init__(img=bullet_img, x=x, y=y)
self.set_sprite_center()
self.speed = 300
self.visible = True
<|end_body_0|>
<|body_start_1|>
if self.visible:
self.move(self.speed * dt)
if self.x < 0 or self.x > 1024 or self.y > 768:
... | 炮弹精灵 | BulletSprite | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BulletSprite:
"""炮弹精灵"""
def __init__(self, x=0, y=0):
"""初始化"""
<|body_0|>
def fire_move(self, dt):
"""移动炮弹"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super().__init__(img=bullet_img, x=x, y=y)
self.set_sprite_center()
self... | stack_v2_sparse_classes_75kplus_train_069668 | 4,509 | no_license | [
{
"docstring": "初始化",
"name": "__init__",
"signature": "def __init__(self, x=0, y=0)"
},
{
"docstring": "移动炮弹",
"name": "fire_move",
"signature": "def fire_move(self, dt)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002048 | Implement the Python class `BulletSprite` described below.
Class description:
炮弹精灵
Method signatures and docstrings:
- def __init__(self, x=0, y=0): 初始化
- def fire_move(self, dt): 移动炮弹 | Implement the Python class `BulletSprite` described below.
Class description:
炮弹精灵
Method signatures and docstrings:
- def __init__(self, x=0, y=0): 初始化
- def fire_move(self, dt): 移动炮弹
<|skeleton|>
class BulletSprite:
"""炮弹精灵"""
def __init__(self, x=0, y=0):
"""初始化"""
<|body_0|>
def fir... | 941e29d5f39092b02f8486a435e61c7ec2bdcdb6 | <|skeleton|>
class BulletSprite:
"""炮弹精灵"""
def __init__(self, x=0, y=0):
"""初始化"""
<|body_0|>
def fire_move(self, dt):
"""移动炮弹"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BulletSprite:
"""炮弹精灵"""
def __init__(self, x=0, y=0):
"""初始化"""
super().__init__(img=bullet_img, x=x, y=y)
self.set_sprite_center()
self.speed = 300
self.visible = True
def fire_move(self, dt):
"""移动炮弹"""
if self.visible:
self.move... | the_stack_v2_python_sparse | Python趣味编程:从入门到人工智能/第31课_捕鱼达人/示例程序/version3/game_sprites.py | zhy0313/children-python | train | 0 |
5614132ffaceb5ea3e84b0434d7dc4e71450f20b | [
"super().__init__(adguard, entry)\nself.entity_description = description\nself._attr_unique_id = '_'.join([DOMAIN, adguard.host, str(adguard.port), 'sensor', description.key])",
"value = await self.entity_description.value_fn(self.adguard)\nself._attr_native_value = value\nif isinstance(value, float):\n self._... | <|body_start_0|>
super().__init__(adguard, entry)
self.entity_description = description
self._attr_unique_id = '_'.join([DOMAIN, adguard.host, str(adguard.port), 'sensor', description.key])
<|end_body_0|>
<|body_start_1|>
value = await self.entity_description.value_fn(self.adguard)
... | Defines a AdGuard Home sensor. | AdGuardHomeSensor | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AdGuardHomeSensor:
"""Defines a AdGuard Home sensor."""
def __init__(self, adguard: AdGuardHome, entry: ConfigEntry, description: AdGuardHomeEntityDescription) -> None:
"""Initialize AdGuard Home sensor."""
<|body_0|>
async def _adguard_update(self) -> None:
"""U... | stack_v2_sparse_classes_75kplus_train_069669 | 4,982 | permissive | [
{
"docstring": "Initialize AdGuard Home sensor.",
"name": "__init__",
"signature": "def __init__(self, adguard: AdGuardHome, entry: ConfigEntry, description: AdGuardHomeEntityDescription) -> None"
},
{
"docstring": "Update AdGuard Home entity.",
"name": "_adguard_update",
"signature": "a... | 2 | stack_v2_sparse_classes_30k_train_020677 | Implement the Python class `AdGuardHomeSensor` described below.
Class description:
Defines a AdGuard Home sensor.
Method signatures and docstrings:
- def __init__(self, adguard: AdGuardHome, entry: ConfigEntry, description: AdGuardHomeEntityDescription) -> None: Initialize AdGuard Home sensor.
- async def _adguard_up... | Implement the Python class `AdGuardHomeSensor` described below.
Class description:
Defines a AdGuard Home sensor.
Method signatures and docstrings:
- def __init__(self, adguard: AdGuardHome, entry: ConfigEntry, description: AdGuardHomeEntityDescription) -> None: Initialize AdGuard Home sensor.
- async def _adguard_up... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class AdGuardHomeSensor:
"""Defines a AdGuard Home sensor."""
def __init__(self, adguard: AdGuardHome, entry: ConfigEntry, description: AdGuardHomeEntityDescription) -> None:
"""Initialize AdGuard Home sensor."""
<|body_0|>
async def _adguard_update(self) -> None:
"""U... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AdGuardHomeSensor:
"""Defines a AdGuard Home sensor."""
def __init__(self, adguard: AdGuardHome, entry: ConfigEntry, description: AdGuardHomeEntityDescription) -> None:
"""Initialize AdGuard Home sensor."""
super().__init__(adguard, entry)
self.entity_description = description
... | the_stack_v2_python_sparse | homeassistant/components/adguard/sensor.py | home-assistant/core | train | 35,501 |
78e030bf86a7727507a53ab7b55021f0028dffcc | [
"if os.path.isfile(bbo.get_path('save_game.pkl')):\n with open(bbo.get_path('save_game.pkl'), 'rb') as load_game:\n data = pickle.load(load_game)\n for variable in vars(init.game_state):\n setattr(init.game_state, variable, getattr(data, variable))\n init.game_state.start_time += time.time() ... | <|body_start_0|>
if os.path.isfile(bbo.get_path('save_game.pkl')):
with open(bbo.get_path('save_game.pkl'), 'rb') as load_game:
data = pickle.load(load_game)
for variable in vars(init.game_state):
setattr(init.game_state, variable, getattr(data, variable))... | Screen for the main menu | StartMenu | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StartMenu:
"""Screen for the main menu"""
def try_loading(self, *args):
"""Loading game action"""
<|body_0|>
def new_game(self, *args):
"""New game action"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if os.path.isfile(bbo.get_path('save_game.... | stack_v2_sparse_classes_75kplus_train_069670 | 1,892 | no_license | [
{
"docstring": "Loading game action",
"name": "try_loading",
"signature": "def try_loading(self, *args)"
},
{
"docstring": "New game action",
"name": "new_game",
"signature": "def new_game(self, *args)"
}
] | 2 | stack_v2_sparse_classes_30k_train_049300 | Implement the Python class `StartMenu` described below.
Class description:
Screen for the main menu
Method signatures and docstrings:
- def try_loading(self, *args): Loading game action
- def new_game(self, *args): New game action | Implement the Python class `StartMenu` described below.
Class description:
Screen for the main menu
Method signatures and docstrings:
- def try_loading(self, *args): Loading game action
- def new_game(self, *args): New game action
<|skeleton|>
class StartMenu:
"""Screen for the main menu"""
def try_loading(... | 49918b9cb34d928d17460d2da6f026404a4c62fd | <|skeleton|>
class StartMenu:
"""Screen for the main menu"""
def try_loading(self, *args):
"""Loading game action"""
<|body_0|>
def new_game(self, *args):
"""New game action"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class StartMenu:
"""Screen for the main menu"""
def try_loading(self, *args):
"""Loading game action"""
if os.path.isfile(bbo.get_path('save_game.pkl')):
with open(bbo.get_path('save_game.pkl'), 'rb') as load_game:
data = pickle.load(load_game)
for variab... | the_stack_v2_python_sparse | Implementation/PythonFiles/Screens/screen_start.py | IoanaParfene/Survive | train | 2 |
029dd0d81202ed031f6a8b345be3a2818af558a2 | [
"if root is None:\n return None\n\ndef build(n):\n res = TreeNode(n.val)\n r = None\n for c in n.children or []:\n n2 = build(c)\n if r is None:\n res.right, r = (n2, n2)\n else:\n r.left = n2\n r = n2\n return res\nreturn build(root)",
"if data... | <|body_start_0|>
if root is None:
return None
def build(n):
res = TreeNode(n.val)
r = None
for c in n.children or []:
n2 = build(c)
if r is None:
res.right, r = (n2, n2)
else:
... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def encode(self, root):
"""Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode"""
<|body_0|>
def decode(self, data):
"""Decodes your binary tree to an n-ary tree. :type data: TreeNode :rtype: Node"""
<|body_1|>
<|end_skeleton|>
... | stack_v2_sparse_classes_75kplus_train_069671 | 1,459 | no_license | [
{
"docstring": "Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode",
"name": "encode",
"signature": "def encode(self, root)"
},
{
"docstring": "Decodes your binary tree to an n-ary tree. :type data: TreeNode :rtype: Node",
"name": "decode",
"signature": "def decode... | 2 | stack_v2_sparse_classes_30k_train_013102 | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def encode(self, root): Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode
- def decode(self, data): Decodes your binary tree to an n-ary tree. :type data: TreeN... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def encode(self, root): Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode
- def decode(self, data): Decodes your binary tree to an n-ary tree. :type data: TreeN... | 0e089be7f7757e64276a7bc6eb2d454e214c3349 | <|skeleton|>
class Codec:
def encode(self, root):
"""Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode"""
<|body_0|>
def decode(self, data):
"""Decodes your binary tree to an n-ary tree. :type data: TreeNode :rtype: Node"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Codec:
def encode(self, root):
"""Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode"""
if root is None:
return None
def build(n):
res = TreeNode(n.val)
r = None
for c in n.children or []:
n2 = buil... | the_stack_v2_python_sparse | 04/31-encode-n-ary-tree-to-binary-tree/main.py | tsholmes/leetcode-go | train | 0 | |
c71bb5a15a2f37dfbf88bcb65ab6a7c0b4362e66 | [
"words = [word for word in re.sub('[^\\\\w]', ' ', paragraph).lower().split() if word not in banned]\ncounts = D(int)\nfor word in words:\n counts[word] += 1\nreturn max(counts, key=counts.get)",
"words = [word for word in re.sub('[^\\\\w]', ' ', paragraph).lower().split() if word not in banned]\ncounts = C(wo... | <|body_start_0|>
words = [word for word in re.sub('[^\\w]', ' ', paragraph).lower().split() if word not in banned]
counts = D(int)
for word in words:
counts[word] += 1
return max(counts, key=counts.get)
<|end_body_0|>
<|body_start_1|>
words = [word for word in re.sub... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def mostCommonWord_1(self, paragraph: str, banned: List[str]) -> str:
"""1. use regex: substutute any character which is not word with space 2. defaultdict and max"""
<|body_0|>
def mostCommonWord_2(self, paragraph: str, banned: List[str]) -> str:
"""1. use... | stack_v2_sparse_classes_75kplus_train_069672 | 1,770 | no_license | [
{
"docstring": "1. use regex: substutute any character which is not word with space 2. defaultdict and max",
"name": "mostCommonWord_1",
"signature": "def mostCommonWord_1(self, paragraph: str, banned: List[str]) -> str"
},
{
"docstring": "1. use regex: substutute any character which is not word... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mostCommonWord_1(self, paragraph: str, banned: List[str]) -> str: 1. use regex: substutute any character which is not word with space 2. defaultdict and max
- def mostCommonW... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mostCommonWord_1(self, paragraph: str, banned: List[str]) -> str: 1. use regex: substutute any character which is not word with space 2. defaultdict and max
- def mostCommonW... | 8e1825e2b78c3897bde813520c1af5608a7c576c | <|skeleton|>
class Solution:
def mostCommonWord_1(self, paragraph: str, banned: List[str]) -> str:
"""1. use regex: substutute any character which is not word with space 2. defaultdict and max"""
<|body_0|>
def mostCommonWord_2(self, paragraph: str, banned: List[str]) -> str:
"""1. use... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def mostCommonWord_1(self, paragraph: str, banned: List[str]) -> str:
"""1. use regex: substutute any character which is not word with space 2. defaultdict and max"""
words = [word for word in re.sub('[^\\w]', ' ', paragraph).lower().split() if word not in banned]
counts = D(... | the_stack_v2_python_sparse | leetcode/string/leetcode_819_most_common_word.py | ecpark4545/algorithms | train | 0 | |
4704fb5bb98f16ea37779ddadde55f974c7b9a34 | [
"response = await self._api.get('/v1/status/leader')\nif response.status == 200:\n return response.body",
"response = await self._api.get('/v1/status/peers')\nif response.status == 200:\n return set(response.body)"
] | <|body_start_0|>
response = await self._api.get('/v1/status/leader')
if response.status == 200:
return response.body
<|end_body_0|>
<|body_start_1|>
response = await self._api.get('/v1/status/peers')
if response.status == 200:
return set(response.body)
<|end_body... | Get information about the status of the Consul cluster. .. note:: this information is generally very low level and not often useful for clients. | StatusEndpoint | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StatusEndpoint:
"""Get information about the status of the Consul cluster. .. note:: this information is generally very low level and not often useful for clients."""
async def leader(self):
"""Returns the current Raft leader Returns: str: address of leader such as ``10.1.10.12:8300`... | stack_v2_sparse_classes_75kplus_train_069673 | 1,254 | permissive | [
{
"docstring": "Returns the current Raft leader Returns: str: address of leader such as ``10.1.10.12:8300``",
"name": "leader",
"signature": "async def leader(self)"
},
{
"docstring": "Returns the current Raft peer set Returns: Collection: addresses of peers This endpoint retrieves the Raft peer... | 2 | stack_v2_sparse_classes_30k_train_005334 | Implement the Python class `StatusEndpoint` described below.
Class description:
Get information about the status of the Consul cluster. .. note:: this information is generally very low level and not often useful for clients.
Method signatures and docstrings:
- async def leader(self): Returns the current Raft leader R... | Implement the Python class `StatusEndpoint` described below.
Class description:
Get information about the status of the Consul cluster. .. note:: this information is generally very low level and not often useful for clients.
Method signatures and docstrings:
- async def leader(self): Returns the current Raft leader R... | 02f7a529d7dc2e49bed942111067aa5faf320e90 | <|skeleton|>
class StatusEndpoint:
"""Get information about the status of the Consul cluster. .. note:: this information is generally very low level and not often useful for clients."""
async def leader(self):
"""Returns the current Raft leader Returns: str: address of leader such as ``10.1.10.12:8300`... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class StatusEndpoint:
"""Get information about the status of the Consul cluster. .. note:: this information is generally very low level and not often useful for clients."""
async def leader(self):
"""Returns the current Raft leader Returns: str: address of leader such as ``10.1.10.12:8300``"""
... | the_stack_v2_python_sparse | aioconsul/client/status_endpoint.py | johnnoone/aioconsul | train | 8 |
44a3a37cfd6486f4e627abb7f127b2e5b5ded5b7 | [
"self.vocab_size = vocab_size\nself.embed_dim = embed_dim\nself.embed_data = embed_data\nself.regularizer = regularizer if trainable == True else None\nself.trainable = trainable\nself.scope = scope\nself.device_spec = get_device_spec(default_gpu_id, num_gpus)\nwith tf.variable_scope(self.scope, reuse=tf.AUTO_REUSE... | <|body_start_0|>
self.vocab_size = vocab_size
self.embed_dim = embed_dim
self.embed_data = embed_data
self.regularizer = regularizer if trainable == True else None
self.trainable = trainable
self.scope = scope
self.device_spec = get_device_spec(default_gpu_id, num... | Pretrained Embedding layer | PretrainedEmbedding | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PretrainedEmbedding:
"""Pretrained Embedding layer"""
def __init__(self, vocab_size, embed_dim, embed_data, num_gpus=1, default_gpu_id=0, regularizer=None, trainable=True, scope='pretrained_embedding'):
"""initialize pretrained embedding layer"""
<|body_0|>
def __call__(... | stack_v2_sparse_classes_75kplus_train_069674 | 3,009 | permissive | [
{
"docstring": "initialize pretrained embedding layer",
"name": "__init__",
"signature": "def __init__(self, vocab_size, embed_dim, embed_data, num_gpus=1, default_gpu_id=0, regularizer=None, trainable=True, scope='pretrained_embedding')"
},
{
"docstring": "call pretrained embedding layer",
... | 2 | stack_v2_sparse_classes_30k_train_031934 | Implement the Python class `PretrainedEmbedding` described below.
Class description:
Pretrained Embedding layer
Method signatures and docstrings:
- def __init__(self, vocab_size, embed_dim, embed_data, num_gpus=1, default_gpu_id=0, regularizer=None, trainable=True, scope='pretrained_embedding'): initialize pretrained... | Implement the Python class `PretrainedEmbedding` described below.
Class description:
Pretrained Embedding layer
Method signatures and docstrings:
- def __init__(self, vocab_size, embed_dim, embed_data, num_gpus=1, default_gpu_id=0, regularizer=None, trainable=True, scope='pretrained_embedding'): initialize pretrained... | 05fcbec15e359e3db86af6c3798c13be8a6c58ee | <|skeleton|>
class PretrainedEmbedding:
"""Pretrained Embedding layer"""
def __init__(self, vocab_size, embed_dim, embed_data, num_gpus=1, default_gpu_id=0, regularizer=None, trainable=True, scope='pretrained_embedding'):
"""initialize pretrained embedding layer"""
<|body_0|>
def __call__(... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PretrainedEmbedding:
"""Pretrained Embedding layer"""
def __init__(self, vocab_size, embed_dim, embed_data, num_gpus=1, default_gpu_id=0, regularizer=None, trainable=True, scope='pretrained_embedding'):
"""initialize pretrained embedding layer"""
self.vocab_size = vocab_size
self.... | the_stack_v2_python_sparse | sequence_labeling/layer/embedding.py | stevezheng23/sequence_labeling_tf | train | 18 |
507a01d9702a9803a8505889b8854a12345e8ea2 | [
"self.children_count = children_count\nself.dc_list = dc_list\nself.replication_strategy = replication_strategy",
"if dictionary is None:\n return None\nchildren_count = dictionary.get('childrenCount')\ndc_list = dictionary.get('dcList')\nreplication_strategy = dictionary.get('replicationStrategy')\nreturn cls... | <|body_start_0|>
self.children_count = children_count
self.dc_list = dc_list
self.replication_strategy = replication_strategy
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
children_count = dictionary.get('childrenCount')
dc_list = diction... | Implementation of the 'CassandraKeyspace' model. Specifies an Object containing information about a Cassandra Keyspace. Attributes: children_count (int): Number of documents in this bucket. dc_list (list of string): If the replication strategy is set as kNetwork, then dc_list will have a list of data centers to which t... | CassandraKeyspace | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CassandraKeyspace:
"""Implementation of the 'CassandraKeyspace' model. Specifies an Object containing information about a Cassandra Keyspace. Attributes: children_count (int): Number of documents in this bucket. dc_list (list of string): If the replication strategy is set as kNetwork, then dc_lis... | stack_v2_sparse_classes_75kplus_train_069675 | 2,167 | permissive | [
{
"docstring": "Constructor for the CassandraKeyspace class",
"name": "__init__",
"signature": "def __init__(self, children_count=None, dc_list=None, replication_strategy=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary rep... | 2 | stack_v2_sparse_classes_30k_val_002732 | Implement the Python class `CassandraKeyspace` described below.
Class description:
Implementation of the 'CassandraKeyspace' model. Specifies an Object containing information about a Cassandra Keyspace. Attributes: children_count (int): Number of documents in this bucket. dc_list (list of string): If the replication s... | Implement the Python class `CassandraKeyspace` described below.
Class description:
Implementation of the 'CassandraKeyspace' model. Specifies an Object containing information about a Cassandra Keyspace. Attributes: children_count (int): Number of documents in this bucket. dc_list (list of string): If the replication s... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class CassandraKeyspace:
"""Implementation of the 'CassandraKeyspace' model. Specifies an Object containing information about a Cassandra Keyspace. Attributes: children_count (int): Number of documents in this bucket. dc_list (list of string): If the replication strategy is set as kNetwork, then dc_lis... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CassandraKeyspace:
"""Implementation of the 'CassandraKeyspace' model. Specifies an Object containing information about a Cassandra Keyspace. Attributes: children_count (int): Number of documents in this bucket. dc_list (list of string): If the replication strategy is set as kNetwork, then dc_list will have a... | the_stack_v2_python_sparse | cohesity_management_sdk/models/cassandra_keyspace.py | cohesity/management-sdk-python | train | 24 |
e63f6accc744295ac34222e1e8b5c59f05dc8d3d | [
"if not email:\n raise ValueError('Users must have an email address')\nuser = self.model(email=self.normalize_email(email))\nuser.set_password(password)\nuser.save(using=self._db)\nreturn user",
"user = self.create_user(email, password=password)\nuser.is_admin = True\nuser.save(using=self._db)\nreturn user"
] | <|body_start_0|>
if not email:
raise ValueError('Users must have an email address')
user = self.model(email=self.normalize_email(email))
user.set_password(password)
user.save(using=self._db)
return user
<|end_body_0|>
<|body_start_1|>
user = self.create_user(... | MyUserManager | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MyUserManager:
def create_user(self, email, password=None):
"""Creates and saves a User with the given email, date of birth and password."""
<|body_0|>
def create_superuser(self, email, password=None):
"""Creates and saves a superuser with the given email, date of bi... | stack_v2_sparse_classes_75kplus_train_069676 | 4,400 | permissive | [
{
"docstring": "Creates and saves a User with the given email, date of birth and password.",
"name": "create_user",
"signature": "def create_user(self, email, password=None)"
},
{
"docstring": "Creates and saves a superuser with the given email, date of birth and password.",
"name": "create_... | 2 | stack_v2_sparse_classes_30k_train_021627 | Implement the Python class `MyUserManager` described below.
Class description:
Implement the MyUserManager class.
Method signatures and docstrings:
- def create_user(self, email, password=None): Creates and saves a User with the given email, date of birth and password.
- def create_superuser(self, email, password=Non... | Implement the Python class `MyUserManager` described below.
Class description:
Implement the MyUserManager class.
Method signatures and docstrings:
- def create_user(self, email, password=None): Creates and saves a User with the given email, date of birth and password.
- def create_superuser(self, email, password=Non... | 0b61f67ce3158cf727d3570daf60bff1b0417360 | <|skeleton|>
class MyUserManager:
def create_user(self, email, password=None):
"""Creates and saves a User with the given email, date of birth and password."""
<|body_0|>
def create_superuser(self, email, password=None):
"""Creates and saves a superuser with the given email, date of bi... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MyUserManager:
def create_user(self, email, password=None):
"""Creates and saves a User with the given email, date of birth and password."""
if not email:
raise ValueError('Users must have an email address')
user = self.model(email=self.normalize_email(email))
user.... | the_stack_v2_python_sparse | Business_Coaching_Platform/user/models.py | SDOS2020/Team_1_Business_Coaching_Platform | train | 0 | |
1c1abc6534eabe9708d593c81417ce22b16bcb74 | [
"self.log = logging.getLogger('autopyfactory')\nself.parent = parent\nself.subdir = subdir\nself.path = os.path.join(parent.path, subdir)\nself.log.debug('SubDir: Object initialized for subdir %s.' % self.subdir)",
"self.log.debug('rm for subdir %s: Starting.' % self.subdir)\ndelta_days = self.parent.delta_t.days... | <|body_start_0|>
self.log = logging.getLogger('autopyfactory')
self.parent = parent
self.subdir = subdir
self.path = os.path.join(parent.path, subdir)
self.log.debug('SubDir: Object initialized for subdir %s.' % self.subdir)
<|end_body_0|>
<|body_start_1|>
self.log.debug... | class to handle each subdirectory. Subdirs look like <logDir>/2011-08-11/ANALY_BNL/ | SubDir | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SubDir:
"""class to handle each subdirectory. Subdirs look like <logDir>/2011-08-11/ANALY_BNL/"""
def __init__(self, parent, subdir):
"""parent is a Dir object subdir is the APFQname"""
<|body_0|>
def rm(self, keepdays):
"""tries to delete a subdirectory, but onl... | stack_v2_sparse_classes_75kplus_train_069677 | 8,015 | permissive | [
{
"docstring": "parent is a Dir object subdir is the APFQname",
"name": "__init__",
"signature": "def __init__(self, parent, subdir)"
},
{
"docstring": "tries to delete a subdirectory, but only if the timing of the parent is older than what keepdays object has to say about it",
"name": "rm",... | 2 | stack_v2_sparse_classes_30k_train_048487 | Implement the Python class `SubDir` described below.
Class description:
class to handle each subdirectory. Subdirs look like <logDir>/2011-08-11/ANALY_BNL/
Method signatures and docstrings:
- def __init__(self, parent, subdir): parent is a Dir object subdir is the APFQname
- def rm(self, keepdays): tries to delete a ... | Implement the Python class `SubDir` described below.
Class description:
class to handle each subdirectory. Subdirs look like <logDir>/2011-08-11/ANALY_BNL/
Method signatures and docstrings:
- def __init__(self, parent, subdir): parent is a Dir object subdir is the APFQname
- def rm(self, keepdays): tries to delete a ... | 9d0d3890b38df2573045111182e45117ed232a46 | <|skeleton|>
class SubDir:
"""class to handle each subdirectory. Subdirs look like <logDir>/2011-08-11/ANALY_BNL/"""
def __init__(self, parent, subdir):
"""parent is a Dir object subdir is the APFQname"""
<|body_0|>
def rm(self, keepdays):
"""tries to delete a subdirectory, but onl... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SubDir:
"""class to handle each subdirectory. Subdirs look like <logDir>/2011-08-11/ANALY_BNL/"""
def __init__(self, parent, subdir):
"""parent is a Dir object subdir is the APFQname"""
self.log = logging.getLogger('autopyfactory')
self.parent = parent
self.subdir = subdir... | the_stack_v2_python_sparse | autopyfactory/cleanlogs.py | PanDAWMS/autopyfactory | train | 2 |
2993567a9cf0ae2830d533a69bdc80c7caf1d259 | [
"total = sum(nums)\nif total < target or (target + total) % 2 == 1:\n return 0\nreturn self.subset_sum_ways(nums, (target + total) / 2)",
"dp = [0] * (subtotal + 1)\ndp[0] = 1\nfor num in nums:\n for i in range(subtotal, num - 1, -1):\n dp[i] += dp[i - num]\nreturn dp[-1]"
] | <|body_start_0|>
total = sum(nums)
if total < target or (target + total) % 2 == 1:
return 0
return self.subset_sum_ways(nums, (target + total) / 2)
<|end_body_0|>
<|body_start_1|>
dp = [0] * (subtotal + 1)
dp[0] = 1
for num in nums:
for i in range... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findTargetSumWays(self, nums, target):
""":type nums: List[int] :type S: int :rtype: int"""
<|body_0|>
def subset_sum_ways(self, nums, subtotal):
"""dp[i]: ways to pick a subset of nums that sum up to i (target) dp[i] = dp[i - nums[0]] + ... + dp[i - nu... | stack_v2_sparse_classes_75kplus_train_069678 | 2,069 | permissive | [
{
"docstring": ":type nums: List[int] :type S: int :rtype: int",
"name": "findTargetSumWays",
"signature": "def findTargetSumWays(self, nums, target)"
},
{
"docstring": "dp[i]: ways to pick a subset of nums that sum up to i (target) dp[i] = dp[i - nums[0]] + ... + dp[i - nums[-1]]",
"name": ... | 2 | stack_v2_sparse_classes_30k_train_022026 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findTargetSumWays(self, nums, target): :type nums: List[int] :type S: int :rtype: int
- def subset_sum_ways(self, nums, subtotal): dp[i]: ways to pick a subset of nums that s... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findTargetSumWays(self, nums, target): :type nums: List[int] :type S: int :rtype: int
- def subset_sum_ways(self, nums, subtotal): dp[i]: ways to pick a subset of nums that s... | 36b02feea04b892f1256de090c4fcf7b6aa98873 | <|skeleton|>
class Solution:
def findTargetSumWays(self, nums, target):
""":type nums: List[int] :type S: int :rtype: int"""
<|body_0|>
def subset_sum_ways(self, nums, subtotal):
"""dp[i]: ways to pick a subset of nums that sum up to i (target) dp[i] = dp[i - nums[0]] + ... + dp[i - nu... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def findTargetSumWays(self, nums, target):
""":type nums: List[int] :type S: int :rtype: int"""
total = sum(nums)
if total < target or (target + total) % 2 == 1:
return 0
return self.subset_sum_ways(nums, (target + total) / 2)
def subset_sum_ways(self... | the_stack_v2_python_sparse | algorithms/dynamic_programming/target_sum.py | kevinshenyang07/Data-Structures-and-Algorithms | train | 0 | |
3f3050d43bb64aa123d7b79d4b59dd09f593bf16 | [
"if __debug__:\n logger.debug('Creating Publisher...')\nfrom kafka import KafkaProducer\nbootstrap_server_info = str(bootstrap_server).split(':')\nbootstrap_server_ip = str(socket.gethostbyname(bootstrap_server_info[0]))\nbootstrap_server_port = str(bootstrap_server_info[1])\nself.kafka_producer = KafkaProducer(... | <|body_start_0|>
if __debug__:
logger.debug('Creating Publisher...')
from kafka import KafkaProducer
bootstrap_server_info = str(bootstrap_server).split(':')
bootstrap_server_ip = str(socket.gethostbyname(bootstrap_server_info[0]))
bootstrap_server_port = str(bootstra... | ODS Publisher connector implementation. Attributes: - kafka_producer: KafkaProducer instance + type: KafkaProducer | ODSPublisher | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ODSPublisher:
"""ODS Publisher connector implementation. Attributes: - kafka_producer: KafkaProducer instance + type: KafkaProducer"""
def __init__(self, bootstrap_server: str) -> None:
"""Create a new ODSPublisher instance. :param bootstrap_server: Associated boostrap server."""
... | stack_v2_sparse_classes_75kplus_train_069679 | 6,395 | permissive | [
{
"docstring": "Create a new ODSPublisher instance. :param bootstrap_server: Associated boostrap server.",
"name": "__init__",
"signature": "def __init__(self, bootstrap_server: str) -> None"
},
{
"docstring": "Publish the given message to the given topic. :param topic: Message topic. :param mes... | 2 | stack_v2_sparse_classes_30k_train_054415 | Implement the Python class `ODSPublisher` described below.
Class description:
ODS Publisher connector implementation. Attributes: - kafka_producer: KafkaProducer instance + type: KafkaProducer
Method signatures and docstrings:
- def __init__(self, bootstrap_server: str) -> None: Create a new ODSPublisher instance. :p... | Implement the Python class `ODSPublisher` described below.
Class description:
ODS Publisher connector implementation. Attributes: - kafka_producer: KafkaProducer instance + type: KafkaProducer
Method signatures and docstrings:
- def __init__(self, bootstrap_server: str) -> None: Create a new ODSPublisher instance. :p... | 5f7a31436d0e6f5acbeb66fa36ab8aad18dc4092 | <|skeleton|>
class ODSPublisher:
"""ODS Publisher connector implementation. Attributes: - kafka_producer: KafkaProducer instance + type: KafkaProducer"""
def __init__(self, bootstrap_server: str) -> None:
"""Create a new ODSPublisher instance. :param bootstrap_server: Associated boostrap server."""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ODSPublisher:
"""ODS Publisher connector implementation. Attributes: - kafka_producer: KafkaProducer instance + type: KafkaProducer"""
def __init__(self, bootstrap_server: str) -> None:
"""Create a new ODSPublisher instance. :param bootstrap_server: Associated boostrap server."""
if __deb... | the_stack_v2_python_sparse | compss/programming_model/bindings/python/src/pycompss/streams/components/objects/kafka_connectors.py | bsc-wdc/compss | train | 39 |
6694be238973704f86d12271df5cca7ddcf98cae | [
"global g_header\nmtt.makeTempDirParent()\nfor i in xrange(0, len(g_overlappingBlocks)):\n tmpDir = os.path.abspath(mtt.makeTempDir('find'))\n testMafPath, g_header = mtt.testFile(os.path.abspath(os.path.join(tmpDir, 'test.maf')), g_overlappingBlocks[i][0], g_headers)\n parent = os.path.dirname(os.path.dir... | <|body_start_0|>
global g_header
mtt.makeTempDirParent()
for i in xrange(0, len(g_overlappingBlocks)):
tmpDir = os.path.abspath(mtt.makeTempDir('find'))
testMafPath, g_header = mtt.testFile(os.path.abspath(os.path.join(tmpDir, 'test.maf')), g_overlappingBlocks[i][0], g_he... | FindTest | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FindTest:
def testFind(self):
"""mafPositionFinder should report information about matching sequences within blocks."""
<|body_0|>
def testNonFind(self):
"""mafPositionFinder should not report any lines when blocks do not match."""
<|body_1|>
def testMem... | stack_v2_sparse_classes_75kplus_train_069680 | 10,932 | permissive | [
{
"docstring": "mafPositionFinder should report information about matching sequences within blocks.",
"name": "testFind",
"signature": "def testFind(self)"
},
{
"docstring": "mafPositionFinder should not report any lines when blocks do not match.",
"name": "testNonFind",
"signature": "de... | 4 | stack_v2_sparse_classes_30k_train_018512 | Implement the Python class `FindTest` described below.
Class description:
Implement the FindTest class.
Method signatures and docstrings:
- def testFind(self): mafPositionFinder should report information about matching sequences within blocks.
- def testNonFind(self): mafPositionFinder should not report any lines whe... | Implement the Python class `FindTest` described below.
Class description:
Implement the FindTest class.
Method signatures and docstrings:
- def testFind(self): mafPositionFinder should report information about matching sequences within blocks.
- def testNonFind(self): mafPositionFinder should not report any lines whe... | 4e5b5de3f275f61b36b9762824cc1edbead31820 | <|skeleton|>
class FindTest:
def testFind(self):
"""mafPositionFinder should report information about matching sequences within blocks."""
<|body_0|>
def testNonFind(self):
"""mafPositionFinder should not report any lines when blocks do not match."""
<|body_1|>
def testMem... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FindTest:
def testFind(self):
"""mafPositionFinder should report information about matching sequences within blocks."""
global g_header
mtt.makeTempDirParent()
for i in xrange(0, len(g_overlappingBlocks)):
tmpDir = os.path.abspath(mtt.makeTempDir('find'))
... | the_stack_v2_python_sparse | mafPositionFinder/src/test.mafPositionFinder.py | dentearl/mafTools | train | 77 | |
29ba155eaa0af4e4b8accade7e1bbad3cd11c528 | [
"pool = self.context['pool']\nuser = data\nquery_membership = Membership.objects.filter(pool=pool, user=user)\nif query_membership.exists():\n raise serializers.ValidationError('User is already member of this pool')\nreturn data",
"try:\n invitation = Invitation.objects.get(code=data, pool=self.context['poo... | <|body_start_0|>
pool = self.context['pool']
user = data
query_membership = Membership.objects.filter(pool=pool, user=user)
if query_membership.exists():
raise serializers.ValidationError('User is already member of this pool')
return data
<|end_body_0|>
<|body_start_... | Add member serializer. Handle the addition of a new member to a pool. Pool object must be provided in the context. | AddMemberSerializer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AddMemberSerializer:
"""Add member serializer. Handle the addition of a new member to a pool. Pool object must be provided in the context."""
def validate_user(self, data):
"""Verify user isn't already a member."""
<|body_0|>
def validate_invitation_code(self, data):
... | stack_v2_sparse_classes_75kplus_train_069681 | 3,336 | no_license | [
{
"docstring": "Verify user isn't already a member.",
"name": "validate_user",
"signature": "def validate_user(self, data)"
},
{
"docstring": "Verify code exists and that it is related to the pool.",
"name": "validate_invitation_code",
"signature": "def validate_invitation_code(self, dat... | 4 | stack_v2_sparse_classes_30k_train_035899 | Implement the Python class `AddMemberSerializer` described below.
Class description:
Add member serializer. Handle the addition of a new member to a pool. Pool object must be provided in the context.
Method signatures and docstrings:
- def validate_user(self, data): Verify user isn't already a member.
- def validate_... | Implement the Python class `AddMemberSerializer` described below.
Class description:
Add member serializer. Handle the addition of a new member to a pool. Pool object must be provided in the context.
Method signatures and docstrings:
- def validate_user(self, data): Verify user isn't already a member.
- def validate_... | ee003cd4cecbcb3ec1a490a3259e8914f78b11cd | <|skeleton|>
class AddMemberSerializer:
"""Add member serializer. Handle the addition of a new member to a pool. Pool object must be provided in the context."""
def validate_user(self, data):
"""Verify user isn't already a member."""
<|body_0|>
def validate_invitation_code(self, data):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AddMemberSerializer:
"""Add member serializer. Handle the addition of a new member to a pool. Pool object must be provided in the context."""
def validate_user(self, data):
"""Verify user isn't already a member."""
pool = self.context['pool']
user = data
query_membership =... | the_stack_v2_python_sparse | grupalcar/pools/serializers/memberships.py | adnrbp/GrupalCar-API | train | 1 |
a08cacbc0cec72acdb9f5346003fbc8dda11a26c | [
"self.cell_shape = cell_shape\nself.aspect_ratio = aspect_ratio\nself.dim = dim\nself.position_offset = position_offset\nif isinstance(cell_padding, int):\n self.cell_padding = (cell_padding, cell_padding)\nelse:\n self.cell_padding = cell_padding",
"if self.cell_shape == 'rect':\n bounding_box_sizes = n... | <|body_start_0|>
self.cell_shape = cell_shape
self.aspect_ratio = aspect_ratio
self.dim = dim
self.position_offset = position_offset
if isinstance(cell_padding, int):
self.cell_padding = (cell_padding, cell_padding)
else:
self.cell_padding = cell_p... | Provide functionalities for laying out actors in a 2D grid fashion. The `GridLayout` class lays the actors in a 2D structured grid aligned with the xy-plane. | GridLayout | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GridLayout:
"""Provide functionalities for laying out actors in a 2D grid fashion. The `GridLayout` class lays the actors in a 2D structured grid aligned with the xy-plane."""
def __init__(self, cell_padding=0, cell_shape='rect', aspect_ratio=16 / 9.0, dim=None, position_offset=(0, 0, 0)):
... | stack_v2_sparse_classes_75kplus_train_069682 | 18,098 | permissive | [
{
"docstring": "Parameters ---------- cell_padding : 2-tuple of float or float (optional) Each grid cell will be padded according to (pad_x, pad_y) i.e. horizontally and vertically. Padding is evenly distributed on each side of the cell. If a single float is provided then both pad_x and pad_y will have the same... | 4 | null | Implement the Python class `GridLayout` described below.
Class description:
Provide functionalities for laying out actors in a 2D grid fashion. The `GridLayout` class lays the actors in a 2D structured grid aligned with the xy-plane.
Method signatures and docstrings:
- def __init__(self, cell_padding=0, cell_shape='r... | Implement the Python class `GridLayout` described below.
Class description:
Provide functionalities for laying out actors in a 2D grid fashion. The `GridLayout` class lays the actors in a 2D structured grid aligned with the xy-plane.
Method signatures and docstrings:
- def __init__(self, cell_padding=0, cell_shape='r... | e595bad0246899d58d24121dcc291eb050721f9f | <|skeleton|>
class GridLayout:
"""Provide functionalities for laying out actors in a 2D grid fashion. The `GridLayout` class lays the actors in a 2D structured grid aligned with the xy-plane."""
def __init__(self, cell_padding=0, cell_shape='rect', aspect_ratio=16 / 9.0, dim=None, position_offset=(0, 0, 0)):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GridLayout:
"""Provide functionalities for laying out actors in a 2D grid fashion. The `GridLayout` class lays the actors in a 2D structured grid aligned with the xy-plane."""
def __init__(self, cell_padding=0, cell_shape='rect', aspect_ratio=16 / 9.0, dim=None, position_offset=(0, 0, 0)):
"""Par... | the_stack_v2_python_sparse | fury/layout.py | fury-gl/fury | train | 209 |
c0aba2a29472b9728ea23a5b9899bb3bb564bc1d | [
"self.first_name = other.first_name or self.first_name\nself.last_name = other.last_name or self.last_name\nself.last_broadcast = get_latest_datetime(self.last_broadcast, other.last_broadcast)\nif not other.contacts:\n return self\nif not self.contacts:\n self.contacts = []\nfor i in range(len(other.contacts)... | <|body_start_0|>
self.first_name = other.first_name or self.first_name
self.last_name = other.last_name or self.last_name
self.last_broadcast = get_latest_datetime(self.last_broadcast, other.last_broadcast)
if not other.contacts:
return self
if not self.contacts:
... | Used to store Student-Events tx / ack metadata. | StudentMarker | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StudentMarker:
"""Used to store Student-Events tx / ack metadata."""
def merge(self, other):
"""Merge this StudentMarker entity with another StudentMarker."""
<|body_0|>
def to_dict(self):
"""Return a MethodMarker entity represented as a dict of values."""
... | stack_v2_sparse_classes_75kplus_train_069683 | 7,163 | no_license | [
{
"docstring": "Merge this StudentMarker entity with another StudentMarker.",
"name": "merge",
"signature": "def merge(self, other)"
},
{
"docstring": "Return a MethodMarker entity represented as a dict of values.",
"name": "to_dict",
"signature": "def to_dict(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_008286 | Implement the Python class `StudentMarker` described below.
Class description:
Used to store Student-Events tx / ack metadata.
Method signatures and docstrings:
- def merge(self, other): Merge this StudentMarker entity with another StudentMarker.
- def to_dict(self): Return a MethodMarker entity represented as a dict... | Implement the Python class `StudentMarker` described below.
Class description:
Used to store Student-Events tx / ack metadata.
Method signatures and docstrings:
- def merge(self, other): Merge this StudentMarker entity with another StudentMarker.
- def to_dict(self): Return a MethodMarker entity represented as a dict... | e23c01d33553c3e7350032a5338597d7363a2521 | <|skeleton|>
class StudentMarker:
"""Used to store Student-Events tx / ack metadata."""
def merge(self, other):
"""Merge this StudentMarker entity with another StudentMarker."""
<|body_0|>
def to_dict(self):
"""Return a MethodMarker entity represented as a dict of values."""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class StudentMarker:
"""Used to store Student-Events tx / ack metadata."""
def merge(self, other):
"""Merge this StudentMarker entity with another StudentMarker."""
self.first_name = other.first_name or self.first_name
self.last_name = other.last_name or self.last_name
self.last... | the_stack_v2_python_sparse | SOSBeacon/sosbeacon/event/student_marker.py | SOSbeacon/SchoolBeacon-GAE | train | 0 |
2af45345eaf7ee58c03a72f6d3222caff1433bcc | [
"ctx = super().get_context_data(**kwargs)\nlookup = {reverse('supplier-index'): {'title': _('Suppliers'), 'button_text': _('New Supplier'), 'filters': {'is_supplier': 'true'}, 'pagetype': 'suppliers'}, reverse('manufacturer-index'): {'title': _('Manufacturers'), 'button_text': _('New Manufacturer'), 'filters': {'is... | <|body_start_0|>
ctx = super().get_context_data(**kwargs)
lookup = {reverse('supplier-index'): {'title': _('Suppliers'), 'button_text': _('New Supplier'), 'filters': {'is_supplier': 'true'}, 'pagetype': 'suppliers'}, reverse('manufacturer-index'): {'title': _('Manufacturers'), 'button_text': _('New Manu... | View for displaying list of companies. | CompanyIndex | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CompanyIndex:
"""View for displaying list of companies."""
def get_context_data(self, **kwargs):
"""Add extra context data to the company index page"""
<|body_0|>
def get_queryset(self):
"""Retrieve the Company queryset based on HTTP request parameters. - supplie... | stack_v2_sparse_classes_75kplus_train_069684 | 3,566 | permissive | [
{
"docstring": "Add extra context data to the company index page",
"name": "get_context_data",
"signature": "def get_context_data(self, **kwargs)"
},
{
"docstring": "Retrieve the Company queryset based on HTTP request parameters. - supplier: Filter by supplier - customer: Filter by customer",
... | 2 | stack_v2_sparse_classes_30k_train_043975 | Implement the Python class `CompanyIndex` described below.
Class description:
View for displaying list of companies.
Method signatures and docstrings:
- def get_context_data(self, **kwargs): Add extra context data to the company index page
- def get_queryset(self): Retrieve the Company queryset based on HTTP request ... | Implement the Python class `CompanyIndex` described below.
Class description:
View for displaying list of companies.
Method signatures and docstrings:
- def get_context_data(self, **kwargs): Add extra context data to the company index page
- def get_queryset(self): Retrieve the Company queryset based on HTTP request ... | e88a8e99a5f0b201c67a95cba097c729f090d5e2 | <|skeleton|>
class CompanyIndex:
"""View for displaying list of companies."""
def get_context_data(self, **kwargs):
"""Add extra context data to the company index page"""
<|body_0|>
def get_queryset(self):
"""Retrieve the Company queryset based on HTTP request parameters. - supplie... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CompanyIndex:
"""View for displaying list of companies."""
def get_context_data(self, **kwargs):
"""Add extra context data to the company index page"""
ctx = super().get_context_data(**kwargs)
lookup = {reverse('supplier-index'): {'title': _('Suppliers'), 'button_text': _('New Sup... | the_stack_v2_python_sparse | InvenTree/company/views.py | inventree/InvenTree | train | 3,077 |
1387ff1bc8c7bc12e8b2972c045f6f7db4fdd97c | [
"act = a1.num_buses(0)\nexp = 0\nself.assertEqual(exp, act)",
"act = a1.num_buses(1)\nexp = 1\nself.assertEqual(exp, act)",
"act = a1.num_buses(50)\nexp = 1\nself.assertEqual(exp, act)",
"act = a1.num_buses(51)\nexp = 2\nself.assertEqual(exp, act)"
] | <|body_start_0|>
act = a1.num_buses(0)
exp = 0
self.assertEqual(exp, act)
<|end_body_0|>
<|body_start_1|>
act = a1.num_buses(1)
exp = 1
self.assertEqual(exp, act)
<|end_body_1|>
<|body_start_2|>
act = a1.num_buses(50)
exp = 1
self.assertEqual(exp... | Test class for function a1.num_buses. | TestNumBuses | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestNumBuses:
"""Test class for function a1.num_buses."""
def test_num_buses_zero(self):
"""Test num_buses with the zero case"""
<|body_0|>
def test_num_buses_one(self):
"""Test num_buses with one person"""
<|body_1|>
def test_num_buses_50_people(sel... | stack_v2_sparse_classes_75kplus_train_069685 | 886 | no_license | [
{
"docstring": "Test num_buses with the zero case",
"name": "test_num_buses_zero",
"signature": "def test_num_buses_zero(self)"
},
{
"docstring": "Test num_buses with one person",
"name": "test_num_buses_one",
"signature": "def test_num_buses_one(self)"
},
{
"docstring": "Test nu... | 4 | stack_v2_sparse_classes_30k_train_022734 | Implement the Python class `TestNumBuses` described below.
Class description:
Test class for function a1.num_buses.
Method signatures and docstrings:
- def test_num_buses_zero(self): Test num_buses with the zero case
- def test_num_buses_one(self): Test num_buses with one person
- def test_num_buses_50_people(self): ... | Implement the Python class `TestNumBuses` described below.
Class description:
Test class for function a1.num_buses.
Method signatures and docstrings:
- def test_num_buses_zero(self): Test num_buses with the zero case
- def test_num_buses_one(self): Test num_buses with one person
- def test_num_buses_50_people(self): ... | 8323476f5665f9495350092ec77ebca8698993ab | <|skeleton|>
class TestNumBuses:
"""Test class for function a1.num_buses."""
def test_num_buses_zero(self):
"""Test num_buses with the zero case"""
<|body_0|>
def test_num_buses_one(self):
"""Test num_buses with one person"""
<|body_1|>
def test_num_buses_50_people(sel... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestNumBuses:
"""Test class for function a1.num_buses."""
def test_num_buses_zero(self):
"""Test num_buses with the zero case"""
act = a1.num_buses(0)
exp = 0
self.assertEqual(exp, act)
def test_num_buses_one(self):
"""Test num_buses with one person"""
... | the_stack_v2_python_sparse | xinweic/crafting_quality_code/test_num_buses.py | nikeethr/rflexstudygroup | train | 0 |
40aa15e865ce7a4e8693f5a4a15e58b0f2f37bfc | [
"self.msg = kargs.get('msg', '')\nself.value = kargs.get('value', 0)\nself.maxi = kargs.get('maxi', 100)\nif self.maxi == 0:\n self.maxi = 1\nself.form = kargs.get('format', '%3d%%')\nself.file = sys.stdout\nself.time = kargs.get('time', True)\nself._write(self.msg)\nself._write(self.form % 0, update=True)\nst =... | <|body_start_0|>
self.msg = kargs.get('msg', '')
self.value = kargs.get('value', 0)
self.maxi = kargs.get('maxi', 100)
if self.maxi == 0:
self.maxi = 1
self.form = kargs.get('format', '%3d%%')
self.file = sys.stdout
self.time = kargs.get('time', True)
... | This class allows to easily follow the progress of a task. | Progress | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Progress:
"""This class allows to easily follow the progress of a task."""
def __init__(self, **kargs):
"""Initialization"""
<|body_0|>
def _write(self, txt, update=False):
"""Print progress if in a terminal."""
<|body_1|>
def Update(self, value):
... | stack_v2_sparse_classes_75kplus_train_069686 | 3,392 | no_license | [
{
"docstring": "Initialization",
"name": "__init__",
"signature": "def __init__(self, **kargs)"
},
{
"docstring": "Print progress if in a terminal.",
"name": "_write",
"signature": "def _write(self, txt, update=False)"
},
{
"docstring": "Set the progress indicator to 'value' and ... | 4 | stack_v2_sparse_classes_30k_train_005975 | Implement the Python class `Progress` described below.
Class description:
This class allows to easily follow the progress of a task.
Method signatures and docstrings:
- def __init__(self, **kargs): Initialization
- def _write(self, txt, update=False): Print progress if in a terminal.
- def Update(self, value): Set th... | Implement the Python class `Progress` described below.
Class description:
This class allows to easily follow the progress of a task.
Method signatures and docstrings:
- def __init__(self, **kargs): Initialization
- def _write(self, txt, update=False): Print progress if in a terminal.
- def Update(self, value): Set th... | 62592c0f17be823caad8ea71cd52841acbab6185 | <|skeleton|>
class Progress:
"""This class allows to easily follow the progress of a task."""
def __init__(self, **kargs):
"""Initialization"""
<|body_0|>
def _write(self, txt, update=False):
"""Print progress if in a terminal."""
<|body_1|>
def Update(self, value):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Progress:
"""This class allows to easily follow the progress of a task."""
def __init__(self, **kargs):
"""Initialization"""
self.msg = kargs.get('msg', '')
self.value = kargs.get('value', 0)
self.maxi = kargs.get('maxi', 100)
if self.maxi == 0:
self.ma... | the_stack_v2_python_sparse | asrun/progress.py | zhanxiangqian/salome | train | 1 |
fede080bd79ecec3db2ed5520e57fb98f072e393 | [
"input_ = Input(shape=[input_shape_x, input_shape_y, 1])\nhidden1 = Conv2D(n_conv_filters[0], kernel_size=filters_shape[0], activation='relu', padding='same', input_shape=(input_shape_x, input_shape_y, 1))(input_)\nbn1 = BatchNormalization()(hidden1)\npooling1 = MaxPooling2D(pool_size=(2, 2))(bn1)\ndp1 = SpatialDro... | <|body_start_0|>
input_ = Input(shape=[input_shape_x, input_shape_y, 1])
hidden1 = Conv2D(n_conv_filters[0], kernel_size=filters_shape[0], activation='relu', padding='same', input_shape=(input_shape_x, input_shape_y, 1))(input_)
bn1 = BatchNormalization()(hidden1)
pooling1 = MaxPooling2D... | Create a Siamese model which is a kind of parallel model, with two inputs: "mfcc" and "lmfe" This model is based on this paper [https://link.springer.com/chapter/10.1007%2F978-3-030-51999-5_18] | SiameseModelGenerator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SiameseModelGenerator:
"""Create a Siamese model which is a kind of parallel model, with two inputs: "mfcc" and "lmfe" This model is based on this paper [https://link.springer.com/chapter/10.1007%2F978-3-030-51999-5_18]"""
def create_siamese_branch_architecture(self, n_conv_filters, filters_... | stack_v2_sparse_classes_75kplus_train_069687 | 7,323 | no_license | [
{
"docstring": "creating a the model architecture of each branch, to be used for both mffc and lmfe Args: n_conv_filters: default values based on the paper are 128, 256, 512 filters_shape: default values based on the paper are [3,3,3] input_shape_x: the input shape of features input_shape_y: the input shape of ... | 3 | stack_v2_sparse_classes_30k_train_027948 | Implement the Python class `SiameseModelGenerator` described below.
Class description:
Create a Siamese model which is a kind of parallel model, with two inputs: "mfcc" and "lmfe" This model is based on this paper [https://link.springer.com/chapter/10.1007%2F978-3-030-51999-5_18]
Method signatures and docstrings:
- d... | Implement the Python class `SiameseModelGenerator` described below.
Class description:
Create a Siamese model which is a kind of parallel model, with two inputs: "mfcc" and "lmfe" This model is based on this paper [https://link.springer.com/chapter/10.1007%2F978-3-030-51999-5_18]
Method signatures and docstrings:
- d... | a8e17c3fd51c2514a40e83f14d8b4ebd4fbd1da5 | <|skeleton|>
class SiameseModelGenerator:
"""Create a Siamese model which is a kind of parallel model, with two inputs: "mfcc" and "lmfe" This model is based on this paper [https://link.springer.com/chapter/10.1007%2F978-3-030-51999-5_18]"""
def create_siamese_branch_architecture(self, n_conv_filters, filters_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SiameseModelGenerator:
"""Create a Siamese model which is a kind of parallel model, with two inputs: "mfcc" and "lmfe" This model is based on this paper [https://link.springer.com/chapter/10.1007%2F978-3-030-51999-5_18]"""
def create_siamese_branch_architecture(self, n_conv_filters, filters_shape, input_... | the_stack_v2_python_sparse | training/siamese_model_generator.py | jacordero/ESA-audio-sentiment-analysis | train | 0 |
a06712124f13364c70a2f77fd9a6a2f2f77fa0cf | [
"length = np.prod(self.nd_shape)\ntile = 1\nbiases = []\nfor i, l in enumerate(self.nd_shape):\n if l > 1:\n new_bias = self.relative_attn_bias(l, self.num_heads, f'bias_{i}')\n repeat = length // (tile * l)\n if repeat > 1:\n new_bias = new_bias[:, :, jnp.newaxis, :, jnp.newaxis]... | <|body_start_0|>
length = np.prod(self.nd_shape)
tile = 1
biases = []
for i, l in enumerate(self.nd_shape):
if l > 1:
new_bias = self.relative_attn_bias(l, self.num_heads, f'bias_{i}')
repeat = length // (tile * l)
if repeat > 1... | Provides learnable NxN relative attention bias. Attributes: num_heads: Number of heads for which to provide relative attention. nd_shape: Shape for which to provided relative attention bias. For instance, for images we we would provide a 2D shape. Note that batch and feature dimensions should be excluded here. initiali... | RelativeAttentionBias | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RelativeAttentionBias:
"""Provides learnable NxN relative attention bias. Attributes: num_heads: Number of heads for which to provide relative attention. nd_shape: Shape for which to provided relative attention bias. For instance, for images we we would provide a 2D shape. Note that batch and fea... | stack_v2_sparse_classes_75kplus_train_069688 | 25,060 | permissive | [
{
"docstring": "Creates relative attention bias that factorizes over dimensions. length = prod(nd_shape) Returns: Bias of shape `[num_heads, length, length]`.",
"name": "__call__",
"signature": "def __call__(self) -> jnp.ndarray"
},
{
"docstring": "Computes attention bias based on relative posit... | 2 | stack_v2_sparse_classes_30k_train_042151 | Implement the Python class `RelativeAttentionBias` described below.
Class description:
Provides learnable NxN relative attention bias. Attributes: num_heads: Number of heads for which to provide relative attention. nd_shape: Shape for which to provided relative attention bias. For instance, for images we we would prov... | Implement the Python class `RelativeAttentionBias` described below.
Class description:
Provides learnable NxN relative attention bias. Attributes: num_heads: Number of heads for which to provide relative attention. nd_shape: Shape for which to provided relative attention bias. For instance, for images we we would prov... | c3ae6d7b5dc829fafe204a92522a5983959561a0 | <|skeleton|>
class RelativeAttentionBias:
"""Provides learnable NxN relative attention bias. Attributes: num_heads: Number of heads for which to provide relative attention. nd_shape: Shape for which to provided relative attention bias. For instance, for images we we would provide a 2D shape. Note that batch and fea... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RelativeAttentionBias:
"""Provides learnable NxN relative attention bias. Attributes: num_heads: Number of heads for which to provide relative attention. nd_shape: Shape for which to provided relative attention bias. For instance, for images we we would provide a 2D shape. Note that batch and feature dimensio... | the_stack_v2_python_sparse | scenic/model_lib/layers/attention_layers.py | shreyasarora/scenic | train | 0 |
35d88e8923e9d0bbb66a45df3b66939759d0a77b | [
"self._datafolder = datafolder\nself._tectonic_grid = os.path.join(datafolder, 'tectonic_global.grd')\nself._oceanic_grid = os.path.join(datafolder, 'oceanic_global.grd')",
"config = get_config()\ndatadir = config['DATA']['folder']\nreturn cls(datadir)",
"regions = OrderedDict()\ngd = GeoDict.createDictFromCent... | <|body_start_0|>
self._datafolder = datafolder
self._tectonic_grid = os.path.join(datafolder, 'tectonic_global.grd')
self._oceanic_grid = os.path.join(datafolder, 'oceanic_global.grd')
<|end_body_0|>
<|body_start_1|>
config = get_config()
datadir = config['DATA']['folder']
... | Regionalizer | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-public-domain-disclaimer",
"LicenseRef-scancode-warranty-disclaimer"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Regionalizer:
def __init__(self, datafolder):
"""Determine tectonic region information given epicenter and depth. Args: datafolder (str): Path to directory containing spatial data for tectonic regions."""
<|body_0|>
def load(cls):
"""Load regionalizer data from data ... | stack_v2_sparse_classes_75kplus_train_069689 | 7,330 | permissive | [
{
"docstring": "Determine tectonic region information given epicenter and depth. Args: datafolder (str): Path to directory containing spatial data for tectonic regions.",
"name": "__init__",
"signature": "def __init__(self, datafolder)"
},
{
"docstring": "Load regionalizer data from data in the ... | 3 | stack_v2_sparse_classes_30k_train_018000 | Implement the Python class `Regionalizer` described below.
Class description:
Implement the Regionalizer class.
Method signatures and docstrings:
- def __init__(self, datafolder): Determine tectonic region information given epicenter and depth. Args: datafolder (str): Path to directory containing spatial data for tec... | Implement the Python class `Regionalizer` described below.
Class description:
Implement the Regionalizer class.
Method signatures and docstrings:
- def __init__(self, datafolder): Determine tectonic region information given epicenter and depth. Args: datafolder (str): Path to directory containing spatial data for tec... | 6e13af7f76d52adfeefbd74dbe647705e92db7d0 | <|skeleton|>
class Regionalizer:
def __init__(self, datafolder):
"""Determine tectonic region information given epicenter and depth. Args: datafolder (str): Path to directory containing spatial data for tectonic regions."""
<|body_0|>
def load(cls):
"""Load regionalizer data from data ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Regionalizer:
def __init__(self, datafolder):
"""Determine tectonic region information given epicenter and depth. Args: datafolder (str): Path to directory containing spatial data for tectonic regions."""
self._datafolder = datafolder
self._tectonic_grid = os.path.join(datafolder, 'tec... | the_stack_v2_python_sparse | strec/gmreg.py | emthompson-usgs/strec | train | 0 | |
7b779f0c00c0d57197f5d8568307d54ea656a420 | [
"data_dealed = []\nfor each in data:\n data_dealed.append(list(each))\nfor rate_index, cumulative_rate_index in rate_indexes.items():\n cumulative_rate = 0\n for num_index, info in enumerate(data):\n day_ratio = info[rate_index]\n if need_to_deal_first_data:\n if 'GetMonthAccountYi... | <|body_start_0|>
data_dealed = []
for each in data:
data_dealed.append(list(each))
for rate_index, cumulative_rate_index in rate_indexes.items():
cumulative_rate = 0
for num_index, info in enumerate(data):
day_ratio = info[rate_index]
... | CumulativeRate | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CumulativeRate:
def cal_cumulative_rate(self, data=[], rate_indexes={0: 4}, need_to_deal_first_data=True, **class_name):
"""根据日收益率计算累计收益率 :param data: [[yield, cumulative_rate],[yield, cumulative_rate],[yield, cumulative_rate]] :param rate_index: {yield.index: cumulative_rate.index} :par... | stack_v2_sparse_classes_75kplus_train_069690 | 13,502 | no_license | [
{
"docstring": "根据日收益率计算累计收益率 :param data: [[yield, cumulative_rate],[yield, cumulative_rate],[yield, cumulative_rate]] :param rate_index: {yield.index: cumulative_rate.index} :param need_to_deal_first_data: if true then deal the first data special :return:",
"name": "cal_cumulative_rate",
"signature": ... | 2 | stack_v2_sparse_classes_30k_train_015833 | Implement the Python class `CumulativeRate` described below.
Class description:
Implement the CumulativeRate class.
Method signatures and docstrings:
- def cal_cumulative_rate(self, data=[], rate_indexes={0: 4}, need_to_deal_first_data=True, **class_name): 根据日收益率计算累计收益率 :param data: [[yield, cumulative_rate],[yield, ... | Implement the Python class `CumulativeRate` described below.
Class description:
Implement the CumulativeRate class.
Method signatures and docstrings:
- def cal_cumulative_rate(self, data=[], rate_indexes={0: 4}, need_to_deal_first_data=True, **class_name): 根据日收益率计算累计收益率 :param data: [[yield, cumulative_rate],[yield, ... | 9cad8d70b1f1a054f7657c986404e33b0f3c80a1 | <|skeleton|>
class CumulativeRate:
def cal_cumulative_rate(self, data=[], rate_indexes={0: 4}, need_to_deal_first_data=True, **class_name):
"""根据日收益率计算累计收益率 :param data: [[yield, cumulative_rate],[yield, cumulative_rate],[yield, cumulative_rate]] :param rate_index: {yield.index: cumulative_rate.index} :par... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CumulativeRate:
def cal_cumulative_rate(self, data=[], rate_indexes={0: 4}, need_to_deal_first_data=True, **class_name):
"""根据日收益率计算累计收益率 :param data: [[yield, cumulative_rate],[yield, cumulative_rate],[yield, cumulative_rate]] :param rate_index: {yield.index: cumulative_rate.index} :param need_to_dea... | the_stack_v2_python_sparse | utils/business/business.py | ck3207/unittest | train | 1 | |
aeab75e3ad41aecef80914e61169458cc28e9705 | [
"Frame.__init__(self, fenetre, width=300, height=700, bg='green')\nself.grid()\nself.liste_todo = ['atchoum', 'aie', 'test', 'carnage', 'bleu', 'blanc', 'violet', 'rouge', 'bleu', 'blanc', 'violet', 'rouge']\nself.liste_done = ['bleu', 'blanc', 'violet', 'rouge']\nself.frame_actions(robot='big', liste='todo')\nself... | <|body_start_0|>
Frame.__init__(self, fenetre, width=300, height=700, bg='green')
self.grid()
self.liste_todo = ['atchoum', 'aie', 'test', 'carnage', 'bleu', 'blanc', 'violet', 'rouge', 'bleu', 'blanc', 'violet', 'rouge']
self.liste_done = ['bleu', 'blanc', 'violet', 'rouge']
sel... | Frame qui regroupe les widgets du frame actions. Hérite de Frame. | actions | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class actions:
"""Frame qui regroupe les widgets du frame actions. Hérite de Frame."""
def __init__(self, fenetre, **kwargs):
"""@param fenetre : frame de la fenêtre principale"""
<|body_0|>
def frame_actions(self, robot, liste):
"""Permet de créer le frame nommé d'une... | stack_v2_sparse_classes_75kplus_train_069691 | 3,154 | no_license | [
{
"docstring": "@param fenetre : frame de la fenêtre principale",
"name": "__init__",
"signature": "def __init__(self, fenetre, **kwargs)"
},
{
"docstring": "Permet de créer le frame nommé d'une liste d'action d'un robot. @param robot = {big, mini} @param liste = {todo, done}",
"name": "fram... | 4 | stack_v2_sparse_classes_30k_train_042498 | Implement the Python class `actions` described below.
Class description:
Frame qui regroupe les widgets du frame actions. Hérite de Frame.
Method signatures and docstrings:
- def __init__(self, fenetre, **kwargs): @param fenetre : frame de la fenêtre principale
- def frame_actions(self, robot, liste): Permet de créer... | Implement the Python class `actions` described below.
Class description:
Frame qui regroupe les widgets du frame actions. Hérite de Frame.
Method signatures and docstrings:
- def __init__(self, fenetre, **kwargs): @param fenetre : frame de la fenêtre principale
- def frame_actions(self, robot, liste): Permet de créer... | e1ffa98f3d16dc3348461d63c5a101cdb29abb3f | <|skeleton|>
class actions:
"""Frame qui regroupe les widgets du frame actions. Hérite de Frame."""
def __init__(self, fenetre, **kwargs):
"""@param fenetre : frame de la fenêtre principale"""
<|body_0|>
def frame_actions(self, robot, liste):
"""Permet de créer le frame nommé d'une... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class actions:
"""Frame qui regroupe les widgets du frame actions. Hérite de Frame."""
def __init__(self, fenetre, **kwargs):
"""@param fenetre : frame de la fenêtre principale"""
Frame.__init__(self, fenetre, width=300, height=700, bg='green')
self.grid()
self.liste_todo = ['at... | the_stack_v2_python_sparse | gui/gui_actions.py | furmi/simu2014 | train | 0 |
ed4d63809b4817112b8d962de2b129f42a9ecdf8 | [
"self.w0 = w0\nself.wa = wa\nDarkEnergyModel.__init__(self)",
"if isinstance(z, np.ndarray) and z.size > 1:\n assert np.all(np.diff(z) > 0.0)\nreturn self.w0 + (1.0 - 1.0 / (1.0 + z)) * self.wa",
"if isinstance(z, np.ndarray) and z.size > 1:\n assert np.all(np.diff(z) > 0.0)\nreturn np.exp(-3.0 * self.wa ... | <|body_start_0|>
self.w0 = w0
self.wa = wa
DarkEnergyModel.__init__(self)
<|end_body_0|>
<|body_start_1|>
if isinstance(z, np.ndarray) and z.size > 1:
assert np.all(np.diff(z) > 0.0)
return self.w0 + (1.0 - 1.0 / (1.0 + z)) * self.wa
<|end_body_1|>
<|body_start_2|>
... | w(z)=constant dark energy model | DarkEnergyW0Wa | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DarkEnergyW0Wa:
"""w(z)=constant dark energy model"""
def __init__(self, w0, wa):
"""w(z)=w0+(1-a)wa"""
<|body_0|>
def w_of_z(self, z):
"""w(z)=w0+(1-a)wa"""
<|body_1|>
def de_mult(self, z):
"""w(z)=w0+(1-a)wa multiplier"""
<|body_2|>... | stack_v2_sparse_classes_75kplus_train_069692 | 4,757 | no_license | [
{
"docstring": "w(z)=w0+(1-a)wa",
"name": "__init__",
"signature": "def __init__(self, w0, wa)"
},
{
"docstring": "w(z)=w0+(1-a)wa",
"name": "w_of_z",
"signature": "def w_of_z(self, z)"
},
{
"docstring": "w(z)=w0+(1-a)wa multiplier",
"name": "de_mult",
"signature": "def d... | 3 | stack_v2_sparse_classes_30k_train_052692 | Implement the Python class `DarkEnergyW0Wa` described below.
Class description:
w(z)=constant dark energy model
Method signatures and docstrings:
- def __init__(self, w0, wa): w(z)=w0+(1-a)wa
- def w_of_z(self, z): w(z)=w0+(1-a)wa
- def de_mult(self, z): w(z)=w0+(1-a)wa multiplier | Implement the Python class `DarkEnergyW0Wa` described below.
Class description:
w(z)=constant dark energy model
Method signatures and docstrings:
- def __init__(self, w0, wa): w(z)=w0+(1-a)wa
- def w_of_z(self, z): w(z)=w0+(1-a)wa
- def de_mult(self, z): w(z)=w0+(1-a)wa multiplier
<|skeleton|>
class DarkEnergyW0Wa:
... | f6cb3014a55942a751ae53f8bb0fc2ea62c6442b | <|skeleton|>
class DarkEnergyW0Wa:
"""w(z)=constant dark energy model"""
def __init__(self, w0, wa):
"""w(z)=w0+(1-a)wa"""
<|body_0|>
def w_of_z(self, z):
"""w(z)=w0+(1-a)wa"""
<|body_1|>
def de_mult(self, z):
"""w(z)=w0+(1-a)wa multiplier"""
<|body_2|>... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DarkEnergyW0Wa:
"""w(z)=constant dark energy model"""
def __init__(self, w0, wa):
"""w(z)=w0+(1-a)wa"""
self.w0 = w0
self.wa = wa
DarkEnergyModel.__init__(self)
def w_of_z(self, z):
"""w(z)=w0+(1-a)wa"""
if isinstance(z, np.ndarray) and z.size > 1:
... | the_stack_v2_python_sparse | dark_energy_model.py | mcdigman/SuperSCRAM | train | 1 |
3e0ee7a97b1e3869f0255fe1f302c8c1bcf11cbb | [
"super(MyRNN, self).__init__()\nself.GRU = torch.nn.GRUCell(D_in, H)\nself.linear = torch.nn.Linear(H, D_out)",
"hidden = self.GRU(x, hx)\ny_pred = self.linear(hidden)\nreturn y_pred"
] | <|body_start_0|>
super(MyRNN, self).__init__()
self.GRU = torch.nn.GRUCell(D_in, H)
self.linear = torch.nn.Linear(H, D_out)
<|end_body_0|>
<|body_start_1|>
hidden = self.GRU(x, hx)
y_pred = self.linear(hidden)
return y_pred
<|end_body_1|>
| MyRNN | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MyRNN:
def __init__(self, D_in, H, D_out):
"""Network with GRU hidden layers and a linear output layer."""
<|body_0|>
def forward(self, x, hx):
"""Forward pass of the model."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super(MyRNN, self).__init__... | stack_v2_sparse_classes_75kplus_train_069693 | 12,941 | no_license | [
{
"docstring": "Network with GRU hidden layers and a linear output layer.",
"name": "__init__",
"signature": "def __init__(self, D_in, H, D_out)"
},
{
"docstring": "Forward pass of the model.",
"name": "forward",
"signature": "def forward(self, x, hx)"
}
] | 2 | stack_v2_sparse_classes_30k_train_044216 | Implement the Python class `MyRNN` described below.
Class description:
Implement the MyRNN class.
Method signatures and docstrings:
- def __init__(self, D_in, H, D_out): Network with GRU hidden layers and a linear output layer.
- def forward(self, x, hx): Forward pass of the model. | Implement the Python class `MyRNN` described below.
Class description:
Implement the MyRNN class.
Method signatures and docstrings:
- def __init__(self, D_in, H, D_out): Network with GRU hidden layers and a linear output layer.
- def forward(self, x, hx): Forward pass of the model.
<|skeleton|>
class MyRNN:
def... | f25f818777bb8b43900c19a9f7dca4407ed05292 | <|skeleton|>
class MyRNN:
def __init__(self, D_in, H, D_out):
"""Network with GRU hidden layers and a linear output layer."""
<|body_0|>
def forward(self, x, hx):
"""Forward pass of the model."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MyRNN:
def __init__(self, D_in, H, D_out):
"""Network with GRU hidden layers and a linear output layer."""
super(MyRNN, self).__init__()
self.GRU = torch.nn.GRUCell(D_in, H)
self.linear = torch.nn.Linear(H, D_out)
def forward(self, x, hx):
"""Forward pass of the mo... | the_stack_v2_python_sparse | NeuralNetworks/pytorch/firefly/train_network.py | XaqLab/FireflyProject | train | 0 | |
f4d465485114aa03455bf53b3bbe7d6df3359217 | [
"self._day = day\nself._month = month\nself._year = year\nself._events = []",
"result = str(self._year) + ',' + self._month + ',' + str(self._day)\nresult += '\\n'\nself._events.sort()\nfor event in self._events:\n result += str(event)\n result += '\\n'\nreturn result",
"no_overlap = True\ni = 0\nwhile no... | <|body_start_0|>
self._day = day
self._month = month
self._year = year
self._events = []
<|end_body_0|>
<|body_start_1|>
result = str(self._year) + ',' + self._month + ',' + str(self._day)
result += '\n'
self._events.sort()
for event in self._events:
... | A calendar day and its events. | Day | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Day:
"""A calendar day and its events."""
def __init__(self, day=1, month='January', year=2015):
"""(Day, int, str, int) -> NoneType Initialize this calendar day. REQ: 0 < day <= 31 REQ: day is an integer"""
<|body_0|>
def __str__(self):
"""(Day) -> str Return a ... | stack_v2_sparse_classes_75kplus_train_069694 | 3,872 | no_license | [
{
"docstring": "(Day, int, str, int) -> NoneType Initialize this calendar day. REQ: 0 < day <= 31 REQ: day is an integer",
"name": "__init__",
"signature": "def __init__(self, day=1, month='January', year=2015)"
},
{
"docstring": "(Day) -> str Return a string representation of this day.",
"n... | 3 | stack_v2_sparse_classes_30k_val_001100 | Implement the Python class `Day` described below.
Class description:
A calendar day and its events.
Method signatures and docstrings:
- def __init__(self, day=1, month='January', year=2015): (Day, int, str, int) -> NoneType Initialize this calendar day. REQ: 0 < day <= 31 REQ: day is an integer
- def __str__(self): (... | Implement the Python class `Day` described below.
Class description:
A calendar day and its events.
Method signatures and docstrings:
- def __init__(self, day=1, month='January', year=2015): (Day, int, str, int) -> NoneType Initialize this calendar day. REQ: 0 < day <= 31 REQ: day is an integer
- def __str__(self): (... | dffbef98cbf43eccc13fafb40df1aaada50850f4 | <|skeleton|>
class Day:
"""A calendar day and its events."""
def __init__(self, day=1, month='January', year=2015):
"""(Day, int, str, int) -> NoneType Initialize this calendar day. REQ: 0 < day <= 31 REQ: day is an integer"""
<|body_0|>
def __str__(self):
"""(Day) -> str Return a ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Day:
"""A calendar day and its events."""
def __init__(self, day=1, month='January', year=2015):
"""(Day, int, str, int) -> NoneType Initialize this calendar day. REQ: 0 < day <= 31 REQ: day is an integer"""
self._day = day
self._month = month
self._year = year
sel... | the_stack_v2_python_sparse | Fall_2015_CSCA08_Intro_to_Computer_Science_I/Week_9_OOP/week9_calendar_complete.py | BoZhaoUT/Teaching | train | 0 |
0c8f9999eac88bb26a4c9ead02351c342f64d540 | [
"self.pos = np.asarray(pos, dtype=float)\nself.vel = np.asarray(vel, dtype=float)\nself.n = self.pos.shape[0]\nself.r = r\nself.m = m\nself.nsteps = 0",
"self.nsteps += 1\nself.pos += self.vel * dt\ndist = squareform(pdist(self.pos))\niarr, jarr = np.where(dist < 2 * self.r)\nk = iarr < jarr\niarr, jarr = (iarr[k... | <|body_start_0|>
self.pos = np.asarray(pos, dtype=float)
self.vel = np.asarray(vel, dtype=float)
self.n = self.pos.shape[0]
self.r = r
self.m = m
self.nsteps = 0
<|end_body_0|>
<|body_start_1|>
self.nsteps += 1
self.pos += self.vel * dt
dist = squ... | MDSimulation | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MDSimulation:
def __init__(self, pos, vel, r, m):
"""Initialize the simulation with identical, circular particles of radius r and mass m. The n x 2 state arrays pos and vel hold the n particles' positions in their rows as (x_i, y_i) and (vx_i, vy_i)."""
<|body_0|>
def advanc... | stack_v2_sparse_classes_75kplus_train_069695 | 5,499 | no_license | [
{
"docstring": "Initialize the simulation with identical, circular particles of radius r and mass m. The n x 2 state arrays pos and vel hold the n particles' positions in their rows as (x_i, y_i) and (vx_i, vy_i).",
"name": "__init__",
"signature": "def __init__(self, pos, vel, r, m)"
},
{
"docs... | 2 | stack_v2_sparse_classes_30k_train_026560 | Implement the Python class `MDSimulation` described below.
Class description:
Implement the MDSimulation class.
Method signatures and docstrings:
- def __init__(self, pos, vel, r, m): Initialize the simulation with identical, circular particles of radius r and mass m. The n x 2 state arrays pos and vel hold the n par... | Implement the Python class `MDSimulation` described below.
Class description:
Implement the MDSimulation class.
Method signatures and docstrings:
- def __init__(self, pos, vel, r, m): Initialize the simulation with identical, circular particles of radius r and mass m. The n x 2 state arrays pos and vel hold the n par... | af24407f75d930e06f02ce25942c222112f33761 | <|skeleton|>
class MDSimulation:
def __init__(self, pos, vel, r, m):
"""Initialize the simulation with identical, circular particles of radius r and mass m. The n x 2 state arrays pos and vel hold the n particles' positions in their rows as (x_i, y_i) and (vx_i, vy_i)."""
<|body_0|>
def advanc... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MDSimulation:
def __init__(self, pos, vel, r, m):
"""Initialize the simulation with identical, circular particles of radius r and mass m. The n x 2 state arrays pos and vel hold the n particles' positions in their rows as (x_i, y_i) and (vx_i, vy_i)."""
self.pos = np.asarray(pos, dtype=float)
... | the_stack_v2_python_sparse | effusion.py | paniash/progs | train | 0 | |
fb35f84dee8ec02e6690ada86758d59c457a1822 | [
"comp = TakephotoPhonePage(self.driver)\nlp = ListViewPhonePage(self.driver)\nname = '在线拍照类型'\ncompname = '在线拍照_名称'\nlp.open_fisrt_doc()\ntarget_element = comp.getcomp(compname)\ncomp.scroll_to_target_element(target_element)\ntype = target_element.get_attribute('fieldtype')\nself.assertEqual(type, 'OnLineTakePhotoF... | <|body_start_0|>
comp = TakephotoPhonePage(self.driver)
lp = ListViewPhonePage(self.driver)
name = '在线拍照类型'
compname = '在线拍照_名称'
lp.open_fisrt_doc()
target_element = comp.getcomp(compname)
comp.scroll_to_target_element(target_element)
type = target_element... | 在线拍照测试 | TakephotoPhoneTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TakephotoPhoneTest:
"""在线拍照测试"""
def test_type_case(self):
"""在线拍照控件类型"""
<|body_0|>
def test_desription_case(self):
"""描述"""
<|body_1|>
def test_refresh_calculate_case(self):
"""刷新_重计算"""
<|body_2|>
def test_show_when_hide_case(... | stack_v2_sparse_classes_75kplus_train_069696 | 3,605 | no_license | [
{
"docstring": "在线拍照控件类型",
"name": "test_type_case",
"signature": "def test_type_case(self)"
},
{
"docstring": "描述",
"name": "test_desription_case",
"signature": "def test_desription_case(self)"
},
{
"docstring": "刷新_重计算",
"name": "test_refresh_calculate_case",
"signature... | 6 | stack_v2_sparse_classes_30k_train_008271 | Implement the Python class `TakephotoPhoneTest` described below.
Class description:
在线拍照测试
Method signatures and docstrings:
- def test_type_case(self): 在线拍照控件类型
- def test_desription_case(self): 描述
- def test_refresh_calculate_case(self): 刷新_重计算
- def test_show_when_hide_case(self): 隐藏时显示值
- def test_readonly_case(s... | Implement the Python class `TakephotoPhoneTest` described below.
Class description:
在线拍照测试
Method signatures and docstrings:
- def test_type_case(self): 在线拍照控件类型
- def test_desription_case(self): 描述
- def test_refresh_calculate_case(self): 刷新_重计算
- def test_show_when_hide_case(self): 隐藏时显示值
- def test_readonly_case(s... | 78768989a79a14013b983024cf6e4838d51ed595 | <|skeleton|>
class TakephotoPhoneTest:
"""在线拍照测试"""
def test_type_case(self):
"""在线拍照控件类型"""
<|body_0|>
def test_desription_case(self):
"""描述"""
<|body_1|>
def test_refresh_calculate_case(self):
"""刷新_重计算"""
<|body_2|>
def test_show_when_hide_case(... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TakephotoPhoneTest:
"""在线拍照测试"""
def test_type_case(self):
"""在线拍照控件类型"""
comp = TakephotoPhonePage(self.driver)
lp = ListViewPhonePage(self.driver)
name = '在线拍照类型'
compname = '在线拍照_名称'
lp.open_fisrt_doc()
target_element = comp.getcomp(compname)
... | the_stack_v2_python_sparse | test_case/running/phone/form/test_take_phone.py | pylk/pythonSelenium | train | 0 |
6fe73d040d7558ee00429ca863fa6245aadcab76 | [
"super().__init__(input_tensor_spec=observation_spec, name=name)\nself._actor_encoder = encoding_network_ctor(input_tensor_spec=observation_spec)\nencoder_output_size = self._actor_encoder.output_spec.shape[0]\nself._policy_head = _create_projection_net_based_on_action_spec(discrete_projection_net_ctor=discrete_pro... | <|body_start_0|>
super().__init__(input_tensor_spec=observation_spec, name=name)
self._actor_encoder = encoding_network_ctor(input_tensor_spec=observation_spec)
encoder_output_size = self._actor_encoder.output_spec.shape[0]
self._policy_head = _create_projection_net_based_on_action_spec(... | A composite network with a policy component and a value component. This network capture a category of network as proposed in the Phasic Policy Gradient paper. It consists of two components and 3 heads: - Value Component: a single value head that estimates the value function - Policy Component: 1 policy head that output... | DisjointPolicyValueNetwork | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DisjointPolicyValueNetwork:
"""A composite network with a policy component and a value component. This network capture a category of network as proposed in the Phasic Policy Gradient paper. It consists of two components and 3 heads: - Value Component: a single value head that estimates the value ... | stack_v2_sparse_classes_75kplus_train_069697 | 12,505 | permissive | [
{
"docstring": "The constructor of DisjointPolicyValueNetwork Note that there are two projection constructor parameters. They exist because in the case when the action spec is a nest of different types where some of them are discrete and some of them are continuous, corresponding projection networks can be crea... | 2 | stack_v2_sparse_classes_30k_train_028910 | Implement the Python class `DisjointPolicyValueNetwork` described below.
Class description:
A composite network with a policy component and a value component. This network capture a category of network as proposed in the Phasic Policy Gradient paper. It consists of two components and 3 heads: - Value Component: a sing... | Implement the Python class `DisjointPolicyValueNetwork` described below.
Class description:
A composite network with a policy component and a value component. This network capture a category of network as proposed in the Phasic Policy Gradient paper. It consists of two components and 3 heads: - Value Component: a sing... | b00ff2fa5e660de31020338ba340263183fbeaa4 | <|skeleton|>
class DisjointPolicyValueNetwork:
"""A composite network with a policy component and a value component. This network capture a category of network as proposed in the Phasic Policy Gradient paper. It consists of two components and 3 heads: - Value Component: a single value head that estimates the value ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DisjointPolicyValueNetwork:
"""A composite network with a policy component and a value component. This network capture a category of network as proposed in the Phasic Policy Gradient paper. It consists of two components and 3 heads: - Value Component: a single value head that estimates the value function - Po... | the_stack_v2_python_sparse | alf/algorithms/ppg/disjoint_policy_value_network.py | HorizonRobotics/alf | train | 288 |
37c0bb89b17e1cc0a43651d45750fc96d3d0c5fb | [
"str_n = str(number) + '\\x00'\ncount = 0\nans = ''\nfor i, c in enumerate(str_n):\n if i == 0:\n count = 1\n elif c == str_n[i - 1]:\n count += 1\n elif c != str_n[i - 1]:\n ans += str(count) + str_n[i - 1]\n count = 1\nreturn ans",
"ans = '1'\nfor i in range(1, n):\n ans ... | <|body_start_0|>
str_n = str(number) + '\x00'
count = 0
ans = ''
for i, c in enumerate(str_n):
if i == 0:
count = 1
elif c == str_n[i - 1]:
count += 1
elif c != str_n[i - 1]:
ans += str(count) + str_n[i -... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def _countNumber(self, number):
"""Count the single number"""
<|body_0|>
def countAndSay(self, n):
""":type n: int :rtype: str"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
str_n = str(number) + '\x00'
count = 0
ans = ''
... | stack_v2_sparse_classes_75kplus_train_069698 | 659 | no_license | [
{
"docstring": "Count the single number",
"name": "_countNumber",
"signature": "def _countNumber(self, number)"
},
{
"docstring": ":type n: int :rtype: str",
"name": "countAndSay",
"signature": "def countAndSay(self, n)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _countNumber(self, number): Count the single number
- def countAndSay(self, n): :type n: int :rtype: str | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _countNumber(self, number): Count the single number
- def countAndSay(self, n): :type n: int :rtype: str
<|skeleton|>
class Solution:
def _countNumber(self, number):
... | 414af3b0c1a02cb08128b4a6246ee612b3458a62 | <|skeleton|>
class Solution:
def _countNumber(self, number):
"""Count the single number"""
<|body_0|>
def countAndSay(self, n):
""":type n: int :rtype: str"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def _countNumber(self, number):
"""Count the single number"""
str_n = str(number) + '\x00'
count = 0
ans = ''
for i, c in enumerate(str_n):
if i == 0:
count = 1
elif c == str_n[i - 1]:
count += 1
... | the_stack_v2_python_sparse | 38.count-and-say/solution.py | binshengliu/leetcode | train | 0 | |
7ffd33b939f3a5b844b815b020636e3abd713048 | [
"super(BinaryExtractorTask, self).__init__(*args, **kwargs)\nself.json_path = None\nself.binary_extraction_dir = None",
"if not os.path.exists(self.json_path):\n raise TurbiniaException('The file {0:s} was not found. Please ensure you have Plaso version 20191203 or greater deployed'.format(self.json_path))\nwi... | <|body_start_0|>
super(BinaryExtractorTask, self).__init__(*args, **kwargs)
self.json_path = None
self.binary_extraction_dir = None
<|end_body_0|>
<|body_start_1|>
if not os.path.exists(self.json_path):
raise TurbiniaException('The file {0:s} was not found. Please ensure you... | Extract binaries out of evidence and provide JSON file with hashes. Attributes: json_path(str): path to output JSON file. binary_extraction_dir(str): path to extraction directory. | BinaryExtractorTask | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BinaryExtractorTask:
"""Extract binaries out of evidence and provide JSON file with hashes. Attributes: json_path(str): path to output JSON file. binary_extraction_dir(str): path to extraction directory."""
def __init__(self, *args, **kwargs):
"""Initializes BinaryExtractorTask."""
... | stack_v2_sparse_classes_75kplus_train_069699 | 4,102 | permissive | [
{
"docstring": "Initializes BinaryExtractorTask.",
"name": "__init__",
"signature": "def __init__(self, *args, **kwargs)"
},
{
"docstring": "Checks counts for extracted binaries and hashes. Returns: Tuple( binary_cnt(int): Number of extracted binaries. hash_cnt(int): Number of extracted hashes. ... | 3 | stack_v2_sparse_classes_30k_train_014965 | Implement the Python class `BinaryExtractorTask` described below.
Class description:
Extract binaries out of evidence and provide JSON file with hashes. Attributes: json_path(str): path to output JSON file. binary_extraction_dir(str): path to extraction directory.
Method signatures and docstrings:
- def __init__(self... | Implement the Python class `BinaryExtractorTask` described below.
Class description:
Extract binaries out of evidence and provide JSON file with hashes. Attributes: json_path(str): path to output JSON file. binary_extraction_dir(str): path to extraction directory.
Method signatures and docstrings:
- def __init__(self... | e73717549c6919e869ce4963449c36f227e3ccd6 | <|skeleton|>
class BinaryExtractorTask:
"""Extract binaries out of evidence and provide JSON file with hashes. Attributes: json_path(str): path to output JSON file. binary_extraction_dir(str): path to extraction directory."""
def __init__(self, *args, **kwargs):
"""Initializes BinaryExtractorTask."""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BinaryExtractorTask:
"""Extract binaries out of evidence and provide JSON file with hashes. Attributes: json_path(str): path to output JSON file. binary_extraction_dir(str): path to extraction directory."""
def __init__(self, *args, **kwargs):
"""Initializes BinaryExtractorTask."""
super(... | the_stack_v2_python_sparse | turbinia/workers/binary_extractor.py | Ash515/turbinia | train | 6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.