id int64 0 6k | code stringlengths 4k 8k | code_compressed listlengths 0 44 |
|---|---|---|
0 | #-*- coding: utf-8 -*-
from vi import utils
from vi.widgets import ListWidget, EditWidget
from vi.priorityqueue import actionDelegateSelector, ModuleWidgetSelector
from flare.i18n import translate
from vi.config import conf
from vi.pane import Pane
from flare.button import Button
class ContextAction(Button):
def __... | [
{
"body": "\t\tassert self.widget, u\"This action must be attached first!\"\n\t\tif isinstance(self.widget, ListWidget):\n\t\t\tfor s in self.widget.getCurrentSelection():\n\t\t\t\tself.openModule(s)\n\t\telif isinstance(self.widget, EditWidget):\n\t\t\td = self.widget.serializeForDocument()\n\t\t\tself.openMod... |
1 | from __future__ import annotations
import asyncio
import enum
import time
from functools import wraps
from typing import Any, Callable, Coroutine, MutableMapping, TypeVar, Protocol
from lru import LRU
R = TypeVar('R')
# Can't use ParamSpec due to https://github.com/python/typing/discussions/946
class CacheProtocol... | [
{
"body": " ...",
"name": "invalidate(self,CacheProtocol(Protocol[R]):"
},
{
"body": " ...",
"name": "invalidate_containing(self,CacheProtocol(Protocol[R]):"
},
{
"body": " self.__ttl: float = seconds\n super().__init__()",
"name": "__init__(self,CacheProt... |
2 | import logging
import os
import subprocess
import time
from dataclasses import dataclass, field
from typing import TYPE_CHECKING, Any, Dict, List, Mapping, Optional
from fastapi import FastAPI, HTTPException
from meerkat.interactive.server import Server
from meerkat.tools.utils import WeakMapping
if TYPE_CHECKING:
... | [
{
"body": " try:\n return self.api_keys[api]\n except KeyError:\n raise HTTPException(\n status_code=404,\n detail=f\"No API key found for {api}.\\\n Add one with `secrets.add(api, api_key)`.\",\n )",
"name": "get(s... |
3 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
{
"body": "\t\treturn self.get_query_params().get('DeviceLifeCycleFlag')",
"name": "get_DeviceLifeCycleFlag(self):UpdateSubscribeRelationRequest(RpcRequest):"
},
{
"body": "\t\tself.add_query_param('DeviceLifeCycleFlag',DeviceLifeCycleFlag)",
"name": "set_DeviceLifeCycleFlag(self,DeviceLifeCycle... |
4 | # MicroPython uasyncio module
# MIT license; Copyright (c) 2019-2020 Damien P. George
# This file contains the core TaskQueue based on a pairing heap, and the core Task class.
# They can optionally be replaced by C implementations.
# This file is a modified version, based on the extmod in Circuitpython, for
# unit te... | [
{
"body": " if node is heap:\n child = heap.ph_child\n node.ph_child = None\n return ph_pairing(child)\n # Find parent of node\n parent = node\n while parent.ph_next is not None:\n parent = parent.ph_next\n parent = parent.ph_rightmost_parent\n if parent is None or ... |
5 | #!/usr/bin/env python
#/*##########################################################################
#
# The PyMca X-Ray Fluorescence Toolkit
#
# Copyright (c) 2004-2014 European Synchrotron Radiation Facility
#
# This file is part of the PyMca X-ray Fluorescence Toolkit developed at
# the ESRF by the Software group.
#
... | [
{
"body": " if not os.path.exists(filename):\n return None\n self.motorNames = []",
"name": "__init__(self,SpecFileAbstractScan(object):"
},
{
"body": " \"\"\"\n If there is only one scan returns 1:1\n with two scans returns 1:2\n \"\"\"\n ... |
6 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
{
"body": "\t\treturn self.get_query_params().get('Environment')",
"name": "get_Environment(self):ListSlotRequest(RpcRequest):"
},
{
"body": "\t\tself.add_query_param('Environment', Environment)",
"name": "METHOD_NAME(self,ListSlotRequest(RpcRequest):"
}
] |
7 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
{
"body": "\t\treturn self.get_query_params().get('ListenerForward')",
"name": "get_ListenerForward(self):CreateLoadBalancerHTTPSListenerRequest(RpcRequest):"
},
{
"body": "\t\tself.add_query_param('ListenerForward', ListenerForward)",
"name": "set_ListenerForward(self,CreateLoadBalancerHTTPSLis... |
8 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
{
"body": "\t\treturn self.get_query_params().get('Description')",
"name": "get_Description(self):ModifyACLRuleRequest(RpcRequest):"
},
{
"body": "\t\tself.add_query_param('Description', Description)",
"name": "set_Description(self,ModifyACLRuleRequest(RpcRequest):"
},
{
"body": "\t\tsel... |
9 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
{
"body": "\t\treturn self.get_query_params().get('LogParams')",
"name": "get_LogParams(self):VerifyUserAuthenticationRequest(RpcRequest):"
},
{
"body": "\t\tself.add_query_param('LogParams', LogParams)",
"name": "METHOD_NAME(self,VerifyUserAuthenticationRequest(RpcRequest):"
},
{
"body"... |
10 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""`cssmin` - A Python port of the YUI CSS compressor."""
"""
Home page: https://github.com/zacharyvoase/cssmin
License: BSD: https://github.com/zacharyvoase/cssmin/blob/master/LICENSE
Original author: Zachary Voase
Modified for inclusion into web2py by: Ross Peoples <ros... | [
{
"body": " \"\"\"Remove all CSS comment blocks.\"\"\"\n iemac = False\n preserve = False\n comment_start = css.find(\"/*\")\n while comment_start >= 0:\n # Preserve comments that look like `/*!...*/`.\n # Slicing is used to make sure we don\"t get an IndexError.\n preserve =... |
11 | from io import StringIO as TextIO
from io import BytesIO as BytesIO
from typing import Any, AnyStr, Callable, Generic, IO, List, Optional, Text, Tuple, TypeVar, Union, overload
from typing_extensions import Final
import sys
_T = TypeVar("_T")
class FDCapture(Generic[AnyStr]):
def __init__(self, targetfd: int, tmp... | [
{
"body": " self,\n out: Union[bool, IO[str]] = ...,\n err: Union[bool, IO[str]] = ...,\n mixed: bool = ...,\n in_: bool = ...,\n patchsys: bool = ...,\n now: bool = ...,",
"name": "__init__(TerminalWriter:"
},
{
"body": " self,\n out: U... |
12 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
{
"body": "\t\treturn self.get_query_params().get('ArchVersion')",
"name": "get_ArchVersion(self):CreateMultiZoneClusterRequest(RpcRequest):"
},
{
"body": "\t\tself.add_query_param('ArchVersion',ArchVersion)",
"name": "set_ArchVersion(self,ArchVersion):CreateMultiZoneClusterRequest(RpcRequest):"... |
13 | from plugin import plugin
# General values for connect 4 game and board
numberRows = 6
numberColumns = 7
numToWin = 4
GameBoard = [[0] * numberColumns for j in range(numberRows)]
def restartBoard():
for i in range(numberRows):
for j in range(numberColumns):
GameBoard[i][j] = str(' ')
# Func... | [
{
"body": " # Temp row and col values to manipulate throughout function\n row = r\n col = c\n # Count matching tokens to the right. Stop when at end of board\n rightCounter = 0\n while col < numberColumns:\n if whatsAtPos(row, col) == p:\n rightCounter += 1\n else:\n ... |
14 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
{
"body": "\t\treturn self.get_query_params().get('Description')",
"name": "get_Description(self):CreateApiRequest(RpcRequest):"
},
{
"body": "\t\tself.add_query_param('Description', Description)",
"name": "set_Description(self,CreateApiRequest(RpcRequest):"
},
{
"body": "\t\treturn self... |
15 | from pathlib import Path
import pytest
from click.testing import CliRunner
from ggshield.__main__ import cli
from ggshield.verticals.hmsl.crypto import hash_string
from tests.unit.conftest import assert_invoke_exited_with, assert_invoke_ok
RESULTS_CONTENT = (
'{"hint": "f7f17c88638b42465b6c620a0c7648ef470e611c1... | [
{
"body": " \"\"\"\n GIVEN a cli\n WHEN running on non-existing files or other issues\n THEN the return code is 2\n \"\"\"\n result = cli_fs_runner.invoke(cli, command)\n assert_invoke_exited_with(result, 2)",
"name": "METHOD_NAME(cli_fs_runner:"
}
] |
16 | ## @file
# process FD generation
#
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##
# Import Modules
#
from __future__ import absolute_import
from . import Region
from . import Fv
import Common.LongFilePathOs as os
from io import BytesIO
i... | [
{
"body": " if self.FdUiName.upper() + 'fd' in GenFdsGlobalVariable.ImageBinDict:\n return GenFdsGlobalVariable.ImageBinDict[self.FdUiName.upper() + 'fd']\n #\n # Print Information\n #\n FdFileName = os.path.join(GenFdsGlobalVariable.FvDir, self.FdUiName + '.fd')\n ... |
17 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
{
"body": "\t\treturn self.get_query_params().get('ResourceOwnerId')",
"name": "get_ResourceOwnerId(self):DescribeSnapshotsRequest(RpcRequest):"
},
{
"body": "\t\tself.add_query_param('ResourceOwnerId', ResourceOwnerId)",
"name": "set_ResourceOwnerId(self,DescribeSnapshotsRequest(RpcRequest):"
... |
18 | import IMP
import IMP.atom
import IMP.pmi
import IMP.test
import IMP.isd
import IMP.pmi.restraints.proteomics
import IMP.pmi.io
import IMP.pmi.restraints
import IMP.pmi.restraints.basic
import IMP.rmf
import RMF
import math
import sys
class MembraneRestraintPrototype(IMP.Restraint):
def __init__(self,
... | [
{
"body": " m,\n z_nuisance,\n thickness=30.0,\n softness=3.0,\n plateau=0.0000000001,\n linear=0.02):\n '''\n input a list of particles, the slope and theta of the sigmoid potential\n theta is t... |
19 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
{
"body": "\t\treturn self.get_query_params().get('ClientToken')",
"name": "get_ClientToken(self):CreateAcceleratorRequest(RpcRequest):"
},
{
"body": "\t\treturn self.get_query_params().get('Duration')",
"name": "get_Duration(self):CreateAcceleratorRequest(RpcRequest):"
},
{
"body": "\t\... |
20 | from __future__ import print_function
## @file
# Utility functions and classes for BaseTools unit tests
#
# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##
# Import Modules
#
import base64
import os
import os.path
import random
import shuti... | [
{
"body": " tests = []\n for name, item in localItems.items():\n if isinstance(item, type):\n if issubclass(item, unittest.TestCase):\n tests.append(unittest.TestLoader().loadTestsFromTestCase(item))\n elif issubclass(item, unittest.TestSuite):\n ... |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 5