code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
class SettingsItem(models.Model): <NEW_LINE> <INDENT> name = models.CharField('设置名', max_length=30) <NEW_LINE> value = models.CharField('值', max_length=200, blank=True) <NEW_LINE> note = models.TextField('备注', blank=True) <NEW_LINE> s_type = models.ForeignKey(SettingsType, on_delete=models.CASCADE, verbose_name='设置类型',...
设置项
62598fad7047854f4633f3ae
class State(Base): <NEW_LINE> <INDENT> __tablename__ = "states" <NEW_LINE> id = Column(Integer, unique=True, primary_key=True, autoincrement=True, nullable=False) <NEW_LINE> name = Column(String(128), nullable=False)
Define class State
62598fad6aa9bd52df0d4e9c
class Rose(Visualization): <NEW_LINE> <INDENT> def __init__(self, app): <NEW_LINE> <INDENT> super(Rose, self).__init__(app) <NEW_LINE> self.app.add_javascripts( '/js/rgraph/RGraph.common.core.js', '/js/rgraph/RGraph.common.tooltips.js', '/js/rgraph/RGraph.common.effects.js', '/js/rgraph/RGraph.rose.js' )
Uses RGraph to render the facet as a rose diagram.
62598fad01c39578d7f12d53
class ExplicitYamlDumper(yaml.SafeDumper): <NEW_LINE> <INDENT> def ignore_aliases(self, data): <NEW_LINE> <INDENT> return True
A yaml dumper that will never emit aliases.
62598fad5fc7496912d4826c
class RemoteTimeout(Timeout): <NEW_LINE> <INDENT> pass
DEPRECATED, DO NOT USE. Prefer Timeout exception
62598fad21bff66bcd722c3b
class JointPositionAction(JointAction): <NEW_LINE> <INDENT> def __init__(self, robot, joint_ids=None, bounds=(None, None), kp=None, kd=None, max_force=None, discrete_values=None): <NEW_LINE> <INDENT> super(JointPositionAction, self).__init__(robot, joint_ids, discrete_values=discrete_values) <NEW_LINE> self.kp, self.kd...
Joint Position Action Set the joint positions using position control.
62598fadd58c6744b42dc2c1
class AdversarialLoss(nn.Module): <NEW_LINE> <INDENT> def __init__(self, type='lsgan', target_real_label=1.0, target_fake_label=0.0): <NEW_LINE> <INDENT> super(AdversarialLoss, self).__init__() <NEW_LINE> self.type = type <NEW_LINE> self.register_buffer('real_label', torch.tensor(target_real_label).to(device)) <NEW_LIN...
Adversarial loss https://arxiv.org/abs/1711.10337
62598fadadb09d7d5dc0a55f
class ITarget(ISimple): <NEW_LINE> <INDENT> pass
Target.
62598fad97e22403b383aee2
class EmailConfig: <NEW_LINE> <INDENT> def __init__(self, **conf): <NEW_LINE> <INDENT> self.s_host = conf["s_host"] <NEW_LINE> self.s_login = conf["s_login"] <NEW_LINE> self.s_pass = conf["s_pass"] <NEW_LINE> self.c_type = conf["c_type"] <NEW_LINE> self.s_port = conf["s_port"]
Экземпляр данного класса будет содержать настройки провадера
62598fada79ad1619776a03b
class subProcess: <NEW_LINE> <INDENT> def __init__(self, cmd, bufsize=8192): <NEW_LINE> <INDENT> self.cleaned=False <NEW_LINE> self.BUFSIZ=bufsize <NEW_LINE> self.outr, self.outw = os.pipe() <NEW_LINE> self.errr, self.errw = os.pipe() <NEW_LINE> self.pid = os.fork() <NEW_LINE> if self.pid == 0: <NEW_LINE> <INDENT> self...
Class representing a child process. It's like popen2.Popen3 but there are three main differences. 1. This makes the new child process group leader (using setpgrp()) so that all children can be killed. 2. The output function (read) is optionally non blocking returning in specified timeout if nothing is read, or as...
62598fad2ae34c7f260ab0b7
class BSTree(): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.__root = None <NEW_LINE> self.__size = 0 <NEW_LINE> <DEDENT> def insert(self, data) -> (BSTIterator, bool): <NEW_LINE> <INDENT> if self.__root is None: <NEW_LINE> <INDENT> self.__root = BSTNode(data) <NEW_LINE> self.__size += 1 <NEW_LINE> ...
Binary Search Tree Attributes: __root: the root of the tree __size: the size of the tree
62598fad66673b3332c303a1
class GPMultiValue(BaseGPObject): <NEW_LINE> <INDENT> _type = None <NEW_LINE> def __init__(self, gptype): <NEW_LINE> <INDENT> self._type = gptype <NEW_LINE> self._dataType = "GPMultiValue:%s" % gptype <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return json.dumps(self.asDictionary) <NEW_LINE> <DEDENT> def...
The fully qualified data type for a GPMultiValue parameter is GPMultiValue:<memberDataType>, where memberDataType is one of the data types defined above (for example, GPMultiValue:GPString, GPMultiValue:GPLong, and so on). The parameter value for GPMultiValue data types is a JSON array. Each element in this array is of...
62598fad99cbb53fe6830ead
class FullPoolError(PoolError): <NEW_LINE> <INDENT> pass
Raised when we try to add a connection to a full pool in blocking mode.
62598fad30bbd72246469963
class TestClientRegistration(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def testClientRegistration(self): <NEW_LINE> <INDENT> pass
ClientRegistration unit test stubs
62598fad5166f23b2e2433ae
class Output(): <NEW_LINE> <INDENT> def write(self, line): echo(line) <NEW_LINE> def flush(self): pass
Standard output like class using echo.
62598fad3317a56b869be535
class GetList(Choreography): <NEW_LINE> <INDENT> def __init__(self, temboo_session): <NEW_LINE> <INDENT> Choreography.__init__(self, temboo_session, '/Library/SunlightLabs/Congress/Legislator/GetList') <NEW_LINE> <DEDENT> def new_input_set(self): <NEW_LINE> <INDENT> return GetListInputSet() <NEW_LINE> <DEDENT> def _mak...
Create a new instance of the GetList Choreography. A TembooSession object, containing a valid set of Temboo credentials, must be supplied.
62598fad4428ac0f6e6584fa
class _PublisherAPI(object): <NEW_LINE> <INDENT> def __init__(self, gax_api): <NEW_LINE> <INDENT> self._gax_api = gax_api <NEW_LINE> <DEDENT> def list_topics(self, project): <NEW_LINE> <INDENT> options = CallOptions(is_page_streaming=False) <NEW_LINE> path = 'projects/%s' % (project,) <NEW_LINE> response = self._gax_ap...
Helper mapping publisher-related APIs. :type gax_api: :class:`google.pubsub.v1.publisher_api.PublisherApi` :param gax_api: API object used to make GAX requests.
62598fad091ae35668704bf4
@base.ReleaseTracks(base.ReleaseTrack.BETA) <NEW_LINE> class List(base.ListCommand): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def Args(parser): <NEW_LINE> <INDENT> parser.display_info.AddFormat('table(updateTime)') <NEW_LINE> base.URI_FLAG.RemoveFromParser(parser) <NEW_LINE> base.PAGE_SIZE_FLAG.RemoveFromParser(par...
List states for a device. This command lists all available states in the history of the device. Up to 10 are kept; you may restrict the output to fewer via the `--limit` flag.
62598fadbe8e80087fbbf03a
@addTupleType <NEW_LINE> class LdapSetting(Tuple, DeclarativeBase): <NEW_LINE> <INDENT> __tupleType__ = userPluginTuplePrefix + 'LdapSettingTuple' <NEW_LINE> __tablename__ = 'LdapSetting' <NEW_LINE> id = Column(Integer, primary_key=True, autoincrement=True) <NEW_LINE> ldapTitle = Column(String, nullable=False, unique=T...
LdapSetting This table stores connetions and settings to LDAP servers
62598fad435de62698e9bdc6
class StreamingQualityCheckRunnerDelegate(QualityCheckRunnerDelegate): <NEW_LINE> <INDENT> __slots__ = () <NEW_LINE> output = sys.stdout <NEW_LINE> error = sys.stderr <NEW_LINE> def _check_failed(self, check): <NEW_LINE> <INDENT> assert isinstance(check, QualityCheck) <NEW_LINE> return check.result() != check.success <...
A delegate that writes information about the runner's progress to streams @note we do not explicitly flush streams after writing
62598fadcc0a2c111447afe7
class DebugLandmarks(PostProcessAction): <NEW_LINE> <INDENT> def process(self, extract_media): <NEW_LINE> <INDENT> frame = os.path.splitext(os.path.basename(extract_media.filename))[0] <NEW_LINE> for idx, face in enumerate(extract_media.detected_faces): <NEW_LINE> <INDENT> logger.trace("Drawing Landmarks. Frame: '%s'. ...
Draw debug landmarks on face output. Extract Only
62598fad498bea3a75a57af4
class Versioned(object): <NEW_LINE> <INDENT> def __init__(self, content, low, high): <NEW_LINE> <INDENT> self.content = content <NEW_LINE> self.low = low <NEW_LINE> self.high = high <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> return "Versioned({0!r}, {1!r}, {2!r})".format(self.content, self.low, self.hi...
This class encapsulates an object and adds information about its (continuous) lifetime. .. data:: content The object .. data:: low The first version where the object starts to appear. .. data:: high The last version where the object still appears.
62598fada05bb46b3848a842
class Command: <NEW_LINE> <INDENT> def __init__(self, transport: RevvyTransport): <NEW_LINE> <INDENT> self._transport = transport <NEW_LINE> self._command_byte = self.command_id <NEW_LINE> self._log = get_logger(f'{type(self).__name__} [id={self._command_byte}]') <NEW_LINE> <DEDENT> @property <NEW_LINE> def command_id(...
A generic command towards the MCU
62598fad7b180e01f3e4903b
class AttentionWeightedAverage(Layer): <NEW_LINE> <INDENT> def __init__(self, embed_dim, **kwargs): <NEW_LINE> <INDENT> self.kernel_initializer = initializers.get('uniform') <NEW_LINE> self.supports_masking = True <NEW_LINE> self.embed_dim = embed_dim <NEW_LINE> super().__init__(**kwargs) <NEW_LINE> <DEDENT> def build(...
Weighted average for image captioning. Inputs: - hidden state of shape (seqdim, seqlen) - visual features of shape (vfeat_dim, vfeatlen) The equation followed is (6) in https://arxiv.org/pdf/1612.01887.pdf z_t = w_h tanh(W_v V + (W_g h_t) 1_{vfeatlen}^T) lpha_t = softmax(z_t) The dimension of the embedding, embed_d...
62598fadfff4ab517ebcd7bb
class UsergroupsModelField(models.IntegerField): <NEW_LINE> <INDENT> ANONYMOUS_USERS = 0 <NEW_LINE> STAFF_USERS = -1 <NEW_LINE> SUPERUSERS = -2 <NEW_LINE> NORMAL_USERS = -3 <NEW_LINE> USER_TYPES_CHOICES = [ (ANONYMOUS_USERS, _("anonymous users")), (NORMAL_USERS, _("normal users")), (STAFF_USERS, _("staff users")), (SUP...
TODO: Use html select optgroup [1] to group anonymous, staff and superusers from user groups [1] http://www.w3.org/wiki/HTML/Elements/optgroup
62598fad99cbb53fe6830eae
class ServiceError(Exception): <NEW_LINE> <INDENT> def __init__(self, msg, error=None, target: ErrorTarget = None): <NEW_LINE> <INDENT> self.message = msg <NEW_LINE> self.error = error <NEW_LINE> self.target = target
Base class for exceptions in MRM.
62598fad4e4d5625663723fc
class Component(OrderedDict): <NEW_LINE> <INDENT> def __init__(self, name=None,data=None): <NEW_LINE> <INDENT> if name in [None, '']: <NEW_LINE> <INDENT> raise Exception('Component must have a name') <NEW_LINE> <DEDENT> self.name = name <NEW_LINE> if data is None: <NEW_LINE> <INDENT> self.data = OrderedDict() <NEW_LINE...
Class for storing component information.
62598fad91f36d47f2230e91
class ReportViewTestCase(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> user = User.objects.create_user( email='test@test.com', password='test', first_name='Test', last_name='User', phone='9997609994', address='Gurgaon', id_number='PBX024', is_admin=True, ) <NEW_LINE> resp = self.client.post( rever...
TestCase for report page
62598fada17c0f6771d5c20c
class _MelModel(MelGroup): <NEW_LINE> <INDENT> typeSets = ((b'MODL', b'MODB', b'MODT'), (b'MOD2', b'MO2B', b'MO2T'), (b'MOD3', b'MO3B', b'MO3T'), (b'MOD4', b'MO4B', b'MO4T')) <NEW_LINE> def __init__(self, attr=u'model', index=0): <NEW_LINE> <INDENT> types = self.__class__.typeSets[index - 1 if index > 1 else 0] <NEW_LI...
Represents a model record.
62598fad009cb60464d014f7
class BasicMultiAgent(MultiAgentEnv): <NEW_LINE> <INDENT> def __init__(self, num): <NEW_LINE> <INDENT> self.agents = [MockEnv(25) for _ in range(num)] <NEW_LINE> self.dones = set() <NEW_LINE> self.observation_space = gym.spaces.Discrete(2) <NEW_LINE> self.action_space = gym.spaces.Discrete(2) <NEW_LINE> <DEDENT> def re...
Env of N independent agents, each of which exits after 25 steps.
62598fad2c8b7c6e89bd379c
class Catalog(abc.ABC): <NEW_LINE> <INDENT> @abc.abstractmethod <NEW_LINE> def get_all(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @abc.abstractmethod <NEW_LINE> def get(self, id): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @abc.abstractmethod <NEW_LINE> def add(self, object, add_to_db): <NEW_LINE> <INDENT> p...
Abstract class Catalog
62598fad4527f215b58e9eb7
class SurfaceLaplaceLayerTerm(Term): <NEW_LINE> <INDENT> name = 'dw_surface_laplace' <NEW_LINE> arg_types = [('material', 'virtual', 'state'), ('material', 'parameter_2', 'parameter_1')] <NEW_LINE> modes = ('weak', 'eval') <NEW_LINE> integration = 'surface' <NEW_LINE> def get_fargs(self, mat, virtual, state, mode=None,...
:Description: Acoustic 'layer' term - derivatives in surface directions. :Definition: .. math:: \int_{\Gamma} c \partial_\alpha \ul{q}\,\partial_\alpha \ul{p}, \alpha = 1,\dots,N-1 :Arguments 1: material: :math:`c`, virtual: :math:`q`, state: :math:`p` :Arguments 2: material: :math:`c`, p...
62598fad01c39578d7f12d55
class Menu(Region): <NEW_LINE> <INDENT> _menu_options_locator = ( By.CSS_SELECTOR, "label") <NEW_LINE> _menu_toggle_locator = ( By.CSS_SELECTOR, "[class*=Toggle]") <NEW_LINE> _select_all_button_locator = ( By.CSS_SELECTOR, "[class*=AllOrNone] button:first-child") <NEW_LINE> _select_none_button_locator = ( By.CSS_SELECT...
A study guide filter menu.
62598fad8e7ae83300ee9079
class levenshtein: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def compare(self,true_seq,input_seq): <NEW_LINE> <INDENT> hpt_lst = init_hpt(true_seq[0], input_seq[0]) <NEW_LINE> len_true = len(true_seq) <NEW_LINE> len_in = len(input_seq) <NEW_LINE> no_more_to_expand = False <NEW...
Class for computing Levenshtein distance between two strings
62598fad01c39578d7f12d56
class IsAdminOrReadOnly(permissions.BasePermission): <NEW_LINE> <INDENT> def has_permission(self, request, view): <NEW_LINE> <INDENT> return ( request.method in permissions.SAFE_METHODS or request.user and is_authenticated(request.user) and request.user.is_staff )
The request is authenticated as a user, or is a read-only request.
62598fad76e4537e8c3ef584
class DoxygenWarning(object): <NEW_LINE> <INDENT> def __init__(self, firstline, filename, warning): <NEW_LINE> <INDENT> self.firstline = firstline <NEW_LINE> self.filename = filename <NEW_LINE> self.warning = warning <NEW_LINE> self.otherlines = [] <NEW_LINE> <DEDENT> def equals_ignoring_path_and_line_number(self, othe...
Doxygen warning class.
62598fad8a43f66fc4bf2153
class CornersProblem(search.SearchProblem): <NEW_LINE> <INDENT> def __init__(self, startingGameState): <NEW_LINE> <INDENT> self.walls = startingGameState.getWalls() <NEW_LINE> self.startingPosition = startingGameState.getPacmanPosition() <NEW_LINE> top, right = self.walls.height-2, self.walls.width-2 <NEW_LINE> self.co...
This search problem finds paths through all four corners of a layout. You must select a suitable state space and successor function
62598fad56ac1b37e63021c2
class UserInfo(models.Model): <NEW_LINE> <INDENT> username = models.CharField(verbose_name="用户名",max_length=32) <NEW_LINE> password = models.CharField(verbose_name='密码',max_length=64) <NEW_LINE> roles = models.ManyToManyField(verbose_name='具有所有角色',to="Role",blank=True) <NEW_LINE> class Meta: <NEW_LINE> <INDENT> verbose...
用户表
62598fad60cbc95b06364325
class VerticalBot(Bot): <NEW_LINE> <INDENT> def __init__(self, character=8982): <NEW_LINE> <INDENT> super().__init__(character=8982) <NEW_LINE> self.moves = [[1, 0], [-1, 0]] <NEW_LINE> self.position = random.choice([[0, 0], [0, 1], [0, 2], [0, 3], [0, 4]]) <NEW_LINE> <DEDENT> def updown_move(self): <NEW_LINE> <INDENT>...
Initializes a bot that can only move directly up or down Parameters ---------- character = string Attributes ---------- moves = list ordered pairs that represent possible movements of the bot position = list ordered pairs that represent possible starting positions of the bot
62598fad55399d3f056264fb
class Meta: <NEW_LINE> <INDENT> model = User
Meta class.
62598fad66673b3332c303a3
class MicrositeSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> values = serializers.JSONField() <NEW_LINE> class Meta: <NEW_LINE> <INDENT> model = Microsite <NEW_LINE> fields = '__all__'
Serializer class for Microsite model.
62598fad236d856c2adc9429
class PaddleLeft(Paddle): <NEW_LINE> <INDENT> def __init__(self, game): <NEW_LINE> <INDENT> super().__init__(game) <NEW_LINE> self.reset_paddle() <NEW_LINE> <DEDENT> def reset_paddle(self): <NEW_LINE> <INDENT> self.rect.midleft = self.screen_rect.midleft <NEW_LINE> self.rect.x += 50 <NEW_LINE> self.y = float(self.rect....
Class for left paddle
62598fade76e3b2f99fd8a0e
class TestVersionedCityObject: <NEW_LINE> <INDENT> def test_initialisation(self): <NEW_LINE> <INDENT> obj = cjm.CityObject({"type" : "Building"}, "building1") <NEW_LINE> ver_obj = cjv.VersionedCityObject(obj) <NEW_LINE> assert ver_obj.original_cityobject.name == "building1" <NEW_LINE> assert ver_obj.name == ver_obj.has...
Tests the VersionedCityObject class.
62598fadf7d966606f747fbd
class HTMLPreview(object): <NEW_LINE> <INDENT> def __init__(self, content, excerpt='', splitters=PREVIEW_SPLITTERS, max_words=PREVIEW_MAX_WORDS, more_string=PREVIEW_MORE_STRING): <NEW_LINE> <INDENT> self._preview = None <NEW_LINE> self.excerpt = excerpt <NEW_LINE> self.content = content <NEW_LINE> self.splitters = spli...
Build an HTML preview of an HTML content.
62598fad460517430c432049
class DeleteOwnComment(permissions.BasePermission): <NEW_LINE> <INDENT> def has_object_permission(self, request, view, obj): <NEW_LINE> <INDENT> if request.method in permissions.SAFE_METHODS: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> return request.user.is_superuser or obj.author == request.user
Allow admin and user to delete their own thread or comment
62598fadd268445f26639b6f
class UserInput: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.X_train, self.y_train = None, None <NEW_LINE> self.class_type = None <NEW_LINE> self.filename = None <NEW_LINE> self.result_path = './result' <NEW_LINE> self.kernel_type = None <NEW_LINE> self.rect_kernel = 1 <NEW_LINE> self.test_method_t...
This class stores user inputs
62598fad3539df3088ecc28b
class ClouduseraccountsGlobalAccountsOperationsListRequest(_messages.Message): <NEW_LINE> <INDENT> filter = _messages.StringField(1) <NEW_LINE> maxResults = _messages.IntegerField(2, variant=_messages.Variant.UINT32, default=500) <NEW_LINE> orderBy = _messages.StringField(3) <NEW_LINE> pageToken = _messages.StringField...
A ClouduseraccountsGlobalAccountsOperationsListRequest object. Fields: filter: Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. The field_name is the name of the field you want ...
62598fad627d3e7fe0e06e86
class UseJSONTests(APITestCase): <NEW_LINE> <INDENT> def test_accept_and_return_json(self): <NEW_LINE> <INDENT> response = self.api_client.get(self.catalogus_list_url) <NEW_LINE> self.assertEqual(response.status_code, 200) <NEW_LINE> self.assertEqual(response['content-type'], 'application/json') <NEW_LINE> <DEDENT> @sk...
Section 2.6.5 of the DSO: API strategy
62598fadd58c6744b42dc2c3
class symbolic_dttmm_system_common_params(symbolic_dttmm_system): <NEW_LINE> <INDENT> def gen_list_of_all_params(self, params={}): <NEW_LINE> <INDENT> symbolic_dttmm_system.gen_list_of_all_params(self) <NEW_LINE> self.all_params.extend(params.keys()) <NEW_LINE> return self.all_params
Symbolic DT-TMM stuff doesn't work very well if there are more than a few elements. Before I completely scrap the idea, I want to see what happens if all of the TSD and rigid mass elements have the same properties, as would be the case for a uniform beam broken into pieces.
62598fad442bda511e95c430
class _SaverDict(_SaverMutable, MutableMapping): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super().__init__(*args, **kwargs) <NEW_LINE> self._data = dict() <NEW_LINE> <DEDENT> def has_key(self, key): <NEW_LINE> <INDENT> return key in self._data <NEW_LINE> <DEDENT> @_save <NEW_LINE> de...
A dict that stores changes to an Attribute when updated
62598fad63d6d428bbee2784
class dl_select(OC_Dialogo): <NEW_LINE> <INDENT> def __init__(self,padre,fichero,campos,preguntas): <NEW_LINE> <INDENT> OC_Dialogo.__init__(self, padre,'Selección de Registros',tam=(580,520),btn=False) <NEW_LINE> preg=[] <NEW_LINE> lsfmt=[] <NEW_LINE> i=0 <NEW_LINE> for ln in preguntas: <NEW_LINE> <INDENT> titu,op,valo...
Dialogo de selección de registros, pone en lista destino
62598fad63b5f9789fe85140
class DiagonalOperator(SymmetricOperator): <NEW_LINE> <INDENT> def __init__(self, diag, **kwargs): <NEW_LINE> <INDENT> shape = 2 * (diag.size,) <NEW_LINE> self.diag = diag <NEW_LINE> matvec = lambda x: x * diag <NEW_LINE> SymmetricOperator.__init__(self, shape, matvec, **kwargs) <NEW_LINE> <DEDENT> def __repr__(self): ...
An operator which mimics a diagonal matrix. Attributes ---------- diag: ndarray of 1 dim The diagonal of the matrix.
62598fad2ae34c7f260ab0bb
class ASGIApp(engineio.ASGIApp): <NEW_LINE> <INDENT> def __init__(self, socketio_server, other_asgi_app=None, static_files=None, socketio_path='socket.io'): <NEW_LINE> <INDENT> super().__init__(socketio_server, other_asgi_app, static_files=static_files, engineio_path=socketio_path)
ASGI application middleware for Socket.IO. This middleware dispatches traffic to an Socket.IO application. It can also serve a list of static files to the client, or forward unrelated HTTP traffic to another ASGI application. :param socketio_server: The Socket.IO server. Must be an instance of the ...
62598fad99cbb53fe6830eb1
class RunnerThread(QThread): <NEW_LINE> <INDENT> def __init__(self, ip="127.0.0.1", port=8000, app=None): <NEW_LINE> <INDENT> QThread.__init__(self) <NEW_LINE> self.ip = ip <NEW_LINE> self.port = port <NEW_LINE> self.app = app <NEW_LINE> <DEDENT> def run(self): <NEW_LINE> <INDENT> self.stopper = thevent() <NEW_LINE> mo...
PyQT thread to monitor the web server
62598fad236d856c2adc942a
class IDocumentFusion(IGeneration): <NEW_LINE> <INDENT> pass
When this behavior is selected, we generate a fusion of the main file of the document with the fields of the dexterity content.
62598fadbd1bec0571e150b0
class Point(Vector): <NEW_LINE> <INDENT> def __new__(cls, *args): <NEW_LINE> <INDENT> from .plane import Point2 <NEW_LINE> from .space import Point3 <NEW_LINE> if len(args) == 2: <NEW_LINE> <INDENT> return Point2(*args) <NEW_LINE> <DEDENT> elif len(args) == 3: <NEW_LINE> <INDENT> return Point3(*args) <NEW_LINE> <DEDENT...
A generic constructor that chooses the correct variant of :py:class:`~petrify.plane.Point2` or :py:class:`~petrify.space.Point3` based on argument count: >>> Point(1, 2) Point(1, 2) >>> Point(1, 2, 3) Point(1, 2, 3)
62598fad091ae35668704bf8
@as_function <NEW_LINE> class gauss_stats(IterOnInfs, Stats): <NEW_LINE> <INDENT> exec_name = "gausfitting" <NEW_LINE> names = "MNaseSeq", <NEW_LINE> def fun(self, f, genome_dir, out_dir): <NEW_LINE> <INDENT> _, base = PathHelpers.base_name(f["file_path"]) <NEW_LINE> input = PathHelpers.build_path(base, out_dir, "gff",...
Gaussian fitting and stiffness constant estimation statistics
62598fadf7d966606f747fbf
class accuracy(loss_metric): <NEW_LINE> <INDENT> def __call__(self, labels, result): <NEW_LINE> <INDENT> batch_size = result.shape[0] <NEW_LINE> choices = np.argmax(result, axis=-1) <NEW_LINE> pct = np.count_nonzero(choices == np.where(labels == 1)[1]) * 100. / batch_size <NEW_LINE> return f'{pct:.2f}%'
Computes percentage of one-hot outputs from a softmax n-class classifier that match the given labels
62598fad8e7ae83300ee907c
class SampleView(grok.View): <NEW_LINE> <INDENT> grok.context(IProfile) <NEW_LINE> grok.require('zope2.View') <NEW_LINE> grok.name('view') <NEW_LINE> def get_current(self): <NEW_LINE> <INDENT> return api.user.get_current() <NEW_LINE> <DEDENT> def has_permission(self, permission, user, obj): <NEW_LINE> <INDENT> if api.u...
sample view class
62598fad460517430c43204a
class AbstractGlobalGeometer( object): <NEW_LINE> <INDENT> def __init__(self, target): <NEW_LINE> <INDENT> self.target = target <NEW_LINE> return <NEW_LINE> <DEDENT> def displacement( self, element1, element2): <NEW_LINE> <INDENT> self._abstract( "displacement" ) <NEW_LINE> <DEDENT> def distance(self, element1, element...
Maintain positions and orientations of elements in a hierarchial structure. each layer in the hierarchy will have a local geometer. measures displacements between elements.
62598fad851cf427c66b8296
class Light(object): <NEW_LINE> <INDENT> @property <NEW_LINE> def illumination(self): <NEW_LINE> <INDENT> return self._get_illumination() <NEW_LINE> <DEDENT> def enable(self): <NEW_LINE> <INDENT> self._enable() <NEW_LINE> <DEDENT> def disable(self): <NEW_LINE> <INDENT> self._disable() <NEW_LINE> <DEDENT> def _get_illum...
Light facade. Light sensor measures the ambient light level(illumination) in lx. Common uses include controlling screen brightness. With method `enable` you can turn on the sensor and `disable` method stops the sensor. Use property `illumination` to get current illumination in lx. .. versionadded:: 1.2.5
62598fada219f33f346c67f0
class FullFieldBinaryPattern(Sequence): <NEW_LINE> <INDENT> def __init__(self, binary_pattern, rate): <NEW_LINE> <INDENT> binary_pattern = self.format_binary_pattern(binary_pattern) <NEW_LINE> bit_planes = 1 <NEW_LINE> pic_num = len(binary_pattern) <NEW_LINE> picture_time = int(1.0e+6 / rate) <NEW_LINE> Sequence.__init...
Full-field binary pattern sequence Parameters ---------- binary_pattern: list or string rate: float Frame rate [Hz].
62598fade5267d203ee6b8e3
class protectedBlock(protected): <NEW_LINE> <INDENT> withCursor = False
Same as L{protected} but without a cursor.
62598fad32920d7e50bc602e
class CosineDecayPruneScheduler(PruneSchedulerBase): <NEW_LINE> <INDENT> def __init__(self, prune_fraction, total_steps, warmup_steps=0): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.prune_fraction = prune_fraction <NEW_LINE> self.total_steps = total_steps - warmup_steps <NEW_LINE> self.warmup_steps = warmup_...
This class enables a tapering of an initial pruning-rate while `get_num_add` always returns how much has been removed. :param prune_fraction: starting pruning rate between 0 and 1 :param total_steps: total number of steps of training; this can be training iterations or epochs depending on how often...
62598fadbe383301e02537d3
@unittest.skipIf(storage_type == 'db', 'skip if environ is db') <NEW_LINE> class TestFileStorageDocs(unittest.TestCase): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def setUpClass(cls): <NEW_LINE> <INDENT> print('\n\n.................................') <NEW_LINE> print('..... Testing Documentation .....') <NEW_LINE> pr...
Class for testing BaseModel docs
62598fad7b180e01f3e4903d
class BucketScanLog(object): <NEW_LINE> <INDENT> def __init__(self, log_dir, name): <NEW_LINE> <INDENT> self.log_dir = log_dir <NEW_LINE> self.name = name <NEW_LINE> self.fh = None <NEW_LINE> self.count = 0 <NEW_LINE> <DEDENT> @property <NEW_LINE> def path(self): <NEW_LINE> <INDENT> return os.path.join(self.log_dir, "%...
Offload remediated key ids to a disk file in batches A bucket keyspace is effectively infinite, we need to store partial results out of memory, this class provides for a json log on disk with partial write support. json output format: - [list_of_serialized_keys], - [] # Empty list of keys at end when we close the b...
62598fada05bb46b3848a846
class BbcodeAdmin(admin.ModelAdmin): <NEW_LINE> <INDENT> pass
Custom BBCodes
62598fadd486a94d0ba2bfa9
class AtomicFile(object): <NEW_LINE> <INDENT> def __init__(self, name, mode="w+b", createmode=None, encoding=None): <NEW_LINE> <INDENT> self.__name = name <NEW_LINE> self._tempname = _maketemp(name, createmode=createmode) <NEW_LINE> if encoding: <NEW_LINE> <INDENT> self._fp = codecs.open(self._tempname, mode, encoding)...
This is a straight port of Alexander Saltanov's atomicfile package. Writeable file object that atomically writes a file. All writes will go to a temporary file. Call ``close()`` when you are done writing, and AtomicFile will rename the temporary copy to the original name, making the changes visible. If the object is d...
62598fad7c178a314d78d477
class Config(dict): <NEW_LINE> <INDENT> def configure(self, **params): <NEW_LINE> <INDENT> self.update(params) <NEW_LINE> <DEDENT> def dns_configure(self, **params): <NEW_LINE> <INDENT> self['dns_params'].update(params)
Base config
62598fad4527f215b58e9ebb
class BaseGeometry: <NEW_LINE> <INDENT> def area(self): <NEW_LINE> <INDENT> raise Exception("area() is not implemented")
BaseGeometry empty class
62598fad01c39578d7f12d59
class Bookmark(object): <NEW_LINE> <INDENT> def __init__(self, beginRow, endRow, data): <NEW_LINE> <INDENT> self.__begin = int(beginRow) <NEW_LINE> self.__end = int(endRow) <NEW_LINE> self.data = data <NEW_LINE> <DEDENT> @property <NEW_LINE> def range(self): <NEW_LINE> <INDENT> return (self.begin, self.end) <NEW_LINE> ...
This bookmark object is used as a marker for different places in a text document. Note that because text buffer lines index at 0, all references to rows also assume that 0 is the first line.
62598fadd58c6744b42dc2c4
class VoVInitBlock(nn.Module): <NEW_LINE> <INDENT> def __init__(self, in_channels, out_channels): <NEW_LINE> <INDENT> super(VoVInitBlock, self).__init__() <NEW_LINE> mid_channels = out_channels // 2 <NEW_LINE> self.conv1 = conv3x3_block( in_channels=in_channels, out_channels=mid_channels, stride=2) <NEW_LINE> self.conv...
VoVNet specific initial block. Parameters: ---------- in_channels : int Number of input channels. out_channels : int Number of output channels.
62598fad76e4537e8c3ef588
class InlineResponse20023(object): <NEW_LINE> <INDENT> openapi_types = { 'items': 'list[XenonntNvetoPmtError]' } <NEW_LINE> attribute_map = { 'items': '_items' } <NEW_LINE> def __init__(self, items=None, local_vars_configuration=None): <NEW_LINE> <INDENT> if local_vars_configuration is None: <NEW_LINE> <INDENT> local_v...
NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually.
62598fadf548e778e596b57f
class UserSession(models.Model): <NEW_LINE> <INDENT> user = models.ForeignKey(settings.AUTH_USER_MODEL) <NEW_LINE> session = models.ForeignKey(Session)
User<->Session model Model for linking user to session. Solution from http://gavinballard.com/associating-django-users-sessions/
62598fad63b5f9789fe85142
class SyncDaemonConfigParser(TypedConfigParser): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(SyncDaemonConfigParser, self).__init__(*args, **kwargs) <NEW_LINE> self.upgrade_hooks = {} <NEW_LINE> for name, parser in get_parsers(): <NEW_LINE> <INDENT> self.add_parser(name, parser) <...
Custom TypedConfigParser with upgrade support and syncdaemon parsers.
62598fad99cbb53fe6830eb3
class Platform(object): <NEW_LINE> <INDENT> def __init__(self, name="None", vendor="None", version=None, extensions=None, idx=0): <NEW_LINE> <INDENT> self.name = name.strip() <NEW_LINE> self.vendor = vendor.strip() <NEW_LINE> self.version = version <NEW_LINE> self.extensions = extensions.split() <NEW_LINE> self.devices...
Simple class that contains the structure of an OpenCL platform
62598fad0c0af96317c5635e
class RangeFeature(featuresModule.FeatureExtractor): <NEW_LINE> <INDENT> id = 'P10' <NEW_LINE> def __init__(self, dataOrStream=None, *arguments, **keywords): <NEW_LINE> <INDENT> super().__init__(dataOrStream=dataOrStream, *arguments, **keywords) <NEW_LINE> self.name = 'Range' <NEW_LINE> self.description = 'Difference b...
Difference between highest and lowest pitches. In semitones >>> s = corpus.parse('bwv66.6') >>> fe = features.jSymbolic.RangeFeature(s) >>> fe.extract().vector [34]
62598fadf7d966606f747fc1
class ActorSerializer(ModelSerializer): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = Actor <NEW_LINE> fields = ('id', 'first_name', 'last_name')
Simple serializer
62598fad5fcc89381b26613a
class Dimensions(namedtuple('Dimensions', ['x', 'y'])): <NEW_LINE> <INDENT> pass
Dimensions.
62598fada219f33f346c67f2
class RelocateCommand(CCCommand): <NEW_LINE> <INDENT> KEYWORDS = { 'en': ['reloc'], 'fr': ['reloc'], } <NEW_LINE> LOCATION_MOVED = 'X' <NEW_LINE> @authenticated <NEW_LINE> def process(self): <NEW_LINE> <INDENT> if 'encounter_date' not in self.message.__dict__: <NEW_LINE> <INDENT> self.message.respond(_(u'Cannot run rel...
Relocate a household Format: reloc LOC_CODE HEALTH_ID Relocates the household containing the patient HEALTH_ID to location LOC_CODE with the current CHW.
62598fadac7a0e7691f724e5
class LimbDarkening: <NEW_LINE> <INDENT> def __init__(self, teff, logg, passband): <NEW_LINE> <INDENT> self.fn = ld_dir+'data/Claret2013_PHOENIX_Nonlinear.tsv' <NEW_LINE> self.teff = teff <NEW_LINE> self.logg = logg <NEW_LINE> self.pb = passband <NEW_LINE> self.round_values() <NEW_LINE> <DEDENT> def round_values(self):...
The main class that creates a limb darkening object. :param teff: The effective temperature in Kelvin :param logg: The log of the surface gravity :param passband: The passband of interest. Acceptable values are ['Kp', 'C', 'S1', 'S2', 'S3', 'S4', 'u', 'v', 'b', 'y', 'U', 'B', 'V', 'R', 'I',...
62598fad16aa5153ce4004de
class PipeOutputImpl(object): <NEW_LINE> <INDENT> def __init__(self) : <NEW_LINE> <INDENT> self.stream = None <NEW_LINE> self.command = [] <NEW_LINE> self.process = [] <NEW_LINE> <DEDENT> def Open(self, command, binary, ignore_stderr = True): <NEW_LINE> <INDENT> if self.stream: <NEW_LINE> <INDENT> LogError('Called on a...
Implementation for pipe outputs, such as '| gzip -c > feats.gz'.
62598fadf9cc0f698b1c52b7
class TradingEngine(object): <NEW_LINE> <INDENT> def __init__(self, redis, strategy, start=None, end=None): <NEW_LINE> <INDENT> self.redis = redis <NEW_LINE> self.pubsub = redis.pubsub() <NEW_LINE> self.strategy = strategy <NEW_LINE> self.start = start <NEW_LINE> self.end = end <NEW_LINE> self.securities = [] <NEW_LINE...
has the responsability to execut strategies Sends actions to trading center does not store anything, used for realtime
62598fad7047854f4633f3b6
class WebhookMgr: <NEW_LINE> <INDENT> def __init__(self, authdata): <NEW_LINE> <INDENT> self.authdata = authdata <NEW_LINE> <DEDENT> def getAll(self): <NEW_LINE> <INDENT> response = requests.get(self.authdata.getUrl() + WEBHOOK_WS_URL, auth=(self.authdata.getUsername(), self.authdata.getPassword())) <NEW_LINE> if respo...
Webhook - creates webhook
62598fad5fdd1c0f98e5df69
class SimpleFactory(AbstractFactory): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.__missile_strategy = SimpleMove() <NEW_LINE> <DEDENT> def create_missile(self, position: Position, speed: float, movement_angle: float) -> Missile: <NEW_LINE> <INDENT> missile = Missile(position, speed, movement_angle...
Simple factory for creating enemies and missiles Missiles: - simple lowering angle Smart enemy: - dump enemy sitting at one place Dummy enemy: - dump enemy sitting at one place
62598fad2c8b7c6e89bd37a2
class Satsuma2(CMakePackage): <NEW_LINE> <INDENT> homepage = "https://github.com/bioinfologics/satsuma2" <NEW_LINE> git = "https://github.com/bioinfologics/satsuma2.git" <NEW_LINE> version('2016-11-22', commit='da694aeecf352e344b790bea4a7aaa529f5b69e6') <NEW_LINE> def install(self, spec, prefix): <NEW_LINE> <INDEN...
Satsuma2 is an optimsed version of Satsuma, a tool to reliably align large and complex DNA sequences providing maximum sensitivity (to find all there is to find), specificity (to only find real homology) and speed (to accomodate the billions of base pairs in vertebrate genomes).
62598fad4527f215b58e9ebd
class AngleTransform(tr.Transform): <NEW_LINE> <INDENT> name = "angle" <NEW_LINE> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> self.regularized = kwargs.pop("regularized", 10.0) <NEW_LINE> super(AngleTransform, self).__init__(*args, **kwargs) <NEW_LINE> <DEDENT> def backward(self, y): <NEW_LINE> <INDENT> re...
Reference: exoplanet.dfm.io
62598fad6aa9bd52df0d4ea4
class ResPartner(models.Model): <NEW_LINE> <INDENT> _inherit = 'res.partner' <NEW_LINE> is_commercial_partner = fields.Boolean( "Is Commercial Partner", compute='_compute_is_commercial_partner', store=True) <NEW_LINE> @api.depends('commercial_partner_id') <NEW_LINE> def _compute_is_commercial_partner(self): <NEW_LINE> ...
Extend to add is_commercial_partner field.
62598fad2ae34c7f260ab0be
class BaseCache: <NEW_LINE> <INDENT> def trim(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def autotrim(self, delay=CACHE_LIFESPAN): <NEW_LINE> <INDENT> self.trim() <NEW_LINE> t = threading.Timer(delay, self.autotrim) <NEW_LINE> t.daemon = True <NEW_LINE> t.start() <NEW_LINE> <DEDENT> def __contains__(self, url)...
Subclasses must behave like a dict
62598fadcc40096d6161a1c9
class Function(mixins.TaskDescriptionMixin, mixins.NextNodeMixin, mixins.DetailViewMixin, mixins.UndoViewMixin, mixins.CancelViewMixin, mixins.PerformViewMixin, Event): <NEW_LINE> <INDENT> task_type = 'FUNC' <NEW_LINE> activation_class = FuncActivation <NEW_LINE> def __init__(self, func, task_loader=None, **kwargs): <N...
Function task to be executed outside of the flow. Example:: class MyFlow(Flow): ... shipment_received_handler = ( flow.Function( this.on_shipment_receive, task_loader=this.get_shipment_handler_task) .Next(this.end) ) .... ...
62598fadadb09d7d5dc0a567
class RegisterConfirmSerializer(SocialAuthSerializer): <NEW_LINE> <INDENT> partial_token = serializers.CharField(source="get_partial_token") <NEW_LINE> verification_code = serializers.CharField(write_only=True) <NEW_LINE> def create(self, validated_data): <NEW_LINE> <INDENT> return super()._authenticate(SocialAuthState...
Serializer for email confirmation
62598fad10dbd63aa1c70b91
class MyModuleList(torch.nn.ModuleList): <NEW_LINE> <INDENT> def __init__(self, lst): <NEW_LINE> <INDENT> self.layers = [] <NEW_LINE> self.activations = [] <NEW_LINE> for layer_activations in lst: <NEW_LINE> <INDENT> self.layers.append(layer_activations[0]) <NEW_LINE> self.activations.append(layer_activations[1:]) <NEW...
Wrapper for easily composing modules and activation functions.
62598fad167d2b6e312b6f4f
class SubscriptionPlanAdmin(admin.ModelAdmin): <NEW_LINE> <INDENT> fields = ( 'plan_name', 'slug', 'plan_description', 'group', 'tags', 'grace_period', ) <NEW_LINE> inlines = [PlanCostInline] <NEW_LINE> list_display = ( 'plan_name', 'group', 'display_tags', ) <NEW_LINE> prepopulated_fields = {'slug': ('plan_name',)}
Admin class for the SubscriptionPlan model.
62598fad7d847024c075c3a0
class RequiredFormSetMixin(object): <NEW_LINE> <INDENT> def clean(self): <NEW_LINE> <INDENT> super(RequiredFormSetMixin, self).clean() <NEW_LINE> count = 0 <NEW_LINE> for form in self.forms: <NEW_LINE> <INDENT> if (hasattr(form, 'cleaned_data') and not form.cleaned_data.get('DELETE', True)): <NEW_LINE> <INDENT> count +...
This class ensures at least one form in the formset is filled.
62598fad5166f23b2e2433b6
class ResidualBlock(nn.Module): <NEW_LINE> <INDENT> def __init__(self, ch_in=64, ch_out=128, in_place=True): <NEW_LINE> <INDENT> super(ResidualBlock, self).__init__() <NEW_LINE> conv1 = nn.Conv2d(in_channels=ch_in, out_channels=ch_out, kernel_size=1, stride=1, padding=0, bias=False) <NEW_LINE> conv2 = nn.Conv2d(in_chan...
Residual BLock For SR without Norm Layer conv 1*1 conv 3*3 conv 1*1
62598fad56b00c62f0fb2892
class Region: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.chromosome: str <NEW_LINE> self.start_position: int <NEW_LINE> self.end_position: int <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return f'{self.chromosome}:{self.start_position}-{self.end_position}' <NEW_LINE> <DEDENT> def __...
Encapsulates a genomic region. Attributes: chromosome (str): The chromosome name. start_position (int): The start position. end_position (int): The end position.
62598fad851cf427c66b8299
class ApiClientMessage(object): <NEW_LINE> <INDENT> def __init__(self, headers=None, body=None): <NEW_LINE> <INDENT> if headers is None: <NEW_LINE> <INDENT> headers = [] <NEW_LINE> <DEDENT> self.headers = headers <NEW_LINE> self.body = body
Represents the interface between :py:class:`ask_sdk_model.services.api_client.ApiClient` implementation and a Service Client. :param headers: List of header tuples :type headers: list[tuple[str, str]] :param body: Body of the message :type body: str
62598fad460517430c43204c
class Cell(object): <NEW_LINE> <INDENT> def __init__(self, state: str): <NEW_LINE> <INDENT> self.state = state <NEW_LINE> self.neighbours = () <NEW_LINE> self.next_state = self.state <NEW_LINE> <DEDENT> def calculate_step(self): <NEW_LINE> <INDENT> if not self.neighbours: <NEW_LINE> <INDENT> raise ReferenceError('No ne...
A single cell for use in cellular automata.
62598fad5fcc89381b26613b
class DiscoverView(Page): <NEW_LINE> <INDENT> def get_widget(self, params): <NEW_LINE> <INDENT> term = '' <NEW_LINE> if 'term' in params: <NEW_LINE> <INDENT> term = params['term'] <NEW_LINE> <DEDENT> results = None <NEW_LINE> if 'results' in params: <NEW_LINE> <INDENT> results = params['results'] <NEW_LINE> <DEDENT> wi...
Discover view
62598fad090684286d5936cb
class CspAnonymousProcess(CspTree): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def take_tree_from(taker): <NEW_LINE> <INDENT> open_mark = CspMark.take_tree_from_chars(taker, chars="(", formatted="(") <NEW_LINE> process = CspProcess().take_tree_from(taker) <NEW_LINE> close_mark = CspMark.take_tree_from_chars(taker, ch...
anonymous_process := "(" process ")"
62598fad32920d7e50bc6032