code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
class BaseMasker(BaseEstimator, TransformerMixin, CacheMixin): <NEW_LINE> <INDENT> @abc.abstractmethod <NEW_LINE> def transform_single_imgs(self, imgs, confounds=None, copy=True): <NEW_LINE> <INDENT> raise NotImplementedError() <NEW_LINE> <DEDENT> def transform(self, imgs, confounds=None): <NEW_LINE> <INDENT> self._che...
Base class for NiftiMaskers
6259903c26238365f5fadd58
class SimpleDroneSpout(Spout): <NEW_LINE> <INDENT> outputs = ['uid', 'dronetime', 'region', 'altitude', 'latitude', 'longitude'] <NEW_LINE> def initialize(self, stormconf, context): <NEW_LINE> <INDENT> with open("/opt/internal.json") as f: <NEW_LINE> <INDENT> config = json.load(f) <NEW_LINE> <DEDENT> self.internal_conf...
A Storm spout that receives messages from a Kafka broker, sends them for proximity monitoring, and records its actions. Tip: The configuration file, internal.json (see config/internal.json.example) must be present in the root of this repository
6259903c26068e7796d4db49
class ListCollectionsResponse(): <NEW_LINE> <INDENT> def __init__(self, *, collections=None): <NEW_LINE> <INDENT> self.collections = collections <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def _from_dict(cls, _dict): <NEW_LINE> <INDENT> args = {} <NEW_LINE> valid_keys = ['collections'] <NEW_LINE> bad_keys = set(_dict.k...
Response object containing an array of collection details. :attr list[Collection] collections: (optional) An array containing information about each collection in the project.
6259903cb5575c28eb7135ca
class BaseInboxView(OrgPermsMixin, SmartTemplateView): <NEW_LINE> <INDENT> title = None <NEW_LINE> folder = None <NEW_LINE> folder_icon = None <NEW_LINE> template_name = None <NEW_LINE> permission = "orgs.org_inbox" <NEW_LINE> def get_context_data(self, **kwargs): <NEW_LINE> <INDENT> context = super(BaseInboxView, self...
Mixin to add site metadata to the context in JSON format which can then used
6259903c3c8af77a43b6883d
class FacebookBackend(_OAuthBackend): <NEW_LINE> <INDENT> DEFAULT_GRAPH_ENDPOINT = "https://graph.facebook.com/v2.5/me" <NEW_LINE> def __init__(self, outgoing, internal_attributes, config, base_url, name): <NEW_LINE> <INDENT> config.setdefault("response_type", "code") <NEW_LINE> config["verify_accesstoken_state"] = Fal...
Backend module for facebook.
6259903c15baa72349463193
class ModelTrainingParams(base_orm.BaseORM): <NEW_LINE> <INDENT> DB_FIELDS = OrderedDict( [ ("model_hash", str), ("label_rows", list), ("epochs", int), ("batch_size", int), ("weights", ModelTrainingWeights), ("device", str), ] )
Model training parameters. ORM: model_hash, label_rows, epochs, batch_size, weights, device
6259903c287bf620b6272ded
class UsersViewSet(viewsets.ModelViewSet): <NEW_LINE> <INDENT> queryset = User.objects.all().order_by('-date_joined') <NEW_LINE> serializer_class = UserSerializer
API endpoint that allows users to be viewed or edited.
6259903cd4950a0f3b111741
class NiceOD(OrderedDict): <NEW_LINE> <INDENT> def __repr__(self): <NEW_LINE> <INDENT> return dict.__repr__(self) <NEW_LINE> <DEDENT> def __hash__(self): <NEW_LINE> <INDENT> return hash(str(self))
A nice ordered dict. aka hashable and prints like a dict.
6259903c287bf620b6272dee
class Suffix_Feature_Template(Feature_Template): <NEW_LINE> <INDENT> def __init__(self,s): <NEW_LINE> <INDENT> assert(s > 0), "Suffix length must be a positive integer greater than 0" <NEW_LINE> Feature_Template.__init__(self) <NEW_LINE> self.s = s <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return str(s...
A Suffix_Feature_Template class This class extends Feature_Template and provides the necessary functionality to compare n length suffices with the contextual tag. For example: Sentence = [The quick brown fox jumped over the lazy dog] Context = [5, (VERB)] Suffix_Feature_Template(2)'s dictionary would consist of a ma...
6259903c21a7993f00c67171
class ComplexNode(SingleValueTreeNodeObject): <NEW_LINE> <INDENT> pass
A tree node for complex number values.
6259903c507cdc57c63a5f9d
class UserCenterPageTestCase(BaseTestCase): <NEW_LINE> <INDENT> def test_add_addr(self): <NEW_LINE> <INDENT> file_name = DATA_PATH + r'\data_login.csv' <NEW_LINE> data = ReadCsv().read_login_data(file_name) <NEW_LINE> username = data[-1][0] <NEW_LINE> password = data[-1][1] <NEW_LINE> login = LoginPage(self.driver) <NE...
用户中心用例类
6259903c1f5feb6acb163df6
class TagHMM(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.train, self.test = self.split_sents() <NEW_LINE> self.hmm = HMM() <NEW_LINE> self.hmm.train(self.train) <NEW_LINE> <DEDENT> def split_sents(self, train=0.95, total=3500, document_class=TaggedSentence): <NEW_LINE> <INDENT> sents = tagg...
Train and test an HMM POS tagger.
6259903cd53ae8145f919669
class Message(JSONSerializable): <NEW_LINE> <INDENT> def __init__(self, mtype, data): <NEW_LINE> <INDENT> self.timestamp = utcts(datetime.datetime.utcnow()) <NEW_LINE> self.mtype = mtype <NEW_LINE> self.data = data <NEW_LINE> self.checksum = double_sha256(data)
A Message is a container for messages sent within the P2P network.
6259903c15baa72349463194
class InlineResponse2007(object): <NEW_LINE> <INDENT> swagger_types = { 'payload': 'AnimalType', 'meta': 'ResponseMeta' } <NEW_LINE> if hasattr(getResponse(), "swagger_types"): <NEW_LINE> <INDENT> swagger_types.update(getResponse().swagger_types) <NEW_LINE> <DEDENT> attribute_map = { 'payload': 'payload', 'meta': 'meta...
NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
6259903c73bcbd0ca4bcb48d
class MyghtyJavascriptLexer(DelegatingLexer): <NEW_LINE> <INDENT> name = 'JavaScript+Myghty' <NEW_LINE> aliases = ['javascript+myghty', 'js+myghty'] <NEW_LINE> mimetypes = ['application/x-javascript+myghty', 'text/x-javascript+myghty', 'text/javascript+mygthy'] <NEW_LINE> def __init__(self, **options): <NEW_LINE> <INDE...
Subclass of the `MyghtyLexer` that highlights unlexed data with the `JavascriptLexer`. .. versionadded:: 0.6
6259903cbaa26c4b54d504ac
class DummyProfileFactory(factory.DjangoModelFactory): <NEW_LINE> <INDENT> FACTORY_FOR = DummyProfile <NEW_LINE> user = factory.SubFactory(UserFactory) <NEW_LINE> dummy_field = factory.Sequence(lambda n: 'dummyfield{}'.format(n))
Factory for the ``DummyProfile`` model.
6259903c94891a1f408b9ff9
class Error(Exception): <NEW_LINE> <INDENT> pass
Base class for exceptionsin this module.
6259903c6e29344779b01856
class TestTelephonyOutgoingHangupAlerting(TestCase, TelephonyTestCommon): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.addCleanup(self.clean_up) <NEW_LINE> super(TestTelephonyOutgoingHangupAlerting, self).setUp() <NEW_LINE> self.wait_for_obj("window.navigator.mozTelephony") <NEW_LINE> self.disable_dial...
This is a test for the `WebTelephony API`_ which will: - Disable the default gaia dialer, so that the test app can handle calls - Ask the test user to specify a destination phone number for the test call - Setup mozTelephonyCall event listeners for the outgoing call - Use the API to initiate the outgoing call - Hang u...
6259903c26068e7796d4db4b
class AnalysisReasons(CheckForm): <NEW_LINE> <INDENT> comprehensive_2 = BooleanField(lazy_gettext('I value it for comprehending the experiment')) <NEW_LINE> reproducibility_2 = BooleanField(lazy_gettext('I value it for reproducing the experiment')) <NEW_LINE> no_time_1 = BooleanField(lazy_gettext('I value it, but I do ...
Q12/A2
6259903cd4950a0f3b111742
class PokemonForm(TableBase): <NEW_LINE> <INDENT> __tablename__ = 'pokemon_forms' <NEW_LINE> __singlename__ = 'pokemon_form' <NEW_LINE> id = Column(Integer, primary_key=True, nullable=False, info=dict(description=u'A unique ID for this form.')) <NEW_LINE> form_identifier = Column(Unicode(16), nullable=True, info=dict(d...
An individual form of a Pokémon. This includes *every* variant (except color differences) of every Pokémon, regardless of how the games treat them. Even Pokémon with no alternate forms have one row in this table, to represent their lone "normal" form.
6259903c8e05c05ec3f6f75d
class PlayerCreateForm(FlaskForm): <NEW_LINE> <INDENT> first_name = StringField('first_name', validators=[DataRequired()]) <NEW_LINE> last_name = StringField('last_name', validators=[DataRequired()]) <NEW_LINE> aga_id = IntegerField( 'aga_id', validators=[NumberRange(0, 50000)]) <NEW_LINE> aga_rank = IntegerField( 'aga...
Player creation form.
6259903c21a7993f00c67173
@base.ReleaseTracks(base.ReleaseTrack.ALPHA) <NEW_LINE> class Source(base.Group): <NEW_LINE> <INDENT> def Filter(self, context, args): <NEW_LINE> <INDENT> resources.SetParamDefault( api='source', collection=None, param='projectId', resolver=resolvers.FromProperty(properties.VALUES.core.project)) <NEW_LINE> source.Sourc...
Cloud git repository commands.
6259903cb57a9660fecd2c80
class Size(Shape): <NEW_LINE> <INDENT> def __new__(cls: Type[Size], width: Real = 0, height: Real = 0) -> Size: <NEW_LINE> <INDENT> return super().__new__(cls, (width, height)) <NEW_LINE> <DEDENT> def __add__(self, other: Union[Size, Real]) -> Union[Size, Real]: <NEW_LINE> <INDENT> if isinstance(other, Size): <NEW_LINE...
Base class for defining a 2D area. Supports floor division.
6259903cbe383301e0254a1c
class SocketOptionsAdapter(adapters.HTTPAdapter): <NEW_LINE> <INDENT> if connection is not None: <NEW_LINE> <INDENT> default_options = getattr( connection.HTTPConnection, 'default_socket_options', [(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)] ) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> default_options = [] <NEW_LIN...
An adapter for requests that allows users to specify socket options. Since version 2.4.0 of requests, it is possible to specify a custom list of socket options that need to be set before establishing the connection. Example usage:: >>> import socket >>> import requests >>> from requests_toolbelt.adapters...
6259903c07d97122c4217ea3
class Sketch(object): <NEW_LINE> <INDENT> def __init__(self, source): <NEW_LINE> <INDENT> if isinstance(source, Tilt): <NEW_LINE> <INDENT> with source.subfile_reader('data.sketch') as inf: <NEW_LINE> <INDENT> self.filename = None <NEW_LINE> self._parse(binfile(inf)) <NEW_LINE> <DEDENT> <DEDENT> elif hasattr(source, 're...
Stroke data from a .tilt file. Attributes: .strokes List of tilt.Stroke instances .filename Filename if loaded from file, but usually None .header Opaque header data
6259903cd53ae8145f91966b
class TestCiscoIPsecDriver(testlib_api.SqlTestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super(TestCiscoIPsecDriver, self).setUp() <NEW_LINE> mock.patch('neutron.common.rpc.create_connection').start() <NEW_LINE> service_plugin = mock.Mock() <NEW_LINE> service_plugin._get_vpnservice.return_value = {...
Test that various incoming requests are sent to device driver.
6259903c004d5f362081f8e7
class HistoryPreprocessor(Preprocessor): <NEW_LINE> <INDENT> def __init__(self, history_length=1): <NEW_LINE> <INDENT> self.history_length = history_length <NEW_LINE> self.past_states = None <NEW_LINE> self.past_states_ori = None <NEW_LINE> <DEDENT> def process_state_for_network(self, state): <NEW_LINE> <INDENT> row, c...
Keeps the last k states. Useful for domains where you need velocities, but the state contains only positions. When the environment starts, this will just fill the initial sequence values with zeros k times. Parameters ---------- history_length: int Number of previous states to prepend to state being processed.
6259903ca4f1c619b294f78a
class EnvironmentModules(Package): <NEW_LINE> <INDENT> homepage = "https://sourceforge.net/p/modules/wiki/Home/" <NEW_LINE> url = "http://prdownloads.sourceforge.net/modules/modules-3.2.10.tar.gz" <NEW_LINE> version('3.2.10', '8b097fdcb90c514d7540bb55a3cb90fb') <NEW_LINE> depends_on('tcl', type=('build', 'link', 'run')...
The Environment Modules package provides for the dynamic modification of a user's environment via modulefiles.
6259903c16aa5153ce4016f3
class Reviews(BaseAbstractModel): <NEW_LINE> <INDENT> profile=models.ForeignKey(to='Auth.Profile', on_delete=models.DO_NOTHING, null=True,related_name='reviews') <NEW_LINE> rating = models.IntegerField(blank=True, null=True) <NEW_LINE> reviews= models.CharField(max_length=255, blank=True, null=True) <NEW_LINE> def __st...
This is model for both user and job reviews
6259903cc432627299fa41ff
class ForumTrack(models.Model): <NEW_LINE> <INDENT> id = models.PositiveIntegerField(primary_key=True, db_column="user_id", default=0, help_text="primary key" ) <NEW_LINE> id = models.PositiveIntegerField(primary_key=True, db_column="forum_id", default=0, help_text="primary key" ) <NEW_LINE> mark_time = models.Positive...
Unread post information is stored here
6259903c26238365f5fadd5c
class PoswiseFeedForwardNet(nn.Module): <NEW_LINE> <INDENT> def __init__(self, config): <NEW_LINE> <INDENT> super(PoswiseFeedForwardNet, self).__init__() <NEW_LINE> self.w_1 = nn.Conv1d(config['d_model'], config['d_ff'], kernel_size=1) <NEW_LINE> self.w_2 = nn.Conv1d(config['d_ff'], config['d_model'], kernel_size=1) <N...
two feed forward layers
6259903c07d97122c4217ea4
class UserSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = get_user_model() <NEW_LINE> fields = ('email', 'password', 'name') <NEW_LINE> extra_kwargs = {'password': {'write_only': True, 'min_length': 5}} <NEW_LINE> <DEDENT> def create(self, validated_data): <NEW_LINE>...
Serializers for the users object.
6259903c96565a6dacd2d88e
class App(object): <NEW_LINE> <INDENT> def __init__( self, appName, shortcut='<Control><Q>', a11yAppName=None, forceKill=True, parameters='', recordVideo=False): <NEW_LINE> <INDENT> self.appCommand = appName <NEW_LINE> self.shortcut = shortcut <NEW_LINE> self.forceKill = forceKill <NEW_LINE> self.parameters = parameter...
This class does all basic events with the app
6259903c63f4b57ef0086677
class ObjectiveFunction(object): <NEW_LINE> <INDENT> def __call__(self, theta): <NEW_LINE> <INDENT> return self.evaluate(theta) <NEW_LINE> <DEDENT> @abstractmethod <NEW_LINE> def evaluate(self, theta): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def fit(self, x0, optimizer='gd', n=1000, xtol=1e-6, ftol=1e-9): <NEW_LIN...
An abstract class for a generic objective function.
6259903c1f5feb6acb163df9
class Spindle(object): <NEW_LINE> <INDENT> CW = -1 <NEW_LINE> CCW = 1 <NEW_LINE> def __init__(self, speed=1.0): <NEW_LINE> <INDENT> self.speed = speed <NEW_LINE> self.running = False <NEW_LINE> <DEDENT> def rotate(self, direction, speed=None): <NEW_LINE> <INDENT> if speed is None: <NEW_LINE> <INDENT> speed = self.speed...
Abstract Class for Spindle Spindle can rotate clockwise or counterclockwise in given Speed
6259903c004d5f362081f8e8
class fib(object): <NEW_LINE> <INDENT> def __init__(self, n=20): <NEW_LINE> <INDENT> self.a = 0 <NEW_LINE> self.b = 1 <NEW_LINE> self.n = n <NEW_LINE> <DEDENT> def __iter__(self): <NEW_LINE> <INDENT> return self <NEW_LINE> <DEDENT> def __next__(self): <NEW_LINE> <INDENT> self.a, self.b = self.b, self.a + self.b <NEW_LI...
docstring for fib
6259903c1d351010ab8f4d23
class InnerModel(BaseModel): <NEW_LINE> <INDENT> inner_int_field = IntegerField() <NEW_LINE> inner_str_field = StringField()
Inner model.
6259903c30c21e258be99a13
class EndProgramException(LarvException): <NEW_LINE> <INDENT> pass
To be called by World when there aren't any more Engines in the stack.
6259903c91af0d3eaad3b03c
class CUHK_PEDES(Dataset): <NEW_LINE> <INDENT> def __init__(self, conf, dataset, is_train=False, image_caption='image'): <NEW_LINE> <INDENT> self.split = dataset[0]["split"] <NEW_LINE> self.image_caption = image_caption <NEW_LINE> self.dataset = dataset <NEW_LINE> self.config = conf <NEW_LINE> self.positive_samples = c...
the class for CUHK_PEDES dataset Attributes:
6259903c26238365f5fadd5e
class Unit(models.Model): <NEW_LINE> <INDENT> name = models.CharField(max_length=30, unique=True) <NEW_LINE> def __repr__(self): <NEW_LINE> <INDENT> return 'Unit(name=%r)' % self.name <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return self.name
A unit used on a data point, such as "ug/m3", or "kWh"
6259903cec188e330fdf9aa1
class SecurityGovernanceItem(Model): <NEW_LINE> <INDENT> S1 = "s1" <NEW_LINE> S2 = "s2" <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> self.swagger_types = { } <NEW_LINE> self.attribute_map = { } <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def from_dict(cls, dikt) -> 'SecurityGovernanceItem': <NEW_LINE> <INDENT> re...
NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
6259903c71ff763f4b5e89a5
class TLSError(Exception): <NEW_LINE> <INDENT> def __str__(self): <NEW_LINE> <INDENT> return repr(self)
Base class for all TLS Lite exceptions.
6259903c63f4b57ef0086678
class MutableCoordinate(_Coordinate): <NEW_LINE> <INDENT> def __init__(self, coord): <NEW_LINE> <INDENT> super().__init__(coord) <NEW_LINE> <DEDENT> def bring_within(self, lat): <NEW_LINE> <INDENT> self.coord = _xtal.bring_within_lattice(self.coord, lat) <NEW_LINE> return <NEW_LINE> <DEDENT> def __iadd__(self, other): ...
Mutable Coordinate class. Defined as the Cartesian coodrinates, can handle opperations related to lattice periodicity.
6259903c596a897236128ea8
class FdMsInterface(CommandLineArguments): <NEW_LINE> <INDENT> EXEC_PATH = os.path.join(_base_dir_, "matching_stats.x") <NEW_LINE> params = OrderedDict([ CommonArgumentSpecs.s_path, CommonArgumentSpecs.t_path, CommonArgumentSpecs.out_path, ('double_rank', (False, bool, False, "Use double instead of single rank.")), ('r...
Interface to the fd_ms binary
6259903c8c3a8732951f7760
class ProductionConfig(Config): <NEW_LINE> <INDENT> SQLALCHEMY_DATABASE_URI = 'sqlite:///'+os.path.join(basedir,'data/data.sqlite')
正式环境配置
6259903cb57a9660fecd2c84
class BingoCage: <NEW_LINE> <INDENT> def __init__(self, items): <NEW_LINE> <INDENT> self._items = list(items) <NEW_LINE> random.shuffle(self._items) <NEW_LINE> <DEDENT> def pick(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return self._items.pop() <NEW_LINE> <DEDENT> except IndexError: <NEW_LINE> <INDENT> raise ...
a callable demo
6259903c21a7993f00c67177
class MostFrequentVisitor(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.visitors = {} <NEW_LINE> self.most_frequent_visitor = None <NEW_LINE> <DEDENT> def process(self, matches): <NEW_LINE> <INDENT> visitor = matches['ip'] <NEW_LINE> if visitor not in self.visitors: <NEW_LINE> <INDENT> self....
Processor to find the most frequent visitor based on IP address from a log file
6259903c63b5f9789fe86375
class QuietServerHandler(ServerHandler): <NEW_LINE> <INDENT> def log_exception(self, exc_info): <NEW_LINE> <INDENT> import errno <NEW_LINE> if exc_info[1].args[0] == errno.EPIPE: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> ServerHandler.log_exception(self, exc_info)
Used to suppress tracebacks of broken pipes.
6259903c0a366e3fb87ddbee
class Command(BaseCommand): <NEW_LINE> <INDENT> help = "Run the queue consumer" <NEW_LINE> option_list = BaseCommand.option_list + ( make_option('--periodic', '-p', dest='periodic', action='store_true', help='Enqueue periodic commands' ), make_option('--no-periodic', '-n', dest='periodic', action='store_false', help='D...
Queue consumer. Example usage:: To start the consumer (note you must export the settings module): django-admin.py run_huey
6259903cd53ae8145f91966f
class chain(Command): <NEW_LINE> <INDENT> def execute(self): <NEW_LINE> <INDENT> for command in self.rest(1).split(";"): <NEW_LINE> <INDENT> self.fm.execute_console(command)
:chain <command1>; <command2>; ... Calls multiple commands at once, separated by semicolons.
6259903cd10714528d69ef90
class PreSurvey(models.Model): <NEW_LINE> <INDENT> student_id = models.IntegerField(default=0) <NEW_LINE> fill_time = models.DateTimeField(auto_now_add=True) <NEW_LINE> p = models.IntegerField(default=0) <NEW_LINE> p_t = models.TextField() <NEW_LINE> p1 = models.IntegerField(default=0) <NEW_LINE> p2 = models.IntegerFie...
student_id: 學生id
6259903c1d351010ab8f4d25
class UaiWriter(): <NEW_LINE> <INDENT> def write_model(self, model: GenericGraphModel, path: str): <NEW_LINE> <INDENT> assert path.endswith('.uai') <NEW_LINE> with open(path, 'w') as f: <NEW_LINE> <INDENT> f.write('MARKOV\n') <NEW_LINE> f.write(str(model.num_variables) + '\n') <NEW_LINE> for var_id in range(model.num_v...
Writes Graphical Model in UAI format.
6259903c6fece00bbacccbb7
class TestPostSQLClass(SQLTestCase): <NEW_LINE> <INDENT> sql_dir = 'sql/' <NEW_LINE> ans_dir = 'expected/' <NEW_LINE> out_dir = 'output/'
@gucs gp_create_table_random_default_distribution=off
6259903c76d4e153a661db78
class LinodeTest(CloudTest): <NEW_LINE> <INDENT> PROVIDER = 'linode' <NEW_LINE> REQUIRED_PROVIDER_CONFIG_ITEMS = ('apikey', 'password') <NEW_LINE> def test_instance(self): <NEW_LINE> <INDENT> ret_str = self.run_cloud('-p linode-test {0}'.format(self.instance_name), timeout=TIMEOUT) <NEW_LINE> self.assertInstanceExists(...
Integration tests for the Linode cloud provider in Salt-Cloud
6259903c26238365f5fadd60
class UnsatisfiableRequest(OperationFailed): <NEW_LINE> <INDENT> pass
Exception raised if Tor was unable to process our request.
6259903c3eb6a72ae038b874
class NewSourceForm(Schema): <NEW_LINE> <INDENT> allow_extra_fields = True <NEW_LINE> filter_extra_fields = True <NEW_LINE> authorFirstName = UnicodeString(not_empty=True) <NEW_LINE> authorLastName = UnicodeString(not_empty=True) <NEW_LINE> title = UnicodeString(not_empty=True) <NEW_LINE> year = Regex('[0-9]{4}', not_e...
NewSourceForm is a Schema for validating the data entered at the Add Source page.
6259903c21bff66bcd723e73
class S3OrgMenuLayout(S3NavigationItem): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def layout(item): <NEW_LINE> <INDENT> name = "IFRC" <NEW_LINE> logo = None <NEW_LINE> root_org = current.auth.root_org() <NEW_LINE> if root_org: <NEW_LINE> <INDENT> db = current.db <NEW_LINE> s3db = current.s3db <NEW_LINE> language = ...
Layout for the organisation-specific menu - used by the custom PDF Form for REQ - replace with s3db.org_organistion_logo()?
6259903c94891a1f408b9ffc
class UserSerializer(ModelSerializer): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = User <NEW_LINE> fields = ( "id", "username", "email", "password", "last_login", "date_joined", "profile", ) <NEW_LINE> read_only_fields = ("id", "date_joined", "profile") <NEW_LINE> extra_kwargs = {"password": {"write_onl...
A serializer for the default auth.User model
6259903c63f4b57ef0086679
class SourceEditor(ElementEditor): <NEW_LINE> <INDENT> def __init__(self, parent = None, source = None, *args, **kwargs): <NEW_LINE> <INDENT> if source is None: <NEW_LINE> <INDENT> source = Source() <NEW_LINE> <DEDENT> ElementEditor.__init__(self, parent, source, *args, **kwargs) <NEW_LINE> <DEDENT> def _makeWidgets(se...
Class to edit ModelEditor Source objects. Python implementation of the SourceEditor class which allows the user to edit the fields of a <source> element. This compound widget is designed to be embedded in other widgets. Attributes: _nameEntryField: (Pmw.EntryField) Controls editing of the Source name. _typeLabel: (...
6259903c8c3a8732951f7762
class Hand(db.Model): <NEW_LINE> <INDENT> id = db.Column(db.Integer, primary_key=True) <NEW_LINE> thema_id = db.Column(db.String(TITLE_SIZE), db.ForeignKey('thema.id')) <NEW_LINE> keyword = db.Column(db.String(KEYWORD_SIZE)) <NEW_LINE> words = db.Column(db.PickleType) <NEW_LINE> def __init__(self, id, thema_id, keyword...
Hand contains a set of words
6259903c23e79379d538d70a
class ProjectDelete(DeleteView): <NEW_LINE> <INDENT> model = models.Project <NEW_LINE> def delete(self, request, *args, **kwargs): <NEW_LINE> <INDENT> self.object = self.get_object() <NEW_LINE> self.object.date_deleted = datetime.datetime.now() <NEW_LINE> self.object.save() <NEW_LINE> messages.add_message(request, mess...
Deletes a project by setting the Project's date_deleted. We save projects for historical tracking.
6259903c0a366e3fb87ddbf0
class NotFoundException(HttpErrorException): <NEW_LINE> <INDENT> pass
Used for HTTP Not Found(404) Errors
6259903c15baa7234946319c
class userchangerole_args(object): <NEW_LINE> <INDENT> def __init__(self, info=None,): <NEW_LINE> <INDENT> self.info = info <NEW_LINE> <DEDENT> def read(self, iprot): <NEW_LINE> <INDENT> if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: <NEW_L...
Attributes: - info
6259903c10dbd63aa1c71de2
class Classifier : <NEW_LINE> <INDENT> def __init__(self, kernel): <NEW_LINE> <INDENT> self.lamb = 1 <NEW_LINE> if isinstance(kernel, str): <NEW_LINE> <INDENT> self.kernel = kernels.Kernel(kernel) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.kernel = kernel <NEW_LINE> <DEDENT> self.coef = 0 <NEW_LINE> self.Xtrain...
Abstract class from which every classifier must inherit
6259903c711fe17d825e15a2
class Nesterov(object): <NEW_LINE> <INDENT> def __init__(self, lr=0.01, momentum=0.9): <NEW_LINE> <INDENT> self.lr = lr <NEW_LINE> self.momentum = momentum <NEW_LINE> self.v = None <NEW_LINE> <DEDENT> def update(self, params, grads): <NEW_LINE> <INDENT> if self.v is None: <NEW_LINE> <INDENT> self.v = {} <NEW_LINE> for ...
Nesterov's Accelerated Gradient (http://arxiv.org/abs/1212.0901)
6259903cb57a9660fecd2c88
class Prover: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.proved_rules = [] <NEW_LINE> self._rules_seen = set() <NEW_LINE> <DEDENT> def split_alpha_beta(self): <NEW_LINE> <INDENT> rules_alpha = [] <NEW_LINE> rules_beta = [] <NEW_LINE> for a, b in self.proved_rules: <NEW_LINE> <INDENT> if isinstance...
ai - prover of logic rules given a set of initial rules, Prover tries to prove all possible rules which follow from given premises. As a result proved_rules are always either in one of two forms: alpha or beta: Alpha rules ----------- This are rules of the form:: a -> b & c & d & ... Beta rules ---------- Thi...
6259903c0a366e3fb87ddbf2
class NoOpFixture(EnvLoadableFixture): <NEW_LINE> <INDENT> def attach_storage_medium(self, ds): <NEW_LINE> <INDENT> ds.meta.storage_medium = NoOpMedium(None, ds) <NEW_LINE> <DEDENT> def rollback(self): pass <NEW_LINE> def commit(self): pass
a fixture that pretends to load stuff but doesn't really.
6259903cd53ae8145f919673
class IType: <NEW_LINE> <INDENT> IMM_START = 20 <NEW_LINE> IMM_END = 32 <NEW_LINE> FUNCT_START = 12 <NEW_LINE> FUNCT_END = 15 <NEW_LINE> def __init__(self, instruction): <NEW_LINE> <INDENT> self.instr = instruction <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def encode(cls, imm_val, rs1_val, funct_val, rd_val, opcode_v...
I-type instruction format
6259903c07d97122c4217eab
@final <NEW_LINE> class NegatedConditionsViolation(ASTViolation): <NEW_LINE> <INDENT> error_template = 'Found negated condition' <NEW_LINE> code = 504 <NEW_LINE> previous_codes = {463}
Forbid negated conditions together with ``else`` clause. Reasoning: It easier to read and name regular conditions. Not negated ones. Solution: Move actions from the negated ``if`` condition to the ``else`` condition. Example:: # Correct: if some == 1: ... else: ... if ...
6259903c91af0d3eaad3b042
class TargetAddress(AWSProperty): <NEW_LINE> <INDENT> props: PropsDictType = { "Ip": (str, True), "Port": (str, False), }
`TargetAddress <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53resolver-resolverrule-targetaddress.html>`__
6259903c76d4e153a661db7a
class Node: <NEW_LINE> <INDENT> def __init__(self,x,y,father,g_value,h_value,f_value): <NEW_LINE> <INDENT> self.x = x <NEW_LINE> self.y = y <NEW_LINE> self.father = father <NEW_LINE> self.g_value = g_value <NEW_LINE> self.h_value = h_value <NEW_LINE> self.f_value = f_value <NEW_LINE> <DEDENT> def equal(self,other): <NE...
Each position in matrix-map is a node
6259903cd99f1b3c44d068b4
class Credential(BASE, L2NetworkBase): <NEW_LINE> <INDENT> __tablename__ = 'credentials' <NEW_LINE> credential_id = Column(String(255)) <NEW_LINE> tenant_id = Column(String(255), primary_key=True) <NEW_LINE> credential_name = Column(String(255), primary_key=True) <NEW_LINE> user_name = Column(String(255)) <NEW_LINE> pa...
Represents credentials for a tenant
6259903ccad5886f8bdc5983
class InvalidPageException(Exception): <NEW_LINE> <INDENT> pass
If page is not found
6259903c596a897236128eae
@gin.configurable <NEW_LINE> class ValueNetwork(network.Network): <NEW_LINE> <INDENT> def __init__(self, input_tensor_spec, preprocessing_layers=None, preprocessing_combiner=None, conv_layer_params=None, fc_layer_params=(75, 40), dropout_layer_params=None, activation_fn=tf.keras.activations.relu, kernel_initializer=Non...
Feed Forward value network. Reduces to 1 value output per batch item.
6259903c287bf620b6272dfa
class SkipExtensionException(Exception): <NEW_LINE> <INDENT> pass
Exception to signal that an extension should be skipped. It should be raised in the constructor of an extension.
6259903c82261d6c527307cb
class Brinkman3DGaussianStokesletsAndDipolesSphericalBCs(Brinkman3DGaussianStokesletsAndDipoles): <NEW_LINE> <INDENT> def __init__(self,eps,mu=1.0,alph=100*np.sqrt(1j),sphererad=0): <NEW_LINE> <INDENT> Brinkman3DGaussianStokesletsAndDipoles.__init__(self, eps, mu, alph) <NEW_LINE> self.dim = 3 <NEW_LINE> if sphererad <...
Summation of 3D regularized Brinkmanlets and dipoles with the Gaussian blob. BCs are steady oscillations of a sphere of radius sphererad. Assigned constants: self.BCcst is the relative dipole strength for spherical boundary conditions. self.fcst is the coefficient that multiplies the boundary condition velocity to get ...
6259903cd53ae8145f919675
class FDWConvBlock(HybridBlock): <NEW_LINE> <INDENT> def __init__(self, in_channels, out_channels, kernel_size, strides, padding, dilation=1, use_bias=False, use_bn=True, bn_epsilon=1e-5, activation=(lambda: nn.Activation("relu")), **kwargs): <NEW_LINE> <INDENT> super(FDWConvBlock, self).__init__(**kwargs) <NEW_LINE> a...
Factorized depthwise separable convolution block with BatchNorms and activations at each convolution layers. Parameters: ---------- in_channels : int Number of input channels. out_channels : int Number of output channels. kernel_size : int Convolution window size. strides : int or tuple/list of 2 int S...
6259903c91af0d3eaad3b044
class ParseElementEnhance(ParserElement): <NEW_LINE> <INDENT> def __init__( self, expr, savelist=False ): <NEW_LINE> <INDENT> super(ParseElementEnhance,self).__init__(savelist) <NEW_LINE> if isinstance( expr, basestring ): <NEW_LINE> <INDENT> if issubclass(ParserElement._literalStringClass, Token): <NEW_LINE> <INDENT> ...
Abstract subclass of C{ParserElement}, for combining and post-processing parsed tokens.
6259903c30c21e258be99a1b
class JNTTCertification(JNTTServer): <NEW_LINE> <INDENT> ip = '127.0.0.1' <NEW_LINE> hadds = ['1111/0000'] <NEW_LINE> client_hadd = "9999/0000" <NEW_LINE> conf = {'broker_ip': '127.0.0.1', 'broker_port': '1883'} <NEW_LINE> def setUp(self): <NEW_LINE> <INDENT> JNTTServer.setUp(self) <NEW_LINE> self.startClient(self.conf...
Certification base test
6259903cd164cc6175822185
class Pruner(torch.nn.Module): <NEW_LINE> <INDENT> def __init__(self, scorer: torch.nn.Module) -> None: <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self._scorer = scorer <NEW_LINE> <DEDENT> @overrides <NEW_LINE> def forward(self, embeddings: torch.FloatTensor, mask: torch.LongTensor, num_items_to_keep: int) -> Tu...
This module scores and prunes items in a list using a parameterised scoring function and a threshold. Parameters ---------- scorer : ``torch.nn.Module``, required. A module which, given a tensor of shape (batch_size, num_items, embedding_size), produces a tensor of shape (batch_size, num_items, 1), representin...
6259903cc432627299fa4208
class Header: <NEW_LINE> <INDENT> def __init__(self, fields): <NEW_LINE> <INDENT> self.set_fields(fields) <NEW_LINE> <DEDENT> def set_fields(self, fields): <NEW_LINE> <INDENT> self.fields = fields <NEW_LINE> self.field_to_column = dict(zip(fields, count())) <NEW_LINE> <DEDENT> def __getitem__(self, key): <NEW_LINE> <IN...
Header of a table -- contains column names and a mapping from them to column indexes
6259903cd99f1b3c44d068b6
class WorkerServiceServicer(object): <NEW_LINE> <INDENT> def GetStatus(self, request, context): <NEW_LINE> <INDENT> context.set_code(grpc.StatusCode.UNIMPLEMENTED) <NEW_LINE> context.set_details('Method not implemented!') <NEW_LINE> raise NotImplementedError('Method not implemented!') <NEW_LINE> <DEDENT> def CreateWork...
////////////////////////////////////////////////////////////////////////////// WorkerService defines a TensorFlow service that executes dataflow graphs on a set of local devices, on behalf of a MasterService. A worker service keeps track of multiple "registered graphs". Each registered graph is a subgraph of a client...
6259903c0fa83653e46f60ea
class IDECommunicatorV1(_IDECommunicatorBase): <NEW_LINE> <INDENT> def send_script(self, script): <NEW_LINE> <INDENT> self._write(script.encode('utf-8') + b'\n')
IDE Communicator (protocol version 1).
6259903c1d351010ab8f4d2c
class TestJSONJobsDatabase(CrontabberTestCaseBase): <NEW_LINE> <INDENT> def test_loading_existing_file(self): <NEW_LINE> <INDENT> db = crontabber.JSONJobDatabase() <NEW_LINE> file1 = os.path.join(self.tempdir, 'file1.json') <NEW_LINE> stuff = { 'foo': 1, 'more': { 'bar': u'Bar' } } <NEW_LINE> json.dump(stuff, open(file...
This has nothing to do with Socorro actually. It's just tests for the underlying JSON database.
6259903c10dbd63aa1c71de6
class BiosVfDRAMClockThrottling(ManagedObject): <NEW_LINE> <INDENT> consts = BiosVfDRAMClockThrottlingConsts() <NEW_LINE> naming_props = set([]) <NEW_LINE> mo_meta = MoMeta("BiosVfDRAMClockThrottling", "biosVfDRAMClockThrottling", "DRAM-Clock-Throttling", VersionMeta.Version222c, "InputOutput", 0x3f, [], ["admin", "ls-...
This is BiosVfDRAMClockThrottling class.
6259903c8c3a8732951f7768
class CitiesLightListModelView(ListModelView): <NEW_LINE> <INDENT> def get(self, request, *args, **kwargs): <NEW_LINE> <INDENT> limit = request.GET.get('limit', None) <NEW_LINE> queryset = super(CitiesLightListModelView, self).get( request, *args, **kwargs) <NEW_LINE> if limit: <NEW_LINE> <INDENT> return queryset[:limi...
ListModelView that supports a limit GET request argument.
6259903c287bf620b6272dfc
class ReadOnlySegment(Segment): <NEW_LINE> <INDENT> def __init__(self, bytes, segment_id, block_size=4096, max_block_count=512): <NEW_LINE> <INDENT> super().__init__(segment_id, block_size, max_block_count) <NEW_LINE> memview = memoryview(bytes) <NEW_LINE> self._block_bytes = memview[block_size:] <NEW_LINE> summary_byt...
Since this class is only for reading from a segment we can store the data in a memoryview, which allows us to take slices of the data without copying.
6259903c23e79379d538d710
class LoadTrajectoryError(TrajectoryError): <NEW_LINE> <INDENT> def __init__(self, path): <NEW_LINE> <INDENT> self.path = path <NEW_LINE> self.message = f"File: '{self.path}' is not a valid trajectory" <NEW_LINE> super().__init__(self.message) <NEW_LINE> <DEDENT> def __str__(self) -> str: <NEW_LINE> <INDENT> return sel...
Error while loading a trajectory
6259903c8a349b6b43687456
class Lighting(GameSprite): <NEW_LINE> <INDENT> def __init__(self, position, size, *containers): <NEW_LINE> <INDENT> GameSprite.__init__(self, *containers) <NEW_LINE> self.rect = pygame.Rect(position, size) <NEW_LINE> self.x, self.y = position <NEW_LINE> self.rect.midbottom = position <NEW_LINE> self._image = None <NEW...
Animation for a lighting that strike the ground
6259903cc432627299fa4209
class KeyboardCapture(threading.Thread): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self._suppressed_keys = set() <NEW_LINE> self.key_down = lambda key: None <NEW_LINE> self.key_up = lambda key: None <NEW_LINE> self._proc = KeyboardCaptureProcess() <NEW_LINE> self._finishe...
Listen to all keyboard events.
6259903c8a43f66fc4bf33a0
class DataFrame(wtypes.Base): <NEW_LINE> <INDENT> begin = datetime.datetime <NEW_LINE> end = datetime.datetime <NEW_LINE> tenant_id = wtypes.text <NEW_LINE> resources = [RatedResource] <NEW_LINE> def to_json(self): <NEW_LINE> <INDENT> return {'begin': self.begin, 'end': self.end, 'tenant_id': self.tenant_id, 'resources...
Type describing a stored data frame.
6259903c26238365f5fadd68
class CThostFtdcQryTradingAccountField: <NEW_LINE> <INDENT> def __init__(self,**fields): <NEW_LINE> <INDENT> """经纪公司代码""" <NEW_LINE> self.BrokerID = None <NEW_LINE> """投资者代码""" <NEW_LINE> self.InvestorID = None <NEW_LINE> """币种代码""" <NEW_LINE> self.CurrencyID = None <NEW_LINE> self.__dict__.update(fields) <NEW_LINE> <D...
查询资金账户 BrokerID 经纪公司代码 char[11] InvestorID 投资者代码 char[13] CurrencyID 币种代码 char[4]
6259903cec188e330fdf9aab
class OWLPropertyRange(OWLObject, metaclass=ABCMeta): <NEW_LINE> <INDENT> pass
OWL Objects that can be the ranges of properties
6259903c66673b3332c31609
class DetailsTenantView(ConfigurationView): <NEW_LINE> <INDENT> entities = View.nested(DetailsTenantEntities) <NEW_LINE> toolbar = View.nested(AccessControlToolbar) <NEW_LINE> name = Text('Name') <NEW_LINE> description = Text('Description') <NEW_LINE> parent = Text('Parent') <NEW_LINE> table = VersionPick({ Version.low...
Details Tenant View
6259903ccad5886f8bdc5985
class SteamykitchenMixin(object): <NEW_LINE> <INDENT> source = 'steamykitchen' <NEW_LINE> def parse_item(self, response): <NEW_LINE> <INDENT> hxs = HtmlXPathSelector(response) <NEW_LINE> base_path = """//blockquote[@class="recipe"]""" <NEW_LINE> recipes_scopes = hxs.select(base_path) <NEW_LINE> name_path = '//meta[@pro...
Using this as a mixin lets us reuse the parse_item method more easily
6259903c26068e7796d4db59
class BrokenLinks(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.broken_links = {} <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> pp = pprint.PrettyPrinter(depth=3, indent=1) <NEW_LINE> err_msg = "Broken links found: \n" + pp.pformat(self.broken_links) <NEW_LINE> self.ass...
Test for broken links on all pages of cnmipss.org
6259903c596a897236128eb2
class MsgWaitForEndRead(Msg): <NEW_LINE> <INDENT> interaction = Interactions.WAIT_FOR_END_READ <NEW_LINE> requires_request = False <NEW_LINE> opcode = 0x00 <NEW_LINE> protocol = ProtocolVersion.ANY <NEW_LINE> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super().__init__(timeout=5, *args, **kwargs) <NEW_LINE...
.. attribute:: crc The checksum provided for the (out of band) pen data.
6259903cb57a9660fecd2c8d
class StatusBar(gtk.Statusbar): <NEW_LINE> <INDENT> def __init__(self, initmsg=None, others=[]): <NEW_LINE> <INDENT> super(StatusBar,self).__init__() <NEW_LINE> self._context = self.get_context_id("unique_sb") <NEW_LINE> self._timer = None <NEW_LINE> for oth in others[::-1]: <NEW_LINE> <INDENT> self.pack_end(oth, False...
All status bar functionality. @param initmsg: An optional initial message. @param others : Others widgets to add at the right of the texts. @author: Facundo Batista <facundobatista =at= taniquetil.com.ar>
6259903cd4950a0f3b111749
class GenericGlobalPerm(models.Model): <NEW_LINE> <INDENT> content_type = models.ForeignKey( ContentType, related_name='global_perms', verbose_name=_('content type'), on_delete=models.CASCADE, null=True ) <NEW_LINE> roles = models.IntegerField(verbose_name=_('roles'), default=DEFAULT_ROLE) <NEW_LINE> permission = model...
This model is for defining template-like permissions e.g. Every blog moderator could edit his blog
6259903c1f5feb6acb163e05
class Question(models.Model): <NEW_LINE> <INDENT> QUESTION_TYPES = [ ('1', 'Text'), ('2', 'Choose one'), ('3', 'Choose many'), ] <NEW_LINE> poll = models.ForeignKey(Poll, on_delete=models.CASCADE, related_name='questions') <NEW_LINE> text = models.CharField("Question text", max_length=255) <NEW_LINE> question_type = mo...
Questions Model
6259903c23e79379d538d712