code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class BibDatabase(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.entries = [] <NEW_LINE> self._entries_dict = {} <NEW_LINE> self.comments = [] <NEW_LINE> self.strings = OrderedDict() <NEW_LINE> self.preambles = [] <NEW_LINE> <DEDENT> def get_entry_list(self): <NEW_LINE> <INDENT> return self.e... | A bibliographic database object following the data structure of a BibTeX file. | 62598f7521bff66bcd722520 |
class PhoneNumberDescriptor(object): <NEW_LINE> <INDENT> def __init__(self, field_name, model): <NEW_LINE> <INDENT> self.field_name = field_name <NEW_LINE> <DEDENT> def __get__(self, instance=None, owner=None): <NEW_LINE> <INDENT> if instance is None: <NEW_LINE> <INDENT> return self <NEW_LINE> <DEDENT> return instance.... | The descriptor for the phone number attribute on the model instance.
Returns a PhoneNumber when accessed so you can do stuff like::
>>> instance.phone_number.as_international
Assigns a phone number object on assignment so you can do::
>>> instance.phone_number = PhoneNumber(...)
or
>>> instance.phone_num... | 62598f75c432627299fa2897 |
class MockedSessionCork(Cork): <NEW_LINE> <INDENT> @property <NEW_LINE> def _beaker_session(self): <NEW_LINE> <INDENT> return self._mocked_beaker_session | Mocked Cork instance where the session is replaced with
MockedSession | 62598f7573bcbd0ca4bc9b0e |
class BlogHandler(webapp2.RequestHandler): <NEW_LINE> <INDENT> def write(self, *a, **kw): <NEW_LINE> <INDENT> self.response.out.write(*a, **kw) <NEW_LINE> <DEDENT> def render_str(self, template, **params): <NEW_LINE> <INDENT> params['user'] = self.user <NEW_LINE> return render_str(template, **params) <NEW_LINE> <DEDENT... | Basic handler for this blog website.
Key functions:
render -- render the HTML page.
login -- set cookie for user login.
logout -- reset the cookie.
intialized: initialize the page and get user info if logged in. | 62598f756fece00bbaccb24b |
class TrainNewModel(Resource): <NEW_LINE> <INDENT> def post(self): <NEW_LINE> <INDENT> reqparse_args = reqparse.RequestParser() <NEW_LINE> reqparse_args.add_argument("chosen_model", type=str) <NEW_LINE> args = reqparse_args.parse_args() <NEW_LINE> X_train_encoded, y_train, X_test_encoded, y_test, encoder = data_loading... | Load training data. Train a new model. Save model. | 62598f7526068e7796d4c21b |
class PPScorer: <NEW_LINE> <INDENT> SUPPORTED_SCORES = ['roc_auc_score'] <NEW_LINE> def __init__(self, real_scorer): <NEW_LINE> <INDENT> self.ys = [] <NEW_LINE> self.real_scorer = real_scorer <NEW_LINE> if self.real_scorer.__name__ not in PPScorer.SUPPORTED_SCORES: <NEW_LINE> <INDENT> sys.exit('Exiting. Provided score ... | Class for custom scorer | 62598f756aa9bd52df0d4795 |
class InterconnectLocationRegionInfo(_messages.Message): <NEW_LINE> <INDENT> class LocationPresenceValueValuesEnum(_messages.Enum): <NEW_LINE> <INDENT> LP_GLOBAL = 0 <NEW_LINE> LP_LOCAL_REGION = 1 <NEW_LINE> <DEDENT> expectedRttMs = _messages.IntegerField(1) <NEW_LINE> locationPresence = _messages.EnumField('LocationPr... | Information about any potential InterconnectAttachments between an
Interconnect at a specific InterconnectLocation, and a specific Cloud
Region.
Enums:
LocationPresenceValueValuesEnum: Identifies the network presence of this
location.
Fields:
expectedRttMs: Expected round-trip time in milliseconds, from this
... | 62598f7521bff66bcd722522 |
class UpdatePriceMonitor(threading.Thread): <NEW_LINE> <INDENT> def __init__(self, data_to_update): <NEW_LINE> <INDENT> threading.Thread.__init__(self) <NEW_LINE> self.Terminated = False <NEW_LINE> self.data_to_update = data_to_update <NEW_LINE> <DEDENT> def run(self): <NEW_LINE> <INDENT> i = 0 <NEW_LINE> while not sel... | classe pour la mise a jour des prix du monitor | 62598f7538b623060ffa895b |
class Entry(models.Model): <NEW_LINE> <INDENT> network = models.OneToOneField('NetworkDefinition') <NEW_LINE> user = models.OneToOneField('auth.User') | Entry in the system. | 62598f759b70327d1c57e66f |
class CKMLayer(ConvNetLayer): <NEW_LINE> <INDENT> def __init__(self, rng, feature_maps, feature_shape, filter_shape, pool=False, pool_size=(2,2), stride_size=None, border_mode="valid", activate_mode="tanh"): <NEW_LINE> <INDENT> super(CKMLayer, self).__init__(rng=rng, feature_maps=feature_maps, feature_shape=feature_sha... | A implementation of Convolutional K-means Layer | 62598f7550485f2cf55da82f |
class LayeredCairoWidget(CairoWidget): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(LayeredCairoWidget, self).__init__() <NEW_LINE> self.layers = [] <NEW_LINE> <DEDENT> def draw(self, context, width, height): <NEW_LINE> <INDENT> for layer in self.layers: <NEW_LINE> <INDENT> layer.stack(context, wid... | A widget with several layers.
This widget paints itself by successively passing its context to
layer objects. The draw() method of a layer object must paint to
the context. | 62598f75796e427e5384e056 |
class StatusCheckException(Exception): <NEW_LINE> <INDENT> pass | define custom exception for status checks. | 62598f758a349b6b43685b03 |
class ChangePassword(UserLoginMixin, PasswordChangeView): <NEW_LINE> <INDENT> template_name = "user/change_password.html" | Allow user to change their password. | 62598f75dc8b845886d52e74 |
class Place(models.Model): <NEW_LINE> <INDENT> organization = models.TextField(max_length=255, default='', null=True) <NEW_LINE> website = models.TextField(max_length=255, default='', null=True) <NEW_LINE> short_description = models.TextField(max_length=1000, default='', null=True) <NEW_LINE> address = models.TextField... | Contains basic information about each facility displayed on the map. | 62598f753eb6a72ae0389f03 |
class User(Base): <NEW_LINE> <INDENT> __tablename__ = 'users' <NEW_LINE> name = Column(Integer, primary_key = True) <NEW_LINE> number = Column(Integer) <NEW_LINE> send = Column(Boolean, default = False) <NEW_LINE> roommate = Column(Integer) <NEW_LINE> def __init__(self, name, number = None, send = False, roommate = Non... | This stores information about a given user who is using the housing website
name: the uid number of the user the information is about
number: the current room number of that the user is in
send: if the website should send notifications to the user
roommate: another user that is allowed to control the user's housing sta... | 62598f75cad5886f8bdc4be3 |
class ConfigFixture(fixture.GabbiFixture): <NEW_LINE> <INDENT> def start_fixture(self): <NEW_LINE> <INDENT> self.conf = None <NEW_LINE> db_url = None <NEW_LINE> for engine in ENGINES: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> db_url = os.environ['AODH_TEST_%s_URL' % engine] <NEW_LINE> <DEDENT> except KeyError: <NEW_... | Establish the relevant configuration for a test run. | 62598f7596565a6dacd2cbdc |
@dataclass(frozen=True) <NEW_LINE> class CannotMoveResourceStoppedNoNodeSpecified(ReportItemMessage): <NEW_LINE> <INDENT> resource_id: str <NEW_LINE> _code = codes.CANNOT_MOVE_RESOURCE_STOPPED_NO_NODE_SPECIFIED <NEW_LINE> @property <NEW_LINE> def message(self) -> str: <NEW_LINE> <INDENT> return "You must specify a node... | When moving a stopped resource, a node to move it to must be specified
resource_id -- id of the resource to be moved | 62598f7530c21e258be980c6 |
class PyUSER_INFO_1006(object): <NEW_LINE> <INDENT> def __new__(cls): <NEW_LINE> <INDENT> raise Exception('This class just for typing, can not be instanced!') <NEW_LINE> <DEDENT> @property <NEW_LINE> def home_dir(self)->'Union[str]': <NEW_LINE> <INDENT> pass | A dictionary holding the information in a Win32 USER_INFO_1006 structure. | 62598f7516aa5153ce3ffdbf |
class HashStorage(Storage): <NEW_LINE> <INDENT> def __init__(self, hash_name, options=""): <NEW_LINE> <INDENT> Storage.__init__(self, name = hash_name, storage_name = "hashes", options_string = options) | Redland Hashed Storage class
import RDF
h1=RDF.HashStorage("abc", options="hash-type='memory'")
# Creating a storage with contexts enabled
s=RDF.HashStorage("def", options="contexts='yes'")
Class of hashed Storage for a particular type of hash (typically
hash-type is "memory" or "bdb") and any other opti... | 62598f75a8ecb03325870aca |
class ChoreStartTime: <NEW_LINE> <INDENT> def __init__(self, year, month, day, hour, minute, second): <NEW_LINE> <INDENT> self._datetime = datetime.combine(date(year, month, day), time(hour, minute, second)) <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def from_string(cls, start_time_string): <NEW_LINE> <INDENT> f = lam... | GMT Time! | 62598f75e76e3b2f99fd82f2 |
class ConsistentHash(object): <NEW_LINE> <INDENT> def __init__(self, nodes=None, seed=0, hash_function=ketama, reps=160): <NEW_LINE> <INDENT> self.nodes = [] <NEW_LINE> if nodes is not None: <NEW_LINE> <INDENT> self.nodes = nodes <NEW_LINE> <DEDENT> self.hash_function = hash_function <NEW_LINE> self.reps = reps <NEW_LI... | Implements the AWS Autodiscovery feature, using Ketama hash to
locate cache nodes.
Maintains an updated list of cluster nodes. | 62598f75c432627299fa2899 |
class Machine(Base): <NEW_LINE> <INDENT> __tablename__ = "machines" <NEW_LINE> id = Column(Integer(), primary_key=True) <NEW_LINE> name = Column(String(255), nullable=False) <NEW_LINE> label = Column(String(255), nullable=False) <NEW_LINE> ip = Column(String(255), nullable=False) <NEW_LINE> platform = Column(String(255... | Configured virtual machines to be used as guests. | 62598f75d53ae8145f917d57 |
class Chinese: <NEW_LINE> <INDENT> country="china" <NEW_LINE> l = ['a','b'] <NEW_LINE> def __init__(self,name,age,gender): <NEW_LINE> <INDENT> print("打印的是变量===",country) <NEW_LINE> self.name = name <NEW_LINE> self.age = age <NEW_LINE> self.gender = gender <NEW_LINE> <DEDENT> def eatFunc(self): <NEW_LINE> <INDENT> print... | 这是一个中国的类 | 62598f75d4950a0f3b110a97 |
class TestClientDetails(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 testClientDetails(self): <NEW_LINE> <INDENT> pass | ClientDetails unit test stubs | 62598f7538b623060ffa895d |
class _SupportedVersionsDict(dict): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.data = {} <NEW_LINE> <DEDENT> def _feed_supported_versions(self): <NEW_LINE> <INDENT> major = get_source_major_version() <NEW_LINE> if major not in _SUPPORTED_VERSIONS: <NEW_LINE> <INDENT> raise KeyError('{} is not a su... | Class for _SUPPORTED_VERSIONS lazy evaluation until ipuworkflowconfig actor data
is ready. | 62598f7576d4e153a661c4d6 |
class Timer: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.__start = None <NEW_LINE> <DEDENT> def start(self): <NEW_LINE> <INDENT> self.__start = time.time() <NEW_LINE> <DEDENT> def stop(self): <NEW_LINE> <INDENT> time_passed = time.time() - self.__start <NEW_LINE> self.__start = None <NEW_LINE> retu... | Helper timer class | 62598f758a349b6b43685b05 |
class V1alpha1ClusterRoleList(object): <NEW_LINE> <INDENT> def __init__(self, kind=None, api_version=None, metadata=None, items=None): <NEW_LINE> <INDENT> self.swagger_types = { 'kind': 'str', 'api_version': 'str', 'metadata': 'V1ListMeta', 'items': 'list[V1alpha1ClusterRole]' } <NEW_LINE> self.attribute_map = { 'kind'... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62598f75dc8b845886d52e76 |
class Dfa(object): <NEW_LINE> <INDENT> def __init__(self, size: int, alphabet: 'Alphabet', start: int, *accept_indices: int): <NEW_LINE> <INDENT> if not 0 <= start < size: <NEW_LINE> <INDENT> raise ValueError('Start state index out of bounds.') <NEW_LINE> <DEDENT> for i in accept_indices: <NEW_LINE> <INDENT> if not 0 <... | Class representation of the formal defined of a DFA automata. May be considered as a graph.
Attributes:
alphabet (Alphabet):
states (Dict): Dictionary of the DFA states given in index:state pairs.
start (int): DFA start state index.
accept_indices (set): Set of state indexes which form the DFA set of a... | 62598f75ac7a0e7691f71dda |
class ClangInfo: <NEW_LINE> <INDENT> def __init__( self): <NEW_LINE> <INDENT> for version in 10, 9, 8, 7, 6,: <NEW_LINE> <INDENT> ok = self._try_init_clang( version) <NEW_LINE> if ok: <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> raise Exception( 'cannot find libclang.so') <NEW_LINE> ... | Sets things up so we can import and use clang.
Members:
.libclang_so
.resource_dir
.include_path
.clang_version | 62598f754d74a7450cd58b3b |
class AppTestCase(WithTestBed): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super(AppTestCase, self).setUp() <NEW_LINE> import main <NEW_LINE> reload(main) <NEW_LINE> self.testapp = webtest.TestApp(main.main_app) | Provides a complete App Engine test environment and also automatically routes all application and plugin handlers to ``testapp``. | 62598f758e05c05ec3f6eaa7 |
@public <NEW_LINE> class GeoArea(GeoSpatialUnOp): <NEW_LINE> <INDENT> output_type = rlz.shape_like('args', dt.float64) | Area of the geo spatial data | 62598f7596565a6dacd2cbdd |
class OutsideAirResetMaximumCoolingSupplyTemperature(BSElement): <NEW_LINE> <INDENT> element_type = "xs:decimal" | Maximum temperature setting of supply air for cooling during outside air reset. (°F) | 62598f7515fb5d323ce7e5eb |
class Precipitation(VersionBase): <NEW_LINE> <INDENT> def __init__(self,precipitation,intensity): <NEW_LINE> <INDENT> if not hasattr(PrecipitationType,str(precipitation)): <NEW_LINE> <INDENT> raise TypeError('precipitation input is not of type PrecipitationType') <NEW_LINE> <DEDENT> self.precipitation = precipitation <... | Precipitation creates an Precipitation element used by the Weather element of openscenario
Parameters
----------
precipitation (PrecipitationType): dry, rain or snow
intensity (float): intensity of precipitation (0...1)
Attributes
----------
precipitation (PrecipitationType): dry, rain or snow
inten... | 62598f75a8ecb03325870acc |
class PageManager(PublisherManager): <NEW_LINE> <INDENT> def get_query_set(self): <NEW_LINE> <INDENT> return PageQuerySet(self.model) <NEW_LINE> <DEDENT> def drafts(self): <NEW_LINE> <INDENT> return super(PageManager, self).drafts().exclude( publisher_state=self.model.PUBLISHER_STATE_DELETE ) <NEW_LINE> <DEDENT> def pu... | Use draft() and public() methods for accessing the corresponding
instances. | 62598f75e76e3b2f99fd82f4 |
class ControllerURLPackage(URLPackage): <NEW_LINE> <INDENT> def __init__(self, controllerID, methodName, objectParameters = []): <NEW_LINE> <INDENT> self.object_name = controllerID <NEW_LINE> self.object_type = 'controller' <NEW_LINE> self.parameterList = objectParameters | A template populator for a generated Controller URL. | 62598f7566656f66f7d59cb4 |
class MinimaxAgent(MultiAgentSearchAgent): <NEW_LINE> <INDENT> def getAction(self, gameState): <NEW_LINE> <INDENT> numAgents = gameState.getNumAgents() <NEW_LINE> return self.minimax(gameState, 0, numAgents, numAgents*self.depth)[1] <NEW_LINE> util.raiseNotDefined() <NEW_LINE> <DEDENT> def minimax(self, gameState, agen... | Your minimax agent (question 2) | 62598f7523e79379d538bdbc |
class Profile(models.Model): <NEW_LINE> <INDENT> user = models.OneToOneField(User, on_delete=models.CASCADE, null=True) | A one to one model for extra user fields | 62598f7573bcbd0ca4bc9b12 |
class HouseItem: <NEW_LINE> <INDENT> def __init__(self, name, area): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.area = area <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return "%s 的占地面积是 %.2f " % (self.name, self.area) | 家具 | 62598f75b830903b9686e0d4 |
class Br(SelfClosingTag): <NEW_LINE> <INDENT> tag = "br" | HTML Title element | 62598f7515baa7234946184b |
class FaucherKaspi2006(Fittable1DModel): <NEW_LINE> <INDENT> amplitude = Parameter() <NEW_LINE> r_0 = Parameter() <NEW_LINE> sigma = Parameter() <NEW_LINE> evolved = False <NEW_LINE> def __init__(self, amplitude=1, r_0=7.04, sigma=1.83, **kwargs): <NEW_LINE> <INDENT> super(FaucherKaspi2006, self).__init__(amplitude=amp... | Radial distribution of the birth surface density of pulsars in the galaxy - Faucher-Giguere & Kaspi 2006.
.. math ::
f(r) = A \frac{1}{\sqrt{2 \pi} \sigma} \exp
\left(- \frac{(r - r_0)^2}{2 \sigma ^ 2}\right)
Reference: http://adsabs.harvard.edu/abs/2006ApJ...643..332F (Appendix B)
Parameters
----------
ampl... | 62598f750383005118f6cfc5 |
class DeleteColumn(prov.ProvOp): <NEW_LINE> <INDENT> def __init__(self, key): <NEW_LINE> <INDENT> super(DeleteColumn, self).__init__(type=prov.PROV_DELETE, key=key) | Provenance class representing the column deletion operator. | 62598f759b70327d1c57e673 |
class PlivoResource(ResponseObject): <NEW_LINE> <INDENT> _identifier_string = None <NEW_LINE> @property <NEW_LINE> def id(self): <NEW_LINE> <INDENT> value = self.__dict__.get(self._identifier_string, None) <NEW_LINE> if not value: <NEW_LINE> <INDENT> raise ValueError('{} must be set'.format(self._identifier_string)) <N... | The Plivo resource object
This provides an interface to deal with all Plivo resources and
sub-resources | 62598f7538b623060ffa895e |
class HangupCause(caching.base.CachingMixin, models.Model): <NEW_LINE> <INDENT> code = models.PositiveIntegerField(unique=True, verbose_name=_('code'), help_text=_("ITU-T Q.850 Code")) <NEW_LINE> enumeration = models.CharField(max_length=100, null=True, blank=True, verbose_name=_('enumeration')) <NEW_LINE> cause = mode... | This defines the HangupCause
**Attributes**:
* ``code`` - ITU-T Q.850 Code.
* ``enumeration`` - Enumeration
* ``cause`` - cause
* ``description`` - cause description
**Name of DB table**: hangup_cause | 62598f7530c21e258be980c9 |
class TextDocumentBatchStatistics(DictMixin): <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> self.document_count = kwargs.get("document_count", None) <NEW_LINE> self.valid_document_count = kwargs.get("valid_document_count", None) <NEW_LINE> self.erroneous_document_count = kwargs.get("erroneous_do... | TextDocumentBatchStatistics contains information about the
request payload. Note: This object is not returned
in the response and needs to be retrieved by a response hook.
:ivar document_count: Number of documents submitted in the request.
:vartype document_count: int
:ivar valid_document_count: Number of valid docume... | 62598f75dc8b845886d52e78 |
class StreamClient(object): <NEW_LINE> <INDENT> def __init__(self, kafka_addr, kafka_topic): <NEW_LINE> <INDENT> producer_factory = (kafka_addr and kafka.KafkaProducer) or NoopProducer <NEW_LINE> self.topic = kafka_topic <NEW_LINE> self.producer = producer_factory( bootstrap_servers=kafka_addr, value_serializer=json.du... | Client for emitting location publish events to a Kafka message broker. | 62598f7526238365f5fac439 |
class SNMP(object): <NEW_LINE> <INDENT> def __init__(self, ip_addr): <NEW_LINE> <INDENT> self.ip_addr = ip_addr <NEW_LINE> self.transport = cmdgen.UdpTransportTarget((self.ip_addr, 161)) <NEW_LINE> <DEDENT> def walk(self): <NEW_LINE> <INDENT> logging.debug('walk') <NEW_LINE> community = 'public' <NEW_LINE> comm_data = ... | class: SNMP - abstraction of the Python SNMP class | 62598f75ac7a0e7691f71ddc |
class MyList(list): <NEW_LINE> <INDENT> def print_sorted(self): <NEW_LINE> <INDENT> print(sorted(self)) | This class inherits from list. | 62598f754d74a7450cd58b3c |
class check_duplicate(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.__random_jumps = 0 <NEW_LINE> <DEDENT> def __call__(self,new_Obs,X,bounds,max_random_jumps=None,tol=1e-10): <NEW_LINE> <INDENT> if max_random_jumps is None: <NEW_LINE> <INDENT> max_random_jumps = 5 * bounds.shape[0] <NEW_LIN... | Callable class that checks whether the new observation is duplicate and randomly samples a new point if that is the case. | 62598f75b57a9660fecd1344 |
class ExploreHandler(tornado.web.RequestHandler): <NEW_LINE> <INDENT> def get(self, *args, **kwargs): <NEW_LINE> <INDENT> os.chdir('static') <NEW_LINE> image_urls = photo.get_images("uploads/thumbs") <NEW_LINE> result_urls_p = photo.get_images2("uploads/result") <NEW_LINE> os.chdir("..") <NEW_LINE> self.render('explore... | Explore page,photo of other users 发现页-----发现或最近上传的图片页面 | 62598f7515baa7234946184c |
class PootleUserManager(UserManager): <NEW_LINE> <INDENT> def get_default_user(self): <NEW_LINE> <INDENT> return super(PootleUserManager, self).get_query_set(). select_related(depth=1).get(username='default') <NEW_LINE> <DEDENT> def get_nobody_user(self): <NEW_LINE> <INDENT> return super(PootleUserManager... | A manager class which is meant to replace the manager class for
the User model. This manager hides the 'nobody' and 'default'
users for normal queries, since they are special users. Code that
needs access to these users should use the methods
get_default_user and get_nobody_user. | 62598f75be383301e02530bd |
class HecConfig: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> import parent_hecConfig_Poplar <NEW_LINE> self = parent_hecConfig_Poplar.setme1(self) <NEW_LINE> print("+++++++++++++++++++++++++++++++ rasProjectName ++++++++++++++++++++++++++++++") <NEW_LINE> self.rasProjectName = "PCRR" <NEW_LINE> self.ras... | Simple class maintaining configuration for HEC applications | 62598f7582261d6c5272fb39 |
class WrappedRFindStrategy(BaseAtomicStrategy): <NEW_LINE> <INDENT> class _RFindInnerEnsemble: <NEW_LINE> <INDENT> def __init__(self, limits, sources, shenanigans=True): <NEW_LINE> <INDENT> self.limits = limits <NEW_LINE> self.sources = sources <NEW_LINE> self.shenanigans = shenanigans <NEW_LINE> <DEDENT> def generate(... | A strategy that contains a Kumoko inside!
| 62598f75287bf620b627147d |
class Solution: <NEW_LINE> <INDENT> def movesToMakeZigzag(self, nums: List[int]) -> int: <NEW_LINE> <INDENT> def min_neighbour(i, num): <NEW_LINE> <INDENT> if i == 0: <NEW_LINE> <INDENT> return num[i + 1] <NEW_LINE> <DEDENT> elif i == len(num) - 1: <NEW_LINE> <INDENT> return num[i - 1] <NEW_LINE> <DEDENT> else: <NEW_LI... | >>> Solution().movesToMakeZigzag([151,42,769,349,835,92,242,82,357,494,880,683,470,631,479,298,941,113,892,103,755,575,885,50,479,502,181,164,292,832,657,512,528,588,716,965,195,106,396,649])
2463
>>> Solution().movesToMakeZigzag([10,4,4,10,10,6,2,3])
13
>>> Solution().movesToMakeZigzag([1,2,3])
2
>>> Solution().mov... | 62598f755e10d32532ce3550 |
class OUNoise: <NEW_LINE> <INDENT> def __init__(self, size, mu=None, theta=0.15, sigma=0.3): <NEW_LINE> <INDENT> self.size = size <NEW_LINE> self.mu = mu*np.ones(size) if mu is not None else np.zeros(self.size) <NEW_LINE> self.theta = theta <NEW_LINE> self.sigma = sigma <NEW_LINE> self.state = np.ones(self.size) * self... | Ornstein-Uhlenbeck process. | 62598f7507d97122c4216567 |
class EmailInactiveUserTestCase(WgerTestCase): <NEW_LINE> <INDENT> def test_reminder(self, fail=False): <NEW_LINE> <INDENT> call_command('inactive-members') <NEW_LINE> self.assertEqual(len(mail.outbox), 6) <NEW_LINE> recipment_list = [message.to[0] for message in mail.outbox] <NEW_LINE> trainer_list = [ 'trainer4@examp... | Test email reminders for inactive users | 62598f75d18da76e235b6d99 |
class Shape: <NEW_LINE> <INDENT> def __init__(self, side): <NEW_LINE> <INDENT> self.side = side <NEW_LINE> <DEDENT> area = 0 | Base class for all instances of a hierarchical electronic design.
| 62598f7550485f2cf55da835 |
class TestJobsTest(helpers.RQTestBase): <NEW_LINE> <INDENT> def test_test_default_queue(self, cli): <NEW_LINE> <INDENT> stdout = cli.invoke(ckan, [u"jobs", u"test"]).output <NEW_LINE> all_jobs = self.all_jobs() <NEW_LINE> assert len(all_jobs) == 1 <NEW_LINE> assert ( jobs.remove_queue_name_prefix(all_jobs[0].origin) ==... | Tests for ``ckan jobs test``. | 62598f75507cdc57c63a4651 |
class ProgramEnrollment(EnrollmentModel): <NEW_LINE> <INDENT> program = models.ForeignKey("courses.Program", on_delete=models.PROTECT) <NEW_LINE> class Meta: <NEW_LINE> <INDENT> unique_together = ("user", "program", "order") <NEW_LINE> <DEDENT> @property <NEW_LINE> def is_ended(self): <NEW_LINE> <INDENT> return all(enr... | Link between User and Program indicating a user's enrollment | 62598f75796e427e5384e05c |
class PreparedGeometry(GEOSBase): <NEW_LINE> <INDENT> ptr_type = capi.PREPGEOM_PTR <NEW_LINE> def __init__(self, geom): <NEW_LINE> <INDENT> self._base_geom = geom <NEW_LINE> if not isinstance(geom, GEOSGeometry): <NEW_LINE> <INDENT> raise TypeError <NEW_LINE> <DEDENT> self.ptr = capi.geos_prepare(geom.ptr) <NEW_LINE> <... | A geometry that is prepared for performing certain operations.
At the moment this includes the contains covers, and intersects
operations. | 62598f75be8e80087fbbe926 |
class TestCompareXLSXFiles(ExcelComparisonTest): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.maxDiff = None <NEW_LINE> filename = 'button09.xlsx' <NEW_LINE> test_dir = 'xlsxwriter/test/comparison/' <NEW_LINE> self.got_filename = test_dir + '_test_' + filename <NEW_LINE> self.exp_filename = test_dir + ... | Test file created by XlsxWriter against a file created by Excel. | 62598f7526238365f5fac43b |
class Sillon(): <NEW_LINE> <INDENT> def __init__(self, args): <NEW_LINE> <INDENT> if args.p: <NEW_LINE> <INDENT> display_parameters(args) <NEW_LINE> <DEDENT> req = requester(args) <NEW_LINE> payload = Load(__file__, args)() <NEW_LINE> resultat = Scrapp(args, req)() <NEW_LINE> if args.hide: <NEW_LINE> <INDENT> nice_disp... | https://github.com/0xswitch/Sillon
https://0xswitch.fr
2018 | 62598f75d10714528d69d795 |
class AthletesListView(ListView): <NEW_LINE> <INDENT> pass | Sub-class the ListView to pass the request to the form. | 62598f7516aa5153ce3ffdc5 |
class SalesCalculator: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def calculateDailySales(self, assetList, dayGlasses, dayCost, dayAds, dayPrice, dayWeather, customerAssets, dayEvent): <NEW_LINE> <INDENT> moneyConverter = MoneyConverter.MoneyConverter() <NEW_LINE> daySales = mo... | The SalesCalculator class performs calculations of daily sales for each player. | 62598f75711fe17d825dffac |
class DescribeSecurityGroupResponseSchema(schema.ResponseSchema): <NEW_LINE> <INDENT> fields = { "Infos": fields.List( models.SGInfoSchema(), required=False, load_from="Infos" ), "Message": fields.Str(required=True, load_from="Message"), "TotalCount": fields.Int(required=False, load_from="TotalCount"), } | DescribeSecurityGroup - 查询安全组信息
| 62598f7573bcbd0ca4bc9b15 |
class TelnetOutput(BaseClass): <NEW_LINE> <INDENT> def __init__(self, client, prompt="#", end_of_line='\r\n',timeout=10): <NEW_LINE> <INDENT> super(TelnetOutput, self).__init__() <NEW_LINE> self.client = client <NEW_LINE> self.prompt = prompt <NEW_LINE> self.end_of_line = end_of_line <NEW_LINE> self.timeout = timeout <... | The TelnetOutput converts the telnet output to a file-like object | 62598f75b57a9660fecd1346 |
class UserTimelineSuggest(UserTimelineSystem): <NEW_LINE> <INDENT> list_id = db.ReferenceProperty(ListSuggestion) <NEW_LINE> status = db.IntegerProperty(default=0) <NEW_LINE> def put(self): <NEW_LINE> <INDENT> if self.is_saved(): <NEW_LINE> <INDENT> super(self.__class__, self).put() <NEW_LINE> <DEDENT> else: <NEW_LINE>... | Almacena una peticion de un usuario para añadir una
sugerencia a la lista de otro usuario | 62598f758c3a8732951f5e15 |
class Media(models.Model): <NEW_LINE> <INDENT> name = models.CharField(max_length=100, help_text='Enter the name for the media') <NEW_LINE> date_created = models.DateField(null=True, blank=True) <NEW_LINE> MEDIA_TYPE = ( ('a','Agar'), ('w','Wort'), ('g','Glycerin'), ('sc','Sodium chloride'), ('g','Gelatine'), ) <NEW_LI... | Model representing the types of growth media yeast can be grown and stored on | 62598f75287bf620b627147e |
class StanzaMalformed(Exception): <NEW_LINE> <INDENT> def __init__(self, message, stanza=''): <NEW_LINE> <INDENT> Exception.__init__(self, message, stanza) <NEW_LINE> self._msg = '{}\n{}'.format(message, stanza) <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return self._msg | Malfromed Stanza | 62598f7515baa7234946184e |
class PartialResStage(nn.Module): <NEW_LINE> <INDENT> def __init__(self, ni:int, no:int, nh:int, nu:int, stride:int, Unit:nn.Module, a:int=1, **kwargs): <NEW_LINE> <INDENT> super(PartialResStage, self).__init__() <NEW_LINE> assert a < nu - 2 <NEW_LINE> self.a, self.nu = a, nu <NEW_LINE> print(self.a, self.nu) <NEW_LINE... | Stage in a residual network, usually the units in a residual network are divided into
stages according to feature (image) resolution.
Parameters:
-----------
ni : number of input channels of the stage, 本stage的入channel数
no : number of output channels of the stage, 本stage的出channel数
nh : number of hidden channels of basi... | 62598f75ec188e330fdf8168 |
class GroupNameNode(MandatoryStringNode, RequestAwareMixin): <NEW_LINE> <INDENT> def validator(self, node: SchemaNode, value: str) -> None: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> validate_group_name(value, self.request) <NEW_LINE> <DEDENT> except ValueError as e: <NEW_LINE> <INDENT> raise Invalid(node, str(e)) | Node to capture a CamCOPS group name, and check it's valid as a string. | 62598f751d351010ab8f3407 |
class HTTPResponse(HTTPMessage): <NEW_LINE> <INDENT> def iter_body(self, chunk_size=1): <NEW_LINE> <INDENT> return self._orig.iter_content(chunk_size=chunk_size) <NEW_LINE> <DEDENT> def iter_lines(self, chunk_size): <NEW_LINE> <INDENT> return ((line, b'\n') for line in self._orig.iter_lines(chunk_size)) <NEW_LINE> <DED... | A :class:`requests.models.Response` wrapper. | 62598f7582261d6c5272fb3a |
@_tag <NEW_LINE> class Figcaption(HtmlFlowContent): <NEW_LINE> <INDENT> pass | Represents a caption or legend describing the rest of the contents of its parent <figure> element.
Contexts for use: As the first or last child of a figure element. | 62598f7507d97122c4216569 |
class Constraints(ConstraintsBase): <NEW_LINE> <INDENT> def __init__(self, scalers): <NEW_LINE> <INDENT> super(Constraints, self).__init__() <NEW_LINE> self.scalers=scalers <NEW_LINE> <DEDENT> def compute(self, inputs, outputs): <NEW_LINE> <INDENT> ESF = inputs['ESF']*self.scalers['ESF'] <NEW_LINE> outputs['con1_esf'] ... | An OpenMDAO component to encapsulate Constraints discipline | 62598f75a4f1c619b294deb3 |
class DuplicatePolicyError(Exception): <NEW_LINE> <INDENT> def __init__(self, message='Policy is a duplicate'): <NEW_LINE> <INDENT> super(Exception, self).__init__(message) | This exception is raised when a policy recommendation is requested and it is determined to me a duplicate | 62598f75bde94217f37072cb |
class Game: <NEW_LINE> <INDENT> def __init__(self, term): <NEW_LINE> <INDENT> self.term = term <NEW_LINE> self.code = locale.getpreferredencoding() <NEW_LINE> <DEDENT> def _redraw_row(self, window, row): <NEW_LINE> <INDENT> row_c = self.term.display[row].encode(self.code) <NEW_LINE> max_y, max_x = window.getmaxyx() <NE... | Draw the game in the terminal. | 62598f7526238365f5fac43d |
class ObjectList(object): <NEW_LINE> <INDENT> def __init__(self, prefix, start_index = None): <NEW_LINE> <INDENT> self._list = [] <NEW_LINE> self._prefix = prefix <NEW_LINE> self._start_index = start_index <NEW_LINE> <DEDENT> def Add(self, an_object): <NEW_LINE> <INDENT> import copy <NEW_LINE> tmp_object = copy.deepcop... | General class for all object lists | 62598f758e05c05ec3f6eaaa |
class YesNo(Handler): <NEW_LINE> <INDENT> mapping = {'yes', 'true', '1'} <NEW_LINE> def __init__(self, yes=True, no=False, hide_value=None): <NEW_LINE> <INDENT> self.yes = yes <NEW_LINE> self.no = no <NEW_LINE> self.hide_value = hide_value <NEW_LINE> <DEDENT> def handle(self, value, context): <NEW_LINE> <INDENT> v = te... | Yes or No handler. | 62598f75b57a9660fecd1347 |
class ClusterLock(BASE, models.ModelBase): <NEW_LINE> <INDENT> __table_args__ = {'mysql_engine': 'InnoDB'} <NEW_LINE> __tablename__ = 'cluster_lock' <NEW_LINE> cluster_id = Column(String(36), primary_key=True, nullable=False) <NEW_LINE> action_ids = Column(types.List) <NEW_LINE> semaphore = Column(Integer) | Cluster locks for actions. | 62598f7530c21e258be980ce |
class Settings(): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.screen_width = 1200 <NEW_LINE> self.screen_height = 800 <NEW_LINE> self.bg_color = (200, 200, 200) <NEW_LINE> self.ship_speed_factor = 1.5 <NEW_LINE> self.bullet_speed_factor = 1 <NEW_LINE> self.bullet_width = 3 <NEW_LINE> self.bullet_he... | A class to store all settings for Alien Invasion. | 62598f75a8ecb03325870ad2 |
class CachingConfig(data_interfaces.ConfigSectionInterface): <NEW_LINE> <INDENT> SECTION_NAME = 'caching' <NEW_LINE> @property <NEW_LINE> def endpoint(self): <NEW_LINE> <INDENT> return self.get('cache_path') <NEW_LINE> <DEDENT> @property <NEW_LINE> def jpg_endpoint(self): <NEW_LINE> <INDENT> return self.get('jpg_path')... | Defines the config values for caching tests. | 62598f7523e79379d538bdc2 |
class Easy21Observation(Observation): <NEW_LINE> <INDENT> def __init__(self, p_sum: int, d_sum: int, terminal: bool): <NEW_LINE> <INDENT> super().__init__(terminal) <NEW_LINE> self.p_sum, self.d_sum = p_sum, d_sum <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return 'Easy21(P: {:<3}, D: {:<3}, T: {})'.form... | Easy21 Environment Observation | 62598f7515baa7234946184f |
class Xor(Gate): <NEW_LINE> <INDENT> def __init__(self, simulator): <NEW_LINE> <INDENT> super(Xor, self).__init__(simulator, 0b0110) | An XOR gate. | 62598f756aa9bd52df0d479f |
class AirlineBoardingPassTemplate(Template): <NEW_LINE> <INDENT> template_type = 'airline_boardingpass' <NEW_LINE> def __init__(self, intro_message: str, locale: str, boarding_pass: List[BoardingPass], theme_color: Optional[str]=None ): <NEW_LINE> <INDENT> self.syntax = { 'template_type': self.template_type, 'intro_mes... | The airline boarding pass template allows you to send a structured
message that contains boarding passes for one or more flights,
for one or more passengers.
Args:
intro_message:
Introduction message.
locale:
Two-letter language region code.
Must be a two-letter ISO 639-1 language code ... | 62598f75be383301e02530c1 |
class TreeItem(TreeItemBase): <NEW_LINE> <INDENT> pass | Built-in tree item class. Default functionality. | 62598f751d351010ab8f3408 |
class GenConf (Base): <NEW_LINE> <INDENT> def __init__ (self, args): <NEW_LINE> <INDENT> super().__init__(args) <NEW_LINE> self.components += ['nat'] <NEW_LINE> <DEDENT> def add_nat (self): <NEW_LINE> <INDENT> for arg in ['downlink-dst-mac', 'uplink-dst-mac', 'range-ipv4-min', 'range-ipv4-max', 'range-port-min', 'range... | SNAT pipeline | 62598f75ec188e330fdf816a |
class DescribeDDoSPolicyRequest(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.Business = None <NEW_LINE> self.Id = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> self.Business = params.get("Business") <NEW_LINE> self.Id = params.get("Id") | DescribeDDoSPolicy request structure.
| 62598f75d99f1b3c44d04f7d |
class TestRecruitingApi(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.api = cfbd.api.recruiting_api.RecruitingApi() <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def test_get_recruiting_groups(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> ... | RecruitingApi unit test stubs | 62598f7521bff66bcd72252c |
class PostSlugAPIView(generics.RetrieveAPIView): <NEW_LINE> <INDENT> queryset = Post.objects.all() <NEW_LINE> serializer_class = PostSerializer <NEW_LINE> lookup_field = 'slug' | Get a Post by Slug | 62598f75bde94217f37072cc |
class Ciphertext(abc.ABC): <NEW_LINE> <INDENT> @abc.abstractmethod <NEW_LINE> def add(self, other): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @abc.abstractmethod <NEW_LINE> def sub(self, other): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @abc.abstractmethod <NEW_LINE> def mul(self, other): <NEW_LINE> <INDENT> pass... | Define common operations for ciphertexts | 62598f750383005118f6cfcc |
@admin.register(Instance) <NEW_LINE> class InstanceAdmin(admin.ModelAdmin): <NEW_LINE> <INDENT> list_display = ( 'id', 'ona_pk', 'xform', 'user', ) <NEW_LINE> list_filter = ( 'created', 'modified', 'xform', 'deleted_at', 'user', 'last_updated', ) | Admin definition for Instance | 62598f757b25080760ed6d6a |
class BaseMonster(dict): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(BaseMonster, self).__init__(*args, **kwargs) <NEW_LINE> self.__dict__ = self | Base monster, properties are generated from the dictionary | 62598f756e29344779afff2b |
class OwnBarcampsView(BaseHandler): <NEW_LINE> <INDENT> template = "own_barcamps.html" <NEW_LINE> @logged_in() <NEW_LINE> def get(self): <NEW_LINE> <INDENT> barcamps = self.config.dbs.barcamps.get_by_user_id(self.user_id, True, True, True) <NEW_LINE> own_barcamps = [BarcampView(barcamp, self) for barcamp in barcamps] <... | show the barcamps you attend(ed) | 62598f7523e79379d538bdc3 |
class ListMixinSubverb(MixinSubverbExtensionPoint): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> satisfies_version( MixinSubverbExtensionPoint.EXTENSION_POINT_VERSION, '^1.0') <NEW_LINE> <DEDENT> def add_arguments(self, *, parser): <NEW_LINE> <INDENT> argument = parser.add_a... | List all repositories and their mixin. | 62598f753eb6a72ae0389f0d |
class Plugin(IdentifyPlugin): <NEW_LINE> <INDENT> def __init__(self, context): <NEW_LINE> <INDENT> super().__init__('Identify File Type', "Thomas Engel", ["filemagic"], context) <NEW_LINE> <DEDENT> def _detect_magic_bytes(self, input): <NEW_LINE> <INDENT> import magic <NEW_LINE> with magic.Magic() as m: <NEW_LINE> <IND... | Detects the file type of the input text based on magic bytes. | 62598f7516aa5153ce3ffdc9 |
class GetEndpoint(Endpoint): <NEW_LINE> <INDENT> @property <NEW_LINE> def method(self): <NEW_LINE> <INDENT> return HttpMethod.Get | An abstract Endpoint implementation for operations that use the HTTP GET method.
| 62598f75711fe17d825dffb0 |
class _LoggerHook(tf.train.SessionRunHook): <NEW_LINE> <INDENT> def begin(self): <NEW_LINE> <INDENT> self._next_trigger_step = test_interval <NEW_LINE> self._trigger = False <NEW_LINE> <DEDENT> def before_run(self, run_context): <NEW_LINE> <INDENT> args = {'global_step': global_step} <NEW_LINE> if self._trigger: <NEW_L... | Logs loss and runtime. | 62598f7573bcbd0ca4bc9b19 |
class Solution: <NEW_LINE> <INDENT> def longestConsecutive2(self, root): <NEW_LINE> <INDENT> self.longest = 0 <NEW_LINE> self.helper(root) <NEW_LINE> return self.longest <NEW_LINE> <DEDENT> def helper(self, root): <NEW_LINE> <INDENT> if not root: <NEW_LINE> <INDENT> return (0, 0) <NEW_LINE> <DEDENT> up, down = 0, 0 <NE... | @param root: the root of binary tree
@return: the length of the longest consecutive sequence path | 62598f7526068e7796d4c227 |
class MCallbackIdArray(object): <NEW_LINE> <INDENT> def __add__(*args, **kwargs): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def __contains__(*args, **kwargs): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def __delitem__(*args, **kwargs): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def __delslice__(*args, **kwargs):... | Array of MCallbackId values. | 62598f75d99f1b3c44d04f7e |
class Cache(object): <NEW_LINE> <INDENT> def __init__(self, funct, max_size=-1): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.cache = {} <NEW_LINE> self.funct = funct <NEW_LINE> self.max_size = max_size <NEW_LINE> self.mod_times = [] <NEW_LINE> <DEDENT> def __call__(self, *args): <NEW_LINE> <INDENT> if args n... | A cache of computed values.
Attributes:
cache: The cache as a dict, whose keys are the arguments to the
function the cache computes, and whose values are tuples of the
last modified time, and the result of the funciton.
funct: The function whose results the cache stores.
max_size: An int. I... | 62598f7550485f2cf55da83b |
class UserSite(models.Model): <NEW_LINE> <INDENT> site = models.ForeignKey(SiteRecord, related_name="members") <NEW_LINE> user = models.ForeignKey(User, related_name="sites") <NEW_LINE> pending = models.BooleanField() <NEW_LINE> def approve(self): <NEW_LINE> <INDENT> self.pending = False <NEW_LINE> self.save() | Represents a user's credit for a site. | 62598f757b25080760ed6d6c |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.