code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class PhoneNumberPrefixWidget(MultiWidget): <NEW_LINE> <INDENT> def __init__(self, attrs=None, initial=None): <NEW_LINE> <INDENT> widgets = (PhonePrefixSelect(initial), TextInput(),) <NEW_LINE> super(PhoneNumberPrefixWidget, self).__init__(widgets, attrs) <NEW_LINE> <DEDENT> def decompress(self, value): <NEW_LINE> <IND... | A Widget that splits phone number input into:
- a country select box for phone prefix
- an input for local phone number | 62598f98460517430c431eeb |
class EWPTestCast(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self._key_fn = path.join(path.dirname(__file__), 'data', 'test.key') <NEW_LINE> self._cert_fn = path.join(path.dirname(__file__), 'data', 'test.crt') <NEW_LINE> <DEDENT> def test_sign(self): <NEW_LINE> <INDENT> signature = sign(self._... | Verify the cryptographic output of sign() and encrypt(). | 62598f9815baa72349461ca6 |
class GetJobDocumentsResponse: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.swaggerTypes = { 'result': 'GetJobDocumentsResult', 'status': 'str', 'error_message': 'str' } <NEW_LINE> self.result = None <NEW_LINE> self.status = None <NEW_LINE> self.error_message = None | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62598f98498bea3a75a57844 |
class TimedeltaAnonymizer: <NEW_LINE> <INDENT> anonymizer = None <NEW_LINE> def __init__(self, anonymizer): <NEW_LINE> <INDENT> self.anonymizer = anonymizer <NEW_LINE> <DEDENT> def anonymize(self, series, key=None, precision='s'): <NEW_LINE> <INDENT> ret = None <NEW_LINE> scale = None <NEW_LINE> shift = None <NEW_LINE>... | Timedelta columns anonymizer | 62598f9856b00c62f0fb25d3 |
class StatMonitor(VariableMonitor): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self._running_stats = defaultdict(StreamingStat) <NEW_LINE> <DEDENT> def register(self, variable: torch.autograd.Variable, label): <NEW_LINE> <INDENT> self._running_stats[label].add(var2np(varia... | StatMonitor
===========
Generic class to monitor some variables. Reuses the :meth:`register` method
to track the state of variables. Useful in combination with the iterative
nature of network training | 62598f98435de62698e9bb18 |
class InlineResponse2009(object): <NEW_LINE> <INDENT> swagger_types = { 'results': 'list[InlineResponse2009Results]' } <NEW_LINE> attribute_map = { 'results': 'results' } <NEW_LINE> def __init__(self, results=None): <NEW_LINE> <INDENT> self._results = None <NEW_LINE> self.discriminator = None <NEW_LINE> if results is n... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62598f98b57a9660fecd17a0 |
class Person: <NEW_LINE> <INDENT> def __init__(self, name="", age=-1): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.age = age <NEW_LINE> <DEDENT> def print_character_input(self): <NEW_LINE> <INDENT> if self.name == "": <NEW_LINE> <INDENT> raise NameError("You haven't entered a valid name!") <NEW_LINE> <DEDENT> ... | Name: Person
Description: A class to store information about a Person, to print their information to the console. | 62598f98d7e4931a7ef3bdbc |
class SSHDMixin(ModuleCase, ProcessManager, SaltReturnAssertsMixin): <NEW_LINE> <INDENT> sshd_proc = None <NEW_LINE> @classmethod <NEW_LINE> def prep_server(cls): <NEW_LINE> <INDENT> cls.sshd_config_dir = tempfile.mkdtemp(dir=RUNTIME_VARS.TMP) <NEW_LINE> cls.sshd_config = os.path.join(cls.sshd_config_dir, 'sshd_config'... | Functions to stand up an SSHD server to serve up git repos for tests. | 62598f980a50d4780f7050fc |
class RecipeSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> ingredients = serializers.PrimaryKeyRelatedField( many=True, queryset=Ingredient.objects.all() ) <NEW_LINE> tags = serializers.PrimaryKeyRelatedField( many=True, queryset=Tag.objects.all() ) <NEW_LINE> class Meta: <NEW_LINE> <INDENT> model = Recip... | Serialzier for Recipe | 62598f98627d3e7fe0e06bce |
class ContactInformation(models.Model): <NEW_LINE> <INDENT> timestamp = models.DateTimeField(auto_now_add=True) <NEW_LINE> contact_name = models.CharField(max_length=100, null=False, blank=False) <NEW_LINE> contact_email = models.EmailField(max_length=200, null=False, blank=False) <NEW_LINE> contact_comment = models.Te... | Model corresponding to Contact Us form fields | 62598f98baa26c4b54d4efd5 |
class NetworkEPG(model_base.BASEV2): <NEW_LINE> <INDENT> __tablename__ = 'cisco_ml2_apic_epgs' <NEW_LINE> network_id = sa.Column(sa.String(255), nullable=False, primary_key=True) <NEW_LINE> epg_id = sa.Column(sa.String(64), nullable=False) <NEW_LINE> segmentation_id = sa.Column(sa.String(64), nullable=False) <NEW_LINE>... | EPG's created on the apic per network. | 62598f98be383301e0253520 |
class alphabator: <NEW_LINE> <INDENT> def __init__(self, lst): <NEW_LINE> <INDENT> self.lst = lst <NEW_LINE> self.itemno = 0 <NEW_LINE> self.count = 1 <NEW_LINE> <DEDENT> def __iter__(self): <NEW_LINE> <INDENT> return self <NEW_LINE> <DEDENT> def __next__(self): <NEW_LINE> <INDENT> if self.count > self.itemno: <NEW_LIN... | Returns a list of objects, but translates integer values
between 1 and 26 into capital letters, such that 1=A,
2=B, 3=C, and so forth. All other objects in list are
returned "as is." | 62598f98fbf16365ca793ddb |
class Agent(): <NEW_LINE> <INDENT> def __init__(self, state_size, action_size, seed, learning_method='DQN'): <NEW_LINE> <INDENT> print("GPU enabled" if torch.cuda.is_available() else "GPU disabled") <NEW_LINE> self.state_size = state_size <NEW_LINE> self.action_size = action_size <NEW_LINE> self.seed = random.seed(seed... | Interacts with and learns from the environment. | 62598f980c0af96317c560a8 |
class MockComm(object): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> self.last_message = None <NEW_LINE> <DEDENT> def on_msg(self, *args, **kwargs): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def send(self, data=None, content=None): <NEW_LINE> <INDENT> self.last_message = {"data": data... | Mock class for ipython.kernel.Comm
This keeps the last message that was sent, so it can be retrieved and
analyzed during the test. | 62598f9871ff763f4b5e749d |
class LoadBalancerListResult(msrest.serialization.Model): <NEW_LINE> <INDENT> _validation = { 'next_link': {'readonly': True}, } <NEW_LINE> _attribute_map = { 'value': {'key': 'value', 'type': '[LoadBalancer]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } <NEW_LINE> def __init__( self, **kwargs ): <NEW_LINE> <IN... | Response for ListLoadBalancers API service call.
Variables are only populated by the server, and will be ignored when sending a request.
:param value: A list of load balancers in a resource group.
:type value: list[~azure.mgmt.network.v2018_04_01.models.LoadBalancer]
:ivar next_link: The URL to get the next set of re... | 62598f98eab8aa0e5d30baa8 |
class RecipeImageInline(admin.TabularInline): <NEW_LINE> <INDENT> model = RecipeImage | Tabular Inline View for RecipeImage | 62598f9816aa5153ce400221 |
class Advent11Test(unittest.TestCase): <NEW_LINE> <INDENT> def test_distance_to_origin(self): <NEW_LINE> <INDENT> known = [ (['ne', 'ne', 'ne'], 3), (['ne', 'ne', 'sw', 'sw'], 0), (['ne', 'ne', 's', 's'], 2), (['se', 'sw', 'se', 'sw', 'sw'], 3) ] <NEW_LINE> for steps, expected in known: <NEW_LINE> <INDENT> message = "I... | Tests for this module | 62598f9891af0d3eaad39b2d |
class ShowVolumeGroup(command.ShowOne): <NEW_LINE> <INDENT> def get_parser(self, prog_name): <NEW_LINE> <INDENT> parser = super().get_parser(prog_name) <NEW_LINE> parser.add_argument( 'group', metavar='<group>', help=_('Name or ID of volume group.'), ) <NEW_LINE> parser.add_argument( '--volumes', action='store_true', d... | Show detailed information for a volume group.
This command requires ``--os-volume-api-version`` 3.13 or greater. | 62598f987cff6e4e811b5744 |
class ExifTool(object): <NEW_LINE> <INDENT> sentinel = "{ready}\n" <NEW_LINE> def __init__(self, executable="/usr/local/bin/exiftool"): <NEW_LINE> <INDENT> self.executable = executable <NEW_LINE> <DEDENT> def __enter__(self): <NEW_LINE> <INDENT> self.process = subprocess.Popen( [self.executable, "-stay_open", "True", ... | keeps exiftool open for speedy mass extraction of get_metadata
from implementation on stackoverflow
https://stackoverflow.com/questions/10075115/call-exiftool-from-a-python-script
make sure that you only feed media files into this | 62598f9891f36d47f2230d31 |
class PluginSchemaMigration(SchemaMigration): <NEW_LINE> <INDENT> def __init__(self, plugin_name, resource, patterns): <NEW_LINE> <INDENT> self.plugin_name = plugin_name <NEW_LINE> self.patch_resource = resource <NEW_LINE> self.patch_patterns = patterns <NEW_LINE> SchemaMigration.__init__(self) <NEW_LINE> self._plugin ... | This is a SchemaMigration class which is suitable for use within
a plugin | 62598f9810dbd63aa1c708db |
class MMSAttachments(object): <NEW_LINE> <INDENT> def GET(self, name): <NEW_LINE> <INDENT> casedir = os.path.join(os.getcwd(), 'cases') <NEW_LINE> mmsattachcsv = os.path.join(casedir, name, 'MMS Attachments.csv') <NEW_LINE> mmsattach = mmsattachments(mmsattachcsv) <NEW_LINE> return render.mmsattachments(name, mmsattach... | Show the informations from MMS Attachments.csv file associated to each
case name.
e.g. /cases/MMSAttachments/Test | 62598f9885dfad0860cbf906 |
class PreferPublicOverTemporaryAddressesTestCase(ComplianceTestCase): <NEW_LINE> <INDENT> pass | IPv6 Default Address Selection - Prefer Public Address over Temporary
Addresses
Verify that a node prefers to use a public address rather than a temporary
address, unless the device is configured to prefer temporary addresses over
public addresses.
@private
Source: RFC 3484 Section 5, Rule 7 | 62598f988e7ae83300ee8dc2 |
class TerminationCombination(): <NEW_LINE> <INDENT> def __init__(self, terminations: list): <NEW_LINE> <INDENT> self._termintaions = terminations <NEW_LINE> <DEDENT> @property <NEW_LINE> def tqdm(self): <NEW_LINE> <INDENT> for termination in self._termintaions: <NEW_LINE> <INDENT> if hasattr(termination, "tqdm"): <NEW_... | Build a termination condition out of a combination of other conditions.
This combination condition signals termination if one inner condition signals termination. | 62598f98f7d966606f747d0b |
class Login(Resource): <NEW_LINE> <INDENT> @handle_exceptions <NEW_LINE> def post(self): <NEW_LINE> <INDENT> parser = reqparse.RequestParser() <NEW_LINE> parser.add_argument('username') <NEW_LINE> parser.add_argument('password') <NEW_LINE> args = parser.parse_args() <NEW_LINE> username = args['username'] <NEW_LINE> pas... | Handles login requests.
Resource url:
'/auth/login'
Requests Allowed:
'POST' | 62598f98bde94217f37074fc |
class TestV1beta1ReplicaSetStatus(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 testV1beta1ReplicaSetStatus(self): <NEW_LINE> <INDENT> model = lib_openshift.models.v1beta1_replica_set_status.V1be... | V1beta1ReplicaSetStatus unit test stubs | 62598f98f8510a7c17d7e00a |
class Yl_Web(): <NEW_LINE> <INDENT> u <NEW_LINE> def __init__(self,driver): <NEW_LINE> <INDENT> self.driver = eval('webdriver.%s()')%(driver) <NEW_LINE> self.driver=webdriver.Chrome() <NEW_LINE> self.driver.maximize_window() <NEW_LINE> <DEDENT> def By_id(self,id): <NEW_LINE> <INDENT> try:return self.driver.find_element... | 优啦Web测试库 | 62598f982ae34c7f260aae06 |
class TCPSource(ABC): <NEW_LINE> <INDENT> def convert_listener(self, listener: Callable[[np.ndarray], None]) -> Callable[[bytes], None]: <NEW_LINE> <INDENT> def parse_bytes(bytes): <NEW_LINE> <INDENT> self.raw_buffer += bytes <NEW_LINE> try: <NEW_LINE> <INDENT> arr:np.ndarray = loads(data=self.raw_buffer) <NEW_LINE> se... | A data source that receives pickled numpy arrays over a TCP port. | 62598f984e4d562566372148 |
class GeneratorModel: <NEW_LINE> <INDENT> def __init__(self, generator_path, watermark_enable=False, wm_width=64, wm_height=64, extractor_path=None, binary=False): <NEW_LINE> <INDENT> self.watermark_enable = watermark_enable <NEW_LINE> self.wm_width = wm_width <NEW_LINE> self.wm_height = wm_height <NEW_LINE> self.binar... | 生成模型 | 62598f98f548e778e596b2d0 |
class MetroElevatorKeys(TwitterKeys): <NEW_LINE> <INDENT> consumer_key = None <NEW_LINE> access_token = None <NEW_LINE> consumer_secret = None <NEW_LINE> access_token_secret = None | Key for @MetroElevators Twitter acccount | 62598f98a4f1c619b294e311 |
class PapersParamsValidatorMixin(BaseParamsValidatorMixin): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def _article_slug_title_validator(value, default): <NEW_LINE> <INDENT> if value: <NEW_LINE> <INDENT> return value <NEW_LINE> <DEDENT> return default | Mixin with validators for validate
request parameters. | 62598f98dd821e528d6d8c5a |
class PathSource(Source, PathLocation): <NEW_LINE> <INDENT> def to_rsync(self): <NEW_LINE> <INDENT> return self._path | Provide a local, path-based back-up source. | 62598f9807f4c71912baf171 |
@base.Hidden <NEW_LINE> @base.ReleaseTracks(base.ReleaseTrack.ALPHA) <NEW_LINE> class GetIamPolicy(base.Command): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def Args(parser): <NEW_LINE> <INDENT> flags.AddStoreResourceFlags(parser) <NEW_LINE> <DEDENT> def Run(self, args): <NEW_LINE> <INDENT> store_resource_ref = flags... | Get iam policy of a taxonomy store. | 62598f98b7558d5895463354 |
class PGDAdversary(nn.Module): <NEW_LINE> <INDENT> def __init__(self, model, x_batch, max_epsilon): <NEW_LINE> <INDENT> super(PGDAdversary, self).__init__() <NEW_LINE> self.batch_size, self.input_size = x_batch.shape <NEW_LINE> self.model = model <NEW_LINE> self.x_batch = Parameter(x_batch, requires_grad=False) <NEW_LI... | Module implementing the PGD adversarial attack on a given model. | 62598f9815baa72349461ca8 |
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 = (230,230,230) <NEW_LINE> self.ship_speed_factor = 1.5 <NEW_LINE> self.ship_limit = 3 <NEW_LINE> self.bullet_speed_factor = 3 <NEW_LINE> self.bullet_width ... | 存储《外星人入侵》的所有设置 | 62598f9826068e7796d4c688 |
class _AutomaticPowerControl(object): <NEW_LINE> <INDENT> def __init__(self, parent): <NEW_LINE> <INDENT> self._parent = parent <NEW_LINE> self._enabled = False <NEW_LINE> <DEDENT> @property <NEW_LINE> def target(self): <NEW_LINE> <INDENT> response = self._parent.query("rslp?") <NEW_LINE> return float(response)*pq.mW <... | Options and functions related to the laser diode's automatic power
control driver.
.. warning:: This class is not designed to be accessed directly. It
should be interfaced via `LM.apc` | 62598f98b7558d5895463355 |
class MasterUniqueNamesReader(Reader): <NEW_LINE> <INDENT> mappable_cols = 'customer_name' <NEW_LINE> redundant_cols = 'names' <NEW_LINE> renamable_cols = { 'names': 'customer_name' } <NEW_LINE> def __init__(self, reader): <NEW_LINE> <INDENT> super().__init__(reader) <NEW_LINE> <DEDENT> def remove_dedundancy(self): <N... | Traits contains the common interface of
readable functionalities of 'master_unique_names' collection | 62598f98d7e4931a7ef3bdbe |
class ItemDetail: <NEW_LINE> <INDENT> def __init__(self, item: GroceryItem): <NEW_LINE> <INDENT> self.item = item <NEW_LINE> defaults_list = self.item.defaults.copy() <NEW_LINE> defaults_list.sort(key=itemgetter(0)) <NEW_LINE> defaults_list = [str(num) for _, num in defaults_list] <NEW_LINE> while len(defaults_list) < ... | Second tab layout; allows editing of item details. | 62598f98baa26c4b54d4efd7 |
class ApplicationStatus: <NEW_LINE> <INDENT> thrift_spec = ( None, (1, TType.STRING, 'applicationState', None, None, ), (2, TType.I64, 'timeOfStateChange', None, None, ), ) <NEW_LINE> def __init__(self, applicationState=None, timeOfStateChange=None,): <NEW_LINE> <INDENT> self.applicationState = applicationState <NEW_LI... | Attributes:
- applicationState
- timeOfStateChange | 62598f9823849d37ff850ded |
class Locale(A10BaseClass): <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> self.ERROR_MSG = "" <NEW_LINE> self.required=[] <NEW_LINE> self.b_key = "locale" <NEW_LINE> self.a10_url="/axapi/v3/locale" <NEW_LINE> self.DeviceProxy = "" <NEW_LINE> self.test = {} <NEW_LINE> self.value = "" <NEW_LINE> f... | Class Description::
Set locale for the CLI startup.
Class locale supports CRUD Operations and inherits from `common/A10BaseClass`.
This class is the `"PARENT"` class for this module.`
:param value: {"description": "'en_US.UTF-8': English locale for the USA, encoding with UTF-8 (default); 'zh_CN.UTF-8': Chinese locale... | 62598f9860cbc95b06364070 |
@dataclass(frozen=True) <NEW_LINE> class _FaceIDs: <NEW_LINE> <INDENT> groups: np.ndarray <NEW_LINE> elements: np.ndarray <NEW_LINE> faces: np.ndarray | Data structure for storage of a list of face identifiers (group, element, face).
Each attribute is a :class:`numpy.ndarray` of shape ``(nfaces,)``.
.. attribute:: groups
The index of the group containing the face.
.. attribute:: elements
The group-relative index of the element containing the face.
.. attri... | 62598f9821a7993f00c65ca7 |
class enum_choices(list): <NEW_LINE> <INDENT> def __init__(self, **data): <NEW_LINE> <INDENT> for item in sorted(data.items(), key=itemgetter(1)): <NEW_LINE> <INDENT> self.append(item[1]) <NEW_LINE> setattr(self, item[0].upper(), item[1][0]) | A helper to create constants from choices tuples.
Usage:
SOME_CHOICES = enum_choices(
FIRST: (1, 'Choice 1'),
SECOND: (2, 'Choice 2'),
THIRD: (3, 'Choice 3'),
)
It will then return a list with the passed tuples so you can use in the
Django's fields choices option and, additionally, the returned object wil... | 62598f9885dfad0860cbf907 |
class StudentCreateView(CreateView): <NEW_LINE> <INDENT> model = Student <NEW_LINE> success_url = reverse_lazy('students:list_view') <NEW_LINE> def get_context_data(self, **kwargs): <NEW_LINE> <INDENT> context = super(StudentCreateView, self).get_context_data(**kwargs) <NEW_LINE> context['page_title'] = u"Student regis... | docstring for StudentCreateView | 62598f98090684286d59356c |
class tdAutostartOsDarwin(tdAutostartOs): <NEW_LINE> <INDENT> def __init__(self, sTestBuildDir): <NEW_LINE> <INDENT> _ = sTestBuildDir; <NEW_LINE> tdAutostartOs.__init__(self); <NEW_LINE> <DEDENT> def installVirtualBox(self, oSession, oTxsSession): <NEW_LINE> <INDENT> _ = oSession; <NEW_LINE> _ = oTxsSession; <NEW_LINE... | Autostart support methods for Darwin guests. | 62598f98a219f33f346c6541 |
class Action(gtk.Action, _ActionBase): <NEW_LINE> <INDENT> def __init__(self, keypresses=(), name=None, label=None, tooltip=None, stock_id=None): <NEW_LINE> <INDENT> if name is None: name = label <NEW_LINE> gtk.Action.__init__(self, name=name, label=label, tooltip=tooltip, stock_id=stock_id, ) <NEW_LINE> _ActionBase.__... | A custom Action class based on gtk.Action.
Pass additional arguments such as keypresses. | 62598f98009cb60464d0124c |
class Operating_system_form(forms.Form): <NEW_LINE> <INDENT> os_name = forms.CharField(widget=forms.TextInput(attrs={"class": "form-control"}), label="Name", max_length=15) <NEW_LINE> os_location = forms.CharField(widget=forms.TextInput(attrs={"class": "form-control"}), label="Location", max_length=100) | Operating system form of os_name and os_location | 62598f9876e4537e8c3ef2db |
class SchedulerCoinerTestCase(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> print("setUp") <NEW_LINE> korbit_machine = KorbitMachine() <NEW_LINE> self.coiner = Coiner(korbit_machine) <NEW_LINE> <DEDENT> def test_get_ticker(self): <NEW_LINE> <INDENT> print(inspect.stack()[0][3]) <NEW_LINE>... | Coiner test module | 62598f98379a373c97d98d3a |
class UpdateBatchStateCallback(_impl.UpdateBatchStateCallbackImpl, tf.keras.callbacks.Callback): <NEW_LINE> <INDENT> def __init__(self, state): <NEW_LINE> <INDENT> super(UpdateBatchStateCallback, self).__init__(tf.keras.backend, state) | Keras Callback that will update the value of `state.batch` with the current batch number at
the end of each batch. Batch will reset to 0 at the end of each epoch.
If `steps_per_epoch` is set, then this callback will also ensure that the number of steps
in the first epoch following a reset is shortened by the number of... | 62598f98656771135c4893a8 |
class NoteGlobalFoldingCommand(NoteSmartFoldingCommand): <NEW_LINE> <INDENT> def run(self, edit): <NEW_LINE> <INDENT> if self.is_global_folded(): <NEW_LINE> <INDENT> self.unfold_all() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.fold_all() <NEW_LINE> <DEDENT> <DEDENT> def is_global_folded(self): <NEW_LINE> <INDEN... | Global folding / unfolding headlines at any point.
Unfold only when top-level headlines are totally folded.
Otherwise fold. | 62598f98a17c0f6771d5bf62 |
class HeUniform(Initializer): <NEW_LINE> <INDENT> def call(self, size): <NEW_LINE> <INDENT> fan_in, fan_out = decompose_size(size) <NEW_LINE> return Uniform(np.sqrt(6. / fan_in))(size) | He uniform variance scaling initializer.
It draws samples from a uniform distribution within [-limit, limit]
where `limit` is `sqrt(6 / fan_in)` [1]_
where `fan_in` is the number of input units in the weight matrix.
References
----------
.. [1] He et al., http://arxiv.org/abs/1502.01852 | 62598f98435de62698e9bb1b |
class SerializerABC(object): <NEW_LINE> <INDENT> __metaclass__ = SerializerMeta | The serializer abstract base class. | 62598f9824f1403a92685745 |
@unique <NEW_LINE> class State(Enum): <NEW_LINE> <INDENT> READY = "READY" <NEW_LINE> BUSY = "BUSY" <NEW_LINE> ERROR = "ERROR" | Enumeration of available states.
:ivar BUSY: Currently in busy state
:vartype BUSY: str
:ivar ERROR: Currently in error state
:vartype ERROR: str
:ivar READY: Currently in ready state
:vartype READY: str | 62598f98bde94217f37074fd |
class Task(Meteor): <NEW_LINE> <INDENT> name = 'import.noaa.hourly.metar' <NEW_LINE> @staticmethod <NEW_LINE> def get_condicode(weather: list) -> Union[int, None]: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> code = weather[0][3] <NEW_LINE> condicodes = { 'RA': 8, 'SHRA': 17, 'DZ': 7, 'DZRA': 7, 'FZRA': 10, 'FZDZ': 10,... | Import (global) METAR data | 62598f98851cf427c66b7fee |
class GroceryItemForm(FlaskForm): <NEW_LINE> <INDENT> name = StringField('Name', validators=[DataRequired(), Length(min=3, max=80)]) <NEW_LINE> price = FloatField('Price', validators=[DataRequired()]) <NEW_LINE> category = SelectField('Category', choices=ItemCategory.choices()) <NEW_LINE> photo_url = StringField('Photo... | Form for adding/updating a GroceryItem | 62598f983eb6a72ae038a365 |
class Category(models.Model): <NEW_LINE> <INDENT> category_name = models.CharField(max_length = 191) <NEW_LINE> def __str__(self): <NEW_LINE> <INDENT> return f'{self.category_name}' | Model definition for Category. | 62598f98baa26c4b54d4efd8 |
class CacheLoadProgress(Event): <NEW_LINE> <INDENT> def __init__(self, current): <NEW_LINE> <INDENT> Event.__init__(self) <NEW_LINE> self.current = current | Cache loading progress | 62598f9838b623060ffa8db5 |
class ViewExecutor(concurrent.futures.Executor): <NEW_LINE> <INDENT> def __init__(self, view): <NEW_LINE> <INDENT> self.view = view <NEW_LINE> self._max_workers = len(self.view) <NEW_LINE> <DEDENT> def submit(self, fn, *args, **kwargs): <NEW_LINE> <INDENT> return self.view.apply_async(fn, *args, **kwargs) <NEW_LINE> <D... | A PEP-3148 Executor API for Views
Access as view.executor | 62598f98e64d504609df924b |
class character: <NEW_LINE> <INDENT> def __init__(self, up, down, left, right, niveau): <NEW_LINE> <INDENT> self.up = pygame.image.load(up).convert_alpha() <NEW_LINE> self.down = pygame.image.load(down).convert_alpha() <NEW_LINE> self.left = pygame.image.load(left).convert_alpha() <NEW_LINE> self.right = pygame.image.l... | Class to create a character | 62598f9807f4c71912baf173 |
class CaptionTreeItem(TreeItem): <NEW_LINE> <INDENT> def __init__(self, data, parent=None): <NEW_LINE> <INDENT> super(CaptionTreeItem, self).__init__(data, parent) <NEW_LINE> <DEDENT> def data(self, column): <NEW_LINE> <INDENT> return self.itemData if column == 0 else None | Caption row in a treeview | 62598f98004d5f362081ee90 |
class CustomDomain(msrest.serialization.Model): <NEW_LINE> <INDENT> _validation = { 'name': {'required': True}, } <NEW_LINE> _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'use_sub_domain_name': {'key': 'useSubDomainName', 'type': 'bool'}, } <NEW_LINE> def __init__( self, *, name: str, use_sub_domain_name: ... | The custom domain assigned to this storage account. This can be set via Update.
All required parameters must be populated in order to send to Azure.
:ivar name: Required. The custom domain name. Name is the CNAME source.
:vartype name: str
:ivar use_sub_domain_name: Indicates whether indirect CName validation is enab... | 62598f98d6c5a102081e1e6c |
class GameData: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.is_in_battle = True <NEW_LINE> self.battle_data = None <NEW_LINE> self.player = None | The game data is the main object that is handled by the game.
It contains all game state and information on top level objects. | 62598f98d7e4931a7ef3bdc0 |
class ComputedVerticals(object): <NEW_LINE> <INDENT> def __init__(self, lines): <NEW_LINE> <INDENT> self.lines = np.array(lines) <NEW_LINE> <DEDENT> @property <NEW_LINE> def data(self): <NEW_LINE> <INDENT> return [self.lines] | Computed vertical lines holder.
The result of `ColumnBasedVerticals.compute()`. Holds a NumPy array with the
vertical lines. | 62598f98627d3e7fe0e06bd2 |
class EventExportByCourseAcceptanceTest(AcceptanceTestCase): <NEW_LINE> <INDENT> INPUT_FILE = 'event_export_tracking.log' <NEW_LINE> NUM_REDUCERS = 1 <NEW_LINE> def test_events_export_by_course(self): <NEW_LINE> <INDENT> self.upload_tracking_log(self.INPUT_FILE, datetime.date(2014, 5, 15)) <NEW_LINE> self.task.launch([... | Validate data flow for bulk export of events by course | 62598f988e7ae83300ee8dc5 |
class InteractionOperand( _user_module.InteractionOperandMixin, Namespace, InteractionFragment ): <NEW_LINE> <INDENT> fragment = EReference( ordered=True, unique=True, containment=True, derived=False, upper=-1 ) <NEW_LINE> guard = EReference(ordered=False, unique=True, containment=True, derived=False) <NEW_LINE> def __... | An InteractionOperand is contained in a CombinedFragment. An
InteractionOperand represents one operand of the expression given by
the enclosing CombinedFragment.
<p>From package UML::Interactions.</p> | 62598f980c0af96317c560ab |
class InternationalMelonOrder(AbstractMelonOrder): <NEW_LINE> <INDENT> def __init__(self, species, qty, country_code): <NEW_LINE> <INDENT> super(InternationalMelonOrder, self).__init__(species, qty) <NEW_LINE> self.country_code = country_code <NEW_LINE> self.order_type = "international" <NEW_LINE> self.tax = 0.17 <NEW_... | An international (non-US) melon order. | 62598f987cff6e4e811b5748 |
class StatsTests(unittest.TestCase): <NEW_LINE> <INDENT> @sweepargs(null=nulldist_sweep[1:]) <NEW_LINE> def test_null_dist_prob(self, null): <NEW_LINE> <INDENT> if not isinstance(null, NullDist): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> ds = datasets['uni2small'] <NEW_LINE> null.fit(OneWayAnova(), ds) <NEW_LINE> ... | Unittests for various statistics | 62598f9845492302aabfc201 |
class EditCCI(CLIRunnable): <NEW_LINE> <INDENT> action = 'edit' <NEW_LINE> def execute(self, args): <NEW_LINE> <INDENT> data = {} <NEW_LINE> if args['--userdata'] and args['--userfile']: <NEW_LINE> <INDENT> raise ArgumentError('[-u | --userdata] not allowed with ' '[-F | --userfile]') <NEW_LINE> <DEDENT> if args['--use... | usage: sl cci edit <identifier> [options]
Edit CCI details
Options:
-D --domain=DOMAIN Domain portion of the FQDN example: example.com
-F --userfile=FILE Read userdata from file
-H --hostname=HOST Host portion of the FQDN. example: server
-u --userdata=DATA User defined metadata string | 62598f98009cb60464d0124e |
class PresupuestoServicioForm(ModelForm): <NEW_LINE> <INDENT> lista_servicio = ModelChoiceField(Servicio.objects.exclude(servicio_material__material__contenedor=True).distinct(), widget=SelectMultiple, empty_label=None, label='Servicios') <NEW_LINE> class Meta: <NEW_LINE> <INDENT> model = Presupuesto_servicio <NEW_LINE... | Docstring | 62598f984527f215b58e9c0d |
class ProcEntropyAvail(MeasurePoint): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(ProcEntropyAvail, self).__init__() <NEW_LINE> self.measurement = CAP_ENTROPY | /proc/sys/kernel/random/entropy_avail time series measurement | 62598f987d847024c075c0fb |
class UserMove(Move): <NEW_LINE> <INDENT> original = models.BooleanField(default=False) <NEW_LINE> def __unicode__(self): <NEW_LINE> <INDENT> return "{}".format(self.name) | User submitted Move. Original Moves will show up on the Cardists
profile. | 62598f98442bda511e95c18e |
class InputEvaluationError(Exception): <NEW_LINE> <INDENT> pass | An error raised when the provided input cannot be evaluated (e.g. when
it's missing an attribute that has been required) | 62598f987047854f4633f10a |
class TemplatedCatalog(kvs.Catalog): <NEW_LINE> <INDENT> def __init__(self, templates=None): <NEW_LINE> <INDENT> if templates: <NEW_LINE> <INDENT> self.templates = templates <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self._load_templates(CONF.catalog.template_file) <NEW_LINE> <DEDENT> super(TemplatedCatalog, self)._... | A backend that generates endpoints for the Catalog based on templates.
It is usually configured via config entries that look like:
catalog.$REGION.$SERVICE.$key = $value
and is stored in a similar looking hierarchy. Where a value can contain
values to be interpolated by standard python string interpolation that lo... | 62598f986e29344779b00383 |
class TextValidationError(DataValidationError): <NEW_LINE> <INDENT> pass | Response text does not match supplied value. | 62598f9882261d6c5272fd6c |
class EnrichmentReader(OntoReader): <NEW_LINE> <INDENT> def __init__(self, file_handle, read_attrs = True): <NEW_LINE> <INDENT> self._handle = file_handle <NEW_LINE> self._read_attrs = read_attrs <NEW_LINE> <DEDENT> def read(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> creader = csv.reader(self._handle, delimite... | Class for reading an enrichment from a file. | 62598f98bde94217f37074fe |
class OutputChannel(OutputChannel): <NEW_LINE> <INDENT> default_output_color = bcolors.OKBLUE <NEW_LINE> def __init__(self, data): <NEW_LINE> <INDENT> self.data = data <NEW_LINE> self.reply = self.setOutputInstance(data) <NEW_LINE> <DEDENT> def send_text_message(self, recipient_id, message): <NEW_LINE> <INDENT> try: <N... | Simple bot that outputs the bots messages back to skype/slack etc. | 62598f98ac7a0e7691f72235 |
class TriMesh(PointCloud): <NEW_LINE> <INDENT> def __init__(self, points, trilist=None, copy=True): <NEW_LINE> <INDENT> super(TriMesh, self).__init__(points, copy=copy) <NEW_LINE> if trilist is None: <NEW_LINE> <INDENT> trilist = Delaunay(points).simplices <NEW_LINE> <DEDENT> if not copy: <NEW_LINE> <INDENT> trilist_ha... | A pointcloud with a connectivity defined by a triangle list. These are
designed to be explicitly 2D or 3D.
Parameters
----------
points : (N, D) ndarray
The set coordinates for the mesh.
trilist : (M, 3) ndarray, optional
The triangle list. If `None`, a Delaunay triangulation of
the points will be used ins... | 62598f983cc13d1c6d465496 |
class UndeclaredError(Exception): <NEW_LINE> <INDENT> pass | Exception raised when using an undeclared symbol. | 62598f98cb5e8a47e493c009 |
class BalancerView(BaseLoggedInPage): <NEW_LINE> <INDENT> toolbar = View.nested(BalancerToolBar) <NEW_LINE> sidebar = View.nested(BalancerSideBar) <NEW_LINE> including_entities = View.include(NetworkProviderEntities, use_parent=True) <NEW_LINE> @property <NEW_LINE> def is_displayed(self): <NEW_LINE> <INDENT> return (su... | Represents whole All NetworkProviders page | 62598f98d58c6744b42dc165 |
class CirrusConfigurationHarness(object): <NEW_LINE> <INDENT> def __init__(self, module_symbol, config_file, gitconf_content=None, **settings): <NEW_LINE> <INDENT> self.module_symbol = module_symbol <NEW_LINE> self.config_file = config_file <NEW_LINE> self.gitconf_str = gitconf_content <NEW_LINE> if self.gitconf_str is... | CirrusConfigurationHarness
Test harness that generates a mock for load_configuration in the
module that is being mocked.
TODO: better location for this, plus maybe combine with
generating the cirrus config file | 62598f98e64d504609df924c |
class TimedPersist(Persist): <NEW_LINE> <INDENT> def __init__(self, filename, default={}, ddir=None, *args, **kwargs): <NEW_LINE> <INDENT> ddir = ddir or getdatadir() <NEW_LINE> timed = time.time() <NEW_LINE> timedstr = time.ctime(timed) <NEW_LINE> Persist.__init__(self, ddir + os.sep + "%s-%s" % (timedstr, stripname(f... | persist that incorporates the create time in the filename. | 62598f98498bea3a75a57849 |
class AnimalLocationApi(object): <NEW_LINE> <INDENT> def __init__(self, api_client=None): <NEW_LINE> <INDENT> if api_client is None: <NEW_LINE> <INDENT> api_client = ApiClient() <NEW_LINE> <DEDENT> self.api_client = api_client <NEW_LINE> <DEDENT> def location_id_animals_get(self, id, **kwargs): <NEW_LINE> <INDENT> kwar... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen | 62598f980a50d4780f705101 |
class BaseModel(db.Model, ModelMixin): <NEW_LINE> <INDENT> __abstract__ = True <NEW_LINE> id = db.Column( UUID(as_uuid=True), primary_key=True, nullable=False, default=uuid.uuid4 ) <NEW_LINE> created_at = db.Column(db.DateTime, default=datetime.utcnow) <NEW_LINE> updated_at = db.Column(db.DateTime, onupdate=datetime.ut... | Base model for all database models.
attributes:
id (string, reserved):
a unique identifier for each instance. Autogenerated. | 62598f9899cbb53fe6830bfb |
class BadTakedownError(TakedownError): <NEW_LINE> <INDENT> pass | A takedown object is not structured correctly, or data is missing. | 62598f980a50d4780f705102 |
class MaliciousASN(Vulnerability): <NEW_LINE> <INDENT> DEFAULTS = Vulnerability.DEFAULTS.copy() <NEW_LINE> DEFAULTS["cvss_base"] = "6.8" <NEW_LINE> def __init__(self, asn, **kwargs): <NEW_LINE> <INDENT> self.__asn_id = asn.identity <NEW_LINE> super(MaliciousASN, self).__init__(**kwargs) <NEW_LINE> self.add_information(... | Malicious ASN Detected.
An Autonomous System Number (ASN) was found that could contain a malicious
site or malware. This may be the result of a security intrusion, or a
successful BGP reconfiguration attack by a nefarious entity.
You should review your website and ensure that your site was not
compromised by a securi... | 62598f98d7e4931a7ef3bdc2 |
class IDateWidget(IWidget): <NEW_LINE> <INDENT> pass | Date widget. | 62598f988e7ae83300ee8dc7 |
class PostManager(models.Manager): <NEW_LINE> <INDENT> def get_queryset(self): <NEW_LINE> <INDENT> return PostQuerySet(self.model, using=self._db) <NEW_LINE> <DEDENT> def all(self): <NEW_LINE> <INDENT> return self.get_queryset().active() <NEW_LINE> <DEDENT> def featured(self): <NEW_LINE> <INDENT> return self.get_querys... | Manager class to return only those products where each instance is featured oe active | 62598f9830dc7b766599f577 |
class TestBroadcast(unittest.TestCase): <NEW_LINE> <INDENT> def test_broadcast(self): <NEW_LINE> <INDENT> t1 = tf.constant([[1, 2, 3]]) <NEW_LINE> t2 = tf.constant([[4], [5], [6]]) <NEW_LINE> t = t1 * t2 <NEW_LINE> assert_equal([[1 * 4, 2 * 4, 3 * 4], [1 * 5, 2 * 5, 3 * 5], [1 * 6, 2 * 6, 3 * 6]], t) <NEW_LINE> t1 = tf... | broadcast过程: 以t1 op t2为例说明, 其中op是element-wise的
1. 对齐rank: 将rank较小的tensor 左侧扩充大小为1的维度
举例:
t1 = tf.constant([[1, 2], [3,4]]) #(2, 2)
t2 = tf.constant([5, 6]) #(2,) ==> [[5,6]] #(1, 2)
2. 判断是否compatible: 对应维度大小相同,或为1
t1.shape[i]==t2.shape[i] or t1.shape[i]=1 or t2.shape[i]=1
举例: (2, 2) 与 ... | 62598f982c8b7c6e89bd34f9 |
class ToPreviousForm( list_action.ToPreviousRow ): <NEW_LINE> <INDENT> def gui_run( self, gui_context ): <NEW_LINE> <INDENT> gui_context.widget_mapper.submit() <NEW_LINE> gui_context.widget_mapper.toPrevious() <NEW_LINE> <DEDENT> def get_state( self, model_context ): <NEW_LINE> <INDENT> return Action.get_state( self, m... | Move to the previous form | 62598f98d53ae8145f9181b7 |
class C(Note): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.name = "Mi" <NEW_LINE> self.sound_path = r"./note/Sound_C.wav" | Note Mi | 62598f9823849d37ff850df1 |
class Solution(object): <NEW_LINE> <INDENT> pass <NEW_LINE> def maxSubArray(self, nums: list) -> int: <NEW_LINE> <INDENT> nums_len = len(nums) <NEW_LINE> if nums_len == 1: <NEW_LINE> <INDENT> return nums[0] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> max_value = nums[0] <NEW_LINE> tmp = 0 <NEW_LINE> i = 0 <NEW_LINE> ... | docstring | 62598f9821a7993f00c65cab |
class ModeratorPage(base.BaseHandler): <NEW_LINE> <INDENT> PAGE_NAME_FOR_CSRF = 'moderator_page' <NEW_LINE> @base.require_moderator <NEW_LINE> def get(self): <NEW_LINE> <INDENT> self.render_template('moderator/moderator.html') | The moderator page. | 62598f9810dbd63aa1c708e1 |
class TbxUZVR(Tbx): <NEW_LINE> <INDENT> @property <NEW_LINE> def label(self): <NEW_LINE> <INDENT> return u'UZVR bestimmen' <NEW_LINE> <DEDENT> @property <NEW_LINE> def Tool(self): <NEW_LINE> <INDENT> return UZVR <NEW_LINE> <DEDENT> def _getParameterInfo(self): <NEW_LINE> <INDENT> par = self.par <NEW_LINE> par.name = ar... | Toolbox UZVR | 62598f98090684286d59356e |
class WinServicesParser(parsers.RegistryValueParser): <NEW_LINE> <INDENT> output_types = ["WindowsServiceInformation"] <NEW_LINE> supported_artifacts = ["WindowsServices"] <NEW_LINE> process_together = True <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> self.service_re = re.compile( r".*HKEY_LOCAL_MACHINE/SYSTEM/[^... | Parser for Windows services values from the registry.
See service key doco:
http://support.microsoft.com/kb/103000 | 62598f984e4d56256637214d |
class ViewPanel(Border): <NEW_LINE> <INDENT> def __init__(self, app): <NEW_LINE> <INDENT> self.app = app <NEW_LINE> text_widgets = {} <NEW_LINE> for label, category, grouping in VIEWS: <NEW_LINE> <INDENT> view = (category, grouping) <NEW_LINE> text_widgets[view] = urwid.Text(('normal', label)) <NEW_LINE> <DEDENT> self.... | Top panel with selectable 'views' on Task data.
The ViewPanel has a reference to the TaskPanel so that when the view is
changed, that event can be passed on to the TaskPanel to react to it. | 62598f987d847024c075c0fd |
class DqnController: <NEW_LINE> <INDENT> def __init__(self, env): <NEW_LINE> <INDENT> self.env = env <NEW_LINE> self.model = DQN(MlpPolicy, env, verbose=1, tensorboard_log="./dqn_thermostat_tensorboard/") <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def name(): <NEW_LINE> <INDENT> return "Dqn" <NEW_LINE> <DEDENT> def t... | Implements an RL (DQN) controller | 62598f98442bda511e95c190 |
class Pale(Ordinary,TrueOrdinary): <NEW_LINE> <INDENT> def process(self): <NEW_LINE> <INDENT> p=partLine() <NEW_LINE> p.lineType=self.lineType <NEW_LINE> p.rect(-10,-2*Ordinary.HEIGHT,20,Ordinary.HEIGHT*3) <NEW_LINE> self.clipPath=SVGdraw.path(p) <NEW_LINE> self.clipPathElt.addElement(self.clipPath) <NEW_LINE> <DEDENT>... | Pale ordinary: vertical stripe | 62598f98656771135c4893ac |
class DescribeAclsRequest(JDCloudRequest): <NEW_LINE> <INDENT> def __init__(self, parameters, header=None, version="v1"): <NEW_LINE> <INDENT> super(DescribeAclsRequest, self).__init__( '/regions/{regionId}/instances/{instanceId}/acl', 'GET', header, version) <NEW_LINE> self.parameters = parameters | 查询防护包实例的访问控制列表 | 62598f982ae34c7f260aae0b |
class msg_received(Event): <NEW_LINE> <INDENT> pass | Message Received Event | 62598f9882261d6c5272fd6d |
class Logs(SimpleMDMpy.SimpleMDM.Connection): <NEW_LINE> <INDENT> def __init__(self, api_key): <NEW_LINE> <INDENT> SimpleMDMpy.SimpleMDM.Connection.__init__(self, api_key) <NEW_LINE> self.url = self._url("/logs") <NEW_LINE> <DEDENT> def get_logs(self): <NEW_LINE> <INDENT> url = self.url <NEW_LINE> data = {} <NEW_LINE> ... | GET all the LOGS | 62598f98851cf427c66b7ff2 |
class ChatLogMessage(MessageBase): <NEW_LINE> <INDENT> msg_type = 0 | Chatlog message. | 62598f986aa9bd52df0d4bf8 |
class GeneralSettingsView(LoginRequiredMixin, generic.FormView): <NEW_LINE> <INDENT> form_class = forms.SettingsForm <NEW_LINE> success_url = reverse_lazy("user-settings") <NEW_LINE> template_name = "account/index.html" <NEW_LINE> def get_form_kwargs(self, **kwargs): <NEW_LINE> <INDENT> kwargs = super(GeneralSettingsVi... | General settings view | 62598f984e4d56256637214e |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.