code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class SimilarResponse(TimeStampedModel): <NEW_LINE> <INDENT> name = models.CharField(max_length=100) <NEW_LINE> normalized_name = models.CharField(max_length=100, editable=False, db_index=True) <NEW_LINE> response = jsonfield.JSONField() <NEW_LINE> def save(self, **kwargs): <NEW_LINE> <INDENT> self.normalized_name = se... | Response from artists/similar API resource at The Echo Nest. | 62598efc377c676e912f6213 |
class CIFARResNetV2(HybridBlock): <NEW_LINE> <INDENT> def __init__(self, block, layers, channels, classes=10, **kwargs): <NEW_LINE> <INDENT> super(CIFARResNetV2, self).__init__(**kwargs) <NEW_LINE> assert len(layers) == len(channels) - 1 <NEW_LINE> with self.name_scope(): <NEW_LINE> <INDENT> self.features = nn.HybridSe... | ResNet V2 model from
`"Identity Mappings in Deep Residual Networks"
<https://arxiv.org/abs/1603.05027>`_ paper.
Parameters
----------
block : HybridBlock
Class for the residual block. Options are CIFARBasicBlockV1, BottleneckV1.
layers : list of int
Numbers of layers in each block
channels : list of int
Nu... | 62598efc56ac1b37e6300b4c |
class GrpcClientDataChannelFactory(DataChannelFactory): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._data_channel_cache = {} <NEW_LINE> self._lock = threading.Lock() <NEW_LINE> <DEDENT> def create_data_channel(self, remote_grpc_port): <NEW_LINE> <INDENT> url = remote_grpc_port.api_service_descripto... | A factory for ``GrpcClientDataChannel``.
Caches the created channels by ``data descriptor url``. | 62598efc71ff763f4b5e60c0 |
class TooManyHeaderProperties(InvalidParse): <NEW_LINE> <INDENT> def __init__(self, class_id: int): <NEW_LINE> <INDENT> self.class_id = class_id <NEW_LINE> <DEDENT> def __str__(self) -> str: <NEW_LINE> <INDENT> return 'Header frame with more properties than class {} specifies'.format(self.class_id) | The sequence of header properties is fixed for each AMQP class. Server sent flags indicating there's more than
there should be. | 62598efc67a9b606de54492f |
class Context(object): <NEW_LINE> <INDENT> def __init__(self, target): <NEW_LINE> <INDENT> self.__target = target <NEW_LINE> <DEDENT> def save(self, **params): <NEW_LINE> <INDENT> for key in params.keys(): <NEW_LINE> <INDENT> setattr(self.__target, "__context__" + key, params.get(key, None)) <NEW_LINE> <DEDENT> <DEDENT... | a class to store/retrieve various context parameters
associated with a passed target which could be any kind of
python object for example a public method of a class;
the first usage of the Context class happened during application of
slot methods which can be defined as static method calls in a external
file; because s... | 62598efc956e5f7376df4b2a |
class PhotoSetAddForm(TendenciBaseForm): <NEW_LINE> <INDENT> status_detail = forms.ChoiceField( choices=(('active',_('Active')),('inactive',_('Inactive')), ('pending',_('Pending')),)) <NEW_LINE> group = forms.ChoiceField(required=True, choices=[]) <NEW_LINE> class Meta: <NEW_LINE> <INDENT> model = PhotoSet <NEW_LINE> f... | Photo-Set Add-Form | 62598efc10dbd63aa1c6f4dd |
class McDBIDownloadsException(Exception): <NEW_LINE> <INDENT> pass | Default exceptions for this package. | 62598efcf548e778e5969ee5 |
class ImagePool: <NEW_LINE> <INDENT> def __init__(self, pool_size): <NEW_LINE> <INDENT> self.pool_size = pool_size <NEW_LINE> if self.pool_size > 0: <NEW_LINE> <INDENT> self.num_imgs = 0 <NEW_LINE> self.images = [] <NEW_LINE> <DEDENT> <DEDENT> def query(self, images): <NEW_LINE> <INDENT> if self.pool_size == 0: <NEW_LI... | IMAGE POOL FOR DISCRIMINATOR | 62598efc283ffb24f3cf220a |
class NotFoundPage(gui.Page): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(NotFoundPage, self).__init__(*args, **kwargs) <NEW_LINE> self.submit = gui.Signal() <NEW_LINE> self.vbox = gui.VBox(height="100%", width="100%", parent=self) <NEW_LINE> self.vbox.style.update({ "background":... | Signals:
submit() | 62598efc4a966d76dd5ed833 |
class Test_Postgres: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.dut = None <NEW_LINE> <DEDENT> def setup(self): <NEW_LINE> <INDENT> print("Setup") <NEW_LINE> self.dut = Database.Postgres.Postgres() <NEW_LINE> self.dut.database = "postgres" <NEW_LINE> self.dut.password = "python" <NEW_LINE> self.du... | Nose tests for the Postgres module | 62598efcbe7bc26dc9251313 |
class block_compressor(object): <NEW_LINE> <INDENT> WBITS = 15 <NEW_LINE> START_OVERSHOOT = 1.1 <NEW_LINE> OVERSHOOT_INCREASE = 0.08 <NEW_LINE> def __init__(self, in_bytes, block_size): <NEW_LINE> <INDENT> def factory(): <NEW_LINE> <INDENT> return zlib.compressobj(zlib.Z_BEST_COMPRESSION, zlib.DEFLATED, self.WBITS) <NE... | Take a set of input bytes and using zlib compress blocks of less than or equal to block_size
and return them as an iterator using blocks()
Each block can be decompressed on its own (still part of the overall stream) | 62598efca05bb46b384891d5 |
@skip_unless_thirdpartyauth() <NEW_LINE> @ddt.ddt <NEW_LINE> class TestXFrameWhitelistDecorator(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super().setUp() <NEW_LINE> self.configure_lti_provider(name='Test', lti_hostname='localhost', lti_consumer_key='test_key', enabled=True) <NEW_LINE> self.fac... | Test the xframe_allow_whitelisted decorator. | 62598efcec188e330fdf720c |
class UserRetrieveUpdateDestroySerializers1(serializers.ModelSerializer): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = User <NEW_LINE> fields = ( 'username', 'nickname', 'img_profile', ) <NEW_LINE> read_only = ( 'username', ) <NEW_LINE> <DEDENT> def update(self, instance, validated_data): <NEW_LINE> <IND... | 유저 정보(이메일 / 유저명 / 프로필이미지) 변경 | 62598efc3617ad0b5ee04a8a |
class TestLTIModuleListing(SharedModuleStoreTestCase): <NEW_LINE> <INDENT> COURSE_SLUG = "100" <NEW_LINE> COURSE_NAME = "test_course" <NEW_LINE> @classmethod <NEW_LINE> def setUpClass(cls): <NEW_LINE> <INDENT> super(TestLTIModuleListing, cls).setUpClass() <NEW_LINE> cls.course = CourseFactory.create(display_name=cls.CO... | a test for the rest endpoint that lists LTI modules in a course | 62598efc3d592f4c4edb984e |
class TaggableObject(ConfigObject): <NEW_LINE> <INDENT> __slots__ = ["tags"] <NEW_LINE> VALID_TAG_RE = re.compile(r"^[\w.+*/:@-]+$") <NEW_LINE> @classmethod <NEW_LINE> def ValidateTag(cls, tag): <NEW_LINE> <INDENT> if not isinstance(tag, str): <NEW_LINE> <INDENT> raise errors.TagError("Invalid tag type (not a string)")... | An generic class supporting tags.
| 62598efcad47b63b2c5a6179 |
class Circuit(Shape, shapes.mCircuit): <NEW_LINE> <INDENT> pass | Um caminho fechado com um interior bem definido. | 62598efcbe383301e0252141 |
class AbstractAgent(ShareObject, metaclass=TypedShareObjectMeta): <NEW_LINE> <INDENT> name = models.TextField(blank=True, db_index=True) <NEW_LINE> location = models.TextField(blank=True) <NEW_LINE> related_agents = ShareManyToManyField('AbstractAgent', through='AbstractAgentRelation', through_fields=('subject', 'relat... | An Agent is an entity that has the power to act, e.g. an individual person or a group of people.
Agents make decisions and produce or contribute to the production of creative works. | 62598efc55399d3f05624e86 |
class Descriminator(nn.Module): <NEW_LINE> <INDENT> def __init__(self, conf): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> channels = conf.model.conv_channels <NEW_LINE> num_groups = conf.model.num_groups <NEW_LINE> self.from_rgb = nn.Sequential( _conv(in_channels=3, out_channels=channels, kernel_size=1, padding=0... | Given a sample from the output of the generated distribution, encode the result
back into | 62598efc3d592f4c4edb984f |
class Background(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.image = pygame.Surface((size[0], size[1])) <NEW_LINE> self.image.fill(BLACK) <NEW_LINE> self.stars = pygame.sprite.Group() <NEW_LINE> self.populate() <NEW_LINE> <DEDENT> def spawn_star(self, y_pos=None): <NEW_LINE> <INDENT> new_s... | Class for creating and displaying a parallax starfield
This class spawns instances of the Star class to populate a blank background with single pixel stars
moving at various rates for a parallax effect. Each new frame of the game shifts the stars down and
there is a 1/7 chance that a new star will spawn. That rate is ... | 62598efc2ae34c7f260a9a43 |
class UdpIdServer(object): <NEW_LINE> <INDENT> def __init__(self, idpool, host, port, timeout=-1): <NEW_LINE> <INDENT> self.inet_type = socket.AF_INET <NEW_LINE> if not is_ipv4(host): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> inet_pton(host, socket.AF_INET6) <NEW_LINE> <DEDENT> except Exception: <NEW_LINE> <INDENT> ... | UDP server to grant ids to connected clients.
The communication is not blocking even if no free id is available.
Server will tell clients the missing of id immediately.
Since the server runs on UDP protocol, it should only serve at a
rather reliable environment. If a client shutdown, but the release
packet is not re... | 62598efc71ff763f4b5e60c2 |
class Git(Source): <NEW_LINE> <INDENT> name = "git" <NEW_LINE> def __init__(self, repourl, branch="master", submodules=False, ignore_ignores=None, **kwargs): <NEW_LINE> <INDENT> Source.__init__(self, **kwargs) <NEW_LINE> self.addFactoryArguments(repourl=repourl, branch=branch, submodules=submodules, ignore_ignores=igno... | Check out a source tree from a git repository 'repourl'. | 62598efc63d6d428bbee1130 |
class Attribute(models.Base): <NEW_LINE> <INDENT> type_ = sa.Column(sa.String(50)) <NEW_LINE> name = sa.Column(sa.String(50)) <NEW_LINE> description = sa.Column(sa.String(200)) <NEW_LINE> level = sa.Column(sa.Integer) <NEW_LINE> hero_id = sa.Column(sa.Integer, sa.ForeignKey('hero.id', ondelete="CASCADE")) <NEW_LINE> he... | Attribute class that stores data about a hero object.
| 62598efc66673b3332c2ed11 |
class UnknownTrophy(TrophyType): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(UnknownTrophy, self).__init__( title=_('Unknown Trophy'), image_url=None) | A trophy with an unknown category.
The data for this trophy exists in the database but its category does not
match the category of any registered trophy types. | 62598efc7047854f4633dd28 |
class Meta: <NEW_LINE> <INDENT> verbose_name = _("Bookmark") <NEW_LINE> verbose_name_plural = _("Bookmarks") | Meta. | 62598efc5fdd1c0f98e5c906 |
class PolicyRuleSetClient(base.GbpClientV2Base): <NEW_LINE> <INDENT> resource = "/grouppolicy/policy_rule_sets" <NEW_LINE> def create_policy_rule_set(self, name, **kwargs): <NEW_LINE> <INDENT> post_body = {'policy_rule_set': {'name': name }} <NEW_LINE> if kwargs.get('policy_rules'): <NEW_LINE> <INDENT> post_body['polic... | API V2 Tempest REST client for GBP Policy Rule Set API | 62598efc10dbd63aa1c6f4df |
class TestPaypalCreditTransaction(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 testPaypalCreditTransaction(self): <NEW_LINE> <INDENT> pass | PaypalCreditTransaction unit test stubs | 62598efc23849d37ff84fa20 |
class ListType(wtypes.UserType): <NEW_LINE> <INDENT> basetype = wtypes.text <NEW_LINE> name = 'list' <NEW_LINE> @staticmethod <NEW_LINE> def validate(value): <NEW_LINE> <INDENT> items = [v.strip().lower() for v in six.text_type(value).split(',')] <NEW_LINE> return filter(None, items) <NEW_LINE> <DEDENT> @staticmethod <... | A simple list type. | 62598efcff9c53063f518fc3 |
class FuncSource: <NEW_LINE> <INDENT> blank_rx = re.compile(r"^\s*finally:\s*(#.*)?$") <NEW_LINE> def __init__(self, fn): <NEW_LINE> <INDENT> self.fn = fn <NEW_LINE> self.filename = inspect.getsourcefile(fn) <NEW_LINE> self.source, self.firstlineno = inspect.getsourcelines(fn) <NEW_LINE> self.sourcelines = {} <NEW_LINE... | Source code annotator for a function. | 62598efc76e4537e8c3edf1c |
class FieldTester(ScopedStorageMixin): <NEW_LINE> <INDENT> field_a = List(scope=Scope.settings) | Toy class for ModelMetaclass and field access testing | 62598efcbe7bc26dc9251314 |
class MetricData(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.when = datetime.datetime.utcnow() <NEW_LINE> self.mem = {} <NEW_LINE> self.cpu = {} <NEW_LINE> self.disk = {} <NEW_LINE> self.rabbit = {} | Container for metric data | 62598efcaad79263cf42d171 |
class ReselloResponse(object): <NEW_LINE> <INDENT> __attrs__ = [ '_content', 'status_code', 'headers', 'url', 'history', 'encoding', 'reason', 'cookies', 'elapsed', 'request', 'status', 'result', 'has_errors', 'errors' ] <NEW_LINE> def __init__(self, response): <NEW_LINE> <INDENT> self._response = response <NEW_LINE> s... | The :class:`Response <Response>` object, contains a
server's response to an HTTP request. | 62598efca219f33f346c5190 |
class CollectEmbeddedResources(interface.Hook): <NEW_LINE> <INDENT> DESCRIPTION = "Embedded resources" <NEW_LINE> def __init__(self, hook_logger, fixture, sample_interval_ms=500, threads=1): <NEW_LINE> <INDENT> interface.Hook.__init__(self, hook_logger, fixture, CollectEmbeddedResources.DESCRIPTION) <NEW_LINE> self.hoo... | CollectEmbeddedResources class.
CollectEmbeddedResources starts and stops the resource monitoring for each test. | 62598efc60cbc95b06362c92 |
class MTSIntegrator(CustomIntegrator): <NEW_LINE> <INDENT> def __init__(self, dt, groups): <NEW_LINE> <INDENT> if len(groups) == 0: <NEW_LINE> <INDENT> raise ValueError("No force groups specified") <NEW_LINE> <DEDENT> groups = sorted(groups, key=lambda x: x[1]) <NEW_LINE> CustomIntegrator.__init__(self, dt) <NEW_LINE> ... | MTSIntegrator implements the rRESPA multiple time step integration algorithm.
This integrator allows different forces to be evaluated at different frequencies,
for example to evaluate the expensive, slowly changing forces less frequently than
the inexpensive, quickly changing forces.
To use it, you must first divide ... | 62598efcadb09d7d5dc08f18 |
class DeleteIpAllowListEntryPayload(sgqlc.types.Type): <NEW_LINE> <INDENT> __schema__ = github_schema <NEW_LINE> __field_names__ = ('client_mutation_id', 'ip_allow_list_entry') <NEW_LINE> client_mutation_id = sgqlc.types.Field(String, graphql_name='clientMutationId') <NEW_LINE> ip_allow_list_entry = sgqlc.types.Field('... | Autogenerated return type of DeleteIpAllowListEntry | 62598efc5fcc89381b2655da |
class ActiveSongManager(models.Manager): <NEW_LINE> <INDENT> def get_query_set(self): <NEW_LINE> <INDENT> return super(ActiveSongManager, self).get_query_set().filter(status = 'A') | This manager only returns the songs marked as Active.
Bound to Song.active | 62598efc21bff66bcd7215b8 |
class CT_Transform2D(OxmlBaseElement): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def new(cls, cx, cy): <NEW_LINE> <INDENT> spPr = OxmlElement('a:xfrm') <NEW_LINE> spPr.append(CT_Point2D.new('a:off', 0, 0)) <NEW_LINE> spPr.append(CT_PositiveSize2D.new('a:ext', cx, cy)) <NEW_LINE> return spPr | ``<a:xfrm>`` element, specifies size and shape of picture container. | 62598efcdc8b845886d51f29 |
class ModelResponse(QThread): <NEW_LINE> <INDENT> throw_resalts = pyqtSignal(np.ndarray) <NEW_LINE> def __init__(self, list1, list2): <NEW_LINE> <INDENT> QThread.__init__(self) <NEW_LINE> self.list1 = list1 <NEW_LINE> self.list2 = list2 <NEW_LINE> <DEDENT> def __del__(self): <NEW_LINE> <INDENT> self.wait() <NEW_LINE> <... | Класс является оболочкой для QThread.
Методы класса реализуют обращение приложения
к обученной модели и получение результата.
Объекты данного класса передаются главным окном
для выполнения в отдельный поток. | 62598efc56ac1b37e6300b50 |
class GameStats(): <NEW_LINE> <INDENT> def __init__(self, settings): <NEW_LINE> <INDENT> self.settings = settings <NEW_LINE> self.reset_stats() <NEW_LINE> self.high_score = 0 <NEW_LINE> self.game_active = False <NEW_LINE> <DEDENT> def reset_stats(self): <NEW_LINE> <INDENT> self.ships_left = self.settings.ship_limit <NE... | Tracks statistics for the game | 62598efccc0a2c1114479965 |
class VideoCollection(collections.Sequence): <NEW_LINE> <INDENT> def __init__(self,videos=[]): <NEW_LINE> <INDENT> self._videos = [] <NEW_LINE> for video in videos: <NEW_LINE> <INDENT> self._videos.append(video) <NEW_LINE> <DEDENT> <DEDENT> @classmethod <NEW_LINE> def from_feed(cls,feed): <NEW_LINE> <INDENT> videos = [... | An ordered collection of videos.
This could be implemented by subclassing list however at this point not clear
what the interface to VideoCollection should be. Will use delegation-composition
and selectively build interface.
self._videos : Video sequence | 62598efc956e5f7376df4b2c |
class TrajectoryPlayer(object): <NEW_LINE> <INDENT> def __init__(self, reachy, trajectories, freq=100): <NEW_LINE> <INDENT> motor_names, trajectories = zip(*trajectories.items()) <NEW_LINE> self._reachy = reachy <NEW_LINE> self._motors = [attrgetter(name)(reachy) for name in motor_names] <NEW_LINE> self._traj = np.arra... | Trajectory player abstraction.
Args:
reachy (:py:class:`~reachy.Reachy`): robot which will play the trajectory
trajectories (dict): Trajectory to play (such as {motor_name: list of positions})
freq (float): Replay sample frequency (in Hz)
Provides high-level features to:
* play a pre-defined trajector... | 62598efcbf627c535bcafdd7 |
class Planet(SQLAlchemyObjectType): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = ModelPlanet <NEW_LINE> interfaces = (graphene.relay.Node,) | Planet node. | 62598efcff9c53063f518fc5 |
class IngredientSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = Ingredient | Ingredient serializer | 62598efc5166f23b2e241d40 |
class Numeral(MorphosyntacticFeature): <NEW_LINE> <INDENT> cardinal = auto() <NEW_LINE> distributive = auto() <NEW_LINE> fractional = auto() <NEW_LINE> multiplicative = auto() <NEW_LINE> ordinal = auto() <NEW_LINE> range = auto() <NEW_LINE> sets = auto() | A subclassification of numeric types.
see https://universaldependencies.org/u/feat/NumType.html | 62598efc627d3e7fe0e057f1 |
class Generic_dbutils: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def tname(self, table): <NEW_LINE> <INDENT> if table != 'biosequence': <NEW_LINE> <INDENT> return table <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return 'bioentry' <NEW_LINE> <DEDENT> <DEDENT> def last_id(sel... | Default database utilities. | 62598efc3317a56b869bda16 |
class MetaData(object): <NEW_LINE> <INDENT> def __init__(self, doc_path, docno=None, docid=None, date=None, hl=None, raw_doc=None, doc_len=None): <NEW_LINE> <INDENT> self.doc_path = doc_path <NEW_LINE> self.docno = docno <NEW_LINE> self.docid = docid <NEW_LINE> self.date = date <NEW_LINE> self.hl = hl <NEW_LINE> self.r... | Container for metadata of a given file | 62598efca219f33f346c5192 |
class Variables(Builtin): <NEW_LINE> <INDENT> def apply(self, expr, evaluation): <NEW_LINE> <INDENT> variables = set() <NEW_LINE> def find_vars(e): <NEW_LINE> <INDENT> if e.to_sympy().is_constant(): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> elif e.is_symbol(): <NEW_LINE> <INDENT> variables.add(e) <NEW_LINE> <DEDEN... | <dl>
<dt>'Variables[$expr$]'
<dd>gives a list of the variables that appear in the
polynomial $expr$.
</dl>
>> Variables[a x^2 + b x + c]
= {a, b, c, x}
>> Variables[{a + b x, c y^2 + x/2}]
= {a, b, c, x, y}
>> Variables[x + Sin[y]]
= {x, Sin[y]} | 62598efc3539df3088ecac10 |
class UI: <NEW_LINE> <INDENT> def __init__(self, root): <NEW_LINE> <INDENT> self.root = root <NEW_LINE> self.current_view = None <NEW_LINE> <DEDENT> def hide_current_view(self): <NEW_LINE> <INDENT> if self.current_view: <NEW_LINE> <INDENT> self.current_view.destroy() <NEW_LINE> <DEDENT> self.current_view = None <NEW_LI... | UI class which processes the main logic for different UI views
| 62598efc5fcc89381b2655db |
class TestConfigOrdererDebug(): <NEW_LINE> <INDENT> def test_config_orderer_debug_serialization(self): <NEW_LINE> <INDENT> config_orderer_debug_model_json = {} <NEW_LINE> config_orderer_debug_model_json['BroadcastTraceDir'] = 'testString' <NEW_LINE> config_orderer_debug_model_json['DeliverTraceDir'] = 'testString' <NEW... | Test Class for ConfigOrdererDebug | 62598efc55399d3f05624e8a |
class ADNSimple(): <NEW_LINE> <INDENT> def __init__(self, cadena): <NEW_LINE> <INDENT> self.largo = len(cadena) <NEW_LINE> self.cadena = cadena <NEW_LINE> <DEDENT> def complementar(self, arreglo): <NEW_LINE> <INDENT> arreglo_comp = ['' for x in range(len(arreglo))] <NEW_LINE> for i in range(len(arreglo)): <NEW_LINE> <I... | Cadena de codones simples. | 62598efcf9cc0f698b1c4781 |
class TestDetectAuthMethod(unittest.TestCase): <NEW_LINE> <INDENT> def test_credentials_returns_cookie_auth_method(self): <NEW_LINE> <INDENT> m = service._detect_auth_method("u", "pass", None, "key", None, None, None) <NEW_LINE> self.assertEqual(m, 'cookie') <NEW_LINE> <DEDENT> def test_session_id_returns_cookie_auth_m... | Tests for auth method detection in service.py. | 62598efc377c676e912f6216 |
class PersonSearcher(): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.meta_file = "./data/person_searcher_metadata.json" <NEW_LINE> metadata = {} <NEW_LINE> if os.path.exists(self.meta_file): <NEW_LINE> <INDENT> metadata = json.load(open(self.meta_file, 'r')) <NEW_LINE> <DEDENT> self.metadata = metad... | This class searches for web pages about a person on the internet, crawls relevant pages, and stores results to disk | 62598efc9f28863672817159 |
class SnmpErrorCommitFailed(SnmpErrorStatus): <NEW_LINE> <INDENT> message = "No validation errors occurred, but no variables were updated." | No validation errors occurred, but no variables were updated. | 62598efc3346ee7daa336b19 |
class UndoLastFrame(Event): <NEW_LINE> <INDENT> pass | Remove a player's last frame from the history. | 62598efc1f5feb6acb1615ba |
class __PolygonFilter__(Filter): <NEW_LINE> <INDENT> arrow_width = NumberParameter() <NEW_LINE> arrow_length = NumberParameter() <NEW_LINE> surface_width = NumberParameter() <NEW_LINE> surface_length = NumberParameter() <NEW_LINE> def _edge_template(self, item): <NEW_LINE> <INDENT> dw = item.width <NEW_LINE> dl = item.... | Base class for edge filters. | 62598efc26068e7796d4b2bf |
class InternalTests(IndivoTests, django.test.TestCase): <NEW_LINE> <INDENT> pass | subclass of Django's TestCase with access to useful utils
specific to Indivo tests (model creation, access control overrides, etc.).
Doesn't allow transaction management in tests. | 62598efc656771135c487fef |
class IsExpertOrReadOnly(permissions.BasePermission): <NEW_LINE> <INDENT> def has_object_permission(self, request, view, obj): <NEW_LINE> <INDENT> if request.method in permissions.SAFE_METHODS and request.method != 'OPTIONS': <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> return ('mediacloud.write_comments' in req... | Custom permission to only allow owners of an object to edit it. | 62598efc9c8ee8231303f60f |
class demo_templates__amp_chain(Module): <NEW_LINE> <INDENT> def __init__(self, bag_config, parent=None, prj=None, **kwargs): <NEW_LINE> <INDENT> Module.__init__(self, bag_config, yaml_file, parent=parent, prj=prj, **kwargs) <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def get_params_info(cls): <NEW_LINE> <INDENT> retur... | Module for library demo_templates cell amp_chain.
Fill in high level description here. | 62598efcbe7bc26dc9251316 |
class CreateFolderError(object): <NEW_LINE> <INDENT> __slots__ = ['_tag', '_value'] <NEW_LINE> _catch_all = None <NEW_LINE> def __init__(self, tag, value=None): <NEW_LINE> <INDENT> assert tag in self._tagmap, 'Invalid tag %r.' % tag <NEW_LINE> validator = self._tagmap[tag] <NEW_LINE> if isinstance(validator, bv.Void): ... | This class acts as a tagged union. Only one of the ``is_*`` methods will
return true. To get the associated value of a tag (if one exists), use the
corresponding ``get_*`` method. | 62598efc5fdd1c0f98e5c90b |
class _FloatBase(BaseProperty): <NEW_LINE> <INDENT> value = ListFloatField("valueOf_", key_name="value") | Define a common _parse_value function for Float and Double types. | 62598efc8a349b6b43684ba8 |
class AdvertiseViewSet(viewsets.ModelViewSet): <NEW_LINE> <INDENT> queryset = Advertise.objects.all() <NEW_LINE> serializer_class = AdvertiseSerializer <NEW_LINE> permission_classes = (IsAuthenticated, UserIsOwnerOrReadOnly, ) <NEW_LINE> parser_classes = (JSONParser, FormParser,) | Viewset handle for requesting course information
| 62598efce5267d203ee6a268 |
class CreateFork(Choreography): <NEW_LINE> <INDENT> def __init__(self, temboo_session): <NEW_LINE> <INDENT> Choreography.__init__(self, temboo_session, '/Library/GitHub/ReposAPI/Forks/CreateFork') <NEW_LINE> <DEDENT> def new_input_set(self): <NEW_LINE> <INDENT> return CreateForkInputSet() <NEW_LINE> <DEDENT> def _make_... | Create a new instance of the CreateFork Choreography. A TembooSession object, containing a valid
set of Temboo credentials, must be supplied. | 62598efc091ae3566870357f |
class MembersResource(Resource): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> @jwt_required <NEW_LINE> @swag_from('../swagger/members/GET.yml') <NEW_LINE> def get(slug): <NEW_LINE> <INDENT> channel = ChannelRepository.get(slug) <NEW_LINE> members = GitlabProvider.getMembers(channel.path) <NEW_LINE> return jsonify({"dat... | Verbs relative to the users | 62598efcad47b63b2c5a617f |
class DhcpLeaseCheck(rootfs_boot.RootFSBootTest): <NEW_LINE> <INDENT> def runTest(self): <NEW_LINE> <INDENT> board = self.dev.board <NEW_LINE> board.sendline("\ncat /tmp/dhcp.leases") <NEW_LINE> board.expect("leases") <NEW_LINE> board.expect(prompt) | Checked dhcp.leases file. | 62598efc0fa83653e46f3847 |
class RHAgreementManagerDetailsToggleNotifications(RHAgreementManagerDetails): <NEW_LINE> <INDENT> def _process(self): <NEW_LINE> <INDENT> enabled = request.form['enabled'] == '1' <NEW_LINE> self.definition.event_settings.set(self.event, 'manager_notifications_enabled', enabled) <NEW_LINE> return jsonify(success=True, ... | Toggle notifications to managers for an agreement type on an event. | 62598efc4527f215b58e8862 |
class Quarter(ndb.Model): <NEW_LINE> <INDENT> idNumber = ndb.IntegerProperty() <NEW_LINE> term = ndb.IntegerProperty() <NEW_LINE> year = ndb.IntegerProperty() <NEW_LINE> courses = ndb.IntegerProperty(repeated=True, write_empty_list=True) <NEW_LINE> name = "Quarter" | Quarter class containing quarter information, list of courses | 62598efc97e22403b383984d |
class BusinessLocationDecoration(Decoration) : <NEW_LINE> <INDENT> DecorationName = 'BusinessLocation' <NEW_LINE> @staticmethod <NEW_LINE> def Load(graph, info) : <NEW_LINE> <INDENT> return BusinessLocationDecoration() <NEW_LINE> <DEDENT> def __init__(self) : <NEW_LINE> <INDENT> Decoration.__init__(self) <NEW_LINE> sel... | BusinessLocationDecoration
This class decorates BusinessLocation objects | 62598efc99cbb53fe682f817 |
class CmdSorts(Commande): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> Commande.__init__(self, "sorts", "spells") <NEW_LINE> self.aide_courte = "manipule les sorts" <NEW_LINE> self.aide_longue = "Cette commande permet de manipuler vos sorts." <NEW_LINE> <DEDENT> def ajouter_parametres(self): <... | Commande 'sorts'.
| 62598efc44b2445a339b5e22 |
class Enrollment(models.Model): <NEW_LINE> <INDENT> id = fields.UUIDField(pk=True) <NEW_LINE> course = fields.ForeignKeyField( model_name="models.Course", related_name="enrollments", on_delete=fields.CASCADE, ) <NEW_LINE> student = fields.ForeignKeyField( model_name="models.Student", related_name="enrollments", on_dele... | The enrollment model. | 62598efc283ffb24f3cf2211 |
class FeatureFilter(LoggerMixin): <NEW_LINE> <INDENT> def __init__(self, limit=None, schema=None, keep_properties=True, chunk=False): <NEW_LINE> <INDENT> self.schema = schema <NEW_LINE> self.limit = limit <NEW_LINE> self.chunk = chunk or False <NEW_LINE> self.set_property_filter(keep_properties) <NEW_LINE> steps = [sel... | Handles vector geospatial data with some lazy filtering of features
Parameters:
limit - the number of features to keep
schema - a voluptuous.Schema or dictionary to use to filter on
feature properties
keep_properties - if True, all feature properties are kept, if
False, no feature propertie... | 62598efc9f2886367281715b |
class OutlierDetectorRPCA(PCA): <NEW_LINE> <INDENT> __metaclass__ = ABCMeta <NEW_LINE> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> self.num_outliers_ = kwargs.pop('num_outliers') <NEW_LINE> return PCA.__init__(self, *args, **kwargs) <NEW_LINE> <DEDENT> @abstractmethod <NEW_LINE> def fit(self, X, y=None): <... | Fits a PCA on a train set without ```num_outliers``` points identified from the train set. Exact
method of detection should be implemented in ```fit```.
Parameters
-----------
*args, **kwargs:
All standard PCA parameters.
num_outliers: int >= 0, Keyword argument
Number of outliers to identify. If 0, the metho... | 62598efc7b180e01f3e484fa |
class TaskExcelPandas(TaskData): <NEW_LINE> <INDENT> target_class = d6tflow.targets.ExcelPandasTarget <NEW_LINE> target_ext = 'xlsx' | Task which saves to CSV | 62598efc3346ee7daa336b1a |
class ShallowWater1D(Arakawa1D): <NEW_LINE> <INDENT> def __init__(self, nx, Lx=1.0e7, nu=1.0e3, nu_phi=None, r=1.0e-5, dt=1000.0): <NEW_LINE> <INDENT> super(ShallowWater1D, self).__init__(nx, Lx) <NEW_LINE> self.nu = nu <NEW_LINE> self.nu_phi = nu if nu_phi is None else nu_phi <NEW_LINE> self.r = r <NEW_LINE> self.dt =... | The Shallow Water Equations on the Arakawa-C grid. | 62598efcbf627c535bcafddb |
class Risk(db.Model, DbMixin): <NEW_LINE> <INDENT> id = db.Column(db.Integer, primary_key=True) <NEW_LINE> risklevel_id = db.Column(db.Integer, db.ForeignKey('risk_level.id')) <NEW_LINE> risktype_id = db.Column(db.Integer, db.ForeignKey('risk_type.id')) | Represents a risk.
A risk can be associated with multiple devices and configurations | 62598efc099cdd3c6367488a |
class UserActionListView(View): <NEW_LINE> <INDENT> def get(self, request, user_id): <NEW_LINE> <INDENT> user = get_object_or_404(UserProfile, id=int(user_id)) <NEW_LINE> user_actions = get_user_actions(user=user) <NEW_LINE> paginator = Paginator(user_actions, 10) <NEW_LINE> page = request.GET.get('page') <NEW_LINE> tr... | 用户动态列表 | 62598efc26068e7796d4b2c1 |
class QuestionView(APIView): <NEW_LINE> <INDENT> permission_classes = [IsAuthenticated & IsStudent] <NEW_LINE> serializer_class = serializers.CreateQuestionSerializer <NEW_LINE> queryset = models.Question.objects.all() <NEW_LINE> def get(self, request): <NEW_LINE> <INDENT> questions = models.Question.objects.all() <NEW... | Retrieve all the questions in the
system | 62598efc627d3e7fe0e057f5 |
class Architect(Occupation): <NEW_LINE> <INDENT> def __init__(self, person, company, shift): <NEW_LINE> <INDENT> super(Architect, self).__init__(person=person, company=company, shift=shift) <NEW_LINE> self.building_constructions = set() <NEW_LINE> self.house_constructions = set() | An architect at a construction firm. | 62598efc656771135c487ff1 |
@register_signal <NEW_LINE> class POSTagsSignal(BaseSignal): <NEW_LINE> <INDENT> signal_str: str = "POSTagsSignal" <NEW_LINE> do_serialize: bool = True <NEW_LINE> @property <NEW_LINE> def value(self) -> List[str]: <NEW_LINE> <INDENT> return self._value <NEW_LINE> <DEDENT> @value.setter <NEW_LINE> def value(self, value:... | POS tags of the nugget's words as determined by extractors. | 62598efc4a966d76dd5ed83b |
class MainHandler(ControllerMixin, tornado.web.RequestHandler): <NEW_LINE> <INDENT> def get(self): <NEW_LINE> <INDENT> self.render( "index.html", ) | Returns our index.html, rendered via template engine | 62598efcfff4ab517ebcc13a |
class JointRandomVerticalFlip(object): <NEW_LINE> <INDENT> def __call__(self, image, segmentation): <NEW_LINE> <INDENT> if random.random() < 0.5: <NEW_LINE> <INDENT> image = TF.vflip(image) <NEW_LINE> segmentation = TF.vflip(segmentation) <NEW_LINE> <DEDENT> return image, segmentation | Randomly vertically flip the given list of PIL.Image with a probability of 0.5
| 62598efcd486a94d0ba2a930 |
class LambdaExpr(FuncItem, Expression): <NEW_LINE> <INDENT> def name(self) -> str: <NEW_LINE> <INDENT> return '<lambda>' <NEW_LINE> <DEDENT> def expr(self) -> Expression: <NEW_LINE> <INDENT> ret = cast(ReturnStmt, self.body.body[-1]) <NEW_LINE> expr = ret.expr <NEW_LINE> assert expr is not None <NEW_LINE> return expr <... | Lambda expression | 62598efc57b8e32f525075b6 |
class Cat(Nnt): <NEW_LINE> <INDENT> def __init__(self, nts): <NEW_LINE> <INDENT> super(Cat, self).__init__() <NEW_LINE> dim = [nts[0].dim[0]] <NEW_LINE> for p, q in zip(nts[:-1], nts[1:]): <NEW_LINE> <INDENT> if p.dim[-1] != q.dim[0]: <NEW_LINE> <INDENT> raise Exception('dimension unmatch: {} to {}'.format(p, q)) <NEW_... | Neural networks formed by concatinating sub-networks. | 62598efc4f6381625f198970 |
class FilterException(Exception): <NEW_LINE> <INDENT> pass | An exception class which indicates an exception originating from a Filter object.
Is only defined for the custom name. | 62598efcbe383301e0252149 |
class QueryBuilder(object): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def _create_operation(model, fieldname, operator, argument, relation=None): <NEW_LINE> <INDENT> opfunc = OPERATORS[operator] <NEW_LINE> argspec = inspect.getargspec(opfunc) <NEW_LINE> numargs = len(argspec[0]) <NEW_LINE> field = getattr(model, rel... | Provides a static function for building a SQLAlchemy query object based
on a :class:`SearchParameters` instance.
Use the static :meth:`create_query` method to create a SQLAlchemy query on
a given model. | 62598efcdc8b845886d51f2f |
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 user object | 62598efc55399d3f05624e8e |
class CricketData(): <NEW_LINE> <INDENT> displays = { } <NEW_LINE> data = { } <NEW_LINE> def register_display(self, display): <NEW_LINE> <INDENT> self.displays.update({id(display): id}) <NEW_LINE> <DEDENT> def unregsiter_display(self, display): <NEW_LINE> <INDENT> self.displays.pop(id(display)) <NEW_LINE> <DEDENT> def ... | This is the subject class it must provide a register and an unregister method to add observers | 62598efc99fddb7c1ca622b6 |
class BasicExpander(object): <NEW_LINE> <INDENT> def __init__(self, target): <NEW_LINE> <INDENT> self.target = target <NEW_LINE> self.memoization_map = {} <NEW_LINE> <DEDENT> def expand_node(self, node): <NEW_LINE> <INDENT> def wrap_expansion(node, transformed_node): <NEW_LINE> <INDENT> return node if transformed_node ... | Basic expansion engine | 62598efc283ffb24f3cf2213 |
@api.route('/<int:problem_id>/tests.tar.gz') <NEW_LINE> @api.login_required(oauth_scopes=['problems:read']) <NEW_LINE> @api.response( code=HTTPStatus.NOT_FOUND, description="Problem not found.", ) <NEW_LINE> @api.resolve_object_by_model(Problem, 'problem') <NEW_LINE> class ProblemTestsArchiveByID(Resource): <NEW_LINE> ... | Manipulations with tests archive for a specific problem. | 62598efc66673b3332c2ed19 |
class MountaincarWrapper(gym.core.Wrapper): <NEW_LINE> <INDENT> def __init__(self, env): <NEW_LINE> <INDENT> super(MountaincarWrapper, self).__init__(env) <NEW_LINE> self._done = False <NEW_LINE> self._steps = 0 <NEW_LINE> self._max_steps = env.spec.max_episode_steps <NEW_LINE> <DEDENT> def reset(self): <NEW_LINE> <IND... | REINFORCE struggles to solve Mountaincar without at least minor reward shaping, mainly because reward is very
sparse in the beginning of the training.
Here we modify the reward function by adding small reward for moving fast in any direction. This helps a lot.
Repeating actions helps too. | 62598efc10dbd63aa1c6f4e7 |
class Type(nativeTypeWithAnotherAsStorage(list.Type)): <NEW_LINE> <INDENT> NAME = "Subset" <NEW_LINE> _SCHEMA = { schema.SchemaKeys.INIT: schema.STRING_LIST( {"default": [], "uniqueItems": True} ), "@values": schema.STRING_LIST({"uniqueItems": True}), } <NEW_LINE> SCHEMA = schema.COLLECTION_SCHEMA(_SCHEMA) <NEW_LINE> S... | Subset type implementation. | 62598efc7047854f4633dd30 |
class Base64DetectRequest(object): <NEW_LINE> <INDENT> swagger_types = { 'base64_content_to_detect': 'str' } <NEW_LINE> attribute_map = { 'base64_content_to_detect': 'Base64ContentToDetect' } <NEW_LINE> def __init__(self, base64_content_to_detect=None): <NEW_LINE> <INDENT> self._base64_content_to_detect = None <NEW_LIN... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62598efcaad79263cf42d179 |
class TensorAdd(Layer): <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> super(TensorAdd, self).__init__(**kwargs) <NEW_LINE> self.supports_masking = True <NEW_LINE> <DEDENT> def compute_mask(self, inputs, mask=None): <NEW_LINE> <INDENT> if mask is not None: <NEW_LINE> <INDENT> mask = mask[0] <NEW_... | ops: A+B | 62598efc627d3e7fe0e057f7 |
class FragmentLength(Task): <NEW_LINE> <INDENT> input_task = luigi.Parameter() <NEW_LINE> def requires(self): <NEW_LINE> <INDENT> return self.input_task <NEW_LINE> <DEDENT> def output(self): <NEW_LINE> <INDENT> super_output = super(FragmentLength, self).output().path <NEW_LINE> return YamlFile(super_output) <NEW_LINE> ... | Extracts the fragment length information using `SPP pipeline`_.
:param input_task: input task.
:type input_task: Generally a :class:`~chipalign.alignment.consolidation.ConsolidatedReads` task
.. _SPP pipeline: https://github.com/kundajelab/phantompeakqualtools | 62598efcbe7bc26dc9251318 |
class Comment(mongoengine.EmbeddedDocument): <NEW_LINE> <INDENT> created_time = mongoengine.DateTimeField(default=lambda: datetime.datetime.now()) <NEW_LINE> author = mongoengine.ReferenceField(models.User, required=True) <NEW_LINE> message = mongoengine.StringField(max_length=COMMENT_MESSAGE_MAX_LENGTH) | This class defines document type for comments on wall posts. | 62598efc63b5f9789fe83ac9 |
class Season(models.Model): <NEW_LINE> <INDENT> name = models.CharField(max_length=100) <NEW_LINE> league = models.ForeignKey(League) <NEW_LINE> def __unicode__(self): <NEW_LINE> <INDENT> return self.league.name + ' ' + self.name | Represents a season for a fantasy league
Fields:
name - season name (e.g. 2012, 2012-2013)
league - league for this season | 62598efc57b8e32f525075b7 |
class TestDescribeAbsoluteURIs(AnonAPITestCase): <NEW_LINE> <INDENT> scenarios_schemes = ( ("http", dict(scheme="http")), ("https", dict(scheme="https")), ) <NEW_LINE> scenarios_paths = ( ("script-at-root", dict(script_name="", path_info="")), ("script-below-root-1", dict(script_name="/foo/bar", path_info="")), ("scrip... | Tests for the `describe` view's URI manipulation. | 62598efc21bff66bcd7215c0 |
class AquoModelAdmin(admin.ModelAdmin): <NEW_LINE> <INDENT> list_display = ("description", "code", "group", "visible", ) <NEW_LINE> list_filter = ("group", "visible", ) <NEW_LINE> search_fields = ("code", "description", ) | ModelAdmin that provides filtering by group. | 62598efc99cbb53fe682f81b |
class TableRowHeaderTextsNormalized(): <NEW_LINE> <INDENT> def __init__(self, *, text_normalized: str = None) -> None: <NEW_LINE> <INDENT> self.text_normalized = text_normalized <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def from_dict(cls, _dict: Dict) -> 'TableRowHeaderTextsNormalized': <NEW_LINE> <INDENT> args = {} ... | If you provide customization input, the normalized version of the row header texts
according to the customization; otherwise, the same value as `row_header_texts`.
:attr str text_normalized: (optional) The normalized version of a row header
text. | 62598efccc40096d6161968e |
class update_default_trust_view(Updater): <NEW_LINE> <INDENT> def execute(self, **options): <NEW_LINE> <INDENT> ldap = self.api.Backend.ldap2 <NEW_LINE> default_trust_view_dn = DN(('cn', 'Default Trust View'), self.api.env.container_views, self.api.env.basedn) <NEW_LINE> default_trust_view_entry = [ dict(attr='objectcl... | Create Default Trust View for upgraded servers. | 62598efc851cf427c66b6c32 |
class reserveCallCreditPurchase_result: <NEW_LINE> <INDENT> thrift_spec = ( (0, TType.STRUCT, 'success', (PaymentReservationResult, PaymentReservationResult.thrift_spec), None, ), (1, TType.STRUCT, 'e', (TalkException, TalkException.thrift_spec), None, ), ) <NEW_LINE> def __init__(self, success=None, e=None,): <NEW_LIN... | Attributes:
- success
- e | 62598efc99fddb7c1ca622b7 |
class ChatBackend(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.channels = {} <NEW_LINE> <DEDENT> def subscribe(self, client, channel_name): <NEW_LINE> <INDENT> if channel_name not in self.channels: <NEW_LINE> <INDENT> self.channels[channel_name] = channel = Channel(channel_name) <NEW_LINE> ... | Manages subscriptions of clients to multiple channels. | 62598efc3d592f4c4edb9859 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.