body_hash stringlengths 64 64 | body stringlengths 23 109k | docstring stringlengths 1 57k | path stringlengths 4 198 | name stringlengths 1 115 | repository_name stringlengths 7 111 | repository_stars float64 0 191k | lang stringclasses 1
value | body_without_docstring stringlengths 14 108k | unified stringlengths 45 133k |
|---|---|---|---|---|---|---|---|---|---|
ee69d829669ccff93925b02449a790ee38e103410c7a68925c7787004c39aaeb | def Start(self):
'Schedules the ReadBuffer client action.'
pathspec = rdf_paths.PathSpec(path='\\\\.\\PhysicalDrive0\\', pathtype=rdf_paths.PathSpec.PathType.OS, path_options=rdf_paths.PathSpec.Options.CASE_LITERAL)
self.state.bytes_downloaded = 0
self.state.buffers = []
buffer_size = constants.CLIE... | Schedules the ReadBuffer client action. | grr/server/grr_response_server/flows/general/transfer.py | Start | max-vogler/grr | 4,238 | python | def Start(self):
pathspec = rdf_paths.PathSpec(path='\\\\.\\PhysicalDrive0\\', pathtype=rdf_paths.PathSpec.PathType.OS, path_options=rdf_paths.PathSpec.Options.CASE_LITERAL)
self.state.bytes_downloaded = 0
self.state.buffers = []
buffer_size = constants.CLIENT_MAX_BUFFER_SIZE
buffers_we_need = ... | def Start(self):
pathspec = rdf_paths.PathSpec(path='\\\\.\\PhysicalDrive0\\', pathtype=rdf_paths.PathSpec.PathType.OS, path_options=rdf_paths.PathSpec.Options.CASE_LITERAL)
self.state.bytes_downloaded = 0
self.state.buffers = []
buffer_size = constants.CLIENT_MAX_BUFFER_SIZE
buffers_we_need = ... |
430d0eb21d1cfb9bc004beddf5707c4388304c2e73807d8f024676c393ceb161 | def StoreMBR(self, responses):
'This method stores the MBR.'
if (not responses.success):
msg = ('Could not retrieve MBR: %s' % responses.status)
self.Log(msg)
raise flow_base.FlowError(msg)
response = responses.First()
self.state.buffers.append(response.data)
self.state.bytes... | This method stores the MBR. | grr/server/grr_response_server/flows/general/transfer.py | StoreMBR | max-vogler/grr | 4,238 | python | def StoreMBR(self, responses):
if (not responses.success):
msg = ('Could not retrieve MBR: %s' % responses.status)
self.Log(msg)
raise flow_base.FlowError(msg)
response = responses.First()
self.state.buffers.append(response.data)
self.state.bytes_downloaded += len(response.d... | def StoreMBR(self, responses):
if (not responses.success):
msg = ('Could not retrieve MBR: %s' % responses.status)
self.Log(msg)
raise flow_base.FlowError(msg)
response = responses.First()
self.state.buffers.append(response.data)
self.state.bytes_downloaded += len(response.d... |
bdcc6200e9962974b868188ffc246592208d84223f591159670d4fae11301baa | def Start(self):
'This issues the sendfile request.'
self.CallClient(server_stubs.SendFile, self.args, next_state=compatibility.GetName(self.Done)) | This issues the sendfile request. | grr/server/grr_response_server/flows/general/transfer.py | Start | max-vogler/grr | 4,238 | python | def Start(self):
self.CallClient(server_stubs.SendFile, self.args, next_state=compatibility.GetName(self.Done)) | def Start(self):
self.CallClient(server_stubs.SendFile, self.args, next_state=compatibility.GetName(self.Done))<|docstring|>This issues the sendfile request.<|endoftext|> |
980b0e854eae7a0d352e4d9cfc7b409763d35e84ddd14b82bdad639910858d40 | def test_number_separator_pass():
'Test passes for number_separator.'
input_text = 'hello2 people'
assert (number_separator(input_text) == 'hello 2 people') | Test passes for number_separator. | tests/test_number_separator.py | test_number_separator_pass | rezashabrang/cleaner-utils | 4 | python | def test_number_separator_pass():
input_text = 'hello2 people'
assert (number_separator(input_text) == 'hello 2 people') | def test_number_separator_pass():
input_text = 'hello2 people'
assert (number_separator(input_text) == 'hello 2 people')<|docstring|>Test passes for number_separator.<|endoftext|> |
99e164248a5398b487fd2d82eaf81634c9f27298db727009c39f310c96751e0d | def catchInterrupt(func):
"decorator : when interupt occurs the display is lost if you don't catch it\n TODO * <view>.stop_data_fetch() # stop\n\n ."
def catch_interrupt(*args, **kwargs):
try:
func(*args, **kwargs)
except KeyboardInterrupt:
pass
return catc... | decorator : when interupt occurs the display is lost if you don't catch it
TODO * <view>.stop_data_fetch() # stop
. | scripts/streams_aid.py | catchInterrupt | IBMStreams/sample.wikirecent | 1 | python | def catchInterrupt(func):
"decorator : when interupt occurs the display is lost if you don't catch it\n TODO * <view>.stop_data_fetch() # stop\n\n ."
def catch_interrupt(*args, **kwargs):
try:
func(*args, **kwargs)
except KeyboardInterrupt:
pass
return catc... | def catchInterrupt(func):
"decorator : when interupt occurs the display is lost if you don't catch it\n TODO * <view>.stop_data_fetch() # stop\n\n ."
def catch_interrupt(*args, **kwargs):
try:
func(*args, **kwargs)
except KeyboardInterrupt:
pass
return catc... |
fc817ada6e6bcfcc4b1f5f116733170931804b590b8941c92b9022cf7c5ecd1c | def display_view_stop(eventView, period=2):
'Wrapper for streamsx.rest_primitives.View.display() to have button. '
button = widgets.Button(description='Stop Updating')
display(button)
eventView.display(period=period)
def on_button_clicked(b):
eventView.stop_data_fetch()
b.descriptio... | Wrapper for streamsx.rest_primitives.View.display() to have button. | scripts/streams_aid.py | display_view_stop | IBMStreams/sample.wikirecent | 1 | python | def display_view_stop(eventView, period=2):
' '
button = widgets.Button(description='Stop Updating')
display(button)
eventView.display(period=period)
def on_button_clicked(b):
eventView.stop_data_fetch()
b.description = 'Stopped'
button.on_click(on_button_clicked) | def display_view_stop(eventView, period=2):
' '
button = widgets.Button(description='Stop Updating')
display(button)
eventView.display(period=period)
def on_button_clicked(b):
eventView.stop_data_fetch()
b.description = 'Stopped'
button.on_click(on_button_clicked)<|docstring|>Wr... |
eb9fb382c7582e1c9579b11d4c3178ff360830796af590ca28857853df7a70f0 | def view_events(views):
'\n Build interface to display a list of views and\n display view when selected from list.\n\n '
view_names = [view.name for view in views]
nameView = dict(zip(view_names, views))
select = widgets.RadioButtons(options=view_names, value=None, description='Select view to d... | Build interface to display a list of views and
display view when selected from list. | scripts/streams_aid.py | view_events | IBMStreams/sample.wikirecent | 1 | python | def view_events(views):
'\n Build interface to display a list of views and\n display view when selected from list.\n\n '
view_names = [view.name for view in views]
nameView = dict(zip(view_names, views))
select = widgets.RadioButtons(options=view_names, value=None, description='Select view to d... | def view_events(views):
'\n Build interface to display a list of views and\n display view when selected from list.\n\n '
view_names = [view.name for view in views]
nameView = dict(zip(view_names, views))
select = widgets.RadioButtons(options=view_names, value=None, description='Select view to d... |
d6e275ecf0726e2bad97cc0f9a8e299315c7d4f19240380ed9fec689c18cfd58 | def find_job(instance, job_name=None):
'locate job within instance'
for job in instance.get_jobs():
if (job.applicationName.split('::')[(- 1)] == job_name):
return job
else:
return None | locate job within instance | scripts/streams_aid.py | find_job | IBMStreams/sample.wikirecent | 1 | python | def find_job(instance, job_name=None):
for job in instance.get_jobs():
if (job.applicationName.split('::')[(- 1)] == job_name):
return job
else:
return None | def find_job(instance, job_name=None):
for job in instance.get_jobs():
if (job.applicationName.split('::')[(- 1)] == job_name):
return job
else:
return None<|docstring|>locate job within instance<|endoftext|> |
df7f202dd733ee65beb7d18c006a8fc4efd6b60f48dc50b2de1e81879d663a7c | def display_views(instance, job_name):
'Locate/promote and display all views of a job'
job = find_job(instance, job_name=job_name)
if (job is None):
print('Failed to locate job')
else:
views = job.get_views()
view_events(views) | Locate/promote and display all views of a job | scripts/streams_aid.py | display_views | IBMStreams/sample.wikirecent | 1 | python | def display_views(instance, job_name):
job = find_job(instance, job_name=job_name)
if (job is None):
print('Failed to locate job')
else:
views = job.get_views()
view_events(views) | def display_views(instance, job_name):
job = find_job(instance, job_name=job_name)
if (job is None):
print('Failed to locate job')
else:
views = job.get_views()
view_events(views)<|docstring|>Locate/promote and display all views of a job<|endoftext|> |
35762aef971c1c4faba84256aa1adf42c5866af66a3ef16e79f2cbb43de3228a | def list_jobs(_instance=None, cancel=False):
'\n Interactive selection of jobs to cancel.\n\n Prompts with SelectMultiple widget, if thier are no jobs, your presente with a blank list.\n\n '
active_jobs = {'{}:{}'.format(job.name, job.health): job for job in _instance.get_jobs()}
selectMultiple_job... | Interactive selection of jobs to cancel.
Prompts with SelectMultiple widget, if thier are no jobs, your presente with a blank list. | scripts/streams_aid.py | list_jobs | IBMStreams/sample.wikirecent | 1 | python | def list_jobs(_instance=None, cancel=False):
'\n Interactive selection of jobs to cancel.\n\n Prompts with SelectMultiple widget, if thier are no jobs, your presente with a blank list.\n\n '
active_jobs = {'{}:{}'.format(job.name, job.health): job for job in _instance.get_jobs()}
selectMultiple_job... | def list_jobs(_instance=None, cancel=False):
'\n Interactive selection of jobs to cancel.\n\n Prompts with SelectMultiple widget, if thier are no jobs, your presente with a blank list.\n\n '
active_jobs = {'{}:{}'.format(job.name, job.health): job for job in _instance.get_jobs()}
selectMultiple_job... |
b94294c351847f4178e73aa72dd1c079cb6294a3882d853a2cfa9054be2525e0 | def submitToStreams(topology, streams_cfg, streams_instance):
'Cancel if same name job is active and submit.\n Args:\n toplogy: streams application topology\n streams_cfg : connection information - from get_instance()\n streams_instance : from get_instance()\n Notes:\... | Cancel if same name job is active and submit.
Args:
toplogy: streams application topology
streams_cfg : connection information - from get_instance()
streams_instance : from get_instance()
Notes:
Create local copy of the streams config so this can be thread-safe | scripts/streams_aid.py | submitToStreams | IBMStreams/sample.wikirecent | 1 | python | def submitToStreams(topology, streams_cfg, streams_instance):
'Cancel if same name job is active and submit.\n Args:\n toplogy: streams application topology\n streams_cfg : connection information - from get_instance()\n streams_instance : from get_instance()\n Notes:\... | def submitToStreams(topology, streams_cfg, streams_instance):
'Cancel if same name job is active and submit.\n Args:\n toplogy: streams application topology\n streams_cfg : connection information - from get_instance()\n streams_instance : from get_instance()\n Notes:\... |
0f4dc4524a2817fa86893bbe09ab6735dba5450d53c9fa910ac7c765c64f55a1 | def cloudSubmit(instance, streams_cloud_service, topology, credential):
'submit cloud streams instance\n Args:\n instance : when submitting from CP4D or Cloud\n streams_cloud_service : when submitting to cloud, the name of the service credential.py must appropriate mapping\n topology : topol... | submit cloud streams instance
Args:
instance : when submitting from CP4D or Cloud
streams_cloud_service : when submitting to cloud, the name of the service credential.py must appropriate mapping
topology : topology to submit
credential : streams instance cloud credential | scripts/streams_aid.py | cloudSubmit | IBMStreams/sample.wikirecent | 1 | python | def cloudSubmit(instance, streams_cloud_service, topology, credential):
'submit cloud streams instance\n Args:\n instance : when submitting from CP4D or Cloud\n streams_cloud_service : when submitting to cloud, the name of the service credential.py must appropriate mapping\n topology : topol... | def cloudSubmit(instance, streams_cloud_service, topology, credential):
'submit cloud streams instance\n Args:\n instance : when submitting from CP4D or Cloud\n streams_cloud_service : when submitting to cloud, the name of the service credential.py must appropriate mapping\n topology : topol... |
e1e38d4339297055803c6c1a3b76626346eda3726d3a66990db7590183faae6a | def get_instance(service_name='Steaming3Turbine'):
"Setup to access your Streams instance.\n\n ..note::The notebook is work within Cloud and ICP4D.\n Refer to the 'Setup' cells above.\n Returns:\n instance : Access to Streams instance, used for submitting and rendering views.\n "
try:... | Setup to access your Streams instance.
..note::The notebook is work within Cloud and ICP4D.
Refer to the 'Setup' cells above.
Returns:
instance : Access to Streams instance, used for submitting and rendering views. | scripts/streams_aid.py | get_instance | IBMStreams/sample.wikirecent | 1 | python | def get_instance(service_name='Steaming3Turbine'):
"Setup to access your Streams instance.\n\n ..note::The notebook is work within Cloud and ICP4D.\n Refer to the 'Setup' cells above.\n Returns:\n instance : Access to Streams instance, used for submitting and rendering views.\n "
try:... | def get_instance(service_name='Steaming3Turbine'):
"Setup to access your Streams instance.\n\n ..note::The notebook is work within Cloud and ICP4D.\n Refer to the 'Setup' cells above.\n Returns:\n instance : Access to Streams instance, used for submitting and rendering views.\n "
try:... |
f50b5d19d1a7b75282e01785b2796ba69b569be752826c93b954c4fb8a1b6118 | def make_response(success, http_status, data=None, message=None):
'Return formatted json response.'
json_result = jsonify({'success': success, 'message': message, 'data': data})
return (json_result, http_status) | Return formatted json response. | server/app/utils/response.py | make_response | PetrushynskyiOleksii/peliculas | 0 | python | def make_response(success, http_status, data=None, message=None):
json_result = jsonify({'success': success, 'message': message, 'data': data})
return (json_result, http_status) | def make_response(success, http_status, data=None, message=None):
json_result = jsonify({'success': success, 'message': message, 'data': data})
return (json_result, http_status)<|docstring|>Return formatted json response.<|endoftext|> |
4950a10e6b777b3b2ea821ddf730ce1a0690a4c3fb70c080f67fbaec936fc3c0 | def init(empty=False):
' (re-)initalizes the platform with devices. '
global DEVICES
DEVICES = ([] if empty else [MockToggleDevice('AC', STATE_ON), MockToggleDevice('AC', STATE_OFF), MockToggleDevice(None, STATE_OFF)]) | (re-)initalizes the platform with devices. | tests/config/custom_components/switch/test.py | init | evancohen/home-assistant | 14 | python | def init(empty=False):
' '
global DEVICES
DEVICES = ([] if empty else [MockToggleDevice('AC', STATE_ON), MockToggleDevice('AC', STATE_OFF), MockToggleDevice(None, STATE_OFF)]) | def init(empty=False):
' '
global DEVICES
DEVICES = ([] if empty else [MockToggleDevice('AC', STATE_ON), MockToggleDevice('AC', STATE_OFF), MockToggleDevice(None, STATE_OFF)])<|docstring|>(re-)initalizes the platform with devices.<|endoftext|> |
b4daf467b0d645b64dadfd2628e856aaad3598c8d2430498f95152e5209cef2f | def setup_platform(hass, config, add_devices_callback, discovery_info=None):
' Find and return test switches. '
add_devices_callback(DEVICES) | Find and return test switches. | tests/config/custom_components/switch/test.py | setup_platform | evancohen/home-assistant | 14 | python | def setup_platform(hass, config, add_devices_callback, discovery_info=None):
' '
add_devices_callback(DEVICES) | def setup_platform(hass, config, add_devices_callback, discovery_info=None):
' '
add_devices_callback(DEVICES)<|docstring|>Find and return test switches.<|endoftext|> |
724d1538b564fc16759e3838676df256e9686bd20347e4fb67292b64f97b27f5 | def make_table(rows: List[List[Any]], labels: Optional[List[Any]]=None, centered: bool=False) -> str:
'\n :param rows: 2D list containing objects that have a single-line representation (via `str`).\n All rows must be of the same length.\n :param labels: List containing the column labels. If present, the le... | :param rows: 2D list containing objects that have a single-line representation (via `str`).
All rows must be of the same length.
:param labels: List containing the column labels. If present, the length must equal to that of each row.
:param centered: If the items should be aligned to the center, else they are left alig... | qualifier/qualifier.py | make_table | chrisd149/cj8-qualifier | 0 | python | def make_table(rows: List[List[Any]], labels: Optional[List[Any]]=None, centered: bool=False) -> str:
'\n :param rows: 2D list containing objects that have a single-line representation (via `str`).\n All rows must be of the same length.\n :param labels: List containing the column labels. If present, the le... | def make_table(rows: List[List[Any]], labels: Optional[List[Any]]=None, centered: bool=False) -> str:
'\n :param rows: 2D list containing objects that have a single-line representation (via `str`).\n All rows must be of the same length.\n :param labels: List containing the column labels. If present, the le... |
cc6fc32ae8fc9935823d69be195c3b151e162fdfbfd9606103a0b49a4e5ededa | def setUp(self):
'\n Set up unit test\n '
self.install = InstallCfg()
self.r_velocity = 'nr02-vs500_lf.vel'
self.r_stations = 'one_stat.txt'
self.r_src = 'test_wh_ucsb.src'
self.r_srf = 'test_ucsb.srf'
self.sim_id = int(seqnum.get_seq_num())
a_indir = os.path.join(self.inst... | Set up unit test | bbp/tests/test_uc_site.py | setUp | ZhangHCFJEA/bbp | 28 | python | def setUp(self):
'\n \n '
self.install = InstallCfg()
self.r_velocity = 'nr02-vs500_lf.vel'
self.r_stations = 'one_stat.txt'
self.r_src = 'test_wh_ucsb.src'
self.r_srf = 'test_ucsb.srf'
self.sim_id = int(seqnum.get_seq_num())
a_indir = os.path.join(self.install.A_IN_DATA_DI... | def setUp(self):
'\n \n '
self.install = InstallCfg()
self.r_velocity = 'nr02-vs500_lf.vel'
self.r_stations = 'one_stat.txt'
self.r_src = 'test_wh_ucsb.src'
self.r_srf = 'test_ucsb.srf'
self.sim_id = int(seqnum.get_seq_num())
a_indir = os.path.join(self.install.A_IN_DATA_DI... |
60234349b4479311cb8e331c5e4d8dd1c41e24c9e0687362e59c2d4a9cfbcdb8 | def psd(wave, rate=None, units='decibels', scaling='density', kind='spectrogram', window_length=1024, window_overlap=50, window_shape='hann', pressure_reference=20.0):
"\n Estimate the power spectral density (psd) of a wave\n \n Parameters\n ----------\n wave: Wave object, file path to a WAV file, or... | Estimate the power spectral density (psd) of a wave
Parameters
----------
wave: Wave object, file path to a WAV file, or numpy array of WAV signal samples
rate: sample rate of signal, default = None
required when 'wave' is a numpy array
if 'None', the rate will be determined by the 'wave' object
units: strin... | nacoustik/spectrum/analysis.py | psd | jacobdein/wavescape | 0 | python | def psd(wave, rate=None, units='decibels', scaling='density', kind='spectrogram', window_length=1024, window_overlap=50, window_shape='hann', pressure_reference=20.0):
"\n Estimate the power spectral density (psd) of a wave\n \n Parameters\n ----------\n wave: Wave object, file path to a WAV file, or... | def psd(wave, rate=None, units='decibels', scaling='density', kind='spectrogram', window_length=1024, window_overlap=50, window_shape='hann', pressure_reference=20.0):
"\n Estimate the power spectral density (psd) of a wave\n \n Parameters\n ----------\n wave: Wave object, file path to a WAV file, or... |
97ea1a7d8ca0b3e5f7794bd34b2b94d2313c52308e667e321587a4999f88ff59 | def sel(a, rate, duration, b=None, limit=2000, bin_width=1000, return_bins=False):
'\n Estimate the sound exposure level (sel) per minute from a wave\n \n Parameters\n ----------\n a: numpy float64 array, required\n a 3d array (channels, frequency bands, time steps)\n representing the p... | Estimate the sound exposure level (sel) per minute from a wave
Parameters
----------
a: numpy float64 array, required
a 3d array (channels, frequency bands, time steps)
representing the psd (power spectral density)
spectrogram of a wave signal in decibels
rate: sample rate of signal, required
dur... | nacoustik/spectrum/analysis.py | sel | jacobdein/wavescape | 0 | python | def sel(a, rate, duration, b=None, limit=2000, bin_width=1000, return_bins=False):
'\n Estimate the sound exposure level (sel) per minute from a wave\n \n Parameters\n ----------\n a: numpy float64 array, required\n a 3d array (channels, frequency bands, time steps)\n representing the p... | def sel(a, rate, duration, b=None, limit=2000, bin_width=1000, return_bins=False):
'\n Estimate the sound exposure level (sel) per minute from a wave\n \n Parameters\n ----------\n a: numpy float64 array, required\n a 3d array (channels, frequency bands, time steps)\n representing the p... |
c1f6a10ab2140078c9c7bc5fa8d50e317a70dec189426587b54da51c97e41b64 | def __init__(__self__, *, user: pulumi.Input[str], pgp_key: Optional[pulumi.Input[str]]=None, status: Optional[pulumi.Input[str]]=None):
'\n The set of arguments for constructing a AccessKey resource.\n :param pulumi.Input[str] user: IAM user to associate with this access key.\n :param pulumi.I... | The set of arguments for constructing a AccessKey resource.
:param pulumi.Input[str] user: IAM user to associate with this access key.
:param pulumi.Input[str] pgp_key: Either a base-64 encoded PGP public key, or a keybase username in the form `keybase:some_person_that_exists`, for use in the `encrypted_secret` output ... | sdk/python/pulumi_aws/iam/access_key.py | __init__ | rapzo/pulumi-aws | 260 | python | def __init__(__self__, *, user: pulumi.Input[str], pgp_key: Optional[pulumi.Input[str]]=None, status: Optional[pulumi.Input[str]]=None):
'\n The set of arguments for constructing a AccessKey resource.\n :param pulumi.Input[str] user: IAM user to associate with this access key.\n :param pulumi.I... | def __init__(__self__, *, user: pulumi.Input[str], pgp_key: Optional[pulumi.Input[str]]=None, status: Optional[pulumi.Input[str]]=None):
'\n The set of arguments for constructing a AccessKey resource.\n :param pulumi.Input[str] user: IAM user to associate with this access key.\n :param pulumi.I... |
9782a684b3044a623f4920950b034bb79a9fa8783d5097e6735e6c2f309c4aad | @property
@pulumi.getter
def user(self) -> pulumi.Input[str]:
'\n IAM user to associate with this access key.\n '
return pulumi.get(self, 'user') | IAM user to associate with this access key. | sdk/python/pulumi_aws/iam/access_key.py | user | rapzo/pulumi-aws | 260 | python | @property
@pulumi.getter
def user(self) -> pulumi.Input[str]:
'\n \n '
return pulumi.get(self, 'user') | @property
@pulumi.getter
def user(self) -> pulumi.Input[str]:
'\n \n '
return pulumi.get(self, 'user')<|docstring|>IAM user to associate with this access key.<|endoftext|> |
c78fe070d9714d3f4992838b5cf041dff6e1b69882576d35ea0b6d573ad171a6 | @property
@pulumi.getter(name='pgpKey')
def pgp_key(self) -> Optional[pulumi.Input[str]]:
'\n Either a base-64 encoded PGP public key, or a keybase username in the form `keybase:some_person_that_exists`, for use in the `encrypted_secret` output attribute.\n '
return pulumi.get(self, 'pgp_key') | Either a base-64 encoded PGP public key, or a keybase username in the form `keybase:some_person_that_exists`, for use in the `encrypted_secret` output attribute. | sdk/python/pulumi_aws/iam/access_key.py | pgp_key | rapzo/pulumi-aws | 260 | python | @property
@pulumi.getter(name='pgpKey')
def pgp_key(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'pgp_key') | @property
@pulumi.getter(name='pgpKey')
def pgp_key(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'pgp_key')<|docstring|>Either a base-64 encoded PGP public key, or a keybase username in the form `keybase:some_person_that_exists`, for use in the `encrypted_secret` output a... |
4d9325eb6593746375c0418566825284d0e7655b5ca752a464ec5f116cf125b7 | @property
@pulumi.getter
def status(self) -> Optional[pulumi.Input[str]]:
'\n Access key status to apply. Defaults to `Active`. Valid values are `Active` and `Inactive`.\n '
return pulumi.get(self, 'status') | Access key status to apply. Defaults to `Active`. Valid values are `Active` and `Inactive`. | sdk/python/pulumi_aws/iam/access_key.py | status | rapzo/pulumi-aws | 260 | python | @property
@pulumi.getter
def status(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'status') | @property
@pulumi.getter
def status(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'status')<|docstring|>Access key status to apply. Defaults to `Active`. Valid values are `Active` and `Inactive`.<|endoftext|> |
5a196de304c53603f9c6d0ff566b75a2949cb8b1ef093bd1dfe5daed16b5e88a | def __init__(__self__, *, create_date: Optional[pulumi.Input[str]]=None, encrypted_secret: Optional[pulumi.Input[str]]=None, encrypted_ses_smtp_password_v4: Optional[pulumi.Input[str]]=None, key_fingerprint: Optional[pulumi.Input[str]]=None, pgp_key: Optional[pulumi.Input[str]]=None, secret: Optional[pulumi.Input[str]]... | Input properties used for looking up and filtering AccessKey resources.
:param pulumi.Input[str] create_date: Date and time in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) that the access key was created.
:param pulumi.Input[str] key_fingerprint: Fingerprint of the PGP key used to encrypt the secre... | sdk/python/pulumi_aws/iam/access_key.py | __init__ | rapzo/pulumi-aws | 260 | python | def __init__(__self__, *, create_date: Optional[pulumi.Input[str]]=None, encrypted_secret: Optional[pulumi.Input[str]]=None, encrypted_ses_smtp_password_v4: Optional[pulumi.Input[str]]=None, key_fingerprint: Optional[pulumi.Input[str]]=None, pgp_key: Optional[pulumi.Input[str]]=None, secret: Optional[pulumi.Input[str]]... | def __init__(__self__, *, create_date: Optional[pulumi.Input[str]]=None, encrypted_secret: Optional[pulumi.Input[str]]=None, encrypted_ses_smtp_password_v4: Optional[pulumi.Input[str]]=None, key_fingerprint: Optional[pulumi.Input[str]]=None, pgp_key: Optional[pulumi.Input[str]]=None, secret: Optional[pulumi.Input[str]]... |
226d1528246040f42ad8aa7352af31727787727d1f0a39993c6973ca804ff1a8 | @property
@pulumi.getter(name='createDate')
def create_date(self) -> Optional[pulumi.Input[str]]:
'\n Date and time in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) that the access key was created.\n '
return pulumi.get(self, 'create_date') | Date and time in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) that the access key was created. | sdk/python/pulumi_aws/iam/access_key.py | create_date | rapzo/pulumi-aws | 260 | python | @property
@pulumi.getter(name='createDate')
def create_date(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'create_date') | @property
@pulumi.getter(name='createDate')
def create_date(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'create_date')<|docstring|>Date and time in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) that the access key was created.<|endoftext|> |
7955bb670b5d715881ca41655456459121b5fe04347d43a1321181156a2411d4 | @property
@pulumi.getter(name='keyFingerprint')
def key_fingerprint(self) -> Optional[pulumi.Input[str]]:
'\n Fingerprint of the PGP key used to encrypt the secret. This attribute is not available for imported resources.\n '
return pulumi.get(self, 'key_fingerprint') | Fingerprint of the PGP key used to encrypt the secret. This attribute is not available for imported resources. | sdk/python/pulumi_aws/iam/access_key.py | key_fingerprint | rapzo/pulumi-aws | 260 | python | @property
@pulumi.getter(name='keyFingerprint')
def key_fingerprint(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'key_fingerprint') | @property
@pulumi.getter(name='keyFingerprint')
def key_fingerprint(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'key_fingerprint')<|docstring|>Fingerprint of the PGP key used to encrypt the secret. This attribute is not available for imported resources.<|endoftext|> |
c78fe070d9714d3f4992838b5cf041dff6e1b69882576d35ea0b6d573ad171a6 | @property
@pulumi.getter(name='pgpKey')
def pgp_key(self) -> Optional[pulumi.Input[str]]:
'\n Either a base-64 encoded PGP public key, or a keybase username in the form `keybase:some_person_that_exists`, for use in the `encrypted_secret` output attribute.\n '
return pulumi.get(self, 'pgp_key') | Either a base-64 encoded PGP public key, or a keybase username in the form `keybase:some_person_that_exists`, for use in the `encrypted_secret` output attribute. | sdk/python/pulumi_aws/iam/access_key.py | pgp_key | rapzo/pulumi-aws | 260 | python | @property
@pulumi.getter(name='pgpKey')
def pgp_key(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'pgp_key') | @property
@pulumi.getter(name='pgpKey')
def pgp_key(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'pgp_key')<|docstring|>Either a base-64 encoded PGP public key, or a keybase username in the form `keybase:some_person_that_exists`, for use in the `encrypted_secret` output a... |
2e19d42886a31c1f517fee76f2ae7ab36f3abde4dc41490059ed5c88f14c7d4c | @property
@pulumi.getter
def secret(self) -> Optional[pulumi.Input[str]]:
'\n Secret access key. This attribute is not available for imported resources. Note that this will be written to the state file. If you use this, please protect your backend state file judiciously. Alternatively, you may supply a `pgp_... | Secret access key. This attribute is not available for imported resources. Note that this will be written to the state file. If you use this, please protect your backend state file judiciously. Alternatively, you may supply a `pgp_key` instead, which will prevent the secret from being stored in plaintext, at the cost o... | sdk/python/pulumi_aws/iam/access_key.py | secret | rapzo/pulumi-aws | 260 | python | @property
@pulumi.getter
def secret(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'secret') | @property
@pulumi.getter
def secret(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'secret')<|docstring|>Secret access key. This attribute is not available for imported resources. Note that this will be written to the state file. If you use this, please protect your backend... |
1f634e2e1d27921844a269ca54cbd13899d16947c0f1b4dd7701078b99160be0 | @property
@pulumi.getter(name='sesSmtpPasswordV4')
def ses_smtp_password_v4(self) -> Optional[pulumi.Input[str]]:
"\n Secret access key converted into an SES SMTP password by applying [AWS's documented Sigv4 conversion algorithm](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/smtp-credentials.html#smt... | Secret access key converted into an SES SMTP password by applying [AWS's documented Sigv4 conversion algorithm](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/smtp-credentials.html#smtp-credentials-convert). This attribute is not available for imported resources. As SigV4 is region specific, valid Provider regio... | sdk/python/pulumi_aws/iam/access_key.py | ses_smtp_password_v4 | rapzo/pulumi-aws | 260 | python | @property
@pulumi.getter(name='sesSmtpPasswordV4')
def ses_smtp_password_v4(self) -> Optional[pulumi.Input[str]]:
"\n \n "
return pulumi.get(self, 'ses_smtp_password_v4') | @property
@pulumi.getter(name='sesSmtpPasswordV4')
def ses_smtp_password_v4(self) -> Optional[pulumi.Input[str]]:
"\n \n "
return pulumi.get(self, 'ses_smtp_password_v4')<|docstring|>Secret access key converted into an SES SMTP password by applying [AWS's documented Sigv4 conversion algorithm](htt... |
4d9325eb6593746375c0418566825284d0e7655b5ca752a464ec5f116cf125b7 | @property
@pulumi.getter
def status(self) -> Optional[pulumi.Input[str]]:
'\n Access key status to apply. Defaults to `Active`. Valid values are `Active` and `Inactive`.\n '
return pulumi.get(self, 'status') | Access key status to apply. Defaults to `Active`. Valid values are `Active` and `Inactive`. | sdk/python/pulumi_aws/iam/access_key.py | status | rapzo/pulumi-aws | 260 | python | @property
@pulumi.getter
def status(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'status') | @property
@pulumi.getter
def status(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'status')<|docstring|>Access key status to apply. Defaults to `Active`. Valid values are `Active` and `Inactive`.<|endoftext|> |
4051bdf2d60a4dd51e6b8ea7a96a7a61712ba423a72baf54bb2fb69974b39906 | @property
@pulumi.getter
def user(self) -> Optional[pulumi.Input[str]]:
'\n IAM user to associate with this access key.\n '
return pulumi.get(self, 'user') | IAM user to associate with this access key. | sdk/python/pulumi_aws/iam/access_key.py | user | rapzo/pulumi-aws | 260 | python | @property
@pulumi.getter
def user(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'user') | @property
@pulumi.getter
def user(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'user')<|docstring|>IAM user to associate with this access key.<|endoftext|> |
599c4c49a417808e800b6583e63bc95fad7b34cff6d7c466f2f2e8ab96bbaded | @overload
def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions]=None, pgp_key: Optional[pulumi.Input[str]]=None, status: Optional[pulumi.Input[str]]=None, user: Optional[pulumi.Input[str]]=None, __props__=None):
'\n Provides an IAM access key. This is a set of credentials that all... | Provides an IAM access key. This is a set of credentials that allow API requests to be made as an IAM user.
## Example Usage
```python
import pulumi
import pulumi_aws as aws
lb_user = aws.iam.User("lbUser", path="/system/")
lb_access_key = aws.iam.AccessKey("lbAccessKey",
user=lb_user.name,
pgp_key="keybase:... | sdk/python/pulumi_aws/iam/access_key.py | __init__ | rapzo/pulumi-aws | 260 | python | @overload
def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions]=None, pgp_key: Optional[pulumi.Input[str]]=None, status: Optional[pulumi.Input[str]]=None, user: Optional[pulumi.Input[str]]=None, __props__=None):
'\n Provides an IAM access key. This is a set of credentials that all... | @overload
def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions]=None, pgp_key: Optional[pulumi.Input[str]]=None, status: Optional[pulumi.Input[str]]=None, user: Optional[pulumi.Input[str]]=None, __props__=None):
'\n Provides an IAM access key. This is a set of credentials that all... |
6f1b807c5e82ef648073b52af526baba5033cc5c65d5e0444aaf63def148a7ef | @overload
def __init__(__self__, resource_name: str, args: AccessKeyArgs, opts: Optional[pulumi.ResourceOptions]=None):
'\n Provides an IAM access key. This is a set of credentials that allow API requests to be made as an IAM user.\n\n ## Example Usage\n\n ```python\n import pulumi\n ... | Provides an IAM access key. This is a set of credentials that allow API requests to be made as an IAM user.
## Example Usage
```python
import pulumi
import pulumi_aws as aws
lb_user = aws.iam.User("lbUser", path="/system/")
lb_access_key = aws.iam.AccessKey("lbAccessKey",
user=lb_user.name,
pgp_key="keybase:... | sdk/python/pulumi_aws/iam/access_key.py | __init__ | rapzo/pulumi-aws | 260 | python | @overload
def __init__(__self__, resource_name: str, args: AccessKeyArgs, opts: Optional[pulumi.ResourceOptions]=None):
'\n Provides an IAM access key. This is a set of credentials that allow API requests to be made as an IAM user.\n\n ## Example Usage\n\n ```python\n import pulumi\n ... | @overload
def __init__(__self__, resource_name: str, args: AccessKeyArgs, opts: Optional[pulumi.ResourceOptions]=None):
'\n Provides an IAM access key. This is a set of credentials that allow API requests to be made as an IAM user.\n\n ## Example Usage\n\n ```python\n import pulumi\n ... |
6f577ef2f4daa1aa9157fce7f9d2433b6a87120a32fb459fb945f658cd801c43 | @staticmethod
def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions]=None, create_date: Optional[pulumi.Input[str]]=None, encrypted_secret: Optional[pulumi.Input[str]]=None, encrypted_ses_smtp_password_v4: Optional[pulumi.Input[str]]=None, key_fingerprint: Optional[pulumi.Input[str]]=... | Get an existing AccessKey resource's state with the given name, id, and optional extra
properties used to qualify the lookup.
:param str resource_name: The unique name of the resulting resource.
:param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
:param pulumi.ResourceOptions opts: Options f... | sdk/python/pulumi_aws/iam/access_key.py | get | rapzo/pulumi-aws | 260 | python | @staticmethod
def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions]=None, create_date: Optional[pulumi.Input[str]]=None, encrypted_secret: Optional[pulumi.Input[str]]=None, encrypted_ses_smtp_password_v4: Optional[pulumi.Input[str]]=None, key_fingerprint: Optional[pulumi.Input[str]]=... | @staticmethod
def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions]=None, create_date: Optional[pulumi.Input[str]]=None, encrypted_secret: Optional[pulumi.Input[str]]=None, encrypted_ses_smtp_password_v4: Optional[pulumi.Input[str]]=None, key_fingerprint: Optional[pulumi.Input[str]]=... |
ab00855a75d29ba1eb12e2d6761b97c2be94130fe5f6a565ae28e1ddb518bb8f | @property
@pulumi.getter(name='createDate')
def create_date(self) -> pulumi.Output[str]:
'\n Date and time in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) that the access key was created.\n '
return pulumi.get(self, 'create_date') | Date and time in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) that the access key was created. | sdk/python/pulumi_aws/iam/access_key.py | create_date | rapzo/pulumi-aws | 260 | python | @property
@pulumi.getter(name='createDate')
def create_date(self) -> pulumi.Output[str]:
'\n \n '
return pulumi.get(self, 'create_date') | @property
@pulumi.getter(name='createDate')
def create_date(self) -> pulumi.Output[str]:
'\n \n '
return pulumi.get(self, 'create_date')<|docstring|>Date and time in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) that the access key was created.<|endoftext|> |
a132383e957e9f76c61c23f0c7a549acf351c99a12e5279cb171442ec5bafc26 | @property
@pulumi.getter(name='keyFingerprint')
def key_fingerprint(self) -> pulumi.Output[str]:
'\n Fingerprint of the PGP key used to encrypt the secret. This attribute is not available for imported resources.\n '
return pulumi.get(self, 'key_fingerprint') | Fingerprint of the PGP key used to encrypt the secret. This attribute is not available for imported resources. | sdk/python/pulumi_aws/iam/access_key.py | key_fingerprint | rapzo/pulumi-aws | 260 | python | @property
@pulumi.getter(name='keyFingerprint')
def key_fingerprint(self) -> pulumi.Output[str]:
'\n \n '
return pulumi.get(self, 'key_fingerprint') | @property
@pulumi.getter(name='keyFingerprint')
def key_fingerprint(self) -> pulumi.Output[str]:
'\n \n '
return pulumi.get(self, 'key_fingerprint')<|docstring|>Fingerprint of the PGP key used to encrypt the secret. This attribute is not available for imported resources.<|endoftext|> |
551c1d6b7b09f5223cbfd99bf6063ebd533f6129d3797af010de4c25712e5dc9 | @property
@pulumi.getter(name='pgpKey')
def pgp_key(self) -> pulumi.Output[Optional[str]]:
'\n Either a base-64 encoded PGP public key, or a keybase username in the form `keybase:some_person_that_exists`, for use in the `encrypted_secret` output attribute.\n '
return pulumi.get(self, 'pgp_key') | Either a base-64 encoded PGP public key, or a keybase username in the form `keybase:some_person_that_exists`, for use in the `encrypted_secret` output attribute. | sdk/python/pulumi_aws/iam/access_key.py | pgp_key | rapzo/pulumi-aws | 260 | python | @property
@pulumi.getter(name='pgpKey')
def pgp_key(self) -> pulumi.Output[Optional[str]]:
'\n \n '
return pulumi.get(self, 'pgp_key') | @property
@pulumi.getter(name='pgpKey')
def pgp_key(self) -> pulumi.Output[Optional[str]]:
'\n \n '
return pulumi.get(self, 'pgp_key')<|docstring|>Either a base-64 encoded PGP public key, or a keybase username in the form `keybase:some_person_that_exists`, for use in the `encrypted_secret` output ... |
72404a36c252320dcf33da2e2a4d9a14abaaf77b3c79ed7adeb92bda04099d86 | @property
@pulumi.getter
def secret(self) -> pulumi.Output[str]:
'\n Secret access key. This attribute is not available for imported resources. Note that this will be written to the state file. If you use this, please protect your backend state file judiciously. Alternatively, you may supply a `pgp_key` inst... | Secret access key. This attribute is not available for imported resources. Note that this will be written to the state file. If you use this, please protect your backend state file judiciously. Alternatively, you may supply a `pgp_key` instead, which will prevent the secret from being stored in plaintext, at the cost o... | sdk/python/pulumi_aws/iam/access_key.py | secret | rapzo/pulumi-aws | 260 | python | @property
@pulumi.getter
def secret(self) -> pulumi.Output[str]:
'\n \n '
return pulumi.get(self, 'secret') | @property
@pulumi.getter
def secret(self) -> pulumi.Output[str]:
'\n \n '
return pulumi.get(self, 'secret')<|docstring|>Secret access key. This attribute is not available for imported resources. Note that this will be written to the state file. If you use this, please protect your backend state fi... |
0ef88a09edb9afad919004a75df3ca42d55f3ec53ed66572acb6db30128e5444 | @property
@pulumi.getter(name='sesSmtpPasswordV4')
def ses_smtp_password_v4(self) -> pulumi.Output[str]:
"\n Secret access key converted into an SES SMTP password by applying [AWS's documented Sigv4 conversion algorithm](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/smtp-credentials.html#smtp-credent... | Secret access key converted into an SES SMTP password by applying [AWS's documented Sigv4 conversion algorithm](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/smtp-credentials.html#smtp-credentials-convert). This attribute is not available for imported resources. As SigV4 is region specific, valid Provider regio... | sdk/python/pulumi_aws/iam/access_key.py | ses_smtp_password_v4 | rapzo/pulumi-aws | 260 | python | @property
@pulumi.getter(name='sesSmtpPasswordV4')
def ses_smtp_password_v4(self) -> pulumi.Output[str]:
"\n \n "
return pulumi.get(self, 'ses_smtp_password_v4') | @property
@pulumi.getter(name='sesSmtpPasswordV4')
def ses_smtp_password_v4(self) -> pulumi.Output[str]:
"\n \n "
return pulumi.get(self, 'ses_smtp_password_v4')<|docstring|>Secret access key converted into an SES SMTP password by applying [AWS's documented Sigv4 conversion algorithm](https://docs... |
9e7595233a0743b855e3a7edddd0c11d99f50fd8ca65ac17dd988822389f8c5a | @property
@pulumi.getter
def status(self) -> pulumi.Output[Optional[str]]:
'\n Access key status to apply. Defaults to `Active`. Valid values are `Active` and `Inactive`.\n '
return pulumi.get(self, 'status') | Access key status to apply. Defaults to `Active`. Valid values are `Active` and `Inactive`. | sdk/python/pulumi_aws/iam/access_key.py | status | rapzo/pulumi-aws | 260 | python | @property
@pulumi.getter
def status(self) -> pulumi.Output[Optional[str]]:
'\n \n '
return pulumi.get(self, 'status') | @property
@pulumi.getter
def status(self) -> pulumi.Output[Optional[str]]:
'\n \n '
return pulumi.get(self, 'status')<|docstring|>Access key status to apply. Defaults to `Active`. Valid values are `Active` and `Inactive`.<|endoftext|> |
62d5beed3a144a03de669c2f1a0d22b06a8247b8bc506513a9b0ba5eb4945b7e | @property
@pulumi.getter
def user(self) -> pulumi.Output[str]:
'\n IAM user to associate with this access key.\n '
return pulumi.get(self, 'user') | IAM user to associate with this access key. | sdk/python/pulumi_aws/iam/access_key.py | user | rapzo/pulumi-aws | 260 | python | @property
@pulumi.getter
def user(self) -> pulumi.Output[str]:
'\n \n '
return pulumi.get(self, 'user') | @property
@pulumi.getter
def user(self) -> pulumi.Output[str]:
'\n \n '
return pulumi.get(self, 'user')<|docstring|>IAM user to associate with this access key.<|endoftext|> |
cd8f6c3f56797d4a2db4af70226b6430ad4bf408ba79ad47d062d0943520b688 | def generate_random_string(chars=ALPHANUMERIC_CHARS, length=STRING_LENGTH):
'\n Generate a random string starting from a set of chars and of fixed length.\n '
return ''.join((random.choice(chars) for _ in range(length))) | Generate a random string starting from a set of chars and of fixed length. | QuestionTime/core/utils.py | generate_random_string | pogginicolo98/QuestionTime | 0 | python | def generate_random_string(chars=ALPHANUMERIC_CHARS, length=STRING_LENGTH):
'\n \n '
return .join((random.choice(chars) for _ in range(length))) | def generate_random_string(chars=ALPHANUMERIC_CHARS, length=STRING_LENGTH):
'\n \n '
return .join((random.choice(chars) for _ in range(length)))<|docstring|>Generate a random string starting from a set of chars and of fixed length.<|endoftext|> |
07501808af04b6144bd1053b6cad72592bfb2581c5be56418125c48f8700c731 | def __init__(self, context, *args, **kwargs):
'Initialize the browser.'
self.browser = context.browser | Initialize the browser. | tests/pages/base.py | __init__ | 20tab/django-bdd-toolkit | 9 | python | def __init__(self, context, *args, **kwargs):
self.browser = context.browser | def __init__(self, context, *args, **kwargs):
self.browser = context.browser<|docstring|>Initialize the browser.<|endoftext|> |
f7bbc19f7a9f39a68048f9ea2810e5e1d368a6e3067b6bc6e15dccb937bd1fc7 | def fit(self, X, y, check_input=True):
'Build a decision tree based on samples X and\n corresponding classifications y.\n\n Parameters\n ----------\n X : array-like or sparse matrix of shape = [n_samples, n_features]\n The training input samples.\n y : array-like, shape... | Build a decision tree based on samples X and
corresponding classifications y.
Parameters
----------
X : array-like or sparse matrix of shape = [n_samples, n_features]
The training input samples.
y : array-like, shape = [n_samples] or [n_samples, n_outputs]
The target values (class labels in classification, rea... | id3/id3.py | fit | salilmishra23/decision-tree-id3 | 31 | python | def fit(self, X, y, check_input=True):
'Build a decision tree based on samples X and\n corresponding classifications y.\n\n Parameters\n ----------\n X : array-like or sparse matrix of shape = [n_samples, n_features]\n The training input samples.\n y : array-like, shape... | def fit(self, X, y, check_input=True):
'Build a decision tree based on samples X and\n corresponding classifications y.\n\n Parameters\n ----------\n X : array-like or sparse matrix of shape = [n_samples, n_features]\n The training input samples.\n y : array-like, shape... |
5318198842e4a4d3b400cfc49d2ca64c0e65781b27a437dec9e8717b0471352b | def predict(self, X):
'Predict class for every sample in X.\n\n Parameters\n ----------\n X : array-like of shape = [n_samples, n_features_idx]\n The input samples.\n\n Returns\n -------\n y : array of shape = [n_samples]\n '
check_is_fitted(self, 'tre... | Predict class for every sample in X.
Parameters
----------
X : array-like of shape = [n_samples, n_features_idx]
The input samples.
Returns
-------
y : array of shape = [n_samples] | id3/id3.py | predict | salilmishra23/decision-tree-id3 | 31 | python | def predict(self, X):
'Predict class for every sample in X.\n\n Parameters\n ----------\n X : array-like of shape = [n_samples, n_features_idx]\n The input samples.\n\n Returns\n -------\n y : array of shape = [n_samples]\n '
check_is_fitted(self, 'tre... | def predict(self, X):
'Predict class for every sample in X.\n\n Parameters\n ----------\n X : array-like of shape = [n_samples, n_features_idx]\n The input samples.\n\n Returns\n -------\n y : array of shape = [n_samples]\n '
check_is_fitted(self, 'tre... |
4465afbb08471e24e734ec7f4bfc15c2c2b9f95831264781dcc2f723a5a02480 | def predict_proba(self, X):
'Predict class probabilities for every sample in X.\n\n Parameters\n ----------\n X : array-like of shape = [n_samples, n_features_idx]\n The input samples.\n\n Returns\n -------\n y : array of shape = [n_samples, n_classes]\n ... | Predict class probabilities for every sample in X.
Parameters
----------
X : array-like of shape = [n_samples, n_features_idx]
The input samples.
Returns
-------
y : array of shape = [n_samples, n_classes] | id3/id3.py | predict_proba | salilmishra23/decision-tree-id3 | 31 | python | def predict_proba(self, X):
'Predict class probabilities for every sample in X.\n\n Parameters\n ----------\n X : array-like of shape = [n_samples, n_features_idx]\n The input samples.\n\n Returns\n -------\n y : array of shape = [n_samples, n_classes]\n ... | def predict_proba(self, X):
'Predict class probabilities for every sample in X.\n\n Parameters\n ----------\n X : array-like of shape = [n_samples, n_features_idx]\n The input samples.\n\n Returns\n -------\n y : array of shape = [n_samples, n_classes]\n ... |
673e13bf086e8c15d101f0ea57aeef9a119134970190bbdb6db6d34d112d1b56 | @classmethod
def of(cls, value):
'Given either a dictionary or a `ConfigSource` object, return\n a `ConfigSource` object. This lets a function accept either type\n of object as an argument.\n '
if isinstance(value, ConfigSource):
return value
elif isinstance(value, dict):
... | Given either a dictionary or a `ConfigSource` object, return
a `ConfigSource` object. This lets a function accept either type
of object as an argument. | confuse/sources.py | of | ntqr/confuse | 0 | python | @classmethod
def of(cls, value):
'Given either a dictionary or a `ConfigSource` object, return\n a `ConfigSource` object. This lets a function accept either type\n of object as an argument.\n '
if isinstance(value, ConfigSource):
return value
elif isinstance(value, dict):
... | @classmethod
def of(cls, value):
'Given either a dictionary or a `ConfigSource` object, return\n a `ConfigSource` object. This lets a function accept either type\n of object as an argument.\n '
if isinstance(value, ConfigSource):
return value
elif isinstance(value, dict):
... |
34753c81f5f36d3f45d0ad616352bdbef3c1d1e5461357175a164280206d855a | def get_sources(country, category):
'\n Function that gets json response to our url request\n '
get_news_url = base_url.format(country, category, api_key)
with urllib.request.urlopen(get_news_url) as url:
get_news_data = url.read()
get_news_response = json.loads(get_news_data.decode('u... | Function that gets json response to our url request | app/request.py | get_sources | JaredAhaza/News-highlights | 0 | python | def get_sources(country, category):
'\n \n '
get_news_url = base_url.format(country, category, api_key)
with urllib.request.urlopen(get_news_url) as url:
get_news_data = url.read()
get_news_response = json.loads(get_news_data.decode('utf'))
source_results = None
if get_... | def get_sources(country, category):
'\n \n '
get_news_url = base_url.format(country, category, api_key)
with urllib.request.urlopen(get_news_url) as url:
get_news_data = url.read()
get_news_response = json.loads(get_news_data.decode('utf'))
source_results = None
if get_... |
f06150b6630e95e7089b6f3bfacd4d86ff00225bec84ca624429649872997a3b | def process_sources(source_list):
'\n Function processing the dictionary and outputs a list of objects\n '
news_results = []
for source in source_list:
id = source.get('id')
name = source.get('name')
description = source.get('description')
url = source.get('url')
... | Function processing the dictionary and outputs a list of objects | app/request.py | process_sources | JaredAhaza/News-highlights | 0 | python | def process_sources(source_list):
'\n \n '
news_results = []
for source in source_list:
id = source.get('id')
name = source.get('name')
description = source.get('description')
url = source.get('url')
category = source.get('category')
country = source.get... | def process_sources(source_list):
'\n \n '
news_results = []
for source in source_list:
id = source.get('id')
name = source.get('name')
description = source.get('description')
url = source.get('url')
category = source.get('category')
country = source.get... |
b876e36637dc0d87bf08cd2fcbaf52a63db48b4ea15d8fe81ed4db51f3140539 | def get_articles(id):
'\n Function that gets json response to our url request\n '
get_source_news_url = source_url.format(id, api_key)
with urllib.request.urlopen(get_source_news_url) as url:
get_news_data = url.read()
get_news_response = json.loads(get_news_data.decode('utf'))
... | Function that gets json response to our url request | app/request.py | get_articles | JaredAhaza/News-highlights | 0 | python | def get_articles(id):
'\n \n '
get_source_news_url = source_url.format(id, api_key)
with urllib.request.urlopen(get_source_news_url) as url:
get_news_data = url.read()
get_news_response = json.loads(get_news_data.decode('utf'))
news_results = None
if get_news_response['... | def get_articles(id):
'\n \n '
get_source_news_url = source_url.format(id, api_key)
with urllib.request.urlopen(get_source_news_url) as url:
get_news_data = url.read()
get_news_response = json.loads(get_news_data.decode('utf'))
news_results = None
if get_news_response['... |
ecd74b7f46aa9ab020e5a400ec5e9299c9734b98b6f008e15794bd75e84c4529 | def process_articles(articles_list):
'\n Function processing the dictionary and outputs a list of objects\n '
news_results = []
source_dictionary = {}
for result in articles_list:
source_id = result['source']
source_dictionary['id'] = source_id['id']
source_dictionary['name... | Function processing the dictionary and outputs a list of objects | app/request.py | process_articles | JaredAhaza/News-highlights | 0 | python | def process_articles(articles_list):
'\n \n '
news_results = []
source_dictionary = {}
for result in articles_list:
source_id = result['source']
source_dictionary['id'] = source_id['id']
source_dictionary['name'] = source_id['name']
id = source_dictionary['id']
... | def process_articles(articles_list):
'\n \n '
news_results = []
source_dictionary = {}
for result in articles_list:
source_id = result['source']
source_dictionary['id'] = source_id['id']
source_dictionary['name'] = source_id['name']
id = source_dictionary['id']
... |
db2fe6ed6d962b1775d878cefab3f0bc449e360ae7b1d93f0ef8d104a2ac03f2 | def check_action_command(ctx, action_command):
'Verifies the action command is valid'
if (action_command not in ['deploy_site', 'update_site', 'redeploy_server']):
ctx.fail('Invalid action command. The action commands available are deploy_site, update_site, and redeploy_server.') | Verifies the action command is valid | src/bin/shipyard_client/shipyard_client/cli/input_checks.py | check_action_command | att-comdev/shipyard | 14 | python | def check_action_command(ctx, action_command):
if (action_command not in ['deploy_site', 'update_site', 'redeploy_server']):
ctx.fail('Invalid action command. The action commands available are deploy_site, update_site, and redeploy_server.') | def check_action_command(ctx, action_command):
if (action_command not in ['deploy_site', 'update_site', 'redeploy_server']):
ctx.fail('Invalid action command. The action commands available are deploy_site, update_site, and redeploy_server.')<|docstring|>Verifies the action command is valid<|endoftext|... |
de58eec3c70f334fb27d8730bf8b0fabc70aa1153ea4d64d60c35ee9e9861996 | def check_control_action(ctx, action):
'Verifies the control action is valid'
if (action not in ['pause', 'unpause', 'stop']):
ctx.fail('Invalid action. Please enter pause, unpause, or stop.') | Verifies the control action is valid | src/bin/shipyard_client/shipyard_client/cli/input_checks.py | check_control_action | att-comdev/shipyard | 14 | python | def check_control_action(ctx, action):
if (action not in ['pause', 'unpause', 'stop']):
ctx.fail('Invalid action. Please enter pause, unpause, or stop.') | def check_control_action(ctx, action):
if (action not in ['pause', 'unpause', 'stop']):
ctx.fail('Invalid action. Please enter pause, unpause, or stop.')<|docstring|>Verifies the control action is valid<|endoftext|> |
293dfc00b336afd54b6a8c476bfd249fc31e37f8bb3af4cca8755fd22ac2a161 | def check_id(ctx, action_id):
'Verifies a ULID id is in a valid format'
if (action_id is None):
ctx.fail('Invalid ID. None is not a valid action ID.')
if (len(action_id) != 26):
ctx.fail('Invalid ID. ID can only be 26 characters.')
if (not action_id.isalnum()):
ctx.fail('Invalid ... | Verifies a ULID id is in a valid format | src/bin/shipyard_client/shipyard_client/cli/input_checks.py | check_id | att-comdev/shipyard | 14 | python | def check_id(ctx, action_id):
if (action_id is None):
ctx.fail('Invalid ID. None is not a valid action ID.')
if (len(action_id) != 26):
ctx.fail('Invalid ID. ID can only be 26 characters.')
if (not action_id.isalnum()):
ctx.fail('Invalid ID. ID can only contain letters and numbe... | def check_id(ctx, action_id):
if (action_id is None):
ctx.fail('Invalid ID. None is not a valid action ID.')
if (len(action_id) != 26):
ctx.fail('Invalid ID. ID can only be 26 characters.')
if (not action_id.isalnum()):
ctx.fail('Invalid ID. ID can only contain letters and numbe... |
6b69a5065c7e3650bcd3499a70510a7bf620ea03fc963c2476531ca4b9293dc3 | def check_workflow_id(ctx, workflow_id):
'Verifies that a workflow id matches the desired format'
if (workflow_id is None):
ctx.fail('Invalid ID. None is not a valid workflow ID.')
if ('__' not in workflow_id):
ctx.fail('Invalid ID. The ID must cotain a double underscore separating the workf... | Verifies that a workflow id matches the desired format | src/bin/shipyard_client/shipyard_client/cli/input_checks.py | check_workflow_id | att-comdev/shipyard | 14 | python | def check_workflow_id(ctx, workflow_id):
if (workflow_id is None):
ctx.fail('Invalid ID. None is not a valid workflow ID.')
if ('__' not in workflow_id):
ctx.fail('Invalid ID. The ID must cotain a double underscore separating the workflow name from the execution date')
input_date_string... | def check_workflow_id(ctx, workflow_id):
if (workflow_id is None):
ctx.fail('Invalid ID. None is not a valid workflow ID.')
if ('__' not in workflow_id):
ctx.fail('Invalid ID. The ID must cotain a double underscore separating the workflow name from the execution date')
input_date_string... |
1709f741dba403816e30fc39eca36244a1c2ffade2d1c886d87635601cd57c6a | def check_reformat_parameter(ctx, param):
'Checks for <name>=<value> format'
param_dictionary = {}
try:
for p in param:
values = p.split('=')
param_dictionary[values[0]] = values[1]
except Exception:
ctx.fail((('Invalid parameter or parameter format for ' + p) + '... | Checks for <name>=<value> format | src/bin/shipyard_client/shipyard_client/cli/input_checks.py | check_reformat_parameter | att-comdev/shipyard | 14 | python | def check_reformat_parameter(ctx, param):
param_dictionary = {}
try:
for p in param:
values = p.split('=')
param_dictionary[values[0]] = values[1]
except Exception:
ctx.fail((('Invalid parameter or parameter format for ' + p) + '. Please utilize the format: <par... | def check_reformat_parameter(ctx, param):
param_dictionary = {}
try:
for p in param:
values = p.split('=')
param_dictionary[values[0]] = values[1]
except Exception:
ctx.fail((('Invalid parameter or parameter format for ' + p) + '. Please utilize the format: <par... |
866573b41305abcc5dd2fa3c590415ec20fc3b1765248879e4e217b6691dd08b | def check_reformat_versions(ctx, buffer, committed, last_site_action, successful_site_action):
'Checks and reformat version'
versions = []
if buffer:
versions.append('buffer')
if committed:
versions.append('committed')
if last_site_action:
versions.append('last_site_action')
... | Checks and reformat version | src/bin/shipyard_client/shipyard_client/cli/input_checks.py | check_reformat_versions | att-comdev/shipyard | 14 | python | def check_reformat_versions(ctx, buffer, committed, last_site_action, successful_site_action):
versions = []
if buffer:
versions.append('buffer')
if committed:
versions.append('committed')
if last_site_action:
versions.append('last_site_action')
if successful_site_action... | def check_reformat_versions(ctx, buffer, committed, last_site_action, successful_site_action):
versions = []
if buffer:
versions.append('buffer')
if committed:
versions.append('committed')
if last_site_action:
versions.append('last_site_action')
if successful_site_action... |
c93526d4b891629de98aae9158a4d0ef39c90586ca400daf84d9b9eff12ccdf6 | def test_do_not_lock_resources_when_not_ready(self):
" Test to make sure that resources won't go unused waiting on workers "
self.sch.add_task(worker='X', task_id='A', priority=10)
self.sch.add_task(worker='X', task_id='B', resources={'R': 1}, priority=5)
self.sch.add_task(worker='Y', task_id='C', resou... | Test to make sure that resources won't go unused waiting on workers | test/central_planner_test.py | test_do_not_lock_resources_when_not_ready | GlobalFishingWatch/luigi | 2 | python | def test_do_not_lock_resources_when_not_ready(self):
" "
self.sch.add_task(worker='X', task_id='A', priority=10)
self.sch.add_task(worker='X', task_id='B', resources={'R': 1}, priority=5)
self.sch.add_task(worker='Y', task_id='C', resources={'R': 1}, priority=1)
self.sch.update_resources(R=1)
s... | def test_do_not_lock_resources_when_not_ready(self):
" "
self.sch.add_task(worker='X', task_id='A', priority=10)
self.sch.add_task(worker='X', task_id='B', resources={'R': 1}, priority=5)
self.sch.add_task(worker='Y', task_id='C', resources={'R': 1}, priority=1)
self.sch.update_resources(R=1)
s... |
db0d4371f1e4c67752fa0f42dfccfd21eeaad3537c9621be14256befe7f2d4cf | def test_do_not_lock_resources_while_running_higher_priority(self):
" Test to make sure that resources won't go unused waiting on workers "
self.sch.add_task(worker='X', task_id='A', priority=10)
self.sch.add_task(worker='X', task_id='B', resources={'R': 1}, priority=5)
self.sch.add_task(worker='Y', tas... | Test to make sure that resources won't go unused waiting on workers | test/central_planner_test.py | test_do_not_lock_resources_while_running_higher_priority | GlobalFishingWatch/luigi | 2 | python | def test_do_not_lock_resources_while_running_higher_priority(self):
" "
self.sch.add_task(worker='X', task_id='A', priority=10)
self.sch.add_task(worker='X', task_id='B', resources={'R': 1}, priority=5)
self.sch.add_task(worker='Y', task_id='C', resources={'R': 1}, priority=1)
self.sch.update_resou... | def test_do_not_lock_resources_while_running_higher_priority(self):
" "
self.sch.add_task(worker='X', task_id='A', priority=10)
self.sch.add_task(worker='X', task_id='B', resources={'R': 1}, priority=5)
self.sch.add_task(worker='Y', task_id='C', resources={'R': 1}, priority=1)
self.sch.update_resou... |
844e2d5889556b575e5f08e9c0d33e46c8416128860f310f078b1cfce85cb7c9 | def test_lock_resources_while_running_lower_priority(self):
' Make sure resources will be made available while working on lower priority tasks '
self.sch.add_task(worker='X', task_id='A', priority=4)
self.assertEqual('A', self.sch.get_work(worker='X')['task_id'])
self.sch.add_task(worker='X', task_id='B... | Make sure resources will be made available while working on lower priority tasks | test/central_planner_test.py | test_lock_resources_while_running_lower_priority | GlobalFishingWatch/luigi | 2 | python | def test_lock_resources_while_running_lower_priority(self):
' '
self.sch.add_task(worker='X', task_id='A', priority=4)
self.assertEqual('A', self.sch.get_work(worker='X')['task_id'])
self.sch.add_task(worker='X', task_id='B', resources={'R': 1}, priority=5)
self.sch.add_task(worker='Y', task_id='C'... | def test_lock_resources_while_running_lower_priority(self):
' '
self.sch.add_task(worker='X', task_id='A', priority=4)
self.assertEqual('A', self.sch.get_work(worker='X')['task_id'])
self.sch.add_task(worker='X', task_id='B', resources={'R': 1}, priority=5)
self.sch.add_task(worker='Y', task_id='C'... |
cd57054048f346ed7e5520b587cf1035f257174912a191f19515e4588e76f73b | def test_quadratic_behavior(self):
' Test that get_work is not taking linear amount of time.\n\n This is of course impossible to test, however, doing reasonable\n assumptions about hardware. This time should finish in a timely\n manner.\n '
NUM_TASKS = 10000
for i in range(NUM_TA... | Test that get_work is not taking linear amount of time.
This is of course impossible to test, however, doing reasonable
assumptions about hardware. This time should finish in a timely
manner. | test/central_planner_test.py | test_quadratic_behavior | GlobalFishingWatch/luigi | 2 | python | def test_quadratic_behavior(self):
' Test that get_work is not taking linear amount of time.\n\n This is of course impossible to test, however, doing reasonable\n assumptions about hardware. This time should finish in a timely\n manner.\n '
NUM_TASKS = 10000
for i in range(NUM_TA... | def test_quadratic_behavior(self):
' Test that get_work is not taking linear amount of time.\n\n This is of course impossible to test, however, doing reasonable\n assumptions about hardware. This time should finish in a timely\n manner.\n '
NUM_TASKS = 10000
for i in range(NUM_TA... |
9da6291fcd7ed2467a6c0384c2469677120d0c95f68e3ab9d285e13810bb7983 | def test_get_work_speed(self):
' Test that get_work is fast for few workers and many DONEs.\n\n In #986, @daveFNbuck reported that he got a slowdown.\n '
NUM_PENDING = 1000
NUM_DONE = 200000
assert (NUM_DONE >= NUM_PENDING)
for i in range(NUM_PENDING):
self.sch.add_task(worker=... | Test that get_work is fast for few workers and many DONEs.
In #986, @daveFNbuck reported that he got a slowdown. | test/central_planner_test.py | test_get_work_speed | GlobalFishingWatch/luigi | 2 | python | def test_get_work_speed(self):
' Test that get_work is fast for few workers and many DONEs.\n\n In #986, @daveFNbuck reported that he got a slowdown.\n '
NUM_PENDING = 1000
NUM_DONE = 200000
assert (NUM_DONE >= NUM_PENDING)
for i in range(NUM_PENDING):
self.sch.add_task(worker=... | def test_get_work_speed(self):
' Test that get_work is fast for few workers and many DONEs.\n\n In #986, @daveFNbuck reported that he got a slowdown.\n '
NUM_PENDING = 1000
NUM_DONE = 200000
assert (NUM_DONE >= NUM_PENDING)
for i in range(NUM_PENDING):
self.sch.add_task(worker=... |
f393f52ab0cab68e769d1534bd68dd2d711722cca41e45bd8750a67d80ac2cfb | @pytest.mark.django_db
@patch('polaris.management.commands.check_trustlines.create_stellar_deposit')
@patch('polaris.management.commands.check_trustlines.settings.HORIZON_SERVER', mock_server)
def test_deposit_check_trustlines_success(acc1_usd_deposit_transaction_factory):
'\n Creates a transaction with status `... | Creates a transaction with status `pending_trust` and checks that
`check_trustlines` changes its status to `completed`. All the necessary
functionality and conditions are mocked for determinism. | polaris/polaris/tests/processes/test_check_trustlines.py | test_deposit_check_trustlines_success | brunopedrazza/django-polaris | 0 | python | @pytest.mark.django_db
@patch('polaris.management.commands.check_trustlines.create_stellar_deposit')
@patch('polaris.management.commands.check_trustlines.settings.HORIZON_SERVER', mock_server)
def test_deposit_check_trustlines_success(acc1_usd_deposit_transaction_factory):
'\n Creates a transaction with status `... | @pytest.mark.django_db
@patch('polaris.management.commands.check_trustlines.create_stellar_deposit')
@patch('polaris.management.commands.check_trustlines.settings.HORIZON_SERVER', mock_server)
def test_deposit_check_trustlines_success(acc1_usd_deposit_transaction_factory):
'\n Creates a transaction with status `... |
64f84d0e54c40a0df54b2f6095efdcafd3b7c46c24196e5d7a43ee49a2965398 | def checkPositive(func):
' Chequea que los parametros sean numeros positivos '
def wrapper(x):
if (x < 0):
raise ValueError('Value must be positive')
return func(x)
return wrapper | Chequea que los parametros sean numeros positivos | src/decorators.py | checkPositive | CaC-Grupo-9/backend | 1 | python | def checkPositive(func):
' '
def wrapper(x):
if (x < 0):
raise ValueError('Value must be positive')
return func(x)
return wrapper | def checkPositive(func):
' '
def wrapper(x):
if (x < 0):
raise ValueError('Value must be positive')
return func(x)
return wrapper<|docstring|>Chequea que los parametros sean numeros positivos<|endoftext|> |
f3d111b8a81ef2c29f92bd28313e2832b586d05b8d58512e755e7d95692befca | def myDecorator(func):
' Decorador que imprime el nombre de la funcion '
def wrapper(*args, **kwargs):
print(func.__name__)
return func(*args, **kwargs)
return wrapper | Decorador que imprime el nombre de la funcion | src/decorators.py | myDecorator | CaC-Grupo-9/backend | 1 | python | def myDecorator(func):
' '
def wrapper(*args, **kwargs):
print(func.__name__)
return func(*args, **kwargs)
return wrapper | def myDecorator(func):
' '
def wrapper(*args, **kwargs):
print(func.__name__)
return func(*args, **kwargs)
return wrapper<|docstring|>Decorador que imprime el nombre de la funcion<|endoftext|> |
678f4a34445a4f794a970a2b45cb584a5f1c504079e3da4171c1ba634d25d4ab | def square_distance(src, dst):
'\n Calculate Euclid distance between each two points.\n src^T * dst = xn * xm + yn * ym + zn * zm;\n sum(src^2, dim=-1) = xn*xn + yn*yn + zn*zn;\n sum(dst^2, dim=-1) = xm*xm + ym*ym + zm*zm;\n dist = (xn - xm)^2 + (yn - ym)^2 + (zn - zm)^2\n = sum(src**2,dim=-1... | Calculate Euclid distance between each two points.
src^T * dst = xn * xm + yn * ym + zn * zm;
sum(src^2, dim=-1) = xn*xn + yn*yn + zn*zn;
sum(dst^2, dim=-1) = xm*xm + ym*ym + zm*zm;
dist = (xn - xm)^2 + (yn - ym)^2 + (zn - zm)^2
= sum(src**2,dim=-1)+sum(dst**2,dim=-1)-2*src^T*dst
Input:
src: source points, [B,... | models_dev/pct_utils.py | square_distance | A-suozhang/SpatioTemporalSegmentation-ScanNet | 1 | python | def square_distance(src, dst):
'\n Calculate Euclid distance between each two points.\n src^T * dst = xn * xm + yn * ym + zn * zm;\n sum(src^2, dim=-1) = xn*xn + yn*yn + zn*zn;\n sum(dst^2, dim=-1) = xm*xm + ym*ym + zm*zm;\n dist = (xn - xm)^2 + (yn - ym)^2 + (zn - zm)^2\n = sum(src**2,dim=-1... | def square_distance(src, dst):
'\n Calculate Euclid distance between each two points.\n src^T * dst = xn * xm + yn * ym + zn * zm;\n sum(src^2, dim=-1) = xn*xn + yn*yn + zn*zn;\n sum(dst^2, dim=-1) = xm*xm + ym*ym + zm*zm;\n dist = (xn - xm)^2 + (yn - ym)^2 + (zn - zm)^2\n = sum(src**2,dim=-1... |
920ac832349211d7cea6b279fa1fc58afadad79eefb6edcb3725dcbdc8ec708e | def index_points_cuda(points, idx):
'\n\n Input:\n points: input points data, [B, N, C]\n idx: sample index data, [B, S]\n Return:\n new_points:, indexed points data, [B, S, C]\n '
points = points.transpose(1, 2).contiguous()
new_points = index_points_cuda_transpose(points, idx... | Input:
points: input points data, [B, N, C]
idx: sample index data, [B, S]
Return:
new_points:, indexed points data, [B, S, C] | models_dev/pct_utils.py | index_points_cuda | A-suozhang/SpatioTemporalSegmentation-ScanNet | 1 | python | def index_points_cuda(points, idx):
'\n\n Input:\n points: input points data, [B, N, C]\n idx: sample index data, [B, S]\n Return:\n new_points:, indexed points data, [B, S, C]\n '
points = points.transpose(1, 2).contiguous()
new_points = index_points_cuda_transpose(points, idx... | def index_points_cuda(points, idx):
'\n\n Input:\n points: input points data, [B, N, C]\n idx: sample index data, [B, S]\n Return:\n new_points:, indexed points data, [B, S, C]\n '
points = points.transpose(1, 2).contiguous()
new_points = index_points_cuda_transpose(points, idx... |
f092ce066e048c328c2efdb996a24b62313f475f57da3e3bbb1c1ad742ff677b | def sample_and_group_cuda(npoint, k, xyz, points, cat_xyz_feature=True):
'\n Input:\n npoint:\n k:\n xyz: input points position data, [B, N, 3]\n points: input points data, [B, C, N]\n Return:\n new_xyz: sampled points position data, [B, 3, npoint]\n new_points: sampl... | Input:
npoint:
k:
xyz: input points position data, [B, N, 3]
points: input points data, [B, C, N]
Return:
new_xyz: sampled points position data, [B, 3, npoint]
new_points: sampled points data, [B, C+C_xyz, npoint, k]
grouped_xyz_norm: sampled relative points position data, [B, 3, npoint, k] | models_dev/pct_utils.py | sample_and_group_cuda | A-suozhang/SpatioTemporalSegmentation-ScanNet | 1 | python | def sample_and_group_cuda(npoint, k, xyz, points, cat_xyz_feature=True):
'\n Input:\n npoint:\n k:\n xyz: input points position data, [B, N, 3]\n points: input points data, [B, C, N]\n Return:\n new_xyz: sampled points position data, [B, 3, npoint]\n new_points: sampl... | def sample_and_group_cuda(npoint, k, xyz, points, cat_xyz_feature=True):
'\n Input:\n npoint:\n k:\n xyz: input points position data, [B, N, 3]\n points: input points data, [B, C, N]\n Return:\n new_xyz: sampled points position data, [B, 3, npoint]\n new_points: sampl... |
d3dcf2d85a59dfc4631d313f54b4c1a277290426b620d566bf16789e0b381dab | def forward(self, xyz, points):
"\n Input:\n xyz: input points position data, [B, 3, N]\n points: input points data, [B, C, N]\n Return:\n gew_xyz: sampled points position data, [B, C, S]\n new_points_concat: sample points feature data, [B, D', S]\n "... | Input:
xyz: input points position data, [B, 3, N]
points: input points data, [B, C, N]
Return:
gew_xyz: sampled points position data, [B, C, S]
new_points_concat: sample points feature data, [B, D', S] | models_dev/pct_utils.py | forward | A-suozhang/SpatioTemporalSegmentation-ScanNet | 1 | python | def forward(self, xyz, points):
"\n Input:\n xyz: input points position data, [B, 3, N]\n points: input points data, [B, C, N]\n Return:\n gew_xyz: sampled points position data, [B, C, S]\n new_points_concat: sample points feature data, [B, D', S]\n "... | def forward(self, xyz, points):
"\n Input:\n xyz: input points position data, [B, 3, N]\n points: input points data, [B, C, N]\n Return:\n gew_xyz: sampled points position data, [B, C, S]\n new_points_concat: sample points feature data, [B, D', S]\n "... |
a2477b5e2efad2a55c0a99fca64bc88924f268521d9997369fc2e2137764488e | def forward(self, xyz_1, xyz_2, points_1, points_2):
"\n Input:\n M < N\n xyz_1: input points position data, [B, 3, M]\n xyz_2: input points position data, [B, 3, N]\n points_1: input points data, [B, C, M]\n points_2: input points data, [B, C, N]\n\n ... | Input:
M < N
xyz_1: input points position data, [B, 3, M]
xyz_2: input points position data, [B, 3, N]
points_1: input points data, [B, C, M]
points_2: input points data, [B, C, N]
interpolate xyz_2's coordinates feature with knn neighbor's features weighted by inverse distance
Return:
new... | models_dev/pct_utils.py | forward | A-suozhang/SpatioTemporalSegmentation-ScanNet | 1 | python | def forward(self, xyz_1, xyz_2, points_1, points_2):
"\n Input:\n M < N\n xyz_1: input points position data, [B, 3, M]\n xyz_2: input points position data, [B, 3, N]\n points_1: input points data, [B, C, M]\n points_2: input points data, [B, C, N]\n\n ... | def forward(self, xyz_1, xyz_2, points_1, points_2):
"\n Input:\n M < N\n xyz_1: input points position data, [B, 3, M]\n xyz_2: input points position data, [B, 3, N]\n points_1: input points data, [B, C, M]\n points_2: input points data, [B, C, N]\n\n ... |
be61df59bb2fd6bf1dc578bbf8d7748e162c71b9d6595575fc0eec91246df057 | def forward(self, input_p, input_x):
'\n input_p: B, 3, npoint\n input_x: B, in_dim, npoint\n '
(B, in_dim, npoint) = list(input_x.size())
n_sample = self.n_sample
k = min(n_sample, npoint)
if (not self.use_vector_attn):
h = self.nhead
input_p = input_p.permute([0, ... | input_p: B, 3, npoint
input_x: B, in_dim, npoint | models_dev/pct_utils.py | forward | A-suozhang/SpatioTemporalSegmentation-ScanNet | 1 | python | def forward(self, input_p, input_x):
'\n input_p: B, 3, npoint\n input_x: B, in_dim, npoint\n '
(B, in_dim, npoint) = list(input_x.size())
n_sample = self.n_sample
k = min(n_sample, npoint)
if (not self.use_vector_attn):
h = self.nhead
input_p = input_p.permute([0, ... | def forward(self, input_p, input_x):
'\n input_p: B, 3, npoint\n input_x: B, in_dim, npoint\n '
(B, in_dim, npoint) = list(input_x.size())
n_sample = self.n_sample
k = min(n_sample, npoint)
if (not self.use_vector_attn):
h = self.nhead
input_p = input_p.permute([0, ... |
f6093df8b5e98f14fc609651ec46b38bba6b7fe9fd7eac33e565335a5c801be0 | def update_resource_specs():
' Update Resource Specs '
for (region, url) in SPEC_REGIONS.items():
filename = pkg_resources.resource_filename(__name__, ('/data/CloudSpecs/%s.json' % region))
LOGGER.debug('Downloading template %s into %s', url, filename)
spec = json.loads(get_url_content(u... | Update Resource Specs | src/cfnlint/maintenance.py | update_resource_specs | kylelaker/cfn-python-lint | 1 | python | def update_resource_specs():
' '
for (region, url) in SPEC_REGIONS.items():
filename = pkg_resources.resource_filename(__name__, ('/data/CloudSpecs/%s.json' % region))
LOGGER.debug('Downloading template %s into %s', url, filename)
spec = json.loads(get_url_content(url))
spec = p... | def update_resource_specs():
' '
for (region, url) in SPEC_REGIONS.items():
filename = pkg_resources.resource_filename(__name__, ('/data/CloudSpecs/%s.json' % region))
LOGGER.debug('Downloading template %s into %s', url, filename)
spec = json.loads(get_url_content(url))
spec = p... |
31131f27f5a5a6d546dff3885f5da60fdd97ebcc1c266da7da2553aa17361066 | def update_documentation(rules):
'Generate documentation'
filename = 'docs/rules.md'
sorted_rules = sorted(rules, key=(lambda obj: obj.id))
data = []
with open(filename, 'r') as origial_file:
line = origial_file.readline()
while line:
data.append(line)
if (lin... | Generate documentation | src/cfnlint/maintenance.py | update_documentation | kylelaker/cfn-python-lint | 1 | python | def update_documentation(rules):
filename = 'docs/rules.md'
sorted_rules = sorted(rules, key=(lambda obj: obj.id))
data = []
with open(filename, 'r') as origial_file:
line = origial_file.readline()
while line:
data.append(line)
if (line == '## Rules\n'):
... | def update_documentation(rules):
filename = 'docs/rules.md'
sorted_rules = sorted(rules, key=(lambda obj: obj.id))
data = []
with open(filename, 'r') as origial_file:
line = origial_file.readline()
while line:
data.append(line)
if (line == '## Rules\n'):
... |
ab11f652479f1a71fe864b93ed7acb28fa6bce5fdd930ce9b8853b0e8c5c6d9d | def patch_spec(content, region):
'Patch the spec file'
LOGGER.info('Patching spec file for region "%s"', region)
append_dir = os.path.join(os.path.dirname(__file__), 'data', 'ExtendedSpecs', region)
for (dirpath, _, filenames) in os.walk(append_dir):
filenames.sort()
for filename in fnma... | Patch the spec file | src/cfnlint/maintenance.py | patch_spec | kylelaker/cfn-python-lint | 1 | python | def patch_spec(content, region):
LOGGER.info('Patching spec file for region "%s"', region)
append_dir = os.path.join(os.path.dirname(__file__), 'data', 'ExtendedSpecs', region)
for (dirpath, _, filenames) in os.walk(append_dir):
filenames.sort()
for filename in fnmatch.filter(filenames,... | def patch_spec(content, region):
LOGGER.info('Patching spec file for region "%s"', region)
append_dir = os.path.join(os.path.dirname(__file__), 'data', 'ExtendedSpecs', region)
for (dirpath, _, filenames) in os.walk(append_dir):
filenames.sort()
for filename in fnmatch.filter(filenames,... |
be1ad0d956bda70a531b4c9a2371bb84c7cf25db45ad53491deac7f53e56eaac | def update_iam_policies():
'update iam policies file'
url = 'https://awspolicygen.s3.amazonaws.com/js/policies.js'
filename = pkg_resources.resource_filename(__name__, '/data/AdditionalSpecs/Policies.json')
LOGGER.debug('Downloading policies %s into %s', url, filename)
content = get_url_content(url)... | update iam policies file | src/cfnlint/maintenance.py | update_iam_policies | kylelaker/cfn-python-lint | 1 | python | def update_iam_policies():
url = 'https://awspolicygen.s3.amazonaws.com/js/policies.js'
filename = pkg_resources.resource_filename(__name__, '/data/AdditionalSpecs/Policies.json')
LOGGER.debug('Downloading policies %s into %s', url, filename)
content = get_url_content(url)
content = content.spl... | def update_iam_policies():
url = 'https://awspolicygen.s3.amazonaws.com/js/policies.js'
filename = pkg_resources.resource_filename(__name__, '/data/AdditionalSpecs/Policies.json')
LOGGER.debug('Downloading policies %s into %s', url, filename)
content = get_url_content(url)
content = content.spl... |
c55678297c13943e93755eb5c0965fde9b0da93f8bb07d333802a03c5e85c702 | def launch_ec(self, argStr='', input='', flag=''):
'Dispatches command to ec (loaded as a module).\n '
command = 'python -m ec tests/targets/simple.py'
if flag:
command += (' %s' % flag)
if argStr:
command += (' %s' % argStr)
return shell_exec(command, input=input) | Dispatches command to ec (loaded as a module). | tests/test_module_launch.py | launch_ec | Laufire/ec | 2 | python | def launch_ec(self, argStr=, input=, flag=):
'\n '
command = 'python -m ec tests/targets/simple.py'
if flag:
command += (' %s' % flag)
if argStr:
command += (' %s' % argStr)
return shell_exec(command, input=input) | def launch_ec(self, argStr=, input=, flag=):
'\n '
command = 'python -m ec tests/targets/simple.py'
if flag:
command += (' %s' % flag)
if argStr:
command += (' %s' % argStr)
return shell_exec(command, input=input)<|docstring|>Dispatches command to ec (loaded as a module).<|endofte... |
1708a75b33f644cae84364e7f120b0ad2d3a0784b0e4b5498fbc87961adb8d3c | def adjust_learning_rate(optimizer, epoch, args):
'Sets the learning rate to the initial LR decayed by 10 every 30 epochs'
lr = (args.lr * (0.1 ** (epoch // 30)))
for param_group in optimizer.param_groups:
param_group['lr'] = lr | Sets the learning rate to the initial LR decayed by 10 every 30 epochs | src/legacy/experiment.py | adjust_learning_rate | spencerpomme/GSPNet | 0 | python | def adjust_learning_rate(optimizer, epoch, args):
lr = (args.lr * (0.1 ** (epoch // 30)))
for param_group in optimizer.param_groups:
param_group['lr'] = lr | def adjust_learning_rate(optimizer, epoch, args):
lr = (args.lr * (0.1 ** (epoch // 30)))
for param_group in optimizer.param_groups:
param_group['lr'] = lr<|docstring|>Sets the learning rate to the initial LR decayed by 10 every 30 epochs<|endoftext|> |
9ac58a8c4ae439d17a2757c8892bef929aedaf58ff23f1ab2a5e08670d55f6f2 | def accuracy(output, target, topk=(1,)):
'Computes the accuracy over the k top predictions for the specified values of k'
with torch.no_grad():
maxk = max(topk)
batch_size = target.size(0)
(_, pred) = output.topk(maxk, 1, True, True)
pred = pred.t()
correct = pred.eq(targ... | Computes the accuracy over the k top predictions for the specified values of k | src/legacy/experiment.py | accuracy | spencerpomme/GSPNet | 0 | python | def accuracy(output, target, topk=(1,)):
with torch.no_grad():
maxk = max(topk)
batch_size = target.size(0)
(_, pred) = output.topk(maxk, 1, True, True)
pred = pred.t()
correct = pred.eq(target.view(1, (- 1)).expand_as(pred))
res = []
for k in topk:
... | def accuracy(output, target, topk=(1,)):
with torch.no_grad():
maxk = max(topk)
batch_size = target.size(0)
(_, pred) = output.topk(maxk, 1, True, True)
pred = pred.t()
correct = pred.eq(target.view(1, (- 1)).expand_as(pred))
res = []
for k in topk:
... |
71ad4f0b87dc21dad6857779ebf3c2e24046f629824b93447a5988cf6c009215 | def main(args):
'Entry point.\n \n :param args: Parsed CLI arguments.\n\n '
network_id = factory.create_network_id(args.network)
network = cache.infra.get_network(network_id)
if (network is None):
raise ValueError('Unregistered network.')
if (network.faucet is None):
raise V... | Entry point.
:param args: Parsed CLI arguments. | sh/scripts/chain_set_contracts.py | main | dwerner/stests | 4 | python | def main(args):
'Entry point.\n \n :param args: Parsed CLI arguments.\n\n '
network_id = factory.create_network_id(args.network)
network = cache.infra.get_network(network_id)
if (network is None):
raise ValueError('Unregistered network.')
if (network.faucet is None):
raise V... | def main(args):
'Entry point.\n \n :param args: Parsed CLI arguments.\n\n '
network_id = factory.create_network_id(args.network)
network = cache.infra.get_network(network_id)
if (network is None):
raise ValueError('Unregistered network.')
if (network.faucet is None):
raise V... |
bb233fe04a7a4d3ab45281e0456c617b7291b32e5d555a2dc51bf630e1af5d6d | def _install_contract(network: Network, account: Account, contract: typing.Callable):
'Installs a smart contract upon target network.\n \n '
utils.log(f'{contract.WASM} :: installation starts ... please wait')
(node, deploy_hash, _, _) = contract.install(network, account)
utils.log(f'{contract.WAS... | Installs a smart contract upon target network. | sh/scripts/chain_set_contracts.py | _install_contract | dwerner/stests | 4 | python | def _install_contract(network: Network, account: Account, contract: typing.Callable):
'\n \n '
utils.log(f'{contract.WASM} :: installation starts ... please wait')
(node, deploy_hash, _, _) = contract.install(network, account)
utils.log(f'{contract.WASM} :: deploy dispatched >- {deploy_hash}')
... | def _install_contract(network: Network, account: Account, contract: typing.Callable):
'\n \n '
utils.log(f'{contract.WASM} :: installation starts ... please wait')
(node, deploy_hash, _, _) = contract.install(network, account)
utils.log(f'{contract.WASM} :: deploy dispatched >- {deploy_hash}')
... |
12b59bf7d9e91a40668f7211c50f08075ff986b7796706ecea143141a3a67c99 | def pay_for_fa_course(self, course_id, status=Order.FULFILLED):
'\n Helper function to pay for a financial aid course\n '
order = OrderFactory.create(user=self.user, status=status)
return LineFactory.create(order=order, course_key=course_id) | Helper function to pay for a financial aid course | dashboard/utils_test.py | pay_for_fa_course | mitodl/micromasters | 32 | python | def pay_for_fa_course(self, course_id, status=Order.FULFILLED):
'\n \n '
order = OrderFactory.create(user=self.user, status=status)
return LineFactory.create(order=order, course_key=course_id) | def pay_for_fa_course(self, course_id, status=Order.FULFILLED):
'\n \n '
order = OrderFactory.create(user=self.user, status=status)
return LineFactory.create(order=order, course_key=course_id)<|docstring|>Helper function to pay for a financial aid course<|endoftext|> |
43cee51af1771bc2942a7b3200af301723d868d0c4cd8f2304947686e0d3f05e | def test_init_normal_track(self):
'\n Test of the init of the class for programs without financial aid\n '
mmtrack = MMTrack(user=self.user, program=self.program, edx_user_data=self.cached_edx_user_data)
assert (mmtrack.user == self.user)
assert (mmtrack.program == self.program)
assert... | Test of the init of the class for programs without financial aid | dashboard/utils_test.py | test_init_normal_track | mitodl/micromasters | 32 | python | def test_init_normal_track(self):
'\n \n '
mmtrack = MMTrack(user=self.user, program=self.program, edx_user_data=self.cached_edx_user_data)
assert (mmtrack.user == self.user)
assert (mmtrack.program == self.program)
assert (mmtrack.enrollments == self.cached_edx_user_data.enrollments)
... | def test_init_normal_track(self):
'\n \n '
mmtrack = MMTrack(user=self.user, program=self.program, edx_user_data=self.cached_edx_user_data)
assert (mmtrack.user == self.user)
assert (mmtrack.program == self.program)
assert (mmtrack.enrollments == self.cached_edx_user_data.enrollments)
... |
95fc4f9d2bd1432ab6c4c985cfb24abea9895131d376fa115ac82d10adc10c35 | def test_init_financial_aid_track(self):
'\n Test of the init of the class for programs with financial aid\n '
mmtrack = MMTrack(user=self.user, program=self.program_financial_aid, edx_user_data=self.cached_edx_user_data)
assert (mmtrack.user == self.user)
assert (mmtrack.program == self.p... | Test of the init of the class for programs with financial aid | dashboard/utils_test.py | test_init_financial_aid_track | mitodl/micromasters | 32 | python | def test_init_financial_aid_track(self):
'\n \n '
mmtrack = MMTrack(user=self.user, program=self.program_financial_aid, edx_user_data=self.cached_edx_user_data)
assert (mmtrack.user == self.user)
assert (mmtrack.program == self.program_financial_aid)
assert (mmtrack.enrollments == self... | def test_init_financial_aid_track(self):
'\n \n '
mmtrack = MMTrack(user=self.user, program=self.program_financial_aid, edx_user_data=self.cached_edx_user_data)
assert (mmtrack.user == self.user)
assert (mmtrack.program == self.program_financial_aid)
assert (mmtrack.enrollments == self... |
bfbf386aea09a3d98742b78ffd58b9f6df568af2b53eb59e28975fddb5eddbb8 | @ddt.data(Order.FULFILLED, Order.PARTIALLY_REFUNDED)
def test_fa_paid(self, order_status):
'\n Test that for financial aid, mmtrack.paid_course_ids only apply to the user with a matching Order\n '
key = 'course-v1:odl+FOO101+CR-FALL15'
self.pay_for_fa_course(key, status=order_status)
mmtra... | Test that for financial aid, mmtrack.paid_course_ids only apply to the user with a matching Order | dashboard/utils_test.py | test_fa_paid | mitodl/micromasters | 32 | python | @ddt.data(Order.FULFILLED, Order.PARTIALLY_REFUNDED)
def test_fa_paid(self, order_status):
'\n \n '
key = 'course-v1:odl+FOO101+CR-FALL15'
self.pay_for_fa_course(key, status=order_status)
mmtrack_paid = MMTrack(user=self.user, program=self.program_financial_aid, edx_user_data=self.cached_e... | @ddt.data(Order.FULFILLED, Order.PARTIALLY_REFUNDED)
def test_fa_paid(self, order_status):
'\n \n '
key = 'course-v1:odl+FOO101+CR-FALL15'
self.pay_for_fa_course(key, status=order_status)
mmtrack_paid = MMTrack(user=self.user, program=self.program_financial_aid, edx_user_data=self.cached_e... |
62a068db347ffaef22228baefc2490d367ede05fa5e28dd563c3adc95d269d91 | def test_is_course_in_program(self):
'\n Test the _is_course_in_program method\n '
mmtrack = MMTrack(user=self.user, program=self.program, edx_user_data=self.cached_edx_user_data)
for course_id in ['course-v1:edX+DemoX+Demo_Course', 'course-v1:MITx+8.MechCX+2014_T1']:
assert (mmtrack._... | Test the _is_course_in_program method | dashboard/utils_test.py | test_is_course_in_program | mitodl/micromasters | 32 | python | def test_is_course_in_program(self):
'\n \n '
mmtrack = MMTrack(user=self.user, program=self.program, edx_user_data=self.cached_edx_user_data)
for course_id in ['course-v1:edX+DemoX+Demo_Course', 'course-v1:MITx+8.MechCX+2014_T1']:
assert (mmtrack._is_course_in_program(course_id) is Tr... | def test_is_course_in_program(self):
'\n \n '
mmtrack = MMTrack(user=self.user, program=self.program, edx_user_data=self.cached_edx_user_data)
for course_id in ['course-v1:edX+DemoX+Demo_Course', 'course-v1:MITx+8.MechCX+2014_T1']:
assert (mmtrack._is_course_in_program(course_id) is Tr... |
042c807dc92caa2f461c5cd269a38b728aa7ada9b4e0304d280bb6d617e53d8f | def test_is_enrolled(self):
'\n Tests for is_enrolled method\n '
mmtrack = MMTrack(user=self.user, program=self.program, edx_user_data=self.cached_edx_user_data)
for course_id in ['course-v1:edX+DemoX+Demo_Course', 'course-v1:MITx+8.MechCX+2014_T1']:
assert (mmtrack.is_enrolled(course_... | Tests for is_enrolled method | dashboard/utils_test.py | test_is_enrolled | mitodl/micromasters | 32 | python | def test_is_enrolled(self):
'\n \n '
mmtrack = MMTrack(user=self.user, program=self.program, edx_user_data=self.cached_edx_user_data)
for course_id in ['course-v1:edX+DemoX+Demo_Course', 'course-v1:MITx+8.MechCX+2014_T1']:
assert (mmtrack.is_enrolled(course_id) is True)
with pa... | def test_is_enrolled(self):
'\n \n '
mmtrack = MMTrack(user=self.user, program=self.program, edx_user_data=self.cached_edx_user_data)
for course_id in ['course-v1:edX+DemoX+Demo_Course', 'course-v1:MITx+8.MechCX+2014_T1']:
assert (mmtrack.is_enrolled(course_id) is True)
with pa... |
ebad5c43254d3f711574ed7ded63491f767dd190c73a3d04070ce9ef1d20c67d | def test_is_enrolled_mmtrack_normal(self):
'\n Tests for the is_enrolled_mmtrack method in case financial aid is not available\n '
mmtrack = MMTrack(user=self.user, program=self.program, edx_user_data=self.cached_edx_user_data)
assert (mmtrack.is_enrolled_mmtrack('course-v1:edX+DemoX+Demo_Cour... | Tests for the is_enrolled_mmtrack method in case financial aid is not available | dashboard/utils_test.py | test_is_enrolled_mmtrack_normal | mitodl/micromasters | 32 | python | def test_is_enrolled_mmtrack_normal(self):
'\n \n '
mmtrack = MMTrack(user=self.user, program=self.program, edx_user_data=self.cached_edx_user_data)
assert (mmtrack.is_enrolled_mmtrack('course-v1:edX+DemoX+Demo_Course') is True)
assert (mmtrack.is_enrolled_mmtrack('course-v1:MITx+8.MechCX+... | def test_is_enrolled_mmtrack_normal(self):
'\n \n '
mmtrack = MMTrack(user=self.user, program=self.program, edx_user_data=self.cached_edx_user_data)
assert (mmtrack.is_enrolled_mmtrack('course-v1:edX+DemoX+Demo_Course') is True)
assert (mmtrack.is_enrolled_mmtrack('course-v1:MITx+8.MechCX+... |
c8d66811996c320b3d582c2c00e2662d1225fd0f017f96a3a1a8cb52ab84e21a | def test_is_enrolled_mmtrack_fa(self):
'\n Tests for the is_enrolled_mmtrack method in case financial aid is available\n '
course_id = 'course-v1:odl+FOO101+CR-FALL15'
mmtrack = MMTrack(user=self.user, program=self.program_financial_aid, edx_user_data=self.cached_edx_user_data)
assert (mmt... | Tests for the is_enrolled_mmtrack method in case financial aid is available | dashboard/utils_test.py | test_is_enrolled_mmtrack_fa | mitodl/micromasters | 32 | python | def test_is_enrolled_mmtrack_fa(self):
'\n \n '
course_id = 'course-v1:odl+FOO101+CR-FALL15'
mmtrack = MMTrack(user=self.user, program=self.program_financial_aid, edx_user_data=self.cached_edx_user_data)
assert (mmtrack.is_enrolled_mmtrack(course_id) is False)
self.pay_for_fa_course(co... | def test_is_enrolled_mmtrack_fa(self):
'\n \n '
course_id = 'course-v1:odl+FOO101+CR-FALL15'
mmtrack = MMTrack(user=self.user, program=self.program_financial_aid, edx_user_data=self.cached_edx_user_data)
assert (mmtrack.is_enrolled_mmtrack(course_id) is False)
self.pay_for_fa_course(co... |
5c041bc3ddba42e951c3f4e7948792f7d9819a1d0d3d55e5a426e1d6f92bf2c4 | @ddt.data(True, False)
def test_has_passed_course(self, final_grade_passed):
'\n Test that has_passed_course returns True when a passed FinalGrade exists\n '
final_grade = FinalGradeFactory.create(user=self.user, course_run=self.cruns[0], passed=final_grade_passed)
mmtrack = MMTrack(user=self.... | Test that has_passed_course returns True when a passed FinalGrade exists | dashboard/utils_test.py | test_has_passed_course | mitodl/micromasters | 32 | python | @ddt.data(True, False)
def test_has_passed_course(self, final_grade_passed):
'\n \n '
final_grade = FinalGradeFactory.create(user=self.user, course_run=self.cruns[0], passed=final_grade_passed)
mmtrack = MMTrack(user=self.user, program=self.program, edx_user_data=self.cached_edx_user_data)
... | @ddt.data(True, False)
def test_has_passed_course(self, final_grade_passed):
'\n \n '
final_grade = FinalGradeFactory.create(user=self.user, course_run=self.cruns[0], passed=final_grade_passed)
mmtrack = MMTrack(user=self.user, program=self.program, edx_user_data=self.cached_edx_user_data)
... |
41bce83233c438886611b8481b00503658a49e615b714a5ed5ba028e2099ec92 | def test_has_passed_course_no_grade(self):
'\n Test that has_passed_course returns False when no FinalGrade exists\n '
mmtrack = MMTrack(user=self.user, program=self.program, edx_user_data=self.cached_edx_user_data)
assert (mmtrack.has_passed_course('random-course-id') is False) | Test that has_passed_course returns False when no FinalGrade exists | dashboard/utils_test.py | test_has_passed_course_no_grade | mitodl/micromasters | 32 | python | def test_has_passed_course_no_grade(self):
'\n \n '
mmtrack = MMTrack(user=self.user, program=self.program, edx_user_data=self.cached_edx_user_data)
assert (mmtrack.has_passed_course('random-course-id') is False) | def test_has_passed_course_no_grade(self):
'\n \n '
mmtrack = MMTrack(user=self.user, program=self.program, edx_user_data=self.cached_edx_user_data)
assert (mmtrack.has_passed_course('random-course-id') is False)<|docstring|>Test that has_passed_course returns False when no FinalGrade exists<|... |
486060798b24a52e41592e8da56bf18a92a58dad124b18f2b4eeb536daaeeded | def test_get_final_grade_percent(self):
'\n Test that get_final_grade_percent returns a final grade in percent form\n '
final_grade = FinalGradeFactory.create(user=self.user, course_run=self.cruns[0], grade=0.57)
mmtrack = MMTrack(user=self.user, program=self.program, edx_user_data=self.cached... | Test that get_final_grade_percent returns a final grade in percent form | dashboard/utils_test.py | test_get_final_grade_percent | mitodl/micromasters | 32 | python | def test_get_final_grade_percent(self):
'\n \n '
final_grade = FinalGradeFactory.create(user=self.user, course_run=self.cruns[0], grade=0.57)
mmtrack = MMTrack(user=self.user, program=self.program, edx_user_data=self.cached_edx_user_data)
assert (round(mmtrack.get_final_grade_percent(final... | def test_get_final_grade_percent(self):
'\n \n '
final_grade = FinalGradeFactory.create(user=self.user, course_run=self.cruns[0], grade=0.57)
mmtrack = MMTrack(user=self.user, program=self.program, edx_user_data=self.cached_edx_user_data)
assert (round(mmtrack.get_final_grade_percent(final... |
a91e5578dea60dcc213228a66bb57f83468675e60df75e2f261181c09e069aa7 | def test_get_final_grade_percent_none(self):
'\n Test that get_final_grade_percent returns a None when there is no final grade\n '
mmtrack = MMTrack(user=self.user, program=self.program, edx_user_data=self.cached_edx_user_data)
assert (mmtrack.get_final_grade_percent('random-course-id') is Non... | Test that get_final_grade_percent returns a None when there is no final grade | dashboard/utils_test.py | test_get_final_grade_percent_none | mitodl/micromasters | 32 | python | def test_get_final_grade_percent_none(self):
'\n \n '
mmtrack = MMTrack(user=self.user, program=self.program, edx_user_data=self.cached_edx_user_data)
assert (mmtrack.get_final_grade_percent('random-course-id') is None) | def test_get_final_grade_percent_none(self):
'\n \n '
mmtrack = MMTrack(user=self.user, program=self.program, edx_user_data=self.cached_edx_user_data)
assert (mmtrack.get_final_grade_percent('random-course-id') is None)<|docstring|>Test that get_final_grade_percent returns a None when there is... |
9b37bcef114f33f2fa8301ba7014ee1f462e561342179f1300809f7fbe3c1170 | def test_has_final_grade(self):
'\n Test that has_final_grade returns True when a FinalGrade exists\n '
final_grade = FinalGradeFactory.create(user=self.user, course_run=self.cruns[0])
mmtrack = MMTrack(user=self.user, program=self.program, edx_user_data=self.cached_edx_user_data)
assert (... | Test that has_final_grade returns True when a FinalGrade exists | dashboard/utils_test.py | test_has_final_grade | mitodl/micromasters | 32 | python | def test_has_final_grade(self):
'\n \n '
final_grade = FinalGradeFactory.create(user=self.user, course_run=self.cruns[0])
mmtrack = MMTrack(user=self.user, program=self.program, edx_user_data=self.cached_edx_user_data)
assert (mmtrack.has_final_grade(final_grade.course_run.edx_course_key) ... | def test_has_final_grade(self):
'\n \n '
final_grade = FinalGradeFactory.create(user=self.user, course_run=self.cruns[0])
mmtrack = MMTrack(user=self.user, program=self.program, edx_user_data=self.cached_edx_user_data)
assert (mmtrack.has_final_grade(final_grade.course_run.edx_course_key) ... |
2350b7c3df962500c43d224683bb05e28cdc3adf227a623d6d8280e1623cbe9b | @ddt.data(True, False)
def test_has_paid_final_grade(self, has_paid):
'\n Test that has_paid_final_grade returns True when the associated FinalGrade is paid\n '
final_grade = FinalGradeFactory.create(user=self.user, course_run=self.cruns[0], course_run_paid_on_edx=has_paid)
mmtrack = MMTrack(u... | Test that has_paid_final_grade returns True when the associated FinalGrade is paid | dashboard/utils_test.py | test_has_paid_final_grade | mitodl/micromasters | 32 | python | @ddt.data(True, False)
def test_has_paid_final_grade(self, has_paid):
'\n \n '
final_grade = FinalGradeFactory.create(user=self.user, course_run=self.cruns[0], course_run_paid_on_edx=has_paid)
mmtrack = MMTrack(user=self.user, program=self.program, edx_user_data=self.cached_edx_user_data)
... | @ddt.data(True, False)
def test_has_paid_final_grade(self, has_paid):
'\n \n '
final_grade = FinalGradeFactory.create(user=self.user, course_run=self.cruns[0], course_run_paid_on_edx=has_paid)
mmtrack = MMTrack(user=self.user, program=self.program, edx_user_data=self.cached_edx_user_data)
... |
b45b56bd90295e7e3027d272be2b73a2e96ed4eb9abf44b89d7aa0ed1fd9f211 | def test_has_paid_final_grade_none(self):
"\n Test that has_paid_final_grade returns False when a FinalGrade doesn't exist\n "
mmtrack = MMTrack(user=self.user, program=self.program, edx_user_data=self.cached_edx_user_data)
assert (mmtrack.has_paid_final_grade('random-course-id') is False) | Test that has_paid_final_grade returns False when a FinalGrade doesn't exist | dashboard/utils_test.py | test_has_paid_final_grade_none | mitodl/micromasters | 32 | python | def test_has_paid_final_grade_none(self):
"\n \n "
mmtrack = MMTrack(user=self.user, program=self.program, edx_user_data=self.cached_edx_user_data)
assert (mmtrack.has_paid_final_grade('random-course-id') is False) | def test_has_paid_final_grade_none(self):
"\n \n "
mmtrack = MMTrack(user=self.user, program=self.program, edx_user_data=self.cached_edx_user_data)
assert (mmtrack.has_paid_final_grade('random-course-id') is False)<|docstring|>Test that has_paid_final_grade returns False when a FinalGrade does... |
cee7cda375f822042b18678c4fbb4f19c19466e9293a6c7b6e2386aeb1c1608b | def test_get_final_grade(self):
"\n Test that get_final_grade returns the FinalGrade associated with a user's course run\n "
final_grade = FinalGradeFactory.create(user=self.user, course_run=self.cruns[0])
mmtrack = MMTrack(user=self.user, program=self.program, edx_user_data=self.cached_edx_us... | Test that get_final_grade returns the FinalGrade associated with a user's course run | dashboard/utils_test.py | test_get_final_grade | mitodl/micromasters | 32 | python | def test_get_final_grade(self):
"\n \n "
final_grade = FinalGradeFactory.create(user=self.user, course_run=self.cruns[0])
mmtrack = MMTrack(user=self.user, program=self.program, edx_user_data=self.cached_edx_user_data)
assert (mmtrack.get_final_grade(final_grade.course_run.edx_course_key) ... | def test_get_final_grade(self):
"\n \n "
final_grade = FinalGradeFactory.create(user=self.user, course_run=self.cruns[0])
mmtrack = MMTrack(user=self.user, program=self.program, edx_user_data=self.cached_edx_user_data)
assert (mmtrack.get_final_grade(final_grade.course_run.edx_course_key) ... |
04a3d3948c765a3af68ce816d1aaaeee753d5b41f5bacf2c6ace6880f1675c4a | def test_get_final_grade_none(self):
'\n Test for get_final_grade returns None if there is no associated FinalGrade\n '
mmtrack = MMTrack(user=self.user, program=self.program, edx_user_data=self.cached_edx_user_data)
assert (mmtrack.get_final_grade('random-course-id') is None) | Test for get_final_grade returns None if there is no associated FinalGrade | dashboard/utils_test.py | test_get_final_grade_none | mitodl/micromasters | 32 | python | def test_get_final_grade_none(self):
'\n \n '
mmtrack = MMTrack(user=self.user, program=self.program, edx_user_data=self.cached_edx_user_data)
assert (mmtrack.get_final_grade('random-course-id') is None) | def test_get_final_grade_none(self):
'\n \n '
mmtrack = MMTrack(user=self.user, program=self.program, edx_user_data=self.cached_edx_user_data)
assert (mmtrack.get_final_grade('random-course-id') is None)<|docstring|>Test for get_final_grade returns None if there is no associated FinalGrade<|en... |
78c17723230caaf60e50e3e7848a6836524db866827af15ebcd1739cf539010e | def test_get_required_final_grade(self):
"\n Test that get_required_final_grade returns the FinalGrade associated with a user's course run\n "
final_grade = FinalGradeFactory.create(user=self.user, course_run=self.cruns[0])
mmtrack = MMTrack(user=self.user, program=self.program, edx_user_data=... | Test that get_required_final_grade returns the FinalGrade associated with a user's course run | dashboard/utils_test.py | test_get_required_final_grade | mitodl/micromasters | 32 | python | def test_get_required_final_grade(self):
"\n \n "
final_grade = FinalGradeFactory.create(user=self.user, course_run=self.cruns[0])
mmtrack = MMTrack(user=self.user, program=self.program, edx_user_data=self.cached_edx_user_data)
assert (mmtrack.get_required_final_grade(final_grade.course_ru... | def test_get_required_final_grade(self):
"\n \n "
final_grade = FinalGradeFactory.create(user=self.user, course_run=self.cruns[0])
mmtrack = MMTrack(user=self.user, program=self.program, edx_user_data=self.cached_edx_user_data)
assert (mmtrack.get_required_final_grade(final_grade.course_ru... |
8c678c1372d8e4e1284334b2a121f99300cd3e5aed558ad7595647400a9545f4 | def test_get_required_final_grade_raises(self):
'\n Test for get_required_final_grade raises an exception if there is no associated FinalGrade\n '
mmtrack = MMTrack(user=self.user, program=self.program, edx_user_data=self.cached_edx_user_data)
with self.assertRaises(FinalGrade.DoesNotExist):
... | Test for get_required_final_grade raises an exception if there is no associated FinalGrade | dashboard/utils_test.py | test_get_required_final_grade_raises | mitodl/micromasters | 32 | python | def test_get_required_final_grade_raises(self):
'\n \n '
mmtrack = MMTrack(user=self.user, program=self.program, edx_user_data=self.cached_edx_user_data)
with self.assertRaises(FinalGrade.DoesNotExist):
mmtrack.get_required_final_grade('random-course-id') | def test_get_required_final_grade_raises(self):
'\n \n '
mmtrack = MMTrack(user=self.user, program=self.program, edx_user_data=self.cached_edx_user_data)
with self.assertRaises(FinalGrade.DoesNotExist):
mmtrack.get_required_final_grade('random-course-id')<|docstring|>Test for get_requi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.