code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class StateBodyPageExport(StateBodyPage): <NEW_LINE> <INDENT> template_name = 'theshow/bodies/body.state.export.html' | **Publish URL**: :code:`/election-results/{YEAR}/{STATE}/{BODY}/` | 6259904ecad5886f8bdc5aaa |
class Group(Base): <NEW_LINE> <INDENT> name = Column(Unicode(255), nullable=False, unique=True) <NEW_LINE> permissions = relationship(Permission, secondary=group__permission, lazy='select') <NEW_LINE> @classmethod <NEW_LINE> def by_name(cls, session, name): <NEW_LINE> <INDENT> return cls.first(session, where=(cls.name ... | Describe user's groups. | 6259904e8e71fb1e983bcf1e |
class Square: <NEW_LINE> <INDENT> def __init__(self, size=0): <NEW_LINE> <INDENT> if type(size) != int: <NEW_LINE> <INDENT> raise TypeError('size must be an integer') <NEW_LINE> <DEDENT> if size < 0: <NEW_LINE> <INDENT> raise ValueError('size must be >= 0') <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.__size = si... | square class | 6259904e8e7ae83300eea4ed |
class PasswordResetForm(forms.ModelForm): <NEW_LINE> <INDENT> email = forms.CharField( widget=forms.EmailInput(), help_text="Enter your account's email address." ) <NEW_LINE> password = forms.CharField(widget=forms.PasswordInput()) <NEW_LINE> confirm_password = forms.CharField( widget=forms.PasswordInput(), help_text="... | Form for password reset | 6259904e3c8af77a43b6896a |
class MyMainWindow(VCPMainWindow): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(MyMainWindow, self).__init__(*args, **kwargs) | Main window class for the VCP. | 6259904e4428ac0f6e65998b |
class ProductionConfig(Config): <NEW_LINE> <INDENT> DEBUG = False <NEW_LINE> TESTING = False | Configurations for Production. | 6259904ef7d966606f7492e4 |
class WebhookInstance(InstanceResource): <NEW_LINE> <INDENT> class Target(object): <NEW_LINE> <INDENT> WEBHOOK = "webhook" <NEW_LINE> TRIGGER = "trigger" <NEW_LINE> STUDIO = "studio" <NEW_LINE> <DEDENT> class Method(object): <NEW_LINE> <INDENT> GET = "GET" <NEW_LINE> POST = "POST" <NEW_LINE> <DEDENT> def __init__(self,... | PLEASE NOTE that this class contains beta products that are subject to
change. Use them with caution. | 6259904e3cc13d1c6d466b92 |
class WorldPointNumpy(NumpyFixedLenSchema): <NEW_LINE> <INDENT> long = SchemaNode(Float()) <NEW_LINE> lat = SchemaNode(Float()) <NEW_LINE> z = SchemaNode(Float()) | Define same schema as WorldPoint; however, the base class
NumpyFixedLenSchema serializes/deserializes it from/to a numpy array | 6259904ee76e3b2f99fd9e59 |
class InputImageV2: <NEW_LINE> <INDENT> def __init__(self, image_size=(28, 28), train_size=0.8): <NEW_LINE> <INDENT> self.classes = [1, 2, 3, 4, 5, 6] <NEW_LINE> self.image_size = image_size <NEW_LINE> self.image_extension = '.bmp' <NEW_LINE> self.max_read_images = 500 <NEW_LINE> self.train_size = train_size <NEW_LINE>... | 画像の読み込みを行うクラス | 6259904ea219f33f346c7c5b |
class getRowWithColumnsTs_result: <NEW_LINE> <INDENT> thrift_spec = ( (0, TType.LIST, 'success', (TType.STRUCT,(TRowResult, TRowResult.thrift_spec)), None, ), (1, TType.STRUCT, 'io', (IOError, IOError.thrift_spec), None, ), ) <NEW_LINE> def __init__(self, success=None, io=None,): <NEW_LINE> <INDENT> self.success = succ... | Attributes:
- success
- io | 6259904ea79ad1619776b4da |
class TestCartesianToCylindrical(unittest.TestCase): <NEW_LINE> <INDENT> def test_cartesian_to_cylindrical(self): <NEW_LINE> <INDENT> np.testing.assert_almost_equal( cartesian_to_cylindrical((3, 1, 6)), np.array([6., 0.32175055, 3.16227766]), decimal=7) <NEW_LINE> np.testing.assert_almost_equal( cartesian_to_cylindrica... | Defines
:func:`colour.algebra.coordinates.transformations.cartesian_to_cylindrical`
definition unit tests methods. | 6259904e498bea3a75a58f7a |
class Categoriser: <NEW_LINE> <INDENT> def __init__(self, args: argparse.Namespace): <NEW_LINE> <INDENT> with open(args.config) as f: <NEW_LINE> <INDENT> CONFIG = yaml.full_load(f) <NEW_LINE> <DEDENT> assert "categories" in CONFIG, "Need categories to work with" <NEW_LINE> self.patterns = {pat.lower(): v for pat, v in ... | Categorises transactions using patterns defined in the YAML config file. | 6259904e45492302aabfd92d |
class Layer: <NEW_LINE> <INDENT> def __init__(self, inbound_layers=[]): <NEW_LINE> <INDENT> self.inbound_layers = inbound_layers <NEW_LINE> self.value = None <NEW_LINE> self.outbound_layers = [] <NEW_LINE> self.gradients = {} <NEW_LINE> for layer in inbound_layers: <NEW_LINE> <INDENT> layer.outbound_layers.append(self)... | Base class for layers in the network.
Arguments:
`inbound_layers`: A list of layers with edges into this layer. | 6259904ed53ae8145f9198bc |
class TestMultiDataset(PymatgenTest): <NEW_LINE> <INDENT> def test_api(self): <NEW_LINE> <INDENT> structure = Structure.from_file(abiref_file("si.cif")) <NEW_LINE> pseudo = abiref_file("14si.pspnc") <NEW_LINE> pseudo_dir = os.path.dirname(pseudo) <NEW_LINE> multi = BasicMultiDataset(structure=structure, pseudos=pseudo)... | Unit tests for BasicMultiDataset. | 6259904e3eb6a72ae038bab5 |
class Connection(object): <NEW_LINE> <INDENT> def __init__(self, sock, addr, server, timeout): <NEW_LINE> <INDENT> self._sock = sock <NEW_LINE> self._addr = addr <NEW_LINE> self.server = server <NEW_LINE> self._timeout = timeout <NEW_LINE> self.logger = logging.getLogger(LoggerName) <NEW_LINE> <DEDENT> def timeout_hand... | Represents a single client (web server) connection. A single request
is handled, after which the socket is closed. | 6259904ed7e4931a7ef3d4d2 |
class Double2DWrapper(ParamWrapper): <NEW_LINE> <INDENT> def __init__(self, param): <NEW_LINE> <INDENT> ParamWrapper.__init__(self, param) <NEW_LINE> <DEDENT> @QtCore.Slot(result=float) <NEW_LINE> def getDefaultValue1(self): <NEW_LINE> <INDENT> return self._param.getDefaultValue1() <NEW_LINE> <DEDENT> @QtCore.Slot(resu... | Gui class, which maps a ParamDouble2D. | 6259904e4e696a045264e84d |
class Strict(Event): <NEW_LINE> <INDENT> def __init__(self, *arg_names): <NEW_LINE> <INDENT> if len(set(arg_names)) != len(arg_names): <NEW_LINE> <INDENT> raise ArgsError("Cannot accept args of same name") <NEW_LINE> <DEDENT> self.args = arg_names <NEW_LINE> Event.__init__(self) <NEW_LINE> <DEDENT> def fire(self, *args... | The 'Strict Event' requires definition of the args on init. It will then
raise an `ArgsError` whenever these requirements are not adhered to. This
includes checking of `fire()` parameters and handler function args. | 6259904e8a43f66fc4bf35f1 |
class GlobalLibraryVersionsRequest(RWSAuthorizedGetRequest): <NEW_LINE> <INDENT> def __init__(self, project_name): <NEW_LINE> <INDENT> self.project_name = project_name <NEW_LINE> <DEDENT> def url_path(self): <NEW_LINE> <INDENT> return make_url('metadata', 'libraries', self.project_name, 'versions') <NEW_LINE> <DEDENT> ... | Return the list of global library versions | 6259904e07f4c71912bb088e |
class PMRequestListener(object): <NEW_LINE> <INDENT> def __init__(self, config, buildroot): <NEW_LINE> <INDENT> self.config = config <NEW_LINE> self.buildroot = buildroot <NEW_LINE> self.rundir = buildroot.make_chroot_path(RUNDIR) <NEW_LINE> self.socket_path = os.path.join(self.rundir, SOCKET_NAME) <NEW_LINE> self.exec... | Daemon process that responds to requests | 6259904ed4950a0f3b111870 |
class TestIncidentApi(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.api = swagger_client.api.incident_api.IncidentApi() <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def test_close_incident(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def... | IncidentApi unit test stubs | 6259904e07d97122c42180fe |
class Bakery(Restaurant): <NEW_LINE> <INDENT> def __init__(self, name, cuisine): <NEW_LINE> <INDENT> super().__init__(name, cuisine) <NEW_LINE> self.flavors = ['rose', 'lavender', 'peanut butter'] <NEW_LINE> <DEDENT> def list_flavors(self): <NEW_LINE> <INDENT> print(f"Today's flavors are: {self.flavors}") | Represents bakeries as a subclass of restaurant. | 6259904e73bcbd0ca4bcb6e3 |
class IndQLearningAgent(Agent): <NEW_LINE> <INDENT> def __init__(self, action_space, n_states, learning_rate, epsilon, gamma, enemy_action_space=None): <NEW_LINE> <INDENT> Agent.__init__(self, action_space) <NEW_LINE> self.n_states = n_states <NEW_LINE> self.alpha = learning_rate <NEW_LINE> self.epsilon = epsilon <NEW_... | A Q-learning agent that treats other players as part of the environment (independent Q-learning).
She represents Q-values in a tabular fashion, i.e., using a matrix Q.
Intended to use as a baseline | 6259904e10dbd63aa1c72038 |
class TestBase(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self, worldbasePath=None, **kwargs): <NEW_LINE> <INDENT> self.tempdir = testutil.TempDir('pygrdata') <NEW_LINE> if worldbasePath is None: <NEW_LINE> <INDENT> worldbasePath = self.tempdir.path <NEW_LINE> <DEDENT> self.metabase = metabase.MetabaseList(world... | A base class to all metabase test classes | 6259904e94891a1f408ba122 |
class MyChef(SushiChef): <NEW_LINE> <INDENT> channel_info = { 'CHANNEL_SOURCE_DOMAIN': CHANNEL_DOMAIN, 'CHANNEL_SOURCE_ID': CHANNEL_SOURCE_ID, 'CHANNEL_TITLE': CHANNEL_NAME, 'CHANNEL_LANGUAGE': CHANNEL_LANGUAGE, 'CHANNEL_THUMBNAIL': CHANNEL_THUMBNAIL, 'CHANNEL_DESCRIPTION': CHANNEL_DESCRIPTION, } <NEW_LINE> def constru... | This class uploads the INTO Intercultural Mentoring channel to Kolibri Studio.
Your command line script should call the `main` method as the entry point,
which performs the following steps:
- Parse command line arguments and options (run `./sushichef.py -h` for details)
- Call the `SushiChef.run` method which in tu... | 6259904e097d151d1a2c24ca |
class togzfile(TextOp): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def op(cls,text,filename, mode='wb', newline='\n',*args,**kwargs): <NEW_LINE> <INDENT> with gzip.open(filename,mode) as fh: <NEW_LINE> <INDENT> fh.write(TextOp.make_string(text,newline).encode()) | send input to gz file
``togzfile()`` must be the last text operation
Args:
filename (str): The gz file to send COMPRESSED output to
mode (str): File open mode (Default : 'wb')
newline (str): The newline string to add for each line (default: '\n')
Examples:
>>> '/var/log/dmesg' | cat() | grep('error')... | 6259904e3539df3088ecd6fe |
class SafetyEventDriver(object): <NEW_LINE> <INDENT> openapi_types = { } <NEW_LINE> attribute_map = { } <NEW_LINE> def __init__(self, local_vars_configuration=None): <NEW_LINE> <INDENT> if local_vars_configuration is None: <NEW_LINE> <INDENT> local_vars_configuration = Configuration() <NEW_LINE> <DEDENT> self.local_var... | NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually. | 6259904e63d6d428bbee3c26 |
class SystemTest(unittest.TestCase): <NEW_LINE> <INDENT> def testSyntaxErrorDiffPass(self): <NEW_LINE> <INDENT> stdout = run_foozzie('build1', '--skip-sanity-checks') <NEW_LINE> self.assertEquals('# V8 correctness - pass\n', cut_verbose_output(stdout)) <NEW_LINE> <DEDENT> def testDifferentOutputFail(self): <NEW_LINE> <... | This tests the whole correctness-fuzzing harness with fake build
artifacts.
Overview of fakes:
baseline: Example foozzie output including a syntax error.
build1: Difference to baseline is a stack trace differece expected to
be suppressed.
build2: Difference to baseline is a non-suppressed output differ... | 6259904e91af0d3eaad3b27f |
class TableBinaryOutputFileFormat(IBinaryOutputFileFormat): <NEW_LINE> <INDENT> def __init__(self, dtype=None, transposed=False): <NEW_LINE> <INDENT> IBinaryOutputFileFormat.__init__(self,"bin") <NEW_LINE> self.dtype=dtype <NEW_LINE> self.transposed=transposed <NEW_LINE> <DEDENT> def get_dtype(self, table): <NEW_LINE> ... | Class for binary output file format.
Args:
dtype: a string with numpy dtype (e.g., ``"<f8"``) used to save the data. By default, use little-endian (``"<"``) variant kind of the supplied data array dtype
transposed (bool): If ``False``, write the data row-wise; otherwise, write it column-wise. | 6259904ee76e3b2f99fd9e5b |
class Whitelist(Greylist): <NEW_LINE> <INDENT> def __init__(self, initialList=None): <NEW_LINE> <INDENT> if initialList is None: <NEW_LINE> <INDENT> initialList = [] <NEW_LINE> <DEDENT> Greylist.__init__(self, initialList) | A class representing a whitelist of file extensions
that should be included in any watching.
:group Constructor: __init__ | 6259904e0c0af96317c5778e |
class HyperPlane: <NEW_LINE> <INDENT> tol = 1e-8 <NEW_LINE> def __init__(self, normal: np.ndarray, constant: float = 0.0): <NEW_LINE> <INDENT> self.normal = normal <NEW_LINE> self.constant = constant <NEW_LINE> <DEDENT> @property <NEW_LINE> def dim(self) -> Tuple[int, ...]: <NEW_LINE> <INDENT> return self.normal.shape ... | Affine space of codimension 1.
Defined by its normal vector 'normal' and the 'constant', such that a point x belongs to the
hyperplane iff $normal ⋅ x = constant$. | 6259904e7d847024c075d82e |
class VotationDetailView(DetailView): <NEW_LINE> <INDENT> model = Votation <NEW_LINE> template_name = 'votations/votation_detail.html' <NEW_LINE> context_object_name = 'votation' <NEW_LINE> def get_context_data(self, **kwargs): <NEW_LINE> <INDENT> context = super(VotationDetailView, self).get_context_data(**kwargs) <NE... | Renders a Votation page | 6259904e24f1403a926862fb |
class ImageResizer(object): <NEW_LINE> <INDENT> def __init__(self, width, height, color=(255, 255, 255,)): <NEW_LINE> <INDENT> self.proportions = float(width)/float(height) <NEW_LINE> self.color = color <NEW_LINE> <DEDENT> def get_white_layer(self, width, height): <NEW_LINE> <INDENT> size = (width, height) <NEW_LINE> r... | Allows to resize images regarding given proportions
r = ImageResize(height_proportion, width_proportion, default_color)
resized_image_buffer = r.complete(image_buffer)
resized_image_buffer will respect the given proportions and
will be filed with the default color | 6259904e07d97122c42180ff |
class StatusFilterBackend(filters.BaseFilterBackend): <NEW_LINE> <INDENT> def filter_queryset(self, request, queryset, view): <NEW_LINE> <INDENT> status_param = request.query_params.get('status') <NEW_LINE> if status_param: <NEW_LINE> <INDENT> status_list = status_param.split(',') <NEW_LINE> status_list = [status.strip... | Filters queryset with status parameter applied on model status field | 6259904e07f4c71912bb0890 |
class TokensManager(base.Manager): <NEW_LINE> <INDENT> resource_class = Token <NEW_LINE> def create(self, project_id=None, account_name=None, return_raw=False): <NEW_LINE> <INDENT> body = {'token': {}} <NEW_LINE> if project_id: <NEW_LINE> <INDENT> body['token']['project_id'] = project_id <NEW_LINE> <DEDENT> if account_... | Manager class for manipulating token. | 6259904eb57a9660fecd2ed8 |
class ConeNode(CylinderNode): <NEW_LINE> <INDENT> __description__ = "Cone Primitve" <NEW_LINE> __instantiable__ = True | ConeNode implements a specialized CylinderNode. | 6259904e23e79379d538d959 |
class Admin(Base): <NEW_LINE> <INDENT> def __init__(self, username, pwd): <NEW_LINE> <INDENT> self.name = username <NEW_LINE> self.pwd = pwd <NEW_LINE> <DEDENT> def create_campus(self, username, addr): <NEW_LINE> <INDENT> school = Campus(username, addr) <NEW_LINE> school.save() <NEW_LINE> <DEDENT> def create_course(sel... | 管理员类,包含创建校区、创建教师、创建课程方法 | 6259904e94891a1f408ba123 |
class rjplAPIError(Exception): <NEW_LINE> <INDENT> pass | Raised when the API returned an error. | 6259904e96565a6dacd2d9b7 |
class Anisotropic(material.Material): <NEW_LINE> <INDENT> sr = None <NEW_LINE> def __get_s(self): <NEW_LINE> <INDENT> return self.sr.full() <NEW_LINE> <DEDENT> def __set_s(self,s): <NEW_LINE> <INDENT> self.sr = s.reduced() <NEW_LINE> <DEDENT> def __get_c(self): <NEW_LINE> <INDENT> return self.cr.full() <NEW_LINE> <DEDE... | Elastic material
Attributes:
s: full compliance matrix
sr: reduced compliance matrix
c: full stiffness matrix
cr: reduced stiffness matrixrotat | 6259904e63b5f9789fe865ca |
class Configuration(object): <NEW_LINE> <INDENT> def __init__(self, xrandr): <NEW_LINE> <INDENT> self.outputs = {} <NEW_LINE> self._xrandr = xrandr <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> return '<%s for %d Outputs, %d active>'%(type(self).__name__, len(self.outputs), len([x for x in self.outputs.va... | Represents everything that can be set by xrandr (and is therefore subject to saving and loading from files) | 6259904ed10714528d69f0bc |
class cmndClassDocStr(Cmnd): <NEW_LINE> <INDENT> cmndParamsMandatory = None <NEW_LINE> cmndParamsOptional = None <NEW_LINE> cmndArgsLen = ["1"] <NEW_LINE> @subjectToTracking(fnLoc=True, fnEntry=True, fnExit=True) <NEW_LINE> def cmnd(self, interactive=False, cmndName=None, ): <NEW_LINE> <INDENT> G = IcmGlobalContext() <... | Given a list of cmnds as Args, for each return the the class docStr. | 6259904e3cc13d1c6d466b96 |
class VehicleStatus: <NEW_LINE> <INDENT> def __init__(self, last_updated_date: datetime, dashboard_date: datetime, odometer: Tuple[float, str], fuel_gauge: Tuple[float, str], drive_range: Tuple[float, str], trip_a: Tuple[float, str], trip_b: Tuple[float, str], hazards_on: bool, doors: Dict[str, Component], windows: Dic... | Details on a vehicle's status | 6259904e6e29344779b01aa0 |
class Borders: <NEW_LINE> <INDENT> def __init__(self, low_b, high_b, path, state): <NEW_LINE> <INDENT> self.low_b = low_b; self.high_b = high_b; self.path = path; self.state = state | Class of cases, containing lower border, higher border, path of numeric calculations followed to this state and number of state | 6259904eac7a0e7691f73938 |
class GroupViewSet(DefaultsMixin, viewsets.ModelViewSet): <NEW_LINE> <INDENT> queryset = Group.objects.all() <NEW_LINE> serializer_class = GroupSerializer | API endpoint that allows groups to be viewed or edited. | 6259904ea79ad1619776b4de |
@logged <NEW_LINE> @traced <NEW_LINE> class AnsibleAPI(Execution): <NEW_LINE> <INDENT> def __init__(self, hostname): <NEW_LINE> <INDENT> Execution.__init__(self, hostname=hostname) | @TODO Ansible API Usage | 6259904ed6c5a102081e357b |
class ControllerApi(object): <NEW_LINE> <INDENT> notify_widget = None <NEW_LINE> lyric_widget = None <NEW_LINE> desktop_mini = None <NEW_LINE> current_playlist_widget = None <NEW_LINE> player = None <NEW_LINE> network_manager = None <NEW_LINE> api = None <NEW_LINE> state = {"is_login": False, "current_mid": 0, "current... | 暴露给plugin或者其他外部模块的接口和数据
| 6259904e71ff763f4b5e8c05 |
class BestiaryEntry(abc.Serializable): <NEW_LINE> <INDENT> def __init__(self, name, kills, step): <NEW_LINE> <INDENT> self.name: str = name <NEW_LINE> self.kills: int = kills <NEW_LINE> self.step: int = step <NEW_LINE> <DEDENT> __slots__ = ( "name", "kills", "step", ) <NEW_LINE> def __repr__(self): <NEW_LINE> <INDENT> ... | The bestiary progress for a specific creature.
Attributes
----------
name: :class:`str`
The name of the creature.
kills: :class:`int`
The number of kills of this creature the player has done.
step: :class:`int`
The current step to unlock this creature the character is in, where 4 is fully unlocked. | 6259904e07d97122c4218102 |
class InconsistentVmDetails(msrest.serialization.Model): <NEW_LINE> <INDENT> _attribute_map = { 'vm_name': {'key': 'vmName', 'type': 'str'}, 'cloud_name': {'key': 'cloudName', 'type': 'str'}, 'details': {'key': 'details', 'type': '[str]'}, 'error_ids': {'key': 'errorIds', 'type': '[str]'}, } <NEW_LINE> def __init__( se... | This class stores the monitoring details for consistency check of inconsistent Protected Entity.
:param vm_name: The Vm name.
:type vm_name: str
:param cloud_name: The Cloud name.
:type cloud_name: str
:param details: The list of details regarding state of the Protected Entity in SRS and On prem.
:type details: list[s... | 6259904e23e79379d538d95b |
class RandomHorizontalFlip(object): <NEW_LINE> <INDENT> def __call__(self, img, random_samples): <NEW_LINE> <INDENT> if random_samples < 0.5: <NEW_LINE> <INDENT> return img.transpose(Image.FLIP_LEFT_RIGHT) <NEW_LINE> <DEDENT> return img <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def name(): <NEW_LINE> <INDENT> return... | Horizontally flip the given PIL.Image randomly with a probability of 0.5. | 6259904e07f4c71912bb0893 |
class Stock: <NEW_LINE> <INDENT> def __init__(self, stockSummaryDict, stockHistoricalPricesDict, stockHistoricalDividendsDict, stockFinancialProfileDict, stockCompanyProfileDict, stockDirectorDict) : <NEW_LINE> <INDENT> self.stockSummaryDict = stockSummaryDict <NEW_LINE> self.stockHistoricalPricesDict = stockHistorical... | This class is now DEPRECATED, we now use a dictionary to store the neccesary company information.
See scrape_data(419) | 6259904e76d4e153a661dca7 |
class CheckSphericalContainer(ConfTest): <NEW_LINE> <INDENT> m_radius2: float = 0 <NEW_LINE> ndim = 0 <NEW_LINE> def __init__(self, radius: float, ndim): <NEW_LINE> <INDENT> self.m_radius2 = radius <NEW_LINE> self.ndim = ndim <NEW_LINE> return None <NEW_LINE> <DEDENT> def conf_test(self, trial_coords: np.ndarray) -> bo... | Check that the system is within a spherical container
Parameters
----------
radius2 : double
radius of the spherical container, centered at **0**
ndim : int
dimensionality of the space (box dimensionality) | 6259904e009cb60464d02997 |
class MulForm(Form): <NEW_LINE> <INDENT> p = FloatField(label='p value', default=1) <NEW_LINE> q = FloatField(label='q value', default=1) | A class for the multiply program | 6259904e15baa723494633eb |
class ScannerTest(unittest.TestCase): <NEW_LINE> <INDENT> def test_single_character(self): <NEW_LINE> <INDENT> text = 'b' <NEW_LINE> testdata = [ dict(index=0, line=0, column=0, text=text), ] <NEW_LINE> s = parsing.Scanner(text=text) <NEW_LINE> for i in range(len(text)): <NEW_LINE> <INDENT> c = s.get() <NEW_LINE> expec... | Unittests for Scanner class. | 6259904ecad5886f8bdc5aad |
class PoolSpace(ctypes.Structure): <NEW_LINE> <INDENT> _fields_ = [("ps_space", Daos_Space), ("ps_free_min", ctypes.c_uint64 * 2), ("ps_free_max", ctypes.c_uint64 * 2), ("ps_free_mean", ctypes.c_uint64 * 2), ("ps_ntargets", ctypes.c_uint32), ("ps_padding", ctypes.c_uint32)] | Structure to represent Pool space usage info | 6259904e596a897236128fde |
class CardQuery: <NEW_LINE> <INDENT> def __init__(self, max_count=30, max_score=1.0, max_proficiency=10, card_type=None): <NEW_LINE> <INDENT> self.max_count = max_count <NEW_LINE> self.max_score = max_score <NEW_LINE> self.max_proficiency = max_proficiency <NEW_LINE> self.card_type = None <NEW_LINE> <DEDENT> def matche... | Queries a list of cards. | 6259904ef7d966606f7492e7 |
class BidsList(APIView): <NEW_LINE> <INDENT> def get(self, request, format=None): <NEW_LINE> <INDENT> data = create_fake_auction_bids(fake, CONST.NUM_OF_AUCTION_BIDS) <NEW_LINE> return Response(data) | List all Bids or create a new Bid | 6259904e63d6d428bbee3c2a |
class MyMplCanvas(FigureCanvas): <NEW_LINE> <INDENT> def __init__(self, parent=None, img=np.ones((576, 384))*1.2, width=3, aspect=576/384.): <NEW_LINE> <INDENT> height = width*aspect <NEW_LINE> self.aspect = aspect <NEW_LINE> self.img = img <NEW_LINE> self.imgsize = self.img.shape <NEW_LINE> self.datafilepath = ... | Ultimately, this is a QWidget (as well as a FigureCanvasAgg, etc.). | 6259904e91af0d3eaad3b283 |
class Timer(pythics.libcontrol.Control): <NEW_LINE> <INDENT> def __init__(self, parent, label=None, **kwargs): <NEW_LINE> <INDENT> pythics.libcontrol.Control.__init__(self, parent, **kwargs) <NEW_LINE> if label is None or label == '': <NEW_LINE> <INDENT> self._widget = None <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT>... | A control which makes calls to an action at regular time intervals. Most
settings are controlled in a call to `start`, which begins the timer. The
timer can be stopped by calling the `stop` method. The timer may be started
and stopped multiple times. Due to the mult-threaded nature of Timers, most
control properties ar... | 6259904eec188e330fdf9cfd |
class DirectoryUserDeviceLinkData(object): <NEW_LINE> <INDENT> def __init__(self, data): <NEW_LINE> <INDENT> self.qrcode = data['qrcode'] <NEW_LINE> self.code = data['code'] <NEW_LINE> self.device_id = data['device_id'] | Directory user device data used to finish the linking process | 6259904e379a373c97d9a48a |
class IDataAccess(metaclass=ABCMeta): <NEW_LINE> <INDENT> @abstractmethod <NEW_LINE> def read(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @abstractmethod <NEW_LINE> def save(self, data: list): <NEW_LINE> <INDENT> pass | Interface for data access implementation
:Author: Zhiming Liu | 6259904e0a366e3fb87dde45 |
class PadInsn(Insn): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def decode(cls, i): <NEW_LINE> <INDENT> return ( uint_field(i, 6, 22), uint_field(i, 28, 4), ) <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def is_valid(cls, opu, addr, p): <NEW_LINE> <INDENT> return all_defined([ opu.reg.ofm_addr, opu.reg.ofm_mem_h, opu.r... | pad instruction | 6259904ed53ae8145f9198c1 |
class AsuswrtTotalTXSensor(AsuswrtSensor): <NEW_LINE> <INDENT> _name = "Asuswrt Upload" <NEW_LINE> _unit = DATA_GIGABYTES <NEW_LINE> @property <NEW_LINE> def unit_of_measurement(self): <NEW_LINE> <INDENT> return self._unit <NEW_LINE> <DEDENT> async def async_update(self): <NEW_LINE> <INDENT> await super().async_update(... | Representation of a asuswrt total upload sensor. | 6259904e99cbb53fe6832344 |
class MessageViewlet(object): <NEW_LINE> <INDENT> available = True <NEW_LINE> render = ViewPageTemplateFile("templates/messages.pt") <NEW_LINE> def update(self): <NEW_LINE> <INDENT> self.messages = self.getMessages() <NEW_LINE> if not len(self.messages): <NEW_LINE> <INDENT> self.available = False <NEW_LINE> <DEDENT> <D... | display a message with optional level info
| 6259904eb5575c28eb7136f9 |
class Rectangle(object): <NEW_LINE> <INDENT> def __init__(self, lo, hi): <NEW_LINE> <INDENT> if not isinstance(lo, Vector): <NEW_LINE> <INDENT> lo = Vector(lo) <NEW_LINE> <DEDENT> if not isinstance(hi, Vector): <NEW_LINE> <INDENT> hi = Vector(hi) <NEW_LINE> <DEDENT> self.lo = lo <NEW_LINE> self.hi = hi <NEW_LINE> <DEDE... | Two-dimensional vector (axis-aligned) rectangle implementation.
| 6259904e73bcbd0ca4bcb6e9 |
class User(models.Model): <NEW_LINE> <INDENT> username = models.CharField(max_length=32, unique=True) <NEW_LINE> password = models.CharField(max_length=64) <NEW_LINE> realname = models.CharField(max_length=64) <NEW_LINE> sex_choices = ( (0, '女'), (1, '男'), ) <NEW_LINE> sex = models.SmallIntegerField(choices=sex_choices... | 用户表 | 6259904e76d4e153a661dca8 |
class RegexExtract(object): <NEW_LINE> <INDENT> schema = { 'type': 'object', 'properties': { 'prefix': {'type': 'string'}, 'field': {'type': 'string'}, 'regex': one_or_more({'type': 'string', 'format': 'regex'}), }, } <NEW_LINE> def on_task_start(self, task, config): <NEW_LINE> <INDENT> regex = config.get('regex') <NEW... | Updates an entry with the values of regex matched named groups
Usage:
regex_extract:
field: <string>
regex:
- <regex>
[prefix]: <string>
Example:
regex_extract:
prefix: f1_
field: title
regex:
- Formula\.?1.(?P<location>*?) | 6259904e23849d37ff85251e |
class BoardListView(ListView): <NEW_LINE> <INDENT> model = Board <NEW_LINE> context_object_name = 'boards' <NEW_LINE> template_name = 'home.html' | / | 6259904e462c4b4f79dbce60 |
class QueryUniversities(View): <NEW_LINE> <INDENT> def get(self, request): <NEW_LINE> <INDENT> response = {} <NEW_LINE> query_word = request.GET.get('query_word') <NEW_LINE> list_of_uni = find_universities(query_word) <NEW_LINE> response['universities'] = list(list_of_uni) <NEW_LINE> return HttpResponse(HttpResponse(js... | AJAX View | 6259904ed99f1b3c44d06afa |
class Token(Model): <NEW_LINE> <INDENT> required_keys = ('id', 'expires') <NEW_LINE> optional_keys = ('extra',) | Token object.
Required keys:
id
expires (datetime)
Optional keys:
user
project
metadata | 6259904e1f037a2d8b9e529c |
class Not(Query): <NEW_LINE> <INDENT> def __init__(self, query, boost = 1.0): <NEW_LINE> <INDENT> self.query = query <NEW_LINE> self.boost = boost <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> return "%s(%s)" % (self.__class__.__name__, repr(self.query)) <NEW_LINE> <DEDENT> def __unicode__(self): <NEW_LIN... | Excludes any documents that match the subquery. | 6259904ed53ae8145f9198c4 |
class AnimeList(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.anime = None <NEW_LINE> self.statistics = None | Model that represents an AnimeList object. | 6259904e71ff763f4b5e8c09 |
class EpicsMotorShutter(OneSignalShutter): <NEW_LINE> <INDENT> signal = Component(EpicsMotor, "") <NEW_LINE> tolerance = 0.01 <NEW_LINE> @property <NEW_LINE> def state(self): <NEW_LINE> <INDENT> if abs(self.signal.user_readback.get() - self.open_value) <= self.tolerance: <NEW_LINE> <INDENT> result = self.valid_open_val... | Shutter, implemented with an EPICS motor moved between two positions
.. index:: Ophyd Device; EpicsMotorShutter
EXAMPLE::
tomo_shutter = EpicsMotorShutter("2bma:m23", name="tomo_shutter")
tomo_shutter.close_value = 1.0 # default
tomo_shutter.open_value = 0.0 # default
tomo_shutter.toleranc... | 6259904e435de62698e9d26a |
class Weight(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.swagger_types = { 'query': 'str', 'value': 'float' } <NEW_LINE> self.attribute_map = { 'query': 'Query', 'value': 'Value' } <NEW_LINE> self._query = None <NEW_LINE> self._value = None <NEW_LINE> <DEDENT> @property <NEW_LINE> def quer... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 6259904e0fa83653e46f6340 |
class StdTuplePrinter: <NEW_LINE> <INDENT> class _iterator: <NEW_LINE> <INDENT> def __init__ (self, head): <NEW_LINE> <INDENT> self.head = head <NEW_LINE> nodes = self.head.type.fields () <NEW_LINE> if len (nodes) == 1: <NEW_LINE> <INDENT> self.head = self.head.cast (nodes[0].type) <NEW_LINE> <DEDENT> elif len (nodes)... | Print a std::tuple | 6259904e99cbb53fe6832346 |
class SighthoundEntity(ImageProcessingEntity): <NEW_LINE> <INDENT> def __init__(self, api, camera_entity, name): <NEW_LINE> <INDENT> self._api = api <NEW_LINE> self._camera = camera_entity <NEW_LINE> if name: <NEW_LINE> <INDENT> self._name = name <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> camera_name = split_entity_... | Create a sighthound entity. | 6259904ecb5e8a47e493cbb7 |
class InpatientDiet (ModelSQL, ModelView): <NEW_LINE> <INDENT> __name__="gnuhealth.inpatient.diet" <NEW_LINE> name = fields.Many2One('gnuhealth.inpatient.registration', 'Registration Code') <NEW_LINE> diet = fields.Many2One('gnuhealth.diet.therapeutic', 'Diet', required=True) <NEW_LINE> remarks = fields.Text('Remarks /... | Inpatient Diet | 6259904e07f4c71912bb0896 |
class DBConnector(db.RealDatabaseMixin, unittest.TestCase): <NEW_LINE> <INDENT> @defer.inlineCallbacks <NEW_LINE> def setUp(self): <NEW_LINE> <INDENT> yield self.setUpRealDatabase(table_names=[ 'changes', 'change_properties', 'change_files', 'patches', 'sourcestamps', 'buildset_properties', 'buildsets', 'sourcestampset... | Basic tests of the DBConnector class - all start with an empty DB | 6259904e73bcbd0ca4bcb6eb |
class RenderingTestCase(TestCase): <NEW_LINE> <INDENT> def doRendering(self, fragmentClass): <NEW_LINE> <INDENT> siteStore = Store() <NEW_LINE> loginSystem = LoginSystem(store=siteStore) <NEW_LINE> installOn(loginSystem, siteStore) <NEW_LINE> p = Product(store=siteStore, types=["xmantissa.webadmin.LocalUserBrowser", "x... | Test cases for HTML rendering of various fragments. | 6259904e23e79379d538d95f |
class deprecated(object): <NEW_LINE> <INDENT> def __init__( self, alternative_feature=None, removal_date='soon', exception=UserWarning ): <NEW_LINE> <INDENT> self.alternative_feature_message = ( alternative_feature and 'use %r instead' % alternative_feature or '' ) <NEW_LINE> self.exception = exception <NEW_LINE> self.... | method or function decorator used to warn of pending feature removal:
>>> @deprecated()
... def myfunc():
... return 'hello'
...
>>> myfunc()
DeprecationWarning: `__main__.myfunc()` is deprecated and will be removed soon.
'hello'
>>> class MyClass(object):
... @deprecated(alternative_feature='print')
... def m... | 6259904e76d4e153a661dca9 |
class settings_json(ProtectedPage): <NEW_LINE> <INDENT> def GET(self): <NEW_LINE> <INDENT> web.header(u"Access-Control-Allow-Origin", u"*") <NEW_LINE> web.header(u"Content-Type", u"application/json") <NEW_LINE> return json.dumps(params) | Returns plugin settings in JSON format | 6259904e07f4c71912bb0897 |
class DateTimeProperty(Property): <NEW_LINE> <INDENT> form_field_class = 'DateTimeField' <NEW_LINE> def __init__(self, default_now=False, **kwargs): <NEW_LINE> <INDENT> if default_now: <NEW_LINE> <INDENT> if 'default' in kwargs: <NEW_LINE> <INDENT> raise ValueError('too many defaults') <NEW_LINE> <DEDENT> kwargs['defau... | A property representing a :class:`datetime.datetime` object as
unix epoch.
:param default_now: If ``True``, the creation time (UTC) will be used as default.
Defaults to ``False``.
:type default_now: :class:`bool` | 6259904e30dc7b76659a0c97 |
class LeaveJourneyView(LoginRequiredMixin, View): <NEW_LINE> <INDENT> return_to = "journeys:recommended" <NEW_LINE> def post(self, request, pk): <NEW_LINE> <INDENT> journey = get_object_or_404(Journey, pk=pk) <NEW_LINE> leave_from = request.POST.get("leave_from") <NEW_LINE> try: <NEW_LINE> <INDENT> journey.leave_passen... | View to handle the action of leaving a journey. | 6259904e1f037a2d8b9e529d |
class grubEntry: <NEW_LINE> <INDENT> def __init__(self, title): <NEW_LINE> <INDENT> self.title = title <NEW_LINE> self.commands = [] <NEW_LINE> <DEDENT> def listCommands(self): <NEW_LINE> <INDENT> return map(lambda x: x.key, self.commands) <NEW_LINE> <DEDENT> def setCommand(self, key, value, opts=[], append=False): <NE... | Grub menu entry | 6259904e8e71fb1e983bcf28 |
class Auth(object): <NEW_LINE> <INDENT> def trigger(self, request): <NEW_LINE> <INDENT> raise NotImplemented() <NEW_LINE> <DEDENT> def __call__(self, request, *args, **kw): <NEW_LINE> <INDENT> raise NotImplemented() | An object with two significant methods, 'trigger' and 'run'.
Using a similar object to this, plugins can register specific
authentication logic, for example the GET param 'access_token' for OAuth.
- trigger: Analyze the 'request' argument, return True if you think you
can handle the request, otherwise return False
... | 6259904eb57a9660fecd2edf |
@dataclass(frozen=True) <NEW_LINE> class not_stitched(Iterable[E]): <NEW_LINE> <INDENT> entities: Iterable[E] <NEW_LINE> def __iter__(self) -> Iterator[E]: <NEW_LINE> <INDENT> return (e for e in self.entities if not e.is_stitched) | An iterable of the entities in the argument iterable that are not stitched.
This is an iterable, so it can be consumed repeatedly. | 6259904e2ae34c7f260ac552 |
class Status(IntEnum): <NEW_LINE> <INDENT> EX_OK = 0 <NEW_LINE> EX_USAGE = 64 <NEW_LINE> EX_DATAERR = 65 <NEW_LINE> EX_NOINPUT = 66 <NEW_LINE> EX_NOUSER = 67 <NEW_LINE> EX_NOHOST = 68 <NEW_LINE> EX_UNAVAILABLE = 69 <NEW_LINE> EX_SOFTWARE = 70 <NEW_LINE> EX_OSERR = 71 <NEW_LINE> EX_OSFILE = 72 <NEW_LINE> EX_CANTCREAT = ... | Enumeration for the status values defined by SPAMD. | 6259904e379a373c97d9a48e |
class VowelerTestCase(unittest.TestCase): <NEW_LINE> <INDENT> def test_first_case(self): <NEW_LINE> <INDENT> input = ["boy", "age"] <NEW_LINE> output = (["by", "age"], 1.5) <NEW_LINE> self.assertTrue(remove_and_average(input), output) <NEW_LINE> <DEDENT> def test_second_case(self): <NEW_LINE> <INDENT> input = ["boy", "... | testing voweler challenge. | 6259904ea79ad1619776b4e3 |
class HandlerClass: <NEW_LINE> <INDENT> def __init__(self, halcomp,builder,useropts): <NEW_LINE> <INDENT> self.halcomp = halcomp <NEW_LINE> self.builder = builder <NEW_LINE> self.nhits = 0 | class with gladevcp callback handlers | 6259904ed6c5a102081e3581 |
class Munge(Package): <NEW_LINE> <INDENT> homepage = "https://code.google.com/p/munge/" <NEW_LINE> url = "https://github.com/dun/munge/releases/download/munge-0.5.11/munge-0.5.11.tar.bz2" <NEW_LINE> version('0.5.11', 'bd8fca8d5f4c1fcbef1816482d49ee01', url='https://github.com/dun/munge/releases/download/munge-0.5.... | MUNGE Uid 'N' Gid Emporium | 6259904ebe383301e0254c7e |
class PMBMultiReferentialConstraint(PMBConstraint): <NEW_LINE> <INDENT> constraintType = 'Multi Referential' <NEW_LINE> AddRigidObject = _RefFuncIndexWrapper(_AddMultiRef, 0) <NEW_LINE> GetRigidObject = _RefFuncIndexWrapper(_GetMultiRef, 0) <NEW_LINE> RemoveRigidObject = _RefFuncIndexWrapper(_RemoveMultiRef, 0) <NEW_LI... | Multi referential constraint class | 6259904e004d5f362081fa1a |
class BaseRadar(Transmitter): <NEW_LINE> <INDENT> _count = 0 <NEW_LINE> def __init__(self, x, y): <NEW_LINE> <INDENT> self.x = x <NEW_LINE> self.y = y <NEW_LINE> self.no = BaseRadar._count <NEW_LINE> BaseRadar._count += 1 | 雷达类包括方法:
发送波形
接收波形
计算参数
上传数据库 | 6259904e0a366e3fb87dde49 |
class TaskCollectData(d6tflow.tasks.TaskCSVPandas): <NEW_LINE> <INDENT> do_collection = luigi.BoolParameter(default=True) <NEW_LINE> input_kwargs = luigi.DictParameter() <NEW_LINE> def run(self): <NEW_LINE> <INDENT> if self.do_collection: <NEW_LINE> <INDENT> from .input_collector import DataAccessor <NEW_LINE> housing ... | Task to collect input data. | 6259904e71ff763f4b5e8c0b |
class Runner: <NEW_LINE> <INDENT> def __init__(self, config, endpoints, reset_on_start=False, reset_on_shutdown=True): <NEW_LINE> <INDENT> self.reset_on_shutdown = reset_on_shutdown <NEW_LINE> self.start_coco(config, endpoints, reset_on_start) <NEW_LINE> time.sleep(1) <NEW_LINE> <DEDENT> def __del__(self): <NEW_LINE> <... | Coco Runner for unit tests. | 6259904e29b78933be26aaf4 |
class pdfPrintout(wx.Printout): <NEW_LINE> <INDENT> def __init__(self, title, view): <NEW_LINE> <INDENT> wx.Printout.__init__(self, title) <NEW_LINE> self.view = view <NEW_LINE> <DEDENT> def HasPage(self, pageno): <NEW_LINE> <INDENT> if pageno <= self.view.numpages: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> e... | Class encapsulating the functionality of printing out the document. The methods below
over-ride those of the base class and supply document-specific information to the
printing framework that calls them internally. | 6259904e0c0af96317c57792 |
class SnapshotModelCheckpoint(Callback): <NEW_LINE> <INDENT> def __init__(self, nb_epochs, nb_snapshots, fn_prefix, fold): <NEW_LINE> <INDENT> super(SnapshotModelCheckpoint, self).__init__() <NEW_LINE> self.check = nb_epochs // nb_snapshots <NEW_LINE> self.fn_prefix = fn_prefix <NEW_LINE> self.fold = fold <NEW_LINE> <D... | Callback that saves the snapshot weights of the model.
Saves the model weights on certain epochs (which can be considered the
snapshot of the model at that epoch).
Should be used with the cosine annealing learning rate schedule to save
the weight just before learning rate is sharply increased.
# Arguments:
nb_ep... | 6259904e4e696a045264e852 |
class ViewsTestCase(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> user = User.objects.create(username="testuser") <NEW_LINE> self.client = APIClient() <NEW_LINE> self.client.force_authenticate(user=user) <NEW_LINE> self.bucketlist_data = {'name': 'Test Text Two2', 'owner': user.id} <NEW_LINE> self... | Test suite for the api views. | 6259904e07d97122c4218108 |
class SelectMixin(ElementMixin): <NEW_LINE> <INDENT> def _get_selenium_select(self): <NEW_LINE> <INDENT> if self.exists(): <NEW_LINE> <INDENT> element = self.element() <NEW_LINE> if element.tag_name == u'select': <NEW_LINE> <INDENT> return SeleniumSelect(element) <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> def deselect_all(s... | The SelectMixin implementation
| 6259904e6fece00bbaccce1e |
class ProposeCommand(NewCommand): <NEW_LINE> <INDENT> pass | Propose a new ADR (same as 'new' command)
propose
{words* : Words in the title} | 6259904e76d4e153a661dcaa |
class OrgaViewSet(viewsets.ModelViewSet): <NEW_LINE> <INDENT> permission_classes = (IsAuthenticated,) <NEW_LINE> serializer_class = OrgaSerializer <NEW_LINE> pagination_class = None <NEW_LINE> def get_queryset(self): <NEW_LINE> <INDENT> return Orga.objects.all() | API endpoint that allows orgas to be viewed or edited. | 6259904e462c4b4f79dbce64 |
class UniqueObject: <NEW_LINE> <INDENT> def __init__(self, name: str = None, unique_id: int = None): <NEW_LINE> <INDENT> self.unique_id = unique_id <NEW_LINE> self.name = name | Base class for all entities. It declares fields that every entity must have.
Should be used only for subclassing, not for creating instances of this class | 6259904e23849d37ff852522 |
class CartCollision(Exception): <NEW_LINE> <INDENT> def __init__(self, coordinates): <NEW_LINE> <INDENT> self.coordinates = coordinates | Raised when two carts collide | 6259904e21a7993f00c673cd |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.