code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class GDevelopInContainer(ContainerTests, test_games.GDevelopTests): <NEW_LINE> <INDENT> TIMEOUT_START = 20 <NEW_LINE> TIMEOUT_STOP = 10 <NEW_LINE> def setUp(self): <NEW_LINE> <INDENT> self.hosts = {443: ["api.github.com", "github.com"]} <NEW_LINE> self.apt_repo_override_path = os.path.join(self.APT_FAKE_REPO_PATH, 'un... | This will test GDevelop inside a container | 62599078627d3e7fe0e08836 |
class BaseXListener(threading.Thread): <NEW_LINE> <INDENT> volume_modifier = None <NEW_LINE> display = None <NEW_LINE> volume = None <NEW_LINE> def __init__(self, notification): <NEW_LINE> <INDENT> super(BaseXListener, self).__init__() <NEW_LINE> self.volume_modifier = VolumeModifierThread(notification) <NEW_LINE> self... | A generic thread to listen to X events.
`processEvent(event)` needs to be overridden by subclases | 62599078bf627c535bcb2e7d |
class TestConnector(object): <NEW_LINE> <INDENT> @pytest.fixture <NEW_LINE> def connection_params(self) -> dict: <NEW_LINE> <INDENT> return { "host": "localhost", "port": 5672, "vhost": "/", "user": "guest", "passwd": "guest", } <NEW_LINE> <DEDENT> @pytest.fixture <NEW_LINE> def connector(self, connection_params: dict)... | Tests for the Connector class. | 625990783317a56b869bf21d |
class IAdminResource(IResource): <NEW_LINE> <INDENT> pass | A marker interface for a web based administrative resource. | 625990787d43ff24874280ec |
class CalendarEvent: <NEW_LINE> <INDENT> def __init__(self, kwargs): <NEW_LINE> <INDENT> self.event_data = kwargs <NEW_LINE> <DEDENT> def __turn_to_string__(self): <NEW_LINE> <INDENT> self.event_text = "BEGIN:VEVENT\n" <NEW_LINE> for item, data in self.event_data.items(): <NEW_LINE> <INDENT> item = str(item).replace("_... | 事件对象 | 62599078283ffb24f3cf5251 |
class BaseCliStub(object): <NEW_LINE> <INDENT> def __init__(self, available_pkgs=(), available_groups=()): <NEW_LINE> <INDENT> self._available_pkgs = set(available_pkgs) <NEW_LINE> self._available_groups = set(available_groups) <NEW_LINE> self.installed_groups = set() <NEW_LINE> self.installed_pkgs = set() <NEW_LINE> s... | A class mocking `dnf.cli.cli.BaseCli`. | 625990783539df3088ecdc47 |
class GSettingsChangeMerger(BaseChangeMerger): <NEW_LINE> <INDENT> pass | GSettings change merger class | 625990784428ac0f6e659edf |
class DescribeSubnetsRequest(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.SubnetIds = None <NEW_LINE> self.Filters = None <NEW_LINE> self.Offset = None <NEW_LINE> self.Limit = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> self.SubnetIds = params.get("Su... | DescribeSubnets request structure.
| 625990789c8ee82313040e5f |
class DBHelper(object): <NEW_LINE> <INDENT> __dbAlia = 'db2 catalog db %s as %s at node %s' <NEW_LINE> __dbNode = 'db2 catalog tcpip node %s remote %s server %s remote_instance %s' <NEW_LINE> __conn2Db = 'db2 connect to %s user %s using %s' <NEW_LINE> __isNodeExist = 'db2 list node directory | grep -i %s' <NEW_LINE> __... | docstring for IBMdbHelper | 6259907856ac1b37e63039ba |
class CommonClient: <NEW_LINE> <INDENT> def __init__(self,server,port=5222,debug=['always', 'nodebuilder']): <NEW_LINE> <INDENT> if self.__class__.__name__=='Client': self.Namespace,self.DBG='jabber:client',DBG_CLIENT <NEW_LINE> elif self.__class__.__name__=='Component': self.Namespace,self.DBG=dispatcher.NS_COMPONENT_... | Base for Client and Component classes. | 6259907863b5f9789fe86b16 |
class GetInjectedWorkflows(DBFormatter): <NEW_LINE> <INDENT> sql = """SELECT DISTINCT name FROM wmbs_workflow WHERE injected = :injected""" <NEW_LINE> def execute(self, injected = False, conn = None, transaction = False): <NEW_LINE> <INDENT> if not injected: <NEW_LINE> <INDENT> binds = {'injected': 0} <NEW_LINE> <DEDEN... | Gets workflows that have been fully injected into WMBS | 6259907876e4537e8c3f0f2f |
class environment(object): <NEW_LINE> <INDENT> def __init__(self, launchSiteLat, launchSiteLon, launchSiteElev, dateAndTime, inflationTemperature=0.0, UTC_offset=0.0, debugging=False, load_on_init=False): <NEW_LINE> <INDENT> self.inflationTemperature = inflationTemperature <NEW_LINE> self.launchSiteLat = launchSiteLat ... | Defines a common interface for the Simulator module.
This is a meta class that should not be instantiated directly, and is
provided mainly for code reuse and a uniform API for the simulator class,
regardless of the environment data used.
Parameters
----------
launchSiteLat : float
latitude of the launch site [deg... | 62599078be7bc26dc9252b2d |
class ZoneoutCell(ModifierCell): <NEW_LINE> <INDENT> def __init__(self, base_cell, zoneout_outputs=0., zoneout_states=0.): <NEW_LINE> <INDENT> assert not isinstance(base_cell, FusedRNNCell), "FusedRNNCell doesn't support zoneout. " "Please unfuse first." <NEW_LINE> assert not isinstance(base_cell,... | Apply Zoneout on base cell.
Parameters
----------
base_cell : BaseRNNCell
Cell on whose states to perform zoneout.
zoneout_outputs : float, default 0.
Fraction of the output that gets dropped out during training time.
zoneout_states : float, default 0.
Fraction of the states that gets dropped out during tr... | 6259907899fddb7c1ca63aae |
class SIPPref: <NEW_LINE> <INDENT> def __init__(self, parent): <NEW_LINE> <INDENT> pass | A hidden Window that automatically
controls the Software Input Panel
according to the control focused in
the parent window.
It should be instancied after all
other controls in the parent window | 625990788e7ae83300eeaa3c |
class TestSignals(TestCase): <NEW_LINE> <INDENT> def test_thumbnails_are_generated_on_save(self): <NEW_LINE> <INDENT> product = models.Product( name="The Cathedral and the bazaar", price=Decimal("3.00") ) <NEW_LINE> product.save() <NEW_LINE> with open("main/fixtures/the-cathedral-the-bazaar.jpg", "rb") as fi: <NEW_LINE... | Since I need to make sure everything is WORKING,
I'll just using the examples from the book, I might change it later on. | 6259907891f36d47f2231b67 |
class FileBrowseUploadField(CharField): <NEW_LINE> <INDENT> description = "FileBrowseUploadField" <NEW_LINE> __metaclass__ = models.SubfieldBase <NEW_LINE> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> self.site = kwargs.pop('site', site) <NEW_LINE> self.directory = kwargs.pop('directory', '') <NEW_LINE> sel... | Model field which renders with an option to browse site.directory as well
as upload a file to a temporary folder (you still need to somehow move that
temporary file to an actual location when the model is being saved). | 62599078baa26c4b54d50c62 |
class Key(object): <NEW_LINE> <INDENT> def __init__(self, obj, *args): <NEW_LINE> <INDENT> self.obj = obj <NEW_LINE> <DEDENT> def __lt__(self, other): <NEW_LINE> <INDENT> for field in sort_fields: <NEW_LINE> <INDENT> lhs, rhs = getattr(self.obj, field), getattr(other.obj, field) <NEW_LINE> if lhs == rhs: <NEW_LINE> <IN... | Complex sort order key | 625990787cff6e4e811b73f0 |
class ModelSelector(object): <NEW_LINE> <INDENT> def __init__(self, all_word_sequences: dict, all_word_Xlengths: dict, this_word: str, n_constant=3, min_n_components=2, max_n_components=10, random_state=14, verbose=False): <NEW_LINE> <INDENT> self.words = all_word_sequences <NEW_LINE> self.hwords = all_word_Xlengths <N... | base class for model selection (strategy design pattern) | 625990785fdd1c0f98e5f92e |
class Quotas(extensions.ExtensionDescriptor): <NEW_LINE> <INDENT> name = "Quotas" <NEW_LINE> alias = "os-quota-sets" <NEW_LINE> namespace = "http://docs.openstack.org/compute/ext/quotas-sets/api/v1.1" <NEW_LINE> updated = "2011-08-08T00:00:00+00:00" <NEW_LINE> def get_resources(self): <NEW_LINE> <INDENT> resources = []... | Quotas management support. | 62599078442bda511e95da30 |
class image2d(recoBase): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(image2d, self).__init__() <NEW_LINE> self._productName = 'image2d' <NEW_LINE> self._product_id = 0 <NEW_LINE> larcv.load_pyutil() <NEW_LINE> <DEDENT> def drawObjects(self, view_manager, io_manager, meta): <NEW_LINE> <INDENT> imag... | docstring for cluster | 6259907816aa5153ce401e8b |
class Component(): <NEW_LINE> <INDENT> _name = None <NEW_LINE> _age = None <NEW_LINE> def __init__(self, name, age): <NEW_LINE> <INDENT> self._name = name <NEW_LINE> self._age = age <NEW_LINE> <DEDENT> def get_name(self): <NEW_LINE> <INDENT> return self._name <NEW_LINE> <DEDENT> def get_age(self): <NEW_LINE> <INDENT> r... | This class represents the component that will be decorated with new
responsibilities | 6259907801c39578d7f1440d |
class Scraper(object): <NEW_LINE> <INDENT> NETWORK_NAME = None <NEW_LINE> def __init__(self, credentials): <NEW_LINE> <INDENT> if credentials.ad_network_name != self.NETWORK_NAME: <NEW_LINE> <INDENT> raise RuntimeError("Invalid credentials. Attempting to use %s" "credentials for an %s scraper" % (cr... | Default Scraper abstract object.
All scrapers implement this class and it's methods. They're all weird as
fuck with roughly 0 things in common though... | 6259907897e22403b383c8b3 |
class StreamEditor(object): <NEW_LINE> <INDENT> table = [] <NEW_LINE> def __init__(self, filename, options): <NEW_LINE> <INDENT> if not self.table: <NEW_LINE> <INDENT> raise NotImplementedError("StreamEditor.table") <NEW_LINE> <DEDENT> self.changes = 0 <NEW_LINE> self.verbose = options.verbose <NEW_LINE> self.dryrun = ... | Abstract class for stream editing | 6259907897e22403b383c8b2 |
class ImproperPrior(Prior): <NEW_LINE> <INDENT> def to_distribution( self, dtype: torch.dtype = torch.float32, device: torch.device = None ): <NEW_LINE> <INDENT> return Improper() <NEW_LINE> <DEDENT> def description(self): <NEW_LINE> <INDENT> return f"Improper(-∞, +∞)" | Improper uniform prior with support over the real line. | 62599078bf627c535bcb2e7f |
class DummyStrategy(Strategy): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> <DEDENT> def window_size(self): <NEW_LINE> <INDENT> return 5 <NEW_LINE> <DEDENT> def advice(self, data): <NEW_LINE> <INDENT> cond = np.ceil(np.sum(data)) % 3 <NEW_LINE> if cond == 1: <NEW_LINE> <INDE... | Strategy that creates random advice, just to demo how to implement the
interface. | 6259907821bff66bcd72461a |
class TasksTests(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.factory = RequestFactory() <NEW_LINE> self.user = User.objects.create(username="user2", password="user2", email="[email protected]") <NEW_LINE> self.repository = Repository.objects.create(author=self.user, repo_name="repo2", owner_n... | Preparing data | 62599078f548e778e596cf42 |
@script_interface_register <NEW_LINE> class EnergyCriterion(_PairCriterion): <NEW_LINE> <INDENT> _so_name = "PairCriteria::EnergyCriterion" <NEW_LINE> _so_creation_policy="LOCAL" | Pair criterion returning true, if the short range energy between the particles is >= the cutoff
Be aware that the short range energy contains the short range part of dipolar and electrostatic interactions,
but not the long range part.
The following parameters can be passed to the constructor, changed via set_params()... | 6259907892d797404e389834 |
class TestUser(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.new_user = User('Rose','rudim3nt@l') <NEW_LINE> <DEDENT> def test__init__(self): <NEW_LINE> <INDENT> self.assertEqual(self.new_user.username,'Rose') <NEW_LINE> self.assertEqual(self.new_user.password,'rudim3nt@l') <NEW_LINE... | Test for user class | 625990784428ac0f6e659ee1 |
class SAG13Universe(SimulatedUniverse): <NEW_LINE> <INDENT> def __init__(self, **specs): <NEW_LINE> <INDENT> SimulatedUniverse.__init__(self, **specs) <NEW_LINE> <DEDENT> def gen_physical_properties(self, **specs): <NEW_LINE> <INDENT> PPop = self.PlanetPopulation <NEW_LINE> PPMod = self.PlanetPhysicalModel <NEW_LINE> T... | Simulated Universe module based on SAG13 Planet Population module.
| 625990782c8b7c6e89bd519c |
class Projector: <NEW_LINE> <INDENT> def __init__(self, parent, proj_exprs): <NEW_LINE> <INDENT> self.parent = parent <NEW_LINE> self.input_exprs = proj_exprs <NEW_LINE> self.resolved_exprs = [parent._ensure_expr(e) for e in proj_exprs] <NEW_LINE> node = parent.op() <NEW_LINE> self.parent_roots = ( [node] if isinstance... | Analysis and validation of projection operation, taking advantage of
"projection fusion" opportunities where they exist, i.e. combining
compatible projections together rather than nesting them. Translation /
evaluation later will not attempt to do any further fusion /
simplification. | 62599078167d2b6e312b826b |
class DagHandlerProvider(DependencyProvider): <NEW_LINE> <INDENT> def get_dependency(self, worker_ctx: object) -> DagHandler: <NEW_LINE> <INDENT> return DagHandler() | DependencyProvider for the DagHandler object. | 625990787c178a314d78e8c4 |
class ToolboxError(Exception): <NEW_LINE> <INDENT> __error_code = None <NEW_LINE> __details = None <NEW_LINE> def __init__(self, error_code, details=None): <NEW_LINE> <INDENT> super(ToolboxError, self).__init__() <NEW_LINE> self.__error_code = error_code <NEW_LINE> if details: <NEW_LINE> <INDENT> self.__details = detai... | Basic class for Toolbox internal errors | 62599078f9cc0f698b1c5fa5 |
class BamSetChecker(object): <NEW_LINE> <INDENT> def __init__(self) : <NEW_LINE> <INDENT> self.bamList=[] <NEW_LINE> self.bamLabels=[] <NEW_LINE> <DEDENT> def appendBams(self, inputBamList, inputLabel) : <NEW_LINE> <INDENT> if (inputBamList is None) or (len(inputBamList) == 0) : <NEW_LINE> <INDENT> raise OptParseExcep... | check properties of the input bams as an aggregate set
for instance, same chrom order, no repeated files, etc... | 625990784f6381625f19a185 |
class JobEventType(basestring): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def get_api_name(): <NEW_LINE> <INDENT> return "job-event-type" | Jobs will trigger history events at certain stages of their life
cycle. These events are of the types described herein.
Possible values:
<ul>
<li> "idle" - The job has become idle,
<li> "running" - The job has started running,
<li> "succeeded" - The job has completed successfully,
<li> "failed" ... | 6259907826068e7796d4e2f0 |
class ProxyFetchMonitoringProtocol(monitor.MonitoringProtocol): <NEW_LINE> <INDENT> INTV_CHECK = 10 <NEW_LINE> TIMEOUT_GET = 5 <NEW_LINE> __name__ = 'ProxyFetch' <NEW_LINE> from twisted.internet import defer, error <NEW_LINE> from twisted.web import error as weberror <NEW_LINE> catchList = ( defer.TimeoutError, weberro... | Monitor that checks server uptime by repeatedly fetching a certain URL | 62599078627d3e7fe0e0883b |
class CloneProvisionError(Exception): <NEW_LINE> <INDENT> pass | Raised when a repo cannot be provisioned. | 62599078f548e778e596cf44 |
class Keybinding(): <NEW_LINE> <INDENT> def __init__(self,up="z",down="s",left="q",right="d",accept="y",refuse="n"): <NEW_LINE> <INDENT> self.up = up <NEW_LINE> self.down = down <NEW_LINE> self.left = left <NEW_LINE> self.right = right <NEW_LINE> self.accept = accept <NEW_LINE> self.refuse = refuse <NEW_LINE> <DEDENT> ... | Class contatining the keys that have special effects | 625990783d592f4c4edbc837 |
class HeatRateCurve(Curve): <NEW_LINE> <INDENT> def __init__(self, isNetGrossP=False, ThermalGeneratingUnit=None, *args, **kw_args): <NEW_LINE> <INDENT> self.isNetGrossP = isNetGrossP <NEW_LINE> self._ThermalGeneratingUnit = None <NEW_LINE> self.ThermalGeneratingUnit = ThermalGeneratingUnit <NEW_LINE> super(HeatRateCur... | Relationship between unit heat rate per active power (Y-axis) and unit output (X-axis). The heat input is from all fuels.
| 62599078091ae356687065ef |
class VocabularySearchRequestArgsSchema(SearchRequestArgsSchema): <NEW_LINE> <INDENT> tags = fields.Str() | Add parameter to parse tags. | 6259907892d797404e389835 |
class FileUnitValidator(UnitValidator): <NEW_LINE> <INDENT> def explain(self, unit, field, kind, message): <NEW_LINE> <INDENT> stock_msg = self._explain_map.get(kind) <NEW_LINE> if message or stock_msg: <NEW_LINE> <INDENT> return message or stock_msg | Validator for the FileUnit class.
The sole purpose of this class is to have a custom :meth:`explain()`
so that we can skip the 'field' part as nobody is really writing file
units and the notion of a field may be confusing. | 625990787d43ff24874280ee |
class DatasetNeg(Dataset): <NEW_LINE> <INDENT> def __init__(self, cands, n_img_per_load = None, max_memory_MB = 2000, max_n_reuse = 1, **kwargs): <NEW_LINE> <INDENT> Dataset.__init__(self, cands, **kwargs) <NEW_LINE> self.max_memory_MB = max_memory_MB <NEW_LINE> if n_img_per_load is None: <NEW_LINE> <INDENT> self.n_img... | Load patches incrementally from the disk after a set number of reuse.
Suitable for negative examples which are abundant and does not need to be
augemnted.
The user doesn't need to invoke a separate command for loading:
s/he can keep calling get_train_valid() and the samples will be
loaded if necessary. | 625990785fdd1c0f98e5f931 |
class TestNulTerminatedString(_TestValueType): <NEW_LINE> <INDENT> value_type = NulTerminatedString(10) <NEW_LINE> attrs = ( ('max_', 10), ('encoding', 'iso-8859-1'), ('sfmt', '10s'), ) <NEW_LINE> accepts_value = ( ('', ''), ('foo', 'foo'), ('bar' * 3, 'bar' * 3), (u'ìë', u'ìë'), ) <NEW_LINE> rejects_value = ( 'bar' * ... | Test :class:`NulTerminatedString` for default encoding. | 62599078dc8b845886d54f6e |
class Shapeshift_fee(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.shapeshift_fee_data = Shapeshift_api.get_fees_shapeshift() <NEW_LINE> self.last_update_time = time.time() <NEW_LINE> <DEDENT> def get_shapeshift_fee(self, currency): <NEW_LINE> <INDENT> current_time = time.time() <NEW_LINE> i... | Class responible for scraping the Shapeshift fee | 625990787c178a314d78e8c5 |
class ConsoleServerPort(models.Model): <NEW_LINE> <INDENT> device = models.ForeignKey('Device', related_name='cs_ports', on_delete=models.CASCADE) <NEW_LINE> name = models.CharField(max_length=30) <NEW_LINE> objects = ConsoleServerPortManager() <NEW_LINE> class Meta: <NEW_LINE> <INDENT> unique_together = ['device', 'na... | A physical port within a Device (typically a designated console server) which provides access to ConsolePorts. | 62599078d268445f2663a838 |
class OwnerSchema(StrictKeysSchema): <NEW_LINE> <INDENT> id = fields.Function(lambda x: x) | Schema for owners.
Allows us to later introduce more properties for an owner. | 625990787047854f46340d6f |
class CollisionSystem(System): <NEW_LINE> <INDENT> requirements = [ 'position', 'map_layer', 'layer', 'physics', 'sprite' ] <NEW_LINE> event_handlers = { EntityMoveEvent: ['on_entity_event', 12] } <NEW_LINE> def update(self, entity, event=None): <NEW_LINE> <INDENT> if not entity.components['position'].old: <NEW_LINE> <... | Collision system. | 62599078be8e80087fbc0a49 |
class ContactDetails(mincepy.SimpleSavable): <NEW_LINE> <INDENT> TYPE_ID = uuid.UUID('7d2e1cf5-6c75-4b85-9fe3-46c70e680e69') <NEW_LINE> name = mincepy.field() <NEW_LINE> email = mincepy.field() <NEW_LINE> institution = mincepy.field() <NEW_LINE> address = mincepy.field() <NEW_LINE> task = mincepy.field() <NEW_LINE> wor... | Database storable class representing a person's contact details | 62599078f548e778e596cf45 |
class IoK8sApiCoreV1WeightedPodAffinityTerm(object): <NEW_LINE> <INDENT> swagger_types = { 'pod_affinity_term': 'IoK8sApiCoreV1PodAffinityTerm', 'weight': 'int' } <NEW_LINE> attribute_map = { 'pod_affinity_term': 'podAffinityTerm', 'weight': 'weight' } <NEW_LINE> def __init__(self, pod_affinity_term=None, weight=None):... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 6259907832920d7e50bc79fc |
class QtMdiWindow(QtWidget, ProxyMdiWindow): <NEW_LINE> <INDENT> widget = Typed(QMdiSubWindow) <NEW_LINE> def create_widget(self): <NEW_LINE> <INDENT> widget = QMdiSubWindow() <NEW_LINE> widget.layout().setSizeConstraint(QLayout.SetMinAndMaxSize) <NEW_LINE> self.widget = widget <NEW_LINE> <DEDENT> def init_widget(self)... | A Qt implementation of an Enaml ProxyMdiWindow.
| 6259907897e22403b383c8b7 |
class MockAppDaemon: <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> from appdaemontestframework.appdaemon_mock.scheduler import MockScheduler <NEW_LINE> self.tz = pytz.timezone('UTC') <NEW_LINE> self.sched = MockScheduler(self) | Implementation of appdaemon's internal AppDaemon class suitable for testing | 62599078aad79263cf43016e |
class Document(object): <NEW_LINE> <INDENT> def __init__(self, content, document_date=None, document_id=None): <NEW_LINE> <INDENT> if document_id is None: <NEW_LINE> <INDENT> document_id = uuid.uuid4() <NEW_LINE> <DEDENT> self.document_id = document_id <NEW_LINE> self.document_date = document_date <NEW_LINE> self.conte... | Documento a ser sicnronizado nas várias bases de dados | 6259907821bff66bcd72461e |
class Metadata(graphene.ObjectType): <NEW_LINE> <INDENT> hash = graphene.String() <NEW_LINE> origin_id = LingvodocID() <NEW_LINE> blobs = graphene.List(LingvodocID) <NEW_LINE> merged_by = LingvodocID() <NEW_LINE> data_type = graphene.String() <NEW_LINE> blob_description = graphene.String() <NEW_LINE> merge = graphene.F... | graphene object that have all metadata attributes
if new attributes of metadata are added, then this class has to be updated | 62599078460517430c432d34 |
class ProxyProtocolHttpsConnection(ProxyProtocolHttpConnection): <NEW_LINE> <INDENT> SSL_CIPHERS = "HIGH:!ADH" <NEW_LINE> SSL_PROTOCOL = ssl.PROTOCOL_TLSv1 <NEW_LINE> def __init__(self, host, port=None, key_file=None, cert_file=None, ca_certs=None, validate=True, proxied_src='localhost', proxied_dst='localhost', proxie... | A secure HTTP communicator (via SSL) which supports proxy protocol | 625990785fdd1c0f98e5f933 |
class IMailchimpSettings(Interface): <NEW_LINE> <INDENT> api_key = schema.TextLine( title=_(u"MailChimp API Key"), description=_(u"help_api_key", default=u"Enter in your MailChimp key here (.e.g. " + "'8b785dcabe4b5aa24ef84201ea7dcded-us4'). Log into " + "mailchimp.com, go to account -> extras -> API Keys & " + "Author... | Global mailchimp settings. This describes records stored in the
configuration registry and obtainable via plone.registry. | 625990784527f215b58eb67b |
class TestGegl(unittest.TestCase): <NEW_LINE> <INDENT> def test_100_init(self): <NEW_LINE> <INDENT> Gegl.init(None); <NEW_LINE> <DEDENT> def test_200_config_defaults(self): <NEW_LINE> <INDENT> gegl_config = Gegl.config() <NEW_LINE> self.assertEqual(gegl_config.props.quality, 1.0) <NEW_LINE> <DEDENT> def test_300_exit(s... | Tests the Gegl global functions, initialization and configuration handling. | 62599078283ffb24f3cf5257 |
class BaseMixer(object): <NEW_LINE> <INDENT> amplification_factor = settings.MIXER_MAX_VOLUME / 100.0 <NEW_LINE> @property <NEW_LINE> def volume(self): <NEW_LINE> <INDENT> volume = self.get_volume() <NEW_LINE> if volume is None: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> return int(volume / self.amplification_... | **Settings:**
- :attr:`mopidy.settings.MIXER_MAX_VOLUME` | 62599078167d2b6e312b826d |
class SequenceBatch(object): <NEW_LINE> <INDENT> def __init__( self, sequences, original_idxs=None, pad_idx=None, left_aligned=True ): <NEW_LINE> <INDENT> if len(sequences) == 0: <NEW_LINE> <INDENT> raise ValueError("Can't batch 0 sequences together") <NEW_LINE> <DEDENT> if not isinstance(sequences[0], Iterable): <NEW_... | Batched sequence object with padding
This wraps a list of integer sequences into a nice array padded to the
longest sequence. The batch dimension (number of sequences) is the last
dimension.
By default the sequences are padded to the right which means that they
are aligned to the left (they all start at index 0)
Arg... | 625990785fcc89381b266e35 |
class SpeciesSearchForm(SearchForm): <NEW_LINE> <INDENT> q = None <NEW_LINE> querystring = forms.CharField(required=False, widget=forms.widgets.TextInput(attrs={ "placeholder": "name:Bass OR category:Plants" }), label="Search") <NEW_LINE> sort_by = forms.ChoiceField(choices=[ ("name", "Name"), ("scientific_name", "Scie... | This form handles searching for a species in the species list view. | 62599078379a373c97d9a9d9 |
class MicrositeAwareSettings(object): <NEW_LINE> <INDENT> def __getattr__(self, name): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if isinstance(microsite.get_value(name), dict): <NEW_LINE> <INDENT> return microsite.get_dict(name, getattr(base_settings, name, None)) <NEW_LINE> <DEDENT> return microsite.get_value(name,... | This class is a proxy object of the settings object from django.
It will try to get a value from the microsite and default to the
django settings | 625990788e7ae83300eeaa42 |
class HotspotPage(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def validate_dbus_object(cls, path, state): <NEW_LINE> <INDENT> name = introspection.get_classname_from_path(path) <NEW_LINE> if name == b'ItemPage': <NEW_LINE> <INDENT> if state['objectName'][1] == 'hot... | Autopilot helper for Hotspot page. | 62599078e1aae11d1e7cf4eb |
class Entry(): <NEW_LINE> <INDENT> def __init__(self, level, heading, tags=None, content=None, starter_char=None): <NEW_LINE> <INDENT> if starter_char: <NEW_LINE> <INDENT> self.starter_char = starter_char <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.starter_char = "*" <NEW_LINE> <DEDENT> self.level = self.starter... | Describes an individual TODO item for use in agendas and TODO lists | 625990787047854f46340d71 |
class DistributionPieViz(NVD3Viz): <NEW_LINE> <INDENT> viz_type = "pie" <NEW_LINE> verbose_name = _("Distribution - NVD3 - Pie Chart") <NEW_LINE> is_timeseries = False <NEW_LINE> fieldsets = ({ 'label': None, 'fields': ( 'metrics', 'groupby', 'limit', 'pie_label_type', ('donut', 'show_legend'), 'labels_outside', ) },) ... | Annoy visualization snobs with this controversial pie chart | 6259907844b2445a339b7639 |
class SimpleVirus(object): <NEW_LINE> <INDENT> def __init__(self, maxBirthProb, clearProb): <NEW_LINE> <INDENT> self.maxBirthProb = maxBirthProb <NEW_LINE> self.clearProb = clearProb <NEW_LINE> <DEDENT> def getMaxBirthProb(self): <NEW_LINE> <INDENT> return self.maxBirthProb <NEW_LINE> <DEDENT> def getClearProb(self): <... | Representation of a simple virus (does not model drug effects/resistance). | 625990785fc7496912d48f45 |
class Book: <NEW_LINE> <INDENT> def __init__(self, title: str, author: str, bid: str = None, **kwargs: Any): <NEW_LINE> <INDENT> self.title = title <NEW_LINE> self.author = author <NEW_LINE> self.bid = bid if bid is not None else str(uuid4()) <NEW_LINE> self.is_lent = False <NEW_LINE> self.current_user = None <NEW_LINE... | Stores data and manages books | 62599078097d151d1a2c2a2d |
class Function: <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def forward(context, *args, **kwargs): <NEW_LINE> <INDENT> raise NotImplementedError("The forward method should be implemented.") <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def backward(context, *output_grads): <NEW_LINE> <INDENT> raise NotImplementedError(... | Interface for custom functions to be added to a computational graph.
Any custom functions should subclass Function and implement two mandatory
static methods: forward and backward.
The function should be called by using the apply method, which will return
the resulting Tensor of the operation with its corresponding i... | 6259907801c39578d7f14410 |
class AliasMixin(models.AbstractModel): <NEW_LINE> <INDENT> _name = 'mail.alias.mixin' <NEW_LINE> _inherits = {'mail.alias': 'alias_id'} <NEW_LINE> alias_id = fields.Many2one('mail.alias', string='Alias', ondelete="restrict", required=True) <NEW_LINE> def get_alias_model_name(self, vals): <NEW_LINE> <INDENT> return Non... | A mixin for models that inherits mail.alias. This mixin initializes the
alias_id column in database, and manages the expected one-to-one
relation between your model and mail aliases. | 62599078442bda511e95da33 |
class BetterLogger(werkzeug.serving.BaseRequestHandler): <NEW_LINE> <INDENT> _user_state = None <NEW_LINE> app = ppc.app() <NEW_LINE> @app.teardown_request <NEW_LINE> def _teardown(response): <NEW_LINE> <INDENT> user_state = '""' <NEW_LINE> if 'user.biv_id' in flask.session: <NEW_LINE> <INDENT> user_state = 'l' <NEW_LI... | HTTP access logger which includes user_state. | 625990787cff6e4e811b73f7 |
class SimpleDatasetPredictor(DatasetPredictorBase): <NEW_LINE> <INDENT> def __init__(self, config, dataset): <NEW_LINE> <INDENT> super(SimpleDatasetPredictor, self).__init__(config, dataset) <NEW_LINE> self.predictor = OfflinePredictor(config) <NEW_LINE> <DEDENT> def get_result(self): <NEW_LINE> <INDENT> self.dataset.r... | Run the predict_config on a given `DataFlow`. | 62599078bf627c535bcb2e85 |
@SingletonDecorator <NEW_LINE> class CallCentre(AbstractCallCentre): <NEW_LINE> <INDENT> def __init__(self, ndirectors, nmanagers, nrespondents): <NEW_LINE> <INDENT> self._employees = {} <NEW_LINE> self._create_call_centre(ndirectors, nmanagers, nrespondents) <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> ... | Concrete Call Centre | 62599078fff4ab517ebcf1ce |
class Solution: <NEW_LINE> <INDENT> def twoSum(self, numbers, target): <NEW_LINE> <INDENT> from collections import defaultdict <NEW_LINE> table = defaultdict(int) <NEW_LINE> for i, num in enumerate(numbers): <NEW_LINE> <INDENT> if target - num in table: <NEW_LINE> <INDENT> return sorted([i + 1, table[target - num]]) <N... | @param numbers : An array of Integer
@param target : target = numbers[index1] + numbers[index2]
@return : [index1 + 1, index2 + 1] (index1 < index2) | 62599078796e427e53850131 |
class Something(data.Dataset): <NEW_LINE> <INDENT> def __init__(self, root_path, annotation_path, subset, n_samples_for_each_video=1, spatial_transform=None, temporal_transform=None, target_transform=None, sample_duration=16, get_loader=get_default_video_loader): <NEW_LINE> <INDENT> self.data, self.class_names = make_d... | Args:
root (string): Root directory path.
spatial_transform (callable, optional): A function/transform that takes in an PIL image
and returns a transformed version. E.g, ``transforms.RandomCrop``
temporal_transform (callable, optional): A function/transform that takes in a list of frame indices
... | 625990784c3428357761bc6f |
@dataclass <NEW_LINE> class PedidoConsultaCnpj: <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> name = "PedidoConsultaCNPJ" <NEW_LINE> namespace = "http://www.prefeitura.sp.gov.br/nfe" <NEW_LINE> <DEDENT> cabecalho: Optional["PedidoConsultaCnpj.Cabecalho"] = field( default=None, metadata={ "name": "Cabecalho", "typ... | Schema utilizado para PEDIDO de consultas de CNPJ.
Este Schema XML é utilizado pelos tomadores e/ou prestadores de
serviços consultarem quais Inscrições Municipais (CCM) estão
vinculadas a um determinado CNPJ e se estes CCM emitem NFS-e ou não.
:ivar cabecalho: Cabeçalho do pedido.
:ivar cnpjcontribuinte: Informe o C... | 6259907823849d37ff852a6f |
class Command(BaseCommand): <NEW_LINE> <INDENT> help = "Handles rename and delete operations on mailboxes" <NEW_LINE> option_list = BaseCommand.option_list + ( make_option( "--pidfile", default="/tmp/handle_mailbox_operations.pid", help="Path to the file that will contain the PID of this process" ), ) <NEW_LINE> def __... | Command definition | 62599078dc8b845886d54f72 |
class Gaussian(RandomVariable): <NEW_LINE> <INDENT> def __init__(self, mu=None, var=None, tau=None): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.mu = mu <NEW_LINE> if var is not None: <NEW_LINE> <INDENT> self.var = var <NEW_LINE> <DEDENT> elif tau is not None: <NEW_LINE> <INDENT> self.tau = tau <NEW_LINE> <D... | The Gaussian distribution
p(x|mu, var)
= exp{-0.5 * (x - mu)^2 / var} / sqrt(2pi * var) | 6259907856ac1b37e63039be |
class UndirectedGraphOperadBasis(UndirectedGraphBasis): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._graphs = keydefaultdict(partial(undirected_graph_cache.graphs, has_odd_automorphism=False)) <NEW_LINE> <DEDENT> def graph_to_key(self, graph): <NEW_LINE> <INDENT> g, undo_canonicalize, sign = undire... | Basis consisting of labeled undirected graphs with no automorphisms that induce an odd permutation on edges | 625990785fcc89381b266e36 |
class Owl( GenericXml ): <NEW_LINE> <INDENT> edam_format = "format_3262" <NEW_LINE> file_ext = "owl" <NEW_LINE> def set_peek( self, dataset, is_multi_byte=False ): <NEW_LINE> <INDENT> if not dataset.dataset.purged: <NEW_LINE> <INDENT> dataset.peek = data.get_file_peek( dataset.file_name, is_multi_byte=is_multi_byte ) <... | Web Ontology Language OWL format description
http://www.w3.org/TR/owl-ref/ | 625990785fdd1c0f98e5f936 |
class SeleniumMiddleware(object): <NEW_LINE> <INDENT> def process_request(self, request, spider): <NEW_LINE> <INDENT> if ("webdriver" in request.meta and request.meta["webdriver"] == "do_use"): <NEW_LINE> <INDENT> log("Selenium requesting {}".format(request.url)) <NEW_LINE> try: <NEW_LINE> <INDENT> spider.driver.get(re... | Uses Selenium for the items having the key in their meta set | 6259907844b2445a339b763a |
class MediaForm(forms.ModelForm): <NEW_LINE> <INDENT> is_private = forms.NullBooleanField(widget=forms.CheckboxInput(), label=_(u"Private")) <NEW_LINE> class Meta: <NEW_LINE> <INDENT> model = Media <NEW_LINE> fields = ('caption', 'private_media', 'tags',) | Form to add a media object | 62599078d486a94d0ba2d970 |
class UploadNodesInfo(GenericRolesHook): <NEW_LINE> <INDENT> identity = 'upload_nodes_info' <NEW_LINE> def serialize(self): <NEW_LINE> <INDENT> q_nodes = objects.Cluster.get_nodes_not_for_deletion(self.cluster) <NEW_LINE> nodes = set(q_nodes.filter_by(status=consts.NODE_STATUSES.ready)) <NEW_LINE> nodes.update(self.nod... | Hook that uploads info about all nodes in cluster. | 62599078a8370b77170f1d87 |
class MainApplication(tk.Frame): <NEW_LINE> <INDENT> def __init__(self, root=None, *args, **kwargs): <NEW_LINE> <INDENT> tk.Frame.__init__(self, root) <NEW_LINE> self.root = root <NEW_LINE> self.download_location = "downloads/" <NEW_LINE> self.download_type = tk.IntVar() <NEW_LINE> self.url_label = tk.Label(self.root, ... | Constructor containing tkinter styles and settings. | 6259907897e22403b383c8ba |
class ProductTypeSerializer(serializers.HyperlinkedModelSerializer): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = ProductType <NEW_LINE> fields = ('id', 'label', 'url'); | Creates ProductType Serializer
@rtwhitfield84 | 62599078460517430c432d36 |
class ControlWindow(tkinter.Frame): <NEW_LINE> <INDENT> def __init__(self, parent_win, master): <NEW_LINE> <INDENT> self.root = master <NEW_LINE> self.parent_win = parent_win <NEW_LINE> w = self.root.winfo_screenwidth() <NEW_LINE> h = self.root.winfo_screenheight() * 0.06 <NEW_LINE> x = WIN10PADDING <NEW_LINE> y = self... | Control window to contain variable name and picture preview | 625990784527f215b58eb67d |
class MyDistribution(Distribution): <NEW_LINE> <INDENT> global_options = Distribution.global_options + [ ('disable-ext', None, 'Disable building extensions.') ] <NEW_LINE> def finalize_options(self): <NEW_LINE> <INDENT> Distribution.finalize_options(self) <NEW_LINE> try: <NEW_LINE> <INDENT> i = self.script_args.index('... | This seems to be is the only obvious way to add a global option to
distutils.
Provide the ability to disable building the extensions for any called
command. | 6259907855399d3f05627ecd |
class Users(APIView): <NEW_LINE> <INDENT> authentication_classes = (SessionAuthentication, BasicAuthentication) <NEW_LINE> permission_classes = (IsAuthenticated, IsAdminUser,) <NEW_LINE> parser_classes = (JSONParser,) <NEW_LINE> def get(self, request, format=None): <NEW_LINE> <INDENT> users = User.objects.all() <NEW_LI... | List all users. | 6259907860cbc95b06365a4a |
class EnterpriseCustomerEntitlementViewSet(EnterpriseReadOnlyModelViewSet): <NEW_LINE> <INDENT> queryset = models.EnterpriseCustomerEntitlement.objects.all() <NEW_LINE> serializer_class = serializers.EnterpriseCustomerEntitlementSerializer <NEW_LINE> USER_ID_FILTER = 'enterprise_customer__enterprise_customer_users__use... | API views for the ``enterprise-customer-entitlements`` API endpoint. | 62599078ec188e330fdfa261 |
class DispatchAgregation(object): <NEW_LINE> <INDENT> def __init__(self, dispatch, moves_by_loc): <NEW_LINE> <INDENT> self.dispatch_id = dispatch <NEW_LINE> self.moves_by_loc = moves_by_loc <NEW_LINE> <DEDENT> @property <NEW_LINE> def picker_id(self): <NEW_LINE> <INDENT> return self.dispatch_id.picker_id <NEW_LINE> <DE... | group moves from a single dispatch by source and dest locations | 6259907876e4537e8c3f0f39 |
class Item: <NEW_LINE> <INDENT> def __init__ (self, position): <NEW_LINE> <INDENT> self.pos_x = position[0] <NEW_LINE> self.pos_y = position[1] <NEW_LINE> self.visible = True <NEW_LINE> <DEDENT> @property <NEW_LINE> def sprite_position(self): <NEW_LINE> <INDENT> return (self.pos_x * TILE_SIZE, self.pos_y * TILE_SIZE) | Creat an item with position | 62599078e1aae11d1e7cf4ed |
class SessionToken(db.Model): <NEW_LINE> <INDENT> __tablename__ = 'authn_session_tokens' <NEW_LINE> user_id = db.Column(db.Uuid, db.ForeignKey('users.id'), primary_key=True) <NEW_LINE> token = db.Column(db.UnicodeText, unique=True, index=True, nullable=False) <NEW_LINE> created_at = db.Column(db.DateTime, nullable=Fals... | A user's session token. | 625990787047854f46340d75 |
class Scorer(object): <NEW_LINE> <INDENT> def rescore(self, thing, score): <NEW_LINE> <INDENT> raise NotImplementedError("cannot instantiate Abstract Base Class") | Implementations of this interface computes a new 'score' to a object such
as an ID of an item or user which a Recommender is considering returning as
a top recommendation. | 625990781f5feb6acb1645b1 |
class MySocket: <NEW_LINE> <INDENT> def __init__(self, sock=None,verb=False,timeout=10): <NEW_LINE> <INDENT> self.verb = verb <NEW_LINE> if sock is None: <NEW_LINE> <INDENT> self.sock = socket.socket( socket.AF_INET, socket.SOCK_STREAM) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.sock = sock <NEW_LINE> <DEDENT> ... | Socket class
The original comment on the example this is base on was:
``demonstration class only - coded for clarity, not efficiency`` | 625990785fdd1c0f98e5f938 |
class FileValidationError(Exception): <NEW_LINE> <INDENT> pass | An exception to indicate that a data file has failed validation. | 62599078097d151d1a2c2a31 |
class LocationFields(IntEnum): <NEW_LINE> <INDENT> Location = 0x85 | The matching criteria which take a Location, as defined above | 62599078442bda511e95da35 |
class TestScanBlackoutSchedule(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 testScanBlackoutSchedule(self): <NEW_LINE> <INDENT> pass | ScanBlackoutSchedule unit test stubs | 6259907897e22403b383c8bd |
class TestConfig(BaseConfig): <NEW_LINE> <INDENT> TESTING = True <NEW_LINE> BASE_DIR = os.path.abspath(os.path.dirname(__file__)) <NEW_LINE> SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(BASE_DIR, 'test.db') <NEW_LINE> SQLALCHEMY_TRACK_MODIFICATIONS = False <NEW_LINE> WTF_CSRF_ENABLED = False <NEW_LINE> LOGIN_D... | Configuration for general testing | 62599078fff4ab517ebcf1d2 |
class RigesterForm(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 = User <NEW_LINE> fields = ('username', 'e... | A form for creating new users. Includes all the required
fields, plus a repeated password. | 625990787047854f46340d76 |
class Detector(six.with_metaclass(ABCMeta, object)): <NEW_LINE> <INDENT> def __init__(self, SE_size_factor=0.15, lam_factor=5, area_factor=0.05, connectivity=4): <NEW_LINE> <INDENT> self.SE_size_factor = SE_size_factor <NEW_LINE> self.lam_factor = lam_factor <NEW_LINE> self.area_factor = area_factor <NEW_LINE> self.con... | Abstract class for salient region detectors.
Parameters
------
SE_size_factor: float, optional
The fraction of the image size that the structuring element should be
lam_factor : float, optional
The factor of lambda compared to the SE size
area_factor: float, optional
factor that describes the minimum area ... | 62599078283ffb24f3cf525c |
class Primitive: <NEW_LINE> <INDENT> def __init__(self, is_additive, rotation, shape): <NEW_LINE> <INDENT> self.is_additive = is_additive <NEW_LINE> self.rotation = rotation <NEW_LINE> self.shape = shape <NEW_LINE> <DEDENT> def __eq__(self, other): <NEW_LINE> <INDENT> return (self.is_additive == other.is_additive and s... | A shape with rotation and exposure modifiers. | 62599078283ffb24f3cf525d |
class NegativeHandler(object): <NEW_LINE> <INDENT> def __init__(self, matcher, actual, *args, **kwargs): <NEW_LINE> <INDENT> self.actual = actual <NEW_LINE> self.matcher = matcher <NEW_LINE> self.args = args <NEW_LINE> self.kwargs = kwargs <NEW_LINE> <DEDENT> def resolve(self): <NEW_LINE> <INDENT> if self.matcher.match... | Used to resolve match of actual against a matcher and propogate a
failure if it does. | 625990782c8b7c6e89bd51a6 |
class ErrorMock(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.msg = None <NEW_LINE> <DEDENT> def error(self, msg): <NEW_LINE> <INDENT> self.msg = msg | Error handling | 6259907855399d3f05627ecf |
class MenuGlyph(Enum,IComparable,IFormattable,IConvertible): <NEW_LINE> <INDENT> def __eq__(self,*args): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def __format__(self,*args): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def __ge__(self,*args): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def __gt__(self,*args): <NEW... | Specifies the image to draw when drawing a menu with the System.Windows.Forms.ControlPaint.DrawMenuGlyph(System.Drawing.Graphics,System.Drawing.Rectangle,System.Windows.Forms.MenuGlyph) method.
enum MenuGlyph,values: Arrow (0),Bullet (2),Checkmark (1),Max (2),Min (0) | 62599078ec188e330fdfa263 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.