code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class ASettingsWindow(QFrame): <NEW_LINE> <INDENT> def __init__(self, internalModel, console, outputConsole, parent=None): <NEW_LINE> <INDENT> super(ASettingsWindow, self).__init__(parent) <NEW_LINE> self._internalModel = internalModel <NEW_LINE> self._console = console <NEW_LINE> self._compSettingsFrame = AComputation... | Main container for the output settings and run. | 6259903e1d351010ab8f4d74 |
class IgpProvider: <NEW_LINE> <INDENT> def __init__(self, problem): <NEW_LINE> <INDENT> self._problem = problem <NEW_LINE> self._sp_data = {} <NEW_LINE> self._bgp_next_hop_data = {} <NEW_LINE> self._border_routers = [r.assigned_node for r in problem.bgp_config.border_routers] <NEW_LINE> self._components = [-1]*self._pr... | Provider for IGP costs. | 6259903e3c8af77a43b68867 |
class LinkedReference(Reference): <NEW_LINE> <INDENT> def _deserialize(self, value, attr, data): <NEW_LINE> <INDENT> if isinstance(value, dict): <NEW_LINE> <INDENT> value = value.get('id') <NEW_LINE> if not value: <NEW_LINE> <INDENT> raise ValidationError("Champ 'id' manquant") <NEW_LINE> <DEDENT> <DEDENT> return super... | Marshmallow custom field to map with :class Mongoengine.Reference: | 6259903e24f1403a926861f8 |
class Adapter(object): <NEW_LINE> <INDENT> msg_type_map: Dict[str, str] = {} <NEW_LINE> def update_header(self, msg: Dict[str, Any]) -> Dict[str, Any]: <NEW_LINE> <INDENT> return msg <NEW_LINE> <DEDENT> def update_metadata(self, msg: Dict[str, Any]) -> Dict[str, Any]: <NEW_LINE> <INDENT> return msg <NEW_LINE> <DEDENT> ... | Base class for adapting messages
Override message_type(msg) methods to create adapters. | 6259903e287bf620b6272e43 |
class TestGithubGetReleasesByRepo: <NEW_LINE> <INDENT> def test_get_releases_by_repo(self): <NEW_LINE> <INDENT> releases_wanted = [ ('debtool_0.2.5_all.deb', 62), ('debtool_0.2.4_all.deb', 5), ('debtool_0.2.1_all.deb', 0), ('debtool_0.2.2_all.deb', 0), ('debtool_0.2.3_all.deb', 2) ] <NEW_LINE> with requests_mock.Mocker... | Test Github class get_releases_by_repo method. | 6259903e21a7993f00c671c5 |
class Encoder(nn.Module): <NEW_LINE> <INDENT> def __init__( self, n_src_vocab, n_max_seq, n_layers=3, n_head=3, d_k=64, d_v=64, d_word_vec=128, d_model=128, d_inner_hid=128, dropout=0.8): <NEW_LINE> <INDENT> super(Encoder, self).__init__() <NEW_LINE> n_position = n_max_seq + 1 <NEW_LINE> self.n_max_seq = n_max_seq <NEW... | A encoder model with self attention mechanism. | 6259903ed4950a0f3b11176c |
class Track: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.root = None <NEW_LINE> <DEDENT> def track(self, value): <NEW_LINE> <INDENT> if self.root: <NEW_LINE> <INDENT> self.insert_bst(value) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.root = Node(value) <NEW_LINE> <DEDENT> <DEDENT> def insert... | Class to keep a track of each incoming number. | 6259903ed6c5a102081e337d |
class Topping(): <NEW_LINE> <INDENT> def __init__(self, name, price=1.00): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.price = price <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return "{} ${:,.2f}".format(self.name, self.price) | What goes on a pizza | 6259903e8c3a8732951f77af |
class InformeCuotaSostenimientoPeriodo(Report): <NEW_LINE> <INDENT> __name__ = 'cooperar-informes.informe_cuotasostenimientoperiodo' <NEW_LINE> @classmethod <NEW_LINE> def resumir_datos_clientes(cls, facturadomes, facturadoanio): <NEW_LINE> <INDENT> Asociadas = Pool().get('party.party') <NEW_LINE> asociadas = Asociadas... | Reportes de Cuotas Sostenimiento por Periodo | 6259903e596a897236128eda |
class sector_DDD_employment_within_DDD_minutes_travel_time_hbw_am_transit_walk(abstract_access_within_threshold_variable): <NEW_LINE> <INDENT> def __init__(self, sector, threshold): <NEW_LINE> <INDENT> self.threshold = threshold <NEW_LINE> self.travel_data_attribute = "travel_data.am_total_transit_time_walk" <NEW_LINE... | total number of sector DDD jobs for zones within DDD minutes travel time
| 6259903e8a43f66fc4bf33e8 |
class EmptyData(Error): <NEW_LINE> <INDENT> pass | is raised within certain protocols to signify a request was successful
but yielded no data. | 6259903e26238365f5faddb0 |
class JobPlacement(_messages.Message): <NEW_LINE> <INDENT> clusterName = _messages.StringField(1) <NEW_LINE> clusterUuid = _messages.StringField(2) | Cloud Dataproc job configuration.
Fields:
clusterName: [Required] The name of the cluster where the job will be
submitted.
clusterUuid: [Output-only] A cluster UUID generated by the Dataproc
service when the job is submitted. | 6259903e8e05c05ec3f6f787 |
class UELCCaseQuizModuleFactory(object): <NEW_LINE> <INDENT> def __init__(self, hname, base_url): <NEW_LINE> <INDENT> hierarchy = HierarchyFactory(name=hname, base_url=base_url) <NEW_LINE> root = hierarchy.get_root() <NEW_LINE> root.add_child_section_from_dict( {'label': "One", 'slug': "one", 'children': [{'label': "Th... | Stealing module factory from pagetree factories to adapt for
casequiz tests | 6259903e73bcbd0ca4bcb4e3 |
class tempfile(object): <NEW_LINE> <INDENT> def __init__(self, unique_id, suffix='', prefix='', dir=None, text=False): <NEW_LINE> <INDENT> suffix = unique_id + suffix <NEW_LINE> prefix = prefix + _TEMPLATE <NEW_LINE> self.fd, self.name = module_tempfile.mkstemp(suffix=suffix, prefix=prefix, dir=dir, text=text) <NEW_LIN... | A wrapper for tempfile.mkstemp
@param unique_id: required, a unique string to help identify what
part of code created the tempfile.
@var name: The name of the temporary file.
@var fd: the file descriptor of the temporary file that was created.
@return a tempfile object
example usage:
t = autotem... | 6259903e10dbd63aa1c71e30 |
class ProtocolScoreEnum(Enum): <NEW_LINE> <INDENT> SSLv20 = 0 <NEW_LINE> SSLv30 = 80 <NEW_LINE> TLSv10 = 90 <NEW_LINE> TLSv11 = 95 <NEW_LINE> TLSv12 = 100 | 1) Protocol support:
SSL 2.0: 0 **V**
SSL 3.0: 80 **V**
TLS 1.0: 90 **V**
TLS 1.1: 95 **V**
TLS 1.2: 100 **V**
Total score: best protocol score + worst protocol score, divided by 2. | 6259903e8e71fb1e983bcd26 |
class FigureManagerWx(FigureManagerBase): <NEW_LINE> <INDENT> def __init__(self, canvas, num, frame): <NEW_LINE> <INDENT> DEBUG_MSG("__init__()", 1, self) <NEW_LINE> FigureManagerBase.__init__(self, canvas, num) <NEW_LINE> self.frame = frame <NEW_LINE> self.window = frame <NEW_LINE> self.tb = frame.GetToolBar() <NEW_LI... | This class contains the FigureCanvas and GUI frame
It is instantiated by GcfWx whenever a new figure is created. GcfWx is
responsible for managing multiple instances of FigureManagerWx.
public attrs
canvas - a FigureCanvasWx(wx.Panel) instance
window - a wxFrame instance - wxpython.org/Phoenix/docs/html/Frame.html | 6259903e45492302aabfd733 |
class FeedbackListView(AdminUserRequiredMixin, generic.ListView): <NEW_LINE> <INDENT> model = Feedback <NEW_LINE> template_name = 'myadmin/feedback_list.html' <NEW_LINE> context_object_name = 'feedback_list' <NEW_LINE> paginate_by = 10 <NEW_LINE> q = '' <NEW_LINE> def get_context_data(self, *, object_list=None, **kwarg... | 反馈信息 | 6259903e287bf620b6272e45 |
class RectangleGenerator: <NEW_LINE> <INDENT> def __init__(self, min_rect_rel_square=0.3, max_rect_rel_square=1): <NEW_LINE> <INDENT> self.min_rect_rel_square = min_rect_rel_square <NEW_LINE> self.max_rect_rel_square = max_rect_rel_square <NEW_LINE> <DEDENT> def gen_coordinates(self, width, height): <NEW_LINE> <INDENT>... | Generates for each object a mask where unobserved region is
a rectangle which square divided by the image square is in
interval [min_rect_rel_square, max_rect_rel_square]. | 6259903eb830903b9686eda6 |
class Coderack(object): <NEW_LINE> <INDENT> def __init__(self, max_capacity=10): <NEW_LINE> <INDENT> self._max_capacity = max_capacity <NEW_LINE> self._urgency_sum = 0 <NEW_LINE> self._codelet_count = 0 <NEW_LINE> self._codelets = set() <NEW_LINE> self._forced_next_codelet = None <NEW_LINE> <DEDENT> def CodeletCount(se... | Implements the coderack --- the collection of codelets waiting to run.
.. todo:: Choose the codelet to expunge based on a better criteria than uniformly randomly. | 6259903e76d4e153a661dba0 |
class AbstractRefreshToken(models.Model): <NEW_LINE> <INDENT> id = models.BigAutoField(primary_key=True) <NEW_LINE> user = models.ForeignKey( settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name="%(app_label)s_%(class)s" ) <NEW_LINE> token = models.CharField(max_length=255) <NEW_LINE> application = models.F... | A RefreshToken instance represents a token that can be swapped for a new
access token when it expires.
Fields:
* :attr:`user` The Django user representing resources' owner
* :attr:`token` Token value
* :attr:`application` Application instance
* :attr:`access_token` AccessToken instance this refresh token is
... | 6259903e4e696a045264e74e |
class NoCorrespondingHandlingFunctionError(ValueError): <NEW_LINE> <INDENT> def __init__(self, event_type: Type[MessageEventObject]): <NEW_LINE> <INDENT> super().__init__(f"No corresponding message handling function of type {type(event_type)}") | Raised if no corresponding handling function for the message type. | 6259903e23849d37ff852313 |
class TraceServerSpanObserver(TraceSpanObserver): <NEW_LINE> <INDENT> def __init__(self, service_name: str, hostname: str, span: Span, recorder: "Recorder"): <NEW_LINE> <INDENT> self.service_name = service_name <NEW_LINE> self.span = span <NEW_LINE> self.recorder = recorder <NEW_LINE> super().__init__(service_name, hos... | Span recording observer for incoming request spans.
This observer implements the server-side span portion of a
Zipkin request trace | 6259903e1f5feb6acb163e4d |
class Integration(Base): <NEW_LINE> <INDENT> def run(self): <NEW_LINE> <INDENT> message.print_welcome() <NEW_LINE> int_name = self.options['<name>'] <NEW_LINE> int_options = self.options['<option>'] <NEW_LINE> int_options = util.option_to_dict(int_options) <NEW_LINE> message.print_bold(int_name + " Integration with Opt... | Manage Integrations. | 6259903eb57a9660fecd2cd5 |
class EmailOperator(BaseOperator): <NEW_LINE> <INDENT> template_fields = ('subject', 'html_content') <NEW_LINE> template_ext = ('.html',) <NEW_LINE> ui_color = '#e6faf9' <NEW_LINE> @apply_defaults <NEW_LINE> def __init__( self, to, subject, html_content, files=None, *args, **kwargs): <NEW_LINE> <INDENT> super(EmailOper... | Sends an email.
:param to: list of emails to send the email to
:type to: list or string (comma or semicolon delimited)
:param subject: subject line for the email (templated)
:type subject: string
:param html_content: content of the email (templated), html markup
is allowed
:type html_content: string
:param files: ... | 6259903e8a349b6b436874a0 |
class LinkCheckThread(threading.Thread): <NEW_LINE> <INDENT> def __init__(self, page, url, history, HTTPignore, day): <NEW_LINE> <INDENT> threading.Thread.__init__(self) <NEW_LINE> self.page = page <NEW_LINE> self.url = url <NEW_LINE> self.history = history <NEW_LINE> self.setName((u'%s - %s' % (page.title(), url)).enc... | A thread responsible for checking one URL.
After checking the page, it will die. | 6259903e30dc7b76659a0a8c |
@HOOKS.register_module() <NEW_LINE> class EMAHook(Hook): <NEW_LINE> <INDENT> def __init__(self, momentum=0.0002, interval=1, warm_up=100, resume_from=None): <NEW_LINE> <INDENT> assert isinstance(interval, int) and interval > 0 <NEW_LINE> self.warm_up = warm_up <NEW_LINE> self.interval = interval <NEW_LINE> assert momen... | Exponential Moving Average Hook.
Use Exponential Moving Average on all parameters of model in training
process. All parameters have a ema backup, which update by the formula
as below. EMAHook takes priority over EvalHook and CheckpointSaverHook.
.. math::
\text{Xema_{t+1}} = (1 - \text{momentum}) \times
... | 6259903ed10714528d69efb9 |
class JType(XMLString): <NEW_LINE> <INDENT> types = {"int", "char", "boolean"} <NEW_LINE> def __init__(self, tokens: list[Token]) -> None: <NEW_LINE> <INDENT> token = tokens.pop() <NEW_LINE> if token.name == "keyword": <NEW_LINE> <INDENT> assert token.value in self.types <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> as... | 'int' | 'char' | 'boolean' | className | 6259903e94891a1f408ba024 |
class DeviceEndpoint(RestEndpoint): <NEW_LINE> <INDENT> ENDPOINT_PATH = "/api/devices/{device_id}" <NEW_LINE> async def get(self, device_id) -> web.Response: <NEW_LINE> <INDENT> device = self.ledfx.devices.get(device_id) <NEW_LINE> if device is None: <NEW_LINE> <INDENT> response = { 'not found': 404 } <NEW_LINE> return... | REST end-point for querying and managing devices | 6259903ed99f1b3c44d068f7 |
class IndexConfigError(Exception): <NEW_LINE> <INDENT> pass | Raise an error when create an :class:`Index` object from config
dictionary. | 6259903e66673b3332c31653 |
class TextureSprite(Sprite): <NEW_LINE> <INDENT> def __init__(self, texture): <NEW_LINE> <INDENT> super(TextureSprite, self).__init__() <NEW_LINE> self.texture = texture <NEW_LINE> flags = Uint32() <NEW_LINE> access = c_int() <NEW_LINE> w = c_int() <NEW_LINE> h = c_int() <NEW_LINE> ret = render.SDL_QueryTexture(texture... | A simple, visible, texture-based 2D object, using a renderer. | 6259903ea79ad1619776b2da |
class ACLMetaclass(type): <NEW_LINE> <INDENT> def __new__(cls, name, bases, attrs): <NEW_LINE> <INDENT> new_class = super(ACLMetaclass, cls).__new__(cls, name, bases, attrs) <NEW_LINE> if new_class.model is None: <NEW_LINE> <INDENT> return new_class <NEW_LINE> <DEDENT> new_class.perms = {} <NEW_LINE> if not isinstance(... | Used to generate the default set of permission | 6259903ebe383301e0254a73 |
class Test_objects(unittest.TestCase): <NEW_LINE> <INDENT> def test_object(self): <NEW_LINE> <INDENT> lines = compile_from_file('obj') <NEW_LINE> find_ops = ['bind_refs', 'invoke'] <NEW_LINE> self.assertTrue(check_op_sequence(lines, find_ops)) <NEW_LINE> <DEDENT> def test_builder_pattern(self): <NEW_LINE> <INDENT> line... | 'Objects' testing | 6259903ed6c5a102081e3381 |
class MinimaxAgent(MultiAgentSearchAgent): <NEW_LINE> <INDENT> def getAction(self, gameState): <NEW_LINE> <INDENT> bestValue = float('-Inf') <NEW_LINE> bestAction = None <NEW_LINE> for action in gameState.getLegalActions(0): <NEW_LINE> <INDENT> tempValue = self.minValue(gameState.generateSuccessor(0, action), 1, 1) <NE... | Your minimax agent (question 2) | 6259903e23849d37ff852315 |
class CPUIdle(CPUError): <NEW_LINE> <INDENT> def __init__(self, msg): <NEW_LINE> <INDENT> super(CPUError, self).__init__(msg) | Executed custom-idle instruction and quit-on-idle is enabled. | 6259903e1f5feb6acb163e4f |
class ModifyIPStrategyRequest(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.ServiceId = None <NEW_LINE> self.StrategyId = None <NEW_LINE> self.StrategyData = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> self.ServiceId = params.get("ServiceId") <NEW_LINE... | ModifyIPStrategy request structure.
| 6259903e6e29344779b018ae |
class TestSampleGrid(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.filename = os.path.join(TEST_DIR, 'test_data', 'landmask.nc') <NEW_LINE> self.lslon, self.lslat, self.lsgrid = grid.grdRead(self.filename) <NEW_LINE> ncobj = nctools.ncLoadFile(self.filename) <NEW_LINE> self.nclon = n... | Test that the range of methods to load gridded data produce expected
results. Uses the 0.083 degree land-sea mask dataset as a test dataset. | 6259903eb57a9660fecd2cd7 |
class CreateInputs(BaseOp): <NEW_LINE> <INDENT> def execute(self, input_data): <NEW_LINE> <INDENT> return [np.array(input_data[0]), np.array(input_data[1])] | op that creates inputs for the pipeline | 6259903ed53ae8145f9196b8 |
class RoleIntrospection(object): <NEW_LINE> <INDENT> title = 'Role' <NEW_LINE> manage.introspection('ptah:role') <NEW_LINE> actions = view.template('ptah.manage:templates/directive-role.pt') <NEW_LINE> def __init__(self, request): <NEW_LINE> <INDENT> self.request = request <NEW_LINE> <DEDENT> def renderActions(self, *a... | Role registrations | 6259903e50485f2cf55dc1e0 |
class AbstractParser(object): <NEW_LINE> <INDENT> def __init__(self, name, description, *args): <NEW_LINE> <INDENT> self._name = name <NEW_LINE> self._description = description <NEW_LINE> self._args = [] <NEW_LINE> self._kwargs = {} <NEW_LINE> for arg in args: <NEW_LINE> <INDENT> if isinstance(arg, KW): <NEW_LINE> <IND... | ABC for Parser objects.
Parser objects can hold Arg and SubParsers.
Do not update any instance local state outside of init. | 6259903e1d351010ab8f4d79 |
class GraphQLResolveInfo(NamedTuple): <NEW_LINE> <INDENT> field_name: str <NEW_LINE> field_nodes: List[FieldNode] <NEW_LINE> return_type: "GraphQLOutputType" <NEW_LINE> parent_type: "GraphQLObjectType" <NEW_LINE> path: Path <NEW_LINE> schema: "GraphQLSchema" <NEW_LINE> fragments: Dict[str, FragmentDefinitionNode] <NEW_... | Collection of information passed to the resolvers.
This is always passed as the first argument to the resolvers.
Note that contrary to the JavaScript implementation, the context (commonly used to
represent an authenticated user, or request-specific caches) is included here and
not passed as an additional argument. | 6259903ed10714528d69efba |
class NameSchema(MappingSchema): <NEW_LINE> <INDENT> name = Name() | Name sheet data structure.
`name`: a human readable resource Identifier | 6259903e26068e7796d4dba3 |
class _Service: <NEW_LINE> <INDENT> def start_service(self): <NEW_LINE> <INDENT> settle() <NEW_LINE> if list(processes("stratisd")) != []: <NEW_LINE> <INDENT> raise RuntimeError("A stratisd process is already running") <NEW_LINE> <DEDENT> service = subprocess.Popen( [_STRATISD], universal_newlines=True, ) <NEW_LINE> db... | Start and stop stratisd. | 6259903ecad5886f8bdc59ab |
class TestContentViewUpdate: <NEW_LINE> <INDENT> @pytest.mark.parametrize( 'key, value', {'description': gen_utf8(), 'name': gen_utf8()}.items(), ids=idgen ) <NEW_LINE> @tier1 <NEW_LINE> def test_positive_update_attributes(self, module_cv, key, value): <NEW_LINE> <INDENT> setattr(module_cv, key, value) <NEW_LINE> conte... | Tests for updating content views. | 6259903e507cdc57c63a5ff9 |
class Bullet(Sprite): <NEW_LINE> <INDENT> def __init__(self, ai_settings, screen, ship): <NEW_LINE> <INDENT> super(Bullet, self).__init__() <NEW_LINE> self.screen = screen <NEW_LINE> self.rect = pygame.Rect( 0, 0, ai_settings.bullet_width, ai_settings.bullet_height) <NEW_LINE> self.rect.centerx = ship.rect.centerx <NEW... | 子弹管理 | 6259903e21a7993f00c671cb |
class _Receiver(object): <NEW_LINE> <INDENT> __metaclass__ = abc.ABCMeta <NEW_LINE> @abc.abstractmethod <NEW_LINE> def abort_if_abortive(self, packet): <NEW_LINE> <INDENT> raise NotImplementedError() <NEW_LINE> <DEDENT> @abc.abstractmethod <NEW_LINE> def receive(self, packet): <NEW_LINE> <INDENT> raise NotImplementedEr... | Common specification of different packet-handling behavior. | 6259903e76d4e153a661dba2 |
class BaseMotorBoard(metaclass=abc.ABCMeta): <NEW_LINE> <INDENT> @abc.abstractmethod <NEW_LINE> def channels(self) -> Sequence[BaseMotorChannel]: <NEW_LINE> <INDENT> raise NotImplementedError | Abstract motor board implementation. | 6259903e8da39b475be0444c |
class Reporter(object): <NEW_LINE> <INDENT> def __init__(self, task=None, stage=None, operation=None): <NEW_LINE> <INDENT> self.task = task <NEW_LINE> self.stage = stage <NEW_LINE> self.operation = operation <NEW_LINE> <DEDENT> def start(self, **data): <NEW_LINE> <INDENT> self.handle(status=Status.START, **data) <NEW_L... | A reporter will create processing status updates. | 6259903e0a366e3fb87ddc43 |
class ProtocolVersion(NamedTuple): <NEW_LINE> <INDENT> major: int <NEW_LINE> minor: int <NEW_LINE> patch: int <NEW_LINE> def to_string(self): <NEW_LINE> <INDENT> return f"v{self.major}.{self.minor}.{self.patch}" | Server protocol version struct | 6259903e15baa723494631ef |
class Team(object): <NEW_LINE> <INDENT> def __init__(self, name, wins, seed): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.wins = int(wins) <NEW_LINE> self.seed = int(seed) <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return self.name <NEW_LINE> <DEDENT> def get_odds(self): <NEW_LINE> <INDENT> see... | Represents a team in the tournament. A team will have a name,
wins, and a seed. The wins should be represented as the number of wins
less the number of losses. eg. A record of 22-12 is 10 wins. | 6259903e379a373c97d9a287 |
class SettingsDict(dict): <NEW_LINE> <INDENT> separator = "." <NEW_LINE> def copy(self): <NEW_LINE> <INDENT> new_items = self.__class__() <NEW_LINE> for k, v in self.iteritems(): <NEW_LINE> <INDENT> new_items[k] = v <NEW_LINE> <DEDENT> return new_items <NEW_LINE> <DEDENT> def getsection(self, section): <NEW_LINE> <INDE... | A dict subclass with some extra helpers for dealing with app settings.
This class extends the standard dictionary interface with some extra helper
methods that are handy when dealing with application settings. It expects
the keys to be dotted setting names, where each component indicates one
section in the settings hi... | 6259903e004d5f362081f913 |
class BasicTokenizer(object): <NEW_LINE> <INDENT> def __init__(self, do_lower_case=True): <NEW_LINE> <INDENT> self.do_lower_case = do_lower_case <NEW_LINE> <DEDENT> def tokenize(self, text): <NEW_LINE> <INDENT> text = _convert_to_unicode_or_throw(text) <NEW_LINE> text = self._clean_text(text) <NEW_LINE> orig_tokens = w... | Runs basic tokenization (punctuation splitting, lower casing, etc.). | 6259903e097d151d1a2c22c4 |
class Config: <NEW_LINE> <INDENT> env_file_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) <NEW_LINE> env_file = env_file_path + '/' + '.env' <NEW_LINE> load_dotenv(dotenv_path=env_file) <NEW_LINE> INFLUX_DB = os.getenv('INFLUXDB_DB') <NEW_LINE> INFLUX_USER = os.getenv('INFLUXDB_ADMIN_USER') <NEW_LIN... | Loading of configurations from dot env file | 6259903e8a349b6b436874a4 |
class CollectorHandler: <NEW_LINE> <INDENT> def __init__(self, entries_handler, collector_registry): <NEW_LINE> <INDENT> self.entries_handler = entries_handler <NEW_LINE> self.collector_registry = collector_registry <NEW_LINE> <DEDENT> def collect(self): <NEW_LINE> <INDENT> yield from self.collector_registry.bandwidthC... | MKTXP Collectors Handler
| 6259903e07d97122c4217efd |
class Net(nn.Module): <NEW_LINE> <INDENT> def __init__(self, hidden_size): <NEW_LINE> <INDENT> super(Net, self).__init__() <NEW_LINE> self.conv1 = nn.Conv2d(1, 32, 3, 1) <NEW_LINE> self.conv2 = nn.Conv2d(32, 64, 3, 1) <NEW_LINE> self.dropout1 = nn.Dropout2d(0.25) <NEW_LINE> self.dropout2 = nn.Dropout2d(0.5) <NEW_LINE> ... | Define an NN model. | 6259903e96565a6dacd2d8ba |
class Font: <NEW_LINE> <INDENT> _DATABASE = None <NEW_LINE> def __init__(self, color='black', paper='white', bold=False, italic=False): <NEW_LINE> <INDENT> self.color = color <NEW_LINE> self.paper = paper <NEW_LINE> self.bold = bold <NEW_LINE> self.italic = italic <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def get_dat... | Utility class that makes it easy to set font related values within the
editor. | 6259903ebe383301e0254a77 |
class TC2(UnixCommands): <NEW_LINE> <INDENT> logger = logging.getLogger(__name__) <NEW_LINE> @staticmethod <NEW_LINE> def run_tc(): <NEW_LINE> <INDENT> TC2.logger.info(cons.INFO_RENAME + cons.INFO_CONDITION_RW) <NEW_LINE> step_1 = UnixCommands.ssh_to_server(var.SERVER_NAME, var.SERVER_IP, cons.REMOTE_TOUCH + var.HOST_P... | From client side rename a file from a share directory. Condition rw | 6259903ed53ae8145f9196bb |
class GetBlockAPISerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> transactions = TransactionAPISerializer(many=True, source='get_block') <NEW_LINE> previous_hash = SubGetBlockAPISerializer(many=False) <NEW_LINE> class Meta: <NEW_LINE> <INDENT> model = models.BlockStructureDB <NEW_LINE> fields = '__all__' | Serialize blocks | 6259903ed6c5a102081e3385 |
class BigBracket(BigSymbol): <NEW_LINE> <INDENT> def __init__(self, size, bracket, alignment='l'): <NEW_LINE> <INDENT> self.size = size <NEW_LINE> self.original = bracket <NEW_LINE> self.alignment = alignment <NEW_LINE> self.pieces = None <NEW_LINE> if bracket in FormulaConfig.bigbrackets: <NEW_LINE> <INDENT> self.piec... | A big bracket generator. | 6259903edc8b845886d54816 |
class JWKRSATest(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> from letsencrypt.acme.jose.jwk import JWKRSA <NEW_LINE> self.jwk256 = JWKRSA(key=RSA256_KEY.publickey()) <NEW_LINE> self.jwk256_private = JWKRSA(key=RSA256_KEY) <NEW_LINE> self.jwk256json = { 'kty': 'RSA', 'e': 'AQAB', 'n': 'r... | Tests for letsencrypt.acme.jose.jwk.JWKRSA. | 6259903e30c21e258be99a6d |
class MockHost(object): <NEW_LINE> <INDENT> def __init__(self, data): <NEW_LINE> <INDENT> self.reader = self._read(data) <NEW_LINE> <DEDENT> def write(self, *args, **kwds): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def read(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return self.reader.next() <NEW_LINE> <DED... | A mock device which can be used
when instantiating a Device.
Rather than accessing hardware,
commands are replayed though given
string (which can be read from file.
This class is dumb, so caller has
to ensure pkts in the import string
or file are properly ordered. | 6259903e0a366e3fb87ddc45 |
class BlockStyle(with_metaclass(ABCMeta, Base)): <NEW_LINE> <INDENT> def __init__(self, background_color=None, separator=None, separator_color=None, **kwargs): <NEW_LINE> <INDENT> super(BlockStyle, self).__init__(**kwargs) <NEW_LINE> self.background_color = background_color <NEW_LINE> self.separator = separator <NEW_LI... | BlockStyle.
https://developers.line.me/en/docs/messaging-api/reference/#objects-for-the-block-style | 6259903e8a43f66fc4bf33f0 |
class DeleteAll(FlaskForm): <NEW_LINE> <INDENT> confirmdelete = SubmitField("Confirm delete all data") | Form to confirm deletion of all user collections and the Tenancy collection. TO DO: Be more graceful by only
removing tenancies for the current user.
Attributes
----------
confirmdelete: SubmitField
Confirm deletion of database. | 6259903ed99f1b3c44d068fc |
class StatusBar(QStatusBar): <NEW_LINE> <INDENT> def __init__(self, parent=None): <NEW_LINE> <INDENT> super().__init__(parent=parent) <NEW_LINE> self._is_cmd_mode = False <NEW_LINE> self.setSizeGripEnabled(False) <NEW_LINE> self._console = QLineEdit() <NEW_LINE> self._console.setVisible(False) <NEW_LINE> self._status_l... | 状态栏 | 6259903e29b78933be26a9f3 |
class Key: <NEW_LINE> <INDENT> def __init__(self, pk_init=new_pk()): <NEW_LINE> <INDENT> self.pk = pk_init <NEW_LINE> self.wif = numtowif(int(self.pk,16)) <NEW_LINE> self.address = new_addy(self.pk) | This will hold the following information:
Private Key in both String and Int form
WIF String | 6259903e07f4c71912bb0692 |
class FacebookMiddleware(FBMiddleware): <NEW_LINE> <INDENT> def process_request(self, request): <NEW_LINE> <INDENT> fb_user = self.get_fb_user(request) <NEW_LINE> request.facebook = DjangoFacebook(fb_user) if fb_user else None <NEW_LINE> return None | We don't need auth_login action at every request
That's why we re-implement middleware | 6259903e10dbd63aa1c71e38 |
class DeleteAccountResource(AccountViewMixin, DeleteAPIResource): <NEW_LINE> <INDENT> decorators = [is_authenticated()] | API View for deleting an account | 6259903e21bff66bcd723ecb |
class Configurable(metaclass=ConfigurableMeta): <NEW_LINE> <INDENT> def __new__(cls, *args, _final=False, **kwargs): <NEW_LINE> <INDENT> options = tuple(cls.__options__) <NEW_LINE> missing = set() <NEW_LINE> for name, option in options: <NEW_LINE> <INDENT> if option.required and not option.name in kwargs: <NEW_LINE> <I... | Generic class for configurable objects. Configurable objects have a dictionary of "options" descriptors that defines
the configuration schema of the type. | 6259903e16aa5153ce40174e |
class IFC(AbivarAble): <NEW_LINE> <INDENT> def __init__(self, ddb_filename, ngqpt, q1shfts=(0.,0.,0.), ifcflag=1, brav=1): <NEW_LINE> <INDENT> self.ddb_filename = os.path.abspath(ddb_filename) <NEW_LINE> if not os.path.exists(self.ddb_filename): <NEW_LINE> <INDENT> raise ValueError("%s: no such file" % self.ddb_filenam... | This object defines the set of variables used for the
Fourier interpolation of the interatomic force constants. | 6259903ebe383301e0254a79 |
class OneHotNp(Transform): <NEW_LINE> <INDENT> def __init__(self, out_dim, dtype=np.float): <NEW_LINE> <INDENT> self.out_dim = out_dim <NEW_LINE> self.dtype = dtype <NEW_LINE> <DEDENT> def transform(self, tensor): <NEW_LINE> <INDENT> if not isinstance(tensor, np.ndarray): <NEW_LINE> <INDENT> tensor = np.array(tensor) <... | Make transform with numpy. | 6259903ea79ad1619776b2e0 |
class QueryBuilder: <NEW_LINE> <INDENT> def __init__(self, measurement="", period="time >= '2019-01-01'", limit=25): <NEW_LINE> <INDENT> self._limit = limit <NEW_LINE> self._measurement = measurement <NEW_LINE> self._period = period <NEW_LINE> <DEDENT> def _select_clause(self): <NEW_LINE> <INDENT> return "select * from... | Builds query statement for the query function | 6259903ee64d504609df9d02 |
class BorrowedBooksView(PermissionRequiredMixin, generic.ListView): <NEW_LINE> <INDENT> model = BookInstance <NEW_LINE> template_name = 'catalog/bookinstance_list_all_borrowed.html' <NEW_LINE> paginate_by = 10 <NEW_LINE> permission_required = 'catalog.can_mark_returned' <NEW_LINE> def get_queryset(self): <NEW_LINE> <IN... | Generic class-based view listing books on loan to all users. For stuff only. | 6259903e8c3a8732951f77b9 |
class Question(Item): <NEW_LINE> <INDENT> test = models.ForeignKey(Test, related_name='questions', verbose_name='测试' ) <NEW_LINE> class Meta: <NEW_LINE> <INDENT> verbose_name = '问题' <NEW_LINE> verbose_name_plural = '问题' <NEW_LINE> app_label = 'itest' <NEW_LINE> ordering = ['test', 'num', ] | 问题 | 6259903e4e696a045264e752 |
class ActivitiesLocationSegment(utilities.DbObject): <NEW_LINE> <INDENT> start_lat = Column(Float) <NEW_LINE> start_long = Column(Float) <NEW_LINE> stop_lat = Column(Float) <NEW_LINE> stop_long = Column(Float) <NEW_LINE> @hybrid_property <NEW_LINE> def start_loc(self): <NEW_LINE> <INDENT> return utilities.Location(self... | Object representing a databse object for storing location segnment from an activity. | 6259903ea4f1c619b294f7b8 |
class BlobTags(Model): <NEW_LINE> <INDENT> _validation = { 'blob_tag_set': {'required': True}, } <NEW_LINE> _attribute_map = { 'blob_tag_set': {'key': 'BlobTagSet', 'type': '[BlobTag]', 'xml': {'name': 'TagSet', 'itemsName': 'TagSet', 'wrapped': True}}, } <NEW_LINE> _xml_map = { 'name': 'Tags' } <NEW_LINE> def __init__... | Blob tags.
All required parameters must be populated in order to send to Azure.
:param blob_tag_set: Required.
:type blob_tag_set: list[~azure.storage.blob.models.BlobTag] | 6259903e23849d37ff85231b |
class removeBreakpoint(ChromeCommand): <NEW_LINE> <INDENT> def __init__(self, breakpointId: "BreakpointId"): <NEW_LINE> <INDENT> self.breakpointId = breakpointId | Removes JavaScript breakpoint. | 6259903f1f5feb6acb163e55 |
class PydubException(Exception): <NEW_LINE> <INDENT> pass | Base class for any Pydub exception | 6259903f0a366e3fb87ddc47 |
class ParametrizedLocator(ParametrizedString): <NEW_LINE> <INDENT> def __get__(self, o, t=None): <NEW_LINE> <INDENT> result = super().__get__(o, t) <NEW_LINE> if isinstance(result, ParametrizedString): <NEW_LINE> <INDENT> return result <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return Locator(result) | :py:class:`ParametrizedString` modified to return instances of :py:class:`smartloc.Locator` | 6259903f15baa723494631f3 |
class UpdateInvoiceItemResultSet(ResultSet): <NEW_LINE> <INDENT> def getJSONFromString(self, str): <NEW_LINE> <INDENT> return json.loads(str) <NEW_LINE> <DEDENT> def get_Response(self): <NEW_LINE> <INDENT> return self._output.get('Response', None) | A ResultSet with methods tailored to the values returned by the UpdateInvoiceItem Choreo.
The ResultSet object is used to retrieve the results of a Choreo execution. | 6259903f8a43f66fc4bf33f2 |
class schedule(object): <NEW_LINE> <INDENT> relative = False <NEW_LINE> def __init__(self, run_every=None, relative=False, nowfun=None, app=None): <NEW_LINE> <INDENT> self.run_every = maybe_timedelta(run_every) <NEW_LINE> self.relative = relative <NEW_LINE> self.nowfun = nowfun <NEW_LINE> self._app = app <NEW_LINE> <DE... | Schedule for periodic task.
:param run_every: Interval in seconds (or a :class:`~datetime.timedelta`).
:keyword relative: If set to True the run time will be rounded to the
resolution of the interval.
:keyword nowfun: Function returning the current date and time
(class:`~datetime.datetime`).
:keyword app: Cel... | 6259903f6fece00bbacccc12 |
class SparklingJavaTransformer(JavaTransformer): <NEW_LINE> <INDENT> def __init__(self, jt=None): <NEW_LINE> <INDENT> super(SparklingJavaTransformer, self).__init__() <NEW_LINE> if not jt: <NEW_LINE> <INDENT> self._java_obj = self._new_java_obj(self.transformer_name) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self._... | Base class for Java transformers exposed in Python. | 6259903f50485f2cf55dc1e6 |
class InvalidProvider(ExecutionError): <NEW_LINE> <INDENT> returncode = 139 | A provider is not valid. This is detected before any changes have been
applied. | 6259903f07f4c71912bb0694 |
class TagsListResult(msrest.serialization.Model): <NEW_LINE> <INDENT> _validation = { 'next_link': {'readonly': True}, } <NEW_LINE> _attribute_map = { 'value': {'key': 'value', 'type': '[TagDetails]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } <NEW_LINE> def __init__( self, *, value: Optional[List["TagDetails"... | List of subscription tags.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: An array of tags.
:vartype value: list[~azure.mgmt.resource.resources.v2018_05_01.models.TagDetails]
:ivar next_link: The URL to use for getting the next set of results.
:vartype next_link: ... | 6259903f30dc7b76659a0a94 |
class UserViewSet(viewsets.ModelViewSet): <NEW_LINE> <INDENT> queryset = User.objects.all().order_by('-date_joined') <NEW_LINE> serializer_class = UserSerializer | api endpoint that allows user to be viewed or edited | 6259903f45492302aabfd73c |
@dataclass <NEW_LINE> class TrainerControl: <NEW_LINE> <INDENT> should_training_stop: bool = False <NEW_LINE> should_epoch_stop: bool = False <NEW_LINE> should_save: bool = False <NEW_LINE> should_evaluate: bool = False <NEW_LINE> should_log: bool = False <NEW_LINE> def _new_training(self): <NEW_LINE> <INDENT> self.sho... | A class that handles the :class:`~transformers.Trainer` control flow. This class is used by the
:class:`~transformers.TrainerCallback` to activate some switches in the training loop.
Args:
should_training_stop (:obj:`bool`, `optional`, defaults to :obj:`False`):
Whether or not the training should be interr... | 6259903f23e79379d538d762 |
class Action: <NEW_LINE> <INDENT> def __init__(self, address, operator_, value): <NEW_LINE> <INDENT> self.address = address <NEW_LINE> self.operator = ACTION_OPERATORS[operator_] <NEW_LINE> self.value = int(value) <NEW_LINE> <DEDENT> def evaluate(self, memory): <NEW_LINE> <INDENT> memory.set( self.address, self.operato... | An instruction action.
Performs an inc/dec on a memory address by a certain value. | 6259903f21a7993f00c671d1 |
class CreateLikeTrack(graphene.Mutation): <NEW_LINE> <INDENT> user = graphene.Field(UserType) <NEW_LINE> track = graphene.Field(TrackType) <NEW_LINE> class Arguments: <NEW_LINE> <INDENT> track_id = graphene.Int() <NEW_LINE> <DEDENT> @login_required <NEW_LINE> def mutate(self, info, **kwagrs): <NEW_LINE> <INDENT> user =... | This CreateLikeTrack allows you to add a track to the user preference. | 6259903f07f4c71912bb0695 |
class TestPullActionList(unittest.TestCase): <NEW_LINE> <INDENT> @mock.patch('builtins.open', mock.mock_open(read_data="sn2:action1\nsn1:action1")) <NEW_LINE> def test_get_actions_basic(self): <NEW_LINE> <INDENT> action_list = get_actions.pull_action_list() <NEW_LINE> self.assertEqual(action_list, ['sn2:action1', 'sn1:... | GIVEN a file with actions already exists | 6259903fd53ae8145f9196bf |
class TargetParameter(DeclarativeBase): <NEW_LINE> <INDENT> __tablename__ = 'rep_target_parameter' <NEW_LINE> tableName = __tablename__ <NEW_LINE> id = Column(Integer, autoincrement=True, primary_key=True) <NEW_LINE> replaceParamFileID = Column(Integer, ForeignKey('rep_replace_param_files.id')) <NEW_LINE> targetVariabl... | Object containing data for a single target value as defined in the Replacement Parameters File. | 6259903fe64d504609df9d03 |
class PortfolioSim(object): <NEW_LINE> <INDENT> def __init__(self, asset_names=[], steps=128, trading_cost=0.0025, time_cost=0.0): <NEW_LINE> <INDENT> self.cost = trading_cost <NEW_LINE> self.time_cost = time_cost <NEW_LINE> self.steps = steps <NEW_LINE> self.asset_names = asset_names <NEW_LINE> self.reset() <NEW_LINE>... | Portfolio management sim.
Params:
- cost e.g. 0.0025 is max in Poliniex
Based of [Jiang 2017](https://arxiv.org/abs/1706.10059) | 6259903fd164cc61758221da |
class SomeGraph: <NEW_LINE> <INDENT> def __init__( self, some_float: float) -> None: <NEW_LINE> <INDENT> self.some_float = some_float | defines some object graph. | 6259903f8a349b6b436874aa |
class TopicShow(ListView): <NEW_LINE> <INDENT> model = Topic <NEW_LINE> template_name = 'posts/topic.html' <NEW_LINE> def get_queryset(self): <NEW_LINE> <INDENT> self.object = get_object_or_404(self.model, id=self.kwargs['topic']) <NEW_LINE> self.comments = Comment.objects.filter(topic=self.object) <NEW_LINE> <DEDENT> ... | Shows a specific topic, and its comments. | 6259903f07d97122c4217f03 |
class Glib(VProject): <NEW_LINE> <INDENT> NAME = 'glib' <NEW_LINE> GROUP = 'c_projects' <NEW_LINE> DOMAIN = ProjectDomains.DATA_STRUCTURES <NEW_LINE> SOURCE = [ PaperConfigSpecificGit( project_name="glib", remote="https://github.com/GNOME/glib.git", local="glib", refspec="origin/HEAD", limit=None, shallow=False ) ] <NE... | GLib is the low-level core library that forms the basis for projects such as
GTK and GNOME. It provides data structure handling for C, portability
wrappers, and interfaces for such runtime functionality as an event loop,
threads, dynamic loading, and an object system.
(fetched by Git) | 6259903f1d351010ab8f4d82 |
class FooEnum(Enum): <NEW_LINE> <INDENT> GOOD_ENUM_NAME = 1 <NEW_LINE> bad_enum_name = 2 | A test case for enum names. | 6259903f10dbd63aa1c71e3b |
class Limitation: <NEW_LINE> <INDENT> def __init__(self, code, data): <NEW_LINE> <INDENT> self._code = code <NEW_LINE> self._data = data <NEW_LINE> <DEDENT> @property <NEW_LINE> def code(self): <NEW_LINE> <INDENT> return self._code <NEW_LINE> <DEDENT> @code.setter <NEW_LINE> def code(self, new_code): <NEW_LINE> <INDENT... | A class representing a limitation that is held within an exclusion. Each limitation only has a unique
identifier called a code, and some data that is interpreted differently based on the code. | 6259903f94891a1f408ba029 |
class GameSession(object): <NEW_LINE> <INDENT> def __init__(self, ip_address, player_controller_id): <NEW_LINE> <INDENT> self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) <NEW_LINE> self.sock.setblocking(False) <NEW_LINE> self.ip_address = socket.gethostbyname(ip_address) <NEW_LINE> self.player_controller_id... | Keyboard:
8bit Version (Currently use 0)
8bit Protocol Type : (Keyboard (1), Mouse (2), Gamepad, etc.)
32bit Sequence (counter for event)
8bit ControllerID (start from 0)
16bit UEKeyCode (A, B, , Z, 0, ... ,9, punctuation, etc.)
16bit UECharCode (F1, ..., F12, Ctrl, Alt, Numpad, etc.)
8bit Event (Key Down (2), Key Up (... | 6259903fcad5886f8bdc59af |
class SolverObjectException(SolversException, metaclass=ABCMeta): <NEW_LINE> <INDENT> pass | Base for exceptions raised by a ``Solver`` object. | 6259903fd53ae8145f9196c1 |
class BuyShareForm(FlaskForm): <NEW_LINE> <INDENT> buysharecode = StringField('Company Code', validators=[ DataRequired('Company Code is required')]) <NEW_LINE> buyquantity = IntegerField('Quantity to Purchase', validators=[ DataRequired('Quantity is required')]) <NEW_LINE> buysubmit = SubmitField('Purchase', validator... | Form for buying shares | 6259903fa79ad1619776b2e4 |
class AbstractAnimatedIcon(qt.QObject): <NEW_LINE> <INDENT> def __init__(self, parent=None): <NEW_LINE> <INDENT> qt.QObject.__init__(self, parent) <NEW_LINE> self.__targets = silxweakref.WeakList() <NEW_LINE> self.__currentIcon = None <NEW_LINE> <DEDENT> iconChanged = qt.Signal(qt.QIcon) <NEW_LINE> def register(self, o... | Store an animated icon.
It provides an event containing the new icon everytime it is updated. | 6259903f0fa83653e46f613f |
class BatchTestCase(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> import rf.batch <NEW_LINE> rf.batch.tqdm = lambda: None <NEW_LINE> <DEDENT> @unittest.skipIf(sys.platform.startswith("win"), "fails on Windows") <NEW_LINE> def test_entry_point(self): <NEW_LINE> <INDENT> ep_script = load_en... | For now batch tests are not run on windows.
See https://travis-ci.org/trichter/rf/jobs/589375488 for failures.
The batch module has a low priority. | 6259903fb830903b9686edac |
class OrderByBasketRetrieveView(generics.RetrieveAPIView): <NEW_LINE> <INDENT> permission_classes = (IsAuthenticated,) <NEW_LINE> serializer_class = OrderSerializer <NEW_LINE> lookup_field = 'number' <NEW_LINE> queryset = Order.objects.all() <NEW_LINE> def dispatch(self, request, *args, **kwargs): <NEW_LINE> <INDENT> m... | Allow the viewing of Orders by Basket. | 6259903f07d97122c4217f04 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.