uid
stringlengths
24
24
split
stringclasses
1 value
category
stringclasses
2 values
content
stringlengths
5
482k
signature
stringlengths
1
14k
suffix
stringlengths
1
482k
prefix
stringlengths
9
14k
prefix_token_count
int64
3
5.01k
prefix_token_budget
int64
64
256
element_token_count
int64
1
292k
signature_token_count
int64
1
5.01k
prefix_context_token_count
int64
0
255
repo
stringlengths
7
112
path
stringlengths
4
208
language
stringclasses
1 value
name
stringlengths
1
218
qualname
stringlengths
1
218
start_line
int64
1
26.7k
end_line
int64
1
26.7k
signature_start_line
int64
1
26.7k
signature_end_line
int64
1
26.7k
source_hash
stringlengths
40
40
source_dataset
stringclasses
1 value
source_split
stringclasses
1 value
3a63b013584e3d0a6529ca98
train
class
class AWSValidationException(AWSError): TYPE = 'ValidationException'
class AWSValidationException(AWSError):
TYPE = 'ValidationException'
= None STATUS = 400 def __init__(self, message): self.message = message def response(self): resp = {'__type': self.TYPE, 'message': self.message} return json.dumps(resp), dict(status=self.STATUS) class AWSValidationException(AWSError):
64
64
15
8
56
edeustace/moto
moto/acm/models.py
Python
AWSValidationException
AWSValidationException
64
65
64
64
dd2b688a80de29417871b11d7d85faa31c04a0ef
bigcode/the-stack
train
7ed4e5ce7cbb4d5811fcb190
train
class
class AWSError(Exception): TYPE = None STATUS = 400 def __init__(self, message): self.message = message def response(self): resp = {'__type': self.TYPE, 'message': self.message} return json.dumps(resp), dict(status=self.STATUS)
class AWSError(Exception):
TYPE = None STATUS = 400 def __init__(self, message): self.message = message def response(self): resp = {'__type': self.TYPE, 'message': self.message} return json.dumps(resp), dict(status=self.STATUS)
root CA (provided or not) # so for now a cheap response is just give any old root CA def datetime_to_epoch(date): # As only Py3 has datetime.timestamp() return int((date - datetime.datetime(1970, 1, 1)).total_seconds()) class AWSError(Exception):
64
64
63
5
59
edeustace/moto
moto/acm/models.py
Python
AWSError
AWSError
52
61
52
52
cd17b641d82ba1e4ff5dc7911c39fabeef3fcb5b
bigcode/the-stack
train
1bc4bd401f32d1f874c5732c
train
class
class AWSResourceNotFoundException(AWSError): TYPE = 'ResourceNotFoundException'
class AWSResourceNotFoundException(AWSError):
TYPE = 'ResourceNotFoundException'
): self.message = message def response(self): resp = {'__type': self.TYPE, 'message': self.message} return json.dumps(resp), dict(status=self.STATUS) class AWSValidationException(AWSError): TYPE = 'ValidationException' class AWSResourceNotFoundException(AWSError):
64
64
19
10
54
edeustace/moto
moto/acm/models.py
Python
AWSResourceNotFoundException
AWSResourceNotFoundException
68
69
68
68
bb5c0399f96e5ad63b55a2e3c5abdcb0ec244476
bigcode/the-stack
train
7f13755c650b4afa5d199ed5
train
function
@stub def test_max_threads(sdc_builder, sdc_executor): pass
@stub def test_max_threads(sdc_builder, sdc_executor):
pass
stage_attributes): pass @stub def test_max_batch_size_in_messages(sdc_builder, sdc_executor): pass @stub def test_max_batch_wait_time_in_ms(sdc_builder, sdc_executor): pass @stub def test_max_threads(sdc_builder, sdc_executor):
64
64
18
15
48
Sentienz/datacollector-tests
stage/configuration/test_amazon_sqs_consumer_origin.py
Python
test_max_threads
test_max_threads
38
40
38
39
5df7055972e0e41f61a6a53e8cc8524a0af3e471
bigcode/the-stack
train
584602e61f6f0b44442332c7
train
function
@stub def test_number_of_messages_per_request(sdc_builder, sdc_executor): pass
@stub def test_number_of_messages_per_request(sdc_builder, sdc_executor):
pass
dc_executor): pass @stub def test_max_batch_wait_time_in_ms(sdc_builder, sdc_executor): pass @stub def test_max_threads(sdc_builder, sdc_executor): pass @stub def test_number_of_messages_per_request(sdc_builder, sdc_executor):
64
64
21
18
45
Sentienz/datacollector-tests
stage/configuration/test_amazon_sqs_consumer_origin.py
Python
test_number_of_messages_per_request
test_number_of_messages_per_request
43
45
43
44
052a9213cbadf3fb28610a2fc633b2c1e492595d
bigcode/the-stack
train
a555706b424797fca1cc5051
train
function
@stub def test_retry_count(sdc_builder, sdc_executor): pass
@stub def test_retry_count(sdc_builder, sdc_executor):
pass
'US_GOV_WEST_1'}, {'region': 'US_WEST_1'}, {'region': 'US_WEST_2'}]) def test_region(sdc_builder, sdc_executor, stage_attributes): pass @stub def test_retry_count(sdc_builder, sdc_executor):
64
64
18
15
48
Sentienz/datacollector-tests
stage/configuration/test_amazon_sqs_consumer_origin.py
Python
test_retry_count
test_retry_count
115
117
115
116
62344853586c602b15af80f8b216fe771696bb37
bigcode/the-stack
train
ec19b1c9f0423562e3a0215b
train
function
@stub def test_poll_wait_time_in_seconds(sdc_builder, sdc_executor): pass
@stub def test_poll_wait_time_in_seconds(sdc_builder, sdc_executor):
pass
': 'DISCARD'}, {'on_record_error': 'STOP_PIPELINE'}, {'on_record_error': 'TO_ERROR'}]) def test_on_record_error(sdc_builder, sdc_executor, stage_attributes): pass @stub def test_poll_wait_time_in_seconds(sdc_builder, sdc_exe...
64
64
21
18
45
Sentienz/datacollector-tests
stage/configuration/test_amazon_sqs_consumer_origin.py
Python
test_poll_wait_time_in_seconds
test_poll_wait_time_in_seconds
56
58
56
57
2e9de75541ab71dd9f933d52fdc72dac97625ba2
bigcode/the-stack
train
1b14f54ca07130acd5a5a0fb
train
function
@stub def test_connection_timeout(sdc_builder, sdc_executor): pass
@stub def test_connection_timeout(sdc_builder, sdc_executor):
pass
import pytest from streamsets.testframework.decorators import stub @stub def test_access_key_id(sdc_builder, sdc_executor): pass @stub def test_connection_timeout(sdc_builder, sdc_executor):
46
64
18
15
30
Sentienz/datacollector-tests
stage/configuration/test_amazon_sqs_consumer_origin.py
Python
test_connection_timeout
test_connection_timeout
11
13
11
12
463ba7e4c875d515dec9d7e51e1f6e7baf2574a5
bigcode/the-stack
train
ae362bab385a12102c8bfb18
train
function
@stub def test_max_batch_wait_time_in_ms(sdc_builder, sdc_executor): pass
@stub def test_max_batch_wait_time_in_ms(sdc_builder, sdc_executor):
pass
ALL'}]) def test_include_sqs_sender_attributes(sdc_builder, sdc_executor, stage_attributes): pass @stub def test_max_batch_size_in_messages(sdc_builder, sdc_executor): pass @stub def test_max_batch_wait_time_in_ms(sdc_builder, sdc_executor):
64
64
22
19
44
Sentienz/datacollector-tests
stage/configuration/test_amazon_sqs_consumer_origin.py
Python
test_max_batch_wait_time_in_ms
test_max_batch_wait_time_in_ms
33
35
33
34
b24711bdba94a3577b35bce207308c2c37d58f7e
bigcode/the-stack
train
cf62c72f2fcd8291a4c3443a
train
function
@stub @pytest.mark.parametrize('stage_attributes', [{'use_proxy': True}]) def test_proxy_host(sdc_builder, sdc_executor, stage_attributes): pass
@stub @pytest.mark.parametrize('stage_attributes', [{'use_proxy': True}]) def test_proxy_host(sdc_builder, sdc_executor, stage_attributes):
pass
, sdc_executor, stage_attributes): pass @stub def test_poll_wait_time_in_seconds(sdc_builder, sdc_executor): pass @stub @pytest.mark.parametrize('stage_attributes', [{'use_proxy': True}]) def test_proxy_host(sdc_builder, sdc_executor, stage_attributes):
64
64
35
32
31
Sentienz/datacollector-tests
stage/configuration/test_amazon_sqs_consumer_origin.py
Python
test_proxy_host
test_proxy_host
61
64
61
63
4c8fa80fbd02ce11b96bf922f7b573f618b4ccf1
bigcode/the-stack
train
66def8b71b0b20e426f2676c
train
function
@stub @pytest.mark.parametrize('stage_attributes', [{'region': 'OTHER'}]) def test_endpoint(sdc_builder, sdc_executor, stage_attributes): pass
@stub @pytest.mark.parametrize('stage_attributes', [{'region': 'OTHER'}]) def test_endpoint(sdc_builder, sdc_executor, stage_attributes):
pass
test_access_key_id(sdc_builder, sdc_executor): pass @stub def test_connection_timeout(sdc_builder, sdc_executor): pass @stub @pytest.mark.parametrize('stage_attributes', [{'region': 'OTHER'}]) def test_endpoint(sdc_builder, sdc_executor, stage_attributes):
64
64
34
31
32
Sentienz/datacollector-tests
stage/configuration/test_amazon_sqs_consumer_origin.py
Python
test_endpoint
test_endpoint
16
19
16
18
ece61be2782d5dbef35748873ed427756cbc0822
bigcode/the-stack
train
f6cd954e3b28accc330931c3
train
function
@stub def test_secret_access_key(sdc_builder, sdc_executor): pass
@stub def test_secret_access_key(sdc_builder, sdc_executor):
pass
'}, {'region': 'US_WEST_2'}]) def test_region(sdc_builder, sdc_executor, stage_attributes): pass @stub def test_retry_count(sdc_builder, sdc_executor): pass @stub def test_secret_access_key(sdc_builder, sdc_executor):
64
64
19
16
47
Sentienz/datacollector-tests
stage/configuration/test_amazon_sqs_consumer_origin.py
Python
test_secret_access_key
test_secret_access_key
120
122
120
121
0d61111250125d280d8c6423049b9bf9fdd3a37f
bigcode/the-stack
train
409e881d7f4b08abfc87c047
train
function
@stub def test_queue_name_prefixes(sdc_builder, sdc_executor): pass
@stub def test_queue_name_prefixes(sdc_builder, sdc_executor):
pass
_builder, sdc_executor, stage_attributes): pass @stub @pytest.mark.parametrize('stage_attributes', [{'use_proxy': True}]) def test_proxy_user(sdc_builder, sdc_executor, stage_attributes): pass @stub def test_queue_name_prefixes(sdc_builder, sdc_executor):
64
64
20
17
46
Sentienz/datacollector-tests
stage/configuration/test_amazon_sqs_consumer_origin.py
Python
test_queue_name_prefixes
test_queue_name_prefixes
85
87
85
86
310cf220dae5488738860fd7d2c5b785d64601ab
bigcode/the-stack
train
5217bd382568f55d685c803d
train
function
@stub def test_socket_timeout(sdc_builder, sdc_executor): pass
@stub def test_socket_timeout(sdc_builder, sdc_executor):
pass
_builder, sdc_executor, stage_attributes): pass @stub def test_retry_count(sdc_builder, sdc_executor): pass @stub def test_secret_access_key(sdc_builder, sdc_executor): pass @stub def test_socket_timeout(sdc_builder, sdc_executor):
64
64
18
15
48
Sentienz/datacollector-tests
stage/configuration/test_amazon_sqs_consumer_origin.py
Python
test_socket_timeout
test_socket_timeout
125
127
125
126
7249ab74e5a3d915119d20b5d39e93af66393444
bigcode/the-stack
train
bc0ce23126341ad0f2aa8e53
train
function
@stub @pytest.mark.parametrize('stage_attributes', [{'use_proxy': True}]) def test_proxy_user(sdc_builder, sdc_executor, stage_attributes): pass
@stub @pytest.mark.parametrize('stage_attributes', [{'use_proxy': True}]) def test_proxy_user(sdc_builder, sdc_executor, stage_attributes):
pass
@pytest.mark.parametrize('stage_attributes', [{'use_proxy': True}]) def test_proxy_port(sdc_builder, sdc_executor, stage_attributes): pass @stub @pytest.mark.parametrize('stage_attributes', [{'use_proxy': True}]) def test_proxy_user(sdc_builder, sdc_executor, stage_attributes):
64
64
35
32
31
Sentienz/datacollector-tests
stage/configuration/test_amazon_sqs_consumer_origin.py
Python
test_proxy_user
test_proxy_user
79
82
79
81
1668ede237d94850b8bedc30523d51cfd48b1506
bigcode/the-stack
train
ad7a845fe785e095eee014dd
train
function
@stub @pytest.mark.parametrize('stage_attributes', [{'on_record_error': 'DISCARD'}, {'on_record_error': 'STOP_PIPELINE'}, {'on_record_error': 'TO_ERROR'}]) def test_on_record_error(sdc_builder, sdc_executor, stage_attributes): ...
@stub @pytest.mark.parametrize('stage_attributes', [{'on_record_error': 'DISCARD'}, {'on_record_error': 'STOP_PIPELINE'}, {'on_record_error': 'TO_ERROR'}]) def test_on_record_error(sdc_builder, sdc_executor, stage_attributes):
pass
sdc_executor): pass @stub @pytest.mark.parametrize('stage_attributes', [{'on_record_error': 'DISCARD'}, {'on_record_error': 'STOP_PIPELINE'}, {'on_record_error': 'TO_ERROR'}]) def test_on_record_error(sdc_builder, sdc_execu...
64
64
60
57
6
Sentienz/datacollector-tests
stage/configuration/test_amazon_sqs_consumer_origin.py
Python
test_on_record_error
test_on_record_error
48
53
48
52
faf51c85c2a8923a799b1def589a4b0d2924126d
bigcode/the-stack
train
6bc333fcdcff8cfd1f958e5c
train
function
@stub @pytest.mark.parametrize('stage_attributes', [{'use_proxy': False}, {'use_proxy': True}]) def test_use_proxy(sdc_builder, sdc_executor, stage_attributes): pass
@stub @pytest.mark.parametrize('stage_attributes', [{'use_proxy': False}, {'use_proxy': True}]) def test_use_proxy(sdc_builder, sdc_executor, stage_attributes):
pass
': 'NONE'}]) def test_sqs_message_attribute_level(sdc_builder, sdc_executor, stage_attributes): pass @stub @pytest.mark.parametrize('stage_attributes', [{'use_proxy': False}, {'use_proxy': True}]) def test_use_proxy(sdc_builder, sdc_executor, stage_attributes):
64
64
41
38
25
Sentienz/datacollector-tests
stage/configuration/test_amazon_sqs_consumer_origin.py
Python
test_use_proxy
test_use_proxy
138
141
138
140
2d84c6a9dbfeea37becac9e4a99adf25c35dad7b
bigcode/the-stack
train
4bff94595af4e3422835f063
train
function
@stub def test_max_batch_size_in_messages(sdc_builder, sdc_executor): pass
@stub def test_max_batch_size_in_messages(sdc_builder, sdc_executor):
pass
): pass @stub @pytest.mark.parametrize('stage_attributes', [{'sqs_message_attribute_level': 'ALL'}]) def test_include_sqs_sender_attributes(sdc_builder, sdc_executor, stage_attributes): pass @stub def test_max_batch_size_in_messages(sdc_builder, sdc_executor):
64
64
21
18
45
Sentienz/datacollector-tests
stage/configuration/test_amazon_sqs_consumer_origin.py
Python
test_max_batch_size_in_messages
test_max_batch_size_in_messages
28
30
28
29
2442ad7841c2323452f17e4494c50aef1dd222f9
bigcode/the-stack
train
acb654370e3f92e0cf44e68a
train
function
@stub @pytest.mark.parametrize('stage_attributes', [{'sqs_message_attribute_level': 'ALL'}, {'sqs_message_attribute_level': 'BASIC'}, {'sqs_message_attribute_level': 'NONE'}]) def test_sqs_message_attribute_level(sdc_builder, sd...
@stub @pytest.mark.parametrize('stage_attributes', [{'sqs_message_attribute_level': 'ALL'}, {'sqs_message_attribute_level': 'BASIC'}, {'sqs_message_attribute_level': 'NONE'}]) def test_sqs_message_attribute_level(sdc_builder, sd...
pass
pass @stub @pytest.mark.parametrize('stage_attributes', [{'sqs_message_attribute_level': 'ALL'}, {'sqs_message_attribute_level': 'BASIC'}, {'sqs_message_attribute_level': 'NONE'}]) def test_sqs_message_attribute_level(sdc_build...
64
64
65
62
1
Sentienz/datacollector-tests
stage/configuration/test_amazon_sqs_consumer_origin.py
Python
test_sqs_message_attribute_level
test_sqs_message_attribute_level
130
135
130
134
348564f3ac651060bd7bf213335fb9720f761e9f
bigcode/the-stack
train
58d7d3bdd90c877311aae99c
train
function
@stub @pytest.mark.parametrize('stage_attributes', [{'use_proxy': True}]) def test_proxy_password(sdc_builder, sdc_executor, stage_attributes): pass
@stub @pytest.mark.parametrize('stage_attributes', [{'use_proxy': True}]) def test_proxy_password(sdc_builder, sdc_executor, stage_attributes):
pass
@pytest.mark.parametrize('stage_attributes', [{'use_proxy': True}]) def test_proxy_host(sdc_builder, sdc_executor, stage_attributes): pass @stub @pytest.mark.parametrize('stage_attributes', [{'use_proxy': True}]) def test_proxy_password(sdc_builder, sdc_executor, stage_attributes):
64
64
35
32
31
Sentienz/datacollector-tests
stage/configuration/test_amazon_sqs_consumer_origin.py
Python
test_proxy_password
test_proxy_password
67
70
67
69
86686340350fd5f4e015339ccc4540ffc83a74a7
bigcode/the-stack
train
d7ab6af4111a8539b7ed45c4
train
function
@stub @pytest.mark.parametrize('stage_attributes', [{'use_proxy': True}]) def test_proxy_port(sdc_builder, sdc_executor, stage_attributes): pass
@stub @pytest.mark.parametrize('stage_attributes', [{'use_proxy': True}]) def test_proxy_port(sdc_builder, sdc_executor, stage_attributes):
pass
@pytest.mark.parametrize('stage_attributes', [{'use_proxy': True}]) def test_proxy_password(sdc_builder, sdc_executor, stage_attributes): pass @stub @pytest.mark.parametrize('stage_attributes', [{'use_proxy': True}]) def test_proxy_port(sdc_builder, sdc_executor, stage_attributes):
64
64
35
32
31
Sentienz/datacollector-tests
stage/configuration/test_amazon_sqs_consumer_origin.py
Python
test_proxy_port
test_proxy_port
73
76
73
75
732e36ab5323ebea87fe0d3f2330ab48dfcf8e4c
bigcode/the-stack
train
9f1c2cf9153f3756448276b8
train
function
@stub def test_access_key_id(sdc_builder, sdc_executor): pass
@stub def test_access_key_id(sdc_builder, sdc_executor):
pass
import pytest from streamsets.testframework.decorators import stub @stub def test_access_key_id(sdc_builder, sdc_executor):
28
64
19
16
11
Sentienz/datacollector-tests
stage/configuration/test_amazon_sqs_consumer_origin.py
Python
test_access_key_id
test_access_key_id
6
8
6
7
bc7023340680dfe039581418eab64ff4984d3f4e
bigcode/the-stack
train
901b56a407eff7f3baec8928
train
function
@stub @pytest.mark.parametrize('stage_attributes', [{'region': 'AP_NORTHEAST_1'}, {'region': 'AP_NORTHEAST_2'}, {'region': 'AP_NORTHEAST_3'}, {'region': 'AP_SOUTHEAST_1'}, ...
@stub @pytest.mark.parametrize('stage_attributes', [{'region': 'AP_NORTHEAST_1'}, {'region': 'AP_NORTHEAST_2'}, {'region': 'AP_NORTHEAST_3'}, {'region': 'AP_SOUTHEAST_1'}, ...
pass
@stub @pytest.mark.parametrize('stage_attributes', [{'region': 'AP_NORTHEAST_1'}, {'region': 'AP_NORTHEAST_2'}, {'region': 'AP_NORTHEAST_3'}, {'region': 'AP_SOUTHEAST_1'}, ...
255
77
258
255
0
Sentienz/datacollector-tests
stage/configuration/test_amazon_sqs_consumer_origin.py
Python
test_region
test_region
90
112
90
111
8180b2d956907a004ac154b60a760d0640dd0a33
bigcode/the-stack
train
1243008a18682947eecfa82d
train
function
@stub @pytest.mark.parametrize('stage_attributes', [{'sqs_message_attribute_level': 'ALL'}]) def test_include_sqs_sender_attributes(sdc_builder, sdc_executor, stage_attributes): pass
@stub @pytest.mark.parametrize('stage_attributes', [{'sqs_message_attribute_level': 'ALL'}]) def test_include_sqs_sender_attributes(sdc_builder, sdc_executor, stage_attributes):
pass
', [{'region': 'OTHER'}]) def test_endpoint(sdc_builder, sdc_executor, stage_attributes): pass @stub @pytest.mark.parametrize('stage_attributes', [{'sqs_message_attribute_level': 'ALL'}]) def test_include_sqs_sender_attributes(sdc_builder, sdc_executor, stage_attributes):
64
64
42
39
24
Sentienz/datacollector-tests
stage/configuration/test_amazon_sqs_consumer_origin.py
Python
test_include_sqs_sender_attributes
test_include_sqs_sender_attributes
22
25
22
24
414da5687b6693e13e18965edbe58f0d527e966b
bigcode/the-stack
train
389856a8f9936b7fc16323fb
train
class
class LanguageDetectionConfig(AppConfig): name = 'language_detection'
class LanguageDetectionConfig(AppConfig):
name = 'language_detection'
from django.apps import AppConfig class LanguageDetectionConfig(AppConfig):
14
64
14
7
6
sumitrathore1313/voice
language_detection/apps.py
Python
LanguageDetectionConfig
LanguageDetectionConfig
4
5
4
4
29ce0aeecc889c429ccf5d4582c15abdd092fa4f
bigcode/the-stack
train
53664458670f05d14ab1fb0d
train
class
class UriField(HyperlinkedIdentityField): """Represents a uri to the resource.""" def get_url(self, obj, view_name, request, format): """Same as basic HyperlinkedIdentityField except return uri vs full url.""" return super().get_url(obj, view_name, None, format)
class UriField(HyperlinkedIdentityField):
"""Represents a uri to the resource.""" def get_url(self, obj, view_name, request, format): """Same as basic HyperlinkedIdentityField except return uri vs full url.""" return super().get_url(obj, view_name, None, format)
kwargs = {self.lookup_url_kwarg: getattr(obj, self.lookup_field)} else: kwargs = {k: getattr(obj, k) for k in info.primary_keys} return self.reverse(view_name, kwargs=kwargs, request=request, format=format) class UriField(HyperlinkedIdentityField):
64
64
67
9
55
orientalperil/django-rest-witchcraft
rest_witchcraft/fields.py
Python
UriField
UriField
28
34
28
28
88662fca64e6b934610dfbf474ffac5b48586f22
bigcode/the-stack
train
b9e6137c135d980b6fca89fa
train
class
class HyperlinkedIdentityField(relations.HyperlinkedIdentityField): def get_url(self, obj, view_name, request, format): info = meta.model_info(obj.__class__) # Unsaved objects will not yet have a valid URL. if not all(getattr(obj, i) for i in info.primary_keys): return None ...
class HyperlinkedIdentityField(relations.HyperlinkedIdentityField):
def get_url(self, obj, view_name, request, format): info = meta.model_info(obj.__class__) # Unsaved objects will not yet have a valid URL. if not all(getattr(obj, i) for i in info.primary_keys): return None if len(info.primary_keys) == 1: kwargs = {self.look...
"""Some SQLAlchemy specific field types.""" import six from django.db.models.constants import LOOKUP_SEP from django_sorcery.db import meta from rest_framework import fields, relations class HyperlinkedIdentityField(relations.HyperlinkedIdentityField):
52
64
138
13
38
orientalperil/django-rest-witchcraft
rest_witchcraft/fields.py
Python
HyperlinkedIdentityField
HyperlinkedIdentityField
12
25
12
12
bfe557592562f8ed11d6e7ea815c15bc66010f17
bigcode/the-stack
train
0d28e88528b4e1159cac58ba
train
class
class CharMappingField(fields.DictField): """Used for Postgresql HSTORE columns for storing key-value pairs.""" child = fields.CharField(allow_null=True)
class CharMappingField(fields.DictField):
"""Used for Postgresql HSTORE columns for storing key-value pairs.""" child = fields.CharField(allow_null=True)
Represents a uri to the resource.""" def get_url(self, obj, view_name, request, format): """Same as basic HyperlinkedIdentityField except return uri vs full url.""" return super().get_url(obj, view_name, None, format) class CharMappingField(fields.DictField):
64
64
34
8
56
orientalperil/django-rest-witchcraft
rest_witchcraft/fields.py
Python
CharMappingField
CharMappingField
37
40
37
37
9abd7df7de12022d19ce427f486d51af1f37e42f
bigcode/the-stack
train
e7710f71abcee6f49e870ec7
train
class
class SkippableField(fields.Field): """Field which is always skipped on to_representation. Useful when used together with ``ExpandableModelSerializer`` since it allows to completely skip expandable field when it is not being expanded. Especially useful for ``OneToMany`` relations since by default neste...
class SkippableField(fields.Field):
"""Field which is always skipped on to_representation. Useful when used together with ``ExpandableModelSerializer`` since it allows to completely skip expandable field when it is not being expanded. Especially useful for ``OneToMany`` relations since by default nested serializer cannot be rendered ...
= i.split(LOOKUP_SEP) data = list( ({LOOKUP_SEP.join(parts[:i]) for i in six.moves.range(1, len(parts))} & set(self.child.choices)) | set(data) ) return data class SkippableField(fields.Field):
64
64
178
8
55
orientalperil/django-rest-witchcraft
rest_witchcraft/fields.py
Python
SkippableField
SkippableField
59
84
59
59
b389fa50a663578ec835dc6f89055e8f49d88a6f
bigcode/the-stack
train
5bee7f0da96dbf2a6c7126ea
train
class
class ImplicitExpandableListField(fields.ListField): """List field which implicitly expands parent field when child field is expanded assuming parent field is also expandable by being one of the choices.""" def to_internal_value(self, data): data = super().to_internal_value(data) for i ...
class ImplicitExpandableListField(fields.ListField):
"""List field which implicitly expands parent field when child field is expanded assuming parent field is also expandable by being one of the choices.""" def to_internal_value(self, data): data = super().to_internal_value(data) for i in data[:]: parts = i.split(LOOKUP_SEP) ...
full url.""" return super().get_url(obj, view_name, None, format) class CharMappingField(fields.DictField): """Used for Postgresql HSTORE columns for storing key-value pairs.""" child = fields.CharField(allow_null=True) class ImplicitExpandableListField(fields.ListField):
64
64
125
10
54
orientalperil/django-rest-witchcraft
rest_witchcraft/fields.py
Python
ImplicitExpandableListField
ImplicitExpandableListField
43
56
43
43
0f41ebfbcce96e5d8abeef7f14df97e973cf45a8
bigcode/the-stack
train
34c81676a1887d36170963cb
train
class
@Registrable.register('conala_evaluator') class ConalaEvaluator(Evaluator): def __init__(self, transition_system=None, args=None): super(ConalaEvaluator, self).__init__() self.transition_system = transition_system self.default_metric = 'corpus_bleu' def is_hyp_correct(self, example, hyp...
@Registrable.register('conala_evaluator') class ConalaEvaluator(Evaluator):
def __init__(self, transition_system=None, args=None): super(ConalaEvaluator, self).__init__() self.transition_system = transition_system self.default_metric = 'corpus_bleu' def is_hyp_correct(self, example, hyp): ref_code = example.tgt_code ref_py_ast = ast.parse(ref_co...
import csv from components.evaluator import Evaluator from common.registerable import Registrable from components.dataset import Dataset from .util import decanonicalize_code from .conala_eval import tokenize_for_bleu_eval from .bleu_score import compute_bleu from nltk.translate.bleu_score import sentence_bleu, Smooth...
101
256
1,201
17
83
clegoues/tranX
datasets/conala/evaluator.py
Python
ConalaEvaluator
ConalaEvaluator
15
132
15
16
b23d25f3d48bf2dbe1a41884790f9ddd5d5be1d8
bigcode/the-stack
train
0d2c67bc569e2ef2962e00d7
train
function
def hide_post(user, post): if post.is_first_post: raise ModerationError(_("You can't hide original post without hiding thread.")) if post.is_hidden: return False post.is_hidden = True post.hidden_by = user post.hidden_by_name = user.username post.hidden_by_slug = user.slug ...
def hide_post(user, post):
if post.is_first_post: raise ModerationError(_("You can't hide original post without hiding thread.")) if post.is_hidden: return False post.is_hidden = True post.hidden_by = user post.hidden_by_name = user.username post.hidden_by_slug = user.slug post.hidden_on = timezone.n...
if post.is_first_post: raise ModerationError( _("You can't make original post visible without revealing thread.") ) if not post.is_hidden: return False post.is_hidden = False post.save(update_fields=["is_hidden"]) return True def hide_post(user, post):
64
64
123
7
56
vascoalramos/misago-deployment
misago/misago/threads/moderation/posts.py
Python
hide_post
hide_post
64
85
64
64
a11fd577a48dc7c8acdc46aae959ac89812e5a42
bigcode/the-stack
train
ed610435a459ef28a97d7631
train
function
@transaction.atomic def delete_post(user, post): if post.is_first_post: raise ModerationError( _("You can't delete original post without deleting thread.") ) post.delete() return True
@transaction.atomic def delete_post(user, post):
if post.is_first_post: raise ModerationError( _("You can't delete original post without deleting thread.") ) post.delete() return True
.slug post.hidden_on = timezone.now() post.save( update_fields=[ "is_hidden", "hidden_by", "hidden_by_name", "hidden_by_slug", "hidden_on", ] ) return True @transaction.atomic def delete_post(user, post):
64
64
45
11
52
vascoalramos/misago-deployment
misago/misago/threads/moderation/posts.py
Python
delete_post
delete_post
88
96
88
89
85a7fc4d4c754eb6194d3965409876d01afa80eb
bigcode/the-stack
train
2a2f0a7804dd96afd85edf5f
train
function
def approve_post(user, post): if not post.is_unapproved: return False post.is_unapproved = False post.save(update_fields=["is_unapproved"]) return True
def approve_post(user, post):
if not post.is_unapproved: return False post.is_unapproved = False post.save(update_fields=["is_unapproved"]) return True
timezone from django.utils.translation import gettext as _ from .exceptions import ModerationError __all__ = [ "approve_post", "protect_post", "unprotect_post", "unhide_post", "hide_post", "delete_post", ] def approve_post(user, post):
64
64
41
7
57
vascoalramos/misago-deployment
misago/misago/threads/moderation/posts.py
Python
approve_post
approve_post
17
23
17
17
4b2b590dd7e1ca515b2308f82124e3cc73023130
bigcode/the-stack
train
6cc3e542605843b311a55dd8
train
function
def protect_post(user, post): if post.is_protected: return False post.is_protected = True post.save(update_fields=["is_protected"]) if post.is_best_answer: post.thread.best_answer_is_protected = True post.thread.save(update_fields=["best_answer_is_protected"]) return True
def protect_post(user, post):
if post.is_protected: return False post.is_protected = True post.save(update_fields=["is_protected"]) if post.is_best_answer: post.thread.best_answer_is_protected = True post.thread.save(update_fields=["best_answer_is_protected"]) return True
"unhide_post", "hide_post", "delete_post", ] def approve_post(user, post): if not post.is_unapproved: return False post.is_unapproved = False post.save(update_fields=["is_unapproved"]) return True def protect_post(user, post):
64
64
71
7
56
vascoalramos/misago-deployment
misago/misago/threads/moderation/posts.py
Python
protect_post
protect_post
26
35
26
26
bd4c2f40399a219fb5b3e9a99e653bba7303350c
bigcode/the-stack
train
6601400ee511a51bc076c0d9
train
function
def unprotect_post(user, post): if not post.is_protected: return False post.is_protected = False post.save(update_fields=["is_protected"]) if post.is_best_answer: post.thread.best_answer_is_protected = False post.thread.save(update_fields=["best_answer_is_protected"]) return...
def unprotect_post(user, post):
if not post.is_protected: return False post.is_protected = False post.save(update_fields=["is_protected"]) if post.is_best_answer: post.thread.best_answer_is_protected = False post.thread.save(update_fields=["best_answer_is_protected"]) return True
return False post.is_protected = True post.save(update_fields=["is_protected"]) if post.is_best_answer: post.thread.best_answer_is_protected = True post.thread.save(update_fields=["best_answer_is_protected"]) return True def unprotect_post(user, post):
64
64
73
8
55
vascoalramos/misago-deployment
misago/misago/threads/moderation/posts.py
Python
unprotect_post
unprotect_post
38
47
38
38
f07dd1b331ab454d320f0b39d2bf929b86698ce7
bigcode/the-stack
train
f311dae1af238670cf4a33ba
train
function
def unhide_post(user, post): if post.is_first_post: raise ModerationError( _("You can't make original post visible without revealing thread.") ) if not post.is_hidden: return False post.is_hidden = False post.save(update_fields=["is_hidden"]) return True
def unhide_post(user, post):
if post.is_first_post: raise ModerationError( _("You can't make original post visible without revealing thread.") ) if not post.is_hidden: return False post.is_hidden = False post.save(update_fields=["is_hidden"]) return True
return False post.is_protected = False post.save(update_fields=["is_protected"]) if post.is_best_answer: post.thread.best_answer_is_protected = False post.thread.save(update_fields=["best_answer_is_protected"]) return True def unhide_post(user, post):
64
64
66
8
55
vascoalramos/misago-deployment
misago/misago/threads/moderation/posts.py
Python
unhide_post
unhide_post
50
61
50
50
df619487d382137b628cedadfd147d4eb88cfbd4
bigcode/the-stack
train
8f0ac18fe2cdf875d1daa3f5
train
function
def loadSOM(filename): weights = np.load(filename + '.npy') som = SOM([weights.shape[0], weights.shape[1]]) som.weights = weights som.weight_labels = list(np.loadtxt(filename + '.txt', dtype='str',delimiter=",")) return som
def loadSOM(filename):
weights = np.load(filename + '.npy') som = SOM([weights.shape[0], weights.shape[1]]) som.weights = weights som.weight_labels = list(np.loadtxt(filename + '.txt', dtype='str',delimiter=",")) return som
update(self, current_iteration): check = np.floor(100 * (float(current_iteration) / float(self.total_iters))) if check in self.percs: sys.stdout.flush() print('\r' + str(check) + '%') self.percs.pop() def loadSOM(filename):
62
64
63
6
56
derkwilson/PhotSOM
PhotSOM/PhotSOM/som_class.py
Python
loadSOM
loadSOM
167
172
167
167
b8abef5e1bf16a026c6b52d0b7ac8a1277baa1e7
bigcode/the-stack
train
8ef598e951271540fb1121e7
train
class
class SOM(): def __init__(self, somsize): self.xpix = somsize[0] self.ypix = somsize[1] self.weights = None self.weight_labels = None self.tracker = [0., 0., 0.] def a_func(self, t, N_iters): return np.exp(-t/N_iters) # 0.5 ** (t / N_iters) # def HBK(self,...
class SOM():
def __init__(self, somsize): self.xpix = somsize[0] self.ypix = somsize[1] self.weights = None self.weight_labels = None self.tracker = [0., 0., 0.] def a_func(self, t, N_iters): return np.exp(-t/N_iters) # 0.5 ** (t / N_iters) # def HBK(self, sig_of_t, bm...
import numpy as np import pandas as pd import matplotlib.pyplot as plt from scipy.optimize import curve_fit from scipy.signal import argrelextrema import sys class SOM():
39
256
1,305
3
35
derkwilson/PhotSOM
PhotSOM/PhotSOM/som_class.py
Python
SOM
SOM
9
141
9
9
1a45646594523c52414b68828295df7a1c8dc074
bigcode/the-stack
train
f6c3a6925bdc778a9bd9ea22
train
class
class ProgressBar(): def __init__(self, total_iterations): self.total_iters = total_iterations self.percs = list(range(100, 0, -5)) print('0 %') def update(self, current_iteration): check = np.floor(100 * (float(current_iteration) / float(self.total_iters))) if c...
class ProgressBar():
def __init__(self, total_iterations): self.total_iters = total_iterations self.percs = list(range(100, 0, -5)) print('0 %') def update(self, current_iteration): check = np.floor(100 * (float(current_iteration) / float(self.total_iters))) if check in self.percs: ...
np.sqrt(np.nansum((self.weights - samp_weights) ** 2, axis=2)) bmu_dist[t] = np.nanmin(dist_arr) t += 1 return (1. / N_its) * np.nansum(bmu_dist) class ProgressBar():
63
64
103
4
59
derkwilson/PhotSOM
PhotSOM/PhotSOM/som_class.py
Python
ProgressBar
ProgressBar
151
162
151
151
a1b4b39871a2e422539637ce6260015065709cc3
bigcode/the-stack
train
14f8ab2351d214452860781c
train
function
def send_reset_password_email(user, token): send_mail(subject='Password Reset', to=user.email, template='emails/reset_password', user=user, token=token)
def send_reset_password_email(user, token):
send_mail(subject='Password Reset', to=user.email, template='emails/reset_password', user=user, token=token)
_mail, args=[app, message]) thr.start() return thr def send_confirm_email(user, token, to=None): send_mail(subject='Email Confirm', to=to or user.email, template='emails/confirm', user=user, token=token) def send_reset_password_email(user, token):
64
64
34
9
55
CattleHome/albumy
LoveAlbumy/emails.py
Python
send_reset_password_email
send_reset_password_email
35
36
35
35
5c7d97fdca4fa4c15c021ce9b35c7aa160b16ade
bigcode/the-stack
train
8882a0f763e700d6ee8997dc
train
function
def send_change_email_email(user, token, to=None): send_mail(subject='Change Email Confirm', to=to or user.email, template='emails/change_email', user=user, token=token)
def send_change_email_email(user, token, to=None):
send_mail(subject='Change Email Confirm', to=to or user.email, template='emails/change_email', user=user, token=token)
to or user.email, template='emails/confirm', user=user, token=token) def send_reset_password_email(user, token): send_mail(subject='Password Reset', to=user.email, template='emails/reset_password', user=user, token=token) def send_change_email_email(user, token, to=None):
64
64
41
12
52
CattleHome/albumy
LoveAlbumy/emails.py
Python
send_change_email_email
send_change_email_email
39
40
39
39
effa80798a2986f787ce965f4c296cd8a19347df
bigcode/the-stack
train
f9f657988830306744cfac72
train
function
def send_confirm_email(user, token, to=None): send_mail(subject='Email Confirm', to=to or user.email, template='emails/confirm', user=user, token=token)
def send_confirm_email(user, token, to=None):
send_mail(subject='Email Confirm', to=to or user.email, template='emails/confirm', user=user, token=token)
txt', **kwargs) message.html = render_template(template + '.html', **kwargs) app = current_app._get_current_object() thr = Thread(target=_send_async_mail, args=[app, message]) thr.start() return thr def send_confirm_email(user, token, to=None):
64
64
39
11
52
CattleHome/albumy
LoveAlbumy/emails.py
Python
send_confirm_email
send_confirm_email
31
32
31
31
d38d528905ed692631b0b06e38c72022385b0712
bigcode/the-stack
train
73048dd52b0e33e062980d7d
train
function
def send_mail(to, subject, template, **kwargs): message = Message(current_app.config['ALBUMY_MAIL_SUBJECT_PREFIX'] + subject, recipients=[to]) message.body = render_template(template + '.txt', **kwargs) message.html = render_template(template + '.html', **kwargs) app = current_app._get_current_object() ...
def send_mail(to, subject, template, **kwargs):
message = Message(current_app.config['ALBUMY_MAIL_SUBJECT_PREFIX'] + subject, recipients=[to]) message.body = render_template(template + '.txt', **kwargs) message.html = render_template(template + '.html', **kwargs) app = current_app._get_current_object() thr = Thread(target=_send_async_mail, args=[...
more details. """ from threading import Thread from flask import current_app, render_template from flask_mail import Message from LoveAlbumy.extensions import mail def _send_async_mail(app, message): with app.app_context(): mail.send(message) def send_mail(to, subject, template, **kwargs):
64
64
97
12
52
CattleHome/albumy
LoveAlbumy/emails.py
Python
send_mail
send_mail
21
28
21
21
5d355ac647455cb63dd1107a6cf148c6d0a5375e
bigcode/the-stack
train
f4207e6a2929bf68e335899f
train
function
def _send_async_mail(app, message): with app.app_context(): mail.send(message)
def _send_async_mail(app, message):
with app.app_context(): mail.send(message)
: © 2018 Grey Li <withlihui@gmail.com> :license: MIT, see LICENSE for more details. """ from threading import Thread from flask import current_app, render_template from flask_mail import Message from LoveAlbumy.extensions import mail def _send_async_mail(app, message):
64
64
20
9
54
CattleHome/albumy
LoveAlbumy/emails.py
Python
_send_async_mail
_send_async_mail
16
18
16
16
7e2ba1575eb97107e0cd4c54b03be91b9340bce6
bigcode/the-stack
train
82f3ba580ff86023af659957
train
function
def shell_sort(array): mov = 0 count = 0 start = time.time(); gap = len(array)//2 while gap > 0: count += 1 for i in range(gap): for j in range(i+gap, len(array), gap): currValue = array[j] while j >= gap and array[j - ...
def shell_sort(array):
mov = 0 count = 0 start = time.time(); gap = len(array)//2 while gap > 0: count += 1 for i in range(gap): for j in range(i+gap, len(array), gap): currValue = array[j] while j >= gap and array[j - gap] > currValue: ...
import random import time def shell_sort(array):
12
64
151
5
6
ArthurTerozendi/sort-methods
SortMethods/ShellSort.py
Python
shell_sort
shell_sort
5
27
5
5
39e51e4fa1a3c7f128c9f5d98d4efbdf01baff0f
bigcode/the-stack
train
1e34cb8ec91c5f1920f04957
train
class
class DataElementSDCObjectClass(SNOMEDCT): """ DataElement SDC Object Class The allowed codes for identifying the ISO 11179 ObjectClass Property for a particular data element if intended for registration/use within the U.S. Structured Data Capture (SDC) project. Status: draft - Version: 4.0.1 htt...
class DataElementSDCObjectClass(SNOMEDCT):
""" DataElement SDC Object Class The allowed codes for identifying the ISO 11179 ObjectClass Property for a particular data element if intended for registration/use within the U.S. Structured Data Capture (SDC) project. Status: draft - Version: 4.0.1 http://hl7.org/fhir/ValueSet/dataelement-sdcob...
ValueSet from oops_fhir.r4.code_system.snomed_ct import SNOMEDCT __all__ = ["DataElementSDCObjectClass"] _resource = _ValueSet.parse_file(Path(__file__).with_suffix(".json")) class DataElementSDCObjectClass(SNOMEDCT):
63
64
108
13
50
Mikuana/oops_fhir
oops_fhir/r4/value_set/data_element_sdcobject_class.py
Python
DataElementSDCObjectClass
DataElementSDCObjectClass
16
30
16
16
cad2010a1dec7f44c8fd353cc0aa16ebeb0f5ba4
bigcode/the-stack
train
68d9ba0bf4d2b1256b7855f9
train
function
def create_app(): '''create and configure instance of our Flask application.''' app = Flask(__name__) CORS(app) app.config['CORS_HEADERS']='Content-Type' def get_data(): data_file = open('airbnb/airbnb/data.csv') csv_file = csv.reader(data_file) info = [] for row...
def create_app():
'''create and configure instance of our Flask application.''' app = Flask(__name__) CORS(app) app.config['CORS_HEADERS']='Content-Type' def get_data(): data_file = open('airbnb/airbnb/data.csv') csv_file = csv.reader(data_file) info = [] for row in csv_file: ...
from flask import Flask,jsonify, request from flask_cors import CORS import pickle import sklearn import pandas as pd import csv import numpy as np from airbnb.prediction import vectorize_data, pre def create_app():
52
85
286
4
47
BW-AirBnB-1-Krisda/ds-1
airbnb/app.py
Python
create_app
create_app
10
43
10
10
66ffb1019dab18805cc69758ddf4ff41bc448c3e
bigcode/the-stack
train
416688546a750140dbafdedb
train
class
class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.CreateModel( name='Profile', fields=[ ('id', models.AutoField(auto_created=True, primar...
class Migration(migrations.Migration):
initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.CreateModel( name='Profile', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_nam...
# Generated by Django 2.0.2 on 2018-02-19 03:11 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration):
51
64
183
7
43
liujordan/QuickRegister
QuickRegister/migrations/0001_initial.py
Python
Migration
Migration
8
30
8
9
4c8288f8b1f8e7b3f541e0359e7fa705f94b8957
bigcode/the-stack
train
0fd0ee8c3e034ffa8c78859f
train
class
class JobClean(object): @classmethod def clean_table(cls,job_id, role, party_id, component_name): # clean data table stat_logger.info('start delete {} {} {} {} data table'.format(job_id, role, party_id, component_name)) tracker = Tracker(job_id=job_id, role=role, party_id=party_id, comp...
class JobClean(object): @classmethod
def clean_table(cls,job_id, role, party_id, component_name): # clean data table stat_logger.info('start delete {} {} {} {} data table'.format(job_id, role, party_id, component_name)) tracker = Tracker(job_id=job_id, role=role, party_id=party_id, component_name=component_name) output...
file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF...
159
159
532
9
149
kakasu/FATE
python/fate_flow/operation/job_clean.py
Python
JobClean
JobClean
24
73
24
25
9764b84e878ff641bd4aa11890b59c8027a608a0
bigcode/the-stack
train
fe0f50a48c205a3fa642fe16
train
function
def get_task_info(f_job_id, f_role, f_party_id, f_component_name): task_info = { "job_id": f_job_id, "component_name": f_component_name, "role": f_role, "party_id": f_party_id, } return task_info
def get_task_info(f_job_id, f_role, f_party_id, f_component_name):
task_info = { "job_id": f_job_id, "component_name": f_component_name, "role": f_role, "party_id": f_party_id, } return task_info
{} {} metric data failed'.format(task.f_job_id, task.f_role, task.f_party_id, task.f_component_name)) stat_logger.exception(e) ...
64
64
65
19
45
kakasu/FATE
python/fate_flow/operation/job_clean.py
Python
get_task_info
get_task_info
76
83
76
76
070f4c88317b8e2559a934001a58ef087d53f49f
bigcode/the-stack
train
72dd0f33e5bff80d41549e27
train
class
class Migration(migrations.Migration): dependencies = [ ('feewaiver', '0024_feewaivervisit_camping_assessment'), ] operations = [ migrations.AddField( model_name='feewaivervisit', name='issued', field=models.BooleanField(default=True), ), ...
class Migration(migrations.Migration):
dependencies = [ ('feewaiver', '0024_feewaivervisit_camping_assessment'), ] operations = [ migrations.AddField( model_name='feewaivervisit', name='issued', field=models.BooleanField(default=True), ), migrations.AlterField( mode...
# -*- coding: utf-8 -*- # Generated by Django 1.11.29 on 2020-12-16 05:07 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration):
54
64
150
7
46
dbca-wa/feewaiver
feewaiver/migrations/0025_auto_20201216_1307.py
Python
Migration
Migration
8
25
8
9
91cc740d2a66fd81016f0ed27193d9edd949f391
bigcode/the-stack
train
7576fb3571dec26173d9e08c
train
function
def chk_btn(): global var_store btnA=var_store['btnA'] btnB=var_store['btnB'] btnC=var_store['btnC'] if btnA.value()==0: if not btn['A']: btn['A']=True return True else: btn['A']=False if btnB.value()==0: if not btn['B']: btn['B']=...
def chk_btn():
global var_store btnA=var_store['btnA'] btnB=var_store['btnB'] btnC=var_store['btnC'] if btnA.value()==0: if not btn['A']: btn['A']=True return True else: btn['A']=False if btnB.value()==0: if not btn['B']: btn['B']=True ...
# -*- coding: utf-8 -*- # ap_freq_test.py version='1.0' from color import * from machine import PWM, Pin import time btn={'A':False, 'B':False, 'C':False} def chk_btn():
54
64
148
4
50
kcfkwok2003/m5_star_navigator
m5stack/sd_cont/ap_freq_test.py
Python
chk_btn
chk_btn
9
31
9
9
ade4f2050323ef5959a3f780b2949e774e379fd6
bigcode/the-stack
train
28b5dac0182d4bd074732f7f
train
function
def inc_freq(n): global tft, freq,p25 freq +=1000 tft.fill_rect(0,10,128,16,NAVY) tft.text('{:^10}'.format(freq),5,10,WHITE) p25.freq(freq) p25.duty(100)
def inc_freq(n):
global tft, freq,p25 freq +=1000 tft.fill_rect(0,10,128,16,NAVY) tft.text('{:^10}'.format(freq),5,10,WHITE) p25.freq(freq) p25.duty(100)
B']: btn['B']=True return True else: btn['B']=False if btnC.value()==0: if not btn['C']: btn['C']=True return True else: btn['C']=False def inc_freq(n):
64
64
69
5
58
kcfkwok2003/m5_star_navigator
m5stack/sd_cont/ap_freq_test.py
Python
inc_freq
inc_freq
33
39
33
33
dada8dbf43c128cf2a2e5ccb23cb5df558735c04
bigcode/the-stack
train
6afd1be07de9ea8e203db8b8
train
function
def set_mute(n): global tft, freq,p26 freq=0 tft.fill_rect(0,10,128,16,NAVY) tft.text('{:^10}'.format('mute'),5,10,WHITE) p25.duty(0)
def set_mute(n):
global tft, freq,p26 freq=0 tft.fill_rect(0,10,128,16,NAVY) tft.text('{:^10}'.format('mute'),5,10,WHITE) p25.duty(0)
0: freq=0 tft.fill_rect(0,10,128,16,NAVY) tft.text('{:^10}'.format(freq),5,10,WHITE) p25.freq(freq) p25.duty(100) def set_mute(n):
63
64
63
6
57
kcfkwok2003/m5_star_navigator
m5stack/sd_cont/ap_freq_test.py
Python
set_mute
set_mute
51
56
51
51
2677980acdae03cfd8ede3d1ac42a092d3fdc54f
bigcode/the-stack
train
26ff262c30632ae1d4666d55
train
function
def main(vs): global tft,var_store,freq,mute,p25 var_store=vs freq=1000 mute=True print('ap_freq_test run') tft=var_store['tft'] horo_main = var_store['horo_main'] btnA = var_store['btnA'] tft.fill(NAVY) tft.text('{:^10}'.format('mute'),5,10,WHITE) p25=PWM(Pin(25)) p25.du...
def main(vs):
global tft,var_store,freq,mute,p25 var_store=vs freq=1000 mute=True print('ap_freq_test run') tft=var_store['tft'] horo_main = var_store['horo_main'] btnA = var_store['btnA'] tft.fill(NAVY) tft.text('{:^10}'.format('mute'),5,10,WHITE) p25=PWM(Pin(25)) p25.duty(0) whi...
): global tft, freq,p26 freq=0 tft.fill_rect(0,10,128,16,NAVY) tft.text('{:^10}'.format('mute'),5,10,WHITE) p25.duty(0) def main(vs):
63
64
173
5
58
kcfkwok2003/m5_star_navigator
m5stack/sd_cont/ap_freq_test.py
Python
main
main
58
81
58
58
9bde001ab60c1b855164bcb78dd42c3d4009cafc
bigcode/the-stack
train
c44de5d7c222b5d9490ceb2d
train
function
def dec_freq(n): global tft, freq,p25 freq -=1000 if freq < 0: freq=0 tft.fill_rect(0,10,128,16,NAVY) tft.text('{:^10}'.format(freq),5,10,WHITE) p25.freq(freq) p25.duty(100)
def dec_freq(n):
global tft, freq,p25 freq -=1000 if freq < 0: freq=0 tft.fill_rect(0,10,128,16,NAVY) tft.text('{:^10}'.format(freq),5,10,WHITE) p25.freq(freq) p25.duty(100)
,p25 freq +=1000 tft.fill_rect(0,10,128,16,NAVY) tft.text('{:^10}'.format(freq),5,10,WHITE) p25.freq(freq) p25.duty(100) def dec_freq(n):
63
64
82
5
58
kcfkwok2003/m5_star_navigator
m5stack/sd_cont/ap_freq_test.py
Python
dec_freq
dec_freq
41
49
41
41
42a2d61536a3cf38b3cbcb0c03e7420177346f5a
bigcode/the-stack
train
e28e52594d210dc698d28dae
train
function
def test_WatershedBEM_inputs(): input_map = dict(args=dict(argstr='%s', ), atlas_mode=dict(argstr='--atlas', ), environ=dict(nohash=True, usedefault=True, ), ignore_exception=dict(nohash=True, usedefault=True, ), overwrite=dict(argstr='--overwrite', usedefault=True, )...
def test_WatershedBEM_inputs():
input_map = dict(args=dict(argstr='%s', ), atlas_mode=dict(argstr='--atlas', ), environ=dict(nohash=True, usedefault=True, ), ignore_exception=dict(nohash=True, usedefault=True, ), overwrite=dict(argstr='--overwrite', usedefault=True, ), subject_id=dict(argstr='--...
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT from __future__ import unicode_literals from ..base import WatershedBEM def test_WatershedBEM_inputs():
42
64
206
9
32
HussainAther/nipype
nipype/interfaces/mne/tests/test_auto_WatershedBEM.py
Python
test_WatershedBEM_inputs
test_WatershedBEM_inputs
6
37
6
6
18659b3348efd5649e63a6d52bb9d890f35096b1
bigcode/the-stack
train
711f088ce76a8d938463f855
train
function
def test_WatershedBEM_outputs(): output_map = dict(brain_surface=dict(loc='bem/watershed', ), cor_files=dict(altkey='COR', loc='bem/watershed/ws', ), fif_file=dict(altkey='fif', loc='bem', ), inner_skull_surface=dict(loc='bem/watershed', ), mesh_files=dict(), outer_skin_s...
def test_WatershedBEM_outputs():
output_map = dict(brain_surface=dict(loc='bem/watershed', ), cor_files=dict(altkey='COR', loc='bem/watershed/ws', ), fif_file=dict(altkey='fif', loc='bem', ), inner_skull_surface=dict(loc='bem/watershed', ), mesh_files=dict(), outer_skin_surface=dict(loc='bem/watershed', ...
efault=True, ), ) inputs = WatershedBEM.input_spec() for key, metadata in list(input_map.items()): for metakey, value in list(metadata.items()): assert getattr(inputs.traits()[key], metakey) == value def test_WatershedBEM_outputs():
64
64
164
9
54
HussainAther/nipype
nipype/interfaces/mne/tests/test_auto_WatershedBEM.py
Python
test_WatershedBEM_outputs
test_WatershedBEM_outputs
40
61
40
40
69ab581439b41484e83d04e62e89071298bf106d
bigcode/the-stack
train
cb36ff0ec8922cf0564ab0a0
train
class
class LandCover(VisionDataset): """The LandCover.ai (Land Cover from Aerial Imagery) dataset. <https://landcover.ai/download/landcover.ai.v1.zip> Args: root (string): Root directory of dataset. transform (callable, optional): A function/transform that takes in an PIL image and ...
class LandCover(VisionDataset):
"""The LandCover.ai (Land Cover from Aerial Imagery) dataset. <https://landcover.ai/download/landcover.ai.v1.zip> Args: root (string): Root directory of dataset. transform (callable, optional): A function/transform that takes in an PIL image and returns a transformed version. ...
"""The LandCover.ai (Land Cover from Aerial Imagery) Dataset.""" from PIL import Image import os import shutil import posixpath import numpy as np import pandas as pd import glob import cv2 from typing import Any, Callable, Optional, Tuple from .utils import _urlretrieve, _load_img from .vision import VisionDataset fr...
97
256
1,250
7
89
dewabratapandu/earth-vision
earthvision/datasets/landcover.py
Python
LandCover
LandCover
17
167
17
17
e736e067affd73650c7ea2a22f6b26777e076c4c
bigcode/the-stack
train
3e2ab1a6effc863f914f5697
train
function
def get_existing_landmarks(): frequency_data = [] for landmark in clean_data['landmark_id']: row = clean_data.loc[clean_data['landmark_id'] == landmark] img_id_string = row['images'].values[0].split(' ') # append tuple of (landmark_id, num_images for that id) frequency_data.appen...
def get_existing_landmarks():
frequency_data = [] for landmark in clean_data['landmark_id']: row = clean_data.loc[clean_data['landmark_id'] == landmark] img_id_string = row['images'].values[0].split(' ') # append tuple of (landmark_id, num_images for that id) frequency_data.append((row['landmark_id'].values[0...
_csv('train_label_to_category.csv') landmark_id_list=[] clean_data = pd.read_csv('train_clean.csv') ''' print('CSV Sample Headers:\n') print(label_to_category_data.head()) print(clean_data.head()) ''' category_vals = label_to_category_data['category'].values def get_existing_landmarks():
64
64
166
6
57
ece324-2020/Monumentum
id_preprocessing.py
Python
get_existing_landmarks
get_existing_landmarks
13
27
13
13
62a5ca8943f8a1e58e40334dc2a35b7dd741f927
bigcode/the-stack
train
cd5967210262d1daa41dc744
train
function
def get_athens_ids(): for i,word in enumerate(category_vals): if 'Athens' in word or 'athens' in word: landmark_id_list+=[i] print('All Athens IDs:\n',landmark_id_list) print('ID Count:\n',len(landmark_id_list)) existing_ids=[] image_tags=[] for i,id in enumerate(landmark_...
def get_athens_ids():
for i,word in enumerate(category_vals): if 'Athens' in word or 'athens' in word: landmark_id_list+=[i] print('All Athens IDs:\n',landmark_id_list) print('ID Count:\n',len(landmark_id_list)) existing_ids=[] image_tags=[] for i,id in enumerate(landmark_id_list): if i...
_id_vals = sorted(frequency_data, key=lambda tup: tup[1] ,reverse=True) for index, tuple in enumerate(landmark_id_vals): if tuple[1]==704: print(landmark_id_vals[index:index+50]) break return landmark_id_vals[index:index+50] def get_athens_ids():
73
73
244
7
66
ece324-2020/Monumentum
id_preprocessing.py
Python
get_athens_ids
get_athens_ids
30
57
30
30
8eec820e55deaf786f46fe4c3d7baa30784cd8f6
bigcode/the-stack
train
290b40e50df5d6ebc99088d4
train
class
class MulticlassExtension(ABC): """ Base class for multiclass extension. This method should initialize the module and use an exception if a component of the module is not available. """ @abstractmethod def __init__(self) -> None: super().__init__() @abstractmethod ...
class MulticlassExtension(ABC):
""" Base class for multiclass extension. This method should initialize the module and use an exception if a component of the module is not available. """ @abstractmethod def __init__(self) -> None: super().__init__() @abstractmethod def train(self, x, y): ...
2.0. # # Any modifications or derivative works of this code must retain this # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. """ Base class for multiclass extension """ from abc import ABC, abstractmethod class MulticlassExtension(ABC):
66
66
221
8
57
aaita92/qiskit-aqua
qiskit/aqua/components/multiclass_extensions/multiclass_extension.py
Python
MulticlassExtension
MulticlassExtension
20
59
20
20
8c16a37d892482f5a41a407f9d6b14c5481138c4
bigcode/the-stack
train
883a3a477ef1f05ba162cc92
train
class
class ShowtickprefixValidator(_plotly_utils.basevalidators.EnumeratedValidator): def __init__( self, plotly_name="showtickprefix", parent_name="layout.xaxis", **kwargs ): super(ShowtickprefixValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, ...
class ShowtickprefixValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__( self, plotly_name="showtickprefix", parent_name="layout.xaxis", **kwargs ): super(ShowtickprefixValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, edit_type=kwargs.pop("edit_type", "ticks"), role=kwargs.pop("...
import _plotly_utils.basevalidators class ShowtickprefixValidator(_plotly_utils.basevalidators.EnumeratedValidator):
24
64
122
16
7
acrucetta/Chicago_COVI_WebApp
env/lib/python3.8/site-packages/plotly/validators/layout/xaxis/_showtickprefix.py
Python
ShowtickprefixValidator
ShowtickprefixValidator
4
15
4
4
4531cf21790c252e681fdf514b6f9aad3cd39b64
bigcode/the-stack
train
a49eb87ce25334e574245c64
train
class
class QosExtensionBaseTestCase(base.BaseTestCase): def setUp(self): super(QosExtensionBaseTestCase, self).setUp() self.qos_ext = qos.QosAgentExtension() self.context = context.get_admin_context() self.connection = mock.Mock() # Don't rely on used driver mock.patch( ...
class QosExtensionBaseTestCase(base.BaseTestCase):
def setUp(self): super(QosExtensionBaseTestCase, self).setUp() self.qos_ext = qos.QosAgentExtension() self.context = context.get_admin_context() self.connection = mock.Mock() # Don't rely on used driver mock.patch( 'neutron.manager.NeutronManager.load_cla...
, self.policy) self.assertFalse(self.driver.create_bandwidth_limit.called) self.rule.should_apply_to_port = mock.Mock(return_value=True) self.driver.create(self.port, self.policy) self.assertTrue(self.driver.create_bandwidth_limit.called) class QosExtensionBaseTestCase(base.BaseTestCase...
64
64
104
12
52
wwriverrat/neutron
neutron/tests/unit/agent/l2/extensions/test_qos.py
Python
QosExtensionBaseTestCase
QosExtensionBaseTestCase
124
136
124
125
d27eaf31d54a516ccc0fb9f1b4d3915e081485dc
bigcode/the-stack
train
7eb7e4b4264d92863b46eef0
train
class
class QosFakeRule(rule.QosRule): rule_type = 'fake_type'
class QosFakeRule(rule.QosRule):
rule_type = 'fake_type'
def __init__(self): super(FakeDriver, self).__init__() self.create_bandwidth_limit = mock.Mock() self.update_bandwidth_limit = mock.Mock() self.delete_bandwidth_limit = mock.Mock() def initialize(self): pass class QosFakeRule(rule.QosRule):
64
64
18
10
53
wwriverrat/neutron
neutron/tests/unit/agent/l2/extensions/test_qos.py
Python
QosFakeRule
QosFakeRule
68
70
68
69
b31ef802e83050f9ca980ebf7dd7732b2b88ca26
bigcode/the-stack
train
5e22b41186865ea3d81917a0
train
class
class QosExtensionInitializeTestCase(QosExtensionBaseTestCase): @mock.patch.object(registry, 'subscribe') @mock.patch.object(resources_rpc, 'ResourcesPushRpcCallback') def test_initialize_subscribed_to_rpc(self, rpc_mock, subscribe_mock): self.qos_ext.initialize( self.connection, consta...
class QosExtensionInitializeTestCase(QosExtensionBaseTestCase): @mock.patch.object(registry, 'subscribe') @mock.patch.object(resources_rpc, 'ResourcesPushRpcCallback')
def test_initialize_subscribed_to_rpc(self, rpc_mock, subscribe_mock): self.qos_ext.initialize( self.connection, constants.EXTENSION_DRIVER_TYPE) self.connection.create_consumer.assert_has_calls( [mock.call( resources_rpc.resource_type_versioned_topic(resourc...
_driver.delete.assert_called_with(port2) self.assertIsNone(self.qos_ext.policy_map.get_port_policy(port2)) class QosExtensionInitializeTestCase(QosExtensionBaseTestCase): @mock.patch.object(registry, 'subscribe') @mock.patch.object(resources_rpc, 'ResourcesPushRpcCallback')
64
64
141
39
25
wwriverrat/neutron
neutron/tests/unit/agent/l2/extensions/test_qos.py
Python
QosExtensionInitializeTestCase
QosExtensionInitializeTestCase
279
293
279
282
f37e059f36347498ad1b2f61ed33fedccdbe6003
bigcode/the-stack
train
1d6de0f9565f7f1e7507a525
train
class
class PortPolicyMapTestCase(base.BaseTestCase): def setUp(self): super(PortPolicyMapTestCase, self).setUp() self.policy_map = qos.PortPolicyMap() def test_update_policy(self): self.policy_map.update_policy(TEST_POLICY) self.assertEqual(TEST_POLICY, self...
class PortPolicyMapTestCase(base.BaseTestCase):
def setUp(self): super(PortPolicyMapTestCase, self).setUp() self.policy_map = qos.PortPolicyMap() def test_update_policy(self): self.policy_map.update_policy(TEST_POLICY) self.assertEqual(TEST_POLICY, self.policy_map.known_policies[TEST_POLICY.id]) ...
.new_policy.rules = [] self.assertTrue(self.qos_ext._policy_rules_modified(self.policy, self.new_policy)) def test_is_reflush_required_add_rules(self): self.qos_ext.policy_map.set_port_policy(self.port, self.policy) self.new_policy...
130
130
435
11
119
wwriverrat/neutron
neutron/tests/unit/agent/l2/extensions/test_qos.py
Python
PortPolicyMapTestCase
PortPolicyMapTestCase
351
405
351
352
edbc2c079074f2a224a0b02d4256853b09c278b0
bigcode/the-stack
train
054fffe4bb65fd4ea28329d3
train
class
class QosExtensionRpcTestCase(QosExtensionBaseTestCase): def setUp(self): super(QosExtensionRpcTestCase, self).setUp() self.qos_ext.initialize( self.connection, constants.EXTENSION_DRIVER_TYPE) self.pull_mock = mock.patch.object( self.qos_ext.resource_rpc, 'pull', ...
class QosExtensionRpcTestCase(QosExtensionBaseTestCase):
def setUp(self): super(QosExtensionRpcTestCase, self).setUp() self.qos_ext.initialize( self.connection, constants.EXTENSION_DRIVER_TYPE) self.pull_mock = mock.patch.object( self.qos_ext.resource_rpc, 'pull', return_value=TEST_POLICY).start() def _cre...
): self.policy.rules.append(self.fake_rule) rules = list(self.driver._iterate_rules(self.policy.rules)) self.assertEqual(1, len(rules)) self.assertIsInstance(rules[0], rule.QosBandwidthLimitRule) def test__handle_update_create_rules_checks_should_apply_to_port(self): self.ru...
256
256
1,458
14
242
wwriverrat/neutron
neutron/tests/unit/agent/l2/extensions/test_qos.py
Python
QosExtensionRpcTestCase
QosExtensionRpcTestCase
139
276
139
140
5d6ddbaa3bceb6eef2fabfca21834df0be842683
bigcode/the-stack
train
7deeabd09b51350defe80c9e
train
class
class FakeDriver(qos.QosAgentDriver): SUPPORTED_RULES = {qos_consts.RULE_TYPE_BANDWIDTH_LIMIT} def __init__(self): super(FakeDriver, self).__init__() self.create_bandwidth_limit = mock.Mock() self.update_bandwidth_limit = mock.Mock() self.delete_bandwidth_limit = mock.Mock() ...
class FakeDriver(qos.QosAgentDriver):
SUPPORTED_RULES = {qos_consts.RULE_TYPE_BANDWIDTH_LIMIT} def __init__(self): super(FakeDriver, self).__init__() self.create_bandwidth_limit = mock.Mock() self.update_bandwidth_limit = mock.Mock() self.delete_bandwidth_limit = mock.Mock() def initialize(self): pass
': TEST_POLICY.id} TEST_PORT2 = {'port_id': 'test_port_id_2', 'qos_policy_id': TEST_POLICY2.id} FAKE_RULE_ID = uuidutils.generate_uuid() REALLY_FAKE_RULE_ID = uuidutils.generate_uuid() class FakeDriver(qos.QosAgentDriver):
64
64
83
10
54
wwriverrat/neutron
neutron/tests/unit/agent/l2/extensions/test_qos.py
Python
FakeDriver
FakeDriver
54
65
54
55
fe7ed0b635342c3cabc71f16a23ce99a527b687b
bigcode/the-stack
train
81c67725f13aceeb0870a49b
train
class
class QosExtensionReflushRulesTestCase(QosExtensionBaseTestCase): def setUp(self): super(QosExtensionReflushRulesTestCase, self).setUp() self.qos_ext.initialize( self.connection, constants.EXTENSION_DRIVER_TYPE) self.pull_mock = mock.patch.object( self.qos_ext.resou...
class QosExtensionReflushRulesTestCase(QosExtensionBaseTestCase):
def setUp(self): super(QosExtensionReflushRulesTestCase, self).setUp() self.qos_ext.initialize( self.connection, constants.EXTENSION_DRIVER_TYPE) self.pull_mock = mock.patch.object( self.qos_ext.resource_rpc, 'pull', return_value=TEST_POLICY).start() ...
Case(QosExtensionBaseTestCase): @mock.patch.object(registry, 'subscribe') @mock.patch.object(resources_rpc, 'ResourcesPushRpcCallback') def test_initialize_subscribed_to_rpc(self, rpc_mock, subscribe_mock): self.qos_ext.initialize( self.connection, constants.EXTENSION_DRIVER_TYPE) ...
151
151
505
16
135
wwriverrat/neutron
neutron/tests/unit/agent/l2/extensions/test_qos.py
Python
QosExtensionReflushRulesTestCase
QosExtensionReflushRulesTestCase
296
348
296
297
15d73bbc4a312dd212942447b0671973ab851642
bigcode/the-stack
train
880bc127314715b834ea04cb
train
class
class QosAgentDriverTestCase(base.BaseTestCase): def setUp(self): super(QosAgentDriverTestCase, self).setUp() self.driver = FakeDriver() self.policy = TEST_POLICY self.rule = ( rule.QosBandwidthLimitRule(context=None, id=FAKE_RULE_ID, ...
class QosAgentDriverTestCase(base.BaseTestCase):
def setUp(self): super(QosAgentDriverTestCase, self).setUp() self.driver = FakeDriver() self.policy = TEST_POLICY self.rule = ( rule.QosBandwidthLimitRule(context=None, id=FAKE_RULE_ID, qos_policy_id=self.policy.id, ...
= uuidutils.generate_uuid() REALLY_FAKE_RULE_ID = uuidutils.generate_uuid() class FakeDriver(qos.QosAgentDriver): SUPPORTED_RULES = {qos_consts.RULE_TYPE_BANDWIDTH_LIMIT} def __init__(self): super(FakeDriver, self).__init__() self.create_bandwidth_limit = mock.Mock() self.update_ban...
131
131
438
12
119
wwriverrat/neutron
neutron/tests/unit/agent/l2/extensions/test_qos.py
Python
QosAgentDriverTestCase
QosAgentDriverTestCase
73
121
73
74
c88d878c9a49f010217128749695444b41116883
bigcode/the-stack
train
94bbe0aea839683342480c1a
train
class
class PadUfes20Downloader(FileDownloader): __title__ = "PAD-UFES-20" __archive_name__ = "pad_ufes_20.zip" __extracted_name__ = "PAD_UFES_20" def _download(self): """Downloads the PAD_UFES_20 zip archive.""" download_file(self.url, self.archive_path, self.size) def _extract(self): ...
class PadUfes20Downloader(FileDownloader):
__title__ = "PAD-UFES-20" __archive_name__ = "pad_ufes_20.zip" __extracted_name__ = "PAD_UFES_20" def _download(self): """Downloads the PAD_UFES_20 zip archive.""" download_file(self.url, self.archive_path, self.size) def _extract(self): """Extracts the PAD_UFES_20 zip arch...
""" Author: David Walshe Date: 11 April 2021 """ import logging import os import shutil from zipfile import ZipFile import glob import pandas as pd from requests import Session from sla_cli.src.download import FileDownloader, download_file, unzip_file logger = logging.getLogger(__name__) class PadUfes20Do...
81
150
500
9
72
DavidWalshe93/SL-CLI
sla_cli/src/download/pad_ufes_20/download.py
Python
PadUfes20Downloader
PadUfes20Downloader
20
76
20
20
d478b6e1523277bcfd8c0663b6f1cbc76e98bd01
bigcode/the-stack
train
41a3439e5b9bda52509d6d42
train
class
class Migration(migrations.Migration): dependencies = [ ('v1', '0001_initial'), ] operations = [ migrations.AlterField( model_name='myuser', name='is_active', field=models.BooleanField(default=False), ), ]
class Migration(migrations.Migration):
dependencies = [ ('v1', '0001_initial'), ] operations = [ migrations.AlterField( model_name='myuser', name='is_active', field=models.BooleanField(default=False), ), ]
# -*- coding: utf-8 -*- # Generated by Django 1.11.7 on 2018-10-31 12:05 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration):
54
64
57
7
46
General-ITer/Django-Introduction
login_register/v1/migrations/0002_auto_20181031_1205.py
Python
Migration
Migration
8
20
8
9
43ad5fd98d5862082b1fb58bccec0162a90bf726
bigcode/the-stack
train
10d95ccd7c36d17fb463585d
train
class
class Customer: name = "" lastName = "" age = 0 def addCart(self): print("Added to",self.name,self.lastName,"'s cart")
class Customer:
name = "" lastName = "" age = 0 def addCart(self): print("Added to",self.name,self.lastName,"'s cart")
class Customer:
3
64
40
3
0
ZnoKunG/PythonProject
OOPclassExample.py
Python
Customer
Customer
1
7
1
1
e9f89c6c89d153d864d90b813db219ece57302aa
bigcode/the-stack
train
6ce45a418717afd0ecdf70cd
train
class
class ReorgsRestoreTest(infincoincashTestFramework): def set_test_params(self): self.num_nodes = 3 def skip_test_if_missing_module(self): self.skip_if_no_wallet() def run_test(self): # Send a tx from which to conflict outputs later txid_conflict_from = self.nodes[0].sendtoa...
class ReorgsRestoreTest(infincoincashTestFramework):
def set_test_params(self): self.num_nodes = 3 def skip_test_if_missing_module(self): self.skip_if_no_wallet() def run_test(self): # Send a tx from which to conflict outputs later txid_conflict_from = self.nodes[0].sendtoaddress(self.nodes[0].getnewaddress(), Decimal("10")) ...
#!/usr/bin/env python3 # Copyright (c) 2019 The Bitcoin Core developers # Copyright (c) 2021 The INFINCOIN CASH developers # Distributed under the MIT software license, see the accompanying # file COPYING or https://www.opensource.org/licenses/mit-license.php. """Test tx status in case of reorgs while wallet being shu...
206
256
961
14
192
INFINCOIN/INFINCOINCASH
test/functional/wallet_reorgsrestore.py
Python
ReorgsRestoreTest
ReorgsRestoreTest
28
103
28
28
0050d046e11d56c00e4290b26b216fd156319486
bigcode/the-stack
train
ba23b0582416814d773d3bef
train
class
class StateMachine(QObject): """ Class for handling all state machine management at the python level. This will do things like initialize the screen at start time with the available hauls, the selected haul, the species associated with the selected haul, etc... It works hand in hand with teh Trawl...
class StateMachine(QObject):
""" Class for handling all state machine management at the python level. This will do things like initialize the screen at start time with the available hauls, the selected haul, the species associated with the selected haul, etc... It works hand in hand with teh TrawlBackdeckStateMachine.qml (whi...
__author__ = 'Todd.Hay' # ------------------------------------------------------------------------------- # Name: StateMachine.py # Purpose: # # Author: Todd.Hay # Email: Todd.Hay@noaa.gov # # Created: Feb 03, 2016 # License: MIT #-------------------------------------------------------------...
139
256
3,005
5
133
nwfsc-fram/pyFieldSoftware
py/trawl/StateMachine.py
Python
StateMachine
StateMachine
22
341
22
22
72bb0e1d508c71ffe68b45fcba4c5d51020e608e
bigcode/the-stack
train
6f915f1d20b829e761d1d0ef
train
class
class Light(FCurveAnimatable): def __init__(self, light, meshesAndNodes): if light.parent and light.parent.type != 'ARMATURE': self.parentId = light.parent.name self.name = light.name Logger.log('processing begun of light (' + light.data.type + '): ' + self.name) self.d...
class Light(FCurveAnimatable):
def __init__(self, light, meshesAndNodes): if light.parent and light.parent.type != 'ARMATURE': self.parentId = light.parent.name self.name = light.name Logger.log('processing begun of light (' + light.data.type + '): ' + self.name) self.define_animations(light, False, ...
from .logger import * from .package_level import * from .f_curve_animatable import * import bpy from mathutils import Color, Vector # used in Light constructor, never formally defined in Babylon, but used in babylonFileLoader POINT_LIGHT = 0 DIRECTIONAL_LIGHT = 1 SPOT_LIGHT = 2 HEMI_LIGHT = 3 #used in ShadowGenerat...
149
256
970
8
141
vousk/Babylon.js
Exporters/Blender/src/light_shadow.py
Python
Light
Light
22
108
22
22
30600537a93a92d4b0a835b1c5d3e0fe235460a8
bigcode/the-stack
train
eaf5ff5db28cd2a8a4589904
train
class
class ShadowGenerator: def __init__(self, lamp, meshesAndNodes, scene): Logger.log('processing begun of shadows for light: ' + lamp.name) self.lightId = lamp.name self.mapSize = lamp.data.shadowMapSize self.shadowBias = lamp.data.shadowBias if lamp.data.shadowMap == VARIANC...
class ShadowGenerator:
def __init__(self, lamp, meshesAndNodes, scene): Logger.log('processing begun of shadows for light: ' + lamp.name) self.lightId = lamp.name self.mapSize = lamp.data.shadowMapSize self.shadowBias = lamp.data.shadowBias if lamp.data.shadowMap == VARIANCE_SHADOWS: ...
) write_float(file_handler, 'intensity', self.intensity) write_color(file_handler, 'diffuse', self.diffuse) write_color(file_handler, 'specular', self.specular) if hasattr(self, 'includedOnlyMeshesIds'): file_handler.write(',"includedOnlyMeshesIds":[') fir...
146
146
489
4
142
vousk/Babylon.js
Exporters/Blender/src/light_shadow.py
Python
ShadowGenerator
ShadowGenerator
110
157
110
110
8766dac7360d171ca1040b7c6a18372970c2aeee
bigcode/the-stack
train
aff405a33026a4f40be58471
train
class
class LightPanel(bpy.types.Panel): bl_label = get_title() bl_space_type = 'PROPERTIES' bl_region_type = 'WINDOW' bl_context = 'data' @classmethod def poll(cls, context): ob = context.object return ob is not None and isinstance(ob.data, bpy.types.Lamp) def draw(self, context...
class LightPanel(bpy.types.Panel):
bl_label = get_title() bl_space_type = 'PROPERTIES' bl_region_type = 'WINDOW' bl_context = 'data' @classmethod def poll(cls, context): ob = context.object return ob is not None and isinstance(ob.data, bpy.types.Lamp) def draw(self, context): ob = context.object ...
.IntProperty( name='Blur Scale', description='', default = 2 ) bpy.types.Lamp.shadowBlurBoxOffset = bpy.props.IntProperty( name='Blur Box Offset', description='', default = 0 ) #=============================================================================== class LightPanel(bpy.types.Panel):
64
64
171
8
56
vousk/Babylon.js
Exporters/Blender/src/light_shadow.py
Python
LightPanel
LightPanel
199
222
199
199
45f337a4c6a7312c06653eb6045dfa3789404d38
bigcode/the-stack
train
0c158f27663b627a69b98ced
train
function
def main(ranking_top_k_path, mode, output_path, jsonl_corpus_path, labels_path): #loading corpus as a json, structrue: { "d_id": [para_0_text, .... para_N_text]} json_corpus = load_json_corpus(jsonl_corpus_path) #structure: {q_id: [rank1_id, ... rank_k_id} first_stage_ranking_dict = load_ranking(r...
def main(ranking_top_k_path, mode, output_path, jsonl_corpus_path, labels_path): #loading corpus as a json, structrue: { "d_id": [para_0_text, .... para_N_text]}
json_corpus = load_json_corpus(jsonl_corpus_path) #structure: {q_id: [rank1_id, ... rank_k_id} first_stage_ranking_dict = load_ranking(ranking_top_k_path, top_k=500) #note: do re-sampling in training phase! """ final steps to create output! """ queries_train = json.loads(open(labels_pat...
: ranking_topk_lines = ranking_file.read().splitlines() for ranking_line in ranking_topk_lines: q_id, run_name, c_id, rank_number, score_rel, run_mode = ranking_line.split(" ") if int(rank_number) > top_k: continue if q_id not in ranking_dict: ra...
143
143
477
51
91
sophiaalthammer/parm
preprocessing/coliee21_task1_json_lines.py
Python
main
main
54
93
54
55
ff57837dd654436bcffca0bd307578f3e08304a9
bigcode/the-stack
train
96fcba856da0c1ca65e6792d
train
function
def load_json_corpus(path): with open(path) as fp: cnt = 0 json_corpus = dict() qid_text = dict() cur_id = "" for line in fp: cnt += 1 if cnt % 10000 == 0: print("{} lines parsed".format(cnt)) line_dict = ast.liter...
def load_json_corpus(path):
with open(path) as fp: cnt = 0 json_corpus = dict() qid_text = dict() cur_id = "" for line in fp: cnt += 1 if cnt % 10000 == 0: print("{} lines parsed".format(cnt)) line_dict = ast.literal_eval(line) id...
import argparse import random import jsonlines import ast import json random.seed(42) def load_json_corpus(path):
28
76
254
7
21
sophiaalthammer/parm
preprocessing/coliee21_task1_json_lines.py
Python
load_json_corpus
load_json_corpus
8
40
8
8
4d7117776aa5a55d3c6ecd096d4c4cf94c0a51ad
bigcode/the-stack
train
e861003e656e4c6d71cf4140
train
function
def load_ranking(qrel_path, top_k=500): ranking_dict = dict() with open(qrel_path, 'r') as ranking_file: ranking_topk_lines = ranking_file.read().splitlines() for ranking_line in ranking_topk_lines: q_id, run_name, c_id, rank_number, score_rel, run_mode = ranking_line.split(" ")...
def load_ranking(qrel_path, top_k=500):
ranking_dict = dict() with open(qrel_path, 'r') as ranking_file: ranking_topk_lines = ranking_file.read().splitlines() for ranking_line in ranking_topk_lines: q_id, run_name, c_id, rank_number, score_rel, run_mode = ranking_line.split(" ") if int(rank_number) > top_k...
id_text = dict() cur_id = id_ qid_text[id_] = [contents] # contents: one paragraph of a doc json_corpus.update(qid_text) #for last one! return json_corpus def load_ranking(qrel_path, top_k=500):
64
64
124
13
50
sophiaalthammer/parm
preprocessing/coliee21_task1_json_lines.py
Python
load_ranking
load_ranking
42
52
42
42
f5cd7dd6bc6b4c0447e2818b3b177531f9521a80
bigcode/the-stack
train
2f22f9632595afe883e93a35
train
class
class GcsCorpusTest(unittest.TestCase): """GcsCorpus tests.""" def setUp(self): test_helpers.patch_environ(self) test_helpers.patch(self, [ 'clusterfuzz._internal.fuzzing.corpus_manager._count_corpus_files', 'multiprocessing.cpu_count', 'subprocess.Popen', ]) self.mock.Pope...
class GcsCorpusTest(unittest.TestCase):
"""GcsCorpus tests.""" def setUp(self): test_helpers.patch_environ(self) test_helpers.patch(self, [ 'clusterfuzz._internal.fuzzing.corpus_manager._count_corpus_files', 'multiprocessing.cpu_count', 'subprocess.Popen', ]) self.mock.Popen.return_value.poll.return_value = 0 ...
2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
227
227
759
9
217
mspectorgoogle/clusterfuzz
src/clusterfuzz/_internal/tests/core/fuzzing/corpus_manager_test.py
Python
GcsCorpusTest
GcsCorpusTest
30
104
30
30
4376fe18aab84bde7249466c70cdab7ef1d51c36
bigcode/the-stack
train
7c5bf824c4c056d4db9e8ed2
train
class
class FileHashTest(FileMixin, fake_filesystem_unittest.TestCase): """Tests utils.file_hash works as expected.""" def test_sha1sum(self): """Test that the correct sha1sum is calculated.""" self.assertEqual(self.FILE_SHA1SUM, utils.file_hash(self.FILE_PATH))
class FileHashTest(FileMixin, fake_filesystem_unittest.TestCase):
"""Tests utils.file_hash works as expected.""" def test_sha1sum(self): """Test that the correct sha1sum is calculated.""" self.assertEqual(self.FILE_SHA1SUM, utils.file_hash(self.FILE_PATH))
'illegaly:named:file') def setUp(self): test_utils.set_up_pyfakefs(self) self.fs.create_dir(self.DIRECTORY) self.fs.create_file(self.FILE_PATH, contents=self.FILE_CONTENTS) class FileHashTest(FileMixin, fake_filesystem_unittest.TestCase):
64
64
62
15
49
mspectorgoogle/clusterfuzz
src/clusterfuzz/_internal/tests/core/fuzzing/corpus_manager_test.py
Python
FileHashTest
FileHashTest
348
353
348
348
6131369593bb8a336907edf4c89e12b271a2e06e
bigcode/the-stack
train
2ad2487208c703eb1cb22858
train
class
class RsyncErrorHandlingTest(unittest.TestCase): """Rsync error handling tests.""" def setUp(self): test_helpers.patch(self, [ 'clusterfuzz._internal.fuzzing.corpus_manager._count_corpus_files', 'clusterfuzz._internal.google_cloud_utils.gsutil.GSUtilRunner.run_gsutil', ]) def test_rsync_...
class RsyncErrorHandlingTest(unittest.TestCase):
"""Rsync error handling tests.""" def setUp(self): test_helpers.patch(self, [ 'clusterfuzz._internal.fuzzing.corpus_manager._count_corpus_files', 'clusterfuzz._internal.google_cloud_utils.gsutil.GSUtilRunner.run_gsutil', ]) def test_rsync_error_below_threshold(self): """Test rsync re...
"""Test upload_files.""" mock_popen = self.mock.Popen.return_value self.mock.cpu_count.return_value = 1 corpus = corpus_manager.GcsCorpus('bucket') self.assertTrue(corpus.upload_files(['/dir/a', '/dir/b'])) self.assertEqual(self.mock.Popen.call_args[0][0], [ '/gsutil_path/gsutil', '-m', '...
213
214
715
10
203
mspectorgoogle/clusterfuzz
src/clusterfuzz/_internal/tests/core/fuzzing/corpus_manager_test.py
Python
RsyncErrorHandlingTest
RsyncErrorHandlingTest
107
189
107
107
b3cb75ccd7046179ea347ad420c73740ae016481
bigcode/the-stack
train
6aeca1a21798f047f388a5a7
train
class
class CorpusBackupTest(fake_filesystem_unittest.TestCase): """Corpus backup tests.""" def _mock_make_archive(self, archive_path, backup_format, _): path = archive_path + '.' + backup_format self.fs.create_file(path) return path def setUp(self): """Setup for corpus backup test.""" test_helpe...
class CorpusBackupTest(fake_filesystem_unittest.TestCase):
"""Corpus backup tests.""" def _mock_make_archive(self, archive_path, backup_format, _): path = archive_path + '.' + backup_format self.fs.create_file(path) return path def setUp(self): """Setup for corpus backup test.""" test_helpers.patch_environ(self) test_utils.set_up_pyfakefs(self...
mock_popen = self.mock.Popen.return_value corpus = corpus_manager.FuzzTargetCorpus('libFuzzer', 'fuzzer') self.assertTrue(corpus.upload_files(['/dir/a', '/dir/b'])) mock_popen.communicate.assert_called_with(b'/dir/a\n/dir/b') self.assertEqual(self.mock.Popen.call_args[0][0], [ '/gsutil_pat...
120
121
405
12
108
mspectorgoogle/clusterfuzz
src/clusterfuzz/_internal/tests/core/fuzzing/corpus_manager_test.py
Python
CorpusBackupTest
CorpusBackupTest
283
330
283
283
9f250627340153a290bc70a4cdaacd5b6333d7a8
bigcode/the-stack
train
b33d17f39c2d58441f9060b3
train
class
class LegalizeFilenamesTest(FileMixin, fake_filesystem_unittest.TestCase): """Tests for legalize_filenames.""" def test_rename_illegal(self): """Test that illegally named files are renamed.""" legally_named = corpus_manager.legalize_filenames([self.FILE_PATH]) # pylint: disable=unnecessary-comprehensio...
class LegalizeFilenamesTest(FileMixin, fake_filesystem_unittest.TestCase):
"""Tests for legalize_filenames.""" def test_rename_illegal(self): """Test that illegally named files are renamed.""" legally_named = corpus_manager.legalize_filenames([self.FILE_PATH]) # pylint: disable=unnecessary-comprehension self.assertEqual([os.path.join(self.DIRECTORY, self.FILE_SHA1SUM)], ...
, 'illegaly:named:file') def setUp(self): test_utils.set_up_pyfakefs(self) self.fs.create_dir(self.DIRECTORY) self.fs.create_file(self.FILE_PATH, contents=self.FILE_CONTENTS) class FileHashTest(FileMixin, fake_filesystem_unittest.TestCase): """Tests utils.file_hash works as expected.""" def test_s...
129
129
433
17
112
mspectorgoogle/clusterfuzz
src/clusterfuzz/_internal/tests/core/fuzzing/corpus_manager_test.py
Python
LegalizeFilenamesTest
LegalizeFilenamesTest
356
395
356
356
207e5559630ec9d0c6755dcd9036c36322d3d0b1
bigcode/the-stack
train
0be93d9e997c5e01f74a6852
train
class
class FileMixin(object): """Mixin with a setUp implementation and attributes that are useful for test classes dealing with cleaning filenames for Windows.""" # Make the content greater than chunk size. FILE_CONTENTS = 'hello' * 30000 FILE_SHA1SUM = 'bf720c91eb988c589a486407d7912da17bdb201f' DIRECTORY = '/co...
class FileMixin(object):
"""Mixin with a setUp implementation and attributes that are useful for test classes dealing with cleaning filenames for Windows.""" # Make the content greater than chunk size. FILE_CONTENTS = 'hello' * 30000 FILE_SHA1SUM = 'bf720c91eb988c589a486407d7912da17bdb201f' DIRECTORY = '/corpus' FILE_PATH = os.pa...
01-01.zip') ]) self.mock.copy_blob.assert_has_calls([ mock.call('gs://backup_bucket/corpus/libFuzzer/fuzzer/2017-01-01.zip', 'gs://backup_bucket/corpus/libFuzzer/fuzzer/latest.zip'), ]) class FileMixin(object):
63
64
148
5
58
mspectorgoogle/clusterfuzz
src/clusterfuzz/_internal/tests/core/fuzzing/corpus_manager_test.py
Python
FileMixin
FileMixin
333
345
333
333
88ba386583205dac84b4ca22b9ecc1afaafd13a1
bigcode/the-stack
train
0a9e0236082a4dfc960727f2
train
class
class FuzzTargetCorpusTest(fake_filesystem_unittest.TestCase): """FuzzTargetCorpus tests.""" def setUp(self): """Setup for fuzz target corpus test.""" test_helpers.patch_environ(self) os.environ['GSUTIL_PATH'] = '/gsutil_path' os.environ['CORPUS_BUCKET'] = 'bucket' test_helpers.patch(self, [ ...
class FuzzTargetCorpusTest(fake_filesystem_unittest.TestCase):
"""FuzzTargetCorpus tests.""" def setUp(self): """Setup for fuzz target corpus test.""" test_helpers.patch_environ(self) os.environ['GSUTIL_PATH'] = '/gsutil_path' os.environ['CORPUS_BUCKET'] = 'bucket' test_helpers.patch(self, [ 'clusterfuzz._internal.fuzzing.corpus_manager._count_co...
=60)) self.mock.run_gsutil.return_value = new_process.ProcessResult( command=['/fake'], return_code=1, output=output, time_executed=30.0, timed_out=True, ) self.assertFalse(corpus.rsync_to_disk('/dir', timeout=60)) def test_rsync_error_above_threshold(self): "...
219
219
732
14
205
mspectorgoogle/clusterfuzz
src/clusterfuzz/_internal/tests/core/fuzzing/corpus_manager_test.py
Python
FuzzTargetCorpusTest
FuzzTargetCorpusTest
192
280
192
192
c776298a7fec3fb99e3d669d8c9f44c216b78739
bigcode/the-stack
train
1c388a070e2bb068c3f38ba6
train
function
def load_and_align_data(image_paths, image_size, margin, gpu_memory_fraction): minsize = 20 # minimum size of face threshold = [ 0.6, 0.7, 0.7 ] # three steps's threshold factor = 0.709 # scale factor print('Creating networks and loading parameters') with tf.Graph().as_default(): gpu_...
def load_and_align_data(image_paths, image_size, margin, gpu_memory_fraction):
minsize = 20 # minimum size of face threshold = [ 0.6, 0.7, 0.7 ] # three steps's threshold factor = 0.709 # scale factor print('Creating networks and loading parameters') with tf.Graph().as_default(): gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=gpu_memory_fraction) ...
])) print('') # Print distance matrix print('Distance matrix') print(' ', end='') for i in range(nrof_images): print(' %1d ' % i, end='') print('') for i in range(nrof_images): prin...
137
138
461
17
121
guanfuchen/facenet
src/compare.py
Python
load_and_align_data
load_and_align_data
81
116
81
82
bd2c2040be36a144aa18086ead86206fcbbcc37f
bigcode/the-stack
train
45a5fa00dfffe420924296f4
train
function
def main(args): # print('args:', args) images = load_and_align_data(args.image_files, args.image_size, args.margin, args.gpu_memory_fraction) with tf.Graph().as_default(): with tf.Session() as sess: # Load the model facenet.load_model(args.model) # G...
def main(args): # print('args:', args)
images = load_and_align_data(args.image_files, args.image_size, args.margin, args.gpu_memory_fraction) with tf.Graph().as_default(): with tf.Session() as sess: # Load the model facenet.load_model(args.model) # Get input and output tensors imag...
, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. from __future__ import absolute_import from __future__ import division from __future__ import print_function from scipy import misc import tensorflow as tf import numpy as np import sys impor...
100
100
334
12
87
guanfuchen/facenet
src/compare.py
Python
main
main
40
78
40
42
f59c768bf326d5b63950c28410fb83d3ab130597
bigcode/the-stack
train
fde1281e04982b1637899218
train
function
def parse_arguments(argv): parser = argparse.ArgumentParser() parser.add_argument('model', type=str, help='Could be either a directory containing the meta_file and ckpt_file or a model protobuf (.pb) file') parser.add_argument('image_files', type=str, nargs='+', help='Images to compare') #...
def parse_arguments(argv):
parser = argparse.ArgumentParser() parser.add_argument('model', type=str, help='Could be either a directory containing the meta_file and ckpt_file or a model protobuf (.pb) file') parser.add_argument('image_files', type=str, nargs='+', help='Images to compare') # 默认输入图像大小160 parser.add...
2],:] aligned = misc.imresize(cropped, (image_size, image_size), interp='bilinear') prewhitened = facenet.prewhiten(aligned) img_list.append(prewhitened) images = np.stack(img_list) return images def parse_arguments(argv):
64
64
214
5
58
guanfuchen/facenet
src/compare.py
Python
parse_arguments
parse_arguments
118
133
118
118
f2b5ad94217c2c3c70927522cdcdd075949b5bb5
bigcode/the-stack
train
266e9e9bf86de8a1aaa31a5a
train
class
class IdentificationTypeNotFoundException(Exception): """ Raise if an identification type is supplied that does not exist in the application's identification type constants. """ pass
class IdentificationTypeNotFoundException(Exception):
""" Raise if an identification type is supplied that does not exist in the application's identification type constants. """ pass
class IdentificationTypeNotFoundException(Exception):
8
64
34
8
0
PhilipWafula/faulu-apis-demo
app/server/exceptions.py
Python
IdentificationTypeNotFoundException
IdentificationTypeNotFoundException
1
6
1
1
03fae5e7a8f2e31078294b14bc41ba1e17eedc6d
bigcode/the-stack
train
54bdaf58bcc2534e0f12c765
train
class
class RoleNotFoundException(Exception): """ Raise if provided role is not in organization's defined roles """ pass
class RoleNotFoundException(Exception):
""" Raise if provided role is not in organization's defined roles """ pass
class IdentificationTypeNotFoundException(Exception): """ Raise if an identification type is supplied that does not exist in the application's identification type constants. """ pass class RoleNotFoundException(Exception):
41
64
26
7
33
PhilipWafula/faulu-apis-demo
app/server/exceptions.py
Python
RoleNotFoundException
RoleNotFoundException
9
14
9
9
03e24600cea48e6382ec26b96bed192815436817
bigcode/the-stack
train
f740b256db64097b77be5200
train
class
class Magnet2(*jishaku.OPTIONAL_FEATURES, *jishaku.STANDARD_FEATURES): # pylint: disable=too-few-public-methods """ The extended Jishaku cog """ @jishaku.Feature.Command(name="jishaku", aliases=["jsk"], invoke_without_command=True, ignore_extra=False) async def jsk(self, ctx: commands.Context): ...
class Magnet2(*jishaku.OPTIONAL_FEATURES, *jishaku.STANDARD_FEATURES): # pylint: disable=too-few-public-methods
""" The extended Jishaku cog """ @jishaku.Feature.Command(name="jishaku", aliases=["jsk"], invoke_without_command=True, ignore_extra=False) async def jsk(self, ctx: commands.Context): """ override test """ return await ctx.send("The behavior of this command has been ...
orialis) R :license: MIT, see LICENSE for more details. """ from redbot.core import commands import jishaku class Magnet2(*jishaku.OPTIONAL_FEATURES, *jishaku.STANDARD_FEATURES): # pylint: disable=too-few-public-methods
64
64
110
35
28
flaree/jishaku
tests/subclassed_module_2.py
Python
Magnet2
Magnet2
22
32
22
22
430741746cb396cd147c99c5c19c4acd12b23b05
bigcode/the-stack
train
c2bea033d41057aa750f6cb8
train
function
def setup(bot: commands.Bot): """ The setup function for the extended cog """ bot.add_cog(Magnet2(bot=bot))
def setup(bot: commands.Bot):
""" The setup function for the extended cog """ bot.add_cog(Magnet2(bot=bot))
(name="jishaku", aliases=["jsk"], invoke_without_command=True, ignore_extra=False) async def jsk(self, ctx: commands.Context): """ override test """ return await ctx.send("The behavior of this command has been overridden directly.") def setup(bot: commands.Bot):
63
64
32
7
56
flaree/jishaku
tests/subclassed_module_2.py
Python
setup
setup
35
40
35
35
7a946c6a62d4766024640b7377736060989c9439
bigcode/the-stack
train
ef2c9d462047808ba22a4ba7
train
function
def fourier_transform(image): image_f_trans = np.fft.fft2(image) image_f_shift = np.fft.fftshift(image_f_trans) # flip the corners return image_f_shift
def fourier_transform(image):
image_f_trans = np.fft.fft2(image) image_f_shift = np.fft.fftshift(image_f_trans) # flip the corners return image_f_shift
# Bengisu Ayan - 2236974 # Ceren Gürsoy - 2237485 from math import sqrt import numpy as np import cv2 # fourier transform the image def fourier_transform(image):
49
64
46
6
42
BengisuA14/METU-ImageProcessing
THE2/the2_part2.py
Python
fourier_transform
fourier_transform
10
14
10
10
9fac32184edd054b022fe2b0e5599ab076d3d434
bigcode/the-stack
train
fe4689bdbed45f19fb722d2a
train
function
def butter_worth_filter(size_x, size_y, r, n): b_filter = np.zeros([size_x, size_y]) for u in range(size_x): for v in range(size_y): val = pow((u - int(size_x / 2)), 2) + pow((v - int(size_y / 2)), 2) if val != 0: # to prevent zero division x = pow(r / sqrt...
def butter_worth_filter(size_x, size_y, r, n):
b_filter = np.zeros([size_x, size_y]) for u in range(size_x): for v in range(size_y): val = pow((u - int(size_x / 2)), 2) + pow((v - int(size_y / 2)), 2) if val != 0: # to prevent zero division x = pow(r / sqrt(val), 2 * n) b_filter[u][v] = ...
ier_transform(image): image_f_trans = np.fft.fft2(image) image_f_shift = np.fft.fftshift(image_f_trans) # flip the corners return image_f_shift # butterworth filter def butter_worth_filter(size_x, size_y, r, n):
64
64
125
15
48
BengisuA14/METU-ImageProcessing
THE2/the2_part2.py
Python
butter_worth_filter
butter_worth_filter
18
27
18
18
9ae2a2a958a0a7e9ccb5c4def7c0c92613e66c2b
bigcode/the-stack
train
e669300f65fd558c470d620a
train
function
def apply_filter(f_shifted_image, r, n): b_filter = butter_worth_filter(f_shifted_image.shape[0], f_shifted_image.shape[1], r, n) filtered_image = np.multiply(f_shifted_image, b_filter) return filtered_image
def apply_filter(f_shifted_image, r, n):
b_filter = butter_worth_filter(f_shifted_image.shape[0], f_shifted_image.shape[1], r, n) filtered_image = np.multiply(f_shifted_image, b_filter) return filtered_image
0: # to prevent zero division x = pow(r / sqrt(val), 2 * n) b_filter[u][v] = 1 / (1 + x) return b_filter # apply butterworth filter to image def apply_filter(f_shifted_image, r, n):
64
64
59
12
51
BengisuA14/METU-ImageProcessing
THE2/the2_part2.py
Python
apply_filter
apply_filter
31
35
31
31
49d49af9cdbcbf025d1744f364a6de0b754ce84e
bigcode/the-stack
train