code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class Generator(): <NEW_LINE> <INDENT> def __init__(self, owner='', history='', cur_yr='', xl_opts='', field_config='', mong_opts='', **kwargs): <NEW_LINE> <INDENT> super().__init__(**kwargs) <NEW_LINE> self.owner = owner.lower() <NEW_LINE> self.history = history if history else 1 <NEW_LINE> self.cur_yr ... | Parent class for the generators
| 62599017d164cc6175821ce2 |
class GenreQuestion(QuestionTemplate): <NEW_LINE> <INDENT> optional_opening = Question(Pos("WP") + Lemma("be") + Question(Pos("DT"))) <NEW_LINE> regex = optional_opening + Question(Lemma("music")) + Lemma("genre") + Pos("IN") + Band() + Question(Pos(".")) <NEW_LINE> def interpret(self, match): <NEW_LINE> <INDENT... | Regex for questions about the genre of a band.
Ex: "What is the music genre of Gorillaz?"
"Music genre of Radiohead" | 625990176fece00bbaccc71c |
class CustomController(Controller): <NEW_LINE> <INDENT> def __init__(self, flask_web_app, available_services, config): <NEW_LINE> <INDENT> Controller.__init__(self, flask_web_app, available_services, config) <NEW_LINE> self.exposed_methods += [ self.custom_route_example, self.custom_route_exception_example ] <NEW_LINE>... | Controller for /custom-route/ URL.
This is a proof-of-concept controller. Modify it accordingly. | 62599017be8e80087fbbfdd8 |
class Site(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.access_points = {} <NEW_LINE> self.logger = logging.getLogger("dyko") <NEW_LINE> try: <NEW_LINE> <INDENT> from logging import NullHandler <NEW_LINE> <DEDENT> except ImportError: <NEW_LINE> <INDENT> class NullHandler(logging.Handler): <... | Kalamar site. | 625990179b70327d1c57fae8 |
class PostOwnStatus(permissions.BasePermission): <NEW_LINE> <INDENT> def has_object_permission(self,request,view,obj): <NEW_LINE> <INDENT> if request.method in permissions.SAFE_METHODS: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> return obj.user_profile.id == request.user.id | Allow users to update their own status. | 62599017d18da76e235b7801 |
@implementer(IRenderable) <NEW_LINE> class _ComparisonRenderer(util.ComparableMixin, object): <NEW_LINE> <INDENT> compare_attrs = ('fn',) <NEW_LINE> def __init__(self, v1, v2, cstr, comparator): <NEW_LINE> <INDENT> self.v1, self.v2, self.comparator, self.cstr = v1, v2, comparator, cstr <NEW_LINE> <DEDENT> @defer.inline... | An instance of this class renders a comparison given by a comparator
function with v1 and v2 | 62599017462c4b4f79dbc770 |
class AnalyzerRuntimeError(BaseCmdlrException): <NEW_LINE> <INDENT> pass | Other analyzer error. | 6259901721a7993f00c66ce3 |
class QueueWriter(Thread): <NEW_LINE> <INDENT> def __init__(self, output_queue, parse=True, pace10=1, factor=2): <NEW_LINE> <INDENT> Thread.__init__(self) <NEW_LINE> self.output_queue = output_queue <NEW_LINE> self.pace10 = pace10 <NEW_LINE> self.factor = factor <NEW_LINE> self.parse = parse <NEW_LINE> self.should_run ... | Used to fill the Statistician queue, to simulate a fast reading and compare the reading speed with or without parsing.
Note
----
pace10 is the pace for 100ms, ie ``10*pace10`` entries are put in the queue every second. | 625990178c3a8732951f72ca |
class S(HtmlElement): <NEW_LINE> <INDENT> class PropTypes: <NEW_LINE> <INDENT> role: str | Implement the ``s`` HTML tag. | 6259901721a7993f00c66ce5 |
class ReplaceFooterWithStaticViewlets(UpgradeStep): <NEW_LINE> <INDENT> def __call__(self): <NEW_LINE> <INDENT> self.install_upgrade_profile() <NEW_LINE> self.remove_footer_layer() <NEW_LINE> self.remove_footer_portlets() <NEW_LINE> self.remove_footer_portlet_managers() <NEW_LINE> <DEDENT> def remove_footer_layer(self)... | Replace footer with static viewlets.
| 62599017be8e80087fbbfddc |
class PROCESS_INFORMATION(Structure): <NEW_LINE> <INDENT> _fields_ = [ ("hProcess", HANDLE), ("hThread", HANDLE), ("dwProcessId", DWORD), ("dwThreadId", DWORD), ] | PROCESS_INFORMATION receives its information
after the target process has been successfully
started. | 625990176fece00bbaccc720 |
class ForeignBranchFormatTests(TestCaseWithTransport): <NEW_LINE> <INDENT> branch_format = None <NEW_LINE> def test_initialize(self): <NEW_LINE> <INDENT> bzrdir = self.make_bzrdir('dir') <NEW_LINE> self.assertRaises(IncompatibleFormat, self.branch_format.initialize, bzrdir) <NEW_LINE> <DEDENT> def test_get_format_descr... | Basic tests for foreign branch format objects. | 6259901756b00c62f0fb3629 |
class ApiRequestConfig(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.Path = None <NEW_LINE> self.Method = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> self.Path = params.get("Path") <NEW_LINE> self.Method = params.get("Method") <NEW_LINE> memeber_set = ... | api请求配置
| 62599017d18da76e235b7803 |
class BaseSocialModel(models.Model): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> abstract = True <NEW_LINE> <DEDENT> def url(self): <NEW_LINE> <INDENT> current_site = Site.objects.get_current() <NEW_LINE> return "http://{0}/{1}/".format(current_site.domain, base62.encode(self.pk)) <NEW_LINE> <DEDENT> def facebo... | This is an abstract model to be inherited by the main "object" being used in feeds on a social media application.
It expects that object to override the methods below. | 625990178c3a8732951f72ce |
class OCNOSBasicModeError(OCNOSError): <NEW_LINE> <INDENT> pass | Exception class when failed to set basic mode to trim | 625990179b70327d1c57faee |
class DecoderBlock(nn.Module): <NEW_LINE> <INDENT> def __init__(self, d_model, d_inner_hid, n_head, dropout=0.1): <NEW_LINE> <INDENT> super(DecoderBlock, self).__init__() <NEW_LINE> self.slf_attn = MultiHeadedAttention(head_count=n_head, model_dim=d_model, dropout=dropout) <NEW_LINE> self.ctx_attn = MultiHeadedAttentio... | Compose with three layers | 625990175166f23b2e24413f |
class CacheEntry(object): <NEW_LINE> <INDENT> __slots__ = [ 'dirty', 'inode', 'blockno', 'last_write', 'size', 'pos', 'fh', 'removed' ] <NEW_LINE> def __init__(self, inode, blockno, filename, mode='w+b'): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.fh = open(filename, mode, 0) <NEW_LINE> self.dirty = False <... | An element in the block cache
Attributes:
-----------
:dirty: entry has been changed since it was last uploaded.
:size: current file size
:pos: current position in file | 62599017796e427e5384f4ee |
class DomainAffiliationManager(ObjectManager): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> ObjectManager.__init__(self) <NEW_LINE> self.getters.update({ 'default' : 'get_general', 'domain' : 'get_foreign_key', 'may_log_me_in' : 'get_general', 'user' : 'get_foreign_key', 'username' : 'get_general', }) <N... | Manage domain affiliations in the Power Reg system | 625990179b70327d1c57faf0 |
class RPolynom(RPackage): <NEW_LINE> <INDENT> homepage = "https://cloud.r-project.org/package=polynom" <NEW_LINE> url = "https://cloud.r-project.org/src/contrib/polynom_1.4-0.tar.gz" <NEW_LINE> list_url = "https://cloud.r-project.org/src/contrib/Archive/polynom" <NEW_LINE> version('1.4-0', sha256='c5b788b26f7118a1... | A collection of functions to implement a class for univariate polynomial
manipulations. | 62599017462c4b4f79dbc778 |
class ComputeDate(FSMAction): <NEW_LINE> <INDENT> def execute(self, context, obj): <NEW_LINE> <INDENT> daysOld = context['daysOld'] <NEW_LINE> context['backupDate'] = datetime.datetime.utcnow() - datetime.timedelta(days=daysOld) <NEW_LINE> return 'ok' | Compute a stable backup date to use across continuations. | 625990175166f23b2e244141 |
class GetValueTests(unittest.TestCase, AssertIsMixin): <NEW_LINE> <INDENT> def assertNotFound(self, item, key): <NEW_LINE> <INDENT> self.assertIs(_get_value(item, key), _NOT_FOUND) <NEW_LINE> <DEDENT> def test_dictionary__key_present(self): <NEW_LINE> <INDENT> item = {"foo": "bar"} <NEW_LINE> self.assertEqual(_get_valu... | Test context._get_value(). | 625990170a366e3fb87dd764 |
class ImbalancedDatasetSampler(torch.utils.data.sampler.Sampler): <NEW_LINE> <INDENT> def __init__(self, dataset, indices=None, num_samples=None, callback_get_label=None): <NEW_LINE> <INDENT> self.indices = list(range(len(dataset))) if indices is None else indices <NEW_LINE> self.callback_get_label = callbac... | Samples elements randomly from a given list of indices for imbalanced dataset
Arguments:
indices (list, optional): a list of indices
num_samples (int, optional): number of samples to draw
callback_get_label func: a callback-like function which takes two arguments - dataset and index | 62599017be8e80087fbbfde2 |
class Ghost(CastleKilmereMember): <NEW_LINE> <INDENT> def __init__(self, name: str, birthyear: int, sex: str, year_of_death: int, house: str = None): <NEW_LINE> <INDENT> super().__init__(name, birthyear, sex) <NEW_LINE> self.year_of_death = year_of_death <NEW_LINE> if house is not None: <NEW_LINE> <INDENT> self.house =... | Creates a Castle Kilmere ghost | 625990175e10d32532ce3fbf |
class Spectrum1DCollection(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.spectra = list() <NEW_LINE> self.dispersion = None <NEW_LINE> <DEDENT> def append(self, spectrum): <NEW_LINE> <INDENT> self.spectra.append(new_spectrum.spectrum1DBase) <NEW_LINE> <DEDENT> def len(self): <NEW_LINE> <INDE... | A collection object for spectra that share the same dispersion information.
| 625990176fece00bbaccc726 |
class RandomSamplerWithoutReplacement(_BaseSampler): <NEW_LINE> <INDENT> def __init__(self, data_source, seed): <NEW_LINE> <INDENT> super(RandomSamplerWithoutReplacement, self).__init__(seed) <NEW_LINE> self.data_source = data_source <NEW_LINE> self.draws = list(range(len(self.data_source))) <NEW_LINE> <DEDENT> def _ge... | Permute the list of items | 625990178c3a8732951f72d2 |
class Conf(object): <NEW_LINE> <INDENT> def __init__(self, hr_init=75, hr_max=200, hr_min=25, qrs_width=0.1, qrs_thr_init=0.13, qrs_thr_min=0, ref_period=0.2, t_inspect_period=0.36): <NEW_LINE> <INDENT> if hr_min < 0: <NEW_LINE> <INDENT> raise ValueError("'hr_min' must be <= 0") <NEW_LINE> <DEDENT> if not hr_min < hr_i... | Initial signal configuration object for this qrs detector | 62599017bf627c535bcb2221 |
class List(base.MistralLister): <NEW_LINE> <INDENT> def _get_format_function(self): <NEW_LINE> <INDENT> return CodeSourceFormatter.format_list <NEW_LINE> <DEDENT> def get_parser(self, prog_name): <NEW_LINE> <INDENT> parser = super(List, self).get_parser(prog_name) <NEW_LINE> return parser <NEW_LINE> <DEDENT> def _get_r... | List all workflows. | 62599017507cdc57c63a5b12 |
class TaskRegistrationDecoratorTest(TestCase): <NEW_LINE> <INDENT> def test_register_without_parameters(self): <NEW_LINE> <INDENT> def register(): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> register_task(force=True)(register) <NEW_LINE> self.assertIn(path(register), TASKS_BY_ID) <NEW_LINE> <DEDENT> def test_register(... | Test registration decorator | 62599018462c4b4f79dbc77c |
class Projeto: <NEW_LINE> <INDENT> def __init__(self, nome): <NEW_LINE> <INDENT> self.nome = nome <NEW_LINE> self.tarefas = [] <NEW_LINE> <DEDENT> def __iter__(self): <NEW_LINE> <INDENT> return self.tarefas.__iter__() <NEW_LINE> <DEDENT> def add(self, descricao, vencimento=None): <NEW_LINE> <INDENT> self.tarefas.append... | Essa classe cria um projeto, onde nele haverão diversas tarefas
e funcionalidades | 62599018be8e80087fbbfde6 |
class Req(DefaultMunch): <NEW_LINE> <INDENT> __default__ = '' <NEW_LINE> def redirect(self, url, permanent=False, anchor=""): <NEW_LINE> <INDENT> if type(url) == bytes: <NEW_LINE> <INDENT> url = str(url, 'utf8') <NEW_LINE> <DEDENT> url = str(url).strip( ) <NEW_LINE> if not url.startswith('http'): <NEW_LINE> <INDENT> ur... | extend the dict object with our own extra methods
| 625990180a366e3fb87dd76b |
class Fragment36(Fragment): <NEW_LINE> <INDENT> HeaderValues = [ ("CenterX", "f"), ("CenterY", "f"), ("CenterZ", "f"), ("Param2_0", "I"), ("Param2_1", "I"), ("Param2_2", "I"), ("MaxDist", "f"), ("MinX", "f"), ("MinY", "f"), ("MinZ", "f"), ("MaxX", "f"), ("MaxY", "f"), ("MaxZ", "f"), ("VertexCount", "H"), ("TexCoordsCou... | This type of fragment describes a mesh. | 62599018507cdc57c63a5b18 |
class ValueIterationAgent(ValueEstimationAgent): <NEW_LINE> <INDENT> def __init__(self, mdp, discount=0.9, iterations=100): <NEW_LINE> <INDENT> self.mdp = mdp <NEW_LINE> self.discount = discount <NEW_LINE> self.iterations = iterations <NEW_LINE> self.values = util.Counter() <NEW_LINE> states = self.mdp.getStates() <NEW... | * Please read learningAgents.py before reading this.*
A ValueIterationAgent takes a Markov decision process
(see mdp.py) on initialization and runs value iteration
for a given number of iterations using the supplied
discount factor. | 625990185e10d32532ce3fc3 |
class NetworkConfigurationDiagnosticResponse(msrest.serialization.Model): <NEW_LINE> <INDENT> _validation = { 'results': {'readonly': True}, } <NEW_LINE> _attribute_map = { 'results': {'key': 'results', 'type': '[NetworkConfigurationDiagnosticResult]'}, } <NEW_LINE> def __init__( self, **kwargs ): <NEW_LINE> <INDENT> s... | Results of network configuration diagnostic on the target resource.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar results: List of network configuration diagnostic results.
:vartype results:
list[~azure.mgmt.network.v2018_12_01.models.NetworkConfigurationDiagnosticResu... | 625990188c3a8732951f72da |
class Alien(Sprite): <NEW_LINE> <INDENT> def __init__(self,ai_settings, screen): <NEW_LINE> <INDENT> super(Alien, self).__init__() <NEW_LINE> self.screen = screen <NEW_LINE> self.ai_settings = ai_settings <NEW_LINE> self.image = pygame.image.load("images/alien.bmp") <NEW_LINE> self.rect = self.image.get_rect() <NEW_LIN... | Initialize alien and set its initial position | 62599018d18da76e235b780a |
class LoginView(View): <NEW_LINE> <INDENT> def get(self,request): <NEW_LINE> <INDENT> return render(request,'login.html') <NEW_LINE> <DEDENT> def post(self,request): <NEW_LINE> <INDENT> login_form = LoginForm(request.POST) <NEW_LINE> if login_form.is_valid(): <NEW_LINE> <INDENT> username = request.POST.get('username','... | 登录 | 62599018be8e80087fbbfdec |
class GetServers_result: <NEW_LINE> <INDENT> thrift_spec = ( (0, TType.STRUCT, 'success', (DeviceResponse, DeviceResponse.thrift_spec), None, ), ) <NEW_LINE> def __init__(self, success=None,): <NEW_LINE> <INDENT> self.success = success <NEW_LINE> <DEDENT> def read(self, iprot): <NEW_LINE> <INDENT> if iprot.__class__ ==... | Attributes:
- success | 62599018bf627c535bcb222c |
class SlackInput(HttpInputComponent): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def name(cls): <NEW_LINE> <INDENT> return "slack" <NEW_LINE> <DEDENT> def __init__(self, slack_token, slack_channel=None, errors_ignore_retry=None): <NEW_LINE> <INDENT> self.slack_token = slack_token <NEW_LINE> self.slack_channel = slack_... | Slack input channel implementation. Based on the HTTPInputChannel. | 62599018d164cc6175821cfa |
class ShowConsoleLog(command.Command): <NEW_LINE> <INDENT> log = logging.getLogger(__name__ + '.ShowConsoleLog') <NEW_LINE> def get_parser(self, prog_name): <NEW_LINE> <INDENT> parser = super(ShowConsoleLog, self).get_parser(prog_name) <NEW_LINE> parser.add_argument( 'server', metavar='<server>', help='Name or ID of se... | Show console-log command | 625990185e10d32532ce3fc5 |
class FileActivityLogger(BaseActivityLogger): <NEW_LINE> <INDENT> def __init__(self, activity, **kwargs): <NEW_LINE> <INDENT> super(FileActivityLogger, self).__init__(activity, **kwargs) <NEW_LINE> self.defer_finalize = True <NEW_LINE> self.indexed_meta_keys = [] <NEW_LINE> <DEDENT> @property <NEW_LINE> def file_meta(s... | An activity for logging to Titan Files. | 62599018a8ecb03325871f9b |
@patch('projects.views.private.trigger_build', lambda x, basic: None) <NEW_LINE> @patch('readthedocs.projects.views.private.trigger_build', lambda x, basic: None) <NEW_LINE> class MockBuildTestCase(TestCase): <NEW_LINE> <INDENT> pass | Mock build triggers for test cases | 625990185e10d32532ce3fc6 |
class ClusteredModel(object): <NEW_LINE> <INDENT> def __init__(self, info_dict): <NEW_LINE> <INDENT> self.queryset = info_dict.get('queryset', []) <NEW_LINE> self.fields = info_dict.get('fields', ['id']) <NEW_LINE> <DEDENT> def dataset(self): <NEW_LINE> <INDENT> dataset = {} <NEW_LINE> for item in self.queryset.filter(... | Wrapper around Model class
building a dataset of instances | 62599018507cdc57c63a5b20 |
class Solution: <NEW_LINE> <INDENT> def trapRainWater(self, heights): <NEW_LINE> <INDENT> min_heap = [] <NEW_LINE> m,n = len(heights), len(heights[0]) <NEW_LINE> visited = set() <NEW_LINE> for j in range(n): <NEW_LINE> <INDENT> heapq.heappush(min_heap, (heights[0][j], 0, j)) <NEW_LINE> visited.add( (0, j) ) <NEW_LINE> ... | @param heights: a matrix of integers
@return: an integer | 62599018462c4b4f79dbc788 |
class AuthenticationMethodBasic(AuthenticationMethod): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> AuthenticationMethod.__init__(self) <NEW_LINE> <DEDENT> def authentication_type(self) -> str: <NEW_LINE> <INDENT> return "basic" <NEW_LINE> <DEDENT> def authenticate(self, input_authentication_parameters: ... | Base class for an authentication method | 62599018925a0f43d25e8dc0 |
class BaseOrganizer(Participant): <NEW_LINE> <INDENT> objects = models.GeoManager() <NEW_LINE> type = models.ForeignKey('OrganizerType') <NEW_LINE> url = models.URLField(_('url'), null=True, blank=True) <NEW_LINE> notes = models.TextField(_('notes'), null=True, blank=True) <NEW_LINE> facebook_page = models.CharField( _... | Someone publicly participating in something. | 625990180a366e3fb87dd775 |
class ProductFilter(forms.Form): <NEW_LINE> <INDENT> FILTER_CHOICES = Filters().get_product_filters() <NEW_LINE> product_filter = forms.ChoiceField(choices=FILTER_CHOICES,required=True) <NEW_LINE> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(ProductFilter, self).__init__(*args, **kwargs) <NEW_LINE> se... | A class that extends Django's default Form class.
This class is used for creating a form used as a product filter.
Attributes
----------
FILTER_CHOICES : list
A list of 2-tuples that contain the filter choice name in the model and user representation name.
product_filter
Represents the product filter. | 62599018be8e80087fbbfdf4 |
class Enrollment(Edge): <NEW_LINE> <INDENT> pass | Represents the relationship between a student and a course in a particular semester | 625990188c3a8732951f72e5 |
class CHRFScore(Score): <NEW_LINE> <INDENT> def __init__(self, score: float, char_order: int, word_order: int, beta: int): <NEW_LINE> <INDENT> self.beta = beta <NEW_LINE> self.char_order = char_order <NEW_LINE> self.word_order = word_order <NEW_LINE> name = f'chrF{self.beta}' + '+' * self.word_order <NEW_LINE> super().... | A convenience class to represent chrF scores.
:param score: The chrF (chrF++) score.
:param char_order: The character n-gram order.
:param word_order: The word n-gram order. If equals to 2, the metric is referred to as chrF++.
:param beta: Determine the importance of recall w.r.t precision. | 62599018d164cc6175821d02 |
class CaptchaRegistrationForm(RegistrationForm): <NEW_LINE> <INDENT> @property <NEW_LINE> def form_fields(self): <NEW_LINE> <INDENT> ffields = super(CaptchaRegistrationForm, self).form_fields <NEW_LINE> if len(ffields): <NEW_LINE> <INDENT> ffields = ffields + form.Fields(CaptchaSchema) <NEW_LINE> ffields["captcha"].cus... | Registration form with captacha. | 62599018507cdc57c63a5b26 |
class BlockDeviceDeployerCreationCalculateNecessaryStateChangesTests( SynchronousTestCase ): <NEW_LINE> <INDENT> def test_no_devices_no_local_datasets(self): <NEW_LINE> <INDENT> dataset_id = unicode(uuid4()) <NEW_LINE> manifestation = Manifestation( dataset=Dataset(dataset_id=dataset_id), primary=True ) <NEW_LINE> node... | Tests for ``BlockDeviceDeployer.calculate_changes`` in the cases relating
to dataset creation. | 6259901856b00c62f0fb3643 |
class ListOfOwnedFunctionalComponent(OwnedFunctionalComponent): <NEW_LINE> <INDENT> __swig_setmethods__ = {} <NEW_LINE> for _s in [OwnedFunctionalComponent]: <NEW_LINE> <INDENT> __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {})) <NEW_LINE> <DEDENT> __setattr__ = lambda self, name, value: _swig_setattr(s... | Provides interface for an SBOL container Property that is allowed to have more
than one object or value.
templateparam
-------------
* `PropertyType` :
The type of SBOL Property, eg, Text, Int, OwnedObject, etc | 62599018925a0f43d25e8dc6 |
class PythonzEmailOneliner(PythonzEmailMessage): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def create(cls, subject, text): <NEW_LINE> <INDENT> cls(cls.get_full_subject(subject), text).schedule(cls.recipients('smtp', cls.get_admins_emails())) | Простое "однострочное" сообщение. | 6259901821a7993f00c66d01 |
class Solution2: <NEW_LINE> <INDENT> def addBinary(self, a, b): <NEW_LINE> <INDENT> result = [] <NEW_LINE> i = len(a)-1 <NEW_LINE> j = len(b)-1 <NEW_LINE> add_one = 0 <NEW_LINE> temp_result = 0 <NEW_LINE> while i>=0 or j>=0: <NEW_LINE> <INDENT> temp_result = add_one <NEW_LINE> if i>=0: <NEW_LINE> <INDENT> temp_result +... | Slowest! | 625990186fece00bbaccc73c |
class Policies(object): <NEW_LINE> <INDENT> __table_args__ = {'mysql_engine':'InnoDB', 'mysql_charset':'utf8'} | A SQLAlchemy mix-in for base policies. | 62599018a8ecb03325871fa5 |
class TimeSeriesEEGFramework(time_series_data.TimeSeriesEEGData, TimeSeriesFramework): <NEW_LINE> <INDENT> def get_space_labels(self): <NEW_LINE> <INDENT> if self.sensors is not None: <NEW_LINE> <INDENT> return list(self.sensors.labels) <NEW_LINE> <DEDENT> return [] | This class exists to add framework methods to TimeSeriesEEGData. | 625990189b70327d1c57fb08 |
class Aes(_Cipher): <NEW_LINE> <INDENT> block_size = 16 <NEW_LINE> key_size = None <NEW_LINE> _key_sizes = [16, 24, 32] <NEW_LINE> _native_type = "Aes *" <NEW_LINE> def _set_key(self, direction): <NEW_LINE> <INDENT> if direction == _ENCRYPTION: <NEW_LINE> <INDENT> return _lib.wc_AesSetKey( self._enc, self._key, len(sel... | The **Advanced Encryption Standard** (AES), a.k.a. Rijndael, is
a symmetric-key cipher standardized by **NIST**. | 62599018462c4b4f79dbc792 |
@add_metaclass(ABCMeta) <NEW_LINE> class AbstractBinaryUsesSimulationRun(AbstractStartsSynchronized): <NEW_LINE> <INDENT> pass | Indicates that the binary run time can be updated
| 62599018462c4b4f79dbc794 |
class ItemList(generics.ListCreateAPIView): <NEW_LINE> <INDENT> queryset = Item.objects.all() <NEW_LINE> serializer_class = ItemSerializer <NEW_LINE> def perform_create(self, serializer): <NEW_LINE> <INDENT> serializer.save(last_modified_by=self.request.user) | List all the Items or create a new item. | 625990189b70327d1c57fb0c |
class ClientSchema(current_app.marshmallow.ModelSchema): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = models.Client | Client model schema | 62599018507cdc57c63a5b2e |
class SubtaskStatus(object): <NEW_LINE> <INDENT> def __init__(self, task_id, attempted=None, succeeded=0, failed=0, skipped=0, retried_nomax=0, retried_withmax=0, state=None): <NEW_LINE> <INDENT> self.task_id = task_id <NEW_LINE> if attempted is not None: <NEW_LINE> <INDENT> self.attempted = attempted <NEW_LINE> <DEDEN... | Create and return a dict for tracking the status of a subtask.
SubtaskStatus values are:
'task_id' : id of subtask. This is used to pass task information across retries.
'attempted' : number of attempts -- should equal succeeded plus failed
'succeeded' : number that succeeded in processing
'skipped' : number... | 62599018a8ecb03325871fac |
class FileXMLHandler(xmlhandler.ContentHandler): <NEW_LINE> <INDENT> def startDocument(self): <NEW_LINE> <INDENT> self._data = [] <NEW_LINE> self._filedata = None <NEW_LINE> self._key = None <NEW_LINE> <DEDENT> def startElement(self, name, attrs): <NEW_LINE> <INDENT> if name == "file": <NEW_LINE> <INDENT> self._filedat... | Parser for the _files.xml file.
This one's a little trickier to parse than the meta file, as we have
some mild nesting: file details are children of the file element. | 625990185166f23b2e244161 |
class ResultSet(list): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(ResultSet, self).__init__() <NEW_LINE> <DEDENT> @property <NEW_LINE> def uniqueIdentifiers(self): <NEW_LINE> <INDENT> ids = [] <NEW_LINE> for item in self: <NEW_LINE> <INDENT> if hasattr(item, 'uniqueIdentifier'): <NEW_LINE> <INDEN... | A list of like object that holds results. | 625990188c3a8732951f72f1 |
class TechnicalProtection(TechnicalProtectionBaseType_): <NEW_LINE> <INDENT> c_tag = 'TechnicalProtection' <NEW_LINE> c_namespace = NAMESPACE <NEW_LINE> c_children = TechnicalProtectionBaseType_.c_children.copy() <NEW_LINE> c_attributes = TechnicalProtectionBaseType_.c_attributes.copy() <NEW_LINE> c_child_order = Techn... | The urn:oasis:names:tc:SAML:2.0:ac:TechnicalProtection element | 6259901821a7993f00c66d0b |
class TestRemoveNone(TestCase): <NEW_LINE> <INDENT> def test_removes_all_None_values(self): <NEW_LINE> <INDENT> data = {"None": None, "another_None": None, "keep": "value"} <NEW_LINE> self.assertEquals({"keep": "value"}, utils.remove_None(data)) | Test `remove_None`. | 625990189b70327d1c57fb10 |
class UpdateError(JustOneError): <NEW_LINE> <INDENT> pass | Exception for JustOne._update_* | 62599018a8ecb03325871fae |
class LearningModeCode(Code): <NEW_LINE> <INDENT> code= models.CharField(primary_key=True, max_length=2, verbose_name=u"代码") <NEW_LINE> name = models.CharField(unique=True, max_length=12, verbose_name=u"名称") <NEW_LINE> def __unicode__(self): <NEW_LINE> <INDENT> return self.name <NEW_LINE> <DEDENT> class Meta: <NEW_LINE... | 学习形式码 | 625990186fece00bbaccc746 |
class PlotterAutoClassDocumenter(AutoSummClassDocumenter): <NEW_LINE> <INDENT> priority = AutoSummClassDocumenter.priority + 0.1 <NEW_LINE> def filter_members(self, *args, **kwargs): <NEW_LINE> <INDENT> ret = super(AutoSummClassDocumenter, self).filter_members( *args, **kwargs) <NEW_LINE> if issubclass(self.object, Plo... | A ClassDocumenter that includes all the formatoption of a plotter | 625990185e10d32532ce3fcf |
class failRequest_args: <NEW_LINE> <INDENT> thrift_spec = ( None, (1, TType.STRING, 'id', None, None, ), ) <NEW_LINE> def __init__(self, id=None,): <NEW_LINE> <INDENT> self.id = id <NEW_LINE> <DEDENT> def read(self, iprot): <NEW_LINE> <INDENT> if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinsta... | Attributes:
- id | 6259901891af0d3eaad3abb3 |
class MemoryError(SerializationError, exceptions.MemoryError): <NEW_LINE> <INDENT> pass | Out of memory or unable to load type due to not enough memory | 62599018d164cc6175821d0f |
class SSRN(nn.Module): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(SSRN, self).__init__() <NEW_LINE> self.name = 'SSRN' <NEW_LINE> self.hc_blocks = nn.ModuleList([norm(mm.Conv1d(args.n_mels, args.Cs, 1, activation_fn=torch.relu))]) <NEW_LINE> self.hc_blocks.extend([norm(mm.HighwayConv1d(args.Cs, a... | SSRN
Args:
Y: (N, Ty/r, n_mels)
Returns:
Z: (N, Ty, n_mags) | 625990189b70327d1c57fb12 |
class Game(Base): <NEW_LINE> <INDENT> __tablename__ = 'game' <NEW_LINE> id = Column(Integer, primary_key = True) <NEW_LINE> name = Column(String(80), nullable = False) <NEW_LINE> description = Column(String(250), nullable = False) <NEW_LINE> price = Column(String(8)) <NEW_LINE> picture = Column(String(250)) <NEW_LINE> ... | Corresponds to the Game table | 62599018a8ecb03325871faf |
class Alien(Sprite): <NEW_LINE> <INDENT> def __init__(self, ai_settings, screen): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.screen = screen <NEW_LINE> self.ai_settings = ai_settings <NEW_LINE> self.image = pygame.image.load('images/alien.bmp') <NEW_LINE> self.rect = self.image.get_rect() <NEW_LINE> self.re... | 表示单个外星人的类 | 62599018507cdc57c63a5b34 |
class CompletionTests(unittest.TestCase): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def setUpClass(cls): <NEW_LINE> <INDENT> cls.xSmall = numpy.array([[4, 2, 3], [1, 5, 8], [7, 6, 9]]) <NEW_LINE> cls.ySmall = numpy.array([2, 6, 4]) <NEW_LINE> <DEDENT> def test_pass_small(self): <NEW_LINE> <INDENT> PLS.main.pls(self.x... | Tests checking whether the code successfully returns while running PLS2. | 625990185e10d32532ce3fd0 |
@attr.s <NEW_LINE> class HacsSystem: <NEW_LINE> <INDENT> disabled: bool = False <NEW_LINE> running: bool = False <NEW_LINE> version: str = INTEGRATION_VERSION <NEW_LINE> stage: HacsStage = attr.ib(HacsStage) <NEW_LINE> action: bool = False | HACS System info. | 62599019462c4b4f79dbc79c |
class AdminController(wsgi.Controller): <NEW_LINE> <INDENT> collection = None <NEW_LINE> valid_status = set([ 'creating', 'available', 'deleting', 'error', 'error_deleting', ]) <NEW_LINE> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(AdminController, self).__init__(*args, **kwargs) <NEW_LINE> self.reso... | Abstract base class for AdminControllers. | 62599019d18da76e235b7817 |
@SAProvider.register_lookup <NEW_LINE> class Overlap(DefaultLookup): <NEW_LINE> <INDENT> lookup_name = "overlap" | Overlap Query | 62599019a8ecb03325871fb2 |
class UserExists(GameException): <NEW_LINE> <INDENT> def msg(self): <NEW_LINE> <INDENT> return jsonify(result="userExists") | User already exists | 62599019bf627c535bcb2244 |
class Player(arcade.Sprite): <NEW_LINE> <INDENT> def __init__(self, image, scale): <NEW_LINE> <INDENT> super().__init__(image, scale) <NEW_LINE> self.speed = 0 <NEW_LINE> <DEDENT> def update(self): <NEW_LINE> <INDENT> angle_rad = math.radians(self.angle) <NEW_LINE> self.angle += self.change_angle <NEW_LINE> self.center... | Player class | 6259901956b00c62f0fb3651 |
class Error(Exception): <NEW_LINE> <INDENT> def __init__(self, msg, response=None): <NEW_LINE> <INDENT> self.response = response <NEW_LINE> self.orig_response = None <NEW_LINE> super(Error, self).__init__(msg) | Error on PowerVM API Adapter method invocation. | 6259901991af0d3eaad3abb7 |
class AutojitExtensionCompiler(compileclass.ExtensionCompiler): <NEW_LINE> <INDENT> method_validators = validators.autojit_validators <NEW_LINE> exttype_validators = validators.autojit_type_validators <NEW_LINE> def get_bases(self): <NEW_LINE> <INDENT> return (self.py_class,) <NEW_LINE> <DEDENT> def get_metacls(self): ... | Compile @autojit extension classes. | 62599019462c4b4f79dbc79e |
class AppiumCommand(object): <NEW_LINE> <INDENT> def __init__(self, phone_os): <NEW_LINE> <INDENT> self.phone_os = phone_os <NEW_LINE> <DEDENT> def send_keys(self, element, keys, driver): <NEW_LINE> <INDENT> if self.phone_os == "Android": <NEW_LINE> <INDENT> return AppiumCommandAndroid().send_keys(element, keys, driver... | API.
Re encapsulate the android & ios appium command. | 62599019925a0f43d25e8dd7 |
@attr.s(repr=False, init=False) <NEW_LINE> class MockLink(link.Link): <NEW_LINE> <INDENT> working_directory = attr.ib() <NEW_LINE> def __init__(self, **kwargs): <NEW_LINE> <INDENT> super(MockLink, self).__init__(**kwargs) <NEW_LINE> self._type = "MockLink" <NEW_LINE> self.working_directory = kwargs.get("working_directo... | A mock link is the metadata representation of a supply chain step mocked
by a functionary.
Mock links are recorded and stored to a file when a functionary
wraps a command with in_toto_mock.
Mock links also contain materials and products which are hashes of
the file before the command was executed and after the comman... | 62599019d164cc6175821d15 |
class PyccelNot(PyccelUnaryOperator): <NEW_LINE> <INDENT> __slots__ = () <NEW_LINE> _precedence = 6 <NEW_LINE> @staticmethod <NEW_LINE> def _calculate_dtype(*args): <NEW_LINE> <INDENT> dtype = NativeBool() <NEW_LINE> precision = -1 <NEW_LINE> return dtype, precision <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def _cal... | Class representing a call to the python not operator.
I.e:
not a
is equivalent to:
PyccelNot(a)
Parameters
----------
arg: PyccelAstNode
The argument passed to the operator | 625990190a366e3fb87dd78d |
class Headline(scrapy.Item): <NEW_LINE> <INDENT> title = scrapy.Field() <NEW_LINE> body = scrapy.Field() | 뉴스 헤드라인을 나타내는 Item 객체 | 625990195e10d32532ce3fd3 |
class GetXF0D: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def __call__(self, it): <NEW_LINE> <INDENT> pass | Class hierarchy: freestyle.types.UnaryFunction0D > freestyle.types.UnaryFunction0DDouble > GetXF0D | 625990195166f23b2e24416d |
class ResubmissionWorkloadFactory(StdBase): <NEW_LINE> <INDENT> def __call__(self, workloadName, arguments): <NEW_LINE> <INDENT> requestName = arguments['OriginalRequestName'] <NEW_LINE> originalRequest = GetRequest.getRequestByName(requestName) <NEW_LINE> helper = loadWorkload(originalRequest) <NEW_LINE> helper.trunca... | Build Resubmission workloads | 62599019d18da76e235b781b |
class MEventMessage(MMessage): <NEW_LINE> <INDENT> def addEventCallback(*args, **kwargs): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def getEventNames(*args, **kwargs): <NEW_LINE> <INDENT> pass | Class used to register callbacks for event related messages. | 6259901921a7993f00c66d17 |
class CommunityDestination(Destination): <NEW_LINE> <INDENT> class Implementation(Destination.Implementation): <NEW_LINE> <INDENT> def __init__(self, meta, *candidates): <NEW_LINE> <INDENT> assert isinstance(candidates, tuple), type(candidates) <NEW_LINE> assert len(candidates) >= 0, len(candidates) <NEW_LINE> assert a... | A destination policy where the message is sent to one or more community members selected from
the current candidate list.
At the time of sending at most NODE_COUNT addresses are obtained using
community.yield_random_candidates(...) to receive the message. | 62599019be8e80087fbbfe0e |
class CpuFreqTestError(Exception): <NEW_LINE> <INDENT> def __init__(self, message): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> if 'scaling_driver' in message: <NEW_LINE> <INDENT> logging.warning( '## Warning: scaling via CpuFreq non-supported ##') <NEW_LINE> sys.exit() <NEW_LINE> <DEDENT> elif 'intel_pstate/stat... | Exception handling. | 62599019a8ecb03325871fba |
class TestNthToLastElement(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.link_list = nth_to_the_last_element_singly_link_list.LinkList() <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> self.link_list = None <NEW_LINE> <DEDENT> def test_happy(self): <NEW_LINE> <INDENT> nod... | Test Cases | 62599019507cdc57c63a5b3d |
class FieldRule(CustomFieldRule): <NEW_LINE> <INDENT> def checkField(self, fieldObj): <NEW_LINE> <INDENT> return isKV(fieldObj.value) | 检查整数列表(数组)
| 625990196fece00bbaccc752 |
class GoogleWifiAPI: <NEW_LINE> <INDENT> def __init__(self, host, conditions): <NEW_LINE> <INDENT> uri = 'http://' <NEW_LINE> resource = "{}{}{}".format(uri, host, ENDPOINT) <NEW_LINE> self._request = requests.Request('GET', resource).prepare() <NEW_LINE> self.raw_data = None <NEW_LINE> self.conditions = conditions <NE... | Get the latest data and update the states. | 62599019d18da76e235b781c |
class Entity(dict): <NEW_LINE> <INDENT> __slots__ = ('ent_type', '__ent_id', '__hash', 'links') <NEW_LINE> def __init__(self, ent_type, ent_id): <NEW_LINE> <INDENT> super(Entity, self).__init__() <NEW_LINE> self.ent_type = ent_type <NEW_LINE> self.links = [] <NEW_LINE> self.__ent_id = None <NEW_LINE> self.__hash = None... | Represents a single entity.
Keys are tuples of (domain, predicate).
The links attribute is a list to (type, id) tuples, referring to the
keys of entities stored in an Entities class.
No real checking is done to verify that all linked objects exist
or anything like that. | 625990198c3a8732951f72ff |
@export <NEW_LINE> class CorreoDialog(QtWidgets.QDialog): <NEW_LINE> <INDENT> def __init__(self, args: Iterable, target: Callable): <NEW_LINE> <INDENT> super(CorreoDialog, self).__init__() <NEW_LINE> self.setWindowTitle("Enviando correo...") <NEW_LINE> self.args = args <NEW_LINE> self.layout = QtWidgets.QVBoxLayout() <... | Clase que representa el dialogo de envio de correos | 6259901991af0d3eaad3abc1 |
class FileLock(object): <NEW_LINE> <INDENT> def __init__(self, fd, mode=None): <NEW_LINE> <INDENT> if has_fcntl and mode is None: <NEW_LINE> <INDENT> mode = fcntl.LOCK_EX <NEW_LINE> <DEDENT> self.fd = fd <NEW_LINE> self.mode = mode <NEW_LINE> <DEDENT> def __enter__(self): <NEW_LINE> <INDENT> if has_fcntl: <NEW_LINE> <I... | Simple file locking
On platforms without fcntl, all operations in this class are no-ops. | 6259901921a7993f00c66d1b |
class TdmPolicy(TanhMlpPolicy): <NEW_LINE> <INDENT> def __init__( self, env, tdm_normalizer: TdmNormalizer=None, **kwargs ): <NEW_LINE> <INDENT> self.save_init_params(locals()) <NEW_LINE> self.observation_dim = env.observation_space.low.size <NEW_LINE> self.action_dim = env.action_space.low.size <NEW_LINE> self.goal_di... | Rather than giving `g`, give `g - goalify(s)` as input. | 62599019796e427e5384f520 |
class ParquetDataset(data.Dataset): <NEW_LINE> <INDENT> def __init__(self, filename, columns, dtypes=None, batch=None): <NEW_LINE> <INDENT> self._data_input = parquet_ops.parquet_input( filename, ["none", "gz"], columns=columns) <NEW_LINE> self._columns = columns <NEW_LINE> self._dtypes = dtypes <NEW_LINE> self._batch ... | A Parquet Dataset that reads the parquet file. | 625990195e10d32532ce3fd7 |
class ImageUploadInput(object): <NEW_LINE> <INDENT> empty_template = ('<input %(file)s>') <NEW_LINE> data_template = ('<div class="image-thumbnail">' ' <img %(image)s>' ' <input type="checkbox" name="%(marker)s">Delete</input>' ' <input %(text)s>' '</div>' '<input %(file)s>') <NEW_LINE> def __call__(self, field, **kwar... | Renders a image input chooser field.
You can customize `empty_template` and `data_template` members to customize
look and feel. | 62599019be8e80087fbbfe14 |
class ReplayBuffer: <NEW_LINE> <INDENT> def __init__(self, buffer_size, batch_size): <NEW_LINE> <INDENT> self.memory = deque(maxlen=buffer_size) <NEW_LINE> self.batch_size = batch_size <NEW_LINE> self.experience = namedtuple("Experience", field_names=["state", "action", "reward", "next_state", "done"]) <NEW_LINE> <DEDE... | Fixed-size buffer to store experience tuples. | 62599019925a0f43d25e8de3 |
class KerasMobileNetDoFn(beam.DoFn): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.model = None <NEW_LINE> <DEDENT> def load_resize_img(self, url): <NEW_LINE> <INDENT> response = requests.get(url) <NEW_LINE> img_bytes = BytesIO(response.content) <NEW_LINE> img = load_img(img_bytes, target_size=(224, ... | Read files from url and classify using Keras | 62599019462c4b4f79dbc7ab |
class Beta(BaseView): <NEW_LINE> <INDENT> template_name = 'beta.html' | A master view class to handle Beta reponses.
Currently accepts email addresses and sends them to the administrator. | 625990190a366e3fb87dd797 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.