query
stringlengths
9
9.05k
document
stringlengths
10
222k
negatives
listlengths
19
20
metadata
dict
Calculate diou on box array
def box_diou(boxes): # get box coordinate and area x = boxes[:, 0] y = boxes[:, 1] w = boxes[:, 2] h = boxes[:, 3] areas = w * h # check IoU inter_xmin = np.maximum(x[:-1], x[-1]) inter_ymin = np.maximum(y[:-1], y[-1]) inter_xmax = np.minimum(x[:-1] + w[:-1], x[-1] + w[-1]) ...
[ "def compute_iou(box, boxes, box_area, boxes_area):\n # Calculate intersection areas\n y1 = np.maximum(box[0], boxes[:, 0])\n y2 = np.minimum(box[2], boxes[:, 2])\n x1 = np.maximum(box[1], boxes[:, 1])\n x2 = np.minimum(box[3], boxes[:, 3])\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
conv => drop => conv => maxpooling
def conv_pooling(init_tensor, n_filters, drop_rate): c = conv_twice(init_tensor, n_filters, drop_rate) p = MaxPooling2D((2, 2))(c) return c, p
[ "def __apply_conv_pool(self, tensor_in, params,\n activation, op_name):\n weights, biases = self.__make_conv_wb(params,op_name)\n tensor_out = tf.nn.max_pool(\n activation(tf.nn.conv2d(\n tensor_in, weights, strides=self.conv_strides,\n padding=self.pad) + biases), ks...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the parent directory object that should be used for a given document. If the document is tagged with a project name (nonRESERVED DocumentTag), a Directory object with the first project tag found is returned. Otherwise, the owner's home directory is returned.
def _get_parent_directory(self, document): parent_dir = self.home_dir project_tags = document.tags.exclude(tag__in=DocumentTag.RESERVED) if project_tags.exists(): first_tag = project_tags[0] parent_dir, created = Directory.objects.get_or_create( owner=self.user, name=first_ta...
[ "def parse_parent(docname):\n\n lineage = docname.split('/')\n lineage_count = len(lineage)\n\n if docname == 'index':\n # This is the top of the Sphinx project\n parent = None\n elif lineage_count == 1:\n # This is a non-index doc in root, e.g. about\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Syncs (creates) Document2Permissions based on the DocumentPermissions found for a given document.
def _sync_permissions(self, document, document2): doc_permissions = DocumentPermission.objects.filter(doc=document) for perm in doc_permissions: try: doc2_permission, created = Document2Permission.objects.get_or_create(doc=document2, perms=perm.perms) if perm.users: doc2_permissi...
[ "def test_set_document_permissions(self):\n\t\tcreate_document()\n\t\t# Get a document to work with\n\t\tdocument = Document.objects.all()[0]\n\n\t\t# Save the Layers current permissions\n\t\tcurrent_perms = document.get_all_level_info() \n\t \n\t\t# Set the Permissions\n\t\tdocuments.views.set_document_permissio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Allows testing management commands in a temporary migrations module. Wrap all invocations to makemigrations and squashmigrations with this context manager in order to avoid creating migration files in your source tree inadvertently. Takes the application label that will be passed to makemigrations or squashmigrations a...
def temporary_migration_module(self, app_label="migrations", module=None): with tempfile.TemporaryDirectory() as temp_dir: target_dir = tempfile.mkdtemp(dir=temp_dir) with open(os.path.join(target_dir, "__init__.py"), "w"): pass target_migrations_dir = os.path...
[ "def temporary_migration_module(self, app_label='migrations', module=None):\n temp_dir = tempfile.mkdtemp()\n try:\n target_dir = tempfile.mkdtemp(dir=temp_dir)\n with open(os.path.join(target_dir, '__init__.py'), 'w'):\n pass\n target_migrations_dir = o...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Makes a test state using set_up_test_model and returns the original state and the state after the migration is applied.
def make_test_state(self, app_label, operation, **kwargs): project_state = self.set_up_test_model(app_label, **kwargs) new_state = project_state.clone() operation.state_forwards(app_label, new_state) return project_state, new_state
[ "def test_save_state(self):\n self.save_helper(\"State\")", "def test_new_state(self):\n self.new_helper(\"State\")", "def _test_update_state_fn(self):\n return encoding_stage._tf_style_update_state(\n lambda _, s, sut, name: {'state': s['state'] + sut['tensor']})", "def test_state_see...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the mount manager. You can use this to set the write directory and base path
def getMountManager(self): return self.mountManager
[ "def mount_option(self):\n return self._mount_option", "def get_shm_context_mount() -> k8s_schemas.V1VolumeMount:\n return k8s_schemas.V1VolumeMount(\n name=constants.VOLUME_MOUNT_SHM, mount_path=ctx_paths.CONTEXT_MOUNT_SHM\n )", "def get_mapping_path_manager(self):\n return # osid.ma...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Loads the pipeline settings from an ini file
def loadSettings(self, filename): self.settings = PipelineSettingsManager() self.settings.loadFromFile(filename)
[ "def load_settings():\n with open(os.path.join(SCRIPT_DIR, '../road-shields.yml'), 'r') as fh:\n return yaml.load(fh, Loader=yaml.FullLoader)", "def read_ini_file( ):\n pkeys = {}\n for p in __para_name: pkeys[__para_name[p].lower()] = p\n set_defaults()\n iniFile = __param[init_file]\n c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates the antialiasing technique
def _setupAntialiasing(self): technique = self.settings.antialiasingTechnique self.debug("Creating antialiasing handler for", technique) if technique == "None": self.antialias = AntialiasingTechniqueNone() elif technique == "SMAA": self.antialias = AntialiasingTe...
[ "def antialias(self):\n return self._ripy.antialias", "def getAntialiasing(self, smoothing: 'SbBool &', numPasses: 'int &') -> \"void\":\n return _coin.SoRenderManager_getAntialiasing(self, smoothing, numPasses)", "def getAntialiasing(self, smoothing: 'SbBool &', numPasses: 'int &') -> \"void\":\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates the occlusion technique
def _setupOcclusion(self): technique = self.settings.occlusionTechnique self.debug("Creating occlusion handle for", technique) if technique == "None": self.occlusion = AmbientOcclusionTechniqueNone() elif technique == "SAO": self.occlusion = AmbientOcclusionTechn...
[ "def _gen_occlusions(self):\n # self.oc_grid = self.grid.copy()\n self.oc_grid[:, 2] = 1.0\n # self.oc_grid[:, 3] = self.types\n c = np.squeeze(self.cam_loc)\n pos = self.oc_grid[:, :2]\n\n # Compute distances from Camera to each object. Obtain sorted indices, closest objec...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Setups the final pass which applies motion blur and so on
def _setupFinalPass(self): # Set wrap for motion blur colorTex = self.antialias.getResultTexture() colorTex.setWrapU(Texture.WMClamp) colorTex.setWrapV(Texture.WMClamp) self._setFinalPassShader()
[ "def main():\n # Import a image ready to be blurred\n old_img = SimpleImage(\"images/smiley-face.png\")\n # Show the original image\n old_img.show()\n\n # Blur the original for one time\n blurred_img = blur(old_img)\n # Keep to blur the blurred image till the total times that user wished to blu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a texture to store the lights per tile into. Should get replaced with ssbos later
def _makeLightPerTileStorage(self): storageSizeX = self.precomputeSize.x * 8 storageSizeY = self.precomputeSize.y * 8 self.debug( "Creating per tile storage of size", storageSizeX, "x", storageSizeY) self.lightPerTileStorage = Texture("LightsPerTile") se...
[ "def world_texture(hdr_name):\r\n world=bpy.data.worlds['World']\r\n world.use_nodes = True\r\n links = world.node_tree.links\r\n nodes = world.node_tree.nodes\r\n for l in links:\r\n links.remove(l)\r\n for n in nodes:\r\n nodes.remove(n)\r\n world_output = nodes.new(type='Shader...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates the halfresolution buffer which computes gi and gi reflections. We use halfres for performance
def _creatGIPrecomputeBuffer(self): self.giPrecomputeBuffer = RenderTarget("GICompute") self.giPrecomputeBuffer.setSize(self.size.x / 2, self.size.y / 2) self.giPrecomputeBuffer.addColorTexture() self.giPrecomputeBuffer.addAuxTextures(1) self.giPrecomputeBuffer.setColorBits(16) ...
[ "def _makeLightBoundsComputationBuffer(self, w, h):\n self.debug(\"Creating light precomputation buffer of size\", w, \"x\", h)\n self.lightBoundsComputeBuff = RenderTarget(\"ComputeLightTileBounds\")\n self.lightBoundsComputeBuff.setSize(w, h)\n self.lightBoundsComputeBuff.setColorWrite...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates the lighting pipeline, including shadow handling
def _createLightingPipeline(self): if not self.haveLightingPass: self.debug("Skipping lighting pipeline") return self.debug("Creating lighting pipeline ..") # size has to be a multiple of the compute unit size # but still has to cover the whole screen s...
[ "def create_light():\n\n # Add new plane\n bpy.ops.mesh.primitive_plane_add(location=(15, -5, 5))\n plane = bpy.context.active_object\n plane.name = 'Light Plane'\n plane.scale = mathutils.Vector((4, 4, 4))\n # tilt\n plane.rotation_euler.rotate_axis('Y', radians(40))\n\n # Create a new mate...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets most of the required shader inputs to the targets
def _setShaderInputs(self): # Shader inputs for the light-culling pass if self.haveLightingPass: self.lightBoundsComputeBuff.setShaderInput( "destination", self.lightPerTileStorage) self.lightBoundsComputeBuff.setShaderInput( "depth", self.deferre...
[ "def bind_to(self, target):\r\n for key, val in iteritems(self.inputs):\r\n target.set_shader_input(self.name + \".\" + key, val)", "def bind_to(self, target):\r\n\r\n for pta_name, pta_handle in iteritems(self.ptas):\r\n if self.use_ubo:\r\n target.set_shader_in...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Loads the cubemap for image based lighting
def _loadFallbackCubemap(self): print self.settings.defaultReflectionCubemap cubemap = self.showbase.loader.loadCubeMap( self.settings.defaultReflectionCubemap) cubemap.setMinfilter(Texture.FTLinearMipmapLinear) cubemap.setMagfilter(Texture.FTLinearMipmapLinear) cubem...
[ "def load_height_and_soil_map(self, map_name):\n map = self.maps[map_name]\n self.image_height_map = Image()\n self.image_height_map.load_image(map.height_map_path)\n self.soil_ids_map = Image()\n self.soil_ids_map.load_image(map.texture_map_path)\n # self.transform_and_sav...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates the buffer which precomputes the lights per tile
def _makeLightBoundsComputationBuffer(self, w, h): self.debug("Creating light precomputation buffer of size", w, "x", h) self.lightBoundsComputeBuff = RenderTarget("ComputeLightTileBounds") self.lightBoundsComputeBuff.setSize(w, h) self.lightBoundsComputeBuff.setColorWrite(False) ...
[ "def _makeLightingComputeBuffer(self):\n self.lightingComputeContainer = RenderTarget(\"ComputeLighting\")\n\n if self.settings.enableTemporalReprojection:\n self.lightingComputeContainer.setSize(self.size.x / 2, self.size.y)\n else:\n self.lightingComputeContainer.setSize...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates the buffer which applies the lighting
def _makeLightingComputeBuffer(self): self.lightingComputeContainer = RenderTarget("ComputeLighting") if self.settings.enableTemporalReprojection: self.lightingComputeContainer.setSize(self.size.x / 2, self.size.y) else: self.lightingComputeContainer.setSize(self.size.x,...
[ "def _makeLightBoundsComputationBuffer(self, w, h):\n self.debug(\"Creating light precomputation buffer of size\", w, \"x\", h)\n self.lightBoundsComputeBuff = RenderTarget(\"ComputeLightTileBounds\")\n self.lightBoundsComputeBuff.setSize(w, h)\n self.lightBoundsComputeBuff.setColorWrite...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates the buffers needed to blur the occlusion
def _createOcclusionBlurBuffer(self): self.blurOcclusionV = RenderTarget("blurOcclusionVertical") self.blurOcclusionV.addColorTexture() self.blurOcclusionV.prepareOffscreenBuffer() self.blurOcclusionH = RenderTarget("blurOcclusionHorizontal") self.blurOcclusionH.addColorTexture(...
[ "def create_buffer(self, data):\n vbo = self.context.buffer(data)\n vao = self.context.vertex_array(self.program, [(vbo, \"3f4 2f4 1f4 /v\", \"aPos\", \"aTexCoord\", \"blockType\")])\n return vbo, vao", "def _create_blended(self):\n hm_cpy = self.heat_map.copy()\n # Make filtere...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a buffer which reconstructs the normals and position from viewspace
def _createNormalPrecomputeBuffer(self): self.normalPrecompute = RenderTarget("PrecomputeNormals") self.normalPrecompute.addColorTexture() self.normalPrecompute.addAuxTextures(1) self.normalPrecompute.setColorBits(16) self.normalPrecompute.setAuxBits(16) self.normalPrecom...
[ "def create_buffer(self, data):\n vbo = self.context.buffer(data)\n vao = self.context.vertex_array(self.program, [(vbo, \"3f4 2f4 1f4 /v\", \"aPos\", \"aTexCoord\", \"blockType\")])\n return vbo, vao", "def _update(self):\n\n if self._vertices_buffer is not None:\n self._ve...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates the texture where the dof factor is stored in, so we don't recompute it each pass
def _createDofStorage(self): self.dofStorage = Texture("DOFStorage") self.dofStorage.setup2dTexture( self.size.x, self.size.y, Texture.TFloat, Texture.FRg16)
[ "def create_3d_texture(perlin_noise, scale, image):\n\tstart = time.time()\n\t\n\twidth = len(perlin_noise)\n\tcoords = range(width)\n\ttexel = (ctypes.c_byte * width**3)()\n\thalf = 0 #width * scale / 2.0 \n\t\n\tfor z in coords:\n\t\tfor y in coords:\n\t\t\tfor x in coords:\n\t\t\t\tv = (perlin_noise[x][y][z])# +...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the shaders which blur the occlusion
def _setOcclusionBlurShader(self): blurVShader = Shader.load(Shader.SLGLSL, "DefaultPostProcess.vertex", "BlurOcclusionVertical.fragment") blurHShader = Shader.load(Shader.SLGLSL, "DefaultPostProcess.vertex", "BlurOcclusionHorizontal.fragment") s...
[ "def _setBlurShader(self):\n blurVShader = Shader.load(Shader.SLGLSL, \n \"DefaultPostProcess.vertex\",\n \"BlurVertical.fragment\")\n blurHShader = Shader.load(Shader.SLGLSL, \n \"DefaultPostProcess.vertex\",\n \"BlurHorizontal.fragment\")\n self.blu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the shader which computes the GI
def _setGIComputeShader(self): giShader = Shader.load(Shader.SLGLSL, "DefaultPostProcess.vertex", "ComputeGI.fragment") self.giPrecomputeBuffer.setShader(giShader)
[ "def assignPartsShader(self, shader):\r\n #We assign the shader to the selected faces\r\n Selection = cmds.ls(sl=True)\r\n if not Selection:\r\n return\r\n cmds.sets(Selection,edit=True, forceElement = \"%sSG\" % shader)", "def reloadShader(cls, shader, *args, **kwargs):\r\n cgfxFile = pm.getA...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the shaders which blur the color
def _setBlurShader(self): blurVShader = Shader.load(Shader.SLGLSL, "DefaultPostProcess.vertex", "BlurVertical.fragment") blurHShader = Shader.load(Shader.SLGLSL, "DefaultPostProcess.vertex", "BlurHorizontal.fragment") self.blurColorV.setShader(bl...
[ "def _setOcclusionBlurShader(self):\n blurVShader = Shader.load(Shader.SLGLSL, \n \"DefaultPostProcess.vertex\",\n \"BlurOcclusionVertical.fragment\")\n blurHShader = Shader.load(Shader.SLGLSL, \n \"DefaultPostProcess.vertex\",\n \"BlurOcclusionHorizontal.fr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the shader which applies the light
def _setLightingShader(self): lightShader = Shader.load(Shader.SLGLSL, "DefaultPostProcess.vertex", "ApplyLighting.fragment") self.lightingComputeContainer.setShader(lightShader)
[ "def set_lighting(self):\n prop = self.GetProperty()\n prop.SetAmbient(0.)\n prop.SetDiffuse(0.)\n prop.SetSpecular(1.0)", "def setSolidShader(self, shader):\n self._solid_shader = shader", "def setWireframeShader(self, shader):\n self._wireframe_shader = shader", "de...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the shader which constructs the normals from position
def _setNormalExtractShader(self): npShader = Shader.load(Shader.SLGLSL, "DefaultPostProcess.vertex", "ExtractNormals.fragment") self.normalPrecompute.setShader(npShader)
[ "def setNumNormals(self, num: 'int const') -> \"void\":\n return _coin.SoNormalGenerator_setNumNormals(self, num)", "def getNormals(self, points, normals=...) -> normals:\n ...", "def setNormal(self, *args):\n return _coin.SoPrimitiveVertex_setNormal(self, *args)", "def setVerticesNormals...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Attaches the update tasks to the showbase
def _attachUpdateTask(self): self.showbase.addTask( self._preRenderCallback, "RP_BeforeRender", sort=-5000) self.showbase.addTask( self._update, "RP_Update", sort=-10) if self.haveLightingPass: self.showbase.addTask( self._updateLights, "RP_...
[ "def do_update(self):\n pass", "def update_widgets(self):\n self.request_update = True", "def update_tasks(self):\n for atask in self.task_running_queue:\n atask.update()\n self.update_task_queue()", "def send_update_to_task_server(self):\n if self.server:\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Computes the current camera bounds, i.e. for light culling
def _computeCameraBounds(self): cameraBounds = self.camera.node().getLens().makeBounds() cameraBounds.xform(self.camera.getMat(self.showbase.render)) return cameraBounds
[ "def _computeLightBounds(self):\n self.bounds = BoundingSphere(Point3(self.position), self.radius)", "def camera_view_bounds_2d(scene, camera_object, mesh_object):\r\n\r\n \"\"\" Get the inverse transformation matrix. \"\"\"\r\n matrix = camera_object.matrix_world.normalized().inverted()\r\n \"\"\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Task which updates/culls the lights
def _updateLights(self, task=None): self.lightManager.updateLights() if task is not None: return task.cont
[ "def _updateShadows(self, task=None):\n self.lightManager.updateShadows()\n if task is not None:\n return task.cont", "async def update_led(led):\n\n global flash_count\n flash_count = 0\n\n while True:\n if flash_count > 0:\n await flash_led(led, 100)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Task which updates the shadow maps
def _updateShadows(self, task=None): self.lightManager.updateShadows() if task is not None: return task.cont
[ "def _updateShadowSources(self):\n self.shadowSources[0].setPos(self.position + self.direction * 500.0)\n self.shadowSources[0].lookAt(self.position)\n self.shadowSources[0].invalidate()", "def _updateShadowSources(self):\n\n cubemapDirections = [\n Vec3(-1, 0, 0),\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Task which updates the onscreen gui debugger
def _updateGUI(self, task=None): self.guiManager.update() if task is not None: return task.cont
[ "def _attachUpdateTask(self):\n\n self.showbase.addTask(\n self._preRenderCallback, \"RP_BeforeRender\", sort=-5000)\n\n self.showbase.addTask(\n self._update, \"RP_Update\", sort=-10)\n\n if self.haveLightingPass:\n self.showbase.addTask(\n self....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Computes the current mvp. Actually, this is the worldViewProjectionMatrix, but for convience it's called mvp.
def _computeMVP(self): camLens = self.showbase.camLens projMat = Mat4.convertMat( CSYupRight, camLens.getCoordinateSystem()) * camLens.getProjectionMat() transformMat = TransformState.makeMat( Mat4.convertMat(self.showbase.win.getGsg().getInternalCoordinateSys...
[ "def get_matrix(self):\n return self.mvp", "def build_proj_matrix(self):\n self.p = Matrix44.perspective_projection(self.fov, \n self.width / self.height, self.near_plane, self.far_plane)\n\n self.mvp = numpy.array(self.p * self.m).astype(\"f4\")", "def build_matrix(self):\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a handle to the light manager
def getLightManager(self): return self.lightManager
[ "def light(self):\n return self._light", "def light_details(self):\n return self.__fetch_dict(\n {'smartlife.iot.smartbulb.lightingservice': {'get_light_details': ''}}\n )", "def light(self, name):\n if name is None:\n group = GroupController(name='{0}.light:{1}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the default shader for objects
def getDefaultObjectShader(self, tesselated=False): if not tesselated: shader = Shader.load(Shader.SLGLSL, "DefaultObjectShader/vertex.glsl", "DefaultObjectShader/fragment.glsl") else: self.warn( "Tesselation is only experimental!...
[ "def wireframeShader(self):\n return self._wireframe_shader", "def solidShader(self):\n return self._solid_shader", "def solidFlatShader(self):\n return self._solid_flat_shader", "def ShaderObjects(self, *args):\n return _Graphic3d.Graphic3d_ShaderProgram_ShaderObjects(self, *args)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets a scattering model to use. Only has an effect if enableScattering is enabled
def setScattering(self, scatteringModel): self.debug("Loading scattering model ..") if not self.settings.enableScattering: self.error("You cannot set a scattering model as scattering is not" " enabled in your pipeline.ini!") return self.lightingCo...
[ "def enableDefaultEarthScattering(self):\n earthScattering = Scattering()\n\n scale = 1000000000\n earthScattering.setSettings({\n \"atmosphereOffset\": Vec3(0, 0, - (6360.0 + 9.5) * scale),\n \"atmosphereScale\": Vec3(scale)\n })\n earthScattering.precompute...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds a standard scattering model, representing the atmosphere of the earth. This is a shortcut for creating a Scattering instance and precomputing it
def enableDefaultEarthScattering(self): earthScattering = Scattering() scale = 1000000000 earthScattering.setSettings({ "atmosphereOffset": Vec3(0, 0, - (6360.0 + 9.5) * scale), "atmosphereScale": Vec3(scale) }) earthScattering.precompute() self.s...
[ "def setScattering(self, scatteringModel):\n self.debug(\"Loading scattering model ..\")\n if not self.settings.enableScattering:\n self.error(\"You cannot set a scattering model as scattering is not\"\n \" enabled in your pipeline.ini!\")\n return\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the light source for the global illumination. The GI uses this light to shade the voxels, so this light is the only light which "casts" global illumination. When GI is disabled, this has no effect
def setGILightSource(self, light): if self.settings.enableGlobalIllumination: self.globalIllum.setTargetLight(light)
[ "def setTargetLight(self, target):\n self.targetLight = target", "def set_lighting(self):\n prop = self.GetProperty()\n prop.SetAmbient(0.)\n prop.SetDiffuse(0.)\n prop.SetSpecular(1.0)", "def on(self):\n self.light.turnOn()", "def GUI_Set_Light_Intensity(self):\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Genrates the global shader include which defines most values used in the shaders.
def _generateShaderConfiguration(self): self.debug("(Re)Generating shader configuration") # Generate list of defines defines = [] if self.settings.antialiasingTechnique == "SMAA": quality = self.settings.smaaQuality.upper() if quality in ["LOW", "MEDIUM", "HIGH...
[ "def _build_uniforms(self):\n\n # We might rebuild the program because of snippets but we must\n # keep already bound uniforms\n\n count = 0\n for (name,gtype) in self.all_uniforms:\n if name not in self._uniforms.keys():\n uniform = Uniform(self, name, gtype)\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Call this whenever the window resized
def onWindowResized(self): raise NotImplementedError()
[ "def resize(self, event):\n self.redraw()", "def resizeEvent(self, e):\n\n self.initUI()", "def window_resize(self):\r\n\r\n offset = (self.canvas.winfo_width()-self.container.winfo_reqwidth(),\r\n self.canvas.winfo_height()-self.container.winfo_reqheight())\r\n self...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This reloads the whole pipeline, same as destroy(); create()
def reload(self): self.debug("Reloading pipeline") self.destroy() self.create()
[ "def reload_pipeline():\n\n api.uninstall()\n _uninstall_menu()\n\n for module in (\"avalon.api\",\n \"avalon.io\",\n \"avalon.lib\",\n \"avalon.pipeline\",\n \"avalon.tools\",\n \"avalon.nuke\",\n \...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Method that makes a decision about worker placement
def decide_place(self, wid): x = 0 y = 0 while x < 6 and y < 6: worker_present = self.__state.get_worker_id(x, y) if worker_present is None and self.__rule_checker.check_place(self.__pid, wid, x, y): return (x, y) x += 1 y += 1 ...
[ "def getWorker(self, position: Union[Unit, Point2, Point3]):\n workersGathering: Units = self.workers.gathering\n\n if workersGathering:\n # select worker closest to pos or unit\n return workersGathering.closest_to(position)\n else:\n raise Exception(\"There are...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Method that makes a decision about where to build
def decide_build(self, action): pass
[ "def _check_custom_build(self):\n pass", "def build(self):\n if self.moveCloseToObject(self.radius[Locals.BUILD], self.currentTask):\n Builder.build(self)", "def buildBase(self):\n if bool(self.expansionLocations):\n location: Point2 = self.expansionLocations.pop(0)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reads file and stores base64 data in database based on creation date.
def read_file_data(filepath, pin, time_session): create_time = time.gmtime(os.path.getmtime(filepath)) create_datetime = datetime.fromtimestamp(time.mktime(create_time)) # Open file and read data with open(filepath, "rb") as f: data_raw = f.read() # Encode to base64 b64data = base64.b64e...
[ "def _encode_file_base64_(self, file_path):\n encoded_file = base64.b64encode(open(file_path, 'rb').read())\n return self._base64_to_str(encoded_file)\n # return str(encoded_file)[2:-1]", "def base64_read_file(filepath):\n with open(filepath, 'rb') as stream:\n data = stream.read()\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calling ``bridges.Bridge.getID()`` should return the binary encoded ``fingerprint``.
def test_integration_getID(self): bridge = bridges.Bridge(self.nickname, self.ip, self.orport, self.fingerprint) self.assertEqual(self.id_digest, bridge.getID())
[ "def getparticipantid(conn, fingerprint):\n oid = intquery(conn, \"select original_id from participant where \" \\\n + \"fingerprint=%s\", (fingerprint,))\n if oid != 0:\n return oid\n\n return intquery(conn, \"select idparticipant from participant where \" \\\n + \"fingerprint=%s\", (fing...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test setting the `verified` attribute on a Bridge.
def test_integration_setVerified(self): raise unittest.SkipTest( ("The setVerified() and isVerified() methods were not refactored " "into the new bridgedb.bridges.Bridge class, as it's not clear " "yet if they are necessary. Skip these tests for now.")) bridge = br...
[ "def test_account_verified(self):\n user = User.objects.get()\n token, uid = RegistrationAPIView.send_account_activation_email(user=user, send_email=False)\n response = self.verify_account(token, uid)\n self.assertEqual(response.status_code, status.HTTP_200_OK)\n\n user = User.obj...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test setting the `running` and `stable` attributes on a Bridge.
def test_integration_setRunningStable(self): bridge = bridges.Bridge(self.nickname, self.ip, self.orport, self.fingerprint) self.assertFalse(bridge.running) self.assertFalse(bridge.stable) bridge.setStatus(True, True) self.assertTrue(bridge.running...
[ "def test_BridgeBackwardsCompatibility_setStatus_running(self):\n bridge = bridges.BridgeBackwardsCompatibility(\n nickname=self.nickname,\n ip=self.address,\n orport=\"anyport\",\n fingerprint=self.fingerprint,\n or_addresses={\"2006:42::123F\": 443, \"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Should return a config line without a fingerprint.
def test_integration_getConfigLine_vanilla_withoutFingerprint(self): #self.skip = True bridge = bridges.Bridge('nofpr', '23.23.23.23', 2323, self.fingerprint, or_addresses=self.or_addresses) bridgeLine = bridge.getConfigLine() ip = bridgeLine.split(':')[0]...
[ "def test_integration_getConfigLine_vanilla_withFingerprint(self):\n bridge = bridges.Bridge('fpr', '23.23.23.23', 2323,\n id_digest=self.id_digest,\n or_addresses=self.or_addresses)\n bridgeLine = bridge.getConfigLine(includeFingerprint=Tr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Should return a config line with a fingerprint.
def test_integration_getConfigLine_vanilla_withFingerprint(self): bridge = bridges.Bridge('fpr', '23.23.23.23', 2323, id_digest=self.id_digest, or_addresses=self.or_addresses) bridgeLine = bridge.getConfigLine(includeFingerprint=True) ...
[ "def test_integration_getConfigLine_vanilla_withoutFingerprint(self):\n #self.skip = True\n bridge = bridges.Bridge('nofpr', '23.23.23.23', 2323, self.fingerprint,\n or_addresses=self.or_addresses)\n bridgeLine = bridge.getConfigLine()\n ip = bridgeLine.spl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Should return a scramblesuit config line with a fingerprint.
def test_integration_getConfigLine_scramblesuit_withFingerprint(self): bridge = bridges.Bridge('philipkdick', '23.23.23.23', 2323, id_digest=self.id_digest, or_addresses=self.or_addresses) ptArgs = {'password': 'NEQGQYLUMUQGK5TFOJ4XI2DJNZTS...
[ "def test_integration_getConfigLine_vanilla_withFingerprint(self):\n bridge = bridges.Bridge('fpr', '23.23.23.23', 2323,\n id_digest=self.id_digest,\n or_addresses=self.or_addresses)\n bridgeLine = bridge.getConfigLine(includeFingerprint=Tr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Upon initialisation, all flags should be ``False``.
def test_init(self): for flag in self._all_flag_names: f = getattr(self.flags, flag, None) self.assertFalse(f, "%s should be False" % flag)
[ "def IsInitOnly(self) -> bool:", "def setInitialFlags(self):\n\n self.isRebalanceTriggered()\n self.isRestructureTriggered()", "def disabledInit(self) -> None:\n ...", "def __initialise_states(self):\n\n # Start not dead and not powered up\n self.powered_up = False\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Setting the Stable flag to ``True`` should result in Flags.stable being ``True``.
def test_settingStable(self): self.flags.stable = True self.assertTrue(self.flags.stable, "The Stable flag should be True")
[ "def test_update_Fast_Stable(self):\n self.flags.update([\"Fast\", \"Stable\"])\n self.assertTrue(self.flags.fast)\n self.assertTrue(self.flags.stable)", "def test_update_Fast(self):\n self.flags.update([\"Fast\"])\n self.assertTrue(self.flags.fast)\n self.assertFalse(sel...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Setting the Running flag to ``True`` should result in Flags.running being ``True``.
def test_settingRunning(self): self.flags.running = True self.assertTrue(self.flags.running, "The Running flag should be True")
[ "def is_running(self, is_running):\n\n self._is_running = is_running", "def mark_as_running(self):\n self.status = self.STATUS_RUNNING\n self.started_running_datetime = timezone.now()\n self.clean()\n self.save()", "def set_cmdrunning(self, cmdrunning):\n self.cmdrunnin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test changing flags with the update() method.
def test_update_Fast_Stable(self): self.flags.update(["Fast", "Stable"]) self.assertTrue(self.flags.fast) self.assertTrue(self.flags.stable)
[ "def test_update_Fast(self):\n self.flags.update([\"Fast\"])\n self.assertTrue(self.flags.fast)\n self.assertFalse(self.flags.stable)", "def test_stable_update_true(self):\n try:\n self.view001(update='true')\n except Exception as err:\n self.fail('An unexp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test changing flags with the update() method.
def test_update_Fast(self): self.flags.update(["Fast"]) self.assertTrue(self.flags.fast) self.assertFalse(self.flags.stable)
[ "def test_update_Fast_Stable(self):\n self.flags.update([\"Fast\", \"Stable\"])\n self.assertTrue(self.flags.fast)\n self.assertTrue(self.flags.stable)", "def test_stable_update_true(self):\n try:\n self.view001(update='true')\n except Exception as err:\n s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test adding the HSDir flag with the update() method.
def test_update_HSDir(self): self.flags.update(["Fast", "Stable", "HSDir"]) self.assertTrue(self.flags.fast) self.assertTrue(self.flags.stable) # We don't care about the HSDir flag: self.assertIsNone(getattr(self.flags, "hsdir", None))
[ "def test_vrfs_update(self):\n pass", "def test_update(self):\n # this is really tested graphically, no unit test here\n pass", "def test_full_update_system(self):\n pass", "def test_update_level(self):\n pass", "def test_update_on_close(self):\n buff = self.make_co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test adding a completely madeup flag, "Unicorn", with the update() method. (It shouldn't get added.)
def test_update_Unicorn(self): self.flags.update(["Unicorn"]) # We don't care about the make-believe Unicorn flag: self.assertIsNone(getattr(self.flags, "unicorn", None))
[ "def test_update_Fast(self):\n self.flags.update([\"Fast\"])\n self.assertTrue(self.flags.fast)\n self.assertFalse(self.flags.stable)", "def test_patch_feature_flag(self):\n pass", "def test_update_Fast_Stable(self):\n self.flags.update([\"Fast\", \"Stable\"])\n self.as...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The BridgeAddressBase's _address and _fingerprint should be None.
def test_BridgeAddressBase_init(self): self.assertIsNone(self.bab._address) self.assertIsNone(self.bab._fingerprint)
[ "def test_BridgeAddressBase_address_del(self):\n self.bab.address = '11.12.13.14'\n self.assertEqual(self.bab.address, ipaddr.IPv4Address('11.12.13.14'))\n\n del(self.bab.address)\n self.assertIsNone(self.bab.address)\n self.assertIsNone(self.bab._address)", "def test_integratio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The del method for the fingerprint property should reset the fingerprint to None.
def test_BridgeAddressBase_fingerprint_del(self): self.bab.fingerprint = self.fingerprint self.assertEqual(self.bab.fingerprint, self.fingerprint) del(self.bab.fingerprint) self.assertIsNone(self.bab.fingerprint) self.assertIsNone(self.bab._fingerprint)
[ "def propdel(self, key):\n self.properties[key] = None", "def __del__(self):\n self.clear()", "def __del__( self ):\n\t\tLiFlame.degrid()", "def __del__(self):\n self.__class__.reference_count -= 1\n if self.__class__.reference_count == 0:\n print \"Number of reference_c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The del method for the address property should reset the address to None.
def test_BridgeAddressBase_address_del(self): self.bab.address = '11.12.13.14' self.assertEqual(self.bab.address, ipaddr.IPv4Address('11.12.13.14')) del(self.bab.address) self.assertIsNone(self.bab.address) self.assertIsNone(self.bab._address)
[ "def remove_address(self, address_id):\n pass", "def _clear_address(self):\n for part_addr in [\n \"street\",\n \"house\",\n \"slash\",\n \"letter\",\n \"corpus\",\n \"building\",\n \"room\",\n \"hotel\",\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initialising a PluggableTransport with args should work.
def test_PluggableTransport_init_with_parameters(self): pt = bridges.PluggableTransport(self.fingerprint, "voltronPT", "1.2.3.4", 443, {'sharedsecret': 'foobar'}) self.assertIsInstance(pt, bridges.PluggableTransport)
[ "def test_PluggableTransport_init(self):\n pt = bridges.PluggableTransport()\n self.assertIsInstance(pt, bridges.PluggableTransport)", "def _InitTransport(self):\n if self.transport is None:\n self.transport = \\\n self.transport_class(self._GetAddress(),\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initialising a PluggableTransport without args should work.
def test_PluggableTransport_init(self): pt = bridges.PluggableTransport() self.assertIsInstance(pt, bridges.PluggableTransport)
[ "def test_PluggableTransport_init_with_parameters(self):\n pt = bridges.PluggableTransport(self.fingerprint,\n \"voltronPT\", \"1.2.3.4\", 443,\n {'sharedsecret': 'foobar'})\n self.assertIsInstance(pt, bridges.PluggableTrans...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parsing a valid list of PT args should return a dictionary.
def test_PluggableTransport_parseArgumentsIntoDict_valid_list(self): pt = bridges.PluggableTransport() args = pt._parseArgumentsIntoDict(["sharedsecret=foobar", "publickey=1234"]) self.assertIsInstance(args, dict) self.assertItemsEqual(args, {"s...
[ "def test_PluggableTransport_parseArgumentsIntoDict_valid_list_multi(self):\n pt = bridges.PluggableTransport()\n args = pt._parseArgumentsIntoDict([\"sharedsecret=foobar,password=baz\",\n \"publickey=1234\"])\n self.assertIsInstance(args, dict)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parsing a valid list with multiple PT args in a single list element should return a dictionary.
def test_PluggableTransport_parseArgumentsIntoDict_valid_list_multi(self): pt = bridges.PluggableTransport() args = pt._parseArgumentsIntoDict(["sharedsecret=foobar,password=baz", "publickey=1234"]) self.assertIsInstance(args, dict) self.assertI...
[ "def parse_ptask(l) :\n task = {}\n l = l.strip()\n s = l.split(',')\n task['max_inst'] = 3\n for x in s :\n prop_extract(x, 'name', task)\n prop_extract(x, 'ctime', task)\n prop_extract(x, 'period', task)\n prop_extract(x, 'deadline', task)\n prop_extract(x, 'max_i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calling _checkArguments on a scramblesuit PT without a password should raise a MalformedPluggableTransport exception.
def test_PluggableTransport_checkArguments_scramblesuit_missing_password(self): pt = bridges.PluggableTransport() self.assertRaises( bridges.MalformedPluggableTransport, pt.updateFromStemTransport, self.fingerprint, 'scramblesuit', ('34.230.223.87', 37341, []))
[ "def test_PluggableTransport_runChecks_invalid_pt_args(self):\n try:\n pt = bridges.PluggableTransport(self.fingerprint,\n \"voltronPT\", \"1.2.3.4\", 443,\n 'sharedsecret=foobar')\n except Exception as er...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calling _checkArguments on an obfs4 PT without an iatmode argument should raise a MalformedPluggableTransport exception.
def test_PluggableTransport_checkArguments_obfs4_missing_iatmode(self): pt = bridges.PluggableTransport() self.assertRaises( bridges.MalformedPluggableTransport, pt.updateFromStemTransport, self.fingerprint, 'obfs4', ('34.230.223.87', 37341, [ 'cert=UX...
[ "def test_PluggableTransport_checkArguments_obfs4_missing_cert(self):\n pt = bridges.PluggableTransport()\n self.assertRaises(\n bridges.MalformedPluggableTransport,\n pt.updateFromStemTransport,\n self.fingerprint, 'obfs4', ('34.230.223.87', 37341, ['iat-mode=1']))", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calling _checkArguments on an obfs4 PT without a cert argument should raise a MalformedPluggableTransport exception.
def test_PluggableTransport_checkArguments_obfs4_missing_cert(self): pt = bridges.PluggableTransport() self.assertRaises( bridges.MalformedPluggableTransport, pt.updateFromStemTransport, self.fingerprint, 'obfs4', ('34.230.223.87', 37341, ['iat-mode=1']))
[ "def test_PluggableTransport_runChecks_invalid_pt_args(self):\n try:\n pt = bridges.PluggableTransport(self.fingerprint,\n \"voltronPT\", \"1.2.3.4\", 443,\n 'sharedsecret=foobar')\n except Exception as er...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calling _checkArguments on an obfs4 PT without a publickey argument should raise a MalformedPluggableTransport exception.
def test_PluggableTransport_checkArguments_obfs4_missing_publickey(self): pt = bridges.PluggableTransport() self.assertRaises( bridges.MalformedPluggableTransport, pt.updateFromStemTransport, self.fingerprint, 'obfs4', ('34.230.223.87', 37341, [ ('iat-...
[ "def test_PluggableTransport_runChecks_invalid_pt_args(self):\n try:\n pt = bridges.PluggableTransport(self.fingerprint,\n \"voltronPT\", \"1.2.3.4\", 443,\n 'sharedsecret=foobar')\n except Exception as er...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calling _runChecks() on a PluggableTransport with an invalid fingerprint should raise a MalformedPluggableTransport exception.
def test_PluggableTransport_runChecks_invalid_fingerprint(self): pt = bridges.PluggableTransport() self.assertRaises( bridges.MalformedPluggableTransport, pt.updateFromStemTransport, "INVALIDFINGERPRINT", 'obfs4', ('34.230.223.87', 37341, [ ('iat-mode=...
[ "def test_PluggableTransport_runChecks_invalid_ip(self):\n pt = bridges.PluggableTransport()\n self.assertRaises(\n bridges.InvalidPluggableTransportIP,\n pt.updateFromStemTransport,\n self.fingerprint, 'obfs4', ('34.230.223', 37341, [\n ('iat-mode=0,'\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calling _runChecks() on a PluggableTransport with an invalid IP address should raise a InvalidPluggableTransportIP exception.
def test_PluggableTransport_runChecks_invalid_ip(self): pt = bridges.PluggableTransport() self.assertRaises( bridges.InvalidPluggableTransportIP, pt.updateFromStemTransport, self.fingerprint, 'obfs4', ('34.230.223', 37341, [ ('iat-mode=0,' ...
[ "def test_PluggableTransport_runChecks_invalid_pt_args(self):\n try:\n pt = bridges.PluggableTransport(self.fingerprint,\n \"voltronPT\", \"1.2.3.4\", 443,\n 'sharedsecret=foobar')\n except Exception as er...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calling _runChecks() on a PluggableTransport with an invalid port should raise a MalformedPluggableTransport exception.
def test_PluggableTransport_runChecks_invalid_port_type(self): pt = bridges.PluggableTransport() self.assertRaises( bridges.MalformedPluggableTransport, pt.updateFromStemTransport, self.fingerprint, 'obfs4', ('34.230.223.87', "anyport", [ ('iat-mode=0,...
[ "def test_PluggableTransport_runChecks_invalid_port_range(self):\n pt = bridges.PluggableTransport()\n self.assertRaises(\n bridges.MalformedPluggableTransport,\n pt.updateFromStemTransport,\n self.fingerprint, 'obfs4', ('34.230.223.87', 65536, [\n ('iat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calling _runChecks() on a PluggableTransport with an invalid port (too high) should raise a MalformedPluggableTransport exception.
def test_PluggableTransport_runChecks_invalid_port_range(self): pt = bridges.PluggableTransport() self.assertRaises( bridges.MalformedPluggableTransport, pt.updateFromStemTransport, self.fingerprint, 'obfs4', ('34.230.223.87', 65536, [ ('iat-mode=0,' ...
[ "def test_PluggableTransport_runChecks_invalid_port_type(self):\n pt = bridges.PluggableTransport()\n self.assertRaises(\n bridges.MalformedPluggableTransport,\n pt.updateFromStemTransport,\n self.fingerprint, 'obfs4', ('34.230.223.87', \"anyport\", [\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calling _runChecks() on a PluggableTransport with an invalid PT args should raise a MalformedPluggableTransport exception.
def test_PluggableTransport_runChecks_invalid_pt_args(self): try: pt = bridges.PluggableTransport(self.fingerprint, "voltronPT", "1.2.3.4", 443, 'sharedsecret=foobar') except Exception as error: ...
[ "def test_PluggableTransport_runChecks_invalid_ip(self):\n pt = bridges.PluggableTransport()\n self.assertRaises(\n bridges.InvalidPluggableTransportIP,\n pt.updateFromStemTransport,\n self.fingerprint, 'obfs4', ('34.230.223', 37341, [\n ('iat-mode=0,'\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If the 'Bridge ' prefix was requested, then it should be at the beginning of the bridge line.
def test_PluggableTransport_getTransportLine_bridge_prefix(self): pt = bridges.PluggableTransport(self.fingerprint, "voltronPT", "1.2.3.4", 443, {'sharedsecret': 'foobar', 'password': 'unicor...
[ "def test_Bridge_getBridgeLine_bridge_prefix(self):\n self.bridge.updateFromNetworkStatus(self.networkstatus)\n self.bridge.updateFromServerDescriptor(self.serverdescriptor)\n self.bridge.updateFromExtraInfoDescriptor(self.extrainfo)\n\n request = BridgeRequestBase()\n request.isV...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check the order and content of the bridge line string.
def test_PluggableTransport_getTransportLine_content_order(self): pt = bridges.PluggableTransport(self.fingerprint, "voltronPT", "1.2.3.4", 443, {'sharedsecret': 'foobar', 'password': 'unicor...
[ "def test_Bridge_getBridgeLine_request_valid(self):\n self.bridge.updateFromNetworkStatus(self.networkstatus)\n self.bridge.updateFromServerDescriptor(self.serverdescriptor)\n self.bridge.updateFromExtraInfoDescriptor(self.extrainfo)\n\n request = BridgeRequestBase()\n request.isV...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The PT arguments in a bridge line should be spaceseparated.
def test_PluggableTransport_getTransportLine_ptargs_space_delimited(self): pt = bridges.PluggableTransport(self.fingerprint, "voltronPT", "1.2.3.4", 443, {'sharedsecret': 'foobar', 'password'...
[ "def parse_instruction(self, line):\n instruction, *args = line.strip().replace(',', '').split()\n return instruction, args", "def _split_args_line(line):\n lexer = lap.Lexer(line)\n scanner = lap.Parser(lexer)\n tree = scanner.input_line()\n\n extractor = lap.QueryParamsExtractor()\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Using setStatus() to set the Stable flag should set Bridge.stable and Bridge.flags.stable to True.
def test_BridgeBackwardsCompatibility_setStatus_stable(self): bridge = bridges.BridgeBackwardsCompatibility( nickname=self.nickname, ip=self.address, orport=self.orPort, fingerprint=self.fingerprint, or_addresses={"2006:42::123F": 443, "2006:42::123E":...
[ "def test_integration_setRunningStable(self):\n bridge = bridges.Bridge(self.nickname, self.ip, self.orport,\n self.fingerprint)\n self.assertFalse(bridge.running)\n self.assertFalse(bridge.stable)\n bridge.setStatus(True, True)\n self.assertTrue(bri...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Using setStatus() to set the Running flag should set Bridge.running and Bridge.flags.running to True.
def test_BridgeBackwardsCompatibility_setStatus_running(self): bridge = bridges.BridgeBackwardsCompatibility( nickname=self.nickname, ip=self.address, orport="anyport", fingerprint=self.fingerprint, or_addresses={"2006:42::123F": 443, "2006:42::123E": ...
[ "def test_integration_setRunningStable(self):\n bridge = bridges.Bridge(self.nickname, self.ip, self.orport,\n self.fingerprint)\n self.assertFalse(bridge.running)\n self.assertFalse(bridge.stable)\n bridge.setStatus(True, True)\n self.assertTrue(bri...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reset safelogging to its default (disabled) state, due to test_Bridge_str_with_safelogging changing it.
def tearDown(self): bridges.safelog.safe_logging = False
[ "def disable_logging():\n logging.shutdown()", "def silence_log_messages_by_default():\n logging.basicConfig(handlers=(logging.NullHandler(),))", "def disable():\n ActionLogger.disable()", "def disable_scribe_logging():\n app.set_option(\"_SCRIBE_LOG_LEVEL\", LogOptions._LOG_LEVEL_NONE_KEY, force=Tr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The del method for the nickname property should reset the nickname to None.
def test_Bridge_nickname_del(self): self.bridge.updateFromNetworkStatus(self.networkstatus) self.assertEqual(self.bridge.nickname, "FourfoldQuirked") del(self.bridge.nickname) self.assertIsNone(self.bridge.nickname) self.assertIsNone(self.bridge._nickname)
[ "def delName(self, value):\n value = valueToInt(value)\n if value < 0 or value > len(self._nameList) - 1:\n self.log.warning('invalid value: {0}'.format(value))\n return\n self._nameList.pop(value)", "def deluser(self, nick):\n if self.users.has_key(nick):\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The del method for the orPort property should reset the orPort to None.
def test_Bridge_orport_del(self): self.bridge.updateFromNetworkStatus(self.networkstatus) self.assertEqual(self.bridge.orPort, 36489) del(self.bridge.orPort) self.assertIsNone(self.bridge.orPort) self.assertIsNone(self.bridge._orPort)
[ "def delete_port(port):\n return IMPL.delete_port(port)", "def _port_unbound_update(self, context, port):\n LOG.info(\"Port becoming unbound: destroy.\")\n self.transport.endpoint_deleted(port)", "def test_delete_logical_router_port(self):\n lrport = self._mocked_lrport()\n\n uuid...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The str() method of a Bridge should return an identifier for the Bridge, which should be different if safelogging is enabled.
def test_Bridge_str_without_safelogging(self): bridges.safelog.safe_logging = False bridge = bridges.Bridge() bridge.updateFromNetworkStatus(self.networkstatus) identifier = str(bridge) self.assertEqual(identifier, ''.join(['$', bridge.fingerprint, ...
[ "def test_Bridge_str_with_safelogging(self):\n bridges.safelog.safe_logging = True\n\n bridge = bridges.Bridge()\n bridge.updateFromNetworkStatus(self.networkstatus)\n\n identifier = str(bridge)\n self.assertEqual(\n identifier,\n ''.join(['$$',\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The str() method of a Bridge should return an identifier for the Bridge, which should be different if safelogging is enabled.
def test_Bridge_str_with_safelogging(self): bridges.safelog.safe_logging = True bridge = bridges.Bridge() bridge.updateFromNetworkStatus(self.networkstatus) identifier = str(bridge) self.assertEqual( identifier, ''.join(['$$', hashli...
[ "def test_Bridge_str_without_safelogging(self):\n bridges.safelog.safe_logging = False\n\n bridge = bridges.Bridge()\n bridge.updateFromNetworkStatus(self.networkstatus)\n\n identifier = str(bridge)\n self.assertEqual(identifier,\n ''.join(['$', bridge.fing...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The str() method of a Bridge should return an identifier for the Bridge, which should be different if the fingerprint is unknown.
def test_Bridge_str_without_fingerprint(self): bridge = bridges.Bridge() bridge.updateFromNetworkStatus(self.networkstatus) del(bridge.fingerprint) identifier = str(bridge) self.assertEqual(identifier, ''.join(['$', '0'*40, ...
[ "def test_Bridge_str_without_fingerprint_without_nickname(self):\n bridge = bridges.Bridge()\n identifier = str(bridge)\n self.assertEqual(identifier, ''.join(['$', '0'*40, '~', 'Unnamed']))", "def test_Bridge_str_without_safelogging(self):\n bridges.safelog.safe_logging = False\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calling str(Bridge) on a Bridge whose fingerprint and nickname were not set should return a Bridge identifier string where the fingerprint is all 0's and the nickname is "Unnamed".
def test_Bridge_str_without_fingerprint_without_nickname(self): bridge = bridges.Bridge() identifier = str(bridge) self.assertEqual(identifier, ''.join(['$', '0'*40, '~', 'Unnamed']))
[ "def test_Bridge_str_without_fingerprint(self):\n bridge = bridges.Bridge()\n bridge.updateFromNetworkStatus(self.networkstatus)\n del(bridge.fingerprint)\n\n identifier = str(bridge)\n self.assertEqual(identifier,\n ''.join(['$', '0'*40,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Bridge._constructBridgeLine() called with an IPv6 address should wrap the IPv6 address in '[]' in the returned bridge line.
def test_Bridge_constructBridgeLine_IPv6(self): bridge = bridges.Bridge() addrport = (u'6bf3:806b:78cd::4ced:cfad:dad4', 36488, 6) bridgeline = bridge._constructBridgeLine(addrport, includeFingerprint=False, ...
[ "def test_Bridge_getBridgeLine_IPv6(self):\n self.bridge.updateFromNetworkStatus(self.networkstatus)\n self.bridge.updateFromServerDescriptor(self.serverdescriptor)\n self.bridge.updateFromExtraInfoDescriptor(self.extrainfo)\n\n request = BridgeRequestBase()\n request.isValid(True...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Bridge.allVanillaAddresses should be idempotent, i.e. calling allVanillaAddresses should not affect the results of subsequent calls.
def test_Bridge_allVanillaAddresses_idempotency_self(self): self.bridge.address = '1.1.1.1' self.bridge.orPort = 443 self.assertItemsEqual(self.bridge.allVanillaAddresses, [(ipaddr.IPv4Address('1.1.1.1'), 443, 4)]) self.assertItemsEqual(self.bridge.allVanill...
[ "def test_Bridge_allVanillaAddresses_reentrancy_address(self):\n self.bridge.orPort = 443\n self.assertItemsEqual(self.bridge.allVanillaAddresses,\n [(None, 443, 4)])\n self.bridge.address = '1.1.1.1'\n self.assertItemsEqual(self.bridge.allVanillaAddresses,\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Bridge.allVanillaAddresses should be idempotent, i.e. calling allVanillaAddresses should not affect any of the Bridge's other attributes (such as Bridge.orAddresses).
def test_Bridge_allVanillaAddresses_idempotency_others(self): self.bridge.address = '1.1.1.1' self.bridge.orPort = 443 self.assertItemsEqual(self.bridge.orAddresses, []) self.assertItemsEqual(self.bridge.allVanillaAddresses, [(ipaddr.IPv4Address('1.1.1.1'), ...
[ "def test_Bridge_allVanillaAddresses_idempotency_self(self):\n self.bridge.address = '1.1.1.1'\n self.bridge.orPort = 443\n self.assertItemsEqual(self.bridge.allVanillaAddresses,\n [(ipaddr.IPv4Address('1.1.1.1'), 443, 4)])\n self.assertItemsEqual(self.bridge...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calling Bridge.allVanillaAddresses before Bridge.orPort is set should return ``None`` for the port value, and after Bridge.orPort is set, it should return the orPort.
def test_Bridge_allVanillaAddresses_reentrancy_orPort(self): self.bridge.address = '1.1.1.1' self.assertItemsEqual(self.bridge.orAddresses, []) self.assertItemsEqual(self.bridge.allVanillaAddresses, [(ipaddr.IPv4Address('1.1.1.1'), None, 4)]) self.assertItem...
[ "def test_Bridge_allVanillaAddresses_reentrancy_orAddresses(self):\n self.bridge.address = '1.1.1.1'\n self.bridge.orPort = 443\n self.assertItemsEqual(self.bridge.allVanillaAddresses,\n [(ipaddr.IPv4Address('1.1.1.1'), 443, 4)])\n self.assertItemsEqual(self....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calling Bridge.allVanillaAddresses before Bridge.address is set should return ``None`` for the address value, and after Bridge.address is set, it should return the address.
def test_Bridge_allVanillaAddresses_reentrancy_address(self): self.bridge.orPort = 443 self.assertItemsEqual(self.bridge.allVanillaAddresses, [(None, 443, 4)]) self.bridge.address = '1.1.1.1' self.assertItemsEqual(self.bridge.allVanillaAddresses, ...
[ "def test_Bridge_allVanillaAddresses_idempotency_self(self):\n self.bridge.address = '1.1.1.1'\n self.bridge.orPort = 443\n self.assertItemsEqual(self.bridge.allVanillaAddresses,\n [(ipaddr.IPv4Address('1.1.1.1'), 443, 4)])\n self.assertItemsEqual(self.bridge...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calling Bridge.allVanillaAddresses before Bridge.orAddresses is set should return only the Bridge's address and orPort.
def test_Bridge_allVanillaAddresses_reentrancy_orAddresses(self): self.bridge.address = '1.1.1.1' self.bridge.orPort = 443 self.assertItemsEqual(self.bridge.allVanillaAddresses, [(ipaddr.IPv4Address('1.1.1.1'), 443, 4)]) self.assertItemsEqual(self.bridge.orA...
[ "def test_Bridge_allVanillaAddresses_reentrancy_orPort(self):\n self.bridge.address = '1.1.1.1'\n self.assertItemsEqual(self.bridge.orAddresses, [])\n self.assertItemsEqual(self.bridge.allVanillaAddresses,\n [(ipaddr.IPv4Address('1.1.1.1'), None, 4)])\n self....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Bridge._updateORAddresses() called with a mixture of valid and invalid ORAddress tuples should only retain the valid ones.
def test_Bridge_updateORAddresses_valid_and_invalid(self): orAddresses = [ (u'1.1.1.1', 1111, False), # valid (u'127.0.0.1', 2222, False), # invalid IPv4 loopback (u'FE80::1234', 3333, True)] # invalid IPv6 link local bridge = bridges.Bridge() bridge._upd...
[ "def test_Bridge_updateFromNetworkStatus_IPv4_ORAddress(self):\n # Add an additional IPv4 ORAddress:\n ns = BRIDGE_NETWORKSTATUS.replace(\n 'a [6bf3:806b:78cd:d4b4:f6a7:4ced:cfad:dad4]:36488',\n 'a [6bf3:806b:78cd:d4b4:f6a7:4ced:cfad:dad4]:36488\\na 123.34.56.78:36488')\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calling updateFromNetworkStatus() with a descriptor which has an IPv4 address as an additional ORAddress should result in a FutureWarning before continuing parsing.
def test_Bridge_updateFromNetworkStatus_IPv4_ORAddress(self): # Add an additional IPv4 ORAddress: ns = BRIDGE_NETWORKSTATUS.replace( 'a [6bf3:806b:78cd:d4b4:f6a7:4ced:cfad:dad4]:36488', 'a [6bf3:806b:78cd:d4b4:f6a7:4ced:cfad:dad4]:36488\na 123.34.56.78:36488') self._write...
[ "def test_Bridge_updateORAddresses_valid_and_invalid(self):\n orAddresses = [\n (u'1.1.1.1', 1111, False), # valid\n (u'127.0.0.1', 2222, False), # invalid IPv4 loopback\n (u'FE80::1234', 3333, True)] # invalid IPv6 link local\n bridge = bridges.Bridge()\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parsing a server descriptor for a bridge which wasn't included in the networkstatus document from the BridgeAuthority should raise a ServerDescriptorWithoutNetworkstatus exception.
def test_Bridge_updateFromServerDescriptor_no_networkstatus(self): self.assertRaises(bridges.ServerDescriptorWithoutNetworkstatus, self.bridge.updateFromServerDescriptor, self.serverdescriptor)
[ "def test_Bridge_updateFromServerDescriptor_ignoreNetworkstatus_no_networkstatus(self):\n self.bridge.updateFromServerDescriptor(self.serverdescriptor,\n ignoreNetworkstatus=True)\n self.assertIsNone(self.bridge.descriptors['networkstatus'])\n self....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parsing a server descriptor for a bridge which wasn't included in the networkstatus document from the BridgeAuthority, when ignoreNetworkstatus=True, should not raise any warnings.
def test_Bridge_updateFromServerDescriptor_ignoreNetworkstatus_no_networkstatus(self): self.bridge.updateFromServerDescriptor(self.serverdescriptor, ignoreNetworkstatus=True) self.assertIsNone(self.bridge.descriptors['networkstatus']) self.assertIsN...
[ "def test_Bridge_checkServerDescriptor(self):\n # Create a networkstatus descriptor without a server descriptor digest:\n filename = self._networkstatusFile + \"-missing-digest\"\n fh = open(filename, 'w')\n invalid = BRIDGE_NETWORKSTATUS.replace(\"c4EVu2rO/iD/DJYBX/Ll38DGQWI\", \"foo\")...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calling _verifyExtraInfoSignature() with a descriptor which has a good signature should return None.
def test_Bridge_verifyExtraInfoSignature_good_signature(self): self.bridge.updateFromNetworkStatus(self.networkstatus) self.bridge.updateFromServerDescriptor(self.serverdescriptor) self.assertIsNone(self.bridge._verifyExtraInfoSignature(self.extrainfo))
[ "def test_Bridge_updateFromExtraInfoDescriptor_bad_signature_changed(self):\n # Make the signature uppercased\n BEGIN_SIG = '-----BEGIN SIGNATURE-----'\n doc, sig = BRIDGE_EXTRAINFO.split(BEGIN_SIG)\n ei = BEGIN_SIG.join([doc, sig.upper()])\n self._writeExtrainfo(ei)\n self...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calling updateFromExtraInfoDescriptor() with a descriptor which has a bad signature should not continue to process the descriptor.
def test_Bridge_updateFromExtraInfoDescriptor_bad_signature_changed(self): # Make the signature uppercased BEGIN_SIG = '-----BEGIN SIGNATURE-----' doc, sig = BRIDGE_EXTRAINFO.split(BEGIN_SIG) ei = BEGIN_SIG.join([doc, sig.upper()]) self._writeExtrainfo(ei) self._parseAllD...
[ "def test_Bridge_updateFromExtraInfoDescriptor_pt_died(self):\n self.bridge.updateFromNetworkStatus(self.networkstatus)\n self.bridge.updateFromServerDescriptor(self.serverdescriptor)\n self.bridge.updateFromExtraInfoDescriptor(self.extrainfo)\n\n self.assertEqual(len(self.bridge.transpo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calling updateFromExtraInfoDescriptor() with a descriptor which includes a different port for a known bridge with a known pluggable transport should update that transport.
def test_Bridge_updateFromExtraInfoDescriptor_pt_changed_port(self): self.bridge.updateFromNetworkStatus(self.networkstatus) self.bridge.updateFromServerDescriptor(self.serverdescriptor) self.bridge.updateFromExtraInfoDescriptor(self.extrainfo) self.assertEqual(len(self.bridge.transport...
[ "def test_Bridge_updateFromExtraInfoDescriptor_pt_died(self):\n self.bridge.updateFromNetworkStatus(self.networkstatus)\n self.bridge.updateFromServerDescriptor(self.serverdescriptor)\n self.bridge.updateFromExtraInfoDescriptor(self.extrainfo)\n\n self.assertEqual(len(self.bridge.transpo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calling updateFromExtraInfoDescriptor() with a descriptor which includes different PT args for a known bridge with a known pluggable transport should update that transport.
def test_Bridge_updateFromExtraInfoDescriptor_pt_changed_args(self): self.bridge.updateFromNetworkStatus(self.networkstatus) self.bridge.updateFromServerDescriptor(self.serverdescriptor) self.bridge.updateFromExtraInfoDescriptor(self.extrainfo) self.assertEqual(len(self.bridge.transport...
[ "def test_Bridge_updateFromExtraInfoDescriptor_pt_died(self):\n self.bridge.updateFromNetworkStatus(self.networkstatus)\n self.bridge.updateFromServerDescriptor(self.serverdescriptor)\n self.bridge.updateFromExtraInfoDescriptor(self.extrainfo)\n\n self.assertEqual(len(self.bridge.transpo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calling updateFromExtraInfoDescriptor() with a descriptor which doesn't include a previouslyknown transport should remove that transport.
def test_Bridge_updateFromExtraInfoDescriptor_pt_died(self): self.bridge.updateFromNetworkStatus(self.networkstatus) self.bridge.updateFromServerDescriptor(self.serverdescriptor) self.bridge.updateFromExtraInfoDescriptor(self.extrainfo) self.assertEqual(len(self.bridge.transports), 4) ...
[ "def test_Bridge_updateFromExtraInfoDescriptor_pt_changed_port(self):\n self.bridge.updateFromNetworkStatus(self.networkstatus)\n self.bridge.updateFromServerDescriptor(self.serverdescriptor)\n self.bridge.updateFromExtraInfoDescriptor(self.extrainfo)\n\n self.assertEqual(len(self.bridge...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parsing a networkstatus descriptor should result in Bridge.descriptorDigest being set.
def test_Bridge_descriptorDigest(self): realdigest = "738115BB6ACEFE20FF0C96015FF2E5DFC0C64162" self.bridge.updateFromNetworkStatus(self.networkstatus) self.assertEqual(self.bridge.descriptorDigest, realdigest)
[ "def test_Bridge_checkServerDescriptor(self):\n # Create a networkstatus descriptor without a server descriptor digest:\n filename = self._networkstatusFile + \"-missing-digest\"\n fh = open(filename, 'w')\n invalid = BRIDGE_NETWORKSTATUS.replace(\"c4EVu2rO/iD/DJYBX/Ll38DGQWI\", \"foo\")...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }