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
fe1b68be12c5b5606e3c516dd1543be259d091e3
[ "date_formatter = self.request.locale.dates.getFormatter('date', 'short')\n\ndef _q_data_item(q):\n item = {}\n item['qid'] = 'q_%s' % q.question_id\n if q.question_number:\n item['subject'] = u'Q %s %s' % (q.question_number, q.short_name)\n else:\n item['subject'] = q.short_name\n item...
<|body_start_0|> date_formatter = self.request.locale.dates.getFormatter('date', 'short') def _q_data_item(q): item = {} item['qid'] = 'q_%s' % q.question_id if q.question_number: item['subject'] = u'Q %s %s' % (q.question_number, q.short_name) ...
QuestionInStateViewlet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuestionInStateViewlet: def getData(self): """return the data of the query""" <|body_0|> def update(self): """refresh the query""" <|body_1|> <|end_skeleton|> <|body_start_0|> date_formatter = self.request.locale.dates.getFormatter('date', 'short') ...
stack_v2_sparse_classes_75kplus_train_000600
35,739
no_license
[ { "docstring": "return the data of the query", "name": "getData", "signature": "def getData(self)" }, { "docstring": "refresh the query", "name": "update", "signature": "def update(self)" } ]
2
stack_v2_sparse_classes_30k_train_010213
Implement the Python class `QuestionInStateViewlet` described below. Class description: Implement the QuestionInStateViewlet class. Method signatures and docstrings: - def getData(self): return the data of the query - def update(self): refresh the query
Implement the Python class `QuestionInStateViewlet` described below. Class description: Implement the QuestionInStateViewlet class. Method signatures and docstrings: - def getData(self): return the data of the query - def update(self): refresh the query <|skeleton|> class QuestionInStateViewlet: def getData(sel...
5cf0ba31dfbff8d2c1b4aa8ab6f69c7a0ae9870d
<|skeleton|> class QuestionInStateViewlet: def getData(self): """return the data of the query""" <|body_0|> def update(self): """refresh the query""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class QuestionInStateViewlet: def getData(self): """return the data of the query""" date_formatter = self.request.locale.dates.getFormatter('date', 'short') def _q_data_item(q): item = {} item['qid'] = 'q_%s' % q.question_id if q.question_number: ...
the_stack_v2_python_sparse
bungeni.buildout/branches/bungeni.buildout-refactor-2010-06-02/src/bungeni.main/bungeni/ui/viewlets/workspace.py
malangalanga/bungeni-portal
train
0
67dd779461ed441da20bb6fef8b6feb65584e4f9
[ "startTime = datetime.datetime.now()\nprint('Selecting important buildings... \\n', end='\\r')\nsys.stdout.write('\\x1b[F')\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('bkin18_cjoe_klovett_sbrz', 'bkin18_cjoe_klovett_sbrz')\ndb = client.repo\ncollection = db['bkin18_cjoe_kl...
<|body_start_0|> startTime = datetime.datetime.now() print('Selecting important buildings... \n', end='\r') sys.stdout.write('\x1b[F') client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('bkin18_cjoe_klovett_sbrz', 'bkin18_cjoe_klovett_sbrz'...
selectImpBuilds
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class selectImpBuilds: def execute(trial=False): """Select the addresses of important buildings from the Property Assessment data set""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing eve...
stack_v2_sparse_classes_75kplus_train_000601
4,548
no_license
[ { "docstring": "Select the addresses of important buildings from the Property Assessment data set", "name": "execute", "signature": "def execute(trial=False)" }, { "docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a ...
2
null
Implement the Python class `selectImpBuilds` described below. Class description: Implement the selectImpBuilds class. Method signatures and docstrings: - def execute(trial=False): Select the addresses of important buildings from the Property Assessment data set - def provenance(doc=prov.model.ProvDocument(), startTim...
Implement the Python class `selectImpBuilds` described below. Class description: Implement the selectImpBuilds class. Method signatures and docstrings: - def execute(trial=False): Select the addresses of important buildings from the Property Assessment data set - def provenance(doc=prov.model.ProvDocument(), startTim...
97e72731ffadbeae57d7a332decd58706e7c08de
<|skeleton|> class selectImpBuilds: def execute(trial=False): """Select the addresses of important buildings from the Property Assessment data set""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing eve...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class selectImpBuilds: def execute(trial=False): """Select the addresses of important buildings from the Property Assessment data set""" startTime = datetime.datetime.now() print('Selecting important buildings... \n', end='\r') sys.stdout.write('\x1b[F') client = d...
the_stack_v2_python_sparse
bkin18_cjoe_klovett_sbrz/selectImpBuilds.py
ROODAY/course-2017-fal-proj
train
3
dc315d819ec478d0e5d745945e601b8e1ebd8f3b
[ "largest = -float('inf')\nfor i in range(len(nums) - k + 1):\n largest = max(sum(nums[i:i + k]), largest)\nreturn float(largest) / k", "numSum = sum(nums[:k])\nres = numSum\nfor i in range(k, len(nums)):\n numSum += nums[i] - nums[i - k]\n res = max(res, numSum)\nreturn float(res) / k\n'\\n :type ...
<|body_start_0|> largest = -float('inf') for i in range(len(nums) - k + 1): largest = max(sum(nums[i:i + k]), largest) return float(largest) / k <|end_body_0|> <|body_start_1|> numSum = sum(nums[:k]) res = numSum for i in range(k, len(nums)): numS...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMaxAverage(self, nums, k): """:type nums: List[int] :type k: int :rtype: float""" <|body_0|> def findMaxAverage(self, nums, k): """:type nums: List[int] :type k: int :rtype: float""" <|body_1|> <|end_skeleton|> <|body_start_0|> lar...
stack_v2_sparse_classes_75kplus_train_000602
1,151
no_license
[ { "docstring": ":type nums: List[int] :type k: int :rtype: float", "name": "findMaxAverage", "signature": "def findMaxAverage(self, nums, k)" }, { "docstring": ":type nums: List[int] :type k: int :rtype: float", "name": "findMaxAverage", "signature": "def findMaxAverage(self, nums, k)" ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMaxAverage(self, nums, k): :type nums: List[int] :type k: int :rtype: float - def findMaxAverage(self, nums, k): :type nums: List[int] :type k: int :rtype: float
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMaxAverage(self, nums, k): :type nums: List[int] :type k: int :rtype: float - def findMaxAverage(self, nums, k): :type nums: List[int] :type k: int :rtype: float <|skele...
a509b383a42f54313970168d9faa11f088f18708
<|skeleton|> class Solution: def findMaxAverage(self, nums, k): """:type nums: List[int] :type k: int :rtype: float""" <|body_0|> def findMaxAverage(self, nums, k): """:type nums: List[int] :type k: int :rtype: float""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def findMaxAverage(self, nums, k): """:type nums: List[int] :type k: int :rtype: float""" largest = -float('inf') for i in range(len(nums) - k + 1): largest = max(sum(nums[i:i + k]), largest) return float(largest) / k def findMaxAverage(self, nums, k)...
the_stack_v2_python_sparse
0643_Maximum_Average_Subarray_I.py
bingli8802/leetcode
train
0
0ea7b773d84ec9ea3d006c1f2930bd7fed8cc5d9
[ "toc, html = table_of_contents(u'')\nself.assertEqual(toc, u'')\nself.assertEqual(html, u'')", "toc, html = table_of_contents(u'<h2>Heading</h2>')\nself.assertEqual(toc, u'<li class=\"toc_h2\"><a href=\"#heading\">Heading</a></li>')\nself.assertEqual(html, u'<h2 id=\"heading\"><a href=\"#heading\" title=\"Permane...
<|body_start_0|> toc, html = table_of_contents(u'') self.assertEqual(toc, u'') self.assertEqual(html, u'') <|end_body_0|> <|body_start_1|> toc, html = table_of_contents(u'<h2>Heading</h2>') self.assertEqual(toc, u'<li class="toc_h2"><a href="#heading">Heading</a></li>') ...
UtilsMethodTests
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UtilsMethodTests: def test_table_of_contents_empty(self): """Empty text returns empty stings.""" <|body_0|> def test_table_of_contents_single(self): """Single heading returns one toc item.""" <|body_1|> def test_table_of_contents_respect_stings_before_an...
stack_v2_sparse_classes_75kplus_train_000603
3,242
permissive
[ { "docstring": "Empty text returns empty stings.", "name": "test_table_of_contents_empty", "signature": "def test_table_of_contents_empty(self)" }, { "docstring": "Single heading returns one toc item.", "name": "test_table_of_contents_single", "signature": "def test_table_of_contents_sin...
6
stack_v2_sparse_classes_30k_train_004055
Implement the Python class `UtilsMethodTests` described below. Class description: Implement the UtilsMethodTests class. Method signatures and docstrings: - def test_table_of_contents_empty(self): Empty text returns empty stings. - def test_table_of_contents_single(self): Single heading returns one toc item. - def tes...
Implement the Python class `UtilsMethodTests` described below. Class description: Implement the UtilsMethodTests class. Method signatures and docstrings: - def test_table_of_contents_empty(self): Empty text returns empty stings. - def test_table_of_contents_single(self): Single heading returns one toc item. - def tes...
a2ff1b5ade88378f1a72a7ab36d51965b06509b9
<|skeleton|> class UtilsMethodTests: def test_table_of_contents_empty(self): """Empty text returns empty stings.""" <|body_0|> def test_table_of_contents_single(self): """Single heading returns one toc item.""" <|body_1|> def test_table_of_contents_respect_stings_before_an...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UtilsMethodTests: def test_table_of_contents_empty(self): """Empty text returns empty stings.""" toc, html = table_of_contents(u'') self.assertEqual(toc, u'') self.assertEqual(html, u'') def test_table_of_contents_single(self): """Single heading returns one toc ite...
the_stack_v2_python_sparse
tvdordrecht/webapp/tests.py
allcaps/tvdordrecht.nl
train
0
9c408ce2e11503b7f8873952009a585bba4049f4
[ "if not marshmallow:\n raise LambdaError('Required marshmallow dependency not found.')\ntry:\n return (schema.load(instance), [])\nexcept marshmallow.ValidationError as error:\n return (None, error.messages)", "exception = marshmallow.ValidationError(errors)\nfield_errors = exception.normalized_messages(...
<|body_start_0|> if not marshmallow: raise LambdaError('Required marshmallow dependency not found.') try: return (schema.load(instance), []) except marshmallow.ValidationError as error: return (None, error.messages) <|end_body_0|> <|body_start_1|> exc...
A Validator that uses Marshmallow schemas.
MarshmallowValidator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MarshmallowValidator: """A Validator that uses Marshmallow schemas.""" def validate(self, instance: Any, schema: 'marshmallow.Schema') -> Tuple[Any, Union[Dict[str, Any], List[Any]]]: """Return the data and errors (if any) from validating `instance` against `schema`.""" <|bod...
stack_v2_sparse_classes_75kplus_train_000604
1,387
permissive
[ { "docstring": "Return the data and errors (if any) from validating `instance` against `schema`.", "name": "validate", "signature": "def validate(self, instance: Any, schema: 'marshmallow.Schema') -> Tuple[Any, Union[Dict[str, Any], List[Any]]]" }, { "docstring": "Re-format the errors from Marsh...
2
stack_v2_sparse_classes_30k_train_026566
Implement the Python class `MarshmallowValidator` described below. Class description: A Validator that uses Marshmallow schemas. Method signatures and docstrings: - def validate(self, instance: Any, schema: 'marshmallow.Schema') -> Tuple[Any, Union[Dict[str, Any], List[Any]]]: Return the data and errors (if any) from...
Implement the Python class `MarshmallowValidator` described below. Class description: A Validator that uses Marshmallow schemas. Method signatures and docstrings: - def validate(self, instance: Any, schema: 'marshmallow.Schema') -> Tuple[Any, Union[Dict[str, Any], List[Any]]]: Return the data and errors (if any) from...
dad59c93d75e628bee265dd18f920ccbbd3b0eb5
<|skeleton|> class MarshmallowValidator: """A Validator that uses Marshmallow schemas.""" def validate(self, instance: Any, schema: 'marshmallow.Schema') -> Tuple[Any, Union[Dict[str, Any], List[Any]]]: """Return the data and errors (if any) from validating `instance` against `schema`.""" <|bod...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MarshmallowValidator: """A Validator that uses Marshmallow schemas.""" def validate(self, instance: Any, schema: 'marshmallow.Schema') -> Tuple[Any, Union[Dict[str, Any], List[Any]]]: """Return the data and errors (if any) from validating `instance` against `schema`.""" if not marshmallow...
the_stack_v2_python_sparse
lambda_handlers/validators/marshmallow_validator.py
logan1202/lambda-handlers
train
0
8ca6e663ddd9614fbbcf333440ee9fd946ec65eb
[ "if width % 2 == 0:\n print('Width needs to be odd!')\n pass\nif height % 2 == 0:\n print('Height needs to be odd!')\n pass\nlowerW = (width - 1) / 2\nlowerH = (height - 1) / 2\nmat = numx.zeros((width, height))\nfor x in range(0, width):\n for y in range(0, height):\n mat[x, y] = numx.exp(-0....
<|body_start_0|> if width % 2 == 0: print('Width needs to be odd!') pass if height % 2 == 0: print('Height needs to be odd!') pass lowerW = (width - 1) / 2 lowerH = (height - 1) / 2 mat = numx.zeros((width, height)) for x in...
This class implements a weight layer that connects one unit layer to another with convolutional weights.
Convolving_weight_layer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Convolving_weight_layer: """This class implements a weight layer that connects one unit layer to another with convolutional weights.""" def construct_gauss_filter(cls, width, height, variance=1.0): """This function constructs a 2D-Gauss filter. :Parameters: width: Filter width. -type...
stack_v2_sparse_classes_75kplus_train_000605
19,732
no_license
[ { "docstring": "This function constructs a 2D-Gauss filter. :Parameters: width: Filter width. -type: int height Filter Height. -type: int variance Variance of the Gaussian -type: scalar :Returns: Convolved matrix with the same shape as matrix. -type: 2D numpy arrays", "name": "construct_gauss_filter", "...
5
stack_v2_sparse_classes_30k_train_049283
Implement the Python class `Convolving_weight_layer` described below. Class description: This class implements a weight layer that connects one unit layer to another with convolutional weights. Method signatures and docstrings: - def construct_gauss_filter(cls, width, height, variance=1.0): This function constructs a...
Implement the Python class `Convolving_weight_layer` described below. Class description: This class implements a weight layer that connects one unit layer to another with convolutional weights. Method signatures and docstrings: - def construct_gauss_filter(cls, width, height, variance=1.0): This function constructs a...
997879373110b2ee69fba921d46a309443c8e374
<|skeleton|> class Convolving_weight_layer: """This class implements a weight layer that connects one unit layer to another with convolutional weights.""" def construct_gauss_filter(cls, width, height, variance=1.0): """This function constructs a 2D-Gauss filter. :Parameters: width: Filter width. -type...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Convolving_weight_layer: """This class implements a weight layer that connects one unit layer to another with convolutional weights.""" def construct_gauss_filter(cls, width, height, variance=1.0): """This function constructs a 2D-Gauss filter. :Parameters: width: Filter width. -type: int height ...
the_stack_v2_python_sparse
pydeep/dbm/weight_layer.py
MelJan/PyDeep
train
50
4fc7a32c0888f1e407ae4a4706eaaf40051e0623
[ "super(Transpose1dLayer, self).__init__()\nself.upsample = upsample\nreflection_pad = nn.ConstantPad1d(kernel_size // 2, value=0)\nconv1d = nn.Conv1d(in_channels, out_channels, kernel_size, stride)\nconv1d.weight.data.normal_(0.0, 0.02)\nConv1dTrans = nn.ConvTranspose1d(in_channels, out_channels, kernel_size, strid...
<|body_start_0|> super(Transpose1dLayer, self).__init__() self.upsample = upsample reflection_pad = nn.ConstantPad1d(kernel_size // 2, value=0) conv1d = nn.Conv1d(in_channels, out_channels, kernel_size, stride) conv1d.weight.data.normal_(0.0, 0.02) Conv1dTrans = nn.ConvTr...
Package of all 1d Convolution Transpose Layer
Transpose1dLayer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Transpose1dLayer: """Package of all 1d Convolution Transpose Layer""" def __init__(self, in_channels, out_channels, kernel_size, stride, padding=11, upsample=None, output_padding=1, use_batch_norm=False) -> NoReturn: """Initialize 1d Convolution Transpose Layer package -*-*-*Convolut...
stack_v2_sparse_classes_75kplus_train_000606
5,819
permissive
[ { "docstring": "Initialize 1d Convolution Transpose Layer package -*-*-*Convolution Transpose summary*-*-*- There isn't a direct back-process to convolution like deconvolution but there is a technique to retrieve most of the information back called \"Convolution Transpose\". Apply convolution with bigger kernel...
2
stack_v2_sparse_classes_30k_train_018752
Implement the Python class `Transpose1dLayer` described below. Class description: Package of all 1d Convolution Transpose Layer Method signatures and docstrings: - def __init__(self, in_channels, out_channels, kernel_size, stride, padding=11, upsample=None, output_padding=1, use_batch_norm=False) -> NoReturn: Initial...
Implement the Python class `Transpose1dLayer` described below. Class description: Package of all 1d Convolution Transpose Layer Method signatures and docstrings: - def __init__(self, in_channels, out_channels, kernel_size, stride, padding=11, upsample=None, output_padding=1, use_batch_norm=False) -> NoReturn: Initial...
4eea5339c8ad0aae2861b8f7cc8ea88bdd0852ed
<|skeleton|> class Transpose1dLayer: """Package of all 1d Convolution Transpose Layer""" def __init__(self, in_channels, out_channels, kernel_size, stride, padding=11, upsample=None, output_padding=1, use_batch_norm=False) -> NoReturn: """Initialize 1d Convolution Transpose Layer package -*-*-*Convolut...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Transpose1dLayer: """Package of all 1d Convolution Transpose Layer""" def __init__(self, in_channels, out_channels, kernel_size, stride, padding=11, upsample=None, output_padding=1, use_batch_norm=False) -> NoReturn: """Initialize 1d Convolution Transpose Layer package -*-*-*Convolution Transpose...
the_stack_v2_python_sparse
not_functional/models/architectures/layers/BaseLayers.py
develooper1994/MasterThesis
train
6
d3e26da205120d5b7626ce9224ef72c312f5fd2c
[ "context = {}\ncontext['form'] = FilterForm()\nall_orders = list(OrderItem.objects.all().order_by('-updated_at'))\ncontext['all_orders'] = all_orders\ncontext['total_sales'] = sum([_.total_price for _ in all_orders])\nreturn render(request, self.template_name, context)", "form = FilterForm(request.POST)\ncontext ...
<|body_start_0|> context = {} context['form'] = FilterForm() all_orders = list(OrderItem.objects.all().order_by('-updated_at')) context['all_orders'] = all_orders context['total_sales'] = sum([_.total_price for _ in all_orders]) return render(request, self.template_name, ...
View to show all the past orders. This view also features a filter i.e. if you want to see all the coffee orders which are of tall and venti size.
AllOrdersView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AllOrdersView: """View to show all the past orders. This view also features a filter i.e. if you want to see all the coffee orders which are of tall and venti size.""" def get(self, request, *args, **kwargs): """Will show all orders placed till date and total sales and also renders a...
stack_v2_sparse_classes_75kplus_train_000607
5,791
no_license
[ { "docstring": "Will show all orders placed till date and total sales and also renders a form to filter by type and/or size.", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "Filteration view. If user wants to filter all tall coffee orders or all tall and...
2
null
Implement the Python class `AllOrdersView` described below. Class description: View to show all the past orders. This view also features a filter i.e. if you want to see all the coffee orders which are of tall and venti size. Method signatures and docstrings: - def get(self, request, *args, **kwargs): Will show all o...
Implement the Python class `AllOrdersView` described below. Class description: View to show all the past orders. This view also features a filter i.e. if you want to see all the coffee orders which are of tall and venti size. Method signatures and docstrings: - def get(self, request, *args, **kwargs): Will show all o...
ff77af514fc08fdb269d66836561e5f90b3020c2
<|skeleton|> class AllOrdersView: """View to show all the past orders. This view also features a filter i.e. if you want to see all the coffee orders which are of tall and venti size.""" def get(self, request, *args, **kwargs): """Will show all orders placed till date and total sales and also renders a...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AllOrdersView: """View to show all the past orders. This view also features a filter i.e. if you want to see all the coffee orders which are of tall and venti size.""" def get(self, request, *args, **kwargs): """Will show all orders placed till date and total sales and also renders a form to filt...
the_stack_v2_python_sparse
apps/order/views.py
iamsudip/wego
train
0
bd48d14b7a153ca5a323fbbad7dc30161407ee8d
[ "user = users.get_current_user()\nversion = self.GetBrowserVersion()\nassign = assignment.GetOrAssignTest(user=user, browser_version=version)\ntest_data = None\nif assign:\n test = assign.test\n test_data = {'key': assign.key().name(), 'run_name': test.run.name, 'url': test.start_url, 'steps': test.steps}\nse...
<|body_start_0|> user = users.get_current_user() version = self.GetBrowserVersion() assign = assignment.GetOrAssignTest(user=user, browser_version=version) test_data = None if assign: test = assign.test test_data = {'key': assign.key().name(), 'run_name': ...
Handler used to manage sites assigned (tests sites) to the current user.
TesterTestsHandler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TesterTestsHandler: """Handler used to manage sites assigned (tests sites) to the current user.""" def get(self): """Gets the test assignment view.""" <|body_0|> def post(self): """Updates the test assignment for the given user.""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_75kplus_train_000608
22,297
permissive
[ { "docstring": "Gets the test assignment view.", "name": "get", "signature": "def get(self)" }, { "docstring": "Updates the test assignment for the given user.", "name": "post", "signature": "def post(self)" } ]
2
null
Implement the Python class `TesterTestsHandler` described below. Class description: Handler used to manage sites assigned (tests sites) to the current user. Method signatures and docstrings: - def get(self): Gets the test assignment view. - def post(self): Updates the test assignment for the given user.
Implement the Python class `TesterTestsHandler` described below. Class description: Handler used to manage sites assigned (tests sites) to the current user. Method signatures and docstrings: - def get(self): Gets the test assignment view. - def post(self): Updates the test assignment for the given user. <|skeleton|>...
1b3a86ed01d7d47d20166d49b090d846cc98aa66
<|skeleton|> class TesterTestsHandler: """Handler used to manage sites assigned (tests sites) to the current user.""" def get(self): """Gets the test assignment view.""" <|body_0|> def post(self): """Updates the test assignment for the given user.""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TesterTestsHandler: """Handler used to manage sites assigned (tests sites) to the current user.""" def get(self): """Gets the test assignment view.""" user = users.get_current_user() version = self.GetBrowserVersion() assign = assignment.GetOrAssignTest(user=user, browser_...
the_stack_v2_python_sparse
server/handlers/site_compat.py
adambyram/bite-project-mod
train
1
cd20a3a1ce484aa2d645e4bfb2ea1b57df8ad5ac
[ "Block.__init__(self, parent, idevice)\nself.activity = idevice.activity\nself.answer = idevice.answer\nself.activityInstruc = idevice.activityInstruc\nself.answerInstruc = idevice.answerInstruc", "Block.process(self, request)\nif 'activity' + self.id in request.args:\n self.idevice.activity = request.args['ac...
<|body_start_0|> Block.__init__(self, parent, idevice) self.activity = idevice.activity self.answer = idevice.answer self.activityInstruc = idevice.activityInstruc self.answerInstruc = idevice.answerInstruc <|end_body_0|> <|body_start_1|> Block.process(self, request) ...
ReflectionBlock can render and process ReflectionIdevices as XHTML
ReflectionBlock
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReflectionBlock: """ReflectionBlock can render and process ReflectionIdevices as XHTML""" def __init__(self, parent, idevice): """Initialize a new Block object""" <|body_0|> def process(self, request): """Process the request arguments from the web server""" ...
stack_v2_sparse_classes_75kplus_train_000609
3,032
no_license
[ { "docstring": "Initialize a new Block object", "name": "__init__", "signature": "def __init__(self, parent, idevice)" }, { "docstring": "Process the request arguments from the web server", "name": "process", "signature": "def process(self, request)" }, { "docstring": "Returns an...
4
stack_v2_sparse_classes_30k_train_039231
Implement the Python class `ReflectionBlock` described below. Class description: ReflectionBlock can render and process ReflectionIdevices as XHTML Method signatures and docstrings: - def __init__(self, parent, idevice): Initialize a new Block object - def process(self, request): Process the request arguments from th...
Implement the Python class `ReflectionBlock` described below. Class description: ReflectionBlock can render and process ReflectionIdevices as XHTML Method signatures and docstrings: - def __init__(self, parent, idevice): Initialize a new Block object - def process(self, request): Process the request arguments from th...
1a99c1788f0eb9f1e5d8c2ced3892d00cd9449ad
<|skeleton|> class ReflectionBlock: """ReflectionBlock can render and process ReflectionIdevices as XHTML""" def __init__(self, parent, idevice): """Initialize a new Block object""" <|body_0|> def process(self, request): """Process the request arguments from the web server""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ReflectionBlock: """ReflectionBlock can render and process ReflectionIdevices as XHTML""" def __init__(self, parent, idevice): """Initialize a new Block object""" Block.__init__(self, parent, idevice) self.activity = idevice.activity self.answer = idevice.answer se...
the_stack_v2_python_sparse
eXe/rev2283-2366/base-trunk-2283/exe/webui/reflectionblock.py
joliebig/featurehouse_fstmerge_examples
train
3
de2941373c627b0f71a510aad1ee3b2e8adf99c3
[ "super(Encoder, self).__init__()\nself.input_size = input_size\nself.latent_size = latent_size\nself.class_size = class_size\nself.hidden_dim = 51200\nself.enc_cfg = enc_cfg\nself.cnn1 = nn.Sequential(nn.Conv2d(self.enc_cfg.in_channels, self.enc_cfg.cnn_filters[0], 3), nn.ReLU(), nn.BatchNorm2d(self.enc_cfg.cnn_fil...
<|body_start_0|> super(Encoder, self).__init__() self.input_size = input_size self.latent_size = latent_size self.class_size = class_size self.hidden_dim = 51200 self.enc_cfg = enc_cfg self.cnn1 = nn.Sequential(nn.Conv2d(self.enc_cfg.in_channels, self.enc_cfg.cnn_...
Encoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Encoder: def __init__(self, input_size, latent_size, class_size, enc_cfg): """Calculates q(z|x) from the given data input_size : (1, 28, 28) for MNIST dataset enc_cfg : Class object of Encoder Config class""" <|body_0|> def forward(self, x): """forward pass for the e...
stack_v2_sparse_classes_75kplus_train_000610
4,969
no_license
[ { "docstring": "Calculates q(z|x) from the given data input_size : (1, 28, 28) for MNIST dataset enc_cfg : Class object of Encoder Config class", "name": "__init__", "signature": "def __init__(self, input_size, latent_size, class_size, enc_cfg)" }, { "docstring": "forward pass for the encoder", ...
2
stack_v2_sparse_classes_30k_train_005310
Implement the Python class `Encoder` described below. Class description: Implement the Encoder class. Method signatures and docstrings: - def __init__(self, input_size, latent_size, class_size, enc_cfg): Calculates q(z|x) from the given data input_size : (1, 28, 28) for MNIST dataset enc_cfg : Class object of Encoder...
Implement the Python class `Encoder` described below. Class description: Implement the Encoder class. Method signatures and docstrings: - def __init__(self, input_size, latent_size, class_size, enc_cfg): Calculates q(z|x) from the given data input_size : (1, 28, 28) for MNIST dataset enc_cfg : Class object of Encoder...
b134e4e6b1e6c110fad8cb38b033c92c34d3c8ce
<|skeleton|> class Encoder: def __init__(self, input_size, latent_size, class_size, enc_cfg): """Calculates q(z|x) from the given data input_size : (1, 28, 28) for MNIST dataset enc_cfg : Class object of Encoder Config class""" <|body_0|> def forward(self, x): """forward pass for the e...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Encoder: def __init__(self, input_size, latent_size, class_size, enc_cfg): """Calculates q(z|x) from the given data input_size : (1, 28, 28) for MNIST dataset enc_cfg : Class object of Encoder Config class""" super(Encoder, self).__init__() self.input_size = input_size self.lat...
the_stack_v2_python_sparse
architectures_networks/Adversarial_Autoencoders/model.py
shubham14/Machine_learning_research
train
3
1597e41cbcb69b1f14689b6c93b54474a2b9f7b6
[ "enrollment_status_map = {}\nfor enrollment in enrollments:\n course_title = enrollment.course_run.course.title\n is_verified = mmtrack.is_enrolled_mmtrack(enrollment.course_run.edx_course_key)\n enrollment_status_map[course_title] = enrollment_status_map.get(course_title) or is_verified\nserialized_enroll...
<|body_start_0|> enrollment_status_map = {} for enrollment in enrollments: course_title = enrollment.course_run.course.title is_verified = mmtrack.is_enrolled_mmtrack(enrollment.course_run.edx_course_key) enrollment_status_map[course_title] = enrollment_status_map.get...
Provides functions for serializing a ProgramEnrollment for the ES index
UserProgramSearchSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserProgramSearchSerializer: """Provides functions for serializing a ProgramEnrollment for the ES index""" def serialize_enrollments(cls, mmtrack, enrollments): """Serializes a user's enrollment data for search results Args: mmtrack (MMTrack): An MMTrack object enrollments (iterable)...
stack_v2_sparse_classes_75kplus_train_000611
2,496
no_license
[ { "docstring": "Serializes a user's enrollment data for search results Args: mmtrack (MMTrack): An MMTrack object enrollments (iterable): An iterable of CachedEnrollments Returns: list: Serialized courses", "name": "serialize_enrollments", "signature": "def serialize_enrollments(cls, mmtrack, enrollment...
2
stack_v2_sparse_classes_30k_train_033760
Implement the Python class `UserProgramSearchSerializer` described below. Class description: Provides functions for serializing a ProgramEnrollment for the ES index Method signatures and docstrings: - def serialize_enrollments(cls, mmtrack, enrollments): Serializes a user's enrollment data for search results Args: mm...
Implement the Python class `UserProgramSearchSerializer` described below. Class description: Provides functions for serializing a ProgramEnrollment for the ES index Method signatures and docstrings: - def serialize_enrollments(cls, mmtrack, enrollments): Serializes a user's enrollment data for search results Args: mm...
3c166bc52dfe8d7aa04f922134f4f6deeff49eb6
<|skeleton|> class UserProgramSearchSerializer: """Provides functions for serializing a ProgramEnrollment for the ES index""" def serialize_enrollments(cls, mmtrack, enrollments): """Serializes a user's enrollment data for search results Args: mmtrack (MMTrack): An MMTrack object enrollments (iterable)...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserProgramSearchSerializer: """Provides functions for serializing a ProgramEnrollment for the ES index""" def serialize_enrollments(cls, mmtrack, enrollments): """Serializes a user's enrollment data for search results Args: mmtrack (MMTrack): An MMTrack object enrollments (iterable): An iterable...
the_stack_v2_python_sparse
dashboard/serializers.py
avontd2868/micromasters
train
0
02a014695f9753dc9efdd2f0dccd392c397e48c1
[ "self.binning_info = binning_info\nself.file_type = file_type\nself.njet_max = 4\nself.jet_types = ['ak4', 'ak8']\nit1 = [{'jet_type': 'ak4'}, {'jet_type': 'ak8'}]\nit2 = []\nfor njet in range(1, self.njet_max + 1):\n for ijet in range(1, njet + 1):\n for jet_type in self.jet_types:\n it2.appen...
<|body_start_0|> self.binning_info = binning_info self.file_type = file_type self.njet_max = 4 self.jet_types = ['ak4', 'ak8'] it1 = [{'jet_type': 'ak4'}, {'jet_type': 'ak8'}] it2 = [] for njet in range(1, self.njet_max + 1): for ijet in range(1, njet ...
Coffea processor for accumulating histograms of selected variables. Some variables are directly read from the ROOT file while other are computed on the fly. This must implement the following methods: * __init__ * initialize_ak_arrays * initialize_gen_weights __init__ defines the following attributes: * self.njet_max * ...
HistogramPFNanoAODExtension
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HistogramPFNanoAODExtension: """Coffea processor for accumulating histograms of selected variables. Some variables are directly read from the ROOT file while other are computed on the fly. This must implement the following methods: * __init__ * initialize_ak_arrays * initialize_gen_weights __init...
stack_v2_sparse_classes_75kplus_train_000612
6,945
no_license
[ { "docstring": "Define the variables to histogram, their binning and their coffea histogram object. Args: binning_info (dict): Form of the dictionary: { \"noregex\": { \"ak8Jet1_ak8Jet2_mass\" : [500 , 0 , 5000 ], }, \"regex\": { \"ak[48]Jet_n\" : [20 , 0 , 20 ], } } file_type (str) Returns: None", "name": ...
3
stack_v2_sparse_classes_30k_train_049452
Implement the Python class `HistogramPFNanoAODExtension` described below. Class description: Coffea processor for accumulating histograms of selected variables. Some variables are directly read from the ROOT file while other are computed on the fly. This must implement the following methods: * __init__ * initialize_ak...
Implement the Python class `HistogramPFNanoAODExtension` described below. Class description: Coffea processor for accumulating histograms of selected variables. Some variables are directly read from the ROOT file while other are computed on the fly. This must implement the following methods: * __init__ * initialize_ak...
37156adf5b92f787533094a97c64a64511f4400d
<|skeleton|> class HistogramPFNanoAODExtension: """Coffea processor for accumulating histograms of selected variables. Some variables are directly read from the ROOT file while other are computed on the fly. This must implement the following methods: * __init__ * initialize_ak_arrays * initialize_gen_weights __init...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HistogramPFNanoAODExtension: """Coffea processor for accumulating histograms of selected variables. Some variables are directly read from the ROOT file while other are computed on the fly. This must implement the following methods: * __init__ * initialize_ak_arrays * initialize_gen_weights __init__ defines th...
the_stack_v2_python_sparse
makeHistograms/HistogramPFNanoAODExtension.py
cesarecazzaniga/SVJanalysis
train
0
3cf1996c512d8f3da3a5622bcca33848d0a93395
[ "def invert(node):\n node.left, node.right = (node.right, node.left)\n if node.left:\n invert(node.left)\n if node.right:\n invert(node.right)\ninvert(root)\nreturn root", "def invert(node) -> TreeNode:\n node_copy = TreeNode(node.val)\n if node.left:\n node_copy.right = invert...
<|body_start_0|> def invert(node): node.left, node.right = (node.right, node.left) if node.left: invert(node.left) if node.right: invert(node.right) invert(root) return root <|end_body_0|> <|body_start_1|> def invert(no...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def invertTree_v1(self, root: TreeNode) -> TreeNode: """Invert in place .""" <|body_0|> def invertTree_v2(self, root: TreeNode) -> TreeNode: """Clone and invert.""" <|body_1|> <|end_skeleton|> <|body_start_0|> def invert(node): ...
stack_v2_sparse_classes_75kplus_train_000613
2,223
no_license
[ { "docstring": "Invert in place .", "name": "invertTree_v1", "signature": "def invertTree_v1(self, root: TreeNode) -> TreeNode" }, { "docstring": "Clone and invert.", "name": "invertTree_v2", "signature": "def invertTree_v2(self, root: TreeNode) -> TreeNode" } ]
2
stack_v2_sparse_classes_30k_train_031229
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def invertTree_v1(self, root: TreeNode) -> TreeNode: Invert in place . - def invertTree_v2(self, root: TreeNode) -> TreeNode: Clone and invert.
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def invertTree_v1(self, root: TreeNode) -> TreeNode: Invert in place . - def invertTree_v2(self, root: TreeNode) -> TreeNode: Clone and invert. <|skeleton|> class Solution: ...
97a2386f5e3adbd7138fd123810c3232bdf7f622
<|skeleton|> class Solution: def invertTree_v1(self, root: TreeNode) -> TreeNode: """Invert in place .""" <|body_0|> def invertTree_v2(self, root: TreeNode) -> TreeNode: """Clone and invert.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def invertTree_v1(self, root: TreeNode) -> TreeNode: """Invert in place .""" def invert(node): node.left, node.right = (node.right, node.left) if node.left: invert(node.left) if node.right: invert(node.right) ...
the_stack_v2_python_sparse
python3/trees_and_graphs/invert_tree.py
victorchu/algorithms
train
0
a6a8ef7ad8ffc631939ef197ebcd41ba591294c3
[ "SegmentSimMeasurement.__init__(self, source_segment, target_segment)\nself.sequence_type = sequence_type\nself.min_tile_length = min_tile_length\nself.ne_disambiguation = ne_disambiguation", "if self.sequence_type == 'manual':\n s1_nes = [token for token in self.source_segment.get_instances('named_entity_sequ...
<|body_start_0|> SegmentSimMeasurement.__init__(self, source_segment, target_segment) self.sequence_type = sequence_type self.min_tile_length = min_tile_length self.ne_disambiguation = ne_disambiguation <|end_body_0|> <|body_start_1|> if self.sequence_type == 'manual': ...
GreedyNETiling
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GreedyNETiling: def __init__(self, source_segment, target_segment, sequence_type='default', min_tile_length=2, ne_disambiguation=False): """:param source_segment: Segment from source article :param target_segment: Segment from target article :param sequence_type: Sequence manual of seque...
stack_v2_sparse_classes_75kplus_train_000614
2,409
permissive
[ { "docstring": ":param source_segment: Segment from source article :param target_segment: Segment from target article :param sequence_type: Sequence manual of sequence default :param ne_disambiguation: Flag, whether to disambiguate named entities", "name": "__init__", "signature": "def __init__(self, so...
2
stack_v2_sparse_classes_30k_train_010139
Implement the Python class `GreedyNETiling` described below. Class description: Implement the GreedyNETiling class. Method signatures and docstrings: - def __init__(self, source_segment, target_segment, sequence_type='default', min_tile_length=2, ne_disambiguation=False): :param source_segment: Segment from source ar...
Implement the Python class `GreedyNETiling` described below. Class description: Implement the GreedyNETiling class. Method signatures and docstrings: - def __init__(self, source_segment, target_segment, sequence_type='default', min_tile_length=2, ne_disambiguation=False): :param source_segment: Segment from source ar...
2e6a85dc9e95ef94bec2339987950f4e88f5d909
<|skeleton|> class GreedyNETiling: def __init__(self, source_segment, target_segment, sequence_type='default', min_tile_length=2, ne_disambiguation=False): """:param source_segment: Segment from source article :param target_segment: Segment from target article :param sequence_type: Sequence manual of seque...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GreedyNETiling: def __init__(self, source_segment, target_segment, sequence_type='default', min_tile_length=2, ne_disambiguation=False): """:param source_segment: Segment from source article :param target_segment: Segment from target article :param sequence_type: Sequence manual of sequence default :p...
the_stack_v2_python_sparse
newssimilarity/segment_sim/greedy_ne_tiling.py
imackerracher/NewsSimilarity
train
0
12d13c4e8ebb52e213bfdf1f2afb672c0966b735
[ "endpoint = cls.list_api_endpoint\nif user_id:\n endpoint += f'?user_id={user_id}'\nelif created_after:\n endpoint += f'?created_after={created_after.isoformat()}'\nresponse_json = cls.get(endpoint)\nmessages = [Message(**s) for s in response_json['results']]\nreturn messages", "response_json = cls.get(cls....
<|body_start_0|> endpoint = cls.list_api_endpoint if user_id: endpoint += f'?user_id={user_id}' elif created_after: endpoint += f'?created_after={created_after.isoformat()}' response_json = cls.get(endpoint) messages = [Message(**s) for s in response_json[...
Messages
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Messages: def list(cls, user_id: Optional[str]=None, created_after: Optional[datetime]=None) -> List[Message]: """Get messages between you and another user or your messages with all users :param user_id: Another user ID, must be provided if no created_after date is provided :param create...
stack_v2_sparse_classes_75kplus_train_000615
2,139
permissive
[ { "docstring": "Get messages between you and another user or your messages with all users :param user_id: Another user ID, must be provided if no created_after date is provided :param created_after: Only fetch messages created after timestamp. Must be provided if no user_id is provided. You can only fetch up to...
3
stack_v2_sparse_classes_30k_train_023141
Implement the Python class `Messages` described below. Class description: Implement the Messages class. Method signatures and docstrings: - def list(cls, user_id: Optional[str]=None, created_after: Optional[datetime]=None) -> List[Message]: Get messages between you and another user or your messages with all users :pa...
Implement the Python class `Messages` described below. Class description: Implement the Messages class. Method signatures and docstrings: - def list(cls, user_id: Optional[str]=None, created_after: Optional[datetime]=None) -> List[Message]: Get messages between you and another user or your messages with all users :pa...
1f540f9bd866d5fd625be4a4d61ad6bce564f1ed
<|skeleton|> class Messages: def list(cls, user_id: Optional[str]=None, created_after: Optional[datetime]=None) -> List[Message]: """Get messages between you and another user or your messages with all users :param user_id: Another user ID, must be provided if no created_after date is provided :param create...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Messages: def list(cls, user_id: Optional[str]=None, created_after: Optional[datetime]=None) -> List[Message]: """Get messages between you and another user or your messages with all users :param user_id: Another user ID, must be provided if no created_after date is provided :param created_after: Only ...
the_stack_v2_python_sparse
mephisto/abstractions/providers/prolific/api/messages.py
facebookresearch/Mephisto
train
281
1ea23f7df89e197e3f64225ce60dc77903226800
[ "self.root_app = root_app\ncontainer = ttk.Frame(root_app.background, width=root_app.navigator_width, height=root_app.canvas_height)\ncanvas = Canvas(container, width=root_app.navigator_width, height=root_app.canvas_height)\ncanvas.pack(side='left', fill='both', expand=True)\nscrollbar = ttk.Scrollbar(container, or...
<|body_start_0|> self.root_app = root_app container = ttk.Frame(root_app.background, width=root_app.navigator_width, height=root_app.canvas_height) canvas = Canvas(container, width=root_app.navigator_width, height=root_app.canvas_height) canvas.pack(side='left', fill='both', expand=True)...
Navigator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Navigator: def __init__(self, root_app): """Navigator Class Parameters ---------- root_app : AnnotationTool object Pass Parent Object to access global variables Attributes ---------- root_app : AnnotationTool object Parent Object Raises ------ None Returns ------- None""" <|body_...
stack_v2_sparse_classes_75kplus_train_000616
4,397
permissive
[ { "docstring": "Navigator Class Parameters ---------- root_app : AnnotationTool object Pass Parent Object to access global variables Attributes ---------- root_app : AnnotationTool object Parent Object Raises ------ None Returns ------- None", "name": "__init__", "signature": "def __init__(self, root_ap...
2
null
Implement the Python class `Navigator` described below. Class description: Implement the Navigator class. Method signatures and docstrings: - def __init__(self, root_app): Navigator Class Parameters ---------- root_app : AnnotationTool object Pass Parent Object to access global variables Attributes ---------- root_ap...
Implement the Python class `Navigator` described below. Class description: Implement the Navigator class. Method signatures and docstrings: - def __init__(self, root_app): Navigator Class Parameters ---------- root_app : AnnotationTool object Pass Parent Object to access global variables Attributes ---------- root_ap...
2de14b3498f54c0b893d3ba506d639cc1c598d53
<|skeleton|> class Navigator: def __init__(self, root_app): """Navigator Class Parameters ---------- root_app : AnnotationTool object Pass Parent Object to access global variables Attributes ---------- root_app : AnnotationTool object Parent Object Raises ------ None Returns ------- None""" <|body_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Navigator: def __init__(self, root_app): """Navigator Class Parameters ---------- root_app : AnnotationTool object Pass Parent Object to access global variables Attributes ---------- root_app : AnnotationTool object Parent Object Raises ------ None Returns ------- None""" self.root_app = root_...
the_stack_v2_python_sparse
navigator.py
ron-kemker/OpenAnnotation
train
2
aba917367e26729df403f71607c15be2c28c6bf6
[ "if key != 'command':\n raise errors.ParseError('Unable to parse record, unknown structure: {0:s}'.format(key))\nevent_data = ZshHistoryEventData()\nevent_data.command = self._GetValueFromStructure(structure, 'command')\nevent_data.elapsed_seconds = self._GetValueFromStructure(structure, 'elapsed_seconds')\ntime...
<|body_start_0|> if key != 'command': raise errors.ParseError('Unable to parse record, unknown structure: {0:s}'.format(key)) event_data = ZshHistoryEventData() event_data.command = self._GetValueFromStructure(structure, 'command') event_data.elapsed_seconds = self._GetValueF...
Parser for ZSH extended history files
ZshExtendedHistoryParser
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ZshExtendedHistoryParser: """Parser for ZSH extended history files""" def ParseRecord(self, parser_mediator, key, structure): """Parses a record and produces a ZSH history event. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such ...
stack_v2_sparse_classes_75kplus_train_000617
3,529
permissive
[ { "docstring": "Parses a record and produces a ZSH history event. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. key (str): name of the parsed structure. structure (pyparsing.ParseResults): structure parsed from the log file. Raises...
2
stack_v2_sparse_classes_30k_train_034233
Implement the Python class `ZshExtendedHistoryParser` described below. Class description: Parser for ZSH extended history files Method signatures and docstrings: - def ParseRecord(self, parser_mediator, key, structure): Parses a record and produces a ZSH history event. Args: parser_mediator (ParserMediator): mediates...
Implement the Python class `ZshExtendedHistoryParser` described below. Class description: Parser for ZSH extended history files Method signatures and docstrings: - def ParseRecord(self, parser_mediator, key, structure): Parses a record and produces a ZSH history event. Args: parser_mediator (ParserMediator): mediates...
c69b2952b608cfce47ff8fd0d1409d856be35cb1
<|skeleton|> class ZshExtendedHistoryParser: """Parser for ZSH extended history files""" def ParseRecord(self, parser_mediator, key, structure): """Parses a record and produces a ZSH history event. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ZshExtendedHistoryParser: """Parser for ZSH extended history files""" def ParseRecord(self, parser_mediator, key, structure): """Parses a record and produces a ZSH history event. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage an...
the_stack_v2_python_sparse
plaso/parsers/zsh_extended_history.py
cyb3rfox/plaso
train
3
1b0abc3c41a8b7b0786988f0119c3f3cc41113a0
[ "super(ResblockBody, self).__init__(**args)\nself.num_filters = num_filters\nself.num_blocks = num_blocks\nself.zero_padding1 = tf.keras.layers.ZeroPadding2D(((1, 0), (1, 0)))\nself.darknet_conv_bn_leaky1 = DarknetConv2D_BN_Leaky(self.num_filters, (3, 3), strides=(2, 2))\nself.blocks = []\nfor i in range(self.num_b...
<|body_start_0|> super(ResblockBody, self).__init__(**args) self.num_filters = num_filters self.num_blocks = num_blocks self.zero_padding1 = tf.keras.layers.ZeroPadding2D(((1, 0), (1, 0))) self.darknet_conv_bn_leaky1 = DarknetConv2D_BN_Leaky(self.num_filters, (3, 3), strides=(2, ...
ResblockBody
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResblockBody: def __init__(self, num_filters, num_blocks, **args): """初始化网络""" <|body_0|> def call(self, x, training): """运算部分""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(ResblockBody, self).__init__(**args) self.num_filters = num_...
stack_v2_sparse_classes_75kplus_train_000618
12,569
no_license
[ { "docstring": "初始化网络", "name": "__init__", "signature": "def __init__(self, num_filters, num_blocks, **args)" }, { "docstring": "运算部分", "name": "call", "signature": "def call(self, x, training)" } ]
2
stack_v2_sparse_classes_30k_train_007317
Implement the Python class `ResblockBody` described below. Class description: Implement the ResblockBody class. Method signatures and docstrings: - def __init__(self, num_filters, num_blocks, **args): 初始化网络 - def call(self, x, training): 运算部分
Implement the Python class `ResblockBody` described below. Class description: Implement the ResblockBody class. Method signatures and docstrings: - def __init__(self, num_filters, num_blocks, **args): 初始化网络 - def call(self, x, training): 运算部分 <|skeleton|> class ResblockBody: def __init__(self, num_filters, num_...
b7549701b0b1a7e4cc2c8275df2bc6c7a3253d24
<|skeleton|> class ResblockBody: def __init__(self, num_filters, num_blocks, **args): """初始化网络""" <|body_0|> def call(self, x, training): """运算部分""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ResblockBody: def __init__(self, num_filters, num_blocks, **args): """初始化网络""" super(ResblockBody, self).__init__(**args) self.num_filters = num_filters self.num_blocks = num_blocks self.zero_padding1 = tf.keras.layers.ZeroPadding2D(((1, 0), (1, 0))) self.darkne...
the_stack_v2_python_sparse
AIServer/ai_api/ai_models/yolo_v3/model.py
tfwcn/tensorflow2-machine-vision
train
1
dd71bd7d1b5b638cebda98e87d12cc8083dda51b
[ "super(EncoderCNN, self).__init__()\nresnet = None\nif resnet_version == 'resnet18':\n resnet = models.resnet18(pretrained=True)\nelif resnet_version == 'resnet34':\n resnet = models.resnet34(pretrained=True)\nelse:\n resnet = models.resnet50(pretrained=True)\nself.image_hidden_size = list(resnet.children(...
<|body_start_0|> super(EncoderCNN, self).__init__() resnet = None if resnet_version == 'resnet18': resnet = models.resnet18(pretrained=True) elif resnet_version == 'resnet34': resnet = models.resnet34(pretrained=True) else: resnet = models.resn...
EncoderCNN
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EncoderCNN: def __init__(self, resnet_version='resnet18', train_resnet=False): """Load the pretrained ResNet and replace top fully connected layer.""" <|body_0|> def forward(self, images): """Extract feature vectors from input images. input: images () output: feature...
stack_v2_sparse_classes_75kplus_train_000619
8,852
no_license
[ { "docstring": "Load the pretrained ResNet and replace top fully connected layer.", "name": "__init__", "signature": "def __init__(self, resnet_version='resnet18', train_resnet=False)" }, { "docstring": "Extract feature vectors from input images. input: images () output: features (N, H*W, C)", ...
2
null
Implement the Python class `EncoderCNN` described below. Class description: Implement the EncoderCNN class. Method signatures and docstrings: - def __init__(self, resnet_version='resnet18', train_resnet=False): Load the pretrained ResNet and replace top fully connected layer. - def forward(self, images): Extract feat...
Implement the Python class `EncoderCNN` described below. Class description: Implement the EncoderCNN class. Method signatures and docstrings: - def __init__(self, resnet_version='resnet18', train_resnet=False): Load the pretrained ResNet and replace top fully connected layer. - def forward(self, images): Extract feat...
d5a566842c1e4ea60b96323af9c72fdc9e1e5e61
<|skeleton|> class EncoderCNN: def __init__(self, resnet_version='resnet18', train_resnet=False): """Load the pretrained ResNet and replace top fully connected layer.""" <|body_0|> def forward(self, images): """Extract feature vectors from input images. input: images () output: feature...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EncoderCNN: def __init__(self, resnet_version='resnet18', train_resnet=False): """Load the pretrained ResNet and replace top fully connected layer.""" super(EncoderCNN, self).__init__() resnet = None if resnet_version == 'resnet18': resnet = models.resnet18(pretrain...
the_stack_v2_python_sparse
model/model_attention.py
chenyipeng1/SI699_Hashtag
train
2
6479c06810459e14a4eccaebfa64d5cafab14b76
[ "prev_min = prev_max = global_max = nums[0]\nfor num in nums[1:]:\n minn, maxx = (min(num, prev_max * num, prev_min * num), max(num, prev_max * num, prev_min * num))\n prev_min, prev_max, global_max = (minn, maxx, max(global_max, maxx))\nreturn global_max", "front_max = front_min = global_max = nums[0]\nfor...
<|body_start_0|> prev_min = prev_max = global_max = nums[0] for num in nums[1:]: minn, maxx = (min(num, prev_max * num, prev_min * num), max(num, prev_max * num, prev_min * num)) prev_min, prev_max, global_max = (minn, maxx, max(global_max, maxx)) return global_max <|end_...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProduct(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def maxProduct_1(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> def maxProduct_2(self, nums): """:type nums: List[int] :rtype: int""" ...
stack_v2_sparse_classes_75kplus_train_000620
3,237
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "maxProduct", "signature": "def maxProduct(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "maxProduct_1", "signature": "def maxProduct_1(self, nums)" }, { "docstring": ":type nums: List[int] ...
4
stack_v2_sparse_classes_30k_train_032868
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProduct(self, nums): :type nums: List[int] :rtype: int - def maxProduct_1(self, nums): :type nums: List[int] :rtype: int - def maxProduct_2(self, nums): :type nums: List[i...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProduct(self, nums): :type nums: List[int] :rtype: int - def maxProduct_1(self, nums): :type nums: List[int] :rtype: int - def maxProduct_2(self, nums): :type nums: List[i...
3d9e0ad2f6ed92ec969556f75d97c51ea4854719
<|skeleton|> class Solution: def maxProduct(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def maxProduct_1(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> def maxProduct_2(self, nums): """:type nums: List[int] :rtype: int""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def maxProduct(self, nums): """:type nums: List[int] :rtype: int""" prev_min = prev_max = global_max = nums[0] for num in nums[1:]: minn, maxx = (min(num, prev_max * num, prev_min * num), max(num, prev_max * num, prev_min * num)) prev_min, prev_max, gl...
the_stack_v2_python_sparse
Solutions/0152_maxProduct.py
YoupengLi/leetcode-sorting
train
3
9090d2d5193b977778ac13e0f191544669e802ab
[ "super().__init__()\nself.output_feature_size = output_feature_size\nself.dropout = dropout\noutput_size, self.inject_input = inject_input(input_feature_size, action_feature_size + output_feature_size, output_feature_size, output_feature_size)\nself.lstm = nn.LSTMCell(output_size, output_feature_size)", "h_n = hi...
<|body_start_0|> super().__init__() self.output_feature_size = output_feature_size self.dropout = dropout output_size, self.inject_input = inject_input(input_feature_size, action_feature_size + output_feature_size, output_feature_size, output_feature_size) self.lstm = nn.LSTMCell...
LSTMTreeDecoder
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LSTMTreeDecoder: def __init__(self, inject_input: InjectInput, input_feature_size: int, action_feature_size: int, output_feature_size: int, dropout: float=0.0): """Constructor Parameters ---------- input_feature_size: int Size of each input vector action_feature_size: int Size of each Ac...
stack_v2_sparse_classes_75kplus_train_000621
5,183
permissive
[ { "docstring": "Constructor Parameters ---------- input_feature_size: int Size of each input vector action_feature_size: int Size of each ActionSequence vector output_feature_size: int The number of features in the hidden state dropout: float The probability of dropout", "name": "__init__", "signature":...
2
stack_v2_sparse_classes_30k_train_030795
Implement the Python class `LSTMTreeDecoder` described below. Class description: Implement the LSTMTreeDecoder class. Method signatures and docstrings: - def __init__(self, inject_input: InjectInput, input_feature_size: int, action_feature_size: int, output_feature_size: int, dropout: float=0.0): Constructor Paramete...
Implement the Python class `LSTMTreeDecoder` described below. Class description: Implement the LSTMTreeDecoder class. Method signatures and docstrings: - def __init__(self, inject_input: InjectInput, input_feature_size: int, action_feature_size: int, output_feature_size: int, dropout: float=0.0): Constructor Paramete...
573e94c567064705fa65267dd83946bf183197de
<|skeleton|> class LSTMTreeDecoder: def __init__(self, inject_input: InjectInput, input_feature_size: int, action_feature_size: int, output_feature_size: int, dropout: float=0.0): """Constructor Parameters ---------- input_feature_size: int Size of each input vector action_feature_size: int Size of each Ac...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LSTMTreeDecoder: def __init__(self, inject_input: InjectInput, input_feature_size: int, action_feature_size: int, output_feature_size: int, dropout: float=0.0): """Constructor Parameters ---------- input_feature_size: int Size of each input vector action_feature_size: int Size of each ActionSequence v...
the_stack_v2_python_sparse
mlprogram/nn/action_sequence/lstm_tree_decoder.py
brando90/mlprogram
train
0
78d1e9cc87ca03582cca80474a1fa00d6fae4e53
[ "try:\n resp = User().get_data_by_userid(userid)\n return masked_json_template(resp, 200)\nexcept:\n abort(400, 'Input unrecognizable.')", "try:\n json_data = api.payload\n resp = User().update_data_by_userid(userid, json_data)\n return masked_json_template(resp, 200)\nexcept:\n abort(400, 'I...
<|body_start_0|> try: resp = User().get_data_by_userid(userid) return masked_json_template(resp, 200) except: abort(400, 'Input unrecognizable.') <|end_body_0|> <|body_start_1|> try: json_data = api.payload resp = User().update_data_by...
UserIDFindRoute
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserIDFindRoute: def get(self, userid): """Get user data by user ID""" <|body_0|> def put(self, userid): """Update user data by user ID""" <|body_1|> def delete(self, userid): """Delete user data by user ID""" <|body_2|> <|end_skeleton|>...
stack_v2_sparse_classes_75kplus_train_000622
5,083
permissive
[ { "docstring": "Get user data by user ID", "name": "get", "signature": "def get(self, userid)" }, { "docstring": "Update user data by user ID", "name": "put", "signature": "def put(self, userid)" }, { "docstring": "Delete user data by user ID", "name": "delete", "signatur...
3
stack_v2_sparse_classes_30k_train_051314
Implement the Python class `UserIDFindRoute` described below. Class description: Implement the UserIDFindRoute class. Method signatures and docstrings: - def get(self, userid): Get user data by user ID - def put(self, userid): Update user data by user ID - def delete(self, userid): Delete user data by user ID
Implement the Python class `UserIDFindRoute` described below. Class description: Implement the UserIDFindRoute class. Method signatures and docstrings: - def get(self, userid): Get user data by user ID - def put(self, userid): Update user data by user ID - def delete(self, userid): Delete user data by user ID <|skel...
100fca0d2dd9b0b2ab2fa5974d8126af35ddcfd1
<|skeleton|> class UserIDFindRoute: def get(self, userid): """Get user data by user ID""" <|body_0|> def put(self, userid): """Update user data by user ID""" <|body_1|> def delete(self, userid): """Delete user data by user ID""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserIDFindRoute: def get(self, userid): """Get user data by user ID""" try: resp = User().get_data_by_userid(userid) return masked_json_template(resp, 200) except: abort(400, 'Input unrecognizable.') def put(self, userid): """Update user...
the_stack_v2_python_sparse
app/controllers/api/user/user.py
ardihikaru/api-dashboard-5g-dive
train
0
ea4581fc47301ecc33a351c0e591e0071bae272a
[ "super(LocalInfoNCELoss, self).__init__()\nself.tau = tau\nself.K = K\nself.n_region = n_region\nself.device = device\nself.pos_mask, self.neg_mask = self.get_masks(n_region)\nself.similarity_f = nn.CosineSimilarity(dim=3)\nself.criterion = nn.CrossEntropyLoss(reduction='mean')", "pos_mask = torch.diag(torch.ones...
<|body_start_0|> super(LocalInfoNCELoss, self).__init__() self.tau = tau self.K = K self.n_region = n_region self.device = device self.pos_mask, self.neg_mask = self.get_masks(n_region) self.similarity_f = nn.CosineSimilarity(dim=3) self.criterion = nn.Cro...
Define the extension of the InfoNCELoss for local structure as proposed in Chaitanya (2020). It enforces feature map region of two representation to be mapped similarly in a decoonvolutional network. Region are selected randomly on the feature map.
LocalInfoNCELoss
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LocalInfoNCELoss: """Define the extension of the InfoNCELoss for local structure as proposed in Chaitanya (2020). It enforces feature map region of two representation to be mapped similarly in a decoonvolutional network. Region are selected randomly on the feature map.""" def __init__(self, ...
stack_v2_sparse_classes_75kplus_train_000623
22,277
permissive
[ { "docstring": "Build a Local InfoNCE loss module. ---------- INPUT |---- tau (float) temperature hyperparameter of InfoNCE loss. |---- K (int) the size of the region to consider (region will be KxK). |---- n_region (int) the number of region to consider within a feature map. |---- device (str) the device to us...
4
null
Implement the Python class `LocalInfoNCELoss` described below. Class description: Define the extension of the InfoNCELoss for local structure as proposed in Chaitanya (2020). It enforces feature map region of two representation to be mapped similarly in a decoonvolutional network. Region are selected randomly on the f...
Implement the Python class `LocalInfoNCELoss` described below. Class description: Define the extension of the InfoNCELoss for local structure as proposed in Chaitanya (2020). It enforces feature map region of two representation to be mapped similarly in a decoonvolutional network. Region are selected randomly on the f...
61e74a6188fe82843085e87da7d9c4ec7bdbf85e
<|skeleton|> class LocalInfoNCELoss: """Define the extension of the InfoNCELoss for local structure as proposed in Chaitanya (2020). It enforces feature map region of two representation to be mapped similarly in a decoonvolutional network. Region are selected randomly on the feature map.""" def __init__(self, ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LocalInfoNCELoss: """Define the extension of the InfoNCELoss for local structure as proposed in Chaitanya (2020). It enforces feature map region of two representation to be mapped similarly in a decoonvolutional network. Region are selected randomly on the feature map.""" def __init__(self, tau=0.5, K=3,...
the_stack_v2_python_sparse
code/src/models/optim/LossFunctions.py
antoine-spahr/Label-Efficient-Volumetric-Deep-Semantic-Segmentation-of-ICH
train
6
44600ea2f5cc3a65c8728e5f89347e4aeb7f7c20
[ "if public_ip is not None:\n self.vn_data['gcpAssignPublicIP'] = public_ip\nreturn self", "if zone == '':\n self.vn_data['gcpZone'] = None\nelif zone is not None:\n self.vn_data['gcpZone'] = zone\nif project_id == '':\n self.vn_data['gcpProjectIdForCreatedResources'] = None\nelif project_id is not Non...
<|body_start_0|> if public_ip is not None: self.vn_data['gcpAssignPublicIP'] = public_ip return self <|end_body_0|> <|body_start_1|> if zone == '': self.vn_data['gcpZone'] = None elif zone is not None: self.vn_data['gcpZone'] = zone if project...
FMGCPVirtualNetwork
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FMGCPVirtualNetwork: def set_assign_public_ip(self, public_ip=True): """Sets whether the instances on this network will have a publicly accessible IP :param bool public_ip: if False, the instances will not be accessible from outside GCP""" <|body_0|> def set_location_for_cre...
stack_v2_sparse_classes_75kplus_train_000624
13,612
permissive
[ { "docstring": "Sets whether the instances on this network will have a publicly accessible IP :param bool public_ip: if False, the instances will not be accessible from outside GCP", "name": "set_assign_public_ip", "signature": "def set_assign_public_ip(self, public_ip=True)" }, { "docstring": "...
3
stack_v2_sparse_classes_30k_train_052833
Implement the Python class `FMGCPVirtualNetwork` described below. Class description: Implement the FMGCPVirtualNetwork class. Method signatures and docstrings: - def set_assign_public_ip(self, public_ip=True): Sets whether the instances on this network will have a publicly accessible IP :param bool public_ip: if Fals...
Implement the Python class `FMGCPVirtualNetwork` described below. Class description: Implement the FMGCPVirtualNetwork class. Method signatures and docstrings: - def set_assign_public_ip(self, public_ip=True): Sets whether the instances on this network will have a publicly accessible IP :param bool public_ip: if Fals...
2f218b45b6354998cc2403ff517c5ef132fe8fdb
<|skeleton|> class FMGCPVirtualNetwork: def set_assign_public_ip(self, public_ip=True): """Sets whether the instances on this network will have a publicly accessible IP :param bool public_ip: if False, the instances will not be accessible from outside GCP""" <|body_0|> def set_location_for_cre...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FMGCPVirtualNetwork: def set_assign_public_ip(self, public_ip=True): """Sets whether the instances on this network will have a publicly accessible IP :param bool public_ip: if False, the instances will not be accessible from outside GCP""" if public_ip is not None: self.vn_data['gc...
the_stack_v2_python_sparse
dataikuapi/fm/virtualnetworks.py
dataiku/dataiku-api-client-python
train
33
fcc40d881c57e9b3641e318243dfd2a8ec7ca38a
[ "k = 0\nfor n in range(L, R + 1):\n result = bin(n).count('1')\n if is_prime(result):\n k = k + 1\nreturn k", "primes = {2, 3, 5, 7, 11, 13, 17, 19}\nres = 0\nfor num in range(L, R + 1):\n if bin(num).count('1') in primes:\n res += 1\nreturn res" ]
<|body_start_0|> k = 0 for n in range(L, R + 1): result = bin(n).count('1') if is_prime(result): k = k + 1 return k <|end_body_0|> <|body_start_1|> primes = {2, 3, 5, 7, 11, 13, 17, 19} res = 0 for num in range(L, R + 1): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def countPrimeSetBits(self, L, R): """:type L: int :type R: int :rtype: int""" <|body_0|> def static_countPrimeSetBits(self, L, R): """:type L: int :type R: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> k = 0 for ...
stack_v2_sparse_classes_75kplus_train_000625
1,993
no_license
[ { "docstring": ":type L: int :type R: int :rtype: int", "name": "countPrimeSetBits", "signature": "def countPrimeSetBits(self, L, R)" }, { "docstring": ":type L: int :type R: int :rtype: int", "name": "static_countPrimeSetBits", "signature": "def static_countPrimeSetBits(self, L, R)" }...
2
stack_v2_sparse_classes_30k_train_049565
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countPrimeSetBits(self, L, R): :type L: int :type R: int :rtype: int - def static_countPrimeSetBits(self, L, R): :type L: int :type R: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countPrimeSetBits(self, L, R): :type L: int :type R: int :rtype: int - def static_countPrimeSetBits(self, L, R): :type L: int :type R: int :rtype: int <|skeleton|> class Sol...
6350568d16b0f8c49a020f055bb6d72e2705ea56
<|skeleton|> class Solution: def countPrimeSetBits(self, L, R): """:type L: int :type R: int :rtype: int""" <|body_0|> def static_countPrimeSetBits(self, L, R): """:type L: int :type R: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def countPrimeSetBits(self, L, R): """:type L: int :type R: int :rtype: int""" k = 0 for n in range(L, R + 1): result = bin(n).count('1') if is_prime(result): k = k + 1 return k def static_countPrimeSetBits(self, L, R): ...
the_stack_v2_python_sparse
bit-manipulation/762_Prime_Number_of_Set_Bits_in_Binary_Representation.py
vsdrun/lc_public
train
6
3cae711f467f76900f7f38461ad3fd4e0e302a92
[ "self.used_ifids: DefaultDict[ISD_AS, List[IfId]] = defaultdict(list)\nfor link in topo_file['links']:\n for ep in [LinkEp(link['a']), LinkEp(link['b'])]:\n if ep.ifid:\n self.used_ifids[ep].append(IfId(ep.ifid))\nfor ifids in self.used_ifids.values():\n ifids.sort()", "ifid = pick_unused_...
<|body_start_0|> self.used_ifids: DefaultDict[ISD_AS, List[IfId]] = defaultdict(list) for link in topo_file['links']: for ep in [LinkEp(link['a']), LinkEp(link['b'])]: if ep.ifid: self.used_ifids[ep].append(IfId(ep.ifid)) for ifids in self.used_ifi...
Helper class keeping track of assigned interface identifers per AS.
IfIdMapping
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IfIdMapping: """Helper class keeping track of assigned interface identifers per AS.""" def __init__(self, topo_file: MutableMapping[str, Any]): """Initializes used interface identifier sets from the given topology file.""" <|body_0|> def assign_ifid(self, isd_as: ISD_AS)...
stack_v2_sparse_classes_75kplus_train_000626
25,735
permissive
[ { "docstring": "Initializes used interface identifier sets from the given topology file.", "name": "__init__", "signature": "def __init__(self, topo_file: MutableMapping[str, Any])" }, { "docstring": "Returns an unused ifid in the given AS and marks it as used for future calls.", "name": "as...
2
stack_v2_sparse_classes_30k_train_045958
Implement the Python class `IfIdMapping` described below. Class description: Helper class keeping track of assigned interface identifers per AS. Method signatures and docstrings: - def __init__(self, topo_file: MutableMapping[str, Any]): Initializes used interface identifier sets from the given topology file. - def a...
Implement the Python class `IfIdMapping` described below. Class description: Helper class keeping track of assigned interface identifers per AS. Method signatures and docstrings: - def __init__(self, topo_file: MutableMapping[str, Any]): Initializes used interface identifier sets from the given topology file. - def a...
3d06a8fb030b17faec40026d21758ecbfb3d6744
<|skeleton|> class IfIdMapping: """Helper class keeping track of assigned interface identifers per AS.""" def __init__(self, topo_file: MutableMapping[str, Any]): """Initializes used interface identifier sets from the given topology file.""" <|body_0|> def assign_ifid(self, isd_as: ISD_AS)...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class IfIdMapping: """Helper class keeping track of assigned interface identifers per AS.""" def __init__(self, topo_file: MutableMapping[str, Any]): """Initializes used interface identifier sets from the given topology file.""" self.used_ifids: DefaultDict[ISD_AS, List[IfId]] = defaultdict(lis...
the_stack_v2_python_sparse
ixp_testbed/gen/generator.py
lschulz/scion-ixp-testbed
train
0
46f0c064e6b0835db6c3066df3a2c9741df4bacf
[ "ctx.ss = spatial_sigma\nctx.cs = color_sigma\nctx.fa = fast_approx\noutput_data = _C.bilateral_filter(input, spatial_sigma, color_sigma, fast_approx)\nreturn output_data", "spatial_sigma, color_sigma, fast_approx = (ctx.ss, ctx.cs, ctx.fa)\ngrad_input = _C.bilateral_filter(grad_output, spatial_sigma, color_sigma...
<|body_start_0|> ctx.ss = spatial_sigma ctx.cs = color_sigma ctx.fa = fast_approx output_data = _C.bilateral_filter(input, spatial_sigma, color_sigma, fast_approx) return output_data <|end_body_0|> <|body_start_1|> spatial_sigma, color_sigma, fast_approx = (ctx.ss, ctx.c...
Blurs the input tensor spatially whilst preserving edges. Can run on 1D, 2D, or 3D, tensors (on top of Batch and Channel dimensions). Two implementations are provided, an exact solution and a much faster approximation which uses a permutohedral lattice. See: https://en.wikipedia.org/wiki/Bilateral_filter https://graphi...
BilateralFilter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BilateralFilter: """Blurs the input tensor spatially whilst preserving edges. Can run on 1D, 2D, or 3D, tensors (on top of Batch and Channel dimensions). Two implementations are provided, an exact solution and a much faster approximation which uses a permutohedral lattice. See: https://en.wikiped...
stack_v2_sparse_classes_75kplus_train_000627
17,992
permissive
[ { "docstring": "autograd forward", "name": "forward", "signature": "def forward(ctx, input, spatial_sigma=5, color_sigma=0.5, fast_approx=True)" }, { "docstring": "autograd backward", "name": "backward", "signature": "def backward(ctx, grad_output)" } ]
2
stack_v2_sparse_classes_30k_train_035637
Implement the Python class `BilateralFilter` described below. Class description: Blurs the input tensor spatially whilst preserving edges. Can run on 1D, 2D, or 3D, tensors (on top of Batch and Channel dimensions). Two implementations are provided, an exact solution and a much faster approximation which uses a permuto...
Implement the Python class `BilateralFilter` described below. Class description: Blurs the input tensor spatially whilst preserving edges. Can run on 1D, 2D, or 3D, tensors (on top of Batch and Channel dimensions). Two implementations are provided, an exact solution and a much faster approximation which uses a permuto...
e48c3e2c741fa3fc705c4425d17ac4a5afac6c47
<|skeleton|> class BilateralFilter: """Blurs the input tensor spatially whilst preserving edges. Can run on 1D, 2D, or 3D, tensors (on top of Batch and Channel dimensions). Two implementations are provided, an exact solution and a much faster approximation which uses a permutohedral lattice. See: https://en.wikiped...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BilateralFilter: """Blurs the input tensor spatially whilst preserving edges. Can run on 1D, 2D, or 3D, tensors (on top of Batch and Channel dimensions). Two implementations are provided, an exact solution and a much faster approximation which uses a permutohedral lattice. See: https://en.wikipedia.org/wiki/B...
the_stack_v2_python_sparse
monai/networks/layers/filtering.py
Project-MONAI/MONAI
train
4,805
4f10b46ef45bdea8771b475fa58607ec86aa6285
[ "if fields and detail:\n raise exception.InvalidParameterValue('Can not specify ?detail=True and fields in the same request.')\napi_utils.check_policy('baremetal:driver:get')\napi_utils.check_allow_driver_detail(detail)\napi_utils.check_allow_filter_driver_type(type)\n_check_allow_driver_fields(fields)\nif type ...
<|body_start_0|> if fields and detail: raise exception.InvalidParameterValue('Can not specify ?detail=True and fields in the same request.') api_utils.check_policy('baremetal:driver:get') api_utils.check_allow_driver_detail(detail) api_utils.check_allow_filter_driver_type(typ...
REST controller for Drivers.
DriversController
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DriversController: """REST controller for Drivers.""" def get_all(self, type=None, detail=None, fields=None): """Retrieve a list of drivers.""" <|body_0|> def get_one(self, driver_name, fields=None): """Retrieve a single driver.""" <|body_1|> def pro...
stack_v2_sparse_classes_75kplus_train_000628
15,740
permissive
[ { "docstring": "Retrieve a list of drivers.", "name": "get_all", "signature": "def get_all(self, type=None, detail=None, fields=None)" }, { "docstring": "Retrieve a single driver.", "name": "get_one", "signature": "def get_one(self, driver_name, fields=None)" }, { "docstring": "R...
3
null
Implement the Python class `DriversController` described below. Class description: REST controller for Drivers. Method signatures and docstrings: - def get_all(self, type=None, detail=None, fields=None): Retrieve a list of drivers. - def get_one(self, driver_name, fields=None): Retrieve a single driver. - def propert...
Implement the Python class `DriversController` described below. Class description: REST controller for Drivers. Method signatures and docstrings: - def get_all(self, type=None, detail=None, fields=None): Retrieve a list of drivers. - def get_one(self, driver_name, fields=None): Retrieve a single driver. - def propert...
ab76ff12e1c3c2208455e917f1a40d4000b4e990
<|skeleton|> class DriversController: """REST controller for Drivers.""" def get_all(self, type=None, detail=None, fields=None): """Retrieve a list of drivers.""" <|body_0|> def get_one(self, driver_name, fields=None): """Retrieve a single driver.""" <|body_1|> def pro...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DriversController: """REST controller for Drivers.""" def get_all(self, type=None, detail=None, fields=None): """Retrieve a list of drivers.""" if fields and detail: raise exception.InvalidParameterValue('Can not specify ?detail=True and fields in the same request.') a...
the_stack_v2_python_sparse
ironic/api/controllers/v1/driver.py
openstack/ironic
train
411
33a520de9fd06e4f62f2093a7d1eb6e18769cc65
[ "if not email:\n raise ValueError(_('The Email must be set'))\nemail = self.normalize_email(email)\nuser = self.model(email=email, username=username, **extra_fields)\nuser.set_password(password)\nuser.save()\nreturn user", "extra_fields.setdefault('is_staff', True)\nextra_fields.setdefault('is_superuser', True...
<|body_start_0|> if not email: raise ValueError(_('The Email must be set')) email = self.normalize_email(email) user = self.model(email=email, username=username, **extra_fields) user.set_password(password) user.save() return user <|end_body_0|> <|body_start_1...
CustomUserManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomUserManager: def create_user(self, email, username, password, **extra_fields): """Create and save a User with the given email and password.""" <|body_0|> def create_superuser(self, email, username, password, **extra_fields): """Create and save a SuperUser with ...
stack_v2_sparse_classes_75kplus_train_000629
3,876
no_license
[ { "docstring": "Create and save a User with the given email and password.", "name": "create_user", "signature": "def create_user(self, email, username, password, **extra_fields)" }, { "docstring": "Create and save a SuperUser with the given email and password.", "name": "create_superuser", ...
2
null
Implement the Python class `CustomUserManager` described below. Class description: Implement the CustomUserManager class. Method signatures and docstrings: - def create_user(self, email, username, password, **extra_fields): Create and save a User with the given email and password. - def create_superuser(self, email, ...
Implement the Python class `CustomUserManager` described below. Class description: Implement the CustomUserManager class. Method signatures and docstrings: - def create_user(self, email, username, password, **extra_fields): Create and save a User with the given email and password. - def create_superuser(self, email, ...
ee828a5ec7ffa874993299a9bf79dceaa11da80c
<|skeleton|> class CustomUserManager: def create_user(self, email, username, password, **extra_fields): """Create and save a User with the given email and password.""" <|body_0|> def create_superuser(self, email, username, password, **extra_fields): """Create and save a SuperUser with ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CustomUserManager: def create_user(self, email, username, password, **extra_fields): """Create and save a User with the given email and password.""" if not email: raise ValueError(_('The Email must be set')) email = self.normalize_email(email) user = self.model(emai...
the_stack_v2_python_sparse
server/models/user.py
YAPP-16th/Team_Web_1_Backend
train
3
4eb211a916703cde49557c40a3d667fe86269cb3
[ "se = SequencingExperiment.query.get(kf_id)\nif se is None:\n abort(404, 'could not find {} `{}`'.format('sequencing_experiment', kf_id))\nreturn SequencingExperimentSchema().jsonify(se)", "se = SequencingExperiment.query.get(kf_id)\nif se is None:\n abort(404, 'could not find {} `{}`'.format('sequencing_ex...
<|body_start_0|> se = SequencingExperiment.query.get(kf_id) if se is None: abort(404, 'could not find {} `{}`'.format('sequencing_experiment', kf_id)) return SequencingExperimentSchema().jsonify(se) <|end_body_0|> <|body_start_1|> se = SequencingExperiment.query.get(kf_id) ...
SequencingExperiment REST API
SequencingExperimentAPI
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SequencingExperimentAPI: """SequencingExperiment REST API""" def get(self, kf_id): """Get a sequencing_experiment by id --- template: path: get_by_id.yml properties: resource: SequencingExperiment""" <|body_0|> def patch(self, kf_id): """Update an existing sequen...
stack_v2_sparse_classes_75kplus_train_000630
6,474
permissive
[ { "docstring": "Get a sequencing_experiment by id --- template: path: get_by_id.yml properties: resource: SequencingExperiment", "name": "get", "signature": "def get(self, kf_id)" }, { "docstring": "Update an existing sequencing_experiment. Allows partial update of resource --- template: path: u...
3
null
Implement the Python class `SequencingExperimentAPI` described below. Class description: SequencingExperiment REST API Method signatures and docstrings: - def get(self, kf_id): Get a sequencing_experiment by id --- template: path: get_by_id.yml properties: resource: SequencingExperiment - def patch(self, kf_id): Upda...
Implement the Python class `SequencingExperimentAPI` described below. Class description: SequencingExperiment REST API Method signatures and docstrings: - def get(self, kf_id): Get a sequencing_experiment by id --- template: path: get_by_id.yml properties: resource: SequencingExperiment - def patch(self, kf_id): Upda...
36ee3fc3d1ba9d1a177274d051fb175c56dd898e
<|skeleton|> class SequencingExperimentAPI: """SequencingExperiment REST API""" def get(self, kf_id): """Get a sequencing_experiment by id --- template: path: get_by_id.yml properties: resource: SequencingExperiment""" <|body_0|> def patch(self, kf_id): """Update an existing sequen...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SequencingExperimentAPI: """SequencingExperiment REST API""" def get(self, kf_id): """Get a sequencing_experiment by id --- template: path: get_by_id.yml properties: resource: SequencingExperiment""" se = SequencingExperiment.query.get(kf_id) if se is None: abort(404, ...
the_stack_v2_python_sparse
dataservice/api/sequencing_experiment/resources.py
kids-first/kf-api-dataservice
train
9
ba5b3c14286eae33b13698809693a4f00da4be8a
[ "new_project = AdviserProject.objects.create(**validated_data)\nplayers = self.initial_data.get('players', [])\nPlayer.send_project(players, new_project)\nreturn new_project", "instance.name = validated_data.get('name', instance.name)\ninstance.description = validated_data.get('description', instance.description)...
<|body_start_0|> new_project = AdviserProject.objects.create(**validated_data) players = self.initial_data.get('players', []) Player.send_project(players, new_project) return new_project <|end_body_0|> <|body_start_1|> instance.name = validated_data.get('name', instance.name) ...
Serializer for AdviserProject
AdviserProjectSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdviserProjectSerializer: """Serializer for AdviserProject""" def create(self, validated_data): """Create and return a new "AdviserProject" instance, given the validated data. Also send created AdviserProject to selected players""" <|body_0|> def update(self, instance, v...
stack_v2_sparse_classes_75kplus_train_000631
1,471
no_license
[ { "docstring": "Create and return a new \"AdviserProject\" instance, given the validated data. Also send created AdviserProject to selected players", "name": "create", "signature": "def create(self, validated_data)" }, { "docstring": "Update and return an existing \"AdviserProject\" instance, gi...
2
stack_v2_sparse_classes_30k_train_004473
Implement the Python class `AdviserProjectSerializer` described below. Class description: Serializer for AdviserProject Method signatures and docstrings: - def create(self, validated_data): Create and return a new "AdviserProject" instance, given the validated data. Also send created AdviserProject to selected player...
Implement the Python class `AdviserProjectSerializer` described below. Class description: Serializer for AdviserProject Method signatures and docstrings: - def create(self, validated_data): Create and return a new "AdviserProject" instance, given the validated data. Also send created AdviserProject to selected player...
46bbe0fb30ce151e398034720939fb4fecea9ac5
<|skeleton|> class AdviserProjectSerializer: """Serializer for AdviserProject""" def create(self, validated_data): """Create and return a new "AdviserProject" instance, given the validated data. Also send created AdviserProject to selected players""" <|body_0|> def update(self, instance, v...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AdviserProjectSerializer: """Serializer for AdviserProject""" def create(self, validated_data): """Create and return a new "AdviserProject" instance, given the validated data. Also send created AdviserProject to selected players""" new_project = AdviserProject.objects.create(**validated_d...
the_stack_v2_python_sparse
itaplay/itaplay/projects/serializers.py
TarasStankovskyi/itaplay
train
0
e81ce1a1a3ddec77988f145c8be6e1e2010c7c62
[ "action = rule['action']\nuser_id = rule.get('user_id', '*')\nroom_id = rule.get('room_id', '*')\nalias = rule.get('alias', '*')\nif action in ('allow', 'deny'):\n self.action = action\nelse:\n raise ConfigError(\"%s rules can only have action of 'allow' or 'deny'\" % (option_name,))\nself._alias_matches_all ...
<|body_start_0|> action = rule['action'] user_id = rule.get('user_id', '*') room_id = rule.get('room_id', '*') alias = rule.get('alias', '*') if action in ('allow', 'deny'): self.action = action else: raise ConfigError("%s rules can only have actio...
Helper class to test whether a room directory action is allowed, like creating an alias or publishing a room.
_RoomDirectoryRule
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _RoomDirectoryRule: """Helper class to test whether a room directory action is allowed, like creating an alias or publishing a room.""" def __init__(self, option_name: str, rule: JsonDict): """Args: option_name: Name of the config option this rule belongs to rule: The rule as specifi...
stack_v2_sparse_classes_75kplus_train_000632
5,480
permissive
[ { "docstring": "Args: option_name: Name of the config option this rule belongs to rule: The rule as specified in the config", "name": "__init__", "signature": "def __init__(self, option_name: str, rule: JsonDict)" }, { "docstring": "Tests if this rule matches the given user_id, room_id and alias...
2
stack_v2_sparse_classes_30k_train_049642
Implement the Python class `_RoomDirectoryRule` described below. Class description: Helper class to test whether a room directory action is allowed, like creating an alias or publishing a room. Method signatures and docstrings: - def __init__(self, option_name: str, rule: JsonDict): Args: option_name: Name of the con...
Implement the Python class `_RoomDirectoryRule` described below. Class description: Helper class to test whether a room directory action is allowed, like creating an alias or publishing a room. Method signatures and docstrings: - def __init__(self, option_name: str, rule: JsonDict): Args: option_name: Name of the con...
d35bed8369514fe727b4fe1afb68f48cc8b2655a
<|skeleton|> class _RoomDirectoryRule: """Helper class to test whether a room directory action is allowed, like creating an alias or publishing a room.""" def __init__(self, option_name: str, rule: JsonDict): """Args: option_name: Name of the config option this rule belongs to rule: The rule as specifi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class _RoomDirectoryRule: """Helper class to test whether a room directory action is allowed, like creating an alias or publishing a room.""" def __init__(self, option_name: str, rule: JsonDict): """Args: option_name: Name of the config option this rule belongs to rule: The rule as specified in the con...
the_stack_v2_python_sparse
synapse/config/room_directory.py
matrix-org/synapse
train
12,215
922ee48224dad11e6eae1de8f3f78967d8c6eb19
[ "super().__init__(master, **kwargs)\nself.master.title(title)\nself.master.columnconfigure(0, weight=1)\nself.master.rowconfigure(0, weight=1)\nself.grid(sticky='NEWS')\nself.create_widgets()\nfor column in range(self.grid_size()[0]):\n self.columnconfigure(column, weight=1)\nfor row in range(self.grid_size()[1]...
<|body_start_0|> super().__init__(master, **kwargs) self.master.title(title) self.master.columnconfigure(0, weight=1) self.master.rowconfigure(0, weight=1) self.grid(sticky='NEWS') self.create_widgets() for column in range(self.grid_size()[0]): self.co...
Sample tkinter application class
Application
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Application: """Sample tkinter application class""" def __init__(self, master=None, title='<application>', **kwargs): """Create root window with frame, tune weight and resize""" <|body_0|> def create_widgets(self): """Create all the widgets""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_000633
1,239
no_license
[ { "docstring": "Create root window with frame, tune weight and resize", "name": "__init__", "signature": "def __init__(self, master=None, title='<application>', **kwargs)" }, { "docstring": "Create all the widgets", "name": "create_widgets", "signature": "def create_widgets(self)" } ]
2
null
Implement the Python class `Application` described below. Class description: Sample tkinter application class Method signatures and docstrings: - def __init__(self, master=None, title='<application>', **kwargs): Create root window with frame, tune weight and resize - def create_widgets(self): Create all the widgets
Implement the Python class `Application` described below. Class description: Sample tkinter application class Method signatures and docstrings: - def __init__(self, master=None, title='<application>', **kwargs): Create root window with frame, tune weight and resize - def create_widgets(self): Create all the widgets ...
6167e7c6803a5e9509dce0742cac8d62bf70f96a
<|skeleton|> class Application: """Sample tkinter application class""" def __init__(self, master=None, title='<application>', **kwargs): """Create root window with frame, tune weight and resize""" <|body_0|> def create_widgets(self): """Create all the widgets""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Application: """Sample tkinter application class""" def __init__(self, master=None, title='<application>', **kwargs): """Create root window with frame, tune weight and resize""" super().__init__(master, **kwargs) self.master.title(title) self.master.columnconfigure(0, weig...
the_stack_v2_python_sparse
20210405_1/task_1.py
TheGhost8/pythonprac
train
0
58267d18ea74cf0511604d99e7ee5072d91dc4e8
[ "QtCore.QObject.__init__(self)\nself.q = Queue()\nself.fit = fo.fit_object(self.q, options[3], options[0], options[1], options[2], data)\nname = 'run_' + str(run) + 'index_' + str(options[3]) + '.txt'\nself.savePath = os.path.join(path, name)\nself.data = data\nself.index = options[3]\nself.exp_data = exp_data", ...
<|body_start_0|> QtCore.QObject.__init__(self) self.q = Queue() self.fit = fo.fit_object(self.q, options[3], options[0], options[1], options[2], data) name = 'run_' + str(run) + 'index_' + str(options[3]) + '.txt' self.savePath = os.path.join(path, name) self.data = data ...
Processing object for threading purposes @parameters data: numpy array options: list of options for fit parameters [params, type_of_fit, ROI, index
ProcessImage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProcessImage: """Processing object for threading purposes @parameters data: numpy array options: list of options for fit parameters [params, type_of_fit, ROI, index""" def __init__(self, data, exp_data, options, path, run): """initialize fit_object""" <|body_0|> def run(...
stack_v2_sparse_classes_75kplus_train_000634
3,400
no_license
[ { "docstring": "initialize fit_object", "name": "__init__", "signature": "def __init__(self, data, exp_data, options, path, run)" }, { "docstring": "process results using methods from fit process and emit", "name": "run", "signature": "def run(self)" } ]
2
stack_v2_sparse_classes_30k_val_001156
Implement the Python class `ProcessImage` described below. Class description: Processing object for threading purposes @parameters data: numpy array options: list of options for fit parameters [params, type_of_fit, ROI, index Method signatures and docstrings: - def __init__(self, data, exp_data, options, path, run): ...
Implement the Python class `ProcessImage` described below. Class description: Processing object for threading purposes @parameters data: numpy array options: list of options for fit parameters [params, type_of_fit, ROI, index Method signatures and docstrings: - def __init__(self, data, exp_data, options, path, run): ...
788fb964cdf7a5cfd747aa6e064ee31a4ffc3518
<|skeleton|> class ProcessImage: """Processing object for threading purposes @parameters data: numpy array options: list of options for fit parameters [params, type_of_fit, ROI, index""" def __init__(self, data, exp_data, options, path, run): """initialize fit_object""" <|body_0|> def run(...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ProcessImage: """Processing object for threading purposes @parameters data: numpy array options: list of options for fit parameters [params, type_of_fit, ROI, index""" def __init__(self, data, exp_data, options, path, run): """initialize fit_object""" QtCore.QObject.__init__(self) ...
the_stack_v2_python_sparse
BECMonitor/Image.py
ZachGlassman/BECMonitor
train
1
b2c516639ecd7ce0e218b8e9f3ac03b67ea58938
[ "box = Box.get_by_urlsafe_key(request.boxKey)\nif not box:\n message = 'No box with the key \"%s\" exists.' % request.boxKey\n raise endpoints.NotFoundException(message)\nreturn BoxHelper.create_box(box)", "product = Product.get_by_urlsafe_key(request.productKey)\nuser = User.get_by_urlsafe_key(request.user...
<|body_start_0|> box = Box.get_by_urlsafe_key(request.boxKey) if not box: message = 'No box with the key "%s" exists.' % request.boxKey raise endpoints.NotFoundException(message) return BoxHelper.create_box(box) <|end_body_0|> <|body_start_1|> product = Product.g...
The API for the aWare Box concept
Boxes
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Boxes: """The API for the aWare Box concept""" def get_box(self, request): """Retrieve a single box for a specific product and user""" <|body_0|> def get_boxes(self, request): """Retrieve a list of boxes for a specific product and user""" <|body_1|> <|en...
stack_v2_sparse_classes_75kplus_train_000635
3,048
no_license
[ { "docstring": "Retrieve a single box for a specific product and user", "name": "get_box", "signature": "def get_box(self, request)" }, { "docstring": "Retrieve a list of boxes for a specific product and user", "name": "get_boxes", "signature": "def get_boxes(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_016120
Implement the Python class `Boxes` described below. Class description: The API for the aWare Box concept Method signatures and docstrings: - def get_box(self, request): Retrieve a single box for a specific product and user - def get_boxes(self, request): Retrieve a list of boxes for a specific product and user
Implement the Python class `Boxes` described below. Class description: The API for the aWare Box concept Method signatures and docstrings: - def get_box(self, request): Retrieve a single box for a specific product and user - def get_boxes(self, request): Retrieve a list of boxes for a specific product and user <|ske...
777dd28290210f589f804d3d66d2a4a87079b736
<|skeleton|> class Boxes: """The API for the aWare Box concept""" def get_box(self, request): """Retrieve a single box for a specific product and user""" <|body_0|> def get_boxes(self, request): """Retrieve a list of boxes for a specific product and user""" <|body_1|> <|en...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Boxes: """The API for the aWare Box concept""" def get_box(self, request): """Retrieve a single box for a specific product and user""" box = Box.get_by_urlsafe_key(request.boxKey) if not box: message = 'No box with the key "%s" exists.' % request.boxKey rai...
the_stack_v2_python_sparse
api/internal/boxes.py
shubashri/src
train
0
4b4514da69d54d32f117b0bc7f49c9e5229c5748
[ "self.k = k\nself.heap = []\nfor n in nums:\n if len(self.heap) < k:\n heapq.heappush(self.heap, n)\n elif n > self.heap[0]:\n heapq.heapreplace(self.heap, n)", "if len(self.heap) < self.k:\n heapq.heappush(self.heap, val)\n return self.heap[0]\nif val > self.heap[0]:\n heapq.heaprepl...
<|body_start_0|> self.k = k self.heap = [] for n in nums: if len(self.heap) < k: heapq.heappush(self.heap, n) elif n > self.heap[0]: heapq.heapreplace(self.heap, n) <|end_body_0|> <|body_start_1|> if len(self.heap) < self.k: ...
KthLargest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.k = k self.heap = [] for n in nums: ...
stack_v2_sparse_classes_75kplus_train_000636
1,643
no_license
[ { "docstring": ":type k: int :type nums: List[int]", "name": "__init__", "signature": "def __init__(self, k, nums)" }, { "docstring": ":type val: int :rtype: int", "name": "add", "signature": "def add(self, val)" } ]
2
stack_v2_sparse_classes_30k_train_047743
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int <|skeleton|> class KthLargest: def __init__(self, k, nu...
e4d21223c85b622b5a905d1a056dfb2f300964b1
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" self.k = k self.heap = [] for n in nums: if len(self.heap) < k: heapq.heappush(self.heap, n) elif n > self.heap[0]: heapq.heapreplace(self.h...
the_stack_v2_python_sparse
Algorithms/heap/703.kth-largest-element-in-a-stream/kth-largest-element-in-a-stream.py
gosyang/leetcode
train
1
de8627e72009b23b70758efa5f46729af0a511b8
[ "strSet = set()\nfor i in A:\n str = ''.join(sorted(i[0::2])) + '#'\n if len(i) > 1:\n str += ''.join(sorted(i[1::2]))\n if str not in strSet:\n strSet.add(str)\nreturn len(strSet)", "def count(str):\n c = [0] * 52\n for i in range(len(str)):\n c[ord(str[i]) - ord('a') + 26 * (...
<|body_start_0|> strSet = set() for i in A: str = ''.join(sorted(i[0::2])) + '#' if len(i) > 1: str += ''.join(sorted(i[1::2])) if str not in strSet: strSet.add(str) return len(strSet) <|end_body_0|> <|body_start_1|> de...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numSpecialEquivGroups_1(self, A): """:type A: List[str] :rtype: int""" <|body_0|> def numSpecialEquivGroups(self, A): """:type A: List[str] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> strSet = set() for i in A: ...
stack_v2_sparse_classes_75kplus_train_000637
1,910
no_license
[ { "docstring": ":type A: List[str] :rtype: int", "name": "numSpecialEquivGroups_1", "signature": "def numSpecialEquivGroups_1(self, A)" }, { "docstring": ":type A: List[str] :rtype: int", "name": "numSpecialEquivGroups", "signature": "def numSpecialEquivGroups(self, A)" } ]
2
stack_v2_sparse_classes_30k_train_002107
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numSpecialEquivGroups_1(self, A): :type A: List[str] :rtype: int - def numSpecialEquivGroups(self, A): :type A: List[str] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numSpecialEquivGroups_1(self, A): :type A: List[str] :rtype: int - def numSpecialEquivGroups(self, A): :type A: List[str] :rtype: int <|skeleton|> class Solution: def n...
0fdc1d60cfb3f4c26698a493da4986bfc873e02a
<|skeleton|> class Solution: def numSpecialEquivGroups_1(self, A): """:type A: List[str] :rtype: int""" <|body_0|> def numSpecialEquivGroups(self, A): """:type A: List[str] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def numSpecialEquivGroups_1(self, A): """:type A: List[str] :rtype: int""" strSet = set() for i in A: str = ''.join(sorted(i[0::2])) + '#' if len(i) > 1: str += ''.join(sorted(i[1::2])) if str not in strSet: ...
the_stack_v2_python_sparse
893_GroupsofSpecialEquivalentStrings/893_GroupsofSpecialEquivalentStrings.py
ranson/leetcode
train
0
66bcc4d4c8919e5e854cdee11dcfb5309c4bdbdb
[ "api_version = '2019-04-01'\nurl = self.get_catalog.metadata['url']\npath_format_arguments = {'subscriptionId': self._serialize.url('subscription_id', subscription_id, 'str')}\nurl = self._client.format_url(url, **path_format_arguments)\nquery_parameters = {}\nquery_parameters['api-version'] = self._serialize.query...
<|body_start_0|> api_version = '2019-04-01' url = self.get_catalog.metadata['url'] path_format_arguments = {'subscriptionId': self._serialize.url('subscription_id', subscription_id, 'str')} url = self._client.format_url(url, **path_format_arguments) query_parameters = {} ...
AzureReservationAPIOperationsMixin
[ "LicenseRef-scancode-generic-cla", "LGPL-2.1-or-later", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AzureReservationAPIOperationsMixin: def get_catalog(self, subscription_id, reserved_resource_type, location=None, custom_headers=None, raw=False, **operation_config): """Get the regions and skus that are available for RI purchase for the specified Azure subscription. :param subscription_...
stack_v2_sparse_classes_75kplus_train_000638
6,657
permissive
[ { "docstring": "Get the regions and skus that are available for RI purchase for the specified Azure subscription. :param subscription_id: Id of the subscription :type subscription_id: str :param reserved_resource_type: The type of the resource for which the skus should be provided. :type reserved_resource_type:...
2
stack_v2_sparse_classes_30k_train_052347
Implement the Python class `AzureReservationAPIOperationsMixin` described below. Class description: Implement the AzureReservationAPIOperationsMixin class. Method signatures and docstrings: - def get_catalog(self, subscription_id, reserved_resource_type, location=None, custom_headers=None, raw=False, **operation_conf...
Implement the Python class `AzureReservationAPIOperationsMixin` described below. Class description: Implement the AzureReservationAPIOperationsMixin class. Method signatures and docstrings: - def get_catalog(self, subscription_id, reserved_resource_type, location=None, custom_headers=None, raw=False, **operation_conf...
f779de8e53dbec033f98f976284e6d9491fd60b3
<|skeleton|> class AzureReservationAPIOperationsMixin: def get_catalog(self, subscription_id, reserved_resource_type, location=None, custom_headers=None, raw=False, **operation_config): """Get the regions and skus that are available for RI purchase for the specified Azure subscription. :param subscription_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AzureReservationAPIOperationsMixin: def get_catalog(self, subscription_id, reserved_resource_type, location=None, custom_headers=None, raw=False, **operation_config): """Get the regions and skus that are available for RI purchase for the specified Azure subscription. :param subscription_id: Id of the ...
the_stack_v2_python_sparse
sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_azure_reservation_api_operations.py
YijunXieMS/azure-sdk-for-python
train
1
d8e35c1a1ac0eade95c617147945579462d6bf12
[ "super(FeedLink, self).__init__()\nself.title = title\nself.message_url = message_url\nself.pic_url = pic_url", "if all(map(is_not_null_and_blank_str, [self.title, self.message_url, self.pic_url])):\n data = {'title': self.title, 'messageURL': self.message_url, 'picURL': self.pic_url}\n return data\nelse:\n...
<|body_start_0|> super(FeedLink, self).__init__() self.title = title self.message_url = message_url self.pic_url = pic_url <|end_body_0|> <|body_start_1|> if all(map(is_not_null_and_blank_str, [self.title, self.message_url, self.pic_url])): data = {'title': self.titl...
FeedCard类型单条消息格式
FeedLink
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FeedLink: """FeedCard类型单条消息格式""" def __init__(self, title, message_url, pic_url): """初始化单条消息文本 :param title: 单条消息文本 :param message_url: 点击单条信息后触发的URL :param pic_url: 点击单条消息后面图片触发的URL""" <|body_0|> def get_data(self): """获取FeedLink消息数据(字典) :return: 本FeedLink消息的数据"...
stack_v2_sparse_classes_75kplus_train_000639
19,135
permissive
[ { "docstring": "初始化单条消息文本 :param title: 单条消息文本 :param message_url: 点击单条信息后触发的URL :param pic_url: 点击单条消息后面图片触发的URL", "name": "__init__", "signature": "def __init__(self, title, message_url, pic_url)" }, { "docstring": "获取FeedLink消息数据(字典) :return: 本FeedLink消息的数据", "name": "get_data", "sign...
2
stack_v2_sparse_classes_30k_train_036978
Implement the Python class `FeedLink` described below. Class description: FeedCard类型单条消息格式 Method signatures and docstrings: - def __init__(self, title, message_url, pic_url): 初始化单条消息文本 :param title: 单条消息文本 :param message_url: 点击单条信息后触发的URL :param pic_url: 点击单条消息后面图片触发的URL - def get_data(self): 获取FeedLink消息数据(字典) :re...
Implement the Python class `FeedLink` described below. Class description: FeedCard类型单条消息格式 Method signatures and docstrings: - def __init__(self, title, message_url, pic_url): 初始化单条消息文本 :param title: 单条消息文本 :param message_url: 点击单条信息后触发的URL :param pic_url: 点击单条消息后面图片触发的URL - def get_data(self): 获取FeedLink消息数据(字典) :re...
4214a6dffc554b0e27354d1322cfe7d9a7494871
<|skeleton|> class FeedLink: """FeedCard类型单条消息格式""" def __init__(self, title, message_url, pic_url): """初始化单条消息文本 :param title: 单条消息文本 :param message_url: 点击单条信息后触发的URL :param pic_url: 点击单条消息后面图片触发的URL""" <|body_0|> def get_data(self): """获取FeedLink消息数据(字典) :return: 本FeedLink消息的数据"...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FeedLink: """FeedCard类型单条消息格式""" def __init__(self, title, message_url, pic_url): """初始化单条消息文本 :param title: 单条消息文本 :param message_url: 点击单条信息后触发的URL :param pic_url: 点击单条消息后面图片触发的URL""" super(FeedLink, self).__init__() self.title = title self.message_url = message_url ...
the_stack_v2_python_sparse
02src/02finalProject/04dingtalk_chatbot/dingtalkchatbot/chatbot.py
eiahb3838ya/PHBS_AI_TweetSentimentExtraction
train
6
f8973512582a078cd9c764dd5715067069ad0d24
[ "self.assertEqual(count_vowels('hello world'), 3)\nself.assertEqual(count_vowels('hEllO world'), 3)\nself.assertNotEqual(count_vowels('hll wrld'), 9)\nself.assertEqual(count_vowels('9876421a!o&g'), 2)\nself.assertEqual(count_vowels('hll wrld'), 0)", "self.assertEqual(last_occurrence(target='Y', string='pyYthon'),...
<|body_start_0|> self.assertEqual(count_vowels('hello world'), 3) self.assertEqual(count_vowels('hEllO world'), 3) self.assertNotEqual(count_vowels('hll wrld'), 9) self.assertEqual(count_vowels('9876421a!o&g'), 2) self.assertEqual(count_vowels('hll wrld'), 0) <|end_body_0|> <|bo...
TestIteration
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestIteration: def test_count_vowels(self): """test the total number of vowels in a string""" <|body_0|> def test_last_occurrence(self): """test the last occurrence of an element in a string or list""" <|body_1|> def test_my_enumerate(self): """t...
stack_v2_sparse_classes_75kplus_train_000640
7,256
no_license
[ { "docstring": "test the total number of vowels in a string", "name": "test_count_vowels", "signature": "def test_count_vowels(self)" }, { "docstring": "test the last occurrence of an element in a string or list", "name": "test_last_occurrence", "signature": "def test_last_occurrence(sel...
3
stack_v2_sparse_classes_30k_train_038574
Implement the Python class `TestIteration` described below. Class description: Implement the TestIteration class. Method signatures and docstrings: - def test_count_vowels(self): test the total number of vowels in a string - def test_last_occurrence(self): test the last occurrence of an element in a string or list - ...
Implement the Python class `TestIteration` described below. Class description: Implement the TestIteration class. Method signatures and docstrings: - def test_count_vowels(self): test the total number of vowels in a string - def test_last_occurrence(self): test the last occurrence of an element in a string or list - ...
6fea7b54756f30e1f44d1019853f3dd88e2e905b
<|skeleton|> class TestIteration: def test_count_vowels(self): """test the total number of vowels in a string""" <|body_0|> def test_last_occurrence(self): """test the last occurrence of an element in a string or list""" <|body_1|> def test_my_enumerate(self): """t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestIteration: def test_count_vowels(self): """test the total number of vowels in a string""" self.assertEqual(count_vowels('hello world'), 3) self.assertEqual(count_vowels('hEllO world'), 3) self.assertNotEqual(count_vowels('hll wrld'), 9) self.assertEqual(count_vowels...
the_stack_v2_python_sparse
HW04_Test_Ejona_Kocibelli.py
ekocibelli/Special-Topics-in-SE
train
0
76f61f0da683de1207955d6952826a9c99489868
[ "if not gas:\n return False\nif not cost:\n return True\nn = gas.__len__()\nstart = 0\ncur = 0\niter = 0\nwhile True:\n cur += gas[iter] - cost[iter]\n iter += 1\n if cur < 0:\n if iter <= start:\n start += 1\n else:\n start = iter\n cur = 0\n else:\n ...
<|body_start_0|> if not gas: return False if not cost: return True n = gas.__len__() start = 0 cur = 0 iter = 0 while True: cur += gas[iter] - cost[iter] iter += 1 if cur < 0: if iter <= s...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def canCompleteCircuit(self, gas, cost): """:type gas: List[int] :type cost: List[int] :rtype: int""" <|body_0|> def canCompleteCircuit1(self, gas, cost): """:type gas: List[int] :type cost: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|b...
stack_v2_sparse_classes_75kplus_train_000641
1,721
no_license
[ { "docstring": ":type gas: List[int] :type cost: List[int] :rtype: int", "name": "canCompleteCircuit", "signature": "def canCompleteCircuit(self, gas, cost)" }, { "docstring": ":type gas: List[int] :type cost: List[int] :rtype: int", "name": "canCompleteCircuit1", "signature": "def canCo...
2
stack_v2_sparse_classes_30k_test_002932
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canCompleteCircuit(self, gas, cost): :type gas: List[int] :type cost: List[int] :rtype: int - def canCompleteCircuit1(self, gas, cost): :type gas: List[int] :type cost: List[...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canCompleteCircuit(self, gas, cost): :type gas: List[int] :type cost: List[int] :rtype: int - def canCompleteCircuit1(self, gas, cost): :type gas: List[int] :type cost: List[...
472f780c3214aab5c713612812d834ccbe589434
<|skeleton|> class Solution: def canCompleteCircuit(self, gas, cost): """:type gas: List[int] :type cost: List[int] :rtype: int""" <|body_0|> def canCompleteCircuit1(self, gas, cost): """:type gas: List[int] :type cost: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def canCompleteCircuit(self, gas, cost): """:type gas: List[int] :type cost: List[int] :rtype: int""" if not gas: return False if not cost: return True n = gas.__len__() start = 0 cur = 0 iter = 0 while True: ...
the_stack_v2_python_sparse
4/134-Gas_Station.py
ChangXiaodong/Leetcode-solutions
train
4
a482d65f643be8f0ba671e7f37c217eee3c7cbb7
[ "if not request.json:\n abort(400)\nfor expected in request_keys:\n if expected not in request.json:\n abort(400)", "options = {}\nif 'options' in request.json:\n options = request.json.get('options')\n if len(options) > 0:\n options = json.loads(options)\nreturn options", "FlaskWebSer...
<|body_start_0|> if not request.json: abort(400) for expected in request_keys: if expected not in request.json: abort(400) <|end_body_0|> <|body_start_1|> options = {} if 'options' in request.json: options = request.json.get('options')...
Flask Web Services Invoice Manager
FlaskWebServicesInvoiceManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FlaskWebServicesInvoiceManager: """Flask Web Services Invoice Manager""" def check_service_requirements(request_keys): """Checks service request minimal requirements.""" <|body_0|> def get_service_options(): """Returns service options.""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_000642
7,699
no_license
[ { "docstring": "Checks service request minimal requirements.", "name": "check_service_requirements", "signature": "def check_service_requirements(request_keys)" }, { "docstring": "Returns service options.", "name": "get_service_options", "signature": "def get_service_options()" }, { ...
6
stack_v2_sparse_classes_30k_train_005598
Implement the Python class `FlaskWebServicesInvoiceManager` described below. Class description: Flask Web Services Invoice Manager Method signatures and docstrings: - def check_service_requirements(request_keys): Checks service request minimal requirements. - def get_service_options(): Returns service options. - def ...
Implement the Python class `FlaskWebServicesInvoiceManager` described below. Class description: Flask Web Services Invoice Manager Method signatures and docstrings: - def check_service_requirements(request_keys): Checks service request minimal requirements. - def get_service_options(): Returns service options. - def ...
a2ee333d2a4fe9821f3d24ee15d458f226ffcde5
<|skeleton|> class FlaskWebServicesInvoiceManager: """Flask Web Services Invoice Manager""" def check_service_requirements(request_keys): """Checks service request minimal requirements.""" <|body_0|> def get_service_options(): """Returns service options.""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FlaskWebServicesInvoiceManager: """Flask Web Services Invoice Manager""" def check_service_requirements(request_keys): """Checks service request minimal requirements.""" if not request.json: abort(400) for expected in request_keys: if expected not in reques...
the_stack_v2_python_sparse
src/server/wsdl/invoice_manager.py
hamed1361554/sportmagazine-server
train
0
73059f924a3cfc761f7f2860e15b2c4bffd8a2d4
[ "super().__init__(*args, **kwargs)\nfor field in self.fields:\n if field in self.fields_not_required:\n self.fields[field].required = False\n else:\n self.fields[field].required = True\n if field in self.fields_hidden:\n self.fields[field].widget = forms.HiddenInput()", "precio = sel...
<|body_start_0|> super().__init__(*args, **kwargs) for field in self.fields: if field in self.fields_not_required: self.fields[field].required = False else: self.fields[field].required = True if field in self.fields_hidden: ...
Formulario base para crear y actualizar anuncios. Este Form no se instancia directamente NUNCA. type_anuncio es relativo, por eso esta en campos no requeridos. @ver: BaseAnuncioViviendaForm.clean_estado_inmueble Las subclases que se creen, el nombre ha de ser AnuncioXxxxxForm, donde Xxxxx la categoría del anuncio. @ver...
BaseAnuncioForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseAnuncioForm: """Formulario base para crear y actualizar anuncios. Este Form no se instancia directamente NUNCA. type_anuncio es relativo, por eso esta en campos no requeridos. @ver: BaseAnuncioViviendaForm.clean_estado_inmueble Las subclases que se creen, el nombre ha de ser AnuncioXxxxxForm,...
stack_v2_sparse_classes_75kplus_train_000643
8,207
no_license
[ { "docstring": "Recorre los campos del form y los añade como required, etc. Utiliza las propiedades: - fields_not_required: Campos que no serán obligatorios. - fields_hidden: Campos que serán ocultos.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "El ...
4
stack_v2_sparse_classes_30k_train_025314
Implement the Python class `BaseAnuncioForm` described below. Class description: Formulario base para crear y actualizar anuncios. Este Form no se instancia directamente NUNCA. type_anuncio es relativo, por eso esta en campos no requeridos. @ver: BaseAnuncioViviendaForm.clean_estado_inmueble Las subclases que se creen...
Implement the Python class `BaseAnuncioForm` described below. Class description: Formulario base para crear y actualizar anuncios. Este Form no se instancia directamente NUNCA. type_anuncio es relativo, por eso esta en campos no requeridos. @ver: BaseAnuncioViviendaForm.clean_estado_inmueble Las subclases que se creen...
44b8d2934105ccbf02ff6c20896aa8c2b1746eaa
<|skeleton|> class BaseAnuncioForm: """Formulario base para crear y actualizar anuncios. Este Form no se instancia directamente NUNCA. type_anuncio es relativo, por eso esta en campos no requeridos. @ver: BaseAnuncioViviendaForm.clean_estado_inmueble Las subclases que se creen, el nombre ha de ser AnuncioXxxxxForm,...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BaseAnuncioForm: """Formulario base para crear y actualizar anuncios. Este Form no se instancia directamente NUNCA. type_anuncio es relativo, por eso esta en campos no requeridos. @ver: BaseAnuncioViviendaForm.clean_estado_inmueble Las subclases que se creen, el nombre ha de ser AnuncioXxxxxForm, donde Xxxxx ...
the_stack_v2_python_sparse
src/apps/anuncios/forms.py
snicoper/ofervivienda
train
1
5083f45a3c61e275b744207df49547c1a717c2f0
[ "self.port = port\nself.host = host\nself.env = env\nself.display_pred = display_pred\nself.prepare_pred = prepare_pred\nself.plots = {}\nlogger.debug('Create viewer on host {0} port {1}.'.format(host, port))\nself.viewer = visdom.Visdom(port=self.port, server=self.host, env=self.env)\nwhile len(logging.root.handle...
<|body_start_0|> self.port = port self.host = host self.env = env self.display_pred = display_pred self.prepare_pred = prepare_pred self.plots = {} logger.debug('Create viewer on host {0} port {1}.'.format(host, port)) self.viewer = visdom.Visdom(port=self...
Define a dynamic board. It can be used to gather interesting plottings during a training.
Board
[ "LicenseRef-scancode-cecill-b-en" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Board: """Define a dynamic board. It can be used to gather interesting plottings during a training.""" def __init__(self, port=8097, host='http://localhost', env='main', display_pred=False, prepare_pred=None): """Initilaize the class. Parameters ---------- port: int, default 8097 the...
stack_v2_sparse_classes_75kplus_train_000644
5,317
permissive
[ { "docstring": "Initilaize the class. Parameters ---------- port: int, default 8097 the port on which the visdom server is launched. host: str, default 'http://localhost' the host on which visdom is launched. env: str, default 'main' the environment to be used. display_pred: bool, default False if set render th...
4
null
Implement the Python class `Board` described below. Class description: Define a dynamic board. It can be used to gather interesting plottings during a training. Method signatures and docstrings: - def __init__(self, port=8097, host='http://localhost', env='main', display_pred=False, prepare_pred=None): Initilaize the...
Implement the Python class `Board` described below. Class description: Define a dynamic board. It can be used to gather interesting plottings during a training. Method signatures and docstrings: - def __init__(self, port=8097, host='http://localhost', env='main', display_pred=False, prepare_pred=None): Initilaize the...
7a807ed690929563ce36086eaf0998d0e8856aea
<|skeleton|> class Board: """Define a dynamic board. It can be used to gather interesting plottings during a training.""" def __init__(self, port=8097, host='http://localhost', env='main', display_pred=False, prepare_pred=None): """Initilaize the class. Parameters ---------- port: int, default 8097 the...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Board: """Define a dynamic board. It can be used to gather interesting plottings during a training.""" def __init__(self, port=8097, host='http://localhost', env='main', display_pred=False, prepare_pred=None): """Initilaize the class. Parameters ---------- port: int, default 8097 the port on whic...
the_stack_v2_python_sparse
pynet/plotting/board.py
Duplums/pynet
train
0
e99767f55543e52e08fd8d4754afad45eb5be1fc
[ "if self._token is None:\n self._token = get_token()\nelif time.time() - self._token['time_fetched'] > self._token['expires_in']:\n self._token = get_token()\nreturn self._token", "if self._api_token is None:\n self._api_token = get_management_token()\nelif time.time() - self._api_token['time_fetched'] >...
<|body_start_0|> if self._token is None: self._token = get_token() elif time.time() - self._token['time_fetched'] > self._token['expires_in']: self._token = get_token() return self._token <|end_body_0|> <|body_start_1|> if self._api_token is None: sel...
Subclass of the Task type, exists to allow sharing of access tokens between workers. Arguments: Task {Task} -- Celery task class
AuthorizedTask
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuthorizedTask: """Subclass of the Task type, exists to allow sharing of access tokens between workers. Arguments: Task {Task} -- Celery task class""" def token(self): """Defines the google access token for the class. Returns: dict -- Access response dictionary with key, ttl, time.""...
stack_v2_sparse_classes_75kplus_train_000645
2,565
permissive
[ { "docstring": "Defines the google access token for the class. Returns: dict -- Access response dictionary with key, ttl, time.", "name": "token", "signature": "def token(self)" }, { "docstring": "Defines the google access token for the class. Returns: dict -- Access response dictionary with key...
2
stack_v2_sparse_classes_30k_train_029263
Implement the Python class `AuthorizedTask` described below. Class description: Subclass of the Task type, exists to allow sharing of access tokens between workers. Arguments: Task {Task} -- Celery task class Method signatures and docstrings: - def token(self): Defines the google access token for the class. Returns: ...
Implement the Python class `AuthorizedTask` described below. Class description: Subclass of the Task type, exists to allow sharing of access tokens between workers. Arguments: Task {Task} -- Celery task class Method signatures and docstrings: - def token(self): Defines the google access token for the class. Returns: ...
f6fcadb06a300c905f88de8879198d6485e6fc6a
<|skeleton|> class AuthorizedTask: """Subclass of the Task type, exists to allow sharing of access tokens between workers. Arguments: Task {Task} -- Celery task class""" def token(self): """Defines the google access token for the class. Returns: dict -- Access response dictionary with key, ttl, time.""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AuthorizedTask: """Subclass of the Task type, exists to allow sharing of access tokens between workers. Arguments: Task {Task} -- Celery task class""" def token(self): """Defines the google access token for the class. Returns: dict -- Access response dictionary with key, ttl, time.""" if ...
the_stack_v2_python_sparse
framework/tasks/authorized_task.py
CIMAC-CIDC/cidc-taskmanager
train
0
9da83533feb426dad7194cc78eb79869d4248ff3
[ "roc_reading = {'confidenceThreshold': threshold, 'recall': tpr, 'falsePositiveRate': fpr}\nif 'confidenceMetrics' not in self.metadata.keys():\n self.metadata['confidenceMetrics'] = []\nself.metadata['confidenceMetrics'].append(roc_reading)", "if len(fpr) != len(tpr) or len(fpr) != len(threshold) or len(tpr) ...
<|body_start_0|> roc_reading = {'confidenceThreshold': threshold, 'recall': tpr, 'falsePositiveRate': fpr} if 'confidenceMetrics' not in self.metadata.keys(): self.metadata['confidenceMetrics'] = [] self.metadata['confidenceMetrics'].append(roc_reading) <|end_body_0|> <|body_start_1...
An artifact for storing classification metrics. Args: name: Name of the metrics artifact. uri: The metrics artifact's location on disk or cloud storage. metadata: The key-value scalar metrics.
ClassificationMetrics
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClassificationMetrics: """An artifact for storing classification metrics. Args: name: Name of the metrics artifact. uri: The metrics artifact's location on disk or cloud storage. metadata: The key-value scalar metrics.""" def log_roc_data_point(self, fpr: float, tpr: float, threshold: float)...
stack_v2_sparse_classes_75kplus_train_000646
17,073
permissive
[ { "docstring": "Logs a single data point in the ROC curve to metadata. Args: fpr: False positive rate value of the data point. tpr: True positive rate value of the data point. threshold: Threshold value for the data point.", "name": "log_roc_data_point", "signature": "def log_roc_data_point(self, fpr: f...
6
stack_v2_sparse_classes_30k_train_024205
Implement the Python class `ClassificationMetrics` described below. Class description: An artifact for storing classification metrics. Args: name: Name of the metrics artifact. uri: The metrics artifact's location on disk or cloud storage. metadata: The key-value scalar metrics. Method signatures and docstrings: - de...
Implement the Python class `ClassificationMetrics` described below. Class description: An artifact for storing classification metrics. Args: name: Name of the metrics artifact. uri: The metrics artifact's location on disk or cloud storage. metadata: The key-value scalar metrics. Method signatures and docstrings: - de...
3fb199658f68e7debf4906d9ce32a9a307e39243
<|skeleton|> class ClassificationMetrics: """An artifact for storing classification metrics. Args: name: Name of the metrics artifact. uri: The metrics artifact's location on disk or cloud storage. metadata: The key-value scalar metrics.""" def log_roc_data_point(self, fpr: float, tpr: float, threshold: float)...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ClassificationMetrics: """An artifact for storing classification metrics. Args: name: Name of the metrics artifact. uri: The metrics artifact's location on disk or cloud storage. metadata: The key-value scalar metrics.""" def log_roc_data_point(self, fpr: float, tpr: float, threshold: float) -> None: ...
the_stack_v2_python_sparse
sdk/python/kfp/dsl/types/artifact_types.py
kubeflow/pipelines
train
3,434
5b559883102438a230447a3b8a2ba732529dba47
[ "try:\n if not isinstance(data['caseProject_id'], int):\n return JsonResponse(code='999996', msg='参数有误!')\n if not data['reportFrom'] or not data['mailUser'] or (not data['mailPass']):\n return JsonResponse(code='999996', msg='参数有误!')\nexcept KeyError:\n return JsonResponse(code='999996', msg...
<|body_start_0|> try: if not isinstance(data['caseProject_id'], int): return JsonResponse(code='999996', msg='参数有误!') if not data['reportFrom'] or not data['mailUser'] or (not data['mailPass']): return JsonResponse(code='999996', msg='参数有误!') excep...
EmailConfig
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EmailConfig: def parameter_check(self, data): """校验参数 :param data: :return:""" <|body_0|> def post(self, request): """添加或修改邮件发送配置 :param request: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: if not isinstance(data['caseP...
stack_v2_sparse_classes_75kplus_train_000647
7,584
no_license
[ { "docstring": "校验参数 :param data: :return:", "name": "parameter_check", "signature": "def parameter_check(self, data)" }, { "docstring": "添加或修改邮件发送配置 :param request: :return:", "name": "post", "signature": "def post(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_014157
Implement the Python class `EmailConfig` described below. Class description: Implement the EmailConfig class. Method signatures and docstrings: - def parameter_check(self, data): 校验参数 :param data: :return: - def post(self, request): 添加或修改邮件发送配置 :param request: :return:
Implement the Python class `EmailConfig` described below. Class description: Implement the EmailConfig class. Method signatures and docstrings: - def parameter_check(self, data): 校验参数 :param data: :return: - def post(self, request): 添加或修改邮件发送配置 :param request: :return: <|skeleton|> class EmailConfig: def parame...
d65297b71ac9f759d508985ee15564162c285e11
<|skeleton|> class EmailConfig: def parameter_check(self, data): """校验参数 :param data: :return:""" <|body_0|> def post(self, request): """添加或修改邮件发送配置 :param request: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EmailConfig: def parameter_check(self, data): """校验参数 :param data: :return:""" try: if not isinstance(data['caseProject_id'], int): return JsonResponse(code='999996', msg='参数有误!') if not data['reportFrom'] or not data['mailUser'] or (not data['mailPass']...
the_stack_v2_python_sparse
automation-test_new/api_test/case/caseProjectMember.py
beitou/django_api_test
train
0
be05ee74f5be5b29e91e0a7bf236e9a82e8df98a
[ "with git_utils.NewGitCheckout(repository=LOCAL_REPO) as checkout:\n filepath = os.path.join(checkout.root, REPO_FILE)\n self.assertTrue(os.path.exists(filepath), 'file %s should exist' % filepath)\nself.assertFalse(os.path.exists(filepath), 'file %s should not exist' % filepath)", "with git_utils.NewGitChe...
<|body_start_0|> with git_utils.NewGitCheckout(repository=LOCAL_REPO) as checkout: filepath = os.path.join(checkout.root, REPO_FILE) self.assertTrue(os.path.exists(filepath), 'file %s should exist' % filepath) self.assertFalse(os.path.exists(filepath), 'file %s should not exist' ...
NewGitCheckoutTest
[ "BSD-3-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NewGitCheckoutTest: def test_defaults(self): """Test NewGitCheckout created using default parameters.""" <|body_0|> def test_remote(self): """Test NewGitCheckout with a remote repo. This makes requests across the network, so we may not want to run it very often..."""...
stack_v2_sparse_classes_75kplus_train_000648
4,015
permissive
[ { "docstring": "Test NewGitCheckout created using default parameters.", "name": "test_defaults", "signature": "def test_defaults(self)" }, { "docstring": "Test NewGitCheckout with a remote repo. This makes requests across the network, so we may not want to run it very often...", "name": "tes...
4
stack_v2_sparse_classes_30k_train_053700
Implement the Python class `NewGitCheckoutTest` described below. Class description: Implement the NewGitCheckoutTest class. Method signatures and docstrings: - def test_defaults(self): Test NewGitCheckout created using default parameters. - def test_remote(self): Test NewGitCheckout with a remote repo. This makes req...
Implement the Python class `NewGitCheckoutTest` described below. Class description: Implement the NewGitCheckoutTest class. Method signatures and docstrings: - def test_defaults(self): Test NewGitCheckout created using default parameters. - def test_remote(self): Test NewGitCheckout with a remote repo. This makes req...
47dbb2ff9ae01305b190f409ccea00b3b4f0bc79
<|skeleton|> class NewGitCheckoutTest: def test_defaults(self): """Test NewGitCheckout created using default parameters.""" <|body_0|> def test_remote(self): """Test NewGitCheckout with a remote repo. This makes requests across the network, so we may not want to run it very often..."""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NewGitCheckoutTest: def test_defaults(self): """Test NewGitCheckout created using default parameters.""" with git_utils.NewGitCheckout(repository=LOCAL_REPO) as checkout: filepath = os.path.join(checkout.root, REPO_FILE) self.assertTrue(os.path.exists(filepath), 'file %...
the_stack_v2_python_sparse
externals/skia/common/py/utils/git_utils_manualtest.py
mono/linux-packaging-skiasharp
train
1
e7686e33272482ab49e219eb9c5dff7e8f89f422
[ "val = {}\nfor column in self.__table__.columns:\n val[column.key] = getattr(self, column.key)\nreturn val", "val = self.value\nif hasattr(self.__class__, '_expandedFields'):\n for field in self.__class__._expandedFields:\n val[field] = [item.expandedValue for item in getattr(self, field).all()]\nret...
<|body_start_0|> val = {} for column in self.__table__.columns: val[column.key] = getattr(self, column.key) return val <|end_body_0|> <|body_start_1|> val = self.value if hasattr(self.__class__, '_expandedFields'): for field in self.__class__._expandedFie...
Define the base functionality for the tables, including a simple primary key and method to convert into a simple (or extended) dictionary class, suitalble for JSON conversion.
TableBase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TableBase: """Define the base functionality for the tables, including a simple primary key and method to convert into a simple (or extended) dictionary class, suitalble for JSON conversion.""" def value(self): """This extracts the values of the object into a simple dictionary, suitab...
stack_v2_sparse_classes_75kplus_train_000649
2,266
no_license
[ { "docstring": "This extracts the values of the object into a simple dictionary, suitable for passing to jsonify. Values are selected based on __table__ object, which is created & managed by SQLAlchemy", "name": "value", "signature": "def value(self)" }, { "docstring": "This injects additional i...
2
stack_v2_sparse_classes_30k_train_018983
Implement the Python class `TableBase` described below. Class description: Define the base functionality for the tables, including a simple primary key and method to convert into a simple (or extended) dictionary class, suitalble for JSON conversion. Method signatures and docstrings: - def value(self): This extracts ...
Implement the Python class `TableBase` described below. Class description: Define the base functionality for the tables, including a simple primary key and method to convert into a simple (or extended) dictionary class, suitalble for JSON conversion. Method signatures and docstrings: - def value(self): This extracts ...
a9dfbf6dd68ebfe8de5f3a4df3c26a9c8ee9e9f0
<|skeleton|> class TableBase: """Define the base functionality for the tables, including a simple primary key and method to convert into a simple (or extended) dictionary class, suitalble for JSON conversion.""" def value(self): """This extracts the values of the object into a simple dictionary, suitab...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TableBase: """Define the base functionality for the tables, including a simple primary key and method to convert into a simple (or extended) dictionary class, suitalble for JSON conversion.""" def value(self): """This extracts the values of the object into a simple dictionary, suitable for passin...
the_stack_v2_python_sparse
raw/table_base.py
divido/littlefinger
train
0
8aefaba9b382d84fe30da2e717b8ae922bd23c4f
[ "self.promoted_at = APIHelper.UnixDateTime(promoted_at) if promoted_at else None\nself.assistant = assistant\nself.additional_properties = additional_properties\nsuper(Boss, self).__init__(address, age, birthday, birthtime, department, dependents, hired_at, joining_day, name, salary, uid, working_days, boss, person...
<|body_start_0|> self.promoted_at = APIHelper.UnixDateTime(promoted_at) if promoted_at else None self.assistant = assistant self.additional_properties = additional_properties super(Boss, self).__init__(address, age, birthday, birthtime, department, dependents, hired_at, joining_day, name...
Implementation of the 'Boss' model. Testing circular reference. NOTE: This class inherits from 'Employee'. Attributes: promoted_at (datetime): TODO: type description here. assistant (Employee): TODO: type description here.
Boss
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Boss: """Implementation of the 'Boss' model. Testing circular reference. NOTE: This class inherits from 'Employee'. Attributes: promoted_at (datetime): TODO: type description here. assistant (Employee): TODO: type description here.""" def __init__(self, address=None, age=None, birthday=None,...
stack_v2_sparse_classes_75kplus_train_000650
13,843
permissive
[ { "docstring": "Constructor for the Boss class", "name": "__init__", "signature": "def __init__(self, address=None, age=None, birthday=None, birthtime=None, department=None, dependents=None, hired_at=None, joining_day='Monday', name=None, promoted_at=None, salary=None, uid=None, working_days=None, assis...
2
stack_v2_sparse_classes_30k_train_007629
Implement the Python class `Boss` described below. Class description: Implementation of the 'Boss' model. Testing circular reference. NOTE: This class inherits from 'Employee'. Attributes: promoted_at (datetime): TODO: type description here. assistant (Employee): TODO: type description here. Method signatures and doc...
Implement the Python class `Boss` described below. Class description: Implementation of the 'Boss' model. Testing circular reference. NOTE: This class inherits from 'Employee'. Attributes: promoted_at (datetime): TODO: type description here. assistant (Employee): TODO: type description here. Method signatures and doc...
49acc3d416a1dde7ea43b178d070484baf1b7f2b
<|skeleton|> class Boss: """Implementation of the 'Boss' model. Testing circular reference. NOTE: This class inherits from 'Employee'. Attributes: promoted_at (datetime): TODO: type description here. assistant (Employee): TODO: type description here.""" def __init__(self, address=None, age=None, birthday=None,...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Boss: """Implementation of the 'Boss' model. Testing circular reference. NOTE: This class inherits from 'Employee'. Attributes: promoted_at (datetime): TODO: type description here. assistant (Employee): TODO: type description here.""" def __init__(self, address=None, age=None, birthday=None, birthtime=No...
the_stack_v2_python_sparse
PYTHON_GENERIC_LIB/tester/models/person.py
MaryamAdnan3/Tester1
train
0
3de18d906f6389066a9078b673c6d7dc78b0e573
[ "self.data = data\nself._attr_name = name\nself._attr_device_class = device_class\nself._attr_is_on = None\nself._payload_on = payload_on\nself._payload_off = payload_off\nself._value_template = value_template\nself._attr_unique_id = unique_id", "await self.hass.async_add_executor_job(self.data.update)\nvalue = s...
<|body_start_0|> self.data = data self._attr_name = name self._attr_device_class = device_class self._attr_is_on = None self._payload_on = payload_on self._payload_off = payload_off self._value_template = value_template self._attr_unique_id = unique_id <|e...
Representation of a command line binary sensor.
CommandBinarySensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommandBinarySensor: """Representation of a command line binary sensor.""" def __init__(self, data: CommandSensorData, name: str, device_class: BinarySensorDeviceClass | None, payload_on: str, payload_off: str, value_template: Template | None, unique_id: str | None) -> None: """Initi...
stack_v2_sparse_classes_75kplus_train_000651
4,158
permissive
[ { "docstring": "Initialize the Command line binary sensor.", "name": "__init__", "signature": "def __init__(self, data: CommandSensorData, name: str, device_class: BinarySensorDeviceClass | None, payload_on: str, payload_off: str, value_template: Template | None, unique_id: str | None) -> None" }, {...
2
stack_v2_sparse_classes_30k_train_000020
Implement the Python class `CommandBinarySensor` described below. Class description: Representation of a command line binary sensor. Method signatures and docstrings: - def __init__(self, data: CommandSensorData, name: str, device_class: BinarySensorDeviceClass | None, payload_on: str, payload_off: str, value_templat...
Implement the Python class `CommandBinarySensor` described below. Class description: Representation of a command line binary sensor. Method signatures and docstrings: - def __init__(self, data: CommandSensorData, name: str, device_class: BinarySensorDeviceClass | None, payload_on: str, payload_off: str, value_templat...
2e65b77b2b5c17919939481f327963abdfdc53f0
<|skeleton|> class CommandBinarySensor: """Representation of a command line binary sensor.""" def __init__(self, data: CommandSensorData, name: str, device_class: BinarySensorDeviceClass | None, payload_on: str, payload_off: str, value_template: Template | None, unique_id: str | None) -> None: """Initi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CommandBinarySensor: """Representation of a command line binary sensor.""" def __init__(self, data: CommandSensorData, name: str, device_class: BinarySensorDeviceClass | None, payload_on: str, payload_off: str, value_template: Template | None, unique_id: str | None) -> None: """Initialize the Com...
the_stack_v2_python_sparse
homeassistant/components/command_line/binary_sensor.py
konnected-io/home-assistant
train
24
b6e025296eeb18341217a175400754743697196f
[ "if [i for i in BanMiddleware.RESOURCE_WHITELIST if i in request.path]:\n return\nuser = getattr(request, 'user', None)\nif user is not None and user.is_authenticated():\n banned = request.COOKIES.get(BanMiddleware.BAN_COOKIE_NAME, False)\n if banned is not False:\n user.profile.ban()", "if [i for...
<|body_start_0|> if [i for i in BanMiddleware.RESOURCE_WHITELIST if i in request.path]: return user = getattr(request, 'user', None) if user is not None and user.is_authenticated(): banned = request.COOKIES.get(BanMiddleware.BAN_COOKIE_NAME, False) if banned i...
Ajouter une information de ban au cookie d'un banni
BanMiddleware
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BanMiddleware: """Ajouter une information de ban au cookie d'un banni""" def process_request(self, request): """Traiter la requête""" <|body_0|> def process_response(self, request, response): """Traiter la réponse""" <|body_1|> <|end_skeleton|> <|body_s...
stack_v2_sparse_classes_75kplus_train_000652
6,927
no_license
[ { "docstring": "Traiter la requête", "name": "process_request", "signature": "def process_request(self, request)" }, { "docstring": "Traiter la réponse", "name": "process_response", "signature": "def process_response(self, request, response)" } ]
2
stack_v2_sparse_classes_30k_train_042638
Implement the Python class `BanMiddleware` described below. Class description: Ajouter une information de ban au cookie d'un banni Method signatures and docstrings: - def process_request(self, request): Traiter la requête - def process_response(self, request, response): Traiter la réponse
Implement the Python class `BanMiddleware` described below. Class description: Ajouter une information de ban au cookie d'un banni Method signatures and docstrings: - def process_request(self, request): Traiter la requête - def process_response(self, request, response): Traiter la réponse <|skeleton|> class BanMiddl...
8cef6f6e89c1990e2b25f83e54e0c3481d83b6d7
<|skeleton|> class BanMiddleware: """Ajouter une information de ban au cookie d'un banni""" def process_request(self, request): """Traiter la requête""" <|body_0|> def process_response(self, request, response): """Traiter la réponse""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BanMiddleware: """Ajouter une information de ban au cookie d'un banni""" def process_request(self, request): """Traiter la requête""" if [i for i in BanMiddleware.RESOURCE_WHITELIST if i in request.path]: return user = getattr(request, 'user', None) if user is ...
the_stack_v2_python_sparse
scoop/rogue/middleware/ban.py
artscoop/scoop
train
0
23936d71e7156c5b658f1b838becc588c486b1e0
[ "coins.reverse()\n\n@lru_cache(maxsize=None)\ndef helper(index, remaining):\n if remaining == 0:\n return 1\n if remaining < 0 or index >= len(coins):\n return 0\n return helper(index, remaining - coins[index]) + helper(index + 1, remaining)\nreturn helper(0, amount)", "dp = [0] * (amount +...
<|body_start_0|> coins.reverse() @lru_cache(maxsize=None) def helper(index, remaining): if remaining == 0: return 1 if remaining < 0 or index >= len(coins): return 0 return helper(index, remaining - coins[index]) + helper(index...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def change(self, amount: int, coins: List[int]) -> int: """DFS""" <|body_0|> def change(self, amount: int, coins: List[int]) -> int: """Dynamic Programming""" <|body_1|> <|end_skeleton|> <|body_start_0|> coins.reverse() @lru_cache...
stack_v2_sparse_classes_75kplus_train_000653
909
no_license
[ { "docstring": "DFS", "name": "change", "signature": "def change(self, amount: int, coins: List[int]) -> int" }, { "docstring": "Dynamic Programming", "name": "change", "signature": "def change(self, amount: int, coins: List[int]) -> int" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def change(self, amount: int, coins: List[int]) -> int: DFS - def change(self, amount: int, coins: List[int]) -> int: Dynamic Programming
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def change(self, amount: int, coins: List[int]) -> int: DFS - def change(self, amount: int, coins: List[int]) -> int: Dynamic Programming <|skeleton|> class Solution: def c...
e50dc0642f087f37ab3234390be3d8a0ed48fe62
<|skeleton|> class Solution: def change(self, amount: int, coins: List[int]) -> int: """DFS""" <|body_0|> def change(self, amount: int, coins: List[int]) -> int: """Dynamic Programming""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def change(self, amount: int, coins: List[int]) -> int: """DFS""" coins.reverse() @lru_cache(maxsize=None) def helper(index, remaining): if remaining == 0: return 1 if remaining < 0 or index >= len(coins): retur...
the_stack_v2_python_sparse
Leetcode/518. Coin Change 2.py
brlala/Educative-Grokking-Coding-Exercise
train
3
9101b1950e12875e4a7b7930d1ac422ff16c505e
[ "self.Screen_WIDTH = WIDTH\nself.counter = 0\nself.score_design = ''", "for pipe in pipes:\n if not pipe.passed:\n if pipe.x + pipe.top_img.get_width() // 2 < bird.x:\n self.counter += 1\n pipe.passed = True\n return True", "self.score_design = STAT_FONT.render('Score:...
<|body_start_0|> self.Screen_WIDTH = WIDTH self.counter = 0 self.score_design = '' <|end_body_0|> <|body_start_1|> for pipe in pipes: if not pipe.passed: if pipe.x + pipe.top_img.get_width() // 2 < bird.x: self.counter += 1 ...
Score
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Score: def __init__(self, WIDTH): """Method that initiates the object Score using pre-established specifications""" <|body_0|> def count(self, bird, pipes): """Flow that counts the score of the game Input = (Bird object, List) Output = None or Boolean""" <|bo...
stack_v2_sparse_classes_75kplus_train_000654
1,775
permissive
[ { "docstring": "Method that initiates the object Score using pre-established specifications", "name": "__init__", "signature": "def __init__(self, WIDTH)" }, { "docstring": "Flow that counts the score of the game Input = (Bird object, List) Output = None or Boolean", "name": "count", "si...
4
stack_v2_sparse_classes_30k_train_035202
Implement the Python class `Score` described below. Class description: Implement the Score class. Method signatures and docstrings: - def __init__(self, WIDTH): Method that initiates the object Score using pre-established specifications - def count(self, bird, pipes): Flow that counts the score of the game Input = (B...
Implement the Python class `Score` described below. Class description: Implement the Score class. Method signatures and docstrings: - def __init__(self, WIDTH): Method that initiates the object Score using pre-established specifications - def count(self, bird, pipes): Flow that counts the score of the game Input = (B...
94c870179cec32aa733a612a6faeb047df16d977
<|skeleton|> class Score: def __init__(self, WIDTH): """Method that initiates the object Score using pre-established specifications""" <|body_0|> def count(self, bird, pipes): """Flow that counts the score of the game Input = (Bird object, List) Output = None or Boolean""" <|bo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Score: def __init__(self, WIDTH): """Method that initiates the object Score using pre-established specifications""" self.Screen_WIDTH = WIDTH self.counter = 0 self.score_design = '' def count(self, bird, pipes): """Flow that counts the score of the game Input = (Bi...
the_stack_v2_python_sparse
flappy-brird/utils/score.py
victorathanasio/Personal-projects
train
0
2ffdfcad09525fc2408a45fffcdceed962ef9171
[ "for app_region in self.app.regions.values():\n app_region.instance_max = 1\n app_region.volumes['data0'] = {'count': 1, 'size': 1}\n laika_service = app_region.services['laika']\n laika_service.volumes['/mnt/data0'] = '/mnt/data'\n laika_service.environment['DISK_PATH'] = '/mnt/data/file.txt'\nself....
<|body_start_0|> for app_region in self.app.regions.values(): app_region.instance_max = 1 app_region.volumes['data0'] = {'count': 1, 'size': 1} laika_service = app_region.services['laika'] laika_service.volumes['/mnt/data0'] = '/mnt/data' laika_service...
TestDeployPersistence
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestDeployPersistence: def test_01_disk(self): """Deploy a service with persistent EBS volume, verify.""" <|body_0|> def test_02_cache(self): """Deploy a service with ElastiCache, verify.""" <|body_1|> def test_03_rds(self): """Deploy a service w...
stack_v2_sparse_classes_75kplus_train_000655
2,156
permissive
[ { "docstring": "Deploy a service with persistent EBS volume, verify.", "name": "test_01_disk", "signature": "def test_01_disk(self)" }, { "docstring": "Deploy a service with ElastiCache, verify.", "name": "test_02_cache", "signature": "def test_02_cache(self)" }, { "docstring": "...
3
stack_v2_sparse_classes_30k_train_048299
Implement the Python class `TestDeployPersistence` described below. Class description: Implement the TestDeployPersistence class. Method signatures and docstrings: - def test_01_disk(self): Deploy a service with persistent EBS volume, verify. - def test_02_cache(self): Deploy a service with ElastiCache, verify. - def...
Implement the Python class `TestDeployPersistence` described below. Class description: Implement the TestDeployPersistence class. Method signatures and docstrings: - def test_01_disk(self): Deploy a service with persistent EBS volume, verify. - def test_02_cache(self): Deploy a service with ElastiCache, verify. - def...
900b8ada0017f727163c5c2ae464e17d747ba0e8
<|skeleton|> class TestDeployPersistence: def test_01_disk(self): """Deploy a service with persistent EBS volume, verify.""" <|body_0|> def test_02_cache(self): """Deploy a service with ElastiCache, verify.""" <|body_1|> def test_03_rds(self): """Deploy a service w...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestDeployPersistence: def test_01_disk(self): """Deploy a service with persistent EBS volume, verify.""" for app_region in self.app.regions.values(): app_region.instance_max = 1 app_region.volumes['data0'] = {'count': 1, 'size': 1} laika_service = app_regio...
the_stack_v2_python_sparse
src/test_integ/test_persistence.py
tom9nguyen/spacel-provision
train
0
99316f5465fb225bf04da7bfa63b27f5d4bace76
[ "if heuristics not in [-1, 1, 2]:\n print('Invalid value for heuristics parameter.' + 'Check python3 robinmax.py --help.')\nepsilon = utils.epsilon(graph)\nself.graph = graph\nself.thresh_budget = thresh_budget\nself.max_thresh_dev = max_thresh_dev\nself.weight_budget = weight_budget\nself.max_weight_dev = max_w...
<|body_start_0|> if heuristics not in [-1, 1, 2]: print('Invalid value for heuristics parameter.' + 'Check python3 robinmax.py --help.') epsilon = utils.epsilon(graph) self.graph = graph self.thresh_budget = thresh_budget self.max_thresh_dev = max_thresh_dev s...
The parameter class. Contains all the parameters necessary for the algorithm.
RobinmaxArgs
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RobinmaxArgs: """The parameter class. Contains all the parameters necessary for the algorithm.""" def __init__(self, graph, thresh_budget, max_thresh_dev, weight_budget, max_weight_dev, max_cover_size, time_limit, num_seeds, heuristics, disable_cuts, solve_as_lp, debug_level, out_f): ...
stack_v2_sparse_classes_75kplus_train_000656
3,360
permissive
[ { "docstring": "Constructor.", "name": "__init__", "signature": "def __init__(self, graph, thresh_budget, max_thresh_dev, weight_budget, max_weight_dev, max_cover_size, time_limit, num_seeds, heuristics, disable_cuts, solve_as_lp, debug_level, out_f)" }, { "docstring": "Convert to string for pri...
2
stack_v2_sparse_classes_30k_train_034530
Implement the Python class `RobinmaxArgs` described below. Class description: The parameter class. Contains all the parameters necessary for the algorithm. Method signatures and docstrings: - def __init__(self, graph, thresh_budget, max_thresh_dev, weight_budget, max_weight_dev, max_cover_size, time_limit, num_seeds,...
Implement the Python class `RobinmaxArgs` described below. Class description: The parameter class. Contains all the parameters necessary for the algorithm. Method signatures and docstrings: - def __init__(self, graph, thresh_budget, max_thresh_dev, weight_budget, max_weight_dev, max_cover_size, time_limit, num_seeds,...
0745a09bcfa6f527817602433755afe6dea33f02
<|skeleton|> class RobinmaxArgs: """The parameter class. Contains all the parameters necessary for the algorithm.""" def __init__(self, graph, thresh_budget, max_thresh_dev, weight_budget, max_weight_dev, max_cover_size, time_limit, num_seeds, heuristics, disable_cuts, solve_as_lp, debug_level, out_f): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RobinmaxArgs: """The parameter class. Contains all the parameters necessary for the algorithm.""" def __init__(self, graph, thresh_budget, max_thresh_dev, weight_budget, max_weight_dev, max_cover_size, time_limit, num_seeds, heuristics, disable_cuts, solve_as_lp, debug_level, out_f): """Construct...
the_stack_v2_python_sparse
robinmax_args.py
sartorg/robinmax
train
1
5d4369f933ee86ec845b1c3599d502952f527e6c
[ "ObjectManager.__init__(self)\nself.getters.update({'email_domain': 'get_general', 'organization': 'get_foreign_key', 'role': 'get_foreign_key', 'effective_role': 'get_foreign_key', 'effective_role_name': 'get_general'})\nself.setters.update({'email_domain': 'set_general', 'organization': 'set_foreign_key', 'role':...
<|body_start_0|> ObjectManager.__init__(self) self.getters.update({'email_domain': 'get_general', 'organization': 'get_foreign_key', 'role': 'get_foreign_key', 'effective_role': 'get_foreign_key', 'effective_role_name': 'get_general'}) self.setters.update({'email_domain': 'set_general', 'organiz...
Manage mappings between email domain and automatic organization and role assignment.
OrgEmailDomainManager
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrgEmailDomainManager: """Manage mappings between email domain and automatic organization and role assignment.""" def __init__(self): """constructor""" <|body_0|> def create(self, auth_token, email_domain, organization, role=None): """Create a new OrgEmailDomain ...
stack_v2_sparse_classes_75kplus_train_000657
1,902
permissive
[ { "docstring": "constructor", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Create a new OrgEmailDomain mapping @param email_domain domain name to look for in user's email address @param organization organization to be assigned @param role role to be assigned within or...
2
stack_v2_sparse_classes_30k_val_000879
Implement the Python class `OrgEmailDomainManager` described below. Class description: Manage mappings between email domain and automatic organization and role assignment. Method signatures and docstrings: - def __init__(self): constructor - def create(self, auth_token, email_domain, organization, role=None): Create ...
Implement the Python class `OrgEmailDomainManager` described below. Class description: Manage mappings between email domain and automatic organization and role assignment. Method signatures and docstrings: - def __init__(self): constructor - def create(self, auth_token, email_domain, organization, role=None): Create ...
a59457bc37f0501aea1f54d006a6de94ff80511c
<|skeleton|> class OrgEmailDomainManager: """Manage mappings between email domain and automatic organization and role assignment.""" def __init__(self): """constructor""" <|body_0|> def create(self, auth_token, email_domain, organization, role=None): """Create a new OrgEmailDomain ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OrgEmailDomainManager: """Manage mappings between email domain and automatic organization and role assignment.""" def __init__(self): """constructor""" ObjectManager.__init__(self) self.getters.update({'email_domain': 'get_general', 'organization': 'get_foreign_key', 'role': 'get_...
the_stack_v2_python_sparse
pr_services/user_system/organization_email_domain_manager.py
ninemoreminutes/openassign-server
train
0
cce2681597a753edd19cb76d9017794a4fc8af10
[ "if len(self) < 2:\n raise IndexError(f'Cannot obtain the penultimate set of coordinates, only had {len(self)}')\nreturn self[-2]", "if len(self) < 1:\n raise IndexError('Cannot obtain the final set of coordinates from an empty history')\nreturn self[-1]", "if len(self) == 0:\n raise IndexError('No min...
<|body_start_0|> if len(self) < 2: raise IndexError(f'Cannot obtain the penultimate set of coordinates, only had {len(self)}') return self[-2] <|end_body_0|> <|body_start_1|> if len(self) < 1: raise IndexError('Cannot obtain the final set of coordinates from an empty his...
Sequential history of coordinates
OptimiserHistory
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OptimiserHistory: """Sequential history of coordinates""" def penultimate(self) -> OptCoordinates: """Last but one set of coordinates (the penultimate set) ----------------------------------------------------------------------- Returns: (OptCoordinates):""" <|body_0|> de...
stack_v2_sparse_classes_75kplus_train_000658
33,069
permissive
[ { "docstring": "Last but one set of coordinates (the penultimate set) ----------------------------------------------------------------------- Returns: (OptCoordinates):", "name": "penultimate", "signature": "def penultimate(self) -> OptCoordinates" }, { "docstring": "Last set of coordinates ----...
5
stack_v2_sparse_classes_30k_train_026315
Implement the Python class `OptimiserHistory` described below. Class description: Sequential history of coordinates Method signatures and docstrings: - def penultimate(self) -> OptCoordinates: Last but one set of coordinates (the penultimate set) -----------------------------------------------------------------------...
Implement the Python class `OptimiserHistory` described below. Class description: Sequential history of coordinates Method signatures and docstrings: - def penultimate(self) -> OptCoordinates: Last but one set of coordinates (the penultimate set) -----------------------------------------------------------------------...
4d6667592f083dfcf38de6b75c4222c0a0e7b60b
<|skeleton|> class OptimiserHistory: """Sequential history of coordinates""" def penultimate(self) -> OptCoordinates: """Last but one set of coordinates (the penultimate set) ----------------------------------------------------------------------- Returns: (OptCoordinates):""" <|body_0|> de...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OptimiserHistory: """Sequential history of coordinates""" def penultimate(self) -> OptCoordinates: """Last but one set of coordinates (the penultimate set) ----------------------------------------------------------------------- Returns: (OptCoordinates):""" if len(self) < 2: r...
the_stack_v2_python_sparse
autode/opt/optimisers/base.py
duartegroup/autodE
train
132
0cb4cd4f9ff045a296381afa0c8eb652dfcdae31
[ "supported_detection_types = ['bbox', 'segmentation']\nif detection_type not in supported_detection_types:\n raise ValueError('Unsupported detection type: {}. Supported values are: {}'.format(detection_type, supported_detection_types))\nself._detection_type = detection_type\ncoco.COCO.__init__(self)\nself.datase...
<|body_start_0|> supported_detection_types = ['bbox', 'segmentation'] if detection_type not in supported_detection_types: raise ValueError('Unsupported detection type: {}. Supported values are: {}'.format(detection_type, supported_detection_types)) self._detection_type = detection_ty...
Wrapper for the pycocotools COCO class.
COCOWrapper
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class COCOWrapper: """Wrapper for the pycocotools COCO class.""" def __init__(self, dataset, detection_type='bbox'): """COCOWrapper constructor. See http://mscoco.org/dataset/#format for a description of the format. By default, the coco.COCO class constructor reads from a JSON file. This f...
stack_v2_sparse_classes_75kplus_train_000659
37,770
permissive
[ { "docstring": "COCOWrapper constructor. See http://mscoco.org/dataset/#format for a description of the format. By default, the coco.COCO class constructor reads from a JSON file. This function duplicates the same behavior but loads from a dictionary, allowing us to perform evaluation without writing to externa...
2
stack_v2_sparse_classes_30k_train_040087
Implement the Python class `COCOWrapper` described below. Class description: Wrapper for the pycocotools COCO class. Method signatures and docstrings: - def __init__(self, dataset, detection_type='bbox'): COCOWrapper constructor. See http://mscoco.org/dataset/#format for a description of the format. By default, the c...
Implement the Python class `COCOWrapper` described below. Class description: Wrapper for the pycocotools COCO class. Method signatures and docstrings: - def __init__(self, dataset, detection_type='bbox'): COCOWrapper constructor. See http://mscoco.org/dataset/#format for a description of the format. By default, the c...
a5388a45f71a949639b35cc5b990bd130d2d8164
<|skeleton|> class COCOWrapper: """Wrapper for the pycocotools COCO class.""" def __init__(self, dataset, detection_type='bbox'): """COCOWrapper constructor. See http://mscoco.org/dataset/#format for a description of the format. By default, the coco.COCO class constructor reads from a JSON file. This f...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class COCOWrapper: """Wrapper for the pycocotools COCO class.""" def __init__(self, dataset, detection_type='bbox'): """COCOWrapper constructor. See http://mscoco.org/dataset/#format for a description of the format. By default, the coco.COCO class constructor reads from a JSON file. This function dupli...
the_stack_v2_python_sparse
TensorFlow/Detection/SSD/models/research/object_detection/metrics/coco_tools.py
NVIDIA/DeepLearningExamples
train
11,838
c68749b39557cf795fe82776cd735d863080170d
[ "_url_path = '/v1/replies'\n_query_builder = Configuration.base_uri\n_query_builder += _url_path\n_query_url = APIHelper.clean_url(_query_builder)\n_headers = {'accept': 'application/json'}\n_request = self.http_client.get(_query_url, headers=_headers)\nAuthManager.apply(_request, _url_path)\n_context = self.execut...
<|body_start_0|> _url_path = '/v1/replies' _query_builder = Configuration.base_uri _query_builder += _url_path _query_url = APIHelper.clean_url(_query_builder) _headers = {'accept': 'application/json'} _request = self.http_client.get(_query_url, headers=_headers) ...
A Controller to access Endpoints in the message_media_messages API.
RepliesController
[ "Apache-2.0", "curl", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RepliesController: """A Controller to access Endpoints in the message_media_messages API.""" def check_replies(self): """Does a GET request to /v1/replies. Check for any replies that have been received. Replies are messages that have been sent from a handset in response to a message ...
stack_v2_sparse_classes_75kplus_train_000660
8,304
permissive
[ { "docstring": "Does a GET request to /v1/replies. Check for any replies that have been received. Replies are messages that have been sent from a handset in response to a message sent by an application or messages that have been sent from a handset to a inbound number associated with an account, known as a dedi...
2
stack_v2_sparse_classes_30k_train_030159
Implement the Python class `RepliesController` described below. Class description: A Controller to access Endpoints in the message_media_messages API. Method signatures and docstrings: - def check_replies(self): Does a GET request to /v1/replies. Check for any replies that have been received. Replies are messages tha...
Implement the Python class `RepliesController` described below. Class description: A Controller to access Endpoints in the message_media_messages API. Method signatures and docstrings: - def check_replies(self): Does a GET request to /v1/replies. Check for any replies that have been received. Replies are messages tha...
7963f5725c5feff7cbc74cc62fe889575f3a83f9
<|skeleton|> class RepliesController: """A Controller to access Endpoints in the message_media_messages API.""" def check_replies(self): """Does a GET request to /v1/replies. Check for any replies that have been received. Replies are messages that have been sent from a handset in response to a message ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RepliesController: """A Controller to access Endpoints in the message_media_messages API.""" def check_replies(self): """Does a GET request to /v1/replies. Check for any replies that have been received. Replies are messages that have been sent from a handset in response to a message sent by an ap...
the_stack_v2_python_sparse
message_media_messages/controllers/replies_controller.py
messagemedia/messages-python-sdk
train
6
d603ab78096a1feef099faa888d181caaa7b1781
[ "response = self.testapp.get(feconf.CONTRIBUTE_GALLERY_URL)\nself.assertEqual(response.status_int, 302)\nself.assertEqual(response.location, self.get_expected_login_url(feconf.CONTRIBUTE_GALLERY_URL))\nself.login('editor@example.com')\nresponse = self.testapp.get(feconf.CONTRIBUTE_GALLERY_URL)\nself.assertEqual(res...
<|body_start_0|> response = self.testapp.get(feconf.CONTRIBUTE_GALLERY_URL) self.assertEqual(response.status_int, 302) self.assertEqual(response.location, self.get_expected_login_url(feconf.CONTRIBUTE_GALLERY_URL)) self.login('editor@example.com') response = self.testapp.get(feco...
ContributeGalleryTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ContributeGalleryTest: def test_contribute_gallery_page(self): """Test access to the contributors' gallery page.""" <|body_0|> def test_contribute_gallery_handler(self): """Test the contribute gallery data handler.""" <|body_1|> def test_exploration_uplo...
stack_v2_sparse_classes_75kplus_train_000661
23,453
permissive
[ { "docstring": "Test access to the contributors' gallery page.", "name": "test_contribute_gallery_page", "signature": "def test_contribute_gallery_page(self)" }, { "docstring": "Test the contribute gallery data handler.", "name": "test_contribute_gallery_handler", "signature": "def test_...
3
stack_v2_sparse_classes_30k_train_051473
Implement the Python class `ContributeGalleryTest` described below. Class description: Implement the ContributeGalleryTest class. Method signatures and docstrings: - def test_contribute_gallery_page(self): Test access to the contributors' gallery page. - def test_contribute_gallery_handler(self): Test the contribute ...
Implement the Python class `ContributeGalleryTest` described below. Class description: Implement the ContributeGalleryTest class. Method signatures and docstrings: - def test_contribute_gallery_page(self): Test access to the contributors' gallery page. - def test_contribute_gallery_handler(self): Test the contribute ...
aead304c95a282c9ca8035bc25c4794864d07578
<|skeleton|> class ContributeGalleryTest: def test_contribute_gallery_page(self): """Test access to the contributors' gallery page.""" <|body_0|> def test_contribute_gallery_handler(self): """Test the contribute gallery data handler.""" <|body_1|> def test_exploration_uplo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ContributeGalleryTest: def test_contribute_gallery_page(self): """Test access to the contributors' gallery page.""" response = self.testapp.get(feconf.CONTRIBUTE_GALLERY_URL) self.assertEqual(response.status_int, 302) self.assertEqual(response.location, self.get_expected_login_...
the_stack_v2_python_sparse
core/controllers/galleries_test.py
aldeka/oppia
train
3
1b7575a64366b7da437ac0ffd9fddd6860b639ac
[ "self.cutoff = cutoff\nself.box_width = box_width\nself.voxel_width = voxel_width\nself.reduce_to_contacts = reduce_to_contacts", "if 'complex' in kwargs:\n datapoint = kwargs.get('complex')\n raise DeprecationWarning('Complex is being phased out as a parameter, please pass \"datapoint\" instead.')\ntry:\n ...
<|body_start_0|> self.cutoff = cutoff self.box_width = box_width self.voxel_width = voxel_width self.reduce_to_contacts = reduce_to_contacts <|end_body_0|> <|body_start_1|> if 'complex' in kwargs: datapoint = kwargs.get('complex') raise DeprecationWarning...
Localize salt bridges between atoms in macromolecular complexes. Given a macromolecular complex made up of multiple constitutent molecules, compute salt bridges between atoms in the macromolecular complex. For each atom, localize this salt bridge in the voxel in which it originated to create a local salt bridge array. ...
SaltBridgeVoxelizer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SaltBridgeVoxelizer: """Localize salt bridges between atoms in macromolecular complexes. Given a macromolecular complex made up of multiple constitutent molecules, compute salt bridges between atoms in the macromolecular complex. For each atom, localize this salt bridge in the voxel in which it o...
stack_v2_sparse_classes_75kplus_train_000662
27,676
permissive
[ { "docstring": "Parameters ---------- cutoff: float, optional (default 5.0) The distance in angstroms within which atoms must be to be considered for a salt bridge between them. box_width: float, optional (default 16.0) Size of a box in which voxel features are calculated. Box is centered on a ligand centroid. ...
2
stack_v2_sparse_classes_30k_train_015433
Implement the Python class `SaltBridgeVoxelizer` described below. Class description: Localize salt bridges between atoms in macromolecular complexes. Given a macromolecular complex made up of multiple constitutent molecules, compute salt bridges between atoms in the macromolecular complex. For each atom, localize this...
Implement the Python class `SaltBridgeVoxelizer` described below. Class description: Localize salt bridges between atoms in macromolecular complexes. Given a macromolecular complex made up of multiple constitutent molecules, compute salt bridges between atoms in the macromolecular complex. For each atom, localize this...
ee6e67ebcf7bf04259cf13aff6388e2b791fea3d
<|skeleton|> class SaltBridgeVoxelizer: """Localize salt bridges between atoms in macromolecular complexes. Given a macromolecular complex made up of multiple constitutent molecules, compute salt bridges between atoms in the macromolecular complex. For each atom, localize this salt bridge in the voxel in which it o...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SaltBridgeVoxelizer: """Localize salt bridges between atoms in macromolecular complexes. Given a macromolecular complex made up of multiple constitutent molecules, compute salt bridges between atoms in the macromolecular complex. For each atom, localize this salt bridge in the voxel in which it originated to ...
the_stack_v2_python_sparse
deepchem/feat/complex_featurizers/grid_featurizers.py
deepchem/deepchem
train
4,876
09222293b2a8b8a6b6cc3d2742f6cb5da469ee6b
[ "if head is None:\n return None\nnode = []\np = head\nwhile p is not None:\n node.append(p)\n p = p.next\nnode_len = len(node)\nprev_node = node_len - n - 1\ncurrent_node = node_len - n\nif prev_node < 0:\n return head.next\nnode[prev_node].next = node[current_node].next\nreturn head", "dummy = ListNo...
<|body_start_0|> if head is None: return None node = [] p = head while p is not None: node.append(p) p = p.next node_len = len(node) prev_node = node_len - n - 1 current_node = node_len - n if prev_node < 0: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def remove_nth_from_end(self, head: ListNode, n: int) -> ListNode: """遍历链表,将节点指针存到数组中,然后再执行删除操作""" <|body_0|> def remove_nth_from_end_2(self, head: ListNode, n: int) -> ListNode: """使用快慢双指针,起始时中间间隔n个节点, 注意起始位置虚节点的使用""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_75kplus_train_000663
2,300
no_license
[ { "docstring": "遍历链表,将节点指针存到数组中,然后再执行删除操作", "name": "remove_nth_from_end", "signature": "def remove_nth_from_end(self, head: ListNode, n: int) -> ListNode" }, { "docstring": "使用快慢双指针,起始时中间间隔n个节点, 注意起始位置虚节点的使用", "name": "remove_nth_from_end_2", "signature": "def remove_nth_from_end_2(self...
2
stack_v2_sparse_classes_30k_train_012271
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def remove_nth_from_end(self, head: ListNode, n: int) -> ListNode: 遍历链表,将节点指针存到数组中,然后再执行删除操作 - def remove_nth_from_end_2(self, head: ListNode, n: int) -> ListNode: 使用快慢双指针,起始时中间间...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def remove_nth_from_end(self, head: ListNode, n: int) -> ListNode: 遍历链表,将节点指针存到数组中,然后再执行删除操作 - def remove_nth_from_end_2(self, head: ListNode, n: int) -> ListNode: 使用快慢双指针,起始时中间间...
3a04d7228c563e408a97b2a9a69c6dddd7379007
<|skeleton|> class Solution: def remove_nth_from_end(self, head: ListNode, n: int) -> ListNode: """遍历链表,将节点指针存到数组中,然后再执行删除操作""" <|body_0|> def remove_nth_from_end_2(self, head: ListNode, n: int) -> ListNode: """使用快慢双指针,起始时中间间隔n个节点, 注意起始位置虚节点的使用""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def remove_nth_from_end(self, head: ListNode, n: int) -> ListNode: """遍历链表,将节点指针存到数组中,然后再执行删除操作""" if head is None: return None node = [] p = head while p is not None: node.append(p) p = p.next node_len = len(node) ...
the_stack_v2_python_sparse
remove_nth_from_end.py
ningmengpian/algorithm
train
0
3c09cf2807dc23faa9390c7a3b89e8aea77b3e21
[ "scheme = urlparse(url).scheme\nhandler = getattr(self, '_load_' + scheme, None)\nif handler is None:\n msg = 'unhandled url resource scheme: `%s`'\n logger.error(msg % url)\n reply(None)\n return\nhandler(url, metadata, reply)", "spec = urlparse(url)\nprovider = self.image_providers.get(spec.netloc)\...
<|body_start_0|> scheme = urlparse(url).scheme handler = getattr(self, '_load_' + scheme, None) if handler is None: msg = 'unhandled url resource scheme: `%s`' logger.error(msg % url) reply(None) return handler(url, metadata, reply) <|end_b...
A class which manages resource loading for a `Session`. A `ResourceManager` is used by a `Session` object to load resources when a url resource request is made by a client session. Users work with the manager by assigning provider objects associated with a host name. For example, a user can provide an image for the url...
ResourceManager
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResourceManager: """A class which manages resource loading for a `Session`. A `ResourceManager` is used by a `Session` object to load resources when a url resource request is made by a client session. Users work with the manager by assigning provider objects associated with a host name. For examp...
stack_v2_sparse_classes_75kplus_train_000664
4,547
permissive
[ { "docstring": "Load a resource from the manager. Parameters ---------- url : str The url pointing to the resource to load. metadata : dict Additional metadata required to load the resource of the given type. See the individual loading handlers for the supported metadata. reply : URLReply A url reply which will...
3
stack_v2_sparse_classes_30k_train_020128
Implement the Python class `ResourceManager` described below. Class description: A class which manages resource loading for a `Session`. A `ResourceManager` is used by a `Session` object to load resources when a url resource request is made by a client session. Users work with the manager by assigning provider objects...
Implement the Python class `ResourceManager` described below. Class description: A class which manages resource loading for a `Session`. A `ResourceManager` is used by a `Session` object to load resources when a url resource request is made by a client session. Users work with the manager by assigning provider objects...
424bba29219de58fe9e47196de6763de8b2009f2
<|skeleton|> class ResourceManager: """A class which manages resource loading for a `Session`. A `ResourceManager` is used by a `Session` object to load resources when a url resource request is made by a client session. Users work with the manager by assigning provider objects associated with a host name. For examp...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ResourceManager: """A class which manages resource loading for a `Session`. A `ResourceManager` is used by a `Session` object to load resources when a url resource request is made by a client session. Users work with the manager by assigning provider objects associated with a host name. For example, a user ca...
the_stack_v2_python_sparse
enaml/resource_manager.py
enthought/enaml
train
17
fa0ce257e243bfcf0e06e684872b9420b4aa5189
[ "Block.__init__(self, scenario, args)\nif self.language is None:\n raise LoadingException('Language must be defined!')", "aroot = zone.atree\ntroot = zone.ttree\nsent_roots = aroot.get_children(ordered=True)\nif sent_roots:\n sent_roots = sent_roots[0:1]\nsent_roots.extend([t.lex_anode for t in troot.get_de...
<|body_start_0|> Block.__init__(self, scenario, args) if self.language is None: raise LoadingException('Language must be defined!') <|end_body_0|> <|body_start_1|> aroot = zone.atree troot = zone.ttree sent_roots = aroot.get_children(ordered=True) if sent_roo...
Capitalize the first word in the sentence (skip punctuation etc.).
CapitalizeSentStart
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CapitalizeSentStart: """Capitalize the first word in the sentence (skip punctuation etc.).""" def __init__(self, scenario, args): """Constructor, checking the argument values""" <|body_0|> def process_zone(self, zone): """Find the first valid word in the sentence...
stack_v2_sparse_classes_75kplus_train_000665
2,312
permissive
[ { "docstring": "Constructor, checking the argument values", "name": "__init__", "signature": "def __init__(self, scenario, args)" }, { "docstring": "Find the first valid word in the sentence and capitalize it.", "name": "process_zone", "signature": "def process_zone(self, zone)" } ]
2
stack_v2_sparse_classes_30k_train_018120
Implement the Python class `CapitalizeSentStart` described below. Class description: Capitalize the first word in the sentence (skip punctuation etc.). Method signatures and docstrings: - def __init__(self, scenario, args): Constructor, checking the argument values - def process_zone(self, zone): Find the first valid...
Implement the Python class `CapitalizeSentStart` described below. Class description: Capitalize the first word in the sentence (skip punctuation etc.). Method signatures and docstrings: - def __init__(self, scenario, args): Constructor, checking the argument values - def process_zone(self, zone): Find the first valid...
73af644ec35c8a1cd0c37cd478c2afc1db717e0b
<|skeleton|> class CapitalizeSentStart: """Capitalize the first word in the sentence (skip punctuation etc.).""" def __init__(self, scenario, args): """Constructor, checking the argument values""" <|body_0|> def process_zone(self, zone): """Find the first valid word in the sentence...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CapitalizeSentStart: """Capitalize the first word in the sentence (skip punctuation etc.).""" def __init__(self, scenario, args): """Constructor, checking the argument values""" Block.__init__(self, scenario, args) if self.language is None: raise LoadingException('Lang...
the_stack_v2_python_sparse
alex/components/nlg/tectotpl/block/t2a/cs/capitalizesentstart.py
oplatek/alex
train
0
5844acb242d79af6ebf50afb39fed05351a23d46
[ "if obj is None:\n raise Exception('Object cannot be null')\nif name is None:\n raise Exception('Property name cannot be null')\nname = name.lower()\nif isinstance(obj, dict):\n for key in obj.keys():\n if name == str(key).lower():\n obj[key] = value\n return\n obj[name] = v...
<|body_start_0|> if obj is None: raise Exception('Object cannot be null') if name is None: raise Exception('Property name cannot be null') name = name.lower() if isinstance(obj, dict): for key in obj.keys(): if name == str(key).lower():...
Helper class to perform property introspection and dynamic writing. In contrast to :class:`PropertyReflector <pip_services3_commons.reflect.PropertyReflector.PropertyReflector>` which only introspects regular objects, this ObjectWriter is also able to handle maps and arrays. For maps properties are key-pairs identified...
ObjectWriter
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ObjectWriter: """Helper class to perform property introspection and dynamic writing. In contrast to :class:`PropertyReflector <pip_services3_commons.reflect.PropertyReflector.PropertyReflector>` which only introspects regular objects, this ObjectWriter is also able to handle maps and arrays. For ...
stack_v2_sparse_classes_75kplus_train_000666
3,803
permissive
[ { "docstring": "ets args of object property specified by its name. The object can be a user defined object, map or array. The property name correspondently must be object property, map key or array index. If the property does not exist or introspection fails this method doesn't do anything and doesn't any throw...
2
stack_v2_sparse_classes_30k_train_008793
Implement the Python class `ObjectWriter` described below. Class description: Helper class to perform property introspection and dynamic writing. In contrast to :class:`PropertyReflector <pip_services3_commons.reflect.PropertyReflector.PropertyReflector>` which only introspects regular objects, this ObjectWriter is al...
Implement the Python class `ObjectWriter` described below. Class description: Helper class to perform property introspection and dynamic writing. In contrast to :class:`PropertyReflector <pip_services3_commons.reflect.PropertyReflector.PropertyReflector>` which only introspects regular objects, this ObjectWriter is al...
17f8a231fb75684032ec57b24025c9a3ca3dcdd6
<|skeleton|> class ObjectWriter: """Helper class to perform property introspection and dynamic writing. In contrast to :class:`PropertyReflector <pip_services3_commons.reflect.PropertyReflector.PropertyReflector>` which only introspects regular objects, this ObjectWriter is also able to handle maps and arrays. For ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ObjectWriter: """Helper class to perform property introspection and dynamic writing. In contrast to :class:`PropertyReflector <pip_services3_commons.reflect.PropertyReflector.PropertyReflector>` which only introspects regular objects, this ObjectWriter is also able to handle maps and arrays. For maps properti...
the_stack_v2_python_sparse
pip_services3_commons/reflect/ObjectWriter.py
pip-services3-python/pip-services3-commons-python
train
0
6cbb073eefcb2371ff40183a96f348d5313c11f0
[ "n = len(s)\ndp = [[0] * n for _ in range(n)]\nres = 0\nfor i in range(n - 1, -1, -1):\n for j in range(i, n):\n if s[i] == s[j]:\n if j - i < 3 or dp[i + 1][j - 1] == 1:\n dp[i][j] = 1\n res += 1\nreturn res", "def helper(s, left, right):\n res = 0\n while...
<|body_start_0|> n = len(s) dp = [[0] * n for _ in range(n)] res = 0 for i in range(n - 1, -1, -1): for j in range(i, n): if s[i] == s[j]: if j - i < 3 or dp[i + 1][j - 1] == 1: dp[i][j] = 1 r...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def countSubstrings0(self, s): """:type s: str :rtype: int""" <|body_0|> def countSubstrings(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = len(s) dp = [[0] * n for _ in range(n)] ...
stack_v2_sparse_classes_75kplus_train_000667
1,490
no_license
[ { "docstring": ":type s: str :rtype: int", "name": "countSubstrings0", "signature": "def countSubstrings0(self, s)" }, { "docstring": ":type s: str :rtype: int", "name": "countSubstrings", "signature": "def countSubstrings(self, s)" } ]
2
stack_v2_sparse_classes_30k_train_017233
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countSubstrings0(self, s): :type s: str :rtype: int - def countSubstrings(self, s): :type s: str :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countSubstrings0(self, s): :type s: str :rtype: int - def countSubstrings(self, s): :type s: str :rtype: int <|skeleton|> class Solution: def countSubstrings0(self, s):...
6e18c5d257840489cc3fb1079ae3804c743982a4
<|skeleton|> class Solution: def countSubstrings0(self, s): """:type s: str :rtype: int""" <|body_0|> def countSubstrings(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def countSubstrings0(self, s): """:type s: str :rtype: int""" n = len(s) dp = [[0] * n for _ in range(n)] res = 0 for i in range(n - 1, -1, -1): for j in range(i, n): if s[i] == s[j]: if j - i < 3 or dp[i + 1][j ...
the_stack_v2_python_sparse
剑指 Offer II 020. 回文子字符串的个数.py
yangyuxiang1996/leetcode
train
0
44015d47bc2b45a406c79f31f4742a40242d783c
[ "if root is None:\n return ''\nres = []\nq = deque()\nq.append(root)\ncounter = 1\nwhile len(q) > 0 and counter > 0:\n n = q.popleft()\n if n:\n counter -= 1\n res.append(str(n.val))\n if n.left:\n counter += 1\n if n.right:\n counter += 1\n q.append...
<|body_start_0|> if root is None: return '' res = [] q = deque() q.append(root) counter = 1 while len(q) > 0 and counter > 0: n = q.popleft() if n: counter -= 1 res.append(str(n.val)) if n...
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_000668
1,833
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_037790
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:...
87f30b91ff1770871d05b784efacd1656f2246ef
<|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 root is None: return '' res = [] q = deque() q.append(root) counter = 1 while len(q) > 0 and counter > 0: n = q.popleft...
the_stack_v2_python_sparse
leetcode/ser_deser_binary_tree.py
VimanyuAgg/code-morsels
train
1
0960020f36e83c50446ef6ea1006b6c5531c6f8d
[ "import cppyy\nm1 = cppyy.gbl.MyCopyingClass1()\nm2 = cppyy.gbl.MyCopyingClass1(2, 2)\nself.assertEqual(float(m1), -2.0)\nself.assertEqual(float(m2), 4.0)\nm3 = cppyy.gbl.MyCopyingClass1(m2)\nself.assertEqual(m3.m_d1, m2.m_d1)\nself.assertEqual(m3.m_d2, m2.m_d2)", "import cppyy\nm1 = cppyy.gbl.MyCopyingClass2()\n...
<|body_start_0|> import cppyy m1 = cppyy.gbl.MyCopyingClass1() m2 = cppyy.gbl.MyCopyingClass1(2, 2) self.assertEqual(float(m1), -2.0) self.assertEqual(float(m2), 4.0) m3 = cppyy.gbl.MyCopyingClass1(m2) self.assertEqual(m3.m_d1, m2.m_d1) self.assertEqual(m3...
Cpp14CopyConstructorOrdering
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Cpp14CopyConstructorOrdering: def test1NoUserCCtor(self): """Overload with implicit copy ctor""" <|body_0|> def test2NoUserCCtor(self): """Overload with user provided cctor second""" <|body_1|> def test3NoUserCCtor(self): """Overload with user pr...
stack_v2_sparse_classes_75kplus_train_000669
30,462
no_license
[ { "docstring": "Overload with implicit copy ctor", "name": "test1NoUserCCtor", "signature": "def test1NoUserCCtor(self)" }, { "docstring": "Overload with user provided cctor second", "name": "test2NoUserCCtor", "signature": "def test2NoUserCCtor(self)" }, { "docstring": "Overload...
3
stack_v2_sparse_classes_30k_train_051389
Implement the Python class `Cpp14CopyConstructorOrdering` described below. Class description: Implement the Cpp14CopyConstructorOrdering class. Method signatures and docstrings: - def test1NoUserCCtor(self): Overload with implicit copy ctor - def test2NoUserCCtor(self): Overload with user provided cctor second - def ...
Implement the Python class `Cpp14CopyConstructorOrdering` described below. Class description: Implement the Cpp14CopyConstructorOrdering class. Method signatures and docstrings: - def test1NoUserCCtor(self): Overload with implicit copy ctor - def test2NoUserCCtor(self): Overload with user provided cctor second - def ...
134508460915282a5d82d6cbbb6e6afa14653413
<|skeleton|> class Cpp14CopyConstructorOrdering: def test1NoUserCCtor(self): """Overload with implicit copy ctor""" <|body_0|> def test2NoUserCCtor(self): """Overload with user provided cctor second""" <|body_1|> def test3NoUserCCtor(self): """Overload with user pr...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Cpp14CopyConstructorOrdering: def test1NoUserCCtor(self): """Overload with implicit copy ctor""" import cppyy m1 = cppyy.gbl.MyCopyingClass1() m2 = cppyy.gbl.MyCopyingClass1(2, 2) self.assertEqual(float(m1), -2.0) self.assertEqual(float(m2), 4.0) m3 = cp...
the_stack_v2_python_sparse
python/cpp/PyROOT_advancedtests.py
root-project/roottest
train
41
fecb3e22946d38845977e65758ca3ade8bc44058
[ "super().__init__()\nself.lca_layer = lca_layer\nself.num_lca_dim = num_lca_dim\nself.num_simulations = num_simulations\nself.num_time_steps = num_time_steps", "dev = ff_input.device\nactive = torch.ones(size=[int(self.num_simulations), 1], device=dev)\npre_activities = torch.zeros(size=[int(self.num_simulations)...
<|body_start_0|> super().__init__() self.lca_layer = lca_layer self.num_lca_dim = num_lca_dim self.num_simulations = num_simulations self.num_time_steps = num_time_steps <|end_body_0|> <|body_start_1|> dev = ff_input.device active = torch.ones(size=[int(self.num_...
LCAModel
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LCAModel: def __init__(self, lca_layer: LCALayer, num_lca_dim: int, num_simulations: int=10000, num_time_steps: int=3000): """A model that simulates a leaky competing accumulator model (Usher and McClelland). References: Usher M, McClelland JL. The time course of perceptual choice: the l...
stack_v2_sparse_classes_75kplus_train_000670
11,741
permissive
[ { "docstring": "A model that simulates a leaky competing accumulator model (Usher and McClelland). References: Usher M, McClelland JL. The time course of perceptual choice: the leaky, competing accumulator model. Psychol Rev. 2001 Jul;108(3):550-92. doi: 10.1037/0033-295x.108.3.550. PMID: 11488378. Args: lca_la...
2
stack_v2_sparse_classes_30k_train_017256
Implement the Python class `LCAModel` described below. Class description: Implement the LCAModel class. Method signatures and docstrings: - def __init__(self, lca_layer: LCALayer, num_lca_dim: int, num_simulations: int=10000, num_time_steps: int=3000): A model that simulates a leaky competing accumulator model (Usher...
Implement the Python class `LCAModel` described below. Class description: Implement the LCAModel class. Method signatures and docstrings: - def __init__(self, lca_layer: LCALayer, num_lca_dim: int, num_simulations: int=10000, num_time_steps: int=3000): A model that simulates a leaky competing accumulator model (Usher...
424971b04d55a2cddbae4c05a0aae2d7b3502c20
<|skeleton|> class LCAModel: def __init__(self, lca_layer: LCALayer, num_lca_dim: int, num_simulations: int=10000, num_time_steps: int=3000): """A model that simulates a leaky competing accumulator model (Usher and McClelland). References: Usher M, McClelland JL. The time course of perceptual choice: the l...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LCAModel: def __init__(self, lca_layer: LCALayer, num_lca_dim: int, num_simulations: int=10000, num_time_steps: int=3000): """A model that simulates a leaky competing accumulator model (Usher and McClelland). References: Usher M, McClelland JL. The time course of perceptual choice: the leaky, competin...
the_stack_v2_python_sparse
Scripts/Debug/lca/onnx_lca.py
PrincetonUniversity/PsyNeuLink
train
79
18612ab44d63561b74fdcdc30869f4bfa7887c9d
[ "C = wilson.util.smeftutil.wcxf2arrays_symmetrized(wc_linear.dict)\nc_old = wilson.match._smeft_old.match_all_array(C, p)\nc_new = wilson.match.smeft_tree.match_all_array(C, p)\nfor k in c_old:\n npt.assert_almost_equal(c_old[k], c_new[k], decimal=18, err_msg=f'Failed for {k}')", "C = wilson.util.smeftutil.wcx...
<|body_start_0|> C = wilson.util.smeftutil.wcxf2arrays_symmetrized(wc_linear.dict) c_old = wilson.match._smeft_old.match_all_array(C, p) c_new = wilson.match.smeft_tree.match_all_array(C, p) for k in c_old: npt.assert_almost_equal(c_old[k], c_new[k], decimal=18, err_msg=f'Fai...
TestSMEFTWETreimpl
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestSMEFTWETreimpl: def test_linear(self): """For WCs entering linearly, agreement should be numerically exact""" <|body_0|> def test_quadratic(self): """For WCs entering also quadratically, agreement should be good up to the size of quadratic terms""" <|body...
stack_v2_sparse_classes_75kplus_train_000671
2,023
permissive
[ { "docstring": "For WCs entering linearly, agreement should be numerically exact", "name": "test_linear", "signature": "def test_linear(self)" }, { "docstring": "For WCs entering also quadratically, agreement should be good up to the size of quadratic terms", "name": "test_quadratic", "s...
2
stack_v2_sparse_classes_30k_train_054189
Implement the Python class `TestSMEFTWETreimpl` described below. Class description: Implement the TestSMEFTWETreimpl class. Method signatures and docstrings: - def test_linear(self): For WCs entering linearly, agreement should be numerically exact - def test_quadratic(self): For WCs entering also quadratically, agree...
Implement the Python class `TestSMEFTWETreimpl` described below. Class description: Implement the TestSMEFTWETreimpl class. Method signatures and docstrings: - def test_linear(self): For WCs entering linearly, agreement should be numerically exact - def test_quadratic(self): For WCs entering also quadratically, agree...
ed6f8ccba2bf267094c4c911ea2e050cbd1f0c74
<|skeleton|> class TestSMEFTWETreimpl: def test_linear(self): """For WCs entering linearly, agreement should be numerically exact""" <|body_0|> def test_quadratic(self): """For WCs entering also quadratically, agreement should be good up to the size of quadratic terms""" <|body...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestSMEFTWETreimpl: def test_linear(self): """For WCs entering linearly, agreement should be numerically exact""" C = wilson.util.smeftutil.wcxf2arrays_symmetrized(wc_linear.dict) c_old = wilson.match._smeft_old.match_all_array(C, p) c_new = wilson.match.smeft_tree.match_all_ar...
the_stack_v2_python_sparse
wilson/match/test_smeft_tree_new.py
wilson-eft/wilson
train
30
81da77d8ade9f28e3235c0fb4f2cf51b5d1c0fde
[ "super().__init__()\nself.document_store: Optional[KeywordDocumentStore] = document_store\nself.top_k = top_k\nself.custom_query = custom_query\nself.all_terms_must_match = all_terms_must_match\nself.scale_score = scale_score", "document_store = document_store or self.document_store\nif document_store is None:\n ...
<|body_start_0|> super().__init__() self.document_store: Optional[KeywordDocumentStore] = document_store self.top_k = top_k self.custom_query = custom_query self.all_terms_must_match = all_terms_must_match self.scale_score = scale_score <|end_body_0|> <|body_start_1|> ...
BM25Retriever
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BM25Retriever: def __init__(self, document_store: Optional[KeywordDocumentStore]=None, top_k: int=10, all_terms_must_match: bool=False, custom_query: Optional[str]=None, scale_score: bool=True): """:param document_store: An instance of one of the following DocumentStores to retrieve from...
stack_v2_sparse_classes_75kplus_train_000672
35,145
permissive
[ { "docstring": ":param document_store: An instance of one of the following DocumentStores to retrieve from: InMemoryDocumentStore, ElasticsearchDocumentStore and OpenSearchDocumentStore. If None, a document store must be passed to the retrieve method for this Retriever to work. :param all_terms_must_match: Whet...
3
stack_v2_sparse_classes_30k_val_001236
Implement the Python class `BM25Retriever` described below. Class description: Implement the BM25Retriever class. Method signatures and docstrings: - def __init__(self, document_store: Optional[KeywordDocumentStore]=None, top_k: int=10, all_terms_must_match: bool=False, custom_query: Optional[str]=None, scale_score: ...
Implement the Python class `BM25Retriever` described below. Class description: Implement the BM25Retriever class. Method signatures and docstrings: - def __init__(self, document_store: Optional[KeywordDocumentStore]=None, top_k: int=10, all_terms_must_match: bool=False, custom_query: Optional[str]=None, scale_score: ...
5f1256ac7e5734c2ea481e72cb7e02c34baf8c43
<|skeleton|> class BM25Retriever: def __init__(self, document_store: Optional[KeywordDocumentStore]=None, top_k: int=10, all_terms_must_match: bool=False, custom_query: Optional[str]=None, scale_score: bool=True): """:param document_store: An instance of one of the following DocumentStores to retrieve from...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BM25Retriever: def __init__(self, document_store: Optional[KeywordDocumentStore]=None, top_k: int=10, all_terms_must_match: bool=False, custom_query: Optional[str]=None, scale_score: bool=True): """:param document_store: An instance of one of the following DocumentStores to retrieve from: InMemoryDocu...
the_stack_v2_python_sparse
haystack/nodes/retriever/sparse.py
deepset-ai/haystack
train
10,599
9c67911fa9c3539cd5b3f6e552bf5501de96a161
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn WindowsDeviceMalwareState()", "from .entity import Entity\nfrom .windows_malware_category import WindowsMalwareCategory\nfrom .windows_malware_execution_state import WindowsMalwareExecutionState\nfrom .windows_malware_severity import W...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return WindowsDeviceMalwareState() <|end_body_0|> <|body_start_1|> from .entity import Entity from .windows_malware_category import WindowsMalwareCategory from .windows_malware_executio...
Malware detection entity.
WindowsDeviceMalwareState
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WindowsDeviceMalwareState: """Malware detection entity.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsDeviceMalwareState: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use t...
stack_v2_sparse_classes_75kplus_train_000673
6,982
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: WindowsDeviceMalwareState", "name": "create_from_discriminator_value", "signature": "def create_from_discrim...
3
null
Implement the Python class `WindowsDeviceMalwareState` described below. Class description: Malware detection entity. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsDeviceMalwareState: Creates a new instance of the appropriate class based on disc...
Implement the Python class `WindowsDeviceMalwareState` described below. Class description: Malware detection entity. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsDeviceMalwareState: Creates a new instance of the appropriate class based on disc...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class WindowsDeviceMalwareState: """Malware detection entity.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsDeviceMalwareState: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WindowsDeviceMalwareState: """Malware detection entity.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsDeviceMalwareState: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the di...
the_stack_v2_python_sparse
msgraph/generated/models/windows_device_malware_state.py
microsoftgraph/msgraph-sdk-python
train
135
fed6a92acea62f9d42c2d89245118f36812705d4
[ "MobileText = self.find_element(*self.MobileTextElement)\nMobileText.send_keys(mobilevalue)\nVerifyCodeText = self.find_element(*self.VerifyCodeTextElement)\nVerifyCodeText.send_keys('111222')\nLoginBtn = self.find_element(*self.LoginBtnElement)\nLoginBtn.click()\nlogger.info('LoginBtn is click!')", "deskBtn = se...
<|body_start_0|> MobileText = self.find_element(*self.MobileTextElement) MobileText.send_keys(mobilevalue) VerifyCodeText = self.find_element(*self.VerifyCodeTextElement) VerifyCodeText.send_keys('111222') LoginBtn = self.find_element(*self.LoginBtnElement) LoginBtn.click...
notice
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class notice: def LoginBtnObj(self, mobilevalue): """登录测试账号""" <|body_0|> def intoObj(self): """进入班级通知""" <|body_1|> def addObj(self, text): """添加班级通知""" <|body_2|> def addvideoObj(self): """添加视频""" <|body_3|> <|end_skelet...
stack_v2_sparse_classes_75kplus_train_000674
4,142
no_license
[ { "docstring": "登录测试账号", "name": "LoginBtnObj", "signature": "def LoginBtnObj(self, mobilevalue)" }, { "docstring": "进入班级通知", "name": "intoObj", "signature": "def intoObj(self)" }, { "docstring": "添加班级通知", "name": "addObj", "signature": "def addObj(self, text)" }, { ...
4
stack_v2_sparse_classes_30k_train_018767
Implement the Python class `notice` described below. Class description: Implement the notice class. Method signatures and docstrings: - def LoginBtnObj(self, mobilevalue): 登录测试账号 - def intoObj(self): 进入班级通知 - def addObj(self, text): 添加班级通知 - def addvideoObj(self): 添加视频
Implement the Python class `notice` described below. Class description: Implement the notice class. Method signatures and docstrings: - def LoginBtnObj(self, mobilevalue): 登录测试账号 - def intoObj(self): 进入班级通知 - def addObj(self, text): 添加班级通知 - def addvideoObj(self): 添加视频 <|skeleton|> class notice: def LoginBtnObj...
c4e11c8aa67306111ca2831a18af4363831af939
<|skeleton|> class notice: def LoginBtnObj(self, mobilevalue): """登录测试账号""" <|body_0|> def intoObj(self): """进入班级通知""" <|body_1|> def addObj(self, text): """添加班级通知""" <|body_2|> def addvideoObj(self): """添加视频""" <|body_3|> <|end_skelet...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class notice: def LoginBtnObj(self, mobilevalue): """登录测试账号""" MobileText = self.find_element(*self.MobileTextElement) MobileText.send_keys(mobilevalue) VerifyCodeText = self.find_element(*self.VerifyCodeTextElement) VerifyCodeText.send_keys('111222') LoginBtn = self....
the_stack_v2_python_sparse
Public/Pages/Notice.py
alexzeger/android_teacher
train
0
9fbbf612ce4490e22d97d3f35767763cac33a2d5
[ "super().__init__(path)\nself._rfile = None\ntry:\n self._rfile = open(self._path, 'r')\n self._reader = csv.DictReader(self._rfile, delimiter=CSVWriter.DELIMITER_CHAR, quotechar=CSVWriter.QUOTE_CHAR, restval=CSVWriter.NONE_VALUE)\nexcept (FileNotFoundError, IOError):\n ExecutionLogReader.logger.error('Can...
<|body_start_0|> super().__init__(path) self._rfile = None try: self._rfile = open(self._path, 'r') self._reader = csv.DictReader(self._rfile, delimiter=CSVWriter.DELIMITER_CHAR, quotechar=CSVWriter.QUOTE_CHAR, restval=CSVWriter.NONE_VALUE) except (FileNotFoundErr...
Reader class for the execution logs produced by injection sessions of this tool
ExecutionLogReader
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExecutionLogReader: """Reader class for the execution logs produced by injection sessions of this tool""" def __init__(self, path): """Constructor for the class :param path: Path of the execution log file""" <|body_0|> def read_entry(self): """Reads one entry fro...
stack_v2_sparse_classes_75kplus_train_000675
6,474
permissive
[ { "docstring": "Constructor for the class :param path: Path of the execution log file", "name": "__init__", "signature": "def __init__(self, path)" }, { "docstring": "Reads one entry from the execution log file :return: A dictionary corresponding to one built by MessageBuilder", "name": "rea...
3
stack_v2_sparse_classes_30k_train_003637
Implement the Python class `ExecutionLogReader` described below. Class description: Reader class for the execution logs produced by injection sessions of this tool Method signatures and docstrings: - def __init__(self, path): Constructor for the class :param path: Path of the execution log file - def read_entry(self)...
Implement the Python class `ExecutionLogReader` described below. Class description: Reader class for the execution logs produced by injection sessions of this tool Method signatures and docstrings: - def __init__(self, path): Constructor for the class :param path: Path of the execution log file - def read_entry(self)...
787b3b060d6a431810c1a29279251cbe9292351b
<|skeleton|> class ExecutionLogReader: """Reader class for the execution logs produced by injection sessions of this tool""" def __init__(self, path): """Constructor for the class :param path: Path of the execution log file""" <|body_0|> def read_entry(self): """Reads one entry fro...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ExecutionLogReader: """Reader class for the execution logs produced by injection sessions of this tool""" def __init__(self, path): """Constructor for the class :param path: Path of the execution log file""" super().__init__(path) self._rfile = None try: self._...
the_stack_v2_python_sparse
fault_injector/io/reader.py
igabriel85/fault_injector
train
0
6eda2f8fd265f2ddc4a318ae10980feba688cc61
[ "self._toc_node = node\nself._toc_limit = limit\nself._toc_level = level", "if name.startswith('_toc_'):\n return object.__getattribute__(self, name)\nif name in ['tableofcontents', 'fulltableofcontents']:\n if self._toc_level < self._toc_limit:\n return [type(self)(x._toc_node, self._toc_limit, self...
<|body_start_0|> self._toc_node = node self._toc_limit = limit self._toc_level = level <|end_body_0|> <|body_start_1|> if name.startswith('_toc_'): return object.__getattribute__(self, name) if name in ['tableofcontents', 'fulltableofcontents']: if self._...
Table of Contents object The table of contents object is a proxy object that limits the depth of a table of contents entry. Each time the `tableofcontents' attribute is accessed on the given node, the depth level is increased. Once the depth limit has been reached, no more table of contents entries are returned.
TableOfContents
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TableOfContents: """Table of Contents object The table of contents object is a proxy object that limits the depth of a table of contents entry. Each time the `tableofcontents' attribute is accessed on the given node, the depth level is increased. Once the depth limit has been reached, no more tab...
stack_v2_sparse_classes_75kplus_train_000676
10,872
permissive
[ { "docstring": "Instantiate a table of contents object Arguments: node -- the node to retrieve the table of contents from limit -- the number of levels to display level -- the current level", "name": "__init__", "signature": "def __init__(self, node, limit, level=1)" }, { "docstring": "Proxy all...
2
stack_v2_sparse_classes_30k_train_014085
Implement the Python class `TableOfContents` described below. Class description: Table of Contents object The table of contents object is a proxy object that limits the depth of a table of contents entry. Each time the `tableofcontents' attribute is accessed on the given node, the depth level is increased. Once the de...
Implement the Python class `TableOfContents` described below. Class description: Table of Contents object The table of contents object is a proxy object that limits the depth of a table of contents entry. Each time the `tableofcontents' attribute is accessed on the given node, the depth level is increased. Once the de...
a882a62b81e6ae7b8c9454ae2b222ef5c2c14bb1
<|skeleton|> class TableOfContents: """Table of Contents object The table of contents object is a proxy object that limits the depth of a table of contents entry. Each time the `tableofcontents' attribute is accessed on the given node, the depth level is increased. Once the depth limit has been reached, no more tab...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TableOfContents: """Table of Contents object The table of contents object is a proxy object that limits the depth of a table of contents entry. Each time the `tableofcontents' attribute is accessed on the given node, the depth level is increased. Once the depth limit has been reached, no more table of content...
the_stack_v2_python_sparse
plasTeX/Base/LaTeX/Sectioning.py
plastex/plastex
train
129
e79d104ebc2456ebc8816db0762f2e2dc74a2df8
[ "super().__init__()\nself.mlp = mlp\nself.use_softmax = use_softmax", "B, C, N = feature.size()\nfeature = feature.view(B, C, N, 1).repeat(1, 1, 1, N)\nif feature.device.type == 'cpu':\n feature = feature - feature.transpose(2, 3).contiguous() + torch.mul(feature, torch.eye(N).view(1, 1, N, N))\nelse:\n fea...
<|body_start_0|> super().__init__() self.mlp = mlp self.use_softmax = use_softmax <|end_body_0|> <|body_start_1|> B, C, N = feature.size() feature = feature.view(B, C, N, 1).repeat(1, 1, 1, N) if feature.device.type == 'cpu': feature = feature - feature.trans...
AFAModule
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AFAModule: def __init__(self, mlp, use_softmax=False): """:param mlp: mlp for learning weight mode: transformation or aggregation""" <|body_0|> def forward(self, feature: torch.Tensor) -> torch.Tensor: """Parameters ---------- features : torch.Tensor (B, C, N, M) or ...
stack_v2_sparse_classes_75kplus_train_000677
12,242
permissive
[ { "docstring": ":param mlp: mlp for learning weight mode: transformation or aggregation", "name": "__init__", "signature": "def __init__(self, mlp, use_softmax=False)" }, { "docstring": "Parameters ---------- features : torch.Tensor (B, C, N, M) or (B, C, N) Returns ------- new_features : torch....
2
stack_v2_sparse_classes_30k_train_036309
Implement the Python class `AFAModule` described below. Class description: Implement the AFAModule class. Method signatures and docstrings: - def __init__(self, mlp, use_softmax=False): :param mlp: mlp for learning weight mode: transformation or aggregation - def forward(self, feature: torch.Tensor) -> torch.Tensor: ...
Implement the Python class `AFAModule` described below. Class description: Implement the AFAModule class. Method signatures and docstrings: - def __init__(self, mlp, use_softmax=False): :param mlp: mlp for learning weight mode: transformation or aggregation - def forward(self, feature: torch.Tensor) -> torch.Tensor: ...
241b3c94112efb2944a27e4cc3eb1d65775edc10
<|skeleton|> class AFAModule: def __init__(self, mlp, use_softmax=False): """:param mlp: mlp for learning weight mode: transformation or aggregation""" <|body_0|> def forward(self, feature: torch.Tensor) -> torch.Tensor: """Parameters ---------- features : torch.Tensor (B, C, N, M) or ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AFAModule: def __init__(self, mlp, use_softmax=False): """:param mlp: mlp for learning weight mode: transformation or aggregation""" super().__init__() self.mlp = mlp self.use_softmax = use_softmax def forward(self, feature: torch.Tensor) -> torch.Tensor: """Parame...
the_stack_v2_python_sparse
crowd_nav/policy/gipcarl.py
sustech-isus/AEMCARL
train
0
4a4094db031c41de0f9e45e379e9fc963b4efd7c
[ "self.class_col_name = class_col_name\nself.n = DF.shape[0]\nif priors:\n self.priors = priors\nelse:\n self.priors = Probs(DF[class_col_name])\nself.classes = DF[class_col_name].unique().tolist()\nself.CondProbs = self.TrainNB(DF, class_col_name, progress_bar)", "g = DF.groupby(by=class_col_name)\nif progr...
<|body_start_0|> self.class_col_name = class_col_name self.n = DF.shape[0] if priors: self.priors = priors else: self.priors = Probs(DF[class_col_name]) self.classes = DF[class_col_name].unique().tolist() self.CondProbs = self.TrainNB(DF, class_col...
NaiveBayes
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NaiveBayes: def __init__(self, DF, class_col_name, priors=None, progress_bar=False): """Naive Bayes Classifier DF: Pandas DataFrame class_col_name: column name with outcome variable priors: dictionary of prior probabilities for each class Will not store dataframe as part of results Calcu...
stack_v2_sparse_classes_75kplus_train_000678
3,848
no_license
[ { "docstring": "Naive Bayes Classifier DF: Pandas DataFrame class_col_name: column name with outcome variable priors: dictionary of prior probabilities for each class Will not store dataframe as part of results Calculates: P(Class | data) \\\\propto P(Class)*P(data | Class) This model ignores the denominator; D...
3
null
Implement the Python class `NaiveBayes` described below. Class description: Implement the NaiveBayes class. Method signatures and docstrings: - def __init__(self, DF, class_col_name, priors=None, progress_bar=False): Naive Bayes Classifier DF: Pandas DataFrame class_col_name: column name with outcome variable priors:...
Implement the Python class `NaiveBayes` described below. Class description: Implement the NaiveBayes class. Method signatures and docstrings: - def __init__(self, DF, class_col_name, priors=None, progress_bar=False): Naive Bayes Classifier DF: Pandas DataFrame class_col_name: column name with outcome variable priors:...
e80167c76067ee2391c23dcbd7e7c98657194961
<|skeleton|> class NaiveBayes: def __init__(self, DF, class_col_name, priors=None, progress_bar=False): """Naive Bayes Classifier DF: Pandas DataFrame class_col_name: column name with outcome variable priors: dictionary of prior probabilities for each class Will not store dataframe as part of results Calcu...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NaiveBayes: def __init__(self, DF, class_col_name, priors=None, progress_bar=False): """Naive Bayes Classifier DF: Pandas DataFrame class_col_name: column name with outcome variable priors: dictionary of prior probabilities for each class Will not store dataframe as part of results Calculates: P(Class...
the_stack_v2_python_sparse
NaiveBayesNets/NaiveBayes/NaiveBayes.py
Johnnyboycurtis/BayesNets
train
0
47479630cf15d8935a6580466ee786dd85538c06
[ "total = sum(nums)\nif total & 1:\n return False\ntarget = total // 2\ndp = [False] * (target + 1)\ndp[0] = True\nfor num in nums:\n for i in range(target, num - 1, -1):\n dp[i] = dp[i] or dp[i - num]\nreturn dp[target]", "if len(nums) < 2:\n return False\nnums.sort()\nfor i in range(1, len(nums))...
<|body_start_0|> total = sum(nums) if total & 1: return False target = total // 2 dp = [False] * (target + 1) dp[0] = True for num in nums: for i in range(target, num - 1, -1): dp[i] = dp[i] or dp[i - num] return dp[target] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def canPartition(self, nums): """:type nums: List[int] :rtype: bool""" <|body_0|> def canPartition3(self, nums): """:type nums: List[int] :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> total = sum(nums) if total & 1: ...
stack_v2_sparse_classes_75kplus_train_000679
2,087
no_license
[ { "docstring": ":type nums: List[int] :rtype: bool", "name": "canPartition", "signature": "def canPartition(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: bool", "name": "canPartition3", "signature": "def canPartition3(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canPartition(self, nums): :type nums: List[int] :rtype: bool - def canPartition3(self, nums): :type nums: List[int] :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canPartition(self, nums): :type nums: List[int] :rtype: bool - def canPartition3(self, nums): :type nums: List[int] :rtype: bool <|skeleton|> class Solution: def canPar...
635af6e22aa8eef8e7920a585d43a45a891a8157
<|skeleton|> class Solution: def canPartition(self, nums): """:type nums: List[int] :rtype: bool""" <|body_0|> def canPartition3(self, nums): """:type nums: List[int] :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def canPartition(self, nums): """:type nums: List[int] :rtype: bool""" total = sum(nums) if total & 1: return False target = total // 2 dp = [False] * (target + 1) dp[0] = True for num in nums: for i in range(target, num...
the_stack_v2_python_sparse
code416PartitionEqualSubsetSum.py
cybelewang/leetcode-python
train
0
6384efa65349068d425ebe8be4a5ed4fe484f8db
[ "seen, res = (set(''), '')\nbuckets = defaultdict(list)\nmin_len, max_len = (float('inf'), float('-inf'))\nfor idx, w in enumerate(words):\n buckets[len(w)].append(idx)\n min_len, max_len = (min(min_len, len(w)), max(max_len, len(w)))\nfor l in range(min_len, max_len + 1):\n for idx in buckets[l]:\n ...
<|body_start_0|> seen, res = (set(''), '') buckets = defaultdict(list) min_len, max_len = (float('inf'), float('-inf')) for idx, w in enumerate(words): buckets[len(w)].append(idx) min_len, max_len = (min(min_len, len(w)), max(max_len, len(w))) for l in ran...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestWord1(self, words): """:type words: List[str] :rtype: str""" <|body_0|> def longestWord2(self, words): """:type words: List[str] :rtype: str""" <|body_1|> <|end_skeleton|> <|body_start_0|> seen, res = (set(''), '') bucke...
stack_v2_sparse_classes_75kplus_train_000680
2,161
no_license
[ { "docstring": ":type words: List[str] :rtype: str", "name": "longestWord1", "signature": "def longestWord1(self, words)" }, { "docstring": ":type words: List[str] :rtype: str", "name": "longestWord2", "signature": "def longestWord2(self, words)" } ]
2
stack_v2_sparse_classes_30k_train_027691
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestWord1(self, words): :type words: List[str] :rtype: str - def longestWord2(self, words): :type words: List[str] :rtype: str
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestWord1(self, words): :type words: List[str] :rtype: str - def longestWord2(self, words): :type words: List[str] :rtype: str <|skeleton|> class Solution: def longe...
c92a5ddcc56e3f69be1e6fb25e9c8ed277e57ee0
<|skeleton|> class Solution: def longestWord1(self, words): """:type words: List[str] :rtype: str""" <|body_0|> def longestWord2(self, words): """:type words: List[str] :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def longestWord1(self, words): """:type words: List[str] :rtype: str""" seen, res = (set(''), '') buckets = defaultdict(list) min_len, max_len = (float('inf'), float('-inf')) for idx, w in enumerate(words): buckets[len(w)].append(idx) m...
the_stack_v2_python_sparse
Classify/HashTable/720#Longest Word in Dictionary.py
EachenKuang/LeetCode
train
28
7cd9fe6e61e7674f469d504a4c004f008e6c97b3
[ "self.model = model\nself.data = data\nself.checkpoint_dir = checkpoint_dir\nself._iterations = variables.Variable(name='iterations', initial_value=_ITERATIONS_UNINITIALIZED, dtype=dtypes.int64)\nself.max_evaluations = max_evaluations\nself.steps = steps\nself.callbacks = callbacks or []", "optimizer_checkpoint =...
<|body_start_0|> self.model = model self.data = data self.checkpoint_dir = checkpoint_dir self._iterations = variables.Variable(name='iterations', initial_value=_ITERATIONS_UNINITIALIZED, dtype=dtypes.int64) self.max_evaluations = max_evaluations self.steps = steps ...
A class designed for a dedicated evaluator task. `SidecarEvaluator` is expected to be run in a process on a separate machine from the training cluster. It is meant for the purpose of a dedicated evaluator, evaluating the metric results of a training cluster which has one or more workers performing the training, and sav...
SidecarEvaluator
[ "MIT", "Apache-2.0", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SidecarEvaluator: """A class designed for a dedicated evaluator task. `SidecarEvaluator` is expected to be run in a process on a separate machine from the training cluster. It is meant for the purpose of a dedicated evaluator, evaluating the metric results of a training cluster which has one or m...
stack_v2_sparse_classes_75kplus_train_000681
11,398
permissive
[ { "docstring": "Initializes an `SidecarEvaluator` object. Args: model: Model to use for evaluation. The model object used here should be a `tf.keras.Model`, and should be the same as the one that is used in training, where `tf.keras.Model`s are checkpointed. The model should have one or more metrics compiled be...
2
stack_v2_sparse_classes_30k_train_039710
Implement the Python class `SidecarEvaluator` described below. Class description: A class designed for a dedicated evaluator task. `SidecarEvaluator` is expected to be run in a process on a separate machine from the training cluster. It is meant for the purpose of a dedicated evaluator, evaluating the metric results o...
Implement the Python class `SidecarEvaluator` described below. Class description: A class designed for a dedicated evaluator task. `SidecarEvaluator` is expected to be run in a process on a separate machine from the training cluster. It is meant for the purpose of a dedicated evaluator, evaluating the metric results o...
085b20a4b6287eff8c0b792425d52422ab8cbab3
<|skeleton|> class SidecarEvaluator: """A class designed for a dedicated evaluator task. `SidecarEvaluator` is expected to be run in a process on a separate machine from the training cluster. It is meant for the purpose of a dedicated evaluator, evaluating the metric results of a training cluster which has one or m...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SidecarEvaluator: """A class designed for a dedicated evaluator task. `SidecarEvaluator` is expected to be run in a process on a separate machine from the training cluster. It is meant for the purpose of a dedicated evaluator, evaluating the metric results of a training cluster which has one or more workers p...
the_stack_v2_python_sparse
tensorflow/python/keras/distribute/sidecar_evaluator.py
graphcore/tensorflow
train
84
3c018ee6207d3fe0c0bcf8953b411a0f873903f2
[ "if logger is None:\n raise ValueError(f'Parameter logger is null is not allowed')\nif not issubclass(logger.__class__, (Logger,)):\n raise ValueError(f'Logger instance is not subclass of LoggerService')\nself.__logger = logger", "if not isclass(_class):\n raise Exception(f'The parameter cls is not a cla...
<|body_start_0|> if logger is None: raise ValueError(f'Parameter logger is null is not allowed') if not issubclass(logger.__class__, (Logger,)): raise ValueError(f'Logger instance is not subclass of LoggerService') self.__logger = logger <|end_body_0|> <|body_start_1|> ...
Logger Decorator
LoggerDecorator
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoggerDecorator: """Logger Decorator""" def __init__(self, logger=None): """Logger class decorator @param logger: File path to log""" <|body_0|> def __call__(self, _class): """Set log variable of log to class @param _class: Class to patch @return: Class modified"...
stack_v2_sparse_classes_75kplus_train_000682
925
permissive
[ { "docstring": "Logger class decorator @param logger: File path to log", "name": "__init__", "signature": "def __init__(self, logger=None)" }, { "docstring": "Set log variable of log to class @param _class: Class to patch @return: Class modified", "name": "__call__", "signature": "def __...
2
null
Implement the Python class `LoggerDecorator` described below. Class description: Logger Decorator Method signatures and docstrings: - def __init__(self, logger=None): Logger class decorator @param logger: File path to log - def __call__(self, _class): Set log variable of log to class @param _class: Class to patch @re...
Implement the Python class `LoggerDecorator` described below. Class description: Logger Decorator Method signatures and docstrings: - def __init__(self, logger=None): Logger class decorator @param logger: File path to log - def __call__(self, _class): Set log variable of log to class @param _class: Class to patch @re...
8055927cb460bc40f3a2651c01a9d1da696177e8
<|skeleton|> class LoggerDecorator: """Logger Decorator""" def __init__(self, logger=None): """Logger class decorator @param logger: File path to log""" <|body_0|> def __call__(self, _class): """Set log variable of log to class @param _class: Class to patch @return: Class modified"...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LoggerDecorator: """Logger Decorator""" def __init__(self, logger=None): """Logger class decorator @param logger: File path to log""" if logger is None: raise ValueError(f'Parameter logger is null is not allowed') if not issubclass(logger.__class__, (Logger,)): ...
the_stack_v2_python_sparse
modules/shared/infrastructure/log/logger_decorator.py
eduardolujan/hexagonal_architecture_django
train
5
0bde403886fe87d41f1c501124613d1e72d8ba2a
[ "new = six.text_type.__new__(cls, sequence)\nnew._normal = normal\nreturn new", "for idx, ucs_part in enumerate(args):\n if not isinstance(ucs_part, six.string_types):\n expected_types = ', '.join((_type.__name__ for _type in six.string_types))\n raise TypeError('TypeError for FormattingString ar...
<|body_start_0|> new = six.text_type.__new__(cls, sequence) new._normal = normal return new <|end_body_0|> <|body_start_1|> for idx, ucs_part in enumerate(args): if not isinstance(ucs_part, six.string_types): expected_types = ', '.join((_type.__name__ for _ty...
A Unicode string which doubles as a callable. This is used for terminal attributes, so that it may be used both directly, or as a callable. When used directly, it simply emits the given terminal sequence. When used as a callable, it wraps the given (string) argument with the 2nd argument used by the class constructor::...
FormattingString
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FormattingString: """A Unicode string which doubles as a callable. This is used for terminal attributes, so that it may be used both directly, or as a callable. When used directly, it simply emits the given terminal sequence. When used as a callable, it wraps the given (string) argument with the ...
stack_v2_sparse_classes_75kplus_train_000683
19,386
permissive
[ { "docstring": "Class constructor accepting 2 positional arguments. :arg str sequence: terminal attribute sequence. :arg str normal: terminating sequence for this attribute (optional).", "name": "__new__", "signature": "def __new__(cls, sequence, normal=u'')" }, { "docstring": "Return ``text`` j...
2
stack_v2_sparse_classes_30k_train_028921
Implement the Python class `FormattingString` described below. Class description: A Unicode string which doubles as a callable. This is used for terminal attributes, so that it may be used both directly, or as a callable. When used directly, it simply emits the given terminal sequence. When used as a callable, it wrap...
Implement the Python class `FormattingString` described below. Class description: A Unicode string which doubles as a callable. This is used for terminal attributes, so that it may be used both directly, or as a callable. When used directly, it simply emits the given terminal sequence. When used as a callable, it wrap...
a34c6b1869b4dd467c6d1ab6895872bb72db7e0f
<|skeleton|> class FormattingString: """A Unicode string which doubles as a callable. This is used for terminal attributes, so that it may be used both directly, or as a callable. When used directly, it simply emits the given terminal sequence. When used as a callable, it wraps the given (string) argument with the ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FormattingString: """A Unicode string which doubles as a callable. This is used for terminal attributes, so that it may be used both directly, or as a callable. When used directly, it simply emits the given terminal sequence. When used as a callable, it wraps the given (string) argument with the 2nd argument ...
the_stack_v2_python_sparse
blessed/formatters.py
jquast/blessed
train
992
2880870d90206fc42d66a1c6d08a2bc79065284a
[ "if aedtname:\n return cls.defaultunit[cls.aedtname.index(aedtname)]\nelse:\n raise TypeError('get_defaultunit: Either the full name or category name must be defined.')", "if aedtname:\n return cls.defaultvalue[cls.aedtname.index(aedtname)]\nelse:\n raise TypeError('get_defaultunit: Either the full na...
<|body_start_0|> if aedtname: return cls.defaultunit[cls.aedtname.index(aedtname)] else: raise TypeError('get_defaultunit: Either the full name or category name must be defined.') <|end_body_0|> <|body_start_1|> if aedtname: return cls.defaultvalue[cls.aedtna...
Contains a list of constant names for all materials with mappings to their internal XML names. Internal names are used in scripts, and XML names are used in the XML syntax.
MatProperties
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MatProperties: """Contains a list of constant names for all materials with mappings to their internal XML names. Internal names are used in scripts, and XML names are used in the XML syntax.""" def get_defaultunit(cls, aedtname=None): """Retrieve the default unit for a full name or a...
stack_v2_sparse_classes_75kplus_train_000684
43,764
permissive
[ { "docstring": "Retrieve the default unit for a full name or a category name. Parameters ---------- aedtname : str, optional AEDT full name or category name. The default is ``None``. Returns ------- str Default unit if it exists.", "name": "get_defaultunit", "signature": "def get_defaultunit(cls, aedtna...
2
null
Implement the Python class `MatProperties` described below. Class description: Contains a list of constant names for all materials with mappings to their internal XML names. Internal names are used in scripts, and XML names are used in the XML syntax. Method signatures and docstrings: - def get_defaultunit(cls, aedtn...
Implement the Python class `MatProperties` described below. Class description: Contains a list of constant names for all materials with mappings to their internal XML names. Internal names are used in scripts, and XML names are used in the XML syntax. Method signatures and docstrings: - def get_defaultunit(cls, aedtn...
2688d6f1b87c64aab539b6d68444bc49ca240405
<|skeleton|> class MatProperties: """Contains a list of constant names for all materials with mappings to their internal XML names. Internal names are used in scripts, and XML names are used in the XML syntax.""" def get_defaultunit(cls, aedtname=None): """Retrieve the default unit for a full name or a...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MatProperties: """Contains a list of constant names for all materials with mappings to their internal XML names. Internal names are used in scripts, and XML names are used in the XML syntax.""" def get_defaultunit(cls, aedtname=None): """Retrieve the default unit for a full name or a category nam...
the_stack_v2_python_sparse
pyaedt/modules/Material.py
boyang2022/pyaedt
train
0
df4eef1b486fecf019eaeb25167bb3b64927ed59
[ "import math\ndp = [0]\nidx = 1\nwhile idx <= n:\n cnt = float('inf')\n for s in range(int(math.sqrt(idx)), 0, -1):\n cnt = min(cnt, dp[idx - s ** 2] + 1)\n dp.append(cnt)\n idx += 1\nreturn dp[n]", "import math\ndp = dict()\n\ndef dfs(idx, n):\n if n <= 0:\n return 0\n if dp.get((...
<|body_start_0|> import math dp = [0] idx = 1 while idx <= n: cnt = float('inf') for s in range(int(math.sqrt(idx)), 0, -1): cnt = min(cnt, dp[idx - s ** 2] + 1) dp.append(cnt) idx += 1 return dp[n] <|end_body_0|> <...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numSquares(self, n): """:type n: int :rtype: int DP, top down from bottom up! e.g 14 sqt = 3""" <|body_0|> def rewrite(self, n): """:type n: int :rtype: int dfs, 類似494 needs memoir!""" <|body_1|> <|end_skeleton|> <|body_start_0|> impor...
stack_v2_sparse_classes_75kplus_train_000685
1,665
no_license
[ { "docstring": ":type n: int :rtype: int DP, top down from bottom up! e.g 14 sqt = 3", "name": "numSquares", "signature": "def numSquares(self, n)" }, { "docstring": ":type n: int :rtype: int dfs, 類似494 needs memoir!", "name": "rewrite", "signature": "def rewrite(self, n)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numSquares(self, n): :type n: int :rtype: int DP, top down from bottom up! e.g 14 sqt = 3 - def rewrite(self, n): :type n: int :rtype: int dfs, 類似494 needs memoir!
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numSquares(self, n): :type n: int :rtype: int DP, top down from bottom up! e.g 14 sqt = 3 - def rewrite(self, n): :type n: int :rtype: int dfs, 類似494 needs memoir! <|skeleto...
6350568d16b0f8c49a020f055bb6d72e2705ea56
<|skeleton|> class Solution: def numSquares(self, n): """:type n: int :rtype: int DP, top down from bottom up! e.g 14 sqt = 3""" <|body_0|> def rewrite(self, n): """:type n: int :rtype: int dfs, 類似494 needs memoir!""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def numSquares(self, n): """:type n: int :rtype: int DP, top down from bottom up! e.g 14 sqt = 3""" import math dp = [0] idx = 1 while idx <= n: cnt = float('inf') for s in range(int(math.sqrt(idx)), 0, -1): cnt = min(cn...
the_stack_v2_python_sparse
co_uber/279_Perfect_Squares.py
vsdrun/lc_public
train
6
95f9b969aee21bb81b0eaf331167cfe9bbd34143
[ "for stack in self.stacks:\n if stack.stack_id == stack_id:\n return stack", "def should_show_stack(stack):\n \"\"\"\n Determines if a stack should be shown for the list response.\n \"\"\"\n if stack.is_deleted() and (not show_deleted):\n return False\n for tag in t...
<|body_start_0|> for stack in self.stacks: if stack.stack_id == stack_id: return stack <|end_body_0|> <|body_start_1|> def should_show_stack(stack): """ Determines if a stack should be shown for the list response. """ ...
A collection of :obj:`Stack` objects for a region.
RegionalStackCollection
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegionalStackCollection: """A collection of :obj:`Stack` objects for a region.""" def stack_by_id(self, stack_id): """Retrieves a stack by its ID""" <|body_0|> def request_list(self, absolutize_url, show_deleted=False, tags=[]): """Tries a stack list operation.""...
stack_v2_sparse_classes_75kplus_train_000686
9,838
permissive
[ { "docstring": "Retrieves a stack by its ID", "name": "stack_by_id", "signature": "def stack_by_id(self, stack_id)" }, { "docstring": "Tries a stack list operation.", "name": "request_list", "signature": "def request_list(self, absolutize_url, show_deleted=False, tags=[])" }, { "...
6
stack_v2_sparse_classes_30k_train_005339
Implement the Python class `RegionalStackCollection` described below. Class description: A collection of :obj:`Stack` objects for a region. Method signatures and docstrings: - def stack_by_id(self, stack_id): Retrieves a stack by its ID - def request_list(self, absolutize_url, show_deleted=False, tags=[]): Tries a st...
Implement the Python class `RegionalStackCollection` described below. Class description: A collection of :obj:`Stack` objects for a region. Method signatures and docstrings: - def stack_by_id(self, stack_id): Retrieves a stack by its ID - def request_list(self, absolutize_url, show_deleted=False, tags=[]): Tries a st...
8e7eeed84ec5ae97863f9330023298845623c639
<|skeleton|> class RegionalStackCollection: """A collection of :obj:`Stack` objects for a region.""" def stack_by_id(self, stack_id): """Retrieves a stack by its ID""" <|body_0|> def request_list(self, absolutize_url, show_deleted=False, tags=[]): """Tries a stack list operation.""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RegionalStackCollection: """A collection of :obj:`Stack` objects for a region.""" def stack_by_id(self, stack_id): """Retrieves a stack by its ID""" for stack in self.stacks: if stack.stack_id == stack_id: return stack def request_list(self, absolutize_url...
the_stack_v2_python_sparse
mimic/model/heat_objects.py
ranjithpeddi/mimic
train
1
1ef19f08c39eee3168114d27cc1c28a284755a56
[ "self.archive_extractor = archive_extractor\nself.resolver = resolver\nself.cwd = cwd", "path = self.resolver.resolve()\nassert os.path.isfile(path)\nextract_hash = hashlib.sha1(path.encode('utf-8')).hexdigest()[:6]\nextract_folder = 'extract-' + extract_hash\nextract_path = os.path.join(self.cwd, extract_folder)...
<|body_start_0|> self.archive_extractor = archive_extractor self.resolver = resolver self.cwd = cwd <|end_body_0|> <|body_start_1|> path = self.resolver.resolve() assert os.path.isfile(path) extract_hash = hashlib.sha1(path.encode('utf-8')).hexdigest()[:6] extrac...
Extracts an archive
ArchiveResolver
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArchiveResolver: """Extracts an archive""" def __init__(self, archive_extractor, resolver, cwd): """Construct a new instance. :param archive_extractor: An archive (zip, tar, etc.) extractor function. :param resolver: The parent resolver responsible for downloading the archive. :param...
stack_v2_sparse_classes_75kplus_train_000687
1,288
permissive
[ { "docstring": "Construct a new instance. :param archive_extractor: An archive (zip, tar, etc.) extractor function. :param resolver: The parent resolver responsible for downloading the archive. :param cwd: Current working directory as a string. This is the place where we should create new folders etc.", "na...
2
stack_v2_sparse_classes_30k_train_005654
Implement the Python class `ArchiveResolver` described below. Class description: Extracts an archive Method signatures and docstrings: - def __init__(self, archive_extractor, resolver, cwd): Construct a new instance. :param archive_extractor: An archive (zip, tar, etc.) extractor function. :param resolver: The parent...
Implement the Python class `ArchiveResolver` described below. Class description: Extracts an archive Method signatures and docstrings: - def __init__(self, archive_extractor, resolver, cwd): Construct a new instance. :param archive_extractor: An archive (zip, tar, etc.) extractor function. :param resolver: The parent...
ba94d46ce58ac7e936fc45acaca1168ae0d7780b
<|skeleton|> class ArchiveResolver: """Extracts an archive""" def __init__(self, archive_extractor, resolver, cwd): """Construct a new instance. :param archive_extractor: An archive (zip, tar, etc.) extractor function. :param resolver: The parent resolver responsible for downloading the archive. :param...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ArchiveResolver: """Extracts an archive""" def __init__(self, archive_extractor, resolver, cwd): """Construct a new instance. :param archive_extractor: An archive (zip, tar, etc.) extractor function. :param resolver: The parent resolver responsible for downloading the archive. :param cwd: Current...
the_stack_v2_python_sparse
src/wurf/archive_resolver.py
steinwurf/waf
train
15
14d2f3f48390265613f871cc9b5fb5e38a3259c5
[ "self.setup_logger()\nself.required_columns = ['a', 'b', 'm', 'n', 'r', 'rpha', 'Zt']\nself.data = self.check_dataframe(data)\nself.electrode_positions = electrode_positions\nself.topography = topography", "if dataframe is None:\n return None\nif not isinstance(dataframe, pd.DataFrame):\n raise Exception('T...
<|body_start_0|> self.setup_logger() self.required_columns = ['a', 'b', 'm', 'n', 'r', 'rpha', 'Zt'] self.data = self.check_dataframe(data) self.electrode_positions = electrode_positions self.topography = topography <|end_body_0|> <|body_start_1|> if dataframe is None: ...
.
CR
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CR: """.""" def __init__(self, data=None, electrode_positions=None, topography=None): """Parameters ---------- data : :py:class:`pandas.DataFrame` If not None, then the provided DataFrame is assumed to contain valid data previously prepared elsewhere. Please refer to the documentatio...
stack_v2_sparse_classes_75kplus_train_000688
5,486
permissive
[ { "docstring": "Parameters ---------- data : :py:class:`pandas.DataFrame` If not None, then the provided DataFrame is assumed to contain valid data previously prepared elsewhere. Please refer to the documentation for required columns. electrode_positions : :py:class:`pandas.DataFrame` If set, this is expected t...
3
null
Implement the Python class `CR` described below. Class description: . Method signatures and docstrings: - def __init__(self, data=None, electrode_positions=None, topography=None): Parameters ---------- data : :py:class:`pandas.DataFrame` If not None, then the provided DataFrame is assumed to contain valid data previo...
Implement the Python class `CR` described below. Class description: . Method signatures and docstrings: - def __init__(self, data=None, electrode_positions=None, topography=None): Parameters ---------- data : :py:class:`pandas.DataFrame` If not None, then the provided DataFrame is assumed to contain valid data previo...
adecc344837c0bf53c5e005a97c2c231b6f9eac2
<|skeleton|> class CR: """.""" def __init__(self, data=None, electrode_positions=None, topography=None): """Parameters ---------- data : :py:class:`pandas.DataFrame` If not None, then the provided DataFrame is assumed to contain valid data previously prepared elsewhere. Please refer to the documentatio...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CR: """.""" def __init__(self, data=None, electrode_positions=None, topography=None): """Parameters ---------- data : :py:class:`pandas.DataFrame` If not None, then the provided DataFrame is assumed to contain valid data previously prepared elsewhere. Please refer to the documentation for require...
the_stack_v2_python_sparse
lib/reda/containers/CR.py
geophysics-ubonn/reda
train
14
d9624171e5e21d14b41f4a7a85193907d649f149
[ "if not root:\n return []\nstack = []\nres = []\nwhile root or stack:\n if root:\n stack.append(root)\n root = root.left\n else:\n root = stack.pop()\n res.append(root.val)\n root = root.right\nreturn res", "if not root:\n return []\nstack = [root]\nres = []\nwhile s...
<|body_start_0|> if not root: return [] stack = [] res = [] while root or stack: if root: stack.append(root) root = root.left else: root = stack.pop() res.append(root.val) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def in_order_traversal(self, root): """:param root: TreeNode :return:""" <|body_0|> def preorderTraversal(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_1|> def preorderTraversal2(self, root): """:type root: TreeNode :...
stack_v2_sparse_classes_75kplus_train_000689
1,394
no_license
[ { "docstring": ":param root: TreeNode :return:", "name": "in_order_traversal", "signature": "def in_order_traversal(self, root)" }, { "docstring": ":type root: TreeNode :rtype: List[int]", "name": "preorderTraversal", "signature": "def preorderTraversal(self, root)" }, { "docstri...
3
stack_v2_sparse_classes_30k_train_026568
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def in_order_traversal(self, root): :param root: TreeNode :return: - def preorderTraversal(self, root): :type root: TreeNode :rtype: List[int] - def preorderTraversal2(self, root...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def in_order_traversal(self, root): :param root: TreeNode :return: - def preorderTraversal(self, root): :type root: TreeNode :rtype: List[int] - def preorderTraversal2(self, root...
11d6bf2ba7b50c07e048df37c4e05c8f46b92241
<|skeleton|> class Solution: def in_order_traversal(self, root): """:param root: TreeNode :return:""" <|body_0|> def preorderTraversal(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_1|> def preorderTraversal2(self, root): """:type root: TreeNode :...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def in_order_traversal(self, root): """:param root: TreeNode :return:""" if not root: return [] stack = [] res = [] while root or stack: if root: stack.append(root) root = root.left else: ...
the_stack_v2_python_sparse
LeetCodes/Trees/TreeTraversal.py
chutianwen/LeetCodes
train
0
cc34c81e7d6790392b7ada67954ba0ab86307af1
[ "dp = [0, 1, 2, 3]\nif n < 2:\n return -1\nelif n == 2:\n return 1\nelif n == 3:\n return 2\nfor i in range(4, n + 1):\n temp = 0\n for j in range(1, i // 2 + 1):\n temp = max(temp, dp[j] * dp[i - j])\n dp.append(temp)\nreturn dp[n]", "if n < 2:\n return -1\nelif n == 2:\n return 1\...
<|body_start_0|> dp = [0, 1, 2, 3] if n < 2: return -1 elif n == 2: return 1 elif n == 3: return 2 for i in range(4, n + 1): temp = 0 for j in range(1, i // 2 + 1): temp = max(temp, dp[j] * dp[i - j]) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def integerBreak(self, n: int) -> int: """dp[i] 代表整数i的最大积拆分 dp[i] = max(dp[i-j] * dp[j]) j=1_最短回文串.py,...,i-1_最短回文串.py. dp[0-3] = 0, 1_最短回文串.py, 2, 3 res = dp[-1_最短回文串.py]""" <|body_0|> def integerBreak(self, n: int) -> int: """贪心: 多分3 尾为1分2,2""" <|...
stack_v2_sparse_classes_75kplus_train_000690
1,039
no_license
[ { "docstring": "dp[i] 代表整数i的最大积拆分 dp[i] = max(dp[i-j] * dp[j]) j=1_最短回文串.py,...,i-1_最短回文串.py. dp[0-3] = 0, 1_最短回文串.py, 2, 3 res = dp[-1_最短回文串.py]", "name": "integerBreak", "signature": "def integerBreak(self, n: int) -> int" }, { "docstring": "贪心: 多分3 尾为1分2,2", "name": "integerBreak", "s...
2
stack_v2_sparse_classes_30k_train_004065
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def integerBreak(self, n: int) -> int: dp[i] 代表整数i的最大积拆分 dp[i] = max(dp[i-j] * dp[j]) j=1_最短回文串.py,...,i-1_最短回文串.py. dp[0-3] = 0, 1_最短回文串.py, 2, 3 res = dp[-1_最短回文串.py] - def int...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def integerBreak(self, n: int) -> int: dp[i] 代表整数i的最大积拆分 dp[i] = max(dp[i-j] * dp[j]) j=1_最短回文串.py,...,i-1_最短回文串.py. dp[0-3] = 0, 1_最短回文串.py, 2, 3 res = dp[-1_最短回文串.py] - def int...
57f303aa6e76f7c5292fa60bffdfddcb4ff9ddfb
<|skeleton|> class Solution: def integerBreak(self, n: int) -> int: """dp[i] 代表整数i的最大积拆分 dp[i] = max(dp[i-j] * dp[j]) j=1_最短回文串.py,...,i-1_最短回文串.py. dp[0-3] = 0, 1_最短回文串.py, 2, 3 res = dp[-1_最短回文串.py]""" <|body_0|> def integerBreak(self, n: int) -> int: """贪心: 多分3 尾为1分2,2""" <|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def integerBreak(self, n: int) -> int: """dp[i] 代表整数i的最大积拆分 dp[i] = max(dp[i-j] * dp[j]) j=1_最短回文串.py,...,i-1_最短回文串.py. dp[0-3] = 0, 1_最短回文串.py, 2, 3 res = dp[-1_最短回文串.py]""" dp = [0, 1, 2, 3] if n < 2: return -1 elif n == 2: return 1 e...
the_stack_v2_python_sparse
4_LEETCODE/9_Greedy/343_整数拆分.py
fzingithub/SwordRefers2Offer
train
1
6eeb2d6be78771a9465d6d2e7b9be50ccaa4674f
[ "self.num_vulnerabilities = num_vulnerabilities\nself.num_intensity_bins = num_intensity_bins\nself.num_damage_bins = num_damage_bins\nself.vulnerability_sparseness = vulnerability_sparseness\nself.dtypes = OrderedDict([('vulnerability_id', 'i'), ('intensity_bin_index', 'i'), ('damage_bin_index', 'i'), ('prob', 'f'...
<|body_start_0|> self.num_vulnerabilities = num_vulnerabilities self.num_intensity_bins = num_intensity_bins self.num_damage_bins = num_damage_bins self.vulnerability_sparseness = vulnerability_sparseness self.dtypes = OrderedDict([('vulnerability_id', 'i'), ('intensity_bin_index...
Generate random data for Vulnerability dummy model file. This file shows the conditional distributions of damage for each intensity bin and for each vulnerability ID. Attributes: generate_data: Generate Vulnerability dummy model file data.
VulnerabilityFile
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VulnerabilityFile: """Generate random data for Vulnerability dummy model file. This file shows the conditional distributions of damage for each intensity bin and for each vulnerability ID. Attributes: generate_data: Generate Vulnerability dummy model file data.""" def __init__(self, num_vuln...
stack_v2_sparse_classes_75kplus_train_000691
39,722
permissive
[ { "docstring": "Initialise VulnerabilityFile class. Args: num_vulnerabilities (int): number of vulnerabilities. num_intensity_bins (int): number of intensity bins. num_damage_bins(int): number of damage bins. vulnerability_sparseness (float): percentage of bins normalised to range [0,1] impacted for a vulnerabi...
2
stack_v2_sparse_classes_30k_train_018610
Implement the Python class `VulnerabilityFile` described below. Class description: Generate random data for Vulnerability dummy model file. This file shows the conditional distributions of damage for each intensity bin and for each vulnerability ID. Attributes: generate_data: Generate Vulnerability dummy model file da...
Implement the Python class `VulnerabilityFile` described below. Class description: Generate random data for Vulnerability dummy model file. This file shows the conditional distributions of damage for each intensity bin and for each vulnerability ID. Attributes: generate_data: Generate Vulnerability dummy model file da...
23e704c335629ccd010969b1090446cfa3f384d5
<|skeleton|> class VulnerabilityFile: """Generate random data for Vulnerability dummy model file. This file shows the conditional distributions of damage for each intensity bin and for each vulnerability ID. Attributes: generate_data: Generate Vulnerability dummy model file data.""" def __init__(self, num_vuln...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VulnerabilityFile: """Generate random data for Vulnerability dummy model file. This file shows the conditional distributions of damage for each intensity bin and for each vulnerability ID. Attributes: generate_data: Generate Vulnerability dummy model file data.""" def __init__(self, num_vulnerabilities, ...
the_stack_v2_python_sparse
oasislmf/computation/data/dummy_model/generate.py
OasisLMF/OasisLMF
train
122
d62e6921d6c0e56da73642f5cfc310037dda6038
[ "with open('zk.yml') as f:\n zk_yml = list(safe_load_all(f))\n self.zk_service = zk_yml[0]\n self.zk_configmap = zk_yml[1]\n self.zk_pdb = zk_yml[2]\n self.zk = zk_yml[3]\nself.__namespace = namespace\nself.__v1_api = client.CoreV1Api()\nself.__v1_policy_api = client.PolicyV1beta1Api()\nself.__v1_app...
<|body_start_0|> with open('zk.yml') as f: zk_yml = list(safe_load_all(f)) self.zk_service = zk_yml[0] self.zk_configmap = zk_yml[1] self.zk_pdb = zk_yml[2] self.zk = zk_yml[3] self.__namespace = namespace self.__v1_api = client.CoreV1A...
Manager for Zookeeper related resources in the cluster Manages creation, deletion, and modification of Zookepeer resources in the Kubernetes cluster. Attributes: zk_service - JSON representation of the Zookeeper service resource used to access Zookeeper zk_configmap - JSON representation of the configmap used to provid...
ZookeeperManager
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ZookeeperManager: """Manager for Zookeeper related resources in the cluster Manages creation, deletion, and modification of Zookepeer resources in the Kubernetes cluster. Attributes: zk_service - JSON representation of the Zookeeper service resource used to access Zookeeper zk_configmap - JSON re...
stack_v2_sparse_classes_75kplus_train_000692
4,162
permissive
[ { "docstring": "Initializes the Zookeeper manager with configuration from the Zookeeper yml file Args: namespace - Namespace to deploy the Zookeeper resources to; string", "name": "__init__", "signature": "def __init__(self, namespace)" }, { "docstring": "Create all Zookeeper items in the cluste...
3
stack_v2_sparse_classes_30k_train_045670
Implement the Python class `ZookeeperManager` described below. Class description: Manager for Zookeeper related resources in the cluster Manages creation, deletion, and modification of Zookepeer resources in the Kubernetes cluster. Attributes: zk_service - JSON representation of the Zookeeper service resource used to ...
Implement the Python class `ZookeeperManager` described below. Class description: Manager for Zookeeper related resources in the cluster Manages creation, deletion, and modification of Zookepeer resources in the Kubernetes cluster. Attributes: zk_service - JSON representation of the Zookeeper service resource used to ...
2b9551aad8ec5518109030f82a396f0c73658e07
<|skeleton|> class ZookeeperManager: """Manager for Zookeeper related resources in the cluster Manages creation, deletion, and modification of Zookepeer resources in the Kubernetes cluster. Attributes: zk_service - JSON representation of the Zookeeper service resource used to access Zookeeper zk_configmap - JSON re...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ZookeeperManager: """Manager for Zookeeper related resources in the cluster Manages creation, deletion, and modification of Zookepeer resources in the Kubernetes cluster. Attributes: zk_service - JSON representation of the Zookeeper service resource used to access Zookeeper zk_configmap - JSON representation ...
the_stack_v2_python_sparse
scripts/control/zk.py
benfen/kapture
train
0
606f42558e73b6d808ca94522bcf781193fdcb8c
[ "self.hp = 1000000\nself.image = pygame.image.load(f'images/{type_}.gif')\nself.rect = self.image.get_rect()\nself.rect.x = x\nself.rect.y = y\nself.is_alive = True", "if pygame.Rect.colliderect(self.rect, item.rect):\n if isinstance(item, Tank):\n return True\n if isinstance(item, Bullet):\n ...
<|body_start_0|> self.hp = 1000000 self.image = pygame.image.load(f'images/{type_}.gif') self.rect = self.image.get_rect() self.rect.x = x self.rect.y = y self.is_alive = True <|end_body_0|> <|body_start_1|> if pygame.Rect.colliderect(self.rect, item.rect): ...
Obstacle
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Obstacle: def __init__(self, x, y, type_): """初始化墙属性""" <|body_0|> def block_item(self, item): """阻挡游戏中的元素""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.hp = 1000000 self.image = pygame.image.load(f'images/{type_}.gif') self.r...
stack_v2_sparse_classes_75kplus_train_000693
10,920
permissive
[ { "docstring": "初始化墙属性", "name": "__init__", "signature": "def __init__(self, x, y, type_)" }, { "docstring": "阻挡游戏中的元素", "name": "block_item", "signature": "def block_item(self, item)" } ]
2
null
Implement the Python class `Obstacle` described below. Class description: Implement the Obstacle class. Method signatures and docstrings: - def __init__(self, x, y, type_): 初始化墙属性 - def block_item(self, item): 阻挡游戏中的元素
Implement the Python class `Obstacle` described below. Class description: Implement the Obstacle class. Method signatures and docstrings: - def __init__(self, x, y, type_): 初始化墙属性 - def block_item(self, item): 阻挡游戏中的元素 <|skeleton|> class Obstacle: def __init__(self, x, y, type_): """初始化墙属性""" <|...
0b69b0cda4f57831504d01b51bd2370f436db2b8
<|skeleton|> class Obstacle: def __init__(self, x, y, type_): """初始化墙属性""" <|body_0|> def block_item(self, item): """阻挡游戏中的元素""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Obstacle: def __init__(self, x, y, type_): """初始化墙属性""" self.hp = 1000000 self.image = pygame.image.load(f'images/{type_}.gif') self.rect = self.image.get_rect() self.rect.x = x self.rect.y = y self.is_alive = True def block_item(self, item): ...
the_stack_v2_python_sparse
第一阶段/基础/坦克大战资源/4子弹击中坦克.py
kwhua/nihao-
train
1
22134e8e3b3f902f9ff171998894b09ef0766603
[ "state = SqliteState(':memory:')\nstate.initialize()\nreturn state", "state = self.state_factory()\nresult = state.query('SELECT name FROM sqlite_schema;')\nassert len(result) == 6" ]
<|body_start_0|> state = SqliteState(':memory:') state.initialize() return state <|end_body_0|> <|body_start_1|> state = self.state_factory() result = state.query('SELECT name FROM sqlite_schema;') assert len(result) == 6 <|end_body_1|>
Test SqliteState implemenation with in-memory database.
SqliteInMemoryStateTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SqliteInMemoryStateTest: """Test SqliteState implemenation with in-memory database.""" def state_factory(self) -> SqliteState: """Return SqliteState with in-memory database.""" <|body_0|> def test_initialize(self) -> None: """Test initialization.""" <|bod...
stack_v2_sparse_classes_75kplus_train_000694
14,164
permissive
[ { "docstring": "Return SqliteState with in-memory database.", "name": "state_factory", "signature": "def state_factory(self) -> SqliteState" }, { "docstring": "Test initialization.", "name": "test_initialize", "signature": "def test_initialize(self) -> None" } ]
2
stack_v2_sparse_classes_30k_train_024487
Implement the Python class `SqliteInMemoryStateTest` described below. Class description: Test SqliteState implemenation with in-memory database. Method signatures and docstrings: - def state_factory(self) -> SqliteState: Return SqliteState with in-memory database. - def test_initialize(self) -> None: Test initializat...
Implement the Python class `SqliteInMemoryStateTest` described below. Class description: Test SqliteState implemenation with in-memory database. Method signatures and docstrings: - def state_factory(self) -> SqliteState: Return SqliteState with in-memory database. - def test_initialize(self) -> None: Test initializat...
55be690535e5f3feb33c888c3e4a586b7bdbf489
<|skeleton|> class SqliteInMemoryStateTest: """Test SqliteState implemenation with in-memory database.""" def state_factory(self) -> SqliteState: """Return SqliteState with in-memory database.""" <|body_0|> def test_initialize(self) -> None: """Test initialization.""" <|bod...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SqliteInMemoryStateTest: """Test SqliteState implemenation with in-memory database.""" def state_factory(self) -> SqliteState: """Return SqliteState with in-memory database.""" state = SqliteState(':memory:') state.initialize() return state def test_initialize(self) -...
the_stack_v2_python_sparse
src/py/flwr/server/state/state_test.py
adap/flower
train
2,999
2a16b43d923514042bf74c8b6f463b969d7a3d10
[ "self._cli_creds = []\nself._folder_paths = {}\ndefault_settings = vendor_settings.pop('default', {})\ndefault_creds = [CLICredentials(user=creds.get('user'), password=creds.get('password'), enable_password=creds.get('enable password')) for creds in default_settings.get('cli-credentials', [])]\nself._default_creds ...
<|body_start_0|> self._cli_creds = [] self._folder_paths = {} default_settings = vendor_settings.pop('default', {}) default_creds = [CLICredentials(user=creds.get('user'), password=creds.get('password'), enable_password=creds.get('enable password')) for creds in default_settings.get('cli...
VendorSettingsCollection
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VendorSettingsCollection: def __init__(self, vendor_settings): """:param dict vendor_settings:""" <|body_0|> def get_creds_by_vendor(self, vendor): """Get CLI credentials by given vendor :param VendorDefinition vendor: :rtype: VendorCLICredentials""" <|body_1...
stack_v2_sparse_classes_75kplus_train_000695
4,559
no_license
[ { "docstring": ":param dict vendor_settings:", "name": "__init__", "signature": "def __init__(self, vendor_settings)" }, { "docstring": "Get CLI credentials by given vendor :param VendorDefinition vendor: :rtype: VendorCLICredentials", "name": "get_creds_by_vendor", "signature": "def get...
3
null
Implement the Python class `VendorSettingsCollection` described below. Class description: Implement the VendorSettingsCollection class. Method signatures and docstrings: - def __init__(self, vendor_settings): :param dict vendor_settings: - def get_creds_by_vendor(self, vendor): Get CLI credentials by given vendor :pa...
Implement the Python class `VendorSettingsCollection` described below. Class description: Implement the VendorSettingsCollection class. Method signatures and docstrings: - def __init__(self, vendor_settings): :param dict vendor_settings: - def get_creds_by_vendor(self, vendor): Get CLI credentials by given vendor :pa...
9ed9e8e74fcf12cb7f7c7fd945f8bc4fae6d5755
<|skeleton|> class VendorSettingsCollection: def __init__(self, vendor_settings): """:param dict vendor_settings:""" <|body_0|> def get_creds_by_vendor(self, vendor): """Get CLI credentials by given vendor :param VendorDefinition vendor: :rtype: VendorCLICredentials""" <|body_1...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VendorSettingsCollection: def __init__(self, vendor_settings): """:param dict vendor_settings:""" self._cli_creds = [] self._folder_paths = {} default_settings = vendor_settings.pop('default', {}) default_creds = [CLICredentials(user=creds.get('user'), password=creds.ge...
the_stack_v2_python_sparse
autodiscovery/models/input_data.py
QualiSystems/cloudshell-autodiscovery
train
1
b0851a16c5f80dd34dc0d5374b49545dae364c8e
[ "return_type = ClientResult(context, SiteSharingReportStatus())\nbinding_type = SiteSharingReportHelper(context)\nqry = ServiceOperationQuery(binding_type, 'CancelSharingReportJob', None, None, None, return_type, True)\ncontext.add_query(qry)\nreturn return_type", "return_type = ClientResult(context, SiteSharingR...
<|body_start_0|> return_type = ClientResult(context, SiteSharingReportStatus()) binding_type = SiteSharingReportHelper(context) qry = ServiceOperationQuery(binding_type, 'CancelSharingReportJob', None, None, None, return_type, True) context.add_query(qry) return return_type <|end...
SiteSharingReportHelper
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SiteSharingReportHelper: def cancel_sharing_report_job(context): """:type context: office365.sharepoint.client_context.ClientContext""" <|body_0|> def create_sharing_report_job(context, web_url, folder_url): """:type context: office365.sharepoint.client_context.Clien...
stack_v2_sparse_classes_75kplus_train_000696
1,460
permissive
[ { "docstring": ":type context: office365.sharepoint.client_context.ClientContext", "name": "cancel_sharing_report_job", "signature": "def cancel_sharing_report_job(context)" }, { "docstring": ":type context: office365.sharepoint.client_context.ClientContext :param str web_url: :param str folder_...
2
stack_v2_sparse_classes_30k_train_028438
Implement the Python class `SiteSharingReportHelper` described below. Class description: Implement the SiteSharingReportHelper class. Method signatures and docstrings: - def cancel_sharing_report_job(context): :type context: office365.sharepoint.client_context.ClientContext - def create_sharing_report_job(context, we...
Implement the Python class `SiteSharingReportHelper` described below. Class description: Implement the SiteSharingReportHelper class. Method signatures and docstrings: - def cancel_sharing_report_job(context): :type context: office365.sharepoint.client_context.ClientContext - def create_sharing_report_job(context, we...
cbd245d1af8d69e013c469cfc2a9851f51c91417
<|skeleton|> class SiteSharingReportHelper: def cancel_sharing_report_job(context): """:type context: office365.sharepoint.client_context.ClientContext""" <|body_0|> def create_sharing_report_job(context, web_url, folder_url): """:type context: office365.sharepoint.client_context.Clien...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SiteSharingReportHelper: def cancel_sharing_report_job(context): """:type context: office365.sharepoint.client_context.ClientContext""" return_type = ClientResult(context, SiteSharingReportStatus()) binding_type = SiteSharingReportHelper(context) qry = ServiceOperationQuery(bin...
the_stack_v2_python_sparse
office365/sharepoint/sharing/site_sharing_report_helper.py
vgrem/Office365-REST-Python-Client
train
1,006
b022f640cd77e379ca1876905c7f4b7d106506c7
[ "self.k = k\nself.upto = upto\nself.normalize = normalize\nself.alphabet = alphabet\ncheck_nac_para(k=self.k, upto=self.upto, normalize=self.normalize, alphabet=self.alphabet)\nself._kmer_list = get_kmer_list(self.k, self.upto, self.alphabet)\nself.feature_name_list = self._kmer_list", "sequence_list = get_data(d...
<|body_start_0|> self.k = k self.upto = upto self.normalize = normalize self.alphabet = alphabet check_nac_para(k=self.k, upto=self.upto, normalize=self.normalize, alphabet=self.alphabet) self._kmer_list = get_kmer_list(self.k, self.upto, self.alphabet) self.featu...
Kmer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Kmer: def __init__(self, k=1, normalize=False, upto=False, alphabet='ACGT'): """:param k: int, the k value of kmer, it should be larger than 0. :param normalize: bool, normalize the result vector or not. :param upto: bool, whether to generate 1-kmer, 2-kmer, ..., k-mer. :param alphabet: ...
stack_v2_sparse_classes_75kplus_train_000697
8,934
permissive
[ { "docstring": ":param k: int, the k value of kmer, it should be larger than 0. :param normalize: bool, normalize the result vector or not. :param upto: bool, whether to generate 1-kmer, 2-kmer, ..., k-mer. :param alphabet: string.", "name": "__init__", "signature": "def __init__(self, k=1, normalize=Fa...
2
null
Implement the Python class `Kmer` described below. Class description: Implement the Kmer class. Method signatures and docstrings: - def __init__(self, k=1, normalize=False, upto=False, alphabet='ACGT'): :param k: int, the k value of kmer, it should be larger than 0. :param normalize: bool, normalize the result vector...
Implement the Python class `Kmer` described below. Class description: Implement the Kmer class. Method signatures and docstrings: - def __init__(self, k=1, normalize=False, upto=False, alphabet='ACGT'): :param k: int, the k value of kmer, it should be larger than 0. :param normalize: bool, normalize the result vector...
a46526eb1094b87ffa387e357de9313cff7ff7e3
<|skeleton|> class Kmer: def __init__(self, k=1, normalize=False, upto=False, alphabet='ACGT'): """:param k: int, the k value of kmer, it should be larger than 0. :param normalize: bool, normalize the result vector or not. :param upto: bool, whether to generate 1-kmer, 2-kmer, ..., k-mer. :param alphabet: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Kmer: def __init__(self, k=1, normalize=False, upto=False, alphabet='ACGT'): """:param k: int, the k value of kmer, it should be larger than 0. :param normalize: bool, normalize the result vector or not. :param upto: bool, whether to generate 1-kmer, 2-kmer, ..., k-mer. :param alphabet: string.""" ...
the_stack_v2_python_sparse
molmap/feature/sequence/nas/global_feature/nac.py
shenwanxiang/bidd-molmap
train
124
7c0f0ef1f5977cf95e47d3cfa28e910318e1ac0c
[ "self.pool_size = pool_size\nself.p = p\nif self.pool_size > 0:\n self.num_imgs = 0\n self.images = []", "if self.pool_size == 0:\n return images\nreturn_images = []\nfor image in images:\n image = torch.unsqueeze(image.data, 0)\n if self.num_imgs < self.pool_size:\n self.num_imgs = self.num...
<|body_start_0|> self.pool_size = pool_size self.p = p if self.pool_size > 0: self.num_imgs = 0 self.images = [] <|end_body_0|> <|body_start_1|> if self.pool_size == 0: return images return_images = [] for image in images: ...
This class implements an image buffer that stores previously generated images. This buffer enables us to update discriminators using a history of generated images rather than the ones produced by the latest generators.
ImagePool
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImagePool: """This class implements an image buffer that stores previously generated images. This buffer enables us to update discriminators using a history of generated images rather than the ones produced by the latest generators.""" def __init__(self, pool_size, p=0.5): """Initial...
stack_v2_sparse_classes_75kplus_train_000698
5,234
permissive
[ { "docstring": "Initialize the ImagePool class Parameters: pool_size (int) -- the size of image buffer, if pool_size=0, no buffer will be created", "name": "__init__", "signature": "def __init__(self, pool_size, p=0.5)" }, { "docstring": "Return an image from the pool. Parameters: images: the la...
2
stack_v2_sparse_classes_30k_val_001727
Implement the Python class `ImagePool` described below. Class description: This class implements an image buffer that stores previously generated images. This buffer enables us to update discriminators using a history of generated images rather than the ones produced by the latest generators. Method signatures and do...
Implement the Python class `ImagePool` described below. Class description: This class implements an image buffer that stores previously generated images. This buffer enables us to update discriminators using a history of generated images rather than the ones produced by the latest generators. Method signatures and do...
f58d4fa293f7950fe131bf50994c1944ffa3b65f
<|skeleton|> class ImagePool: """This class implements an image buffer that stores previously generated images. This buffer enables us to update discriminators using a history of generated images rather than the ones produced by the latest generators.""" def __init__(self, pool_size, p=0.5): """Initial...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ImagePool: """This class implements an image buffer that stores previously generated images. This buffer enables us to update discriminators using a history of generated images rather than the ones produced by the latest generators.""" def __init__(self, pool_size, p=0.5): """Initialize the Image...
the_stack_v2_python_sparse
util/util.py
penguinbing/Mask-ShadowNet
train
2
bc265ad8f156dce7bf7f872247f712207046be6c
[ "super(FusionModule, self).__init__()\nself.input_channels = fuse_config['in_channels']\nself.num_hidden_layers = fuse_config['num_hidden_layers']\nhidden_channels = fuse_config['hidden_channels']\nkernel_sizes = fuse_config['kernel_sizes']\ngru_units = []\nfor i in range(0, self.num_hidden_layers):\n cur_input_...
<|body_start_0|> super(FusionModule, self).__init__() self.input_channels = fuse_config['in_channels'] self.num_hidden_layers = fuse_config['num_hidden_layers'] hidden_channels = fuse_config['hidden_channels'] kernel_sizes = fuse_config['kernel_sizes'] gru_units = [] ...
FusionModule
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FusionModule: def __init__(self, fuse_config): """Args: fuse_config : dict, fusion configuration""" <|body_0|> def forward(self, x, alphas, h=None): """Args: x : tensor (B, L, C, W, H), hidden states alphas : tensor (B, L, 1, 1, 1), boolean indicator (0 if padded low...
stack_v2_sparse_classes_75kplus_train_000699
9,902
permissive
[ { "docstring": "Args: fuse_config : dict, fusion configuration", "name": "__init__", "signature": "def __init__(self, fuse_config)" }, { "docstring": "Args: x : tensor (B, L, C, W, H), hidden states alphas : tensor (B, L, 1, 1, 1), boolean indicator (0 if padded low-res view, 1 otherwise) Return...
2
null
Implement the Python class `FusionModule` described below. Class description: Implement the FusionModule class. Method signatures and docstrings: - def __init__(self, fuse_config): Args: fuse_config : dict, fusion configuration - def forward(self, x, alphas, h=None): Args: x : tensor (B, L, C, W, H), hidden states al...
Implement the Python class `FusionModule` described below. Class description: Implement the FusionModule class. Method signatures and docstrings: - def __init__(self, fuse_config): Args: fuse_config : dict, fusion configuration - def forward(self, x, alphas, h=None): Args: x : tensor (B, L, C, W, H), hidden states al...
caf71c8446e185bc6f44f6e29c029883550ef9d9
<|skeleton|> class FusionModule: def __init__(self, fuse_config): """Args: fuse_config : dict, fusion configuration""" <|body_0|> def forward(self, x, alphas, h=None): """Args: x : tensor (B, L, C, W, H), hidden states alphas : tensor (B, L, 1, 1, 1), boolean indicator (0 if padded low...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FusionModule: def __init__(self, fuse_config): """Args: fuse_config : dict, fusion configuration""" super(FusionModule, self).__init__() self.input_channels = fuse_config['in_channels'] self.num_hidden_layers = fuse_config['num_hidden_layers'] hidden_channels = fuse_con...
the_stack_v2_python_sparse
src/DeepNetworks/MISRGRU.py
hehongjie/MISR-GRU
train
0