code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
@register(Tag.PLACED_LAYER1) <NEW_LINE> @register(Tag.PLACED_LAYER2) <NEW_LINE> @attr.s(repr=False, slots=True) <NEW_LINE> class PlacedLayerData(BaseElement): <NEW_LINE> <INDENT> kind = attr.ib(default=b'plcL', type=bytes) <NEW_LINE> version = attr.ib(default=3, type=int, validator=in_((3, ))) <NEW_LINE> uuid = attr.ib...
PlacedLayerData structure.
62598f8723e79379d538bff8
class Service(object): <NEW_LINE> <INDENT> running = False <NEW_LINE> name = None <NEW_LINE> def __init__(self, app=None): <NEW_LINE> <INDENT> if app: <NEW_LINE> <INDENT> self.init_app(app) <NEW_LINE> <DEDENT> <DEDENT> def init_app(self, app): <NEW_LINE> <INDENT> app.services[self.name] = self <NEW_LINE> <DEDENT> def s...
Base class for services.
62598f873617ad0b5ee05c3f
class Classifier: <NEW_LINE> <INDENT> def fit(self,dataset): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def predict(self,dataset): <NEW_LINE> <INDENT> return [self.predict_instance(x) for x in dataset.data] <NEW_LINE> <DEDENT> def predict_instance(self,instance): <NEW_LINE> <INDENT> return 'Iris-setosa';
A learning classifier with a hard-coded algorithim
62598f8796565a6dacd2ccf6
class ConfigHook(hooks.PecanHook): <NEW_LINE> <INDENT> def __init__(self, conf): <NEW_LINE> <INDENT> self.conf = conf <NEW_LINE> self.enforcer = policy.Enforcer(conf, default_rule="default") <NEW_LINE> <DEDENT> def before(self, state): <NEW_LINE> <INDENT> state.request.cfg = self.conf <NEW_LINE> state.request.enforcer ...
Attach the configuration and policy enforcer object to the request. That allows controllers to get it.
62598f87a79ad16197769b5f
class Income(models.Model): <NEW_LINE> <INDENT> type = models.IntegerField(choices=choices.INCOME_TYPE, default=7) <NEW_LINE> frequency = models.IntegerField(choices=choices.FREQENCY, default=7) <NEW_LINE> amount = models.DecimalField(max_digits=10, decimal_places=2) <NEW_LINE> notes = models.CharField(max_length=150) ...
User inputs all types of income
62598f870fa83653e46f49eb
class RoleListSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = Role <NEW_LINE> fields = '__all__' <NEW_LINE> depth = 1
角色列表序列化
62598f87c432627299fa2acd
class HttpRequest(object): <NEW_LINE> <INDENT> def __init__(self, environment): <NEW_LINE> <INDENT> self._environment = environment <NEW_LINE> self.path = environment.get('PATH_INFO', '').lstrip('/') <NEW_LINE> self.method = environment.get('REQUEST_METHOD') <NEW_LINE> if environment.get('HTTP_HOST'): <NEW_LINE> <INDEN...
WSGI Request helper class
62598f8763d6d428bbee22b5
class SHA1(): <NEW_LINE> <INDENT> _h0, _h1, _h2, _h3, _h4, = ( 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0) <NEW_LINE> def __init__(self, message): <NEW_LINE> <INDENT> length = struct.pack('>Q', len(message) * 8) <NEW_LINE> while len(message) > 64: <NEW_LINE> <INDENT> self._handle(message[:64]) <NEW_LINE...
MD5类,输入message,输出md5摘要值
62598f87b57a9660fecd1579
class TdFilterCheckType(Enum): <NEW_LINE> <INDENT> AREA = 1 <NEW_LINE> WIDTH = 2 <NEW_LINE> HEIGHT = 4 <NEW_LINE> PERIMETER = 8 <NEW_LINE> ASPECTRATIO = 16 <NEW_LINE> OCCUPIEDRATIO = 32 <NEW_LINE> COMPACTNESS = 64 <NEW_LINE> SWT = 128
需要检查的类型
62598f878a43f66fc4bf1c7f
class ConfirmTemplate(Template): <NEW_LINE> <INDENT> def __init__(self, text=None, actions=None, **kwargs): <NEW_LINE> <INDENT> super(ConfirmTemplate, self).__init__(**kwargs) <NEW_LINE> self.type = 'confirm' <NEW_LINE> self.text = text <NEW_LINE> self.actions = get_actions(actions)
ConfirmTemplate. https://devdocs.line.me/en/#confirm Template message with two action buttons.
62598f870383005118f6d1f8
class FigureManager(object): <NEW_LINE> <INDENT> def __init__(self, fig): <NEW_LINE> <INDENT> self.fig = fig <NEW_LINE> self.fig.clear() <NEW_LINE> self.axes = [AxesManager(fig.add_subplot(111))] <NEW_LINE> self._current_index = 0 <NEW_LINE> self._axrow_count = 1 <NEW_LINE> <DEDENT> @property <NEW_LINE> def current_ind...
object to simplify editing figure settings
62598f87a4f1c619b294e0ea
class Prodigal(object): <NEW_LINE> <INDENT> def __init__(self, user_path = None, id_type = 'meta', verbose = True): <NEW_LINE> <INDENT> self.user_path = user_path <NEW_LINE> self.verbose = verbose <NEW_LINE> path_check('prodigal', self.user_path) <NEW_LINE> if id_type == 'meta': <NEW_LINE> <INDENT> self.id_type = 'meta...
Runs Prodigal
62598f8710dbd63aa1c706b1
class distributions(object): <NEW_LINE> <INDENT> your_organization = 0 <NEW_LINE> this_community = 1 <NEW_LINE> connected_communities = 2 <NEW_LINE> all_communities = 3
Enumeration of the available distributions.
62598f87d99f1b3c44d051ab
class DirectoryFixTypeTest(TestCase): <NEW_LINE> <INDENT> @patch('bundlewrap.items.directories.Directory._fix_mode') <NEW_LINE> @patch('bundlewrap.items.directories.Directory._fix_owner') <NEW_LINE> def test_rm(self, fix_mode, fix_owner): <NEW_LINE> <INDENT> node = MagicMock() <NEW_LINE> bundle = MagicMock() <NEW_LINE>...
Tests bundlewrap.items.directories.Directory._fix_type.
62598f878a349b6b43685d42
class HiddenTransform(nn.Module): <NEW_LINE> <INDENT> def __init__(self, input_shape, output_shape, activation='tanh', bias=True, batch_first=False): <NEW_LINE> <INDENT> super(HiddenTransform, self).__init__() <NEW_LINE> self.batch_first = batch_first <NEW_LINE> self.activation = nn.Tanh() if activation == 'tanh' else ...
docstring for [object Object].
62598f87711fe17d825e01e8
class ResourceOptions(object): <NEW_LINE> <INDENT> serializer = Serializer() <NEW_LINE> authentication = Authentication() <NEW_LINE> authorization = ReadOnlyAuthorization() <NEW_LINE> cache = NoCache() <NEW_LINE> throttle = BaseThrottle() <NEW_LINE> validation = Validation() <NEW_LINE> paginator_class = Paginator <NEW_...
A configuration class for ``Resource``. Provides sane defaults and the logic needed to augment these settings with the internal ``class Meta`` used on ``Resource`` subclasses.
62598f8707d97122c42167a3
class FLoss(nn.Module): <NEW_LINE> <INDENT> def __init__(self, gamma=2., weight=None, size_average=True): <NEW_LINE> <INDENT> super(FLoss, self).__init__() <NEW_LINE> self.gamma = gamma <NEW_LINE> self.weight = weight <NEW_LINE> self.size_average = size_average <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT...
Focal Loss Lin, Tsung-Yi, et al. "Focal loss for dense object detection." Proceedings of the IEEE international conference on computer vision. 2017. (modified from https://github.com/umbertogriffo/focal-loss-keras/blob/master/losses.py)
62598f8782261d6c5272fc53
@dev((1,0,0)) <NEW_LINE> class WAITING_FOR_REPLY(object): <NEW_LINE> <INDENT> def __init__(self, reqid): <NEW_LINE> <INDENT> self._reqid = reqid <NEW_LINE> self._reply = None <NEW_LINE> <DEDENT> @property <NEW_LINE> @dev((1,0,0)) <NEW_LINE> def reply(self): <NEW_LINE> <INDENT> return self._reply <NEW_LINE> <DEDENT> @pr...
The ``ClientConnection`` has sent a message to the Bokeh Server which should generate a paired reply, and is waiting for the reply.
62598f87e76e3b2f99fd8535
class Profile(models.Model): <NEW_LINE> <INDENT> avatar = models.ImageField(upload_to='avatars',storage='s3boto', blank=True, null=True) <NEW_LINE> posts = models.IntegerField(default=0, blank=True, null=True) <NEW_LINE> user = models.ForeignKey(User, unique=True) <NEW_LINE> first_name = models.CharField(max_length=30,...
Profile model with a one to one relation with a user, first name, last name, avatar, hometown, bio, and posts.
62598f87d53ae8145f917f8d
class DcosAuth(requests.auth.AuthBase): <NEW_LINE> <INDENT> def __init__(self, auth_token: str): <NEW_LINE> <INDENT> self.auth_token = auth_token <NEW_LINE> <DEDENT> def __call__(self, request): <NEW_LINE> <INDENT> request.headers['Authorization'] = 'token={}'.format(self.auth_token) <NEW_LINE> return request
Child of AuthBase for specifying how to handle DC/OS auth per request :param auth_token: token generated by authenticating with access control :type auth_token: str
62598f87462c4b4f79dbb501
class MetricsPostBodySchemaParameters(Model): <NEW_LINE> <INDENT> _validation = { 'metric_id': {'required': True}, } <NEW_LINE> _attribute_map = { 'metric_id': {'key': 'metricId', 'type': 'str'}, 'timespan': {'key': 'timespan', 'type': 'str'}, 'aggregation': {'key': 'aggregation', 'type': '[MetricsAggregation]'}, 'inte...
The parameters for a single metrics query. All required parameters must be populated in order to send to Azure. :param metric_id: Required. Possible values include: 'requests/count', 'requests/duration', 'requests/failed', 'users/count', 'users/authenticated', 'pageViews/count', 'pageViews/duration', 'client/proce...
62598f87d4950a0f3b110bb4
class GridLookup(object): <NEW_LINE> <INDENT> def __init__(self, grid, max_word_length): <NEW_LINE> <INDENT> self.grid_lookup = {} <NEW_LINE> self.max_word_length = max_word_length <NEW_LINE> for index, _, row, col in grid.get_letter_data(max_word_length): <NEW_LINE> <INDENT> self._index_grid_sequence(index, row) <NEW_...
Responsible for indexing a grid for faster lookups of a word, either by checking for an exact match or retrieving a list of possible positions in the grid for longer words. The grid is stored as a tree, using dictionaries. Each letter is indexed along with the next x letters that appear horizontally and vertically, x ...
62598f8715baa72349461a7c
class WeightedCharacter: <NEW_LINE> <INDENT> def __init__( self, gdf, values, spatial_weights, unique_id, areas=None, verbose=True ): <NEW_LINE> <INDENT> self.gdf = gdf <NEW_LINE> self.sw = spatial_weights <NEW_LINE> self.id = gdf[unique_id] <NEW_LINE> data = gdf.copy() <NEW_LINE> if areas is None: <NEW_LINE> <INDENT> ...
Calculates the weighted character Character weighted by the area of the objects within neighbors defined in ``spatial_weights``. .. math:: \frac{\sum_{i=1}^{n} {character_{i} * area_{i}}}{\sum_{i=1}^{n} area_{i}} Adapted from :cite:`dibble2017`. Parameters ---------- gdf : GeoDataFrame GeoDataFrame containi...
62598f873617ad0b5ee05c41
class MultiLookupRouterWithPatchList(MultiLookupRouter): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def make_routes(template_text): <NEW_LINE> <INDENT> return routers.Route( url=r'^{prefix}/{%s}{trailing_slash}$' % template_text, mapping={ 'get': 'list', 'post': 'create', 'patch': 'modify' }, name='{basename}-list', ...
This class only extends MultiLookupRouter to allow PATCH method on list endpoint
62598f87b830903b9686e1f1
class moving_average_ii(object): <NEW_LINE> <INDENT> thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') <NEW_LINE> def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined - class is abstract") <NEW_LINE> __repr__ = _swig_repr <NEW_LINE> def ...
output is the moving sum of the last N samples, scaled by the scale factor Constructor Specific Documentation: Create a moving average block. Args: length : Number of samples to use in the average. scale : scale factor for the result. max_iter : limits how long we go without flushing the accumulator This...
62598f8773bcbd0ca4bc9d51
class User(webapp2_extras.appengine.auth.models.User): <NEW_LINE> <INDENT> def set_password(self, raw_password): <NEW_LINE> <INDENT> self.password = security.generate_password_hash(raw_password, length=12) <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def get_by_auth_token(cls, user_id, token, subject='auth'): <NEW_LINE>...
Many of the method here have been copied from the webapp2 core because dolphin.
62598f8738b623060ffa8b95
class Meanabs(Aggregator): <NEW_LINE> <INDENT> def __call__(self, array): <NEW_LINE> <INDENT> return np.mean(np.abs(array))
The mean of the absolute values of the array
62598f87498bea3a75a57622
class VectorCNN: <NEW_LINE> <INDENT> def __init__(self, model_path, device='CPU', max_reqs=100): <NEW_LINE> <INDENT> self.max_reqs = max_reqs <NEW_LINE> self.net = load_ie_model(model_path, device, None, num_reqs=self.max_reqs) <NEW_LINE> <DEDENT> def forward(self, batch): <NEW_LINE> <INDENT> assert len(batch) <= self....
Wrapper class for a network returning a vector
62598f878e05c05ec3f6ebc7
class EPUWorkerService(BaseService): <NEW_LINE> <INDENT> pass
EPU Worker service interface
62598f87a17c0f6771d5bd41
class CategorySelectWidget(RadioSelect): <NEW_LINE> <INDENT> renderer = CategorySelectRenderer
Mainly duplicated from django.forms.widgets Adds extra attributes to the markup
62598f8723849d37ff850bbd
class Task(models.Model): <NEW_LINE> <INDENT> name = models.CharField(max_length=200) <NEW_LINE> completions = models.IntegerField(default=10, blank=True, null=True) <NEW_LINE> documents = models.ManyToManyField('document.Document', through='DocumentQuestRelationship', blank=True) <NEW_LINE> users = models.ManyToManyFi...
This is an ER Quest, tracks whose completed it and what documents are contained within the Quest * Originally called Task when training was going to be dynamic, a TODO is remove all 'Training' references from this model
62598f87d10714528d69d9cf
class ListPublicGistsInputSet(InputSet): <NEW_LINE> <INDENT> def set_Page(self, value): <NEW_LINE> <INDENT> InputSet._set_input(self, 'Page', value)
An InputSet with methods appropriate for specifying the inputs to the ListPublicGists Choreo. The InputSet object is used to specify input parameters when executing this Choreo.
62598f8782261d6c5272fc54
class InvertedFilter(UpdateFilter): <NEW_LINE> <INDENT> def __init__(self, f: BaseFilter): <NEW_LINE> <INDENT> self.f = f <NEW_LINE> <DEDENT> def filter(self, update: Update) -> bool: <NEW_LINE> <INDENT> return not bool(self.f(update)) <NEW_LINE> <DEDENT> def __repr__(self) -> str: <NEW_LINE> <INDENT> return "<inverted...
Represents a filter that has been inverted. Args: f: The filter to invert.
62598f87d10714528d69d9d0
class CustomProgressBar(urwid.ProgressBar): <NEW_LINE> <INDENT> semi = u'\u2582' <NEW_LINE> def get_text(self): <NEW_LINE> <INDENT> return min(100, max(0, int(self.current * 100 / self.done))) <NEW_LINE> <DEDENT> def get_current(self): <NEW_LINE> <INDENT> return self.current <NEW_LINE> <DEDENT> def get_done(self): <NEW...
ProgressBar that displays a semigraph instead of a percentage
62598f8716aa5153ce400002
class EventImageSerializer(serializers.HyperlinkedModelSerializer): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = EventImage <NEW_LINE> fields = ('id', 'image', 'position')
EventImageSerializer class
62598f87d53ae8145f917f8f
class KeyInfo(object): <NEW_LINE> <INDENT> def __init__(self, required, help, type, persistent): <NEW_LINE> <INDENT> self.required = required <NEW_LINE> self.type = type <NEW_LINE> self.help = help <NEW_LINE> self.persistent = persistent
Key configuration item storage object.
62598f87be383301e02532fb
class NoMutation: <NEW_LINE> <INDENT> def mutate(self, org): <NEW_LINE> <INDENT> return org.copy()
Simple 'mutation' class that doesn't do anything.
62598f878e71fb1e983bb5b1
class Card(models.Model): <NEW_LINE> <INDENT> cardid = models.CharField(max_length=20) <NEW_LINE> name = models.CharField(max_length=10) <NEW_LINE> user = models.ForeignKey("user.User",on_delete=models.CASCADE,related_name="cards") <NEW_LINE> class Meta: <NEW_LINE> <INDENT> db_table = "Card" <NEW_LINE> <DEDENT> def __s...
信用卡
62598f87bde94217f37073e6
class Image(Base): <NEW_LINE> <INDENT> __tablename__ = 'images' <NEW_LINE> id = sa.Column(sa.Integer, primary_key=True) <NEW_LINE> time = sa.Column( sa.String(len(coils.time2string(dt.datetime.now()))), unique=True) <NEW_LINE> def __init__(self, tstamp): <NEW_LINE> <INDENT> self.time = coils.time2string(tstamp) <NEW_LI...
Mapping for "images" table.
62598f87507cdc57c63a488d
class GroupViewSet(viewsets.ModelViewSet): <NEW_LINE> <INDENT> queryset = Group.objects.all() <NEW_LINE> serializer_class = GroupSerializer <NEW_LINE> permission_classes = [permissions.IsAuthenticated]
用户组视图集合
62598f876fb2d068a7693baf
class _GatherLayerBroadcaster(_LayerBroadcaster): <NEW_LINE> <INDENT> def __init__(self, gather_index): <NEW_LINE> <INDENT> gather_index = ops.convert_to_tensor(gather_index) <NEW_LINE> if (gather_index.dtype != dtypes.int64 and gather_index.dtype != dtypes.int32): <NEW_LINE> <INDENT> raise ValueError("gather_index mus...
Implements _LayerBroadcaster with an explicit gather_index. For example, suppose that the source shape is: [*],[*,*] And the target shape is: [*],[*,*],[*],[*,*] Then, this can be represented with a map: [0,1,2,0,1,2]
62598f87c432627299fa2ad1
class FormatCBFMiniPilatusDLS6MSN100(FormatCBFMiniPilatus): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def understand(image_file): <NEW_LINE> <INDENT> header = FormatCBFMiniPilatus.get_cbf_header(image_file) <NEW_LINE> for record in header.split("\n"): <NEW_LINE> <INDENT> if ( "# Detector" in record and "PILATUS" in ...
A class for reading mini CBF format Pilatus images for 6M SN 100 @ DLS.
62598f87287bf620b62716b6
class ALESimpleManager: <NEW_LINE> <INDENT> def __init__(self, ale_experiment): <NEW_LINE> <INDENT> self.ale_experiment = ale_experiment <NEW_LINE> <DEDENT> def run_single_game(self, nn_parameters, logging=True, **kwargs): <NEW_LINE> <INDENT> game_parameters = copy.copy(self.ale_experiment.ale_parameters) <NEW_LINE> fo...
Creates internal experiment based on parameter inputs. Allows running single game
62598f87b5575c28eb712a48
class BaseType(object): <NEW_LINE> <INDENT> def __init__(self, obj_type, attribute_name = None, fixed = True): <NEW_LINE> <INDENT> if attribute_name: <NEW_LINE> <INDENT> self.__attribute_name = "__{0}".format(attribute_name) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.__attribute_name = "__{0:x}".format(random.g...
Base for managable types. It's type can only be set if allowed by __contains__ method. Otherwise AttributeError exception is raised. Child classes should define policy by overloading __contains__ operator, e.g.: class Human(BaseType): genders = set(["male", "female"]) def __init__(self, gender): ...
62598f87498bea3a75a57624
class UserManager(object): <NEW_LINE> <INDENT> def __init__(self, base_url='https://peprodscussu2.portalext.visualstudio.com', creds=None): <NEW_LINE> <INDENT> self._config = Configuration(base_url=base_url) <NEW_LINE> self._client = ServiceClient(creds, self._config) <NEW_LINE> client_models = {k: v for k, v in models...
Get details about a user Attributes: See BaseManager
62598f8707d97122c42167a6
class ListVpnSitesResult(msrest.serialization.Model): <NEW_LINE> <INDENT> _attribute_map = { 'value': {'key': 'value', 'type': '[VpnSite]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } <NEW_LINE> def __init__( self, **kwargs ): <NEW_LINE> <INDENT> super(ListVpnSitesResult, self).__init__(**kwargs) <NEW_LINE> sel...
Result of the request to list VpnSites. It contains a list of VpnSites and a URL nextLink to get the next set of results. :param value: List of VpnSites. :type value: list[~azure.mgmt.network.v2019_12_01.models.VpnSite] :param next_link: URL to get the next set of operation list results if there are any. :type next_li...
62598f8729b78933be269e5b
class IMeasureWizardSourceType(IMeasureSourceType, IMeasureWizardSubform): <NEW_LINE> <INDENT> pass
Choose form data-source type (branch point in wizard decision tree)
62598f87a05bb46b3848a37b
class AuthoritiesList(AuthenticatedResource): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.reqparse = reqparse.RequestParser() <NEW_LINE> super(AuthoritiesList, self).__init__() <NEW_LINE> <DEDENT> @validate_schema(None, authorities_output_schema) <NEW_LINE> def get(self): <NEW_LINE> <INDENT> parser...
Defines the 'authorities' endpoint
62598f87596a897236127774
class NoOperationHandler(webapp2.RequestHandler): <NEW_LINE> <INDENT> def noop(self): <NEW_LINE> <INDENT> self.response.write('NO-OP') <NEW_LINE> self.error(404) <NEW_LINE> <DEDENT> def get(self, *args, **kwargs): <NEW_LINE> <INDENT> return self.noop() <NEW_LINE> <DEDENT> def post(self, *args, **kwargs): <NEW_LINE> <IN...
Does nothing.
62598f87fbf16365ca793bac
class Question(models.Model): <NEW_LINE> <INDENT> question_text = models.CharField(max_length=200) <NEW_LINE> pub_date = models.DateTimeField('date published') <NEW_LINE> def was_published_recently(self): <NEW_LINE> <INDENT> return self.pub_date >= timezone.now() - datetime.timedelta(days=1) <NEW_LINE> <DEDENT> def __s...
The model for a question.
62598f87d10714528d69d9d1
class TestGroupsV2GroupPotentialMembership(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 testGroupsV2GroupPotentialMembership(self): <NEW_LINE> <INDENT> pass
GroupsV2GroupPotentialMembership unit test stubs
62598f8771ff763f4b5e7270
class TestTranslatedHelp(tests.TestCaseWithTransport): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super(TestTranslatedHelp, self).setUp() <NEW_LINE> self.overrideAttr(i18n, '_translations', ZzzTranslations()) <NEW_LINE> <DEDENT> def test_help_command_utf8(self): <NEW_LINE> <INDENT> out, err = self.run_bzr...
Tests for display of translated help topics
62598f8763b5f9789fe84c72
class E5LineEditSideWidget(QWidget): <NEW_LINE> <INDENT> sizeHintChanged = pyqtSignal() <NEW_LINE> def __init__(self, parent=None): <NEW_LINE> <INDENT> super(E5LineEditSideWidget, self).__init__(parent) <NEW_LINE> <DEDENT> def event(self, evt): <NEW_LINE> <INDENT> if evt.type() == QEvent.LayoutRequest: <NEW_LINE> <INDE...
Class implementing the side widgets for the line edit class.
62598f878e71fb1e983bb5b2
class OBOParser(object): <NEW_LINE> <INDENT> def __init__(self, file): <NEW_LINE> <INDENT> self.file = file <NEW_LINE> <DEDENT> def parse(self, progress_callback=None): <NEW_LINE> <INDENT> data = self.file.read() <NEW_LINE> header = data[: data.index("\n[")] <NEW_LINE> body = data[data.index("\n[") + 1:] <NEW_LINE> for...
A simple parser for .obo files (inspired by xml.dom.pulldom) >>> from six import StringIO >>> file = StringIO(''' ... header_tag: header_value ... [Term] ... id: FOO:001 { modifier=bar } ! comment ... ''') >>> parser = OBOParser(file) >>> for event, value in parser: ... print(event, value) ... HEADER_TAG ['header_...
62598f87507cdc57c63a488f
class exitAction(QAction): <NEW_LINE> <INDENT> def __init__(self, parent): <NEW_LINE> <INDENT> super().__init__(QIcon('..\\icons\\circle-cross.svg'), MyStrings.actionExitPrettyName, parent) <NEW_LINE> self.setStatusTip(MyStrings.actionExitStatusTip) <NEW_LINE> self.setIconText(MyStrings.actionExitIconText) <NEW_LINE> s...
# Class: exitAction. # Description: A PyQt5 action that closes the application and all the opened files.
62598f876aa9bd52df0d49d9
class KNN(object): <NEW_LINE> <INDENT> def get_iris_data(self): <NEW_LINE> <INDENT> iris = load_iris() <NEW_LINE> iris_data = iris.data <NEW_LINE> iris_target = iris.target <NEW_LINE> return iris_data, iris_target <NEW_LINE> <DEDENT> def run(self): <NEW_LINE> <INDENT> iris_data, iris_target = self.get_iris_data() <NEW_...
利用KNN算法对鸢尾花进行分类
62598f87379a373c97d98b15
class PathSet(set): <NEW_LINE> <INDENT> def __init__(self, iterable=None): <NEW_LINE> <INDENT> if iterable: <NEW_LINE> <INDENT> for value in iterable: <NEW_LINE> <INDENT> if not isinstance(value, Path): <NEW_LINE> <INDENT> raise TypeError("only accepts pathlib.Path objects") <NEW_LINE> <DEDENT> <DEDENT> super().__init_...
A class for containing a set of :class:`pathlib.Path` objects.
62598f87d6c5a102081e1c4d
class StateConnection(ImplicitComponent): <NEW_LINE> <INDENT> def setup(self): <NEW_LINE> <INDENT> self.add_input('y2_actual', 1.0) <NEW_LINE> self.add_output('y2_command', val=1.0) <NEW_LINE> <DEDENT> def apply_nonlinear(self, inputs, outputs, residuals): <NEW_LINE> <INDENT> y2_actual = inputs['y2_actual'] <NEW_LINE> ...
Define connection with an explicit equation.
62598f87a79ad16197769b65
class ExampleWidget(QWidget): <NEW_LINE> <INDENT> def __init__(self, parent): <NEW_LINE> <INDENT> QWidget.__init__(self, parent=parent) <NEW_LINE> self.setWindowTitle("Example") <NEW_LINE> self.button = QPushButton('Current editor') <NEW_LINE> self.table = QTableWidget(self) <NEW_LINE> self.button.setIcon(ima.icon('spy...
Example widget. Methods defined here should not be aware of spyder, but of the function required by the widget only.
62598f875f7d997b871f915a
class PlotResource(ModelResource): <NEW_LINE> <INDENT> owners = fields.ManyToManyField(UserResource, 'owners') <NEW_LINE> def get_object_list(self, request): <NEW_LINE> <INDENT> object_list = self._meta.queryset <NEW_LINE> if request and hasattr(request, 'user'): <NEW_LINE> <INDENT> object_list = object_list.filter(own...
Api resource for tracktor.models.Plot
62598f8715baa72349461a81
class Options(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.output = None <NEW_LINE> self.resume = False <NEW_LINE> self.live = False <NEW_LINE> self.silent = False <NEW_LINE> self.force = False <NEW_LINE> self.quality = 0 <NEW_LINE> self.flexibleq = 0 <NEW_LINE> self.list_quality = False <N...
Options used when invoking the script from another Python script. Simple container class used when calling get_media() from another Python script. The variables corresponds to the command line parameters parsed in main() when the script is called directly. When called from a script there are a few more things to cons...
62598f87fbf16365ca793bae
class AuxToggleWidget(QtWidgets.QWidget): <NEW_LINE> <INDENT> def __init__(self, toggle_names, plot_widget): <NEW_LINE> <INDENT> super(AuxToggleWidget, self).__init__() <NEW_LINE> self.plot_widget = plot_widget <NEW_LINE> self.toggle_names = toggle_names <NEW_LINE> self.toggles = {} <NEW_LINE> self.__build_aux_toggle_w...
Creates a collection of auxiliary toggles :type: QWidget
62598f8707f4c71912baef47
class JobTitleSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> job_tag = JobTagSerializer(many=True, required=True) <NEW_LINE> class Meta: <NEW_LINE> <INDENT> model = JobTitle <NEW_LINE> fields = ('id', 'uid', 'program_id', 'category', 'title', 'level', 'description', 'status', 'job_tag', 'created_by', 'cre...
serializer for Job Title
62598f873eb6a72ae038a134
class CountReleasesTest(OrloQueryTest): <NEW_LINE> <INDENT> INCLUSIVE_ARGS = {} <NEW_LINE> EXCLUSIVE_ARGS = {'user': 'non-existent'} <NEW_LINE> def test_count_releases(self): <NEW_LINE> <INDENT> self._create_finished_release() <NEW_LINE> result = orlo.queries.count_releases(**self.INCLUSIVE_ARGS).all() <NEW_LINE> self....
Parent class for testing the CountReleases function By subclassing it and overriding ARGS, we can test different combinations of arguments with the same test code. INCLUSIVE_ARGS represents a set of arguments that will match the releases created (see the functions in OrloQueryTest for what those are) EXCLUSIVE_ARGS r...
62598f87d10714528d69d9d4
class DifferentiableBinomialModel(BinomialModel, DifferentiableModel): <NEW_LINE> <INDENT> def __init__(self, underlying_model): <NEW_LINE> <INDENT> if not isinstance(underlying_model, DifferentiableModel): <NEW_LINE> <INDENT> raise TypeError("Decorated model must also be differentiable.") <NEW_LINE> <DEDENT> BinomialM...
Extends :class:`BinomialModel` to take advantage of differentiable two-outcome models.
62598f8707f4c71912baef48
class CMFConfigParser(ConfigParser): <NEW_LINE> <INDENT> OPTCRE = re.compile( r'(?P<option>[]\-[ \w_.*,(){}]+)' r'[ \t]*(?P<vi>[:=])[ \t]*' r'(?P<value>.*)$' ) <NEW_LINE> def optionxform(self, optionstr): <NEW_LINE> <INDENT> return optionstr.strip()
This our wrapper around ConfigParser to solve a few minor niggles with the code
62598f87e76e3b2f99fd853b
class AdaptableHeapPriorityQueue(HeapPriorityQueue): <NEW_LINE> <INDENT> class Locator(HeapPriorityQueue._Item): <NEW_LINE> <INDENT> __slots__ = "_index" <NEW_LINE> def __init__(self, k, v, j): <NEW_LINE> <INDENT> super().__init__(k, v) <NEW_LINE> self._index = j <NEW_LINE> <DEDENT> <DEDENT> def _swap(self, i, j): <NEW...
A locator-based priority queue implemented with a binary heap. Effort to make better support for Locator is under way.
62598f87d53ae8145f917f94
class Config(object): <NEW_LINE> <INDENT> SECRET_KEY = '876587326432uyrhietweryoi' <NEW_LINE> SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(base_dir, 'ndoo.db')
Defined database using Sqlite
62598f87d6c5a102081e1c4f
class DbModelMixin(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.mocked_session = None <NEW_LINE> <DEDENT> def set_up_mocks(self): <NEW_LINE> <INDENT> self.mocked_session = mock.Mock() <NEW_LINE> get_session = mock.patch('apicapi.tests.db.api.get_session').start() <NEW_LINE> get_session.retu...
Mock the DB models for the APIC driver and service unit tests.
62598f87287bf620b62716ba
class PullRequestMeta(object): <NEW_LINE> <INDENT> swagger_types = { 'merged': 'bool', 'merged_at': 'datetime' } <NEW_LINE> attribute_map = { 'merged': 'merged', 'merged_at': 'merged_at' } <NEW_LINE> def __init__(self, merged=None, merged_at=None): <NEW_LINE> <INDENT> self._merged = None <NEW_LINE> self._merged_at = No...
NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
62598f87435de62698e9b8fe
@attr.s <NEW_LINE> class CreatedInstance(object): <NEW_LINE> <INDENT> path = attr.ib(type=Text) <NEW_LINE> type = attr.ib(type=InstanceType) <NEW_LINE> def ToDict(self): <NEW_LINE> <INDENT> return {'path': self.path, 'type': self.type.value}
Stores the path and type of the DICOM instance created. Attributes: path: The instance path. type: Type of the created DICOM object.
62598f8730dc7b766599f35d
class ProductSerializer(serializers.HyperlinkedModelSerializer): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = ProductModel <NEW_LINE> url = serializers.HyperlinkedIdentityField( view_name='product', lookup_field='id' ) <NEW_LINE> fields = ('id', 'title', 'customer_id', 'customer', 'price', 'description',...
JSON serializer for Product Arguments: serializers
62598f8738b623060ffa8b9b
class Agent: <NEW_LINE> <INDENT> def __init__(self, api_result): <NEW_LINE> <INDENT> self._enlid = api_result["enlid"] <NEW_LINE> self._agent = api_result["agent"] <NEW_LINE> self._vlevel = api_result["vlevel"] <NEW_LINE> self._vpoints = api_result["vpoints"] <NEW_LINE> self._verified = api_result["verified"] <NEW_LINE...
Basic agent data. It's ok to make this public, I think.
62598f8750485f2cf55daa79
class Bib66x(db.Model): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> __tablename__ = 'bib66x' <NEW_LINE> id = db.Column(db.MediumInteger(8, unsigned=True), primary_key=True, autoincrement=True) <NEW_LINE> tag = db.Column(db.String(6), nullable=False, index=True, server_default=''...
Represents a Bib66x record.
62598f870a366e3fb87dc4d4
class User(models.Model): <NEW_LINE> <INDENT> gender = ( ('male', '男'), ('female', '女'), ) <NEW_LINE> codename = models.CharField(max_length=128, unique=True, default='2016') <NEW_LINE> nickname = models.CharField(max_length=128, unique=False) <NEW_LINE> password = models.CharField(max_length=256) <NEW_LINE> email = mo...
用户表
62598f87b57a9660fecd1582
class DataPool(object): <NEW_LINE> <INDENT> def __init__(self, **datafile): <NEW_LINE> <INDENT> self.default = { "duration" : "call_duration_g01.txt", "arrival": "call_arrival_g01.txt", "speed": "car_speed_g01.txt" } <NEW_LINE> self.default.update(datafile) <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def read_input_fi...
Generate test dataset from supplied data for network simulation
62598f87596a897236127778
class MPLinear(torch.nn.Module): <NEW_LINE> <INDENT> def __init__(self, input_size, output_size, factor_size): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.factor_size = factor_size <NEW_LINE> self.input_size = input_size <NEW_LINE> self.output_size = output_size <NEW_LINE> self.shared_weight = torch.nn.Param...
A linear layer with partitioned weights
62598f870383005118f6d200
class TestCompound(BaseDataset): <NEW_LINE> <INDENT> def test_rt(self): <NEW_LINE> <INDENT> dt = np.dtype([ ('weight', np.float64), ('cputime', np.float64), ('walltime', np.float64), ('parents_offset', np.uint32), ('n_parents', np.uint32), ('status', np.uint8), ('endpoint_type', np.uint8), ]) <NEW_LINE> testdata = np.n...
Feature: Compound types correctly round-trip
62598f87a05bb46b3848a37f
class Cifar10MLDataset(MetricLearningTrainDataset, CIFAR10): <NEW_LINE> <INDENT> _split = 5 <NEW_LINE> classes = [ "0 - airplane", "1 - automobile", "2 - bird", "3 - cat", "4 - deer", ] <NEW_LINE> def __init__(self, **kwargs): <NEW_LINE> <INDENT> if "train" in kwargs: <NEW_LINE> <INDENT> if kwargs["train"] is False: <N...
Simple wrapper for CIFAR10 dataset for metric learning train stage. This dataset can be used only for training. For test stage use CIFAR10QGDataset. For this dataset we use only training part of the CIFAR10 and only those images that are labeled as 'airplane', 'automobile', 'bird', 'cat' and 'deer'
62598f87f8510a7c17d7def9
class Type(dd.BabelNamed): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> verbose_name = _("Household Type") <NEW_LINE> verbose_name_plural = _("Household Types")
Type of a household. http://www.belgium.be/fr/famille/couple/cohabitation/
62598f8782261d6c5272fc57
class nvs06: <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def evaluate(cls, x): <NEW_LINE> <INDENT> assert(len(x)==2) <NEW_LINE> value = (0.1*((x[0])**2 + (1 + (x[1])**2)/(x[0])**2 + (100 + ((x[0])**2)*(x[1])**2)/(x[0]*x[1])**4) + 1.2) <NEW_LINE> return(value) <NEW_LINE> <DEDENT> dimension = 2 <NEW_LINE> var_lower = np....
nvs06 function of the MINLPLib test set.
62598f878a349b6b43685d4a
class Meta: <NEW_LINE> <INDENT> model = PhoneNumber <NEW_LINE> fields = ('id', 'phone_number',) <NEW_LINE> list_serializer_class = CustomListSerializer
Meta class to map serializer's fields with model fields.
62598f87d10714528d69d9d6
class Conditional: <NEW_LINE> <INDENT> _when = FieldAttribute(isa='list', default=[]) <NEW_LINE> def __init__(self, loader=None): <NEW_LINE> <INDENT> if not hasattr(self, '_loader'): <NEW_LINE> <INDENT> if loader is None: <NEW_LINE> <INDENT> raise AnsibleError("a loader must be specified when using Conditional() direct...
This is a mix-in class, to be used with Base to allow the object to be run conditionally when a condition is met or skipped.
62598f8707f4c71912baef49
class TestCounter(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self._short_text = 'aaaa, bbbb' <NEW_LINE> self._short_file = StringIO(self._short_text) <NEW_LINE> self._words = ['aaaa', 'bbbb'] <NEW_LINE> self._result = [('ab', 3), ('ac', 2), ('b', 4), ('c', 1)] <NEW_LINE> self._output_f...
Test for counter
62598f87a8ecb03325870d06
class FixtureRegistry(object): <NEW_LINE> <INDENT> __SPLIT_SUFFIX = '__split' <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> path = os.path.dirname(os.path.abspath(__file__)) <NEW_LINE> items = {} <NEW_LINE> for fixture in glob(os.path.join(path, 'fixtures', '*')): <NEW_LINE> <INDENT> name, _ = os.path.splitext(os....
Fixtures holder for easier access in tests Note it would return bytes in cp1251 as any reply from finam.ru export tool would do
62598f87d53ae8145f917f95
class FilesList(object): <NEW_LINE> <INDENT> swagger_types = { 'value': 'list[StorageFile]' } <NEW_LINE> attribute_map = { 'value': 'Value' } <NEW_LINE> def __init__(self, value=None): <NEW_LINE> <INDENT> super(FilesList, self).__init__() <NEW_LINE> self._value = None <NEW_LINE> if value is not None: <NEW_LINE> <INDENT...
Files list
62598f87e64d504609df9134
class MyRegressor(nn.Module): <NEW_LINE> <INDENT> def __init__(self, num_units=10, nonlin=F.relu): <NEW_LINE> <INDENT> super(MyRegressor, self).__init__() <NEW_LINE> self.dense0 = nn.Linear(20, num_units) <NEW_LINE> self.nonlin = nonlin <NEW_LINE> self.dropout = nn.Dropout(0.5) <NEW_LINE> self.dense1 = nn.Linear(num_un...
Simple regression module.
62598f871f5feb6acb162738
class MrvL3DeviceMap(SnmpPlugin): <NEW_LINE> <INDENT> maptype = "MrvL3DeviceMap" <NEW_LINE> snmpGetMap = GetMap({ '.1.3.6.1.4.1.629.6.10.75.1.1.5.1.0' : 'setHWProductKey', '.1.3.6.1.4.1.629.6.10.75.1.1.3.1.10.1' : 'setHWSerialNumber', '.1.3.6.1.4.1.629.6.10.75.1.1.3.1.6.1': 'setOSProductKey', }) <NEW_LINE> def process(...
Map mib elements from Mrv switch mib to get hw and os products.
62598f87097d151d1a2c0b2b
@attr.s(cmp=False) <NEW_LINE> class BindingMixin: <NEW_LINE> <INDENT> bindings = {} <NEW_LINE> target = attr.ib() <NEW_LINE> name = attr.ib( validator=attr.validators.optional(attr.validators.instance_of(str))) <NEW_LINE> state = attr.ib(default=BindingState.idle, init=False) <NEW_LINE> def __attrs_post_init__(self): <...
Handles the binding and activation of drivers and their supplying resources and drivers. One client can be bound to many suppliers, and one supplier can be bound by many clients. Conflicting access to one supplier can be avoided by deactivating conflicting clients before activation (using the resolve_conflicts callba...
62598f87596a897236127779
class EntityDelete(AuthMixin, generic.DeleteView): <NEW_LINE> <INDENT> def dispatch(self, request, *args, **kwargs): <NEW_LINE> <INDENT> self.model = get_model(**kwargs) <NEW_LINE> instance = get_model_instance(**kwargs) <NEW_LINE> app_title = get_app_name(**kwargs) <NEW_LINE> self.success_url = reverse_lazy( 'index', ...
Generic view for Delete operation
62598f8750485f2cf55daa7a
class TweetUpdateThread(threading.Thread): <NEW_LINE> <INDENT> def __init__(self, cli_object, function, waittime): <NEW_LINE> <INDENT> threading.Thread.__init__(self) <NEW_LINE> self.waittime = waittime <NEW_LINE> self.cli = cli_object <NEW_LINE> self.function = function <NEW_LINE> self.endme = False <NEW_LINE> self.co...
thread class to fetch tweets in the background
62598f87b830903b9686e1f5
class CreateUserRequest(proto.Message): <NEW_LINE> <INDENT> user = proto.Field(proto.MESSAGE, number=1, message=User, )
The request message for the google.showcase.v1beta1.Identity\CreateUser method. Attributes: user (~.identity.User): The user to create.
62598f8773bcbd0ca4bc9d59
class SearchCell(nn.Module): <NEW_LINE> <INDENT> def __init__(self, n_nodes, C_pp, C_p, C, reduction_p, reduction, primitives): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.reduction = reduction <NEW_LINE> self.n_nodes = n_nodes <NEW_LINE> if reduction_p: <NEW_LINE> <INDENT> self.preproc0 = ops.FactorizedRedu...
Cell for search Each edge is mixed and continuous relaxed.
62598f87ec188e330fdf83a5
class Player: <NEW_LINE> <INDENT> def __init__(self, name, prof, maxhp, level, attack, defense = 5): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.life = 1 <NEW_LINE> self.attack = attack <NEW_LINE> self.defense = defense <NEW_LINE> self.hp = 100 <NEW_LINE> self.xp = 0 <NEW_LINE> <DEDENT> def level_up(self, leve...
You are the player
62598f870a50d4780f704edf
class SplashMiddleware(object): <NEW_LINE> <INDENT> def process_request(self, request): <NEW_LINE> <INDENT> config = SplashConfig.current() <NEW_LINE> if not config.enabled: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if request.path_info in config.unaffected_url_paths_list: <NEW_LINE> <INDENT> return <NEW_LINE> <DE...
Checks incoming requests, to redirect users to a configured splash screen URL if they don't have the proper cookie set This can be used to display a small marketing landing page, protect an alpha website from the public eye, make an announcement, etc.
62598f878e05c05ec3f6ebcb
class DataLoader(object): <NEW_LINE> <INDENT> def __init__(self, dataset, batch_size=1, shuffle=False, sampler=None, batch_sampler=None, num_workers=0, collate_fn=default_collate, pin_memory=False, drop_last=False, timeout=0): <NEW_LINE> <INDENT> self.dataset = dataset <NEW_LINE> self.batch_size = batch_size <NEW_LINE>...
Data loader. Combines a dataset and a sampler, and provides single- or multi-process iterators over the dataset. Arguments: dataset (Dataset): dataset from which to load the data. batch_size (int, optional): how many samples per batch to load (default: 1). shuffle (bool, optional): set to ``True`` ...
62598f87fbf16365ca793bb2
class ReactionSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> user = UserSerializer(many=False) <NEW_LINE> created = DateTimeSerializer(many=False) <NEW_LINE> class Meta: <NEW_LINE> <INDENT> model = ReactionModel <NEW_LINE> fields = ('user', 'reaction_id', 'reaction', 'created')
get data to be changed, fields that are not being changed should be blank. field being changed to blank should be null
62598f87a4f1c619b294e0f4
class JSONPointerSyntaxError(JSONPointerError): <NEW_LINE> <INDENT> pass
Syntax error in a JSON Pointer path.
62598f87a17c0f6771d5bd49
class MaisonTourismeSearch(RelationAwareSearch): <NEW_LINE> <INDENT> implements(ITableSearch) <NEW_LINE> searchableFields = ['Commune', 'Nom'] <NEW_LINE> searchFieldMapper = {'Nom': 'mais_nom', 'Commune': 'commune.com_nom'} <NEW_LINE> def __init__(self, context): <NEW_LINE> <INDENT> self.context = context
Searching into the MaisonTourisme
62598f87f8510a7c17d7defa
class DefaultRegisterUserSerializer( PasswordConfirmSerializerMixin, serializers.ModelSerializer): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> user_class = get_user_model() <NEW_LINE> field_names = get_user_public_field_names(write_once=True) <NEW_LINE> read_only_field_names = get_user_...
Default serializer used for user registration. It will use these: * User fields * :ref:`user-hidden-fields-setting` setting * :ref:`user-public-fields-setting` setting to automagically generate the required serializer fields.
62598f878a43f66fc4bf1c89