code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
@unittest.skipIf(skipTestsSettings.long, "Long tests") <NEW_LINE> @patch("logging.Logger.debug") <NEW_LINE> @patch("logging.Logger.info") <NEW_LINE> @patch("logging.Logger.warning") <NEW_LINE> @patch("logging.Logger.exception") <NEW_LINE> class TestWebImportMethods(unittest.TestCase): <NEW_LINE> <INDENT> def test_prope... | Test the functions that writes bibtexs. | 62598f8e45492302aabfc0d4 |
class NominatimReverse(NominatimRequest): <NEW_LINE> <INDENT> def __init__(self, base_url=None): <NEW_LINE> <INDENT> super(NominatimReverse, self).__init__(base_url) <NEW_LINE> self.url += '/reverse?format=json' <NEW_LINE> <DEDENT> def query(self, lat=None, lon=None, osm_id=None, osm_type=None, acceptlanguage='', zoom=... | Connections to a Nominatim instance for querying by
geographical coordinates
Cf. Nominatim documentation::
http://wiki.openstreetmap.org/wiki/Nominatim#Reverse_Geocoding_.2F_Address_lookup | 62598f8e96565a6dacd2cd77 |
class JSONWebTokenSerializer(Serializer): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(JSONWebTokenSerializer, self).__init__(*args, **kwargs) <NEW_LINE> self.fields[self.username_field] = serializers.CharField() <NEW_LINE> self.fields['password'] = PasswordField(write_only=True) <... | Serializer class used to validate a username and password.
'username' is identified by the custom UserModel.USERNAME_FIELD.
Returns a JSON Web Token that can be used to authenticate later calls. | 62598f8e009cb60464d0112a |
class APIClient: <NEW_LINE> <INDENT> class APIException(UserException): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> baseurl = "https://openexchangerates.org/api" <NEW_LINE> def __init__(self, apikey: str) -> None: <NEW_LINE> <INDENT> self.__apikey = apikey <NEW_LINE> <DEDENT> def get(self, uri, params) -> HTTPResponse... | Defines an API client. | 62598f8e2ae34c7f260aace3 |
class DestinationsTests(TestCase): <NEW_LINE> <INDENT> def test_send(self): <NEW_LINE> <INDENT> destinations = Destinations() <NEW_LINE> message = {"hoorj": "blargh"} <NEW_LINE> dest = [] <NEW_LINE> dest2 = [] <NEW_LINE> destinations.add(dest.append) <NEW_LINE> destinations.add(dest2.append) <NEW_LINE> destinations.sen... | Tests for L{Destinations}. | 62598f8ecc0a2c111447ac0c |
class Idea(AuditMixin, Base): <NEW_LINE> <INDENT> __tablename__ = 'idea' <NEW_LINE> id = Column(Integer, primary_key=True) <NEW_LINE> _forked_from_id = Column('forked_from_id', Integer, ForeignKey('idea.id')) <NEW_LINE> _owner_id = Column('owner_id', Integer, ForeignKey('user.id')) <NEW_LINE> title = Column(String(200)... | Information for a specific Idea | 62598f8e4e696a045264dc05 |
class GetLastID(AdminService): <NEW_LINE> <INDENT> class SimpleIO(AdminSIO): <NEW_LINE> <INDENT> request_elem = 'zato_kvdb_data_dict_dictionary_get_last_id_request' <NEW_LINE> response_elem = 'zato_kvdb_data_dict_dictionary_get_last_id_response' <NEW_LINE> output_optional = Int('value') <NEW_LINE> <DEDENT> def handle(s... | Returns the value of the last dictionary's ID or nothing at all if the key for holding its value doesn't exist.
| 62598f8e0c0af96317c55f80 |
class UserCreationForm(forms.ModelForm): <NEW_LINE> <INDENT> password1 = forms.CharField(label='Password', widget=forms.PasswordInput) <NEW_LINE> password2 = forms.CharField(label='Password confirmation', widget=forms.PasswordInput) <NEW_LINE> class Meta: <NEW_LINE> <INDENT> model = MyUser <NEW_LINE> fields = ('email',... | A form for creating new users. Includes all the required
fields, plus a repeated password. | 62598f8ea17c0f6771d5be38 |
class RegisterCity(object): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def register(cls, email, nickname, password): <NEW_LINE> <INDENT> if not cls._user_email_is_valid(email): <NEW_LINE> <INDENT> return RegisterResult.INVALID_EMAIL <NEW_LINE> <DEDENT> elif UsersService.user_with_email_already_exists(email): <NEW_LINE... | Manages the logic of registering
I N T E R F A C E G U A R A N T E E D
---------------------------------------
register(email, nickname, password):
-- Register a user if the email is valid and doesn't yet exist
-- Returns a RegisterResult describing what happened | 62598f8e94891a1f408b94ee |
class DiceLoss(nn.Module): <NEW_LINE> <INDENT> def __init__(self) -> None: <NEW_LINE> <INDENT> super(DiceLoss, self).__init__() <NEW_LINE> self.eps: float = 1e-6 <NEW_LINE> <DEDENT> def forward( self, input: torch.Tensor, target: torch.Tensor) -> torch.Tensor: <NEW_LINE> <INDENT> if not torch.is_tensor(input): <NEW_LIN... | Criterion that computes Sørensen-Dice Coefficient loss.
According to [1], we compute the Sørensen-Dice Coefficient as follows:
.. math::
\text{Dice}(x, class) = \frac{2 |X| \cap |Y|}{|X| + |Y|}
where:
- :math:`X` expects to be the scores of each class.
- :math:`Y` expects to be the one-hot tensor with the... | 62598f8e23e79379d538c0ff |
class TestDoubleCanDoubleRealNumber(SimpleTestCase): <NEW_LINE> <INDENT> def test_double_four(self): <NEW_LINE> <INDENT> response = self.client.post( path=reverse('double'), data={'your_num': '4'}) <NEW_LINE> self.assertEqual(response.context['answer'], 8) <NEW_LINE> <DEDENT> def test_double_eight(self): <NEW_LINE> <IN... | If you POST double with an int or float, it should
render double.html with double that number as 'answer'
in the context. | 62598f8e4428ac0f6e658124 |
class Class3(meta.ProtocoledClass): <NEW_LINE> <INDENT> pass | message Class3 {
message Class1 {
required int32 a = 1;
}
required Class1 c = 3;
} | 62598f8e8e7ae83300ee8ca1 |
class Declaration(DocType): <NEW_LINE> <INDENT> general = Object( properties={ 'full_name_suggest': Completion(preserve_separators=False), 'full_name': String(index='analyzed'), 'name': String(index='analyzed'), 'patronymic': String(index='analyzed'), 'last_name': String(index='analyzed'), 'family_raw': String(index='a... | Declaration document.
Assumes there's a dynamic mapping with all fields not indexed by default. | 62598f8e85dfad0860cbf870 |
class AddonsComponent: <NEW_LINE> <INDENT> def __init__(self, vass: VoiceAssistant) -> None: <NEW_LINE> <INDENT> self._vass = vass <NEW_LINE> for addon in _INTERNAL_ADDONS: <NEW_LINE> <INDENT> self.add(addon) <NEW_LINE> <DEDENT> <DEDENT> def add(self, addon: Addon) -> None: <NEW_LINE> <INDENT> method = self._get_core_a... | Addons Component. | 62598f8eb57a9660fecd167d |
class AliasTests(unittest.TestCase): <NEW_LINE> <INDENT> def test_mirrors_attribute_on_class(self): <NEW_LINE> <INDENT> class Thing: <NEW_LINE> <INDENT> one = 4 <NEW_LINE> two = alias('one') <NEW_LINE> <DEDENT> thing = Thing() <NEW_LINE> thing.two <NEW_LINE> self.assertEqual(thing.one, 4) <NEW_LINE> self.assertEqual(th... | Tests for alias. | 62598f8e462c4b4f79dbb602 |
class ObjectSetResultSet(ResultSet): <NEW_LINE> <INDENT> def getJSONFromString(self, str): <NEW_LINE> <INDENT> return json.loads(str) <NEW_LINE> <DEDENT> def get_Response(self): <NEW_LINE> <INDENT> return self._output.get('Response', None) | A ResultSet with methods tailored to the values returned by the ObjectSet Choreo.
The ResultSet object is used to retrieve the results of a Choreo execution. | 62598f8eb830903b9686e272 |
class TokenType(HtmlTagType): <NEW_LINE> <INDENT> WORD = 0 | constants for token types | 62598f8e1f037a2d8b9e3cdb |
class CalendarManager(models.Manager): <NEW_LINE> <INDENT> def get_calendar_for_object(self, obj, distinction=None): <NEW_LINE> <INDENT> calendar_list = self.get_calendars_for_object(obj, distinction) <NEW_LINE> if len(calendar_list) == 0: <NEW_LINE> <INDENT> raise Calendar.DoesNotExist("Calendar does not exist.") <NEW... | >>> user1 = User(username='tony')
>>> user1.save() | 62598f8eeab8aa0e5d30b97b |
class _ReuseCycle(object): <NEW_LINE> <INDENT> def __init__(self, x): <NEW_LINE> <INDENT> self.indices = list() <NEW_LINE> self.popped = dict() <NEW_LINE> assert len(x) > 0 <NEW_LINE> self.x = x <NEW_LINE> <DEDENT> def __iter__(self): <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> yield self.__next__() <NEW_LINE> ... | Cycle over a variable, preferring to reuse earlier indices.
Requires the values in ``x`` to be hashable and unique. This holds
nicely for matplotlib's color cycle, which gives HTML hex color strings. | 62598f8e30dc7b766599f458 |
class Stack: <NEW_LINE> <INDENT> def __init__(self, backing_dir): <NEW_LINE> <INDENT> self.backing_dir = Path(backing_dir) <NEW_LINE> assert self.backing_dir.is_dir() <NEW_LINE> <DEDENT> def top(self, n): <NEW_LINE> <INDENT> content = list(self.backing_dir.iterdir()) <NEW_LINE> content = filter(lambda p: not p.name.sta... | A stack of not yet managed documents | 62598f8e82261d6c5272fcd5 |
class AccountType(Enum): <NEW_LINE> <INDENT> undefined = auto() <NEW_LINE> exchange = auto() <NEW_LINE> margin = auto() <NEW_LINE> combined = auto() | Account Type
https://github.com/fund3/OmegaProtocol/blob/master/TradeMessage.capnp | 62598f8e96565a6dacd2cd78 |
class Kernel(object): <NEW_LINE> <INDENT> def _pairwise(self,x,y): <NEW_LINE> <INDENT> return ( np.tile(x,(len(y),1,1)).transpose(1,0,2), np.tile(y,(len(x),1,1)) ) | Base class for kernel function | 62598f8efbf16365ca793caf |
class UnknownPackageError(Error): <NEW_LINE> <INDENT> pass | Represents an exception when encountering an unsupported Android APK. | 62598f8f0c0af96317c55f82 |
class Winery(Base): <NEW_LINE> <INDENT> __tablename__ = 'wineries' <NEW_LINE> id = Column(Integer, primary_key=True) <NEW_LINE> name = Column(String(60), nullable=False) <NEW_LINE> address = Column(String(100)) <NEW_LINE> website = Column(String(150)) <NEW_LINE> onStNicks = Column(Boolean, default=False) <NEW_LINE> hou... | Summary of City Class.
Object that contains information about a City
Attributes:
id: An integer representing a unique identifier for the city
user_id: An integer representing the id of the user who create it
name: A string representing the name of the city
state_provence: A string representing the sta... | 62598f8f7b25080760ed70ad |
class TimeGetPixelData_LargeDataset: <NEW_LINE> <INDENT> def setup(self): <NEW_LINE> <INDENT> self.no_runs = 100 <NEW_LINE> self.ds_16_3_100 = dcmread(_create_temporary_dataset()) <NEW_LINE> <DEDENT> def time_large_dataset(self): <NEW_LINE> <INDENT> for ii in range(self.no_runs): <NEW_LINE> <INDENT> get_pixeldata(self.... | Time tests for numpy_handler.get_pixeldata with large datasets. | 62598f8fa219f33f346c6419 |
class FlowQuery(metaclass=abc.ABCMeta): <NEW_LINE> <INDENT> @abc.abstractmethod <NEW_LINE> def lookup(self): <NEW_LINE> <INDENT> raise NotImplementedError() | Flow Lookup interface | 62598f8fec188e330fdf84a0 |
class site_locator: <NEW_LINE> <INDENT> def context_find(self, site_self, locator_value): <NEW_LINE> <INDENT> with context_if(self.no_highlight, site_self.temp_no_highlight): <NEW_LINE> <INDENT> with context_if(self.is_safe, site_self.without_wait): <NEW_LINE> <INDENT> return site_self.driver.find_element(self.locator_... | lazy evaluated class descriptor for locators evaluated every time it is called (no caching in this method).
| 62598f8fc432627299fa2bce |
class IndexRecord(Base): <NEW_LINE> <INDENT> __tablename__ = "index_record" <NEW_LINE> did = Column(String, primary_key=True) <NEW_LINE> baseid = Column(String, ForeignKey("base_version.baseid"), index=True) <NEW_LINE> rev = Column(String) <NEW_LINE> form = Column(String) <NEW_LINE> size = Column(BigInteger, index=True... | Base index record representation. | 62598f8fa79ad16197769c66 |
class LoadBalancingPolicy(object): <NEW_LINE> <INDENT> def distance(self, host): <NEW_LINE> <INDENT> raise NotImplementedError() <NEW_LINE> <DEDENT> def populate(self, cluster, hosts): <NEW_LINE> <INDENT> raise NotImplementedError() <NEW_LINE> <DEDENT> def make_query_plan(self, working_keyspace=None, query=None): <NEW_... | Load balancing policies are used to decide how to distribute
requests among all possible coordinator nodes in the cluster.
In particular, they may focus on querying "near" nodes (those
in a local datacenter) or on querying nodes who happen to
be replicas for the requested data.
You may also use subclasses of :class:`... | 62598f8fb5575c28eb712acb |
class UpperBound(ElemwiseTransform): <NEW_LINE> <INDENT> name = "upperbound" <NEW_LINE> def __init__(self, b): <NEW_LINE> <INDENT> self.b = tt.as_tensor_variable(b) <NEW_LINE> <DEDENT> def backward(self, x): <NEW_LINE> <INDENT> b = self.b <NEW_LINE> r = b - tt.exp(x) <NEW_LINE> return r <NEW_LINE> <DEDENT> def forward(... | Transform from real line interval [-inf,b] to whole real line. | 62598f8fcb5e8a47e493bf70 |
class PollResponse(ModelBase): <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> super(PollResponse, self).__init__(**kwargs) | The response by person (or anonymous), will have a collection of answers | 62598f8f8e7ae83300ee8ca3 |
class GridTemplate(object): <NEW_LINE> <INDENT> def __init__(self, template_id, nrows, ncols): <NEW_LINE> <INDENT> self.template_id = template_id <NEW_LINE> self.nrows = nrows <NEW_LINE> self.ncols = ncols <NEW_LINE> self.gframes = {} <NEW_LINE> <DEDENT> def __getitem__(self, key): <NEW_LINE> <INDENT> nrows, ncols = se... | User defined grid system which will map to pdf page template. uses numpy style slicing to define GridFrames | 62598f8fd6c5a102081e1d46 |
class KerasNode(AegisNode): <NEW_LINE> <INDENT> def __init__(self, model, input_url, input_shape=None): <NEW_LINE> <INDENT> super().__init__(inputs=input_url) <NEW_LINE> self.model = model <NEW_LINE> self.input_shape = self.model.input_shape[1:] if input_shape is None else input_shape <NEW_LINE> <DEDENT> def update(sel... | Use a Keras model as an inference node
provide input_shape to replace Nones with np.zeros for partially-defined
input shapes | 62598f8f0a50d4780f704fd2 |
class ToTensor(object): <NEW_LINE> <INDENT> def __call__(self, sample): <NEW_LINE> <INDENT> return torch.from_numpy(np.array(sample)) | Convert ndarrays in sample to Tensors. | 62598f8fd53ae8145f91808b |
class BanLogParser: <NEW_LINE> <INDENT> def __init__(self, interval, log_file): <NEW_LINE> <INDENT> self.interval = interval <NEW_LINE> self.log_file = log_file <NEW_LINE> self.data = list() <NEW_LINE> self.last_update = dt_util.now() <NEW_LINE> self.ip_regex = dict() <NEW_LINE> <DEDENT> def timer(self): <NEW_LINE> <IN... | Class to parse fail2ban logs. | 62598f8f7cff6e4e811b5617 |
class ActionDeserializer(CommonDeserializer): <NEW_LINE> <INDENT> def default(self, string): <NEW_LINE> <INDENT> dom = xmlutil.safe_minidom_parse_string(string) <NEW_LINE> action_node = dom.childNodes[0] <NEW_LINE> action_name = action_node.tagName <NEW_LINE> action_deserializer = { 'create_image': self._action_create_... | Deserializer to handle xml-formatted server action requests.
Handles standard server attributes as well as optional metadata
and personality attributes | 62598f8f379a373c97d98c19 |
@endpoint("openapi/trade/v1/messages") <NEW_LINE> class GetTradeMessages(Trading): <NEW_LINE> <INDENT> @dyndoc_insert(responses) <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> super(GetTradeMessages, self).__init__() | Get trade messages for the current user. | 62598f8f45492302aabfc0d8 |
class Class(object): <NEW_LINE> <INDENT> mnemonic = None <NEW_LINE> long_name = None <NEW_LINE> value = 0 | RR Class base class
Subclass this to implement individual RR classes. | 62598f8f10dbd63aa1c707bb |
class NodeInitTests(make_with_init_tests( record_type=Node, kwargs=dict(uuid=uuid4(), applications={a.name: a for a in [ Application(name=u'mysql-clusterhq', image=DockerImage.from_string( u"image")), Application(name=u'site-clusterhq.com', image=DockerImage.from_string(u"another")), ]}) )): <NEW_LINE> <INDENT> def tes... | Tests for ``Node.__init__``. | 62598f8fe76e3b2f99fd8634 |
class TestBaseType: <NEW_LINE> <INDENT> @pytest.fixture <NEW_LINE> def basetype(self): <NEW_LINE> <INDENT> return configtypes.BaseType() <NEW_LINE> <DEDENT> @pytest.mark.parametrize('val, expected', [ ('foobar', 'foobar'), ('', None), ]) <NEW_LINE> def test_transform(self, basetype, val, expected): <NEW_LINE> <INDENT> ... | Test BaseType. | 62598f8f15fb5d323ce7e930 |
class Greeting(ndb.Model): <NEW_LINE> <INDENT> id2 = ndb.GenericProperty(indexed=True) <NEW_LINE> author = ndb.UserProperty() <NEW_LINE> name = ndb.StringProperty(indexed=True) <NEW_LINE> fname = ndb.StringProperty(indexed=False) <NEW_LINE> email = ndb.StringProperty(indexed=False) <NEW_LINE> content = ndb.StringProper... | Models an individual Guestbook entry with author, content, and date. | 62598f8fdd821e528d6d8b33 |
class approvalProcessorGCNCreationCheck(esUtils.EventSupervisorTask): <NEW_LINE> <INDENT> description = "a check that approval processor created the expected GCN" <NEW_LINE> name = "approvalProcessorGCNCreation" <NEW_LINE> def approvalProcessorGCNCreation(self, graceid, gdb, verbose=False, annotate=False, **kwar... | NOT IMPLEMENTED | 62598f8f15baa72349461b7d |
class UI: <NEW_LINE> <INDENT> def __init__(self, minitel, posx, posy, largeur, hauteur, couleur): <NEW_LINE> <INDENT> assert isinstance(minitel, Minitel) <NEW_LINE> assert posx > 0 and posx <= 80 <NEW_LINE> assert posy > 0 and posy <= 24 <NEW_LINE> assert largeur > 0 and largeur + posx - 1 <= 80 <NEW_LINE> assert haute... | Classe de base pour la création d’élément d’interface utilisateur
Cette classe fournit un cadre de fonctionnement pour la création d’autres
classes pour réaliser une interface utilisateur.
Elle instaure les attributs suivants :
- posx et posy : coordonnées haut gauche de l’élément
- largeur et hauteur : dimensions e... | 62598f8fcad5886f8bdc4e8c |
class TestCookiecutterSubstitution(DjangoCookieTestCase): <NEW_LINE> <INDENT> def test_default_configuration(self): <NEW_LINE> <INDENT> self.generate_project() <NEW_LINE> <DEDENT> def test_flake8_compliance(self): <NEW_LINE> <INDENT> self.generate_project() <NEW_LINE> try: <NEW_LINE> <INDENT> sh.flake8(self.destpath) <... | Test that all cookiecutter instances are substituted | 62598f8fa219f33f346c641b |
class IcloudDeviceBatterySensor(SensorEntity): <NEW_LINE> <INDENT> _attr_device_class = DEVICE_CLASS_BATTERY <NEW_LINE> _attr_native_unit_of_measurement = PERCENTAGE <NEW_LINE> def __init__(self, account: IcloudAccount, device: IcloudDevice) -> None: <NEW_LINE> <INDENT> self._account = account <NEW_LINE> self._device =... | Representation of a iCloud device battery sensor. | 62598f8f097d151d1a2c0c2b |
class FacebookException(AuthException): <NEW_LINE> <INDENT> status_code = 400 <NEW_LINE> def __init__(self, result): <NEW_LINE> <INDENT> self.message = result['error']['message'] <NEW_LINE> self.result = result <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return self.message | Facebook exception. | 62598f8f63b5f9789fe84d75 |
class DetteOrRemboursementCreateView(UserPassesTestMixin, CreateView): <NEW_LINE> <INDENT> def test_func(self): <NEW_LINE> <INDENT> if not self.request.user.is_authenticated: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> self.occasion = get_object_or_404(Occasion, slug=self.kwargs["oc_slug"]) <NEW_LINE> return (... | Mixin to for model create views. | 62598f8f16aa5153ce400109 |
class GatewayService: <NEW_LINE> <INDENT> name = 'gateway_service' <NEW_LINE> airports_rpc = RpcProxy('airports_service') <NEW_LINE> routes_rpc = RpcProxy('routes_service') <NEW_LINE> @http('GET', '/airport/<string:airport_id>') <NEW_LINE> def get_airport(self, request, airport_id): <NEW_LINE> <INDENT> airport = self.a... | The Gateway microservice will receive HTTP requests via a simple REST-like
API and use RPC to communicate with Airports and Trips. | 62598f8fe64d504609df91b5 |
class CmsMapperExt(MapperExtension): <NEW_LINE> <INDENT> def before_update(self, mapper, connection, instance): <NEW_LINE> <INDENT> return EXT_PASS | will update children count etc | 62598f8f4e4d56256637202a |
class CMSRandomEntriesPlugin(ZinniaCMSPluginBase): <NEW_LINE> <INDENT> model = RandomEntriesPlugin <NEW_LINE> name = _('Random entries') <NEW_LINE> render_template = 'cmsplugin_zinnia/random_entries.html' <NEW_LINE> fields = ('number_of_entries', 'template_to_render') <NEW_LINE> def render(self, context, instance, plac... | Plugin for including random entries | 62598f8fb830903b9686e274 |
class PullRequestReview(github.GithubObject.CompletableGithubObject): <NEW_LINE> <INDENT> def __repr__(self): <NEW_LINE> <INDENT> return self.get__repr__({"id": self._id.value, "user": self._user.value}) <NEW_LINE> <DEDENT> @property <NEW_LINE> def id(self): <NEW_LINE> <INDENT> self._completeIfNotSet(self._id) <NEW_LIN... | This class represents PullRequestReviews. The reference can be found here https://developer.github.com/v3/pulls/reviews/ | 62598f8f8e71fb1e983bb6b5 |
class PlaneGame(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.screen = pygame.display.set_mode(SCREEN_RECT.size) <NEW_LINE> self.clock = pygame.time.Clock() <NEW_LINE> self.__create_sprites() <NEW_LINE> pygame.time.set_timer(CREATE_ENEMY_EVENT, 800) <NEW_LINE> pygame.time.set_timer(HERO_FIRE... | 飞机大战主程序 | 62598f8f7cff6e4e811b5619 |
class LSTMCellStack(nn.Module): <NEW_LINE> <INDENT> def __init__(self, input_size: int, hidden_size: List[int]): <NEW_LINE> <INDENT> super(LSTMCellStack, self).__init__() <NEW_LINE> self.input_size = input_size <NEW_LINE> self.hidden_size = hidden_size <NEW_LINE> self.num_layers = len(hidden_size) <NEW_LINE> cells = ... | This module is a stack of LSTMCell: instead of receiving an
entire sequence in input as torch.nn.LSTM does, it accepts one
element at a time. | 62598f8f379a373c97d98c1b |
class BufferCommand(object): <NEW_LINE> <INDENT> MEMENTO_INSERT, MEMENTO_REPLACE = list(range(2)) <NEW_LINE> def __init__(self, buffer): <NEW_LINE> <INDENT> self._buffer = buffer <NEW_LINE> self._document = buffer.document <NEW_LINE> self._cursor = buffer.cursor <NEW_LINE> self._line_memento_data = [] <NEW_LINE> self._... | A base class for commands modifying a buffer | 62598f8f6fece00bbaccb590 |
class XengineStream(data_stream.SPEADStream): <NEW_LINE> <INDENT> def __init__(self, name, destination, xops, max_pkt_size, timeout=5, *args, **kwargs): <NEW_LINE> <INDENT> self.xops = xops <NEW_LINE> self.timeout = timeout <NEW_LINE> super(XengineStream, self).__init__(name, data_stream.XENGINE_CROSS_PRODUCTS, destina... | An x-engine SPEAD stream | 62598f8fa8ecb03325870e07 |
class GoSmartSimulationTranslator: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._files_required = {} <NEW_LINE> <DEDENT> def get_files_required(self): <NEW_LINE> <INDENT> return self._files_required <NEW_LINE> <DEDENT> def translate(self, xml): <NEW_LINE> <INDENT> parameters = {} <NEW_LINE> paramete... | This extracts basic information, common to all families, from GSSA-XML. | 62598f8fd4950a0f3b110c38 |
class Boot(object): <NEW_LINE> <INDENT> priority = 0 <NEW_LINE> action_type = 'boot' <NEW_LINE> compatibility = 0 <NEW_LINE> def __init__(self, parent): <NEW_LINE> <INDENT> self.__parameters__ = {} <NEW_LINE> self.pipeline = parent <NEW_LINE> self.job = parent.job <NEW_LINE> self.job.compatibility = max(self.compatibil... | Allows selection of the boot method for this job within the parser. | 62598f8ff7d966606f747be3 |
class IETotalsByCandidatePage(object): <NEW_LINE> <INDENT> swagger_types = { 'pagination': 'OffsetInfo', 'results': 'list[IETotalsByCandidate]' } <NEW_LINE> attribute_map = { 'pagination': 'pagination', 'results': 'results' } <NEW_LINE> def __init__(self, pagination=None, results=None): <NEW_LINE> <INDENT> self._pagina... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62598f8fe76e3b2f99fd8636 |
class GetInvalidSensorDefinition(OptionalParameterTestFixture): <NEW_LINE> <INDENT> CATEGORY = TestCategory.ERROR_CONDITIONS <NEW_LINE> PID = 'SENSOR_DEFINITION' <NEW_LINE> def Test(self): <NEW_LINE> <INDENT> self.AddIfGetSupported(self.NackGetResult(RDMNack.NR_DATA_OUT_OF_RANGE)) <NEW_LINE> data = struct.pack('!B', 0x... | Get the sensor definition with the all sensor value (0xff). | 62598f8f8da39b475be02de2 |
class UnknownMediaKind(Exception): <NEW_LINE> <INDENT> pass | Thrown when an unknown media kind is found. | 62598f8f55399d3f0562611f |
class AdaptiveLIFRate(LIFRate): <NEW_LINE> <INDENT> probeable = ('rates', 'adaptation') <NEW_LINE> tau_n = NumberParam('tau_n', low=0, low_open=True) <NEW_LINE> inc_n = NumberParam('inc_n', low=0) <NEW_LINE> def __init__(self, tau_n=1, inc_n=0.01, **lif_args): <NEW_LINE> <INDENT> super(AdaptiveLIFRate, self).__init__(*... | Adaptive non-spiking version of the LIF agent model.
Works as the LIF model, except with adapation state ``n``, which is
subtracted from the input current. Its dynamics are::
tau_n dn/dt = -n
where ``n`` is incremented by ``inc_n`` when the agent spikes.
Parameters
----------
tau_n : float
Adaptation time c... | 62598f8f498bea3a75a5772a |
class OP_xor(OperatorToken): <NEW_LINE> <INDENT> pass | Expression '^' operator | 62598f8fd6c5a102081e1d49 |
class VF3_Ofast_gcc(VF): <NEW_LINE> <INDENT> def __init__(self, model, dx, dt=None, align=None): <NEW_LINE> <INDENT> super(VF3_Ofast_gcc, self).__init__(model, dx, dt, align) <NEW_LINE> self.fstep = libvf3_Ofast_gcc.vf3.step | Like VF1, but uses forall. | 62598f8f8c0ade5d55dc348e |
class AccessInformation(graphene.ObjectType): <NEW_LINE> <INDENT> ldap = generic.GenericScalar() <NEW_LINE> mozilliansorg = generic.GenericScalar() <NEW_LINE> access_provider = generic.GenericScalar() <NEW_LINE> hris = generic.GenericScalar() <NEW_LINE> class Meta: <NEW_LINE> <INDENT> default_resolver = dino_park_resol... | V2 Schema AccessInformation object for Graphene. | 62598f8f3539df3088ecbec1 |
class is_togglebutton_checked_by_index_args: <NEW_LINE> <INDENT> thrift_spec = ( None, (1, TType.I32, 'index', None, None, ), ) <NEW_LINE> def __init__(self, index=None,): <NEW_LINE> <INDENT> self.index = index <NEW_LINE> <DEDENT> def read(self, iprot): <NEW_LINE> <INDENT> if iprot.__class__ == TBinaryProtocol.TBinaryP... | Attributes:
- index | 62598f8f7b25080760ed70b0 |
class LoadProductManager(pipeline.TaskBase): <NEW_LINE> <INDENT> product_directory = config.Property(proptype=str) <NEW_LINE> def setup(self): <NEW_LINE> <INDENT> import os <NEW_LINE> from drift.core import manager <NEW_LINE> if not os.path.exists(self.product_directory): <NEW_LINE> <INDENT> raise RuntimeError("Product... | Loads a driftscan product manager from disk.
Attributes
----------
product_directory : str
Path to the root of the products. This is the same as the output
directory used by ``drift-makeproducts``. | 62598f8fa79ad16197769c6b |
@_tag <NEW_LINE> class Colgroup(HtmlNode): <NEW_LINE> <INDENT> pass | Defines a group of columns within a table.
Content model:
No: if the span attribute is present.
Zero or more col and template elements: if the span attribute is absent.
Contexts for use: As a child of a table element, after any caption elements and before any thead, tbody, tfoot, and tr elements. | 62598f8f8e71fb1e983bb6b6 |
class CustomException(ValidationError): <NEW_LINE> <INDENT> def __init__(self, msg=None): <NEW_LINE> <INDENT> self.msg = msg <NEW_LINE> super(CustomException, self).__init__(msg) <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return self.msg | Override the default way python prints errors as strings. | 62598f8f6aa9bd52df0d4ad1 |
class XmlCoverageReporter(BaseViolationReporter): <NEW_LINE> <INDENT> def __init__(self, xml_roots): <NEW_LINE> <INDENT> super(XmlCoverageReporter, self).__init__("XML") <NEW_LINE> self._xml_roots = xml_roots <NEW_LINE> self._info_cache = defaultdict(list) <NEW_LINE> <DEDENT> def _cache_file(self, src_path): <NEW_LINE>... | Query information from a Cobertura XML coverage report. | 62598f8fe64d504609df91b6 |
class Hand: <NEW_LINE> <INDENT> def __init__(self, values): <NEW_LINE> <INDENT> self.cards = [] <NEW_LINE> self.value = 0 <NEW_LINE> self.aces = 0 <NEW_LINE> self.values = values <NEW_LINE> <DEDENT> def add_card(self, card): <NEW_LINE> <INDENT> self.cards.append(card) <NEW_LINE> self.value += self.values[card.rank] <NE... | Create difference role like player or dealer, they can keep Card object hit
form Deck object | 62598f8ff7d966606f747be4 |
class VIEW3D_PT_tools_extrucut(Panel): <NEW_LINE> <INDENT> bl_label = 'ExtruCut' <NEW_LINE> bl_category = 'Tools' <NEW_LINE> bl_space_type = 'VIEW_3D' <NEW_LINE> bl_region_type = 'TOOLS' <NEW_LINE> bl_context = 'mesh_edit' <NEW_LINE> def draw(self, context): <NEW_LINE> <INDENT> row = self.layout.row() <NE... | Creates a panel in the Tools panel | 62598f8f71ff763f4b5e7377 |
class Transaction(object): <NEW_LINE> <INDENT> def __init__(self, request=None, response=None, resource=None, timestamp=None): <NEW_LINE> <INDENT> self._response = response <NEW_LINE> self._request = request <NEW_LINE> self._resource = resource <NEW_LINE> self._timestamp = timestamp <NEW_LINE> self._completed = False <... | Transaction object to bind together a request, a response and a resource. | 62598f8f3eb6a72ae038a23b |
class SystemdStrategy(GenericStrategy): <NEW_LINE> <INDENT> def get_current_hostname(self): <NEW_LINE> <INDENT> cmd = ['hostname'] <NEW_LINE> rc, out, err = self.module.run_command(cmd) <NEW_LINE> if rc != 0: <NEW_LINE> <INDENT> self.module.fail_json(msg="Command failed rc=%d, out=%s, err=%s" % (rc, out, err)) <NEW_LIN... | This is a Systemd hostname manipulation strategy class - it uses
the hostnamectl command. | 62598f8feab8aa0e5d30b981 |
class AzureBlockBlobRawIO(AzureBlobRawIO): <NEW_LINE> <INDENT> __DEFAULT_CLASS = False <NEW_LINE> @property <NEW_LINE> @memoizedmethod <NEW_LINE> def _client(self): <NEW_LINE> <INDENT> return self._system.client[_BLOB_TYPE] <NEW_LINE> <DEDENT> def _flush(self, buffer): <NEW_LINE> <INDENT> with _handle_azure_exception()... | Binary Azure BLock Blobs Storage Object I/O
Args:
name (path-like object): URL or path to the file which will be opened.
mode (str): The mode can be 'r', 'w', 'a'
for reading (default), writing or appending
storage_parameters (dict): Azure service keyword arguments.
This is generally Azure ... | 62598f8f1f037a2d8b9e3ce1 |
class Equipment: <NEW_LINE> <INDENT> def __init__(self, name): <NEW_LINE> <INDENT> self._name = name <NEW_LINE> <DEDENT> def name(self): <NEW_LINE> <INDENT> return self._name <NEW_LINE> <DEDENT> def price(self): <NEW_LINE> <INDENT> raise NotImplementedError <NEW_LINE> <DEDENT> def accept(self, equipment_visitor): <NEW_... | Taken from Composite tutorial. Added accept method. | 62598f8f76e4537e8c3ef1b3 |
class Beer(db.Model): <NEW_LINE> <INDENT> id = db.Column(db.Integer, primary_key=True) <NEW_LINE> name = db.Column(db.String(80)) <NEW_LINE> abv = db.Column(db.Float) <NEW_LINE> photo = db.Column(db.String(200)) <NEW_LINE> special_ingredient = db.Column(db.String(250)) <NEW_LINE> genre_id = db.Column(db.Integer, db.For... | Beer object, takes care of everything you would want to know
about a specific beer. | 62598f8fe5267d203ee6b51d |
@cassiopeia.type.core.common.inheritdocs <NEW_LINE> class RunePages(cassiopeia.type.dto.common.CassiopeiaDto): <NEW_LINE> <INDENT> def __init__(self, dictionary): <NEW_LINE> <INDENT> self.pages = [(RunePage(p) if not isinstance(p, RunePage) else p) for p in dictionary.get("pages", []) if p] <NEW_LINE> self.summonerId =... | pages list<RunePage> collection of rune pages associated with the summoner
summonerId int summoner ID | 62598f8f30dc7b766599f45e |
@dataclass <NEW_LINE> class DatagramReceived(H3Event): <NEW_LINE> <INDENT> data: bytes <NEW_LINE> flow_id: int | The DatagramReceived is fired whenever a datagram is received from the
the remote peer. | 62598f8f2ae34c7f260aaceb |
class MovableGameMapObject(object): <NEW_LINE> <INDENT> def __init__(self, position, direction): <NEW_LINE> <INDENT> self.position = position <NEW_LINE> self.direction = direction <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def from_ram(cls, position, ram): <NEW_LINE> <INDENT> direction = cls._get_direction(ram) <NEW_L... | Movable game map object. | 62598f8ff7d966606f747be5 |
class UserAdminCreationForm(forms.ModelForm): <NEW_LINE> <INDENT> password = forms.CharField(label='Password', widget=forms.PasswordInput) <NEW_LINE> class Meta: <NEW_LINE> <INDENT> model = User <NEW_LINE> fields = ('username', 'email') <NEW_LINE> <DEDENT> def save(self, commit=True): <NEW_LINE> <INDENT> user = super(U... | A form for creating new users. Includes all the required
fields, plus a repeated password. | 62598f8fb7558d5895463239 |
class Sentiment_NRC(Feature): <NEW_LINE> <INDENT> FEATS = ['sent_nrc'] <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> self.sent_lext = get_sentiment_lexicon() <NEW_LINE> <DEDENT> def transform(self, X): <NEW_LINE> <INDENT> for sent in X: <NEW_LINE> <INDENT> emotions_vector = [0 for _ in range(len(emotions))] <NEW_L... | Adds sentiment of the text with NRC emotion lexicon | 62598f8fe76e3b2f99fd8638 |
class SiteUpdate(models.Model): <NEW_LINE> <INDENT> created = models.DateTimeField(auto_now_add=True, verbose_name=_('created')) <NEW_LINE> class Meta: <NEW_LINE> <INDENT> verbose_name = _('Site update') <NEW_LINE> verbose_name_plural = _('Site updates') <NEW_LINE> default_related_name = 'siteupdates' <NEW_LINE> get_la... | A site update that asks the user to reload the page. | 62598f8f0383005118f6d300 |
class Secure: <NEW_LINE> <INDENT> __serializer = URLSafeSerializer( app.config["SECRET_KEY"], salt="yagshjuegsbkajhsi") <NEW_LINE> __timed_serializer = TimedSerializer( app.config["SECRET_KEY"], expires_in=app.config["YUMMY_TOKEN_EXPIRY"]) <NEW_LINE> @staticmethod <NEW_LINE> def encrypt_user_id(user_id): <NEW_LINE> <IN... | Secure class handles basic security operations of the api e.g.
Generates the token for authentication of api users
Generates and decrypts public user ids | 62598f8f3cc13d1c6d46536f |
class ScanManifest(BaseImmutableModel): <NEW_LINE> <INDENT> scanned_accounts: List[str] <NEW_LINE> master_artifact: Optional[str] = None <NEW_LINE> artifacts: List[str] <NEW_LINE> errors: Dict[str, List[str]] <NEW_LINE> unscanned_accounts: List[str] <NEW_LINE> start_time: int <NEW_LINE> end_time: int | A ScanManifest defines the output of a complete scan. It contains pointers to the
per-account scan result artifacts and summaries of what was scanned, errors which occurred,
scan datetime and api call statistics.
Args:
scanned_accounts: List of account ids which were scanned
master_artifact: artifact containin... | 62598f8f3c8af77a43b67d3b |
class CreateUserForm(FlaskForm): <NEW_LINE> <INDENT> username = StringField('username', validators=[InputRequired(), Length(min=6, max=80)]) <NEW_LINE> password = PasswordField('password', validators=[InputRequired(), Length(min=8, max=80)]) <NEW_LINE> email = StringField('email', validators=[InputRequired(), Email()]) | Registration form definition | 62598f8fb5575c28eb712ace |
class SchoolModel(Model): <NEW_LINE> <INDENT> def __init__(self, N): <NEW_LINE> <INDENT> self.num_agents = N <NEW_LINE> for i in range(self.num_agents): <NEW_LINE> <INDENT> a = Student(i, "Engineer", self) | A model with some number of agents. | 62598f8f91af0d3eaad39a08 |
class Packet (object): <NEW_LINE> <INDENT> def __init__ (self): <NEW_LINE> <INDENT> self.ttl = 255 <NEW_LINE> self.path = [] <NEW_LINE> <DEDENT> def __eq__ (self, A): <NEW_LINE> <INDENT> return hash(A) == hash(self) <NEW_LINE> <DEDENT> def pack (self): <NEW_LINE> <INDENT> return "" | Represent whatever interesting fields
one cares about in a packet | 62598f8f0c0af96317c55f89 |
class JSONEncoderForHTML(JSONEncoder): <NEW_LINE> <INDENT> def encode(self, o): <NEW_LINE> <INDENT> chunks = self.iterencode(o, True) <NEW_LINE> return ''.join(chunks) <NEW_LINE> <DEDENT> def iterencode(self, o, _one_shot=False): <NEW_LINE> <INDENT> chunks = super().iterencode(o, _one_shot) <NEW_LINE> for chunk in chun... | An encoder that produces JSON safe to embed in HTML.
To embed JSON content in, say, a script tag on a web page, the
characters &, < and > should be escaped. They cannot be escaped
with the usual entities (e.g. &) because they are not expanded
within <script> tags. | 62598f8fe64d504609df91b7 |
class MTSettingsPerLanguageDto(object): <NEW_LINE> <INDENT> swagger_types = { 'target_lang': 'str', 'machine_translate_settings': 'MachineTranslateSettingsDto' } <NEW_LINE> attribute_map = { 'target_lang': 'targetLang', 'machine_translate_settings': 'machineTranslateSettings' } <NEW_LINE> def __init__(self, target_lang... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62598f8f63b5f9789fe84d79 |
class LibModelViewCanExportTestCase(CubaneTestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.view = ModelView() <NEW_LINE> <DEDENT> def test_should_return_false(self): <NEW_LINE> <INDENT> self.assertEqual(self.view._can_export(), False) <NEW_LINE> <DEDENT> def test_should_return_true(self): <NEW_L... | cubane.views.ModelView._can_export() | 62598f8f4428ac0f6e65812c |
class CleanUpDir(object): <NEW_LINE> <INDENT> def __init__(self, path=None): <NEW_LINE> <INDENT> self.path = path <NEW_LINE> <DEDENT> def __enter__(self): <NEW_LINE> <INDENT> if self.path is None: <NEW_LINE> <INDENT> self.path = tempfile.mkdtemp() <NEW_LINE> <DEDENT> return self <NEW_LINE> <DEDENT> def __exit__(self, *... | Context utility for ensuring that a given temp directory | 62598f8f63d6d428bbee23c1 |
class ReturnsRows(roles.ReturnsRowsRole, ClauseElement): <NEW_LINE> <INDENT> _is_returns_rows = True <NEW_LINE> _is_from_clause = False <NEW_LINE> _is_select_statement = False <NEW_LINE> _is_lateral = False <NEW_LINE> @property <NEW_LINE> def selectable(self): <NEW_LINE> <INDENT> raise NotImplementedError() <NEW_LINE> ... | The base-most class for Core constructs that have some concept of
columns that can represent rows.
While the SELECT statement and TABLE are the primary things we think
of in this category, DML like INSERT, UPDATE and DELETE can also specify
RETURNING which means they can be used in CTEs and other forms, and
PostgreSQ... | 62598f8f8da39b475be02de5 |
class RSSPage(SyndicationPage): <NEW_LINE> <INDENT> TYPE = "rss" <NEW_LINE> TEMPLATE = "syndication.rss" | A RSS syndication page | 62598f8f287bf620b62717c0 |
class Decoder(nn.Module): <NEW_LINE> <INDENT> def __init__(self, layer, N): <NEW_LINE> <INDENT> super(Decoder, self).__init__() <NEW_LINE> self.layers = clones(layer, N) <NEW_LINE> self.norm = LayerNorm(layer.size) <NEW_LINE> <DEDENT> def forward(self, x, memory, price_series_mask, local_price_mask, padding_price): <NE... | Generic N layer decoder with masking. | 62598f8fbaa26c4b54d4eebc |
class JobError(LnstError): <NEW_LINE> <INDENT> def __init__(self, s): <NEW_LINE> <INDENT> self._s = s <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return "JobError: " + str(self._s) | Base class for client errors. | 62598f8f1f037a2d8b9e3ce3 |
class IterQueryResult(object): <NEW_LINE> <INDENT> def __init__( self, packet_generator, with_column_types=False): <NEW_LINE> <INDENT> self.packet_generator = packet_generator <NEW_LINE> self.with_column_types = with_column_types <NEW_LINE> self.first_block = True <NEW_LINE> super(IterQueryResult, self).__init__() <NEW... | Provides iteration over returned data by chunks (streaming by chunks). | 62598f8f76e4537e8c3ef1b5 |
class Webpack: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.assets = {} <NEW_LINE> self.assets_host = None <NEW_LINE> <DEDENT> def init_app(self, app): <NEW_LINE> <INDENT> self.assets_host = app.config.get('WEBPACK_ASSETS_HOST', '') <NEW_LINE> self._load_assets(app) <NEW_LINE> if app.unchained.env =... | The `Webpack` extension::
from flask_unchained.bundles.webpack import webpack | 62598f8fe5267d203ee6b51f |
class EnablingModesComponent(ModesComponent): <NEW_LINE> <INDENT> def __init__(self, component=None, toggle_value=False, disabled_value=False, *a, **k): <NEW_LINE> <INDENT> super(EnablingModesComponent, self).__init__(*a, **k) <NEW_LINE> component.set_enabled(False) <NEW_LINE> self.add_mode('disabled', None, disabled_v... | Adds the two modes 'enabled' and 'disabled'. The provided component will be
enabled while the 'enabled' mode is active. | 62598f8f656771135c489284 |
class TestOrphans(object): <NEW_LINE> <INDENT> def test_atom(self): <NEW_LINE> <INDENT> u = MDAnalysis.Universe(two_water_gro) <NEW_LINE> def getter(): <NEW_LINE> <INDENT> u2 = MDAnalysis.Universe(two_water_gro) <NEW_LINE> return u2.atoms[1] <NEW_LINE> <DEDENT> atom = getter() <NEW_LINE> assert_(atom is not u.atoms[1])... | Test moving Universes out of scope and having A/AG persist
Atoms and AtomGroups from other scopes should work, namely:
- should have access to Universe
- should be able to use the Reader (coordinates) | 62598f8f76d4e153a661c820 |
class InstanceAttributeDocumenter(AttributeDocumenter): <NEW_LINE> <INDENT> objtype = 'instanceattribute' <NEW_LINE> directivetype = 'attribute' <NEW_LINE> member_order = 60 <NEW_LINE> priority = 11 <NEW_LINE> @classmethod <NEW_LINE> def can_document_member(cls, member, membername, isattr, parent): <NEW_LINE> <INDENT> ... | Specialized Documenter subclass for attributes that cannot be imported
because they are instance attributes (e.g. assigned in __init__). | 62598f8fa05bb46b3848a483 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.