code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class ForexObject: <NEW_LINE> <INDENT> priceValues = [] <NEW_LINE> name = "" <NEW_LINE> def __init__(self, names): <NEW_LINE> <INDENT> self.name = names <NEW_LINE> <DEDENT> def addValue(self, value): <NEW_LINE> <INDENT> self.priceValues.append(value) | Common object to represent each stock/forex | 62598f923617ad0b5ee05dc7 |
class Settings(): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.screen_width = 1000 <NEW_LINE> self.screen_height = 700 <NEW_LINE> self.bg_color = (230, 230, 230) <NEW_LINE> self.ship_speed_factor = 1.5 <NEW_LINE> self.bullet_speed_factor = 5 <NEW_LINE> self.bullet_width = 3 <NEW_LINE> self.bullet_he... | A class to store all settings for Alien Invasion | 62598f92d6c5a102081e1dbe |
class Collection(dict): <NEW_LINE> <INDENT> def set_store(self, store): <NEW_LINE> <INDENT> self.store = store <NEW_LINE> <DEDENT> def commit(self): <NEW_LINE> <INDENT> self.store.set_values(self) <NEW_LINE> <DEDENT> def __getattribute__(self, key): <NEW_LINE> <INDENT> keys = super(Collection, self).keys() <NEW_LINE> i... | Collection() -> new Collection dict
A dictionary which belongs to a thread-safe store
Again, you do not instantiate these yourself | 62598f92e64d504609df91f4 |
class TestIOrderbookSide(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 testIOrderbookSide(self): <NEW_LINE> <INDENT> pass | IOrderbookSide unit test stubs | 62598f928e7ae83300ee8d22 |
class BucketlistPageNumberPagination(PageNumberPagination): <NEW_LINE> <INDENT> page_size = 20 <NEW_LINE> page_size_query_param = 'limit' <NEW_LINE> max_page_size = 100 | Overrides the default pagination settings. | 62598f9245492302aabfc154 |
class SearchTypeCache(BaseCache): <NEW_LINE> <INDENT> def __init__(self, search_type): <NEW_LINE> <INDENT> self.search_type = search_type <NEW_LINE> self.sobjects = [] <NEW_LINE> super(SearchTypeCache,self).__init__(search_type) <NEW_LINE> <DEDENT> def init_cache(self): <NEW_LINE> <INDENT> self.mtime = datetime.datetim... | Generic class to cache an entire table
There should only be one of these for each search type. It is used
for data that does not change much and is much faster to have
cached in memory | 62598f9294891a1f408b952e |
class Reviews(models.Model): <NEW_LINE> <INDENT> email = models.EmailField() <NEW_LINE> name = models.CharField('Имя', max_length=100) <NEW_LINE> text = models.TextField('Сообщение', max_length=100) <NEW_LINE> parent = models.ForeignKey('self', verbose_name='Родитель', on_delete=models.SET_NULL, blank=True, null=True) ... | Отзывы | 62598f92287bf620b627183a |
class RegistrationForm(forms.Form): <NEW_LINE> <INDENT> username = forms.CharField(widget=forms.HiddenInput,required=False) <NEW_LINE> email = forms.EmailField(label=_("E-mail"), required=True) <NEW_LINE> password1 = forms.CharField(widget=forms.PasswordInput, label=_("Password")) <NEW_LINE> password2 = forms.CharField... | Form for registering a new user account. | 62598f92e5267d203ee6b598 |
class MasterSelect(object): <NEW_LINE> <INDENT> def getSlaves(self): <NEW_LINE> <INDENT> slaves = (getattr(self.field, 'slave_fields', None) or getattr(self.field.value_type, 'slave_fields', ())) <NEW_LINE> for slave in slaves: <NEW_LINE> <INDENT> yield slave.copy() <NEW_LINE> <DEDENT> <DEDENT> def get_slave_id(self, s... | Methods required for widgets
| 62598f92adb09d7d5dc0a204 |
class _ReadingEncoder(json.JSONEncoder): <NEW_LINE> <INDENT> def default(self, o): <NEW_LINE> <INDENT> if isinstance(o, Sensor): <NEW_LINE> <INDENT> return _rawReadingToDict(o.getRawReading()) <NEW_LINE> <DEDENT> elif isinstance(o, Alarm): <NEW_LINE> <INDENT> return _rawReadingToDict(o.getRawReading()) <NEW_LINE> <DEDE... | Reading JSON encoder that returns
dictionary with data and reading value | 62598f92dd821e528d6d8bb1 |
class json2po(object): <NEW_LINE> <INDENT> def convert_store(self, input_store, duplicatestyle="msgctxt"): <NEW_LINE> <INDENT> output_store = po.pofile() <NEW_LINE> output_header = output_store.header() <NEW_LINE> output_header.addnote("extracted from %s" % input_store.filename, "developer") <NEW_LINE> for input_unit i... | Convert a JSON file to a PO file | 62598f9296565a6dacd2cdb8 |
class SignOutView(web.View): <NEW_LINE> <INDENT> @login_required <NEW_LINE> async def get(self): <NEW_LINE> <INDENT> self.request.session.pop("user") <NEW_LINE> add_message(self.request, "You are logged out") <NEW_LINE> redirect(self.request, "index") | Remove current user from session | 62598f92656771135c4892fd |
class ListAllTeamsView(generics.ListAPIView): <NEW_LINE> <INDENT> queryset = FantasyTeam.objects.all() <NEW_LINE> serializer_class = serializers.TeamsSerializer | Provides a get method handler. | 62598f92a219f33f346c6498 |
class Include(PropertyDescriptorFactory): <NEW_LINE> <INDENT> def __init__(self, delegate, help="", use_prefix=True): <NEW_LINE> <INDENT> if not (isinstance(delegate, type) and issubclass(delegate, HasProps)): <NEW_LINE> <INDENT> raise ValueError("expected a subclass of HasProps, got %r" % delegate) <NEW_LINE> <DEDENT>... | Include "mix-in" property collection in a Bokeh model.
See :ref:`bokeh.core.property_mixins` for more details. | 62598f92cc0a2c111447ac90 |
class TestSupport(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 testSupport(self): <NEW_LINE> <INDENT> model = kinow_client.models.support.Support() | Support unit test stubs | 62598f92a05bb46b3848a4fc |
class VEPhoneField(RegexField): <NEW_LINE> <INDENT> default_error_messages = { 'max_digits' : _(u"This field requires 12 digits."), } <NEW_LINE> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(VEPhoneField, self).__init__( r'^\d{4}-\d{7}$', max_length=12, min_length=12, *args, **kwargs ) <NEW_LINE> <DEDE... | A field that validates as Venezuelan phone postal code.
Valid code is XXXX-XXXXXXX where X is digit. | 62598f920c0af96317c56002 |
class PDFCollocationsView(FormView): <NEW_LINE> <INDENT> template_name = 'articles/pdfcollocations.html' <NEW_LINE> form_class = PDFUploadForm <NEW_LINE> def form_valid(self, form): <NEW_LINE> <INDENT> collocs = form.get_collocations_alchemy() <NEW_LINE> return self.render_to_response(self.get_context_data(form=form, c... | Extract and display collocations from pdf document | 62598f928e71fb1e983bb731 |
class HttpStatusInfo(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.HttpStatus = None <NEW_LINE> self.Num = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> self.HttpStatus = params.get("HttpStatus") <NEW_LINE> self.Num = params.get("Num") <NEW_LINE> memeber... | 播放错误码信息
| 62598f92d486a94d0ba2bc50 |
class NotContainsOnly(Negate, ContainsOnly): <NEW_LINE> <INDENT> reason = '{0} contains only {comparable}' | Asserts that `value` does not contain only `comparable`.
Aliases:
- ``to_not_contain_only``
- ``does_not_contain_only``
.. versionadded:: 0.5.0 | 62598f9230bbd722464697b5 |
class ForeignKey(validators.Int): <NEW_LINE> <INDENT> column = None <NEW_LINE> __unpackargs__ = ('column',) <NEW_LINE> def validate_python(self, value, state): <NEW_LINE> <INDENT> if value is None or not hasattr(state, 'session'): return <NEW_LINE> query = select([self.column], self.column == value) <NEW_LINE> if not s... | Takes a database column to check converted value's existence
>>> ForeignKey(parties_table.c.id).to_python('10')
10 | 62598f92925a0f43d25e7cb8 |
class Break(_BreakContinue): <NEW_LINE> <INDENT> get_label = lambda _, c: c.break_label <NEW_LINE> descrip = "break" | Node for a break statement. | 62598f9215baa72349461bfc |
class PageLoaderView(LoginRequiredMixin, TemplateView): <NEW_LINE> <INDENT> login_url = "/auth/login/" <NEW_LINE> def dispatch(self, request, template, *args, **kwargs): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.template_name = f"pages/{template}.html" <NEW_LINE> get_template(self.template_name) <NEW_LINE> retu... | Page loader view | 62598f9263b5f9789fe84df3 |
class Dataloader(LoadClassInterface, metaclass=DocStringInheritor): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> pass | Base class of Dataloader.
| 62598f923eb6a72ae038a2b7 |
class Lock(): <NEW_LINE> <INDENT> def __init__(self, path, userid): <NEW_LINE> <INDENT> self.name = os.path.join(path, '.mfc1_lock-%s' % userid) <NEW_LINE> self.pid = os.path.join(path, '.mfc1_pid-%s' % userid) <NEW_LINE> <DEDENT> def delete_lock(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> os.remove(self.name) ... | mfc1.Lock(path, userid)
Lock object of the MindfulClock. | 62598f9230dc7b766599f4d0 |
class PReLU(Layer): <NEW_LINE> <INDENT> def __init__(self, num_parameters=1, init=0.25, weight_attr=None, name=None): <NEW_LINE> <INDENT> super(PReLU, self).__init__() <NEW_LINE> self._num_parameters = num_parameters <NEW_LINE> self._init = init <NEW_LINE> self._weight_attr = weight_attr <NEW_LINE> self._name = name <N... | PReLU Activation.
.. math::
PReLU(x) = max(0, x) + weight * min(0, x)
Parameters:
num_parameters (int, optional): Number of `weight` to learn. The supported values are:
1 - a single parameter `alpha` is used for all input channels;
Number of channels - a seperate `alpha` is used for each inpu... | 62598f9207f4c71912baf0c8 |
class TestDocsBaseModel(unittest.TestCase): <NEW_LINE> <INDENT> def test_module(self): <NEW_LINE> <INDENT> self.assertTrue(len(user.__doc__) > 0) <NEW_LINE> <DEDENT> def test_class(self): <NEW_LINE> <INDENT> self.assertTrue(len(User.__doc__) > 0) <NEW_LINE> <DEDENT> def test_method(self): <NEW_LINE> <INDENT> for func i... | test docstrings for base and test_base files | 62598f92e64d504609df91f5 |
class ArgsConstraint(Constraint): <NEW_LINE> <INDENT> def __init__(self, args): <NEW_LINE> <INDENT> self._args = args <NEW_LINE> <DEDENT> def add_to(self, consts, writer): <NEW_LINE> <INDENT> args = self._args <NEW_LINE> args[0].add_prefix("_F(") <NEW_LINE> indent = " " * 3 <NEW_LINE> for arg in args[1:]: <NEW_LINE> <I... | Add several arguments A, B, C in the form:
_F(keyA=valA,
keyB=valB,
keyC=valC,), | 62598f927047854f4633f05d |
class Validator: <NEW_LINE> <INDENT> def __init__(self, passport): <NEW_LINE> <INDENT> self.passport = passport <NEW_LINE> <DEDENT> def is_valid(self) -> bool: <NEW_LINE> <INDENT> return self.byr() and self.iyr() and self.eyr() and self.hgt() and self.hcl() and self.ecl() and self.pid() <NEW_LINE> <DEDENT> def byr(self... | Validator validates a passport. | 62598f920a50d4780f705053 |
class EBSVolumeResourceSpec(EC2ResourceSpec): <NEW_LINE> <INDENT> type_name = "volume" <NEW_LINE> schema = Schema( ScalarField("AvailabilityZone"), ScalarField("CreateTime"), ScalarField("Size"), ScalarField("State"), ScalarField("VolumeType"), ScalarField("Encrypted"), ListField( "Attachments", EmbeddedDictField( Scal... | Resource for EBSVolumes | 62598f92004d5f362081ee3b |
class SensorEntity(Entity): <NEW_LINE> <INDENT> pass | Base class for sensor entities. | 62598f9294891a1f408b952f |
class ap_array: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.a = [0.0 for _ in range(7)] | * Array containing the following magnetic values:
* 0 : daily AP
* 1 : 3 hr AP index for current time
* 2 : 3 hr AP index for 3 hrs before current time
* 3 : 3 hr AP index for 6 hrs before current time
* 4 : 3 hr AP index for 9 hrs before current time
* 5 : Average of eight 3 hr AP indicies from 12 to 33 hr... | 62598f92851cf427c66b7f44 |
class TwitterToken(object): <NEW_LINE> <INDENT> def __init__(self, con, meta): <NEW_LINE> <INDENT> self.con = con <NEW_LINE> self.meta = meta <NEW_LINE> self.data = meta.tables['twitter_token'] <NEW_LINE> <DEDENT> def find_by_group(self, group_name): <NEW_LINE> <INDENT> search_clause = self.data.select().where( self.da... | Handle database access for twitter_token table
Attributes:
con: sqlalchemy connection object
meta: sqlalchemy meta object
data: twitter_token table from database | 62598f9226068e7796d4c5e0 |
class LocallyShuffleData(ProxyDataFlow, RNGDataFlow): <NEW_LINE> <INDENT> def __init__(self, ds, buffer_size, nr_reuse=1, shuffle_interval=None): <NEW_LINE> <INDENT> ProxyDataFlow.__init__(self, ds) <NEW_LINE> self.q = deque(maxlen=buffer_size) <NEW_LINE> if shuffle_interval is None: <NEW_LINE> <INDENT> shuffle_interva... | Maintain a pool to buffer datapoints, and shuffle before producing them.
This can be used as an alternative when a complete random read is too expensive
or impossible for the data source. | 62598f926aa9bd52df0d4b4c |
class MovementDirectorCoreConfig(MovementDirectorAbstract): <NEW_LINE> <INDENT> def __init__(self, scenario_changes, *args, **kwargs): <NEW_LINE> <INDENT> self.nodes = CoreConfigNodes.factory()(scenario_changes) <NEW_LINE> <DEDENT> def get_distances_from_nodes(self): <NEW_LINE> <INDENT> return self.nodes.get_distance_m... | Attributes
----------
scenario_changes : list<list<str, int>>
Describes the change of a scenario. The values are the steps until the next scenario becomes active.
node_count : int
nodes : ArmaNodes | 62598f9285dfad0860cbf8b2 |
class BaseCase(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.app = create_app(configure="testing") <NEW_LINE> self.client = self.app.test_client() <NEW_LINE> self.app_context = self.app.app_context() <NEW_LINE> self.app_context.push() <NEW_LINE> self.data = { "location" : "fhkdhf", "descripti... | Base class to be inherited by all other testcases. | 62598f92dd821e528d6d8bb3 |
class OSPF_BaseLSA(Packet): <NEW_LINE> <INDENT> def post_build(self, p, pay): <NEW_LINE> <INDENT> length = self.len <NEW_LINE> if length is None: <NEW_LINE> <INDENT> length = len(p) <NEW_LINE> p = p[:18] + struct.pack("!H", length) + p[20:] <NEW_LINE> <DEDENT> if self.chksum is None: <NEW_LINE> <INDENT> chksum = ospf_l... | An abstract base class for Link State Advertisements | 62598f924e696a045264dc48 |
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>... | Serializer for the users object | 62598f9323e79379d538c184 |
class eMonitorIntervalTrigger(IntervalTrigger): <NEW_LINE> <INDENT> def __str__(self): <NEW_LINE> <INDENT> return '*interval trigger* with interval: {}'.format(self.interval) | Own implementation of IntervalTrigger | 62598f937d847024c075c051 |
class Telegram(models.Model): <NEW_LINE> <INDENT> profile = models.ForeignKey('Profile', on_delete=models.CASCADE) <NEW_LINE> handle = models.CharField(max_length=40) <NEW_LINE> @classmethod <NEW_LINE> def create(cls, user_id, institution, course): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> user = User.objects.get(id... | Schema of telegram field | 62598f93b57a9660fecd16f9 |
class Parse: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.rawString = str() <NEW_LINE> <DEDENT> def __setattr__(self, name, value): <NEW_LINE> <INDENT> if(name == "inputString"): <NEW_LINE> <INDENT> self.__dict__["rawString"] = value <NEW_LINE> <DEDENT> <DEDENT> def messageSplit(self): <NEW_LINE> <I... | This class is responsible for analyzing and parsing the output of the
IRC-Server.
Variables:
none | 62598f9330bbd722464697b6 |
class _SyncMap: <NEW_LINE> <INDENT> def __init__(self) -> None: <NEW_LINE> <INDENT> self.file_set = set() <NEW_LINE> self.directory_set = set() | Represent the listing of file and the directories needed for syncing remote and local directories.
All paths are given as relative paths.
:ivar file_set: set of all files available in a directory including the files in subdirectories
:ivar directory_set: set of all sub-directories in a directory (including the subdir... | 62598f93fff4ab517ebcd46b |
class ObjectiveCreateView(LoginRequiredMixin, InvalidFormHandlerMixin, CreateView): <NEW_LINE> <INDENT> model = Objective <NEW_LINE> form_class = ObjectiveCreateForm <NEW_LINE> template_name = "learning/taxonomy/objective/create.html" <NEW_LINE> def form_valid(self, form): <NEW_LINE> <INDENT> form.instance.author = sel... | The view that allows user to create Objective | 62598f936e29344779b002d8 |
class ConnectivityTestReport(ActiveMeasurement): <NEW_LINE> <INDENT> __tablename__ = "connectivity_test_reports" <NEW_LINE> id = db1.Column(db1.Integer, db1.ForeignKey("active_measurements.id"), primary_key=True) <NEW_LINE> sites_results = db1.relationship("SiteResult", backref="connectivity_test_report", lazy="dynamic... | Connectivity test reports model class | 62598f93bde94217f37074a8 |
class CronSlices(list): <NEW_LINE> <INDENT> def __init__(self, *args): <NEW_LINE> <INDENT> for info in S_INFO: <NEW_LINE> <INDENT> self.append(CronSlice(info)) <NEW_LINE> <DEDENT> self.special = None <NEW_LINE> if args and not self.setall(*args): <NEW_LINE> <INDENT> raise ValueError("Can't set cron value to: %s" % str(... | Controls a list of five time 'slices' which reprisent:
minute frequency, hour frequency, day of month frequency,
month requency and finally day of the week frequency. | 62598f9332920d7e50bc5cdf |
class WatermarkEvent(StatusEvent): <NEW_LINE> <INDENT> def __init__(self, bot, state_update_event): <NEW_LINE> <INDENT> super().__init__(bot, state_update_event) <NEW_LINE> self.conv_event = hangups.parsers.parse_watermark_notification(state_update_event) <NEW_LINE> self.user_id = state_update_event.sender_id <NEW_LIN... | user reads up to a certain point in the conversation | 62598f93379a373c97d98c99 |
class Libice(AutotoolsPackage): <NEW_LINE> <INDENT> homepage = "http://cgit.freedesktop.org/xorg/lib/libICE" <NEW_LINE> url = "https://www.x.org/archive/individual/lib/libICE-1.0.9.tar.gz" <NEW_LINE> version('1.0.9', '95812d61df8139c7cacc1325a26d5e37') <NEW_LINE> depends_on('xproto', type='build') <NEW_LINE> depen... | libICE - Inter-Client Exchange Library. | 62598f9316aa5153ce400180 |
class JSR(Instruction, Branch): <NEW_LINE> <INDENT> def __call__(self): <NEW_LINE> <INDENT> sef.core.stack.push(self.core + 2) <NEW_LINE> self.core.pc = self.get_arg() | JSR Jump to new location saving return address | 62598f930383005118f6d37b |
class SQLAlchemySessionSpanObserver(SpanObserver): <NEW_LINE> <INDENT> def __init__(self, session, span): <NEW_LINE> <INDENT> self.session = session <NEW_LINE> self.span = span <NEW_LINE> <DEDENT> def on_finish(self, exc_info): <NEW_LINE> <INDENT> if isinstance(self.span, ServerSpan): <NEW_LINE> <INDENT> self.session.c... | Automatically close the session at the end of each request. | 62598f93b5575c28eb712b0d |
class SubjectInterface: <NEW_LINE> <INDENT> def request(self): pass | Defined the common interface for RealSubject and Proxy so that a
Proxy can be used anywhere a RealSubject is expected. | 62598f93eab8aa0e5d30ba01 |
class Post(models.Model): <NEW_LINE> <INDENT> author = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, help_text="Nome ou Pseudónimo do Usuario") <NEW_LINE> title = models.CharField(help_text="Titulo do Post",max_length=200) <NEW_LINE> text = models.TextField(help_text="Texto do Post") <NEW_LINE> ... | Armazena um unico Post, se relaciona com
:model:`auth.User`.
Para publicar o Post é preciso executar a função publish() | 62598f930a50d4780f705055 |
class ExcludeDecorator(TestDecorator): <NEW_LINE> <INDENT> def __init__(self, suite, exclude_pattern): <NEW_LINE> <INDENT> super(ExcludeDecorator, self).__init__( exclude_tests_by_re(suite, exclude_pattern)) | A decorator which excludes test matching an exclude pattern. | 62598f938da39b475be02e62 |
class Reshape(OnnxOpConverter): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def _impl_v1(cls, inputs, attr, params): <NEW_LINE> <INDENT> return _op.reshape(inputs[0], attr["shape"]) <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def _impl_v5(cls, inputs, attr, params): <NEW_LINE> <INDENT> if get_name(inputs[1]) in params:... | Operator converter for Reshape. | 62598f93596a8972361278fe |
class NSEC3PARAM(dns.rdata.Rdata): <NEW_LINE> <INDENT> __slots__ = ['algorithm', 'flags', 'iterations', 'salt'] <NEW_LINE> def __init__(self, rdclass, rdtype, algorithm, flags, iterations, salt): <NEW_LINE> <INDENT> super(NSEC3PARAM, self).__init__(rdclass, rdtype) <NEW_LINE> self.algorithm = algorithm <NEW_LINE> self.... | NSEC3PARAM record
@ivar algorithm: the hash algorithm number
@type algorithm: int
@ivar flags: the flags
@type flags: int
@ivar iterations: the number of iterations
@type iterations: int
@ivar salt: the salt
@type salt: string | 62598f936aa9bd52df0d4b4e |
class SubprocVecEnv(VecEnv): <NEW_LINE> <INDENT> def __init__(self, env_fns, spaces=None): <NEW_LINE> <INDENT> self.waiting = False <NEW_LINE> self.closed = False <NEW_LINE> nenvs = len(env_fns) <NEW_LINE> self.remotes, self.work_remotes = zip(*[Pipe() for _ in range(nenvs)]) <NEW_LINE> self.ps = [Process(target=worker... | VecEnv that runs multiple environments in parallel in subproceses and communicates with them via pipes.
Recommended to use when num_envs > 1 and step() can be a bottleneck. | 62598f93656771135c489301 |
class MembershipDeleteView(CustomUserMixin, DeleteView): <NEW_LINE> <INDENT> model = BuildingMembership <NEW_LINE> template_name = 'buildings/administrative/roles/membership_delete_confirm.html' <NEW_LINE> def test_func(self): <NEW_LINE> <INDENT> return RolesPermissions.can_edit_membership( user=self.request.user, memb... | Memberhips delete view. Users are redirected to a view
in which they will be asked about confirmation for
delete a membership definitely. | 62598f93d7e4931a7ef3bd23 |
class CustomUserAgentMiddleware(object): <NEW_LINE> <INDENT> def process_request(self, request, spider): <NEW_LINE> <INDENT> agent = random.choice(AGENTS) <NEW_LINE> request.headers['User-Agent'] = agent | docstring for CustomUserAgentMiddleware | 62598f93a05bb46b3848a500 |
class MoxMetaTestBase(type): <NEW_LINE> <INDENT> def __init__(cls, name, bases, d): <NEW_LINE> <INDENT> super(MoxMetaTestBase, cls).__init__(name, bases, d) <NEW_LINE> type.__init__(cls, name, bases, d) <NEW_LINE> for base in bases: <NEW_LINE> <INDENT> for attr_name in dir(base): <NEW_LINE> <INDENT> if attr_name not in... | Metaclass to add mox cleanup and verification to every test.
As the mox unit testing class is being constructed (MoxTestBase or a
subclass), this metaclass will modify all test functions to call the
CleanUpMox method of the test class after they finish. This means that
unstubbing and verifying will happen for every te... | 62598f933cc13d1c6d4653ed |
class Currency(decimal.Decimal): <NEW_LINE> <INDENT> def __new__(cls, value: Any) -> 'Currency': <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> value = decimal.Decimal(str(value)) <NEW_LINE> <DEDENT> except decimal.InvalidOperation: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> symbol = babel.numbers.get_currency_symbol(C... | A ``Decimal`` sub-class that knows how to handle currency for our app.
Adds a ``formatted_string`` method to represent a currency instance.
``Currency`` will convert any negative numbers to a positive number, which
is what is required by our calculations.
.. note::
When performing any operations (like addition, ... | 62598f9307f4c71912baf0cb |
class JsonFormatter(object): <NEW_LINE> <INDENT> def __init__(self, graph): <NEW_LINE> <INDENT> self.graph_def = graph.as_graph_def() <NEW_LINE> <DEDENT> def dump(self, json_path): <NEW_LINE> <INDENT> json_txt = json_format.MessageToJson(self.graph_def) <NEW_LINE> parsed = json.loads(json_txt) <NEW_LINE> formatted = js... | Dumpt a DL graph into a Json file. | 62598f937cff6e4e811b569c |
class itkMaskImageFilterICVF22IUL2ICVF22_Superclass(itkInPlaceImageFilterAPython.itkInPlaceImageFilterICVF22ICVF22): <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 constr... | Proxy of C++ itkMaskImageFilterICVF22IUL2ICVF22_Superclass class | 62598f9315baa72349461c00 |
class HardwareProfile(Model): <NEW_LINE> <INDENT> _validation = { 'hardware_type': {'readonly': True}, 'hana_instance_size': {'readonly': True}, } <NEW_LINE> _attribute_map = { 'hardware_type': {'key': 'hardwareType', 'type': 'str'}, 'hana_instance_size': {'key': 'hanaInstanceSize', 'type': 'str'}, } <NEW_LINE> def __i... | Specifies the hardware settings for the HANA instance.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar hardware_type: Name of the hardware type (vendor and/or their
product name). Possible values include: 'Cisco_UCS', 'HPE'
:vartype hardware_type: str or
~azure.mgmt.han... | 62598f93bde94217f37074a9 |
class PidWrapper(object): <NEW_LINE> <INDENT> REQUESTING = (100, "REQUESTING") <NEW_LINE> RUNNING = (500, "RUNNING") <NEW_LINE> TERMINATING = (600, "TERMINATING") <NEW_LINE> INVALID = (900, "INVALID") <NEW_LINE> REJECTED = (850, "REJECTED") <NEW_LINE> FAILED = (800, "FAILED") <NEW_LINE> EXITED = (1000, "EXITED") <NEW_L... | This class wraps a pidantic pid. The point of this class is to get an in-memory reference to the
users launch request in the event that the pidantic object failed to run. This minimzes lost messages
in the event of sqldb errors, supervisord errors, or pyon errors. | 62598f9330dc7b766599f4d4 |
@dataclass(frozen=True) <NEW_LINE> class Match(Parameterized): <NEW_LINE> <INDENT> pattern: Pattern <NEW_LINE> optional: bool = False <NEW_LINE> where: Optional[Where] = None <NEW_LINE> def __str__(self) -> str: <NEW_LINE> <INDENT> if self.optional: <NEW_LINE> <INDENT> if self.where: <NEW_LINE> <INDENT> return f"OPTION... | Match = [(O,P,T,I,O,N,A,L), SP], (M,A,T,C,H), [SP], Pattern, [[SP], Where] ; | 62598f9332920d7e50bc5ce1 |
class CommandNeedsAddCacheUpdater(Error): <NEW_LINE> <INDENT> pass | Command needs an AddCacheUpdater() call. | 62598f93f8510a7c17d7dfb8 |
class Client1Create(BaseClientAction): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def power_users(user, request, signed_request_data): <NEW_LINE> <INDENT> user.is_staff = True <NEW_LINE> user.save() <NEW_LINE> return Client1Create._send_email( _("power users"), user, request, signed_request_data ) <NEW_LINE> <DEDENT>... | Client 1 `USER_CREATE_CALLBACK` callbacks. | 62598f9345492302aabfc15a |
class ResizeArrowAnnotation(UserInteraction): <NEW_LINE> <INDENT> def __init__(self, document, *args, **kwargs): <NEW_LINE> <INDENT> UserInteraction.__init__(self, document, *args, **kwargs) <NEW_LINE> self.item = None <NEW_LINE> self.annotation = None <NEW_LINE> self.control = None <NEW_LINE> self.savedLine = None <NE... | Resize an Arrow Annotation interaction handler. | 62598f934428ac0f6e6581ac |
class DeviceWithStateState: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.swaggerTypes = { 'deviceId': 'integer', 'stateLabel': 'string, null' } <NEW_LINE> self.deviceId = None <NEW_LINE> self.stateLabel = None | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62598f9338b623060ffa8d0e |
class BigQuerySink(dataflow_io.NativeSink): <NEW_LINE> <INDENT> def __init__(self, table, dataset=None, project=None, schema=None, create_disposition=BigQueryDisposition.CREATE_IF_NEEDED, write_disposition=BigQueryDisposition.WRITE_EMPTY, validate=False, coder=None): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> from ap... | A sink based on a BigQuery table. | 62598f93287bf620b6271840 |
class ModSimDataFrame(pd.DataFrame): <NEW_LINE> <INDENT> column_constructor = ModSimSeries <NEW_LINE> row_constructor = ModSimSeries <NEW_LINE> def __init__(self, *args, **options): <NEW_LINE> <INDENT> super().__init__(*args, **options) <NEW_LINE> <DEDENT> def __getitem__(self, key): <NEW_LINE> <INDENT> obj = super()._... | ModSimDataFrame is a modified version of a Pandas DataFrame,
with a few changes to make it more suited to our purpose.
In particular:
1. DataFrame provides two special variables called
`dt` and `T` that cause problems if we try to use those names
as variables. I override them so they can be used as row labe... | 62598f93dc8b845886d53241 |
class ApiListApplicationUsersResponse(object): <NEW_LINE> <INDENT> swagger_types = { 'result': 'list[ApiGetApplicationUserResponse]', 'total_count': 'int' } <NEW_LINE> attribute_map = { 'result': 'result', 'total_count': 'totalCount' } <NEW_LINE> def __init__(self, result=None, total_count=None): <NEW_LINE> <INDENT> se... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62598f9355399d3f056261a1 |
class IAQ(): <NEW_LINE> <INDENT> RH0 = 40 <NEW_LINE> IAQ_RH = -1 <NEW_LINE> VOC0 = -1 <NEW_LINE> IAQ_VOC = -1 <NEW_LINE> IAQ = -1 <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> self.voc_24h = CRR_AVG(24, jfile = "voc_24h") <NEW_LINE> self.voc_60m = CRR_AVG(60, self.voc_24h) <NEW_LINE> self.voc_60s = CRR_AVG(60, sel... | Calculate the Indoor Air Quality from relative humidity and VOC.
By convention the baseline relative humidity is fixed at 40%. The VOC baseline uses
a 24 hour average. If we don't have that much VOC history just use what's been provided
so far as an approximation. Samples are expected at about 1 second intervals.
IA... | 62598f93adb09d7d5dc0a20a |
class GraphEdgeSizeMismatchError(GraphError): <NEW_LINE> <INDENT> def __init__(self, index, edge): <NEW_LINE> <INDENT> self.index = index <NEW_LINE> self.edge = edge <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return "Number of edges do not match at index %s, %s" % (str(self.index), str(sel... | Exception for number of output edges do not match the number of input
edges. | 62598f93dd821e528d6d8bb7 |
class User(object): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def create(cls, username, password, role=Role.user.name): <NEW_LINE> <INDENT> with DB.connect(**config.mysql) as cursor: <NEW_LINE> <INDENT> cursor.execute( 'INSERT INTO users ' '(username, password, role) ' 'VALUES (%s, %s, %s);', (username, str(Password(... | Service User Class | 62598f93498bea3a75a577ac |
class ArticlesTest(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.new_articles = Articles( 'Jonathan Shieber', 'Bitcoin has surged above $8,000 and theories around why abound', 'Bitcoin is now trading at around $8,130, up a whopping 60.84 percent over the past month, with the price su... | Test Class to test the behaviour of the Articles class | 62598f938e71fb1e983bb737 |
class SystemError(Exception): <NEW_LINE> <INDENT> pass | SystemError. | 62598f937cff6e4e811b569e |
@unique <NEW_LINE> class SymbolSmall(IntEnum): <NEW_LINE> <INDENT> LSRG = Symbol.LSRG <NEW_LINE> MSNG = Symbol.MSNG <NEW_LINE> MSRS = Symbol.MSRS <NEW_LINE> MTLR = Symbol.MTLR <NEW_LINE> MTLRP = Symbol.MTLRP <NEW_LINE> OGKB = Symbol.OGKB <NEW_LINE> PIKK = Symbol.PIKK <NEW_LINE> RTKM = Symbol.RTKM <NEW_LINE> RTKM... | Symbols (from SymbolMoex minus SymbolNight) with history candles starting from 2011. | 62598f9315baa72349461c02 |
@dataclass <NEW_LINE> class PureEnergieSensorEntityDescriptionMixin: <NEW_LINE> <INDENT> value_fn: Callable[[PureEnergieData], int | float] | Mixin for required keys. | 62598f939b70327d1c57ea24 |
class ManagerWithPublished(Manager): <NEW_LINE> <INDENT> def published(self): <NEW_LINE> <INDENT> return self.get_query_set().filter(status__gte=2, publish__lte=datetime.datetime.now()) | Same as above but for more for templates | 62598f93379a373c97d98c9b |
class MinistrySource(SpecializedSource): <NEW_LINE> <INDENT> def __init__(self, value_field): <NEW_LINE> <INDENT> self.value_field = value_field <NEW_LINE> <DEDENT> def construct_query(self, context): <NEW_LINE> <INDENT> session = Session() <NEW_LINE> trusted = removeSecurityProxy(context) <NEW_LINE> ministry_id = geta... | Ministries in the current chamber.
| 62598f9332920d7e50bc5ce3 |
class StreamingPropertyFilesTest(PropertyFilesTestCase): <NEW_LINE> <INDENT> def test_init(self): <NEW_LINE> <INDENT> property_files = StreamingPropertyFiles() <NEW_LINE> self.assertEqual('ota-streaming-property-files', property_files.name) <NEW_LINE> self.assertEqual( ( 'payload.bin', 'payload_properties.txt', ), prop... | Additional validity checks specialized for StreamingPropertyFiles. | 62598f93097d151d1a2c0cb0 |
class PyAuthorize_addressTest(PyAuthorizeTest): <NEW_LINE> <INDENT> def test__address(self): <NEW_LINE> <INDENT> address = "351 W Hubbard St. Suite 500 '/&#-,." <NEW_LINE> self.pp.address = address <NEW_LINE> response = self.pp._address() <NEW_LINE> tools.assert_equal(address, response) <NEW_LINE> <DEDENT> @tools.raise... | Tests pertaining to _address. | 62598f93e64d504609df91f8 |
class Cadastro: <NEW_LINE> <INDENT> def criar_arq(self, ): <NEW_LINE> <INDENT> arquivo = open('PythonHBSIS/Aula.23/cadastro2.txt','a') <NEW_LINE> arquivo.write ('test \n') <NEW_LINE> arquivo.close() | Classe de Cadastro | 62598f9316aa5153ce400185 |
class Parameter(Component, Symbol): <NEW_LINE> <INDENT> def __new__(cls, name, value=0.0, nonnegative=True, integer=False, _export=True): <NEW_LINE> <INDENT> return super(Parameter, cls).__new__(cls, name, real=True, nonnegative=nonnegative, integer=integer) <NEW_LINE> <DEDENT> def __getnewargs__(self): <NEW_LINE> <IND... | Model component representing a named constant floating point number.
Parameters are used as reaction rate constants, compartment volumes and
initial (boundary) conditions for species.
Parameters
----------
value : number, optional
The numerical value of the parameter. Defaults to 0.0 if not specified.
The pro... | 62598f93a79ad16197769ce4 |
class CreateTableRequest(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.TableInfo = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> if params.get("TableInfo") is not None: <NEW_LINE> <INDENT> self.TableInfo = TableInfo() <NEW_LINE> self.TableInfo._deseriali... | CreateTable请求参数结构体
| 62598f9394891a1f408b9532 |
class ComputeDisksDeleteRequest(_messages.Message): <NEW_LINE> <INDENT> disk = _messages.StringField(1, required=True) <NEW_LINE> project = _messages.StringField(2, required=True) <NEW_LINE> requestId = _messages.StringField(3) <NEW_LINE> zone = _messages.StringField(4, required=True) | A ComputeDisksDeleteRequest object.
Fields:
disk: Name of the persistent disk to delete.
project: Project ID for this request.
requestId: An optional request ID to identify requests. Specify a unique
request ID so that if you must retry your request, the server will know
to ignore the request if it has a... | 62598f9338b623060ffa8d10 |
class BootErrorsTest(Test): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(BootErrorsTest, self).__init__( { "type": "exec", "operation": "readBootErrors", "mbean": "jboss.as:core-service=management" } ) <NEW_LINE> self.__disableBootErrorsCheck = os.getenv("PROBE_DISABLE_BOOT_ERRORS_CHECK", "false").... | Checks the server for boot errors. | 62598f93090684286d59351a |
class BatchNorm2d(nn.BatchNorm2d): <NEW_LINE> <INDENT> def __init__(self, num_features, eps=1e-5, momentum=0.1, affine=True, track_running_stats=True): <NEW_LINE> <INDENT> super(BatchNorm2d, self).__init__( num_features, eps=eps, momentum=momentum, affine=affine, track_running_stats=track_running_stats) <NEW_LINE> self... | BatchNorm2d with automatic multi-GPU Sync | 62598f93287bf620b6271842 |
class UserAuthBackend(object): <NEW_LINE> <INDENT> def authenticate(self, username=None, password=None): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> user = get_user_model().objects.get(login=username) <NEW_LINE> if user.check_password(password): <NEW_LINE> <INDENT> return user <NEW_LINE> <DEDENT> <DEDENT> except get_u... | User Authentication Backend | 62598f93bd1bec0571e14f06 |
class AbstractPoolingLayer(AbstractConvolutionalLayer): <NEW_LINE> <INDENT> def __init__(self, tile_shape, func=numpy.amax, overlap_tiles=False): <NEW_LINE> <INDENT> super().__init__(tile_shape, overlap_tiles) <NEW_LINE> self.func = func <NEW_LINE> <DEDENT> def process(self, inputs, remember_inputs=False): <NEW_LINE> <... | Implements a pooling layer for a neural net,
which divides an input matrix/vector into 'tiles'
and then performs a particular function on each tile
to compute the layer's output. | 62598f9326068e7796d4c5e6 |
class V1EndpointsList(object): <NEW_LINE> <INDENT> def __init__(self, api_version=None, items=None, kind=None, metadata=None): <NEW_LINE> <INDENT> self.swagger_types = { 'api_version': 'str', 'items': 'list[V1Endpoints]', 'kind': 'str', 'metadata': 'V1ListMeta' } <NEW_LINE> self.attribute_map = { 'api_version': 'apiVer... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62598f9355399d3f056261a3 |
class CropVolumeSequenceTest(ScriptedLoadableModuleTest): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> slicer.mrmlScene.Clear(0) <NEW_LINE> <DEDENT> def runTest(self): <NEW_LINE> <INDENT> self.setUp() <NEW_LINE> self.test_CropVolumeSequence1() <NEW_LINE> <DEDENT> def test_CropVolumeSequence1(self): <NEW_LIN... | This is the test case for your scripted module.
Uses ScriptedLoadableModuleTest base class, available at:
https://github.com/Slicer/Slicer/blob/master/Base/Python/slicer/ScriptedLoadableModule.py | 62598f93be383301e0253489 |
class ActiveNode(ABC, Node): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super().__init__(*args, **kwargs) <NEW_LINE> if self.state is None: <NEW_LINE> <INDENT> self.state = Start <NEW_LINE> <DEDENT> <DEDENT> def can_go(self) -> bool: <NEW_LINE> <INDENT> return not self.is_dormant() <NE... | A node that is capable of generating Action objects.
An ActiveNode always has a .state member, of type ActiveNodeState. | 62598f933539df3088ecbf44 |
class Role(db.Model): <NEW_LINE> <INDENT> __tablename__ = 'roles' <NEW_LINE> id = db.Column(db.Integer, primary_key=True) <NEW_LINE> name = db.Column(db.String(60), unique=True) <NEW_LINE> description = db.Column(db.String(200)) <NEW_LINE> employees = db.relationship('Employee', backref='role', lazy='dynamic') <NEW_LIN... | Create a Role table | 62598f93a05bb46b3848a503 |
class TestHeader(unittest.TestCase): <NEW_LINE> <INDENT> def test_add_and_get(self): <NEW_LINE> <INDENT> chunk = Chunk() <NEW_LINE> record1 = b'china' <NEW_LINE> record2 = b'usa' <NEW_LINE> record3 = b'russia' <NEW_LINE> chunk.add(record1) <NEW_LINE> chunk.add(record2) <NEW_LINE> chunk.add(record3) <NEW_LINE> self.asse... | Test chunk.py
| 62598f936e29344779b002de |
class VolumeReplicationController(wsgi.Controller): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(VolumeReplicationController, self).__init__(*args, **kwargs) <NEW_LINE> self.volume_api = volume.API() <NEW_LINE> self.replication_api = replicationAPI.API() <NEW_LINE> <DEDENT> def _ad... | The Volume Replication API controller for the Openstack API. | 62598f93596a897236127902 |
class TestValidateIP(object): <NEW_LINE> <INDENT> @pytest.mark.parametrize("ip", ("123.123.123.123", "68.62.43.1", "8.8.8.8")) <NEW_LINE> def test_valid(self, ip): <NEW_LINE> <INDENT> validate_ip(ip) <NEW_LINE> <DEDENT> @pytest.mark.parametrize("ip", ("0.0.0.-1", "255.255.255.256", "not an ip address")) <NEW_LINE> def ... | IP validation test cases. | 62598f93be8e80087fbbece3 |
class Employee: <NEW_LINE> <INDENT> def __init__(self, attributes): <NEW_LINE> <INDENT> self.id = int(float(attributes.get("id"))) <NEW_LINE> self.department = int(float(attributes.get("department"))) <NEW_LINE> self.cost_center = int(float(attributes.get("cost_center"))) <NEW_LINE> self.manager_id = int(float(attribut... | This class encapsulates a employees information.
The class takes in attributes that represent information specific to every employee working at
Google that can be found on their go/who. These attributes are anonymized integers
that represent each piece of information.
Attributes:
id
department
cost_center... | 62598f93f7d966606f747c69 |
class ModelMultipleChoiceField(MultipleChoiceField): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> self.model = kwargs['choices'].queryset.model <NEW_LINE> super().__init__(*args, **kwargs) <NEW_LINE> <DEDENT> def to_internal_value(self, data): <NEW_LINE> <INDENT> if data: <NEW_LINE> <IND... | Multiple Model Choices Field for Django Rest Framework
Changes list of integer data to Django Model queryset | 62598f9316aa5153ce400186 |
class CardinalSpline(object): <NEW_LINE> <INDENT> def __init__(self, pts, tension = -0.5, continuity=0.0, bias=0.0): <NEW_LINE> <INDENT> self.pts = pts <NEW_LINE> self.tension = tension <NEW_LINE> self.continuity = continuity <NEW_LINE> self.bias = bias <NEW_LINE> <DEDENT> def __call__(self, t): <NEW_LINE> <INDENT> p0 ... | Represent a spline going through a series of points. Evaluable
at any (fractional) point from 0...len(pts) | 62598f93e64d504609df91f9 |
class FindSubStrTask(BaseTask): <NEW_LINE> <INDENT> def __init__(self, base): <NEW_LINE> <INDENT> super(type(self), self).__init__() <NEW_LINE> assert base >= 27 <NEW_LINE> self.base = base <NEW_LINE> self.eos = 0 <NEW_LINE> self.find_str = [1, 2] <NEW_LINE> self.input_type = IOType.string <NEW_LINE> self.output_type =... | Find sub-string coding task.
Code needs to output a bool: True if the input string contains a hard-coded
substring, 'AB' (values [1, 2]). | 62598f9323849d37ff850d4b |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.