Search is not available for this dataset
id int64 0 10.8M | vector listlengths 1.54k 1.54k | ast_depth int64 3 164 | ast_data stringlengths 297 510k | full_path stringlengths 0 319 | code stringlengths 60 56.5k |
|---|---|---|---|---|---|
15,701 | [
0.029254425317049026,
0.007888108491897583,
0.06604838371276855,
-0.0473286509513855,
-0.0036180727183818817,
-0.0065002660267055035,
0.01287143025547266,
0.02113393321633339,
0.02917696349322796,
-0.0019349104259163141,
0.056391581892967224,
-0.021185575053095818,
-0.014601392671465874,
0... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "has_course_ended", "annotation": null, "type_comment": null}}], "... | def test_course_end(self, has_course_ended):
user1 = UserFactory.create(id=self.task.num_bins)
current_day, offset, target_day, upgrade_deadline = self._get_dates()
end_date_offset = -2 if has_course_ended else 2
self._schedule_factory(
enrollment__user=user1,
en... | |
15,702 | [
-0.016607310622930527,
-0.00801058579236269,
0.08185125142335892,
-0.03878946974873543,
0.01912120170891285,
0.033110421150922775,
0.01410644594579935,
-0.00797802209854126,
0.0027630007825791836,
-0.007307216990739107,
0.028603652492165565,
-0.04652652144432068,
-0.010166279971599579,
-0.... | 14 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "mock_ace", "annotation": null, "type_comment": null}}], "kwarg": ... | def test_multiple_target_schedules(self, mock_ace):
user = UserFactory.create()
current_day, offset, target_day, upgrade_deadline = self._get_dates()
num_courses = 3
for course_index in range(num_courses):
self._schedule_factory(
enrollment__user=user,
... | |
15,703 | [
0.020795760676264763,
0.006744571030139923,
0.053125716745853424,
-0.02776026353240013,
0.02529214136302471,
0.012768255546689034,
0.011466993018984795,
-0.007777028251439333,
0.012548323720693588,
0.014955353923141956,
0.01940286159515381,
0.011748016811907291,
0.05097527429461479,
-0.008... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "test_config", "annotation": null, "type_comment": null}}], "kwarg... | def _check_if_email_sent_for_experience(self, test_config):
current_day, offset, target_day, _ = self._get_dates(offset=test_config.offset)
kwargs = {
'offset': offset
}
if test_config.experience is None:
kwargs['experience'] = None
else:
kwar... | |
15,704 | [
0.01762797124683857,
0.007628680672496557,
0.04818404093384743,
-0.03407064080238342,
0.021418193355202675,
0.026104284450411797,
-0.0024326324928551912,
0.004183025564998388,
-0.001304180477745831,
0.008993159979581833,
0.04396656155586243,
-0.01736610196530819,
-0.006698353681713343,
-0.... | 15 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "offset", "annotation": null, "type_comment": null}}, {"_type": "a... | def _assert_template_for_offset(self, offset, message_count):
current_day, offset, target_day, upgrade_deadline = self._get_dates(offset)
user = UserFactory.create()
for course_index in range(message_count):
self._schedule_factory(
offset=offset,
enro... | |
15,705 | [
0.02069506049156189,
0.00011249562521697953,
0.018941989168524742,
-0.03473065793514252,
0.029173752292990685,
-0.004371652379631996,
0.011576885357499123,
-0.0186553243547678,
-0.025645557790994644,
0.02670401521027088,
-0.0001422130735591054,
-0.029063494876027107,
-0.03993474319577217,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "cls", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs"... | class SeleniumTests(test.LiveServerTestCase):
@classmethod
def setUpClass(cls):
if os.environ.get('WITH_SELENIUM', False):
cls.selenium = WebDriver()
super(SeleniumTests, cls).setUpClass()
@classmethod
def tearDownClass(cls):
super(SeleniumTests, cls).tearDownClass()... | |
15,706 | [
0.001123300869949162,
0.030830025672912598,
-0.00929334294050932,
-0.005570321809500456,
-0.025509798899292946,
-0.037082426249980927,
-0.008264538832008839,
-0.004410785157233477,
-0.01601751707494259,
-0.002407174790278077,
0.02317935787141323,
-0.0584770105779171,
0.019518861547112465,
... | 14 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs... | class image( IECore.ParameterisedProcedural ) :
def __init__( self ) :
IECore.ParameterisedProcedural.__init__( self )
self.parameters().addParameters(
[
IECore.ImagePrimitiveParameter(
name = "image",
description = "",
defaultValue = IECore.ImagePrimitive(
IECore.Box2i( IECor... | |
15,707 | [
0.001255116192623973,
0.011444239877164364,
-0.008111377246677876,
-0.0010547512210905552,
-0.02801782265305519,
-0.02530798129737377,
0.017359919846057892,
0.03012278862297535,
-0.01622275449335575,
0.035977981984615326,
0.03612314909696579,
-0.04817226529121399,
-0.0016996994381770492,
-... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def __init__( self ) :
IECore.ParameterisedProcedural.__init__( self )
self.parameters().addParameters(
[
IECore.ImagePrimitiveParameter(
name = "image",
description = "",
defaultValue = IECore.ImagePrimitive(
IECore.Box2i( IECore.V2i( 0 ), IECore.V2i( 10 ) ),
IECore.Box2i... | |
15,708 | [
0.010919171385467052,
0.02887660451233387,
0.07906533032655716,
-0.035914864391088486,
-0.0023680131416767836,
-0.006977964658290148,
0.018384991213679314,
0.0005402715178206563,
-0.04477299004793167,
0.014800081960856915,
-0.03707694634795189,
0.009866720996797085,
0.017847802489995956,
0... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {... | class Migration(migrations.Migration):
dependencies = [
('main', '0011_auto_20160807_1602'),
]
operations = [
migrations.CreateModel(
name='TestModel',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_nam... | |
15,709 | [
0.0519055537879467,
0.03492619842290878,
0.06961052119731903,
-0.0023930128663778305,
-0.0309836957603693,
0.009390648454427719,
-0.014633205719292164,
0.008042216300964355,
-0.0489063486456871,
0.022445645183324814,
0.03599042817950249,
-0.03163674846291542,
0.009862297214567661,
0.026847... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "argv", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def main(argv):
parser = GetParser()
options = parser.parse_args(argv)
logging.getLogger('sqlalchemy.engine').setLevel(logging.INFO)
# Check that we have no uncommitted files, and that our checkout's HEAD is
# contained in a remote branch. This is to ensure that we don't accidentally
# run uncommitted mig... | |
15,710 | [
0.003364990931004286,
-0.0032835202291607857,
0.0659666582942009,
-0.005115378648042679,
-0.049415744841098785,
0.01917773298919201,
-0.040152762085199356,
0.009144480340182781,
-0.038019705563783646,
0.02310808189213276,
-0.035175636410713196,
0.014486989937722683,
0.00798413809388876,
-0... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "platform", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs"... | def get_supported_targets(platform):
if platform == 'win32':
return ['win32', 'win10', 'android']
elif platform == 'darwin':
return ['macos', 'ios', 'android']
elif platform == 'linux':
return ['android', 'linux']
else:
return [] | |
15,711 | [
0.007468777243047953,
0.03186041861772537,
0.08918626606464386,
0.0029230837244540453,
-0.02235383540391922,
0.004863056819885969,
0.056772250682115555,
0.021017568185925484,
-0.05719222128391266,
0.03943896293640137,
-0.04470767080783844,
0.03714821860194206,
0.01152052916586399,
-0.06139... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "target", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "working_directory_path", "annotation": null, "type_comment": nu... | def build_for_target(target, working_directory_path, root_project_path):
if target == 'win32':
_build_win32(working_directory_path, root_project_path)
elif target == 'win10':
_build_win10(working_directory_path, root_project_path)
elif target == 'macos':
_build_macos(working_director... | |
15,712 | [
-0.05845307931303978,
-0.02443433366715908,
0.01020562369376421,
-0.0386531837284565,
-0.009895018301904202,
-0.010728230699896812,
0.04804038628935814,
-0.0006403166335076094,
-0.00797221902757883,
0.032125528901815414,
-0.0016738208942115307,
-0.004548158496618271,
0.012374935671687126,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "working_directory_path", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [],... | def _download_and_extract(working_directory_path):
source_folder_paths = {
'lua': os.path.join(working_directory_path, 'lua_source'),
'bit': os.path.join(working_directory_path, 'bit_source')
}
urls = get_download_info()
for key in ['lua', 'bit']:
build_utils.download_and_extract... | |
15,713 | [
-0.033200278878211975,
0.01792936772108078,
0.06286947429180145,
0.010704857297241688,
-0.015768103301525116,
-0.0031175995245575905,
0.04204827547073364,
-0.018294652923941612,
-0.03938981518149376,
0.052600931376218796,
-0.023154960945248604,
0.02617870271205902,
-0.0039826128631830215,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "working_directory_path", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "root_project_path", "annotation": null, "type_c... | def _build_win32(working_directory_path, root_project_path):
source_folder_paths = _download_and_extract(working_directory_path)
_patch_sources(source_folder_paths, working_directory_path)
build_utils.build_and_copy_libraries_win32_cmake(
os.path.join(working_directory_path, 'gen'),
source_... | |
15,714 | [
-0.020936928689479828,
-0.013026011176407337,
0.020608631893992424,
-0.04985890910029411,
0.00019062454521190375,
0.00864164624363184,
0.027195768430829048,
-0.02276904322206974,
-0.01960255764424801,
0.013428440317511559,
0.012189380824565887,
0.040370043367147446,
0.0095206368714571,
-0.... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "source_folder_paths", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "working_directory_path", "annotation": null, "type... | def _patch_sources(source_folder_paths, working_directory_path):
shutil.copyfile(
'CMakeLists.txt',
os.path.join(source_folder_paths['lua'], 'CMakeLists.txt'))
shutil.copyfile(
os.path.join(source_folder_paths['bit'], 'bit.c'),
os.path.join(source_folder_paths['lua'], 'src', 'bit... | |
15,715 | [
-0.02804647944867611,
0.004295676480978727,
0.041940152645111084,
0.010016599670052528,
-0.0194750614464283,
0.014700979925692081,
0.03448501229286194,
0.0031096311286091805,
-0.021827219054102898,
0.016465097665786743,
-0.017601309344172478,
0.0276876762509346,
-0.006373747251927853,
-0.0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "working_directory_path", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "root_project_path", "annotation": null, "type_c... | def _build_macos(working_directory_path, root_project_path):
source_folder_paths = _download_and_extract(working_directory_path)
_patch_sources(source_folder_paths, working_directory_path)
build_utils.build_and_copy_libraries_macos_cmake(
os.path.join(working_directory_path, 'gen'),
source_... | |
15,716 | [
-0.026969317346811295,
0.02341856248676777,
0.06346204876899719,
0.029965907335281372,
-0.008225231431424618,
-0.013074166141450405,
0.044907812029123306,
-0.001416197046637535,
-0.018328461796045303,
0.03838099166750908,
-0.02883705496788025,
0.004079263191670179,
-0.022084463387727737,
-... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "working_directory_path", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "root_project_path", "annotation": null, "type_c... | def _build_win10(working_directory_path, root_project_path):
source_folder_paths = _download_and_extract(working_directory_path)
_patch_sources(source_folder_paths, working_directory_path)
build_utils.build_and_copy_libraries_win10_cmake(
os.path.join(working_directory_path, 'gen'),
source_... | |
15,717 | [
-0.0288283322006464,
0.01730090007185936,
0.05913904309272766,
-0.01258070021867752,
-0.005232205614447594,
-0.0017505702562630177,
0.04688992723822594,
-0.04470537230372429,
-0.011371391825377941,
0.01866624690592289,
-0.044237252324819565,
-0.011946788989007473,
0.003920497372746468,
-0.... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "working_directory_path", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "root_project_path", "annotation": null, "type_c... | def _build_android(working_directory_path, root_project_path):
source_folder_paths = _download_and_extract(working_directory_path)
_patch_sources(source_folder_paths, working_directory_path)
build_utils.build_and_copy_libraries_android_cmake(
os.path.join(working_directory_path, 'gen'),
sou... | |
15,718 | [
-0.03031926415860653,
0.017666922882199287,
0.020995931699872017,
-0.0022320689167827368,
-0.011946506798267365,
-0.016866276040673256,
0.033521853387355804,
-0.02342947944998741,
-0.02132251299917698,
0.014664494432508945,
-0.017361413687467575,
-0.010397884994745255,
-0.011883297003805637,... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "working_directory_path", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "root_project_path", "annotation": null, "type_c... | def _build_ios(working_directory_path, root_project_path):
source_folder_paths = _download_and_extract(working_directory_path)
_patch_sources(source_folder_paths, working_directory_path)
build_utils.build_and_copy_libraries_ios_cmake(
os.path.join(working_directory_path, 'gen'),
source_fold... | |
15,719 | [
0.022045638412237167,
0.002818141132593155,
-0.013020776212215424,
-0.011386084370315075,
-0.016619369387626648,
-0.022828929126262665,
-0.02397548407316208,
-0.020683394744992256,
0.011119311675429344,
0.011601773090660572,
0.04681576415896416,
-0.034669093787670135,
-0.026518337428569794,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "name", "annotation": null, "type_comment": null}}], "kwarg": null... | def get_sweep_values_with_var(self, name):
if self.psf.sweep_value_w_var is not None:
if name in self.psf.sweep_value_w_var:
return self.psf.sweep_value_w_var[name]
else:
return None
elif self.psf.sweep_value is not None:
return self.ps... | |
15,720 | [
-0.03578809276223183,
-0.006077315658330917,
0.05731579661369324,
-0.0021486077457666397,
-0.0015621786005795002,
-0.002668925793841481,
0.011851009912788868,
-0.009808914735913277,
-0.015327959321439266,
0.018501287326216698,
-0.0025807777419686317,
0.02652275748550892,
0.006038138642907143... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "working_directory_path", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "root_project_path", "annotation": null, "type_c... | def _build_linux(working_directory_path, root_project_path):
source_folder_paths = _download_and_extract(working_directory_path)
_patch_sources(source_folder_paths, working_directory_path)
build_utils.build_and_copy_libraries_linux_cmake(
gen_folder_path=os.path.join(working_directory_path, 'gen'),... | |
15,721 | [
0.0025496918242424726,
-0.003637679386883974,
0.03293808922171593,
-0.028876950964331627,
-0.015009892173111439,
-0.017581267282366753,
0.028652464970946312,
0.004601945169270039,
0.011275275610387325,
-0.002780554350465536,
0.014928260818123817,
-0.0004333455872256309,
0.04763166233897209,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": {"_type": "arg", "_fields": {"arg": "mocked_objects", "annotation": null, "t... | def test_create_test_db_database_exists(self, *mocked_objects):
# Simulate test database creation raising "database exists"
creation = DatabaseCreation(connection)
with self.patch_test_db_creation(self._execute_raise_database_exists):
with mock.patch('builtins.input', return_value='n... | |
15,722 | [
-0.01525805052369833,
0.0016272920183837414,
0.06236741691827774,
-0.0280610304325819,
0.0031065260991454124,
-0.017788495868444443,
0.022849388420581818,
-0.013061407953500748,
-0.00932496227324009,
0.0015074997209012508,
0.0022181780077517033,
-0.02457224577665329,
0.032346636056900024,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "cursor", "annotation":... | class DatabaseCreationTests(SimpleTestCase):
def _execute_raise_database_exists(self, cursor, parameters, keepdb=False):
raise DatabaseError(1007, "Can't create database '%s'; database exists" % parameters['dbname'])
def _execute_raise_access_denied(self, cursor, parameters, keepdb=False):
rai... | |
15,723 | [
-0.00494199525564909,
-0.01683095470070839,
-0.049677688628435135,
-0.05715811625123024,
0.04423520341515541,
0.02515053004026413,
0.011586266569793224,
0.008751137182116508,
0.0007668483885936439,
-0.04473869130015373,
0.041118357330560684,
-0.015248557552695274,
0.0029055573977530003,
-0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "monkeypatch", "annotat... | class TestCache(object):
@pytest.fixture(autouse=True)
def enable_cache(self, monkeypatch):
monkeypatch.setattr('thefuck.utils.cache.disabled', False)
@pytest.fixture
def shelve(self, mocker):
value = {}
class _Shelve(object):
def __init__(self, path):
... | |
15,724 | [
0.01339466031640768,
0.033078569918870926,
0.030246008187532425,
-0.043064553290605545,
0.024580882862210274,
0.04198433831334114,
0.020200012251734734,
0.019635900855064392,
-0.010094004683196545,
0.0263812392950058,
0.03130221739411354,
0.006985387299209833,
-0.030077973380684853,
-0.034... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "base", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "n", "annotation": null, "type_comment": null}}], "kwarg": null, "... | def th(base, n):
for i in range(n):
# this will intern the string and check it
exec("check('%u', %u)" % (base + i, base + i))
with lock:
global n_finished
n_finished += 1 | |
15,725 | [
0.035896699875593185,
-0.02479296177625656,
0.048154670745134354,
-0.03945174068212509,
0.01270812377333641,
0.024077335372567177,
-0.01537440624088049,
-0.01965661719441414,
0.0072024245746433735,
0.0007094936445355415,
0.009205021895468235,
-0.026178043335676193,
0.04663108289241791,
0.0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs... | class TestCompatibilityCall(object):
def test_match(self):
def match(command):
assert command == Command()
return True
assert compatibility_call(match, Command())
def test_old_match(self, settings):
def match(command, _settings):
assert command == Co... | |
15,726 | [
0.03269701451063156,
0.030839519575238228,
0.06234061345458031,
-0.027277199551463127,
-0.03511430323123932,
0.0013772186357527971,
-0.006167267914861441,
-0.013371425680816174,
-0.007468150928616524,
0.03211177885532379,
-0.020737795159220695,
-0.04910913482308388,
-0.012722574174404144,
... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "orm", "annotation": nu... | class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Region'
db.create_table('widgets_region', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('slug', self.gf('django.db.models.fields.SlugField')(unique=True, max_leng... | |
15,727 | [
0.0224092286080122,
0.006318073254078627,
0.058614324778318405,
-0.008118059486150742,
-0.027664221823215485,
-0.0033493037335574627,
0.01547505147755146,
-0.004451644606888294,
0.03041856363415718,
0.01563209667801857,
-0.025223972275853157,
-0.024245455861091614,
0.007761686574667692,
-0... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "orm", "annotation": null, "type_comment": null}}], "kwarg": null,... | def forwards(self, orm):
# Adding model 'Region'
db.create_table('widgets_region', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('slug', self.gf('django.db.models.fields.SlugField')(unique=True, max_length=100, db_index=True)),
('... | |
15,728 | [
0.04967355355620384,
0.025115320459008217,
0.07028575986623764,
-0.011083701625466347,
-0.04024950787425041,
0.038021158427000046,
0.003835773328319192,
0.03806758299469948,
0.021471045911312103,
0.015598424710333347,
-0.0017133314395323396,
-0.0616973415017128,
-0.016851870343089104,
-0.0... | 7 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "orm", "annotation": null, "type_comment": null}}], "kwarg": null,... | def backwards(self, orm):
# Deleting model 'Region'
db.delete_table('widgets_region')
# Deleting model 'WidgetTemplate'
db.delete_table('widgets_widgettemplate')
# Deleting model 'Widget'
db.delete_table('widgets_widget') | |
15,729 | [
-0.009332572109997272,
0.057265717536211014,
-0.03664365038275719,
0.002710794797167182,
0.00592798599973321,
0.00665467930957675,
-0.006374301388859749,
0.028793074190616608,
-0.0009663017699494958,
0.018962688744068146,
-0.0011680020252242684,
-0.06797728687524796,
0.03753628209233284,
0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "account.invoice.refund"}}, "targets": [{"_type": "Name", "_fields": {"id": "_inherit", "ctx": {"_type": "Store", "_fields": {}}}}], "type... | class account_invoice_refund(orm.TransientModel):
_inherit = "account.invoice.refund"
def compute_refund(self, cr, uid, ids, mode='refund', context=None):
if context is None:
context = {}
if context.get('invoice_ids'):
context['active_ids'] = context.get('invoice_ids')
... | |
15,730 | [
0.03930441662669182,
-0.02131829224526882,
-0.0014057577354833484,
-0.026960255578160286,
0.020396897569298744,
0.01773368939757347,
-0.053870026022195816,
0.027263179421424866,
0.06068582087755203,
0.010589726269245148,
0.011201885528862476,
-0.03286727890372276,
-0.01573943719267845,
-0.... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def poll(self):
if not self.feeds:
arg = "-a"
if self.fetch:
arg += "u"
output = self.all_format.format(number=self.call_process(["canto", arg])[:-1])
return output
else:
if self.fetch:
call(["canto", "-u"])
... | |
15,731 | [
0.02983231469988823,
0.07306822389364243,
0.04123467952013016,
-0.021664496511220932,
-0.0007715504616498947,
-0.021408524364233017,
-0.013741015456616879,
-0.016405446454882622,
-0.0011860497761517763,
-0.0013693020446226,
-0.004345697816461325,
-0.06701799482107162,
0.02629525400698185,
... | 7 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "report_open_items_qweb_account"}}, "targets": [{"_type": "Name", "_fields": {"id": "_name", "ctx": {"_type": "Store", "_fields": {}}}}], ... | class OpenItemsReportAccount(models.TransientModel):
_name = 'report_open_items_qweb_account'
_order = 'code ASC'
report_id = fields.Many2one(
comodel_name='report_open_items_qweb',
ondelete='cascade',
index=True
)
# Data fields, used to keep link with real object
acco... | |
15,732 | [
0.013373149558901787,
0.09618335217237473,
0.052271518856287,
-0.03468330204486847,
-0.026347100734710693,
-0.009762750938534737,
-0.009522058069705963,
-0.025055576115846634,
0.013525784015655518,
0.004097654949873686,
0.005257091950625181,
-0.04757506772875786,
0.018128307536244392,
-0.0... | 7 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "report_open_items_qweb_move_line"}}, "targets": [{"_type": "Name", "_fields": {"id": "_name", "ctx": {"_type": "Store", "_fields": {}}}}]... | class OpenItemsReportMoveLine(models.TransientModel):
_name = 'report_open_items_qweb_move_line'
report_partner_id = fields.Many2one(
comodel_name='report_open_items_qweb_partner',
ondelete='cascade',
index=True
)
# Data fields, used to keep link with real object
move_line... | |
15,733 | [
0.027830759063363075,
0.013245020061731339,
0.054839786142110825,
-0.043140921741724014,
0.006103521212935448,
-0.005903494544327259,
-0.013991065323352814,
0.019040390849113464,
0.011001475155353546,
-0.013655886054039001,
-0.013482889160513878,
-0.04627647623419762,
-0.018078099936246872,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "xlsx_report", "annotation": null, "type_comment": null}}], "kwarg... | def print_report(self, xlsx_report=False):
self.ensure_one()
self.compute_data_for_report()
if xlsx_report:
report_name = 'account_financial_report_qweb.' \
'report_open_items_xlsx'
else:
report_name = 'account_financial_report_qweb.' \
... | |
15,734 | [
0.01582874171435833,
0.02069324627518654,
0.08180517703294754,
-0.01754787191748619,
0.01615983247756958,
-0.006819220259785652,
0.02401689998805523,
0.03685307875275612,
0.008531983941793442,
0.008296399377286434,
0.005447098985314369,
-0.02661469765007496,
-0.02867765538394451,
-0.044748... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def compute_data_for_report(self):
self.ensure_one()
# Compute report data
self._inject_account_values()
self._inject_partner_values()
self._inject_line_values()
self._inject_line_values(only_empty_partner_line=True)
self._clean_partners_and_accounts()
sel... | |
15,735 | [
0.06278789788484573,
0.0008848278084769845,
-0.011015783064067364,
-0.02980254963040352,
-0.04418713599443436,
0.049395348876714706,
0.06506132334470749,
0.023705635219812393,
0.013175537809729576,
-0.0030510411597788334,
0.06750009208917618,
-0.03248932585120201,
-0.04298842325806618,
-0.... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "ec2", "annotation": null, "type_comment": null}}, {"_type": "ar... | def wait_until_image_is_copied(module, ec2, wait_timeout, img, image_id, wait):
wait_timeout = time.time() + wait_timeout
while wait and wait_timeout > time.time() and (img is None or img.state != 'available'):
img = ec2.get_image(image_id)
time.sleep(3)
if wait and wait_timeout <= time.time... | |
15,736 | [
0.06254753470420837,
-0.01650313101708889,
0.0014465227723121643,
-0.005452918820083141,
-0.03922547772526741,
0.04406758025288582,
0.05090871825814247,
0.04035826399922371,
0.0010376927675679326,
0.03918105736374855,
0.042712680995464325,
-0.049709297716617584,
-0.05046448856592178,
-0.05... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "ec2", "annotation": null, "type_comment": null}}, {"_type": "ar... | def wait_until_image_is_recognized(module, ec2, wait_timeout, image_id, wait):
for i in range(wait_timeout):
try:
return ec2.get_image(image_id)
except boto.exception.EC2ResponseError as e:
# This exception we expect initially right after registering the copy with EC2 API
... | |
15,737 | [
0.007371942978352308,
0.03227553144097328,
0.03239569440484047,
-0.01654631644487381,
-0.01009962148964405,
0.037995245307683945,
0.015032274648547173,
-0.034822966903448105,
-0.01595752313733101,
0.01521251816302538,
0.02922341600060463,
-0.057004883885383606,
0.010357970371842384,
-0.026... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "app_client", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyarg... | def test_all_records_are_there(app_client):
failed = []
for record in [record.json for record in RecordMetadata.query.all()]:
try:
absolute_url = record['self']['$ref']
relative_url = absolute_url.partition('api')[2]
response = app_client.get(relative_url)
... | |
15,738 | [
0.05270637571811676,
0.009834785014390945,
0.03545905649662018,
-0.0070312549360096455,
-0.016832398250699043,
0.05876200273633003,
0.005469688214361668,
0.031735967844724655,
0.029111862182617188,
0.04364536330103874,
0.03779159113764763,
-0.09038582444190979,
0.0003069865924771875,
-0.01... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def main():
argument_spec = ec2_argument_spec()
argument_spec.update(dict(
source_region=dict(required=True),
source_image_id=dict(required=True),
name=dict(),
description=dict(default=""),
encrypted=dict(type='bool', required=False),
kms_key_id=dict(type='str', r... | |
15,739 | [
0.03547438234090805,
-0.002166277263313532,
-0.04698264226317406,
-0.02358175814151764,
-0.014051834121346474,
0.0033264297526329756,
-0.011225640773773193,
0.02780974470078945,
-0.027244506403803825,
-0.007382017560303211,
0.037237927317619324,
-0.020891223102808,
-0.07547067105770111,
-0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "sender", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "instance", "annotation": null, "type_comment": null}}, {"_type"... | def update_num_votes(sender, instance, action, **kwargs):
if(action == 'post_add'):
instance.num_votes = F('num_votes') + 1
elif(action == 'post_remove'):
instance.num_votes = F('num_votes') - 1
elif(action == 'post_clear'):
instance.num_votes = 0
instance.save() | |
15,740 | [
0.05507596954703331,
-0.016485163941979408,
-0.0057792142033576965,
-0.021141458302736282,
0.0035333752166479826,
-0.02739688567817211,
0.012710743583738804,
0.043670400977134705,
-0.02459840476512909,
0.023363782092928886,
0.032429445534944534,
0.006408284418284893,
-0.010059243068099022,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "instance", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "created", "annotation": null, "type_comment": null}}], "kwarg... | def answer_created(instance, created, **kwargs):
if created:
q = instance.for_question
q.num_answers = F('num_answers') + 1
q.save()
for follower in q.followers:
n = models.Notification(
owner=follower, message='New answer to ' + q.title, url='question/' +... | |
15,741 | [
0.06629402935504913,
-0.009598460048437119,
-0.0601271390914917,
-0.021323002874851227,
-0.012085107155144215,
0.002009522169828415,
0.031182561069726944,
0.03749864548444748,
-0.005958629306405783,
0.010649068281054497,
0.00916951335966587,
0.03518606349825859,
0.00908248033374548,
-0.020... | 20 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "sender", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "instance", "annotation": null, "type_comment": null}}, {"_type"... | def comment_created(sender, instance, created, **kwargs):
if created:
i = instance.for_item
# notifying all followers
for follower in i.followers:
if follower == instance.created_by:
continue
model = str(i.__class__).split('.')[2].split('\'')[0]
... | |
15,742 | [
-0.0005303992074914277,
0.01797955296933651,
0.026423199102282524,
-0.02560637891292572,
0.014436830766499043,
0.007208917289972305,
0.02792387083172798,
-0.00014610464859288186,
-0.003331393701955676,
0.05850715562701225,
0.007413122802972794,
-0.007783541455864906,
-0.022605037316679955,
... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "module_name", "annotation": null, "type_comment": null}}], "kwarg... | def _get_directory_containing_module(self, module_name):
module = sys.modules[module_name]
full_path = os.path.abspath(module.__file__)
if os.path.basename(full_path).lower().startswith('__init__.py'):
return os.path.dirname(os.path.dirname(full_path))
else:
# he... | |
15,743 | [
-0.017808368429541588,
0.03260229900479317,
0.02835889905691147,
-0.009623011574149132,
-0.003379648085683584,
-0.029680613428354263,
0.028080642223358154,
-0.05463087931275368,
-0.003141971305012703,
0.004689768888056278,
0.03842248022556305,
0.03501385077834129,
-0.0024622734636068344,
-... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "text", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def show_source(text):
shown = document.select(".show_source")
if not shown:
top = btn.offsetTop + btn.offsetHeight
else:
top = max(elt.offsetTop + elt.offsetHeight for elt in shown)
top += int(0.5 * btn.offsetHeight)
div = html.DIV(style=div_style, Class="show_source")
indent ... | |
15,744 | [
0.043499212712049484,
0.01952247880399227,
-0.007022473961114883,
-0.029654905200004578,
-0.015569828450679779,
-0.012239169329404831,
0.004955860320478678,
-0.024378016591072083,
0.010152490809559822,
0.03733949735760689,
0.005713284481316805,
-0.0010132426396012306,
0.007504015229642391,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "path", "annotation": null, "type_comment": null}}], "kwarg": null... | def _get_name_from_path(self, path):
path = _jython_aware_splitext(os.path.normpath(path))
_relpath = os.path.relpath(path, self._top_level_dir)
assert not os.path.isabs(_relpath), "Path must be within the project"
assert not _relpath.startswith('..'), "Path must be within the project"
... | |
15,745 | [
0.030581358820199966,
0.023711632937192917,
0.05120357125997543,
-0.03793339803814888,
-0.0021443450823426247,
-0.01847134903073311,
0.012937765568494797,
-0.029773157089948654,
-0.009405137039721012,
0.001465682638809085,
0.005132740829139948,
-0.06345697492361069,
-0.009724507108330727,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "orm", "annotation": nu... | class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'Submission.tags'
db.delete_column('demos_submission', 'tags')
def backwards(self, orm):
db.add_column('demos_submission', 'tags', self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank... | |
15,746 | [
-0.00026114811771549284,
0.020148567855358124,
-0.016263363882899284,
0.014687961898744106,
-0.015232838690280914,
-0.008670635521411896,
0.0038111708126962185,
-0.02410484105348587,
0.020681599155068398,
-0.006745802238583565,
0.05979422107338905,
-0.0020506882574409246,
0.02279003150761127... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "ev", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}... | def show(ev):
global state
if state == "on":
for div in document.select(".show_source"):
div.remove()
state = "off"
btn.text = "Show source code"
else:
scripts = document.select("script")
for script in scripts:
if not script.src:
... | |
15,747 | [
0.04166589304804802,
0.026038553565740585,
-0.06684210151433945,
0.015248749405145645,
0.002784211188554764,
-0.005857623182237148,
-0.029403794556856155,
0.040088437497615814,
0.032495610415935516,
0.0048559377901256084,
-0.0011955808149650693,
-0.05367559939622879,
0.025933390483260155,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "pyobject", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "parameters", "annotation": null, "type_comment": null}}], "kw... | def _handle_first_parameter(pyobject, parameters):
kind = pyobject.get_kind()
if parameters is None or kind not in ['method', 'classmethod']:
pass
if not parameters:
if not pyobject.get_param_names(special_args=False):
return
parameters.append(rope.base.pyobjects.get_unkn... | |
15,748 | [
0.03955584391951561,
0.007065987680107355,
-0.07386495172977448,
-0.014622432179749012,
-0.02078164555132389,
-0.004821866750717163,
-0.006142105907201767,
-0.019641051068902016,
0.03298601508140564,
0.006005234085023403,
-0.009774901904165745,
-0.03738871216773987,
0.029678288847208023,
-... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "pyfunction", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "parameter_index", "annotation": null, "type_comment": null}... | def get_passed_objects(pyfunction, parameter_index):
object_info = pyfunction.pycore.object_info
result = object_info.get_passed_objects(pyfunction,
parameter_index)
if not result:
statically_inferred = _parameter_objects(pyfunction)
if len(statica... | |
15,749 | [
-0.0008358474588021636,
0.03541390970349312,
-0.0034169331192970276,
-0.025163110345602036,
0.009594567120075226,
0.0015387512976303697,
0.013803504407405853,
-0.013894019648432732,
-0.00011155239917570725,
0.03824249655008316,
0.008344331756234169,
-0.025864599272608757,
-0.0246879067271947... | 6 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "assignment", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "pymodule", "annotation": null, "type_comment": null}}], "kw... | def _infer_assignment(assignment, pymodule):
result = _follow_pyname(assignment, pymodule)
if result is None:
return None
pyname, pyobject = result
pyobject = _follow_evaluations(assignment, pyname, pyobject)
if pyobject is None:
return None
return _follow_levels(assignment, pyob... | |
15,750 | [
0.023498546332120895,
0.057850342243909836,
-0.04646705090999603,
-0.027486484497785568,
-0.010064495727419853,
0.01761760003864765,
0.01836218312382698,
0.014702366665005684,
0.032610226422548294,
-0.006486709229648113,
0.017339957877993584,
-0.048309579491615295,
-0.004249804187566042,
0... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "pyobject", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "args", "annotation": null, "type_comment": null}}], "kwarg": ... | def _infer_returned(pyobject, args):
if args:
# HACK: Setting parameter objects manually
# This is not thread safe and might cause problems if `args`
# does not come from a good call site
pyobject.get_scope().invalidate_data()
pyobject._set_parameter_pyobjects(
ar... | |
15,751 | [
0.012506786733865738,
-0.0017468257574364543,
0.0001758956495905295,
-0.037775106728076935,
0.034038837999105453,
-0.007848585024476051,
0.026566307991743088,
0.014726711437106133,
-0.003751429496333003,
0.03588271141052246,
0.050463855266571045,
-0.032194968312978745,
0.0018211264396086335,... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "assignment", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "pyobject", "annotation": null, "type_comment": null}}], "kw... | def _follow_levels(assignment, pyobject):
for index in assignment.levels:
if isinstance(pyobject.get_type(), rope.base.builtins.Tuple):
holdings = pyobject.get_type().get_holding_objects()
if holdings:
pyobject = holdings[min(len(holdings) - 1, index)]
els... | |
15,752 | [
0.017490016296505928,
0.04019710421562195,
-0.032114919275045395,
-0.03636982664465904,
0.0282021164894104,
-0.002645952859893441,
-0.0000863609675434418,
-0.029741579666733742,
0.016164368018507957,
-0.009723208844661713,
0.0446016788482666,
0.01569397561252117,
-0.028159353882074356,
-0.... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "assignment", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "pymodule", "annotation": null, "type_comment": null}}, {"_t... | def _follow_pyname(assignment, pymodule, lineno=None):
assign_node = assignment.ast_node
if lineno is None:
lineno = _get_lineno_for_node(assign_node)
holding_scope = pymodule.get_scope().get_inner_scope_for_line(lineno)
pyname = evaluate.eval_node(holding_scope, assign_node)
if pyname is no... | |
15,753 | [
0.02934521809220314,
0.022078987210989,
-0.027879035100340843,
-0.044071730226278305,
-0.0012498939177021384,
-0.022661149501800537,
0.009314573369920254,
0.001093572936952114,
0.048685893416404724,
-0.022229919210076332,
0.03827168419957161,
-0.03848729655146599,
0.0027679591439664364,
-0... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "assignment", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "pyname", "annotation": null, "type_comment": null}}, {"_typ... | def _follow_evaluations(assignment, pyname, pyobject):
new_pyname = pyname
tokens = assignment.evaluation.split('.')
for token in tokens:
call = token.endswith('()')
if call:
token = token[:-2]
if token:
pyname = new_pyname
new_pyname = _get_attrib... | |
15,754 | [
0.009689629077911377,
-0.049143366515636444,
0.03319675475358963,
-0.01776069961488247,
0.005328209605067968,
-0.020139655098319054,
0.009575569070875645,
0.0012838486582040787,
-0.03504343330860138,
0.03971444442868233,
-0.005947390105575323,
-0.03910612687468529,
0.018119171261787415,
0.... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "in_planes", "annotation": null, "type_comment": null}}, {"_type":... | def __init__(self, in_planes, planes, stride=1):
super(PreActBlock, self).__init__()
self.bn1 = nn.BatchNorm2d(in_planes)
self.conv1 = nn.Conv2d(in_planes, planes, kernel_size=3, stride=stride, padding=1, bias=False)
self.bn2 = nn.BatchNorm2d(planes)
self.conv2 = nn.Conv2d(planes... | |
15,755 | [
0.014727710746228695,
-0.04495706036686897,
0.04373263567686081,
-0.025504929944872856,
-0.02351813204586506,
-0.010973588563501835,
0.025181496515870094,
0.04419468343257904,
-0.07217155396938324,
0.032412514090538025,
-0.014277216047048569,
-0.022778859362006187,
-0.009650981985032558,
-... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "in_planes", "annotation": null, "type_comment": null}}, {"_type":... | def __init__(self, in_planes, planes, stride=1):
super(PreActBottleneck, self).__init__()
self.bn1 = nn.BatchNorm2d(in_planes)
self.conv1 = nn.Conv2d(in_planes, planes, kernel_size=1, bias=False)
self.bn2 = nn.BatchNorm2d(planes)
self.conv2 = nn.Conv2d(planes, planes, kernel_size... | |
15,756 | [
0.022235095500946045,
-0.058673422783613205,
0.017878832295536995,
-0.057675112038850784,
-0.01100977510213852,
-0.013704079203307629,
-0.003766352776437998,
0.042223989963531494,
0.011775524355471134,
-0.00013613323972094804,
-0.011270697228610516,
-0.005411296151578426,
-0.0455819442868232... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "x", "annotation": null, "type_comment": null}}], "kwarg": null, "... | def forward(self, x):
out = F.relu(self.bn1(x))
shortcut = self.shortcut(out) if hasattr(self, 'shortcut') else x
out = self.conv1(out)
out = self.conv2(F.relu(self.bn2(out)))
out = self.conv3(F.relu(self.bn3(out)))
out += shortcut
return out | |
15,757 | [
0.008795591071248055,
-0.03990194946527481,
0.011053228750824928,
-0.04174074903130531,
0.017519673332571983,
-0.018398210406303406,
-0.023597927764058113,
-0.010951072908937931,
-0.03514150157570839,
0.02398611791431904,
-0.02504853531718254,
-0.06313211470842361,
-0.005587907508015633,
0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "block", "annotation": ... | class PreActResNet(nn.Module):
def __init__(self, block, num_blocks, num_classes=10):
super(PreActResNet, self).__init__()
self.in_planes = 64
self.conv1 = nn.Conv2d(3, 64, kernel_size=3, stride=1, padding=1, bias=False)
self.layer1 = self._make_layer(block, 64, num_blocks[0], strid... | |
15,758 | [
-0.003742734668776393,
-0.03333314508199692,
0.0077215698547661304,
-0.02388910949230194,
0.014724105596542358,
-0.019102703779935837,
0.0008075721561908722,
-0.0028868692461401224,
-0.03745417669415474,
0.02790282480418682,
-0.007694740314036608,
-0.04953824356198311,
-0.022837389260530472,... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "block", "annotation": null, "type_comment": null}}, {"_type": "ar... | def __init__(self, block, num_blocks, num_classes=10):
super(PreActResNet, self).__init__()
self.in_planes = 64
self.conv1 = nn.Conv2d(3, 64, kernel_size=3, stride=1, padding=1, bias=False)
self.layer1 = self._make_layer(block, 64, num_blocks[0], stride=1)
self.layer2 = self._ma... | |
15,759 | [
0.02275584451854229,
0.004762851167470217,
0.004090616945177317,
-0.01863662339746952,
0.024672428146004677,
0.029892971739172935,
-0.0310658048838377,
-0.04322323203086853,
0.023628320544958115,
0.02977854758501053,
0.0025673627387732267,
-0.030293451622128487,
0.012851117178797722,
0.040... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs... | class DiffusiveConductanceTest:
def setup_class(self):
self.net = op.network.Cubic(shape=[5, 5, 5])
self.geo = op.geometry.GenericGeometry(network=self.net,
pores=self.net.Ps,
throats=self.net.Ts)
s... | |
15,760 | [
0.026434237137436867,
-0.0393546000123024,
0.016093382611870766,
-0.026251617819070816,
0.024950450286269188,
-0.030383393168449402,
-0.029470294713974,
-0.007299091201275587,
0.025932032614946365,
0.01295460294932127,
-0.008018157444894314,
-0.004000518471002579,
-0.03458365425467491,
-0.... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "x", "annotation": null, "type_comment": null}}], "kwarg": null, "... | def forward(self, x):
out = self.conv1(x)
out = self.layer1(out)
out = self.layer2(out)
out = self.layer3(out)
out = self.layer4(out)
out = F.adaptive_max_pool2d(out, 1)
out = out.view(out.size(0), -1)
return F.log_softmax(self.linear(out)) | |
15,761 | [
0.04232232645153999,
0.010681075975298882,
0.008082588203251362,
0.006629014387726784,
-0.011233792640268803,
0.028769994154572487,
-0.025051716715097427,
-0.035058047622442245,
-0.02193640172481537,
0.011729083955287933,
-0.005663554184138775,
-0.014327571727335453,
-0.0024369792081415653,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_ordinary_diffusion(self):
self.geo['throat.conduit_lengths.pore1'] = 0.15
self.geo['throat.conduit_lengths.throat'] = 0.6
self.geo['throat.conduit_lengths.pore2'] = 0.25
mod = op.models.physics.diffusive_conductance.ordinary_diffusion
self.phys.add_model(propname='throat... | |
15,762 | [
0.021424395963549614,
-0.009067156352102757,
0.009708333760499954,
0.01532349456101656,
-0.0038438267074525356,
-0.003188077127560973,
0.03059517778456211,
-0.021748222410678864,
-0.023121248930692673,
0.0147665124386549,
0.012188849039375782,
-0.01983116753399372,
0.010699245147407055,
-0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def setup_class(self):
self.net = op.network.Cubic(shape=[5, 5, 5])
self.geo = op.geometry.GenericGeometry(network=self.net,
pores=self.net.Ps,
throats=self.net.Ts)
self.geo['pore.diameter'] = 1
... | |
15,763 | [
0.04070388525724411,
0.009561173617839813,
0.01075543649494648,
0.007218579761683941,
-0.02350366860628128,
0.024351665750145912,
-0.025143129751086235,
-0.03561590239405632,
-0.004766453523188829,
0.023885266855359077,
-0.011808367446064949,
-0.019447412341833115,
0.0004973152535967529,
-... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_ordinary_diffusion_with_zero_length_throats(self):
self.geo['throat.conduit_lengths.pore1'] = 0.15
self.geo['throat.conduit_lengths.throat'] = 0.0
self.geo['throat.conduit_lengths.pore2'] = 0.25
mod = op.models.physics.diffusive_conductance.ordinary_diffusion
self.phys.a... | |
15,764 | [
0.04151943325996399,
0.01383515726774931,
0.006694206036627293,
0.0009973249398171902,
-0.01781398616731167,
0.021513599902391434,
-0.007196794729679823,
-0.026595333591103554,
-0.020731795579195023,
0.010959231294691563,
-0.012962606735527515,
-0.021806776523590088,
-0.01760457456111908,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_mixed_diffusion(self):
self.geo['throat.conduit_lengths.pore1'] = 0.15
self.geo['throat.conduit_lengths.throat'] = 0.6
self.geo['throat.conduit_lengths.pore2'] = 0.25
mod = op.models.physics.diffusive_conductance.mixed_diffusion
self.phys.add_model(propname='throat.m_dif... | |
15,765 | [
0.0066398377530276775,
0.01196303404867649,
0.023911910131573677,
-0.013095628470182419,
-0.007517598569393158,
-0.004940945189446211,
-0.021533461287617683,
-0.043151866644620895,
0.026219571009278297,
0.012904503382742405,
-0.03074995055794716,
-0.016351839527487755,
-0.016705775633454323,... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_taylor_aris_diffusion(self):
self.geo['throat.conduit_lengths.pore1'] = 0.15
self.geo['throat.conduit_lengths.throat'] = 0.6
self.geo['throat.conduit_lengths.pore2'] = 0.25
self.phase['pore.pressure'] = sp.linspace(0, 20, self.net.Np)
self.phase['throat.hydraulic_conduct... | |
15,766 | [
0.031842272728681564,
0.008834616281092167,
0.02099061943590641,
0.00551323127001524,
0.013399841263890266,
-0.008135377429425716,
0.007496649399399757,
-0.003368449630215764,
-0.010259988717734814,
0.025522226467728615,
0.03515021130442619,
-0.009385939687490463,
-0.004393776413053274,
0.... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_multiphase_diffusion(self):
np.random.seed(50)
net = op.network.Cubic(shape=[1, 6, 1])
geom = op.geometry.StickAndBall(network=net)
air = op.phases.Air(network=net)
water = op.phases.Water(network=net)
m = op.phases.MultiPhase(phases=[air, water], project=net.pro... | |
15,767 | [
0.048727814108133316,
-0.004320183768868446,
0.004392531234771013,
-0.001592507935129106,
0.011527379974722862,
0.02167671173810959,
-0.017156710848212242,
-0.011851221323013306,
-0.012808965519070625,
0.02295829728245735,
-0.017900856211781502,
-0.027340492233633995,
-0.01068677008152008,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_classic_ordinary_diffusion(self):
self.geo['pore.diameter'] = 1.0
self.geo['throat.diameter'] = 1.0
self.geo['throat.length'] = 1e-9
self.air = op.phases.Air(network=self.net)
self.phys = op.physics.GenericPhysics(network=self.net,
... | |
15,768 | [
0.050016310065984726,
0.000739824550691992,
0.009676766581833363,
0.0002709216787479818,
-0.004105505533516407,
0.017088904976844788,
-0.011753832921385765,
-0.02134029194712639,
0.004515361040830612,
0.03256617486476898,
-0.0145464101806283,
-0.032982975244522095,
-0.008023449219763279,
0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_classic_ordinary_diffusion_with_zero_length_throats(self):
self.geo['pore.diameter'] = 1.0
self.geo['throat.diameter'] = 1.0
self.geo['throat.length'] = 0.0
self.air = op.phases.Air(network=self.net)
self.phys = op.physics.GenericPhysics(network=self.net,
... | |
15,769 | [
-0.03166751563549042,
-0.0461900569498539,
-0.03644959628582001,
-0.012616320513188839,
-0.007393494714051485,
0.009167492389678955,
-0.05663571134209633,
0.035127364099025726,
-0.018786748871207237,
0.022257613018155098,
0.0064348746091127396,
-0.05266900733113289,
0.008792859502136707,
-... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "request", "annotation": null, "type_comment": null}}], "kwarg": {"_type": "arg", "_fields": {"arg": "kwargs", "annotation": null, "type_comment": null}},... | def angular_reverse(request, *args, **kwargs):
url_name = request.GET.get('djng_url_name')
url_args = request.GET.getlist('djng_url_args', None)
url_kwargs = {}
prefix = 'djng_url_kwarg_'
for param in request.GET:
if param.startswith(prefix):
url_kwargs[param[len(prefix):]] = re... | |
15,770 | [
0.005738676059991121,
0.0435134619474411,
0.023225214332342148,
0.026509977877140045,
0.04815077409148216,
0.030374405905604362,
-0.02506725676357746,
0.006685460917651653,
0.07764924317598343,
0.04905247688293457,
0.010717347264289856,
-0.030554745346307755,
0.01818857528269291,
-0.026149... | 14 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "comment", "annotation": null, "type_comment": null}}, {"_type":... | def rax_dns(module, comment, email, name, state, ttl):
changed = False
dns = pyrax.cloud_dns
if not dns:
module.fail_json(msg='Failed to instantiate client. This '
'typically indicates an invalid region or an '
'incorrectly capitalized regio... | |
15,771 | [
0.008448367938399315,
0.027325475588440895,
0.012851209379732609,
0.004790436942130327,
0.01269374880939722,
0.038250818848609924,
-0.02405514009296894,
0.004735931288450956,
0.06322649866342545,
0.05251917615532875,
0.0038729258812963963,
-0.06739314645528793,
0.03687001019716263,
-0.0124... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def main():
argument_spec = rax_argument_spec()
argument_spec.update(
dict(
comment=dict(),
email=dict(),
name=dict(),
state=dict(default='present', choices=['present', 'absent']),
ttl=dict(type='int', default=3600),
)
)
module... | |
15,772 | [
0.021032877266407013,
0.03869149833917618,
0.07733800262212753,
-0.024452127516269684,
0.02656666189432144,
0.014396836049854755,
0.025149473920464516,
0.014711767435073853,
-0.036509476602077484,
-0.016466381028294563,
-0.022112641483545303,
0.021898938342928886,
-0.0009750201134011149,
-... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {... | class Migration(migrations.Migration):
dependencies = [
("discount", "0034_populate_sales_datetimes"),
]
operations = [
migrations.AlterField(
model_name="sale",
name="created",
field=models.DateTimeField(auto_now_add=True, db_index=True),
),
... | |
15,773 | [
0.08312612026929855,
-0.04843136668205261,
-0.038796115666627884,
0.028297418728470802,
-0.003029413288459182,
0.017043210566043854,
0.004300049971789122,
0.013442255556583405,
0.04156306013464928,
0.029415972530841827,
0.008737466298043728,
-0.03363507241010666,
-0.0030465840827673674,
-0... | 14 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "result", "annotation": null, "type_comment": null}}], "kwarg": nu... | def convert_mongo_result_to_valid_json(self, result):
if result is None:
return result
if isinstance(result, integer_types + (float, bool)):
return result
if isinstance(result, string_types):
return result
elif isinstance(result, list):
new... | |
15,774 | [
-0.002663283608853817,
0.035631850361824036,
-0.04164131358265877,
-0.042936280369758606,
-0.02282380871474743,
-0.014588622376322746,
-0.04645697399973869,
-0.027194326743483543,
0.027679938822984695,
0.021791880950331688,
-0.03905137628316879,
-0.033021681010723114,
0.039779797196388245,
... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "sort_parameter", "annotation": null, "type_comment": null}}], "kw... | def _fix_sort_parameter(self, sort_parameter):
if sort_parameter is None:
return sort_parameter
if not isinstance(sort_parameter, list):
raise AnsibleError("Error. Sort parameters must be a list, not [ {} ]".format(sort_parameter))
for item in sort_parameter:
... | |
15,775 | [
0.02366686798632145,
-0.020109577104449272,
0.08401979506015778,
-0.06993583589792252,
0.019819187000393867,
0.026522379368543625,
-0.0034786423202604055,
0.015765812247991562,
-0.018222035840153694,
0.06790309399366379,
0.061804886907339096,
-0.025917397812008858,
-0.022408505901694298,
-... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_large_graph(self):
nodes = range(1, 10)
edges = [
(1, 2, 4),
(2, 1, 4),
(1, 8, 8),
(8, 1, 8),
(2, 8, 11),
(8, 2, 11),
(2, 3, 8),
(3, 2, 8),
(3, 9, 2),
(9, 3, 2),
(... | |
15,776 | [
0.030929191038012505,
-0.034336235374212265,
0.0707988515496254,
-0.07466500252485275,
0.011791754513978958,
0.047601960599422455,
0.0010790482629090548,
0.014558467082679272,
-0.022592807188630104,
0.052386317402124405,
0.053642816841602325,
-0.02991432696580887,
-0.003222797531634569,
-0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs... | class PrimTest(unittest.TestCase):
def test_large_graph(self):
nodes = range(1, 10)
edges = [
(1, 2, 4),
(2, 1, 4),
(1, 8, 8),
(8, 1, 8),
(2, 8, 11),
(8, 2, 11),
(2, 3, 8),
(3, 2, 8),
(3, 9, 2... | |
15,777 | [
-0.004862397909164429,
-0.027191225439310074,
0.01900015026330948,
-0.054831892251968384,
0.036584559828042984,
-0.0019705211743712425,
-0.03406768664717674,
-0.05640494078397751,
0.0007717757835052907,
0.016955189406871796,
0.017213618382811546,
-0.01775294914841652,
0.023326026275753975,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs... | class DataTest(TestCase):
def test1(self):
# Parsing trivial file with nothing.
self._test(test4)
def test2(self):
# Parsing trivial file with some comments in the data section.
self._test(test5)
def test3(self):
# Parsing trivial file with nominal attribute of 1 ch... | |
15,778 | [
0.02973143570125103,
-0.016074780374765396,
-0.025286689400672913,
-0.058311380445957184,
0.03394588455557823,
0.00822162814438343,
0.004862160421907902,
-0.026046670973300934,
-0.01255122572183609,
0.019678939133882523,
0.026507267728447914,
-0.023651575669646263,
0.01404816098511219,
0.0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_filelike(self):
# Test reading from file-like object (StringIO)
f1 = open(test1)
data1, meta1 = loadarff(f1)
f1.close()
f2 = open(test1)
data2, meta2 = loadarff(StringIO(f2.read()))
f2.close()
assert_(data1 == data2)
assert_(repr(meta1) ==... | |
15,779 | [
-0.028962068259716034,
-0.003935191314667463,
0.04812883585691452,
-0.06649502366781235,
0.020532457157969475,
0.03720330446958542,
-0.0206148698925972,
-0.061832837760448456,
0.0033759644720703363,
-0.003882212098687887,
0.013080023229122162,
-0.021733323112130165,
-0.022628087550401688,
... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs... | class HeaderTest(TestCase):
def test_type_parsing(self):
# Test parsing type of attribute from their value.
ofile = open(test2)
rel, attrs = read_header(ofile)
ofile.close()
expected = ['numeric', 'numeric', 'numeric', 'numeric', 'numeric',
'numeric', 'st... | |
15,780 | [
-0.01617438904941082,
0.016543718054890633,
0.00029651462682522833,
-0.0716930627822876,
0.02776476740837097,
0.041342999786138535,
0.0014542285352945328,
-0.043819669634103775,
0.015718160197138786,
0.000766491168178618,
0.04827332869172096,
-0.021268941462039948,
-0.012415935285389423,
0... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_type_parsing(self):
# Test parsing type of attribute from their value.
ofile = open(test2)
rel, attrs = read_header(ofile)
ofile.close()
expected = ['numeric', 'numeric', 'numeric', 'numeric', 'numeric',
'numeric', 'string', 'string', 'nominal', 'nom... | |
15,781 | [
0.015838589519262314,
0.01977970451116562,
0.031726595014333725,
-0.04380938783288002,
0.03058997355401516,
0.011681267991662025,
-0.021027518436312675,
-0.0360754132270813,
-0.002341195475310087,
-0.005781949497759342,
0.06468865275382996,
-0.02285599708557129,
-0.03995475545525551,
0.015... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_fullheader1(self):
# Parsing trivial header with nothing.
ofile = open(test1)
rel, attrs = read_header(ofile)
ofile.close()
# Test relation
assert_(rel == 'test1')
# Test numerical attributes
assert_(len(attrs) == 5)
for i in range(4):
... | |
15,782 | [
-0.017314935103058815,
0.013915405608713627,
0.013382812961935997,
-0.04827331379055977,
0.030663752928376198,
0.005206945352256298,
-0.014402671717107296,
-0.07492562383413315,
0.009360036812722683,
-0.01274823397397995,
0.03941187262535095,
-0.022980816662311554,
0.008878436870872974,
0.... | 7 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_badtype_parsing(self):
# Test parsing wrong type of attribute from their value.
ofile = open(test3)
rel, attrs = read_header(ofile)
ofile.close()
for name, value in attrs:
assert_raises(ParseArffError, parse_type, value) | |
15,783 | [
0.027300547808408737,
0.026877475902438164,
0.07336555421352386,
-0.05853316932916641,
0.0006968234665691853,
0.02757430076599121,
-0.02640463225543499,
-0.0393456406891346,
-0.0028883954510092735,
-0.01623847521841526,
0.03105841763317585,
0.005347497761249542,
-0.010806985199451447,
-0.0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_dateheader_unsupported(self):
ofile = open(test8)
rel, attrs = read_header(ofile)
ofile.close()
assert_(rel == 'test8')
assert_(len(attrs) == 2)
assert_(attrs[0][0] == 'attr_datetime_utc')
assert_(attrs[0][1] == 'DATE "yyyy-MM-dd HH:mm Z"')
ass... | |
15,784 | [
0.011170369572937489,
0.038105424493551254,
0.07167388498783112,
-0.06514880806207657,
0.01601957157254219,
0.00966017134487629,
-0.018377264961600304,
-0.0450638085603714,
-0.015395102091133595,
-0.027757063508033752,
0.03813091292977333,
-0.00774852791801095,
-0.014388303272426128,
-0.00... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_dateheader(self):
ofile = open(test7)
rel, attrs = read_header(ofile)
ofile.close()
assert_(rel == 'test7')
assert_(len(attrs) == 5)
assert_(attrs[0][0] == 'attr_year')
assert_(attrs[0][1] == 'DATE yyyy')
assert_(attrs[1][0] == 'attr_month')
... | |
15,785 | [
-0.0017628161003813148,
-0.013106275349855423,
0.034558944404125214,
-0.031503766775131226,
0.05490466579794884,
0.009082515724003315,
0.020057914778590202,
-0.049059975892305374,
0.008556715212762356,
0.017013804987072945,
0.005612230859696865,
0.026943136006593704,
-0.009082515724003315,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_datetime_local_attribute(self):
expected = np.array([
datetime.datetime(year=1999, month=1, day=31, hour=0, minute=1),
datetime.datetime(year=2004, month=12, day=1, hour=23, minute=59),
datetime.datetime(year=1817, month=4, day=28, hour=13, minute=0),
dat... | |
15,786 | [
-0.011366424150764942,
-0.0058537982404232025,
0.0334947369992733,
-0.039959054440259933,
0.037062082439661026,
0.024241188541054726,
-0.01478413213044405,
-0.07168209552764893,
0.004147936590015888,
0.0075596594251692295,
0.004536992870271206,
0.017154382541775703,
-0.012342057190835476,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs... | class DateAttributeTest(TestCase):
@dec.skipif(NumpyVersion(np.__version__) < '1.7.0', "No np.datetime64 in Numpy < 1.7.0")
def setUp(self):
self.data, self.meta = loadarff(test7)
@dec.skipif(NumpyVersion(np.__version__) < '1.7.0', "No np.datetime64 in Numpy < 1.7.0")
def test_year_attribute(se... | |
15,787 | [
0.009425751864910126,
0.0378112718462944,
0.03775713965296745,
-0.042412497103214264,
0.0347798727452755,
0.06528330594301224,
0.01431793998926878,
-0.008424307219684124,
0.000542589696124196,
0.07859980314970016,
0.04736558720469475,
-0.05667630583047867,
-0.012152655981481075,
0.03572718... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "line", "annotation": null, "type_comment": null}}], "kwarg": null... | def _parse_modulus(self, line):
timestamp, mod_type, tests, tries, size, generator, modulus = line.split()
mod_type = int(mod_type)
tests = int(tests)
tries = int(tries)
size = int(size)
generator = int(generator)
modulus = long(modulus, 16)
# weed out pr... | |
15,788 | [
0.004353886004537344,
-0.010353189893066883,
0.03941607475280762,
0.006908289156854153,
0.017132064327597618,
0.0009405688033439219,
-0.013668675906956196,
-0.0003535799332894385,
0.0007314251270145178,
0.030344706028699875,
0.012694982811808586,
-0.019264329224824905,
-0.026548536494374275,... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "min", "annotation": null, "type_comment": null}}, {"_type": "arg"... | def get_modulus(self, min, prefer, max):
bitsizes = self.pack.keys()
bitsizes.sort()
if len(bitsizes) == 0:
raise SSHException('no moduli available')
good = -1
# find nearest bitsize >= preferred
for b in bitsizes:
if (b >= prefer) and (b < max) an... | |
15,789 | [
0.005701383575797081,
0.003339153015986085,
-0.02496223710477352,
0.008589443750679493,
-0.007041315548121929,
-0.03469943255186081,
-0.034678079187870026,
0.00019635207718238235,
0.013196460902690887,
0.0514192208647728,
0.04138307645916939,
-0.034037474542856216,
-0.01731768622994423,
-0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "nums", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def move_zeros(nums):
last = -1
for i in range(len(nums)):
if nums[i] != 0:
nums[last+1] = nums[i]
last += 1
for i in range(last+1, len(nums)):
nums[i] = 0
return nums | |
15,790 | [
0.019325096160173416,
0.060359105467796326,
0.03839561343193054,
-0.03631266579031944,
-0.019799545407295227,
-0.021917205303907394,
0.027008848264813423,
-0.014140879735350609,
-0.023213259875774384,
0.010640375316143036,
-0.018920080736279488,
-0.027795737609267235,
0.010009706020355225,
... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DateTimeField", "value": {"_type": "Name", "_fields": {"id":... | class DocumentForm(forms.ModelForm):
date = forms.DateTimeField(widget=forms.SplitDateTimeWidget)
date.widget.widgets[0].attrs = {"class":"datepicker", 'data-date-format': "yyyy-mm-dd"}
date.widget.widgets[1].attrs = {"class":"time"}
temporal_extent_start = forms.DateField(required=False,widget=forms.Da... | |
15,791 | [
0.04216666892170906,
0.0017252402612939477,
-0.02079799585044384,
-0.019307896494865417,
0.020174479112029076,
-0.0229327492415905,
0.05076909437775612,
0.008602423593401909,
-0.01247034315019846,
-0.0075033423490822315,
0.014319758862257004,
-0.04611913487315178,
0.03476900979876518,
0.00... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": {"_type": "arg", "_fields": {"arg": "kwargs", "annotation": null, "type_comment": null}}, "v... | def save(self, *args, **kwargs):
contenttype_id = None
contenttype = None
object_id = None
resource = self.cleaned_data['resource']
if resource != 'no_link':
matches = re.match("type:(\d+)-id:(\d+)", resource).groups()
contenttype_id = matches[0]
... | |
15,792 | [
0.03551356494426727,
0.02926071174442768,
0.005702426191419363,
-0.008498596027493477,
0.00815182738006115,
-0.034786999225616455,
0.03879411146044731,
0.00881233997642994,
-0.04388005658984184,
0.039190419018268585,
-0.020828165113925934,
-0.02615630067884922,
0.013980851508677006,
-0.018... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": {"_type": "arg", "_fields": {"arg": "kwargs", "annotation": null, "type_comment": null}}, "v... | def __init__(self, *args, **kwargs):
super(DocumentForm, self).__init__(*args, **kwargs)
rbases = list(Layer.objects.all())
rbases += list(Map.objects.all())
rbases.sort(key=lambda x: x.title)
rbases_choices = []
rbases_choices.append(['no_link', '---------'])
for... | |
15,793 | [
-0.009845848195254803,
-0.04256284236907959,
0.03242109715938568,
-0.030216369777917862,
-0.008256124332547188,
-0.012160812504589558,
-0.03158562257885933,
-0.020202266052365303,
0.006614182144403458,
0.04557983949780464,
0.02108415588736534,
-0.024925023317337036,
0.007026118226349354,
0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields":... | def test_grid_to_graph():
#Checking that the function works with graphs containing no edges
size = 2
roi_size = 1
# Generating two convex parts with one vertex
# Thus, edges will be empty in _to_graph
mask = np.zeros((size, size), dtype=np.bool)
mask[0:roi_size, 0:roi_size] = True
mask[-... | |
15,794 | [
-0.004071459174156189,
0.00026576820528134704,
-0.007841531187295914,
-0.015102208591997623,
-0.0032248366624116898,
-0.008444304578006268,
-0.00022758114209864289,
-0.022708110511302948,
-0.025009609758853912,
0.026609698310494423,
-0.00014872402243781835,
-0.010592369362711906,
-0.00812099... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "BinOp", "_fields": {"... | def test_img_to_graph():
x, y = np.mgrid[:4, :4] - 10
grad_x = img_to_graph(x)
grad_y = img_to_graph(y)
assert_equal(grad_x.nnz, grad_y.nnz)
# Negative elements are the diagonal: the elements of the original
# image. Positive elements are the values of the gradient, they
# should all be equa... | |
15,795 | [
-0.013242244720458984,
-0.044775575399398804,
0.06669981777667999,
0.0008667907095514238,
-0.03881217911839485,
0.006119996774941683,
-0.007667222060263157,
-0.006201429758220911,
-0.010824313387274742,
0.017840072512626648,
-0.01568523235619068,
-0.022425372153520584,
0.008299892768263817,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def test_connect_regions_with_grid():
lena = sp.misc.lena()
mask = lena > 50
graph = grid_to_graph(*lena.shape, mask=mask)
assert_equal(ndimage.label(mask)[1], connected_components(graph)[0])
mask = lena > 150
graph = grid_to_graph(*lena.shape, mask=mask, dtype=None)
assert_equal(ndimage.la... | |
15,796 | [
0.02108083665370941,
-0.06564384698867798,
0.021136168390512466,
-0.052718691527843475,
0.02198825404047966,
-0.003726494498550892,
0.007071210071444511,
-0.006656232755631208,
0.0419403538107872,
0.013146474957466125,
-0.02923652157187462,
-0.004487285856157541,
-0.027687272056937218,
-0.... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def _downsampled_lena():
lena = sp.misc.lena().astype(np.float32)
lena = (lena[::2, ::2] + lena[1::2, ::2] + lena[::2, 1::2]
+ lena[1::2, 1::2])
lena = (lena[::2, ::2] + lena[1::2, ::2] + lena[::2, 1::2]
+ lena[1::2, 1::2])
lena = lena.astype(np.float32)
lena /= 16.0
retu... | |
15,797 | [
0.04575127363204956,
-0.04001259431242943,
0.03054603561758995,
-0.0463612899184227,
0.002954063704237342,
-0.01817624643445015,
0.03079456090927124,
-0.007585674058645964,
-0.02397140860557556,
-0.00602109357714653,
-0.013962610624730587,
0.0024937267880886793,
-0.03337018936872482,
-0.05... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "lena", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [{"_type": "Constant", "_fields": {"kind": null, "value": ... | def _make_images(lena=None):
lena = _downsampled_lena() if lena is None else lena
# make a collection of lenas
images = np.zeros((3,) + lena.shape)
images[0] = lena
images[1] = lena + 1
images[2] = lena + 2
return images | |
15,798 | [
0.010941596701741219,
-0.01788925938308239,
0.04605816677212715,
-0.030238188803195953,
0.023162586614489555,
0.01630948670208454,
0.022050069645047188,
-0.02345184050500393,
-0.030126936733722687,
0.005654363427311182,
0.008004553616046906,
-0.01269380934536457,
-0.0024113787803798914,
-0... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"i... | def test_extract_patches_all_rect():
lena = downsampled_lena
lena = lena[:, 32:97]
i_h, i_w = lena.shape
p_h, p_w = 16, 12
expected_n_patches = (i_h - p_h + 1) * (i_w - p_w + 1)
patches = extract_patches_2d(lena, (p_h, p_w))
assert_equal(patches.shape, (expected_n_patches, p_h, p_w)) | |
15,799 | [
0.00925853569060564,
-0.024759702384471893,
0.05261144042015076,
-0.0293977539986372,
0.022323554381728172,
0.01289519015699625,
0.017357558012008667,
-0.02119917795062065,
-0.013574500568211079,
0.0004245691525284201,
0.008450389839708805,
-0.025532711297273636,
-0.0153547627851367,
-0.02... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"i... | def test_extract_patches_max_patches():
lena = downsampled_lena
i_h, i_w = lena.shape
p_h, p_w = 16, 16
patches = extract_patches_2d(lena, (p_h, p_w), max_patches=100)
assert_equal(patches.shape, (100, p_h, p_w))
expected_n_patches = int(0.5 * (i_h - p_h + 1) * (i_w - p_w + 1))
patches = e... | |
15,800 | [
0.013247055001556873,
-0.019423523917794228,
0.05247057229280472,
-0.022270582616329193,
-0.005076469387859106,
0.005676468834280968,
0.01452940795570612,
-0.02283528819680214,
-0.003991175442934036,
-0.004705881234258413,
0.02047058194875717,
-0.030964696779847145,
-0.01567058451473713,
-... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"i... | def test_patch_extractor_max_patches():
lenas = lena_collection
i_h, i_w = lenas.shape[1:3]
p_h, p_w = 8, 8
max_patches = 100
expected_n_patches = len(lenas) * max_patches
extr = PatchExtractor(patch_size=(p_h, p_w), max_patches=max_patches,
random_state=0)
patches... |