code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
class Song(Media): <NEW_LINE> <INDENT> def __init__(self, title="No Title", author="No Author", release_year="No Release Year", url="No URL", album="No Album", genre="No Genre", track_length=0, json=None): <NEW_LINE> <INDENT> super().__init__(title, author, release_year, url, json) <NEW_LINE> if (json is None): <NEW_LI...
ADD DOCSTRING
625990326fece00bbaccca88
@dataclass <NEW_LINE> class RouteInfo: <NEW_LINE> <INDENT> origin: int <NEW_LINE> destination: int <NEW_LINE> o_name: str <NEW_LINE> d_name: str <NEW_LINE> name: str <NEW_LINE> nodes: List
Basic OD information for a route.
62599032a4f1c619b294f6cf
class Script: <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def sign(privkey, data): <NEW_LINE> <INDENT> return rsa.sign(data.encode(), privkey, 'SHA-256') <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def verify(data, signature, pubkey): <NEW_LINE> <INDENT> if data is None or signature is None or pubkey is None: <NEW_LI...
脚本流程 栈顶元素复制->加密->校验签名
625990323eb6a72ae038b73f
class Initializer: <NEW_LINE> <INDENT> def __init__( self ): <NEW_LINE> <INDENT> self.SOURCE_DIR_PATH = os.environ['ANXEOD__SOURCE_DIR_PATH'] <NEW_LINE> self.DESTINATION_PATH = os.environ['ANXEOD__TRACKER_A_PATH'] <NEW_LINE> self.filepath_tracker = [] <NEW_LINE> self.start = datetime.datetime.now() <NEW_LINE> self.file...
Creates initial tracker.
6259903215baa72349463072
class UserProfile(models.Model): <NEW_LINE> <INDENT> user = models.ForeignKey(User) <NEW_LINE> feeds = models.ManyToManyField(to=Feed, through='profiles.Subscription') <NEW_LINE> entries = models.ManyToManyField(to=Entry, through='profiles.UserEntryDetail') <NEW_LINE> next_slug = RandomSlugField(slug_length=10) <NEW_LI...
A user profile.
6259903291af0d3eaad3af06
class OsuConverter(commands.IDConverter): <NEW_LINE> <INDENT> async def convert(self, ctx, argument): <NEW_LINE> <INDENT> id_ = self._get_id_match(argument) or re.match(r'<@!?([0-9]+)>$', argument) <NEW_LINE> if id_: <NEW_LINE> <INDENT> result = ctx.guild.get_member(int(id_.group(1))) <NEW_LINE> <DEDENT> else: <NEW_LIN...
Converts to a Guild.
6259903226068e7796d4da23
class STrustGetter(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(STrustGetter, self).__init__() <NEW_LINE> self.config = ConfigX() <NEW_LINE> self.user = {} <NEW_LINE> self.relations = self.get_relations() <NEW_LINE> self.followees = defaultdict(dict) <NEW_LINE> self.followers = {} <NEW_LIN...
docstring for TrustGetter read trust data and save the global parameters
62599032711fe17d825e1507
class CiscoNXOS(IOSLikeDevice): <NEW_LINE> <INDENT> _disable_paging_command = "terminal length 0" <NEW_LINE> @staticmethod <NEW_LINE> def _normalize_linefeeds(a_string): <NEW_LINE> <INDENT> newline = re.compile(r"(\r\r\n|\r\n)") <NEW_LINE> return newline.sub("\n", a_string).replace("\r", "")
Class for working with Cisco Nexus/NX-OS
6259903250485f2cf55dc056
class returned_values: <NEW_LINE> <INDENT> value=None <NEW_LINE> complement=None <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> pass
this class defines the structure of returned_value a returned value has the used value and its complement the free value
625990328c3a8732951f7632
@dataclass <NEW_LINE> class DataCollatorForLanguageModeling: <NEW_LINE> <INDENT> tokenizer: PreTrainedTokenizer <NEW_LINE> mlm: bool = True <NEW_LINE> mlm_probability: float = 0.15 <NEW_LINE> def __call__(self, examples: List[Union[torch.Tensor, Dict[str, torch.Tensor]]]) -> Dict[str, torch.Tensor]: <NEW_LINE> <INDENT>...
Data collator used for language modeling. - collates batches of tensors, honoring their tokenizer's pad_token - preprocesses batches for masked language modeling
6259903266673b3332c314cc
class PrintHelp(Exception): <NEW_LINE> <INDENT> pass
raise this to print a message and the argparse help
625990321d351010ab8f4bf3
class CurrentControlledVoltageSource(VoltageSource): <NEW_LINE> <INDENT> def __init__(self, name, element, evaluated_paramsd, parent): <NEW_LINE> <INDENT> r_expresion = element.paramsl[-1] <NEW_LINE> r_value = scs_parser.evaluate_param('_r', {'_r': r_expresion}, evaluated_paramsd, parent) <NEW_LINE> self.names = [name,...
Object with instance of current controlled voltage source of a circtuit
625990328e05c05ec3f6f6c8
class Service(object): <NEW_LINE> <INDENT> name = None <NEW_LINE> requests = None <NEW_LINE> waiting = None <NEW_LINE> def __init__(self, name): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.requests = [] <NEW_LINE> self.waiting = [] <NEW_LINE> self.idle = []
a single Service
62599032ac7a0e7691f735c2
class Journal(Service): <NEW_LINE> <INDENT> writing = defer.succeed(None) <NEW_LINE> def write(self, occurence=None): <NEW_LINE> <INDENT> if occurence and occurence.name == 'signal': <NEW_LINE> <INDENT> if occurence.signum != signal.SIGTERM: return <NEW_LINE> log('Attempting to save journal before shutdown.') <NEW_LINE...
This Service is responsible for maintaining DroneD's notion of environmental state.
625990329b70327d1c57fe5f
class SnapshotRelayTest(TestCase): <NEW_LINE> <INDENT> def test_should_put_vehicle_snapshot_on_the_sim_queue_when_translation_event_is_received(self): <NEW_LINE> <INDENT> snapshots = Queue() <NEW_LINE> _ = SnapshotRelay(snapshots) <NEW_LINE> mock_lane = mock() <NEW_LINE> mock_lane.id = 10 <NEW_LINE> vehicle = Vehicle(0...
A note about this line: relay = SnapshotRelay(snapshots) The SnapshotRelay object will not put anything on the queue if when it is instantiated, the instance is not assigned to an variable. This is very strange. WHAT DOES PYTHON DO WHEN YOU ASSIGN A NEW INSTANCE OF A CLASS TO A VARIABLE THAT IT DOESN'T DO WHEN A VA...
625990328c3a8732951f7633
class Post(db.Model): <NEW_LINE> <INDENT> __tablename__ = 'posts' <NEW_LINE> id = db.Column(db.Integer, primary_key = True) <NEW_LINE> body = db.Column(db.Text) <NEW_LINE> timestamp = db.Column(db.DateTime, index = True, default = datetime.utcnow) <NEW_LINE> author_id = db.Column(db.Integer, db.ForeignKey('users.id')) ...
定于用户专栏文章模型
6259903221bff66bcd723d40
class SolarEdgeStorageLevelSensor(SolarEdgeSensor): <NEW_LINE> <INDENT> _attr_device_class = DEVICE_CLASS_BATTERY <NEW_LINE> def __init__( self, platform_name: str, sensor_key: str, data_service: SolarEdgeDataService ) -> None: <NEW_LINE> <INDENT> super().__init__(platform_name, sensor_key, data_service) <NEW_LINE> sel...
Representation of an SolarEdge Monitoring API storage level sensor.
6259903266673b3332c314ce
class MetadataRDBMSFactory(AbstractMetadataFactory): <NEW_LINE> <INDENT> def __init__(self, entity, name, **kwargs): <NEW_LINE> <INDENT> super(MetadataRDBMSFactory, self).__init__(entity, name, kwargs) <NEW_LINE> <DEDENT> def create_admin(self): <NEW_LINE> <INDENT> admin = MetadataAdmin(self._entity, self._name, **self...
Builds a Metadata object for RDBMS based DataSource and DataStore objects.
625990326fece00bbaccca8c
@ModelComponentFactory.register("Uncertainty set in a robust problem") <NEW_LINE> class UncSet(SimpleBlock): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> _rule = kwargs.pop('rule', None) <NEW_LINE> _fixed = kwargs.pop('fixed', None) <NEW_LINE> _param = kwargs.pop('param', None) <NEW_LINE...
This model component defines an uncertainty set in a robust optimization problem.
625990323eb6a72ae038b743
class City(BaseModel): <NEW_LINE> <INDENT> name = "" <NEW_LINE> state_id = ""
class City that inherits from BaseModel:
62599032d4950a0f3b1116ac
class UserDetailsSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = User <NEW_LINE> fields = ('pk', 'username', 'email', 'name', 'nickname', 'anonymous') <NEW_LINE> read_only_fields = ('username', 'email')
User model w/o password
6259903226068e7796d4da27
class NameInferenceError(InferenceError): <NEW_LINE> <INDENT> name = None <NEW_LINE> scope = None <NEW_LINE> def __init__(self, message="{name!r} not found in {scope!r}.", **kws): <NEW_LINE> <INDENT> super().__init__(message, **kws)
Raised when a name lookup fails, corresponds to NameError. Standard attributes: name: The name for which lookup failed, as a string. scope: The node representing the scope in which the lookup occurred. context: InferenceContext object.
625990320a366e3fb87ddac3
class UserSimpleForm(ModelForm): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = User <NEW_LINE> fields = ('first_name', 'last_name')
Form for registration page
625990325e10d32532ce4171
class RegisterView(View): <NEW_LINE> <INDENT> def get(self,request): <NEW_LINE> <INDENT> register_form = RegisterForm() <NEW_LINE> return render(request,'register.html',{'register_form':register_form}) <NEW_LINE> <DEDENT> def post(self,request): <NEW_LINE> <INDENT> register_form = RegisterForm(request.POST) <NEW_LINE> ...
用户注册
62599032796e427e5384f859
class HTestCase(unittest.TestCase): <NEW_LINE> <INDENT> def test_init(self): <NEW_LINE> <INDENT> p = H(4, "Lesson7 - HTML") <NEW_LINE> f = StringIO() <NEW_LINE> p.render(f) <NEW_LINE> expected = "<h4>Lesson7 - HTML</h4>\n" <NEW_LINE> self.assertEqual(expected, f.getvalue())
Test number level
62599032d53ae8145f919541
class Description: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.title = "" <NEW_LINE> self.score = None <NEW_LINE> self.bits = None <NEW_LINE> self.e = None <NEW_LINE> self.num_alignments = None <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return "%-66s %5s %s" % (self.title, self.sco...
Stores information about one hit in the descriptions section. Members: title Title of the hit. score Number of bits. (int) bits Bit score. (float) e E value. (float) num_alignments Number of alignments for the same subject. (int)
625990328a349b6b4368731b
class Sounds(): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> pygame.mixer.init() <NEW_LINE> <DEDENT> def stop_all(self): <NEW_LINE> <INDENT> pygame.mixer.stop() <NEW_LINE> <DEDENT> def start_turn(self): <NEW_LINE> <INDENT> soundfile = 'sounds/263125_pan14_sine-fifths-up-beep.ogg' <NEW_LINE> pygame.mixer....
contains all sounds of the game
625990321f5feb6acb163cce
class TestDependencySet(TestPackageClass): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super(TestDependencySet, self).setUp() <NEW_LINE> self.package = "fabtools" <NEW_LINE> self.version = "0.19.0" <NEW_LINE> self.fab_reqs = json.load( open("tests/deputils_data/fabtools_0_19_0_req.json", 'r')) <NEW_LINE> s...
Dependency set tests, methods: - check_changes_in_requirements_vs_env good package for test is fabtools : 0.19.0
6259903250485f2cf55dc05b
class Http409(JSONErrorResponse): <NEW_LINE> <INDENT> status_code = 409
HTTP 409 Conflict
6259903215baa72349463078
class MkdirFileLock(LockBase): <NEW_LINE> <INDENT> def __init__(self, path, threaded=True): <NEW_LINE> <INDENT> LockBase.__init__(self, path, threaded) <NEW_LINE> if threaded: <NEW_LINE> <INDENT> tname = "{0:x}-".format(_thread.get_ident()) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> tname = "" <NEW_LINE> <DEDENT> se...
Lock file by creating a directory.
62599032ac7a0e7691f735c6
class ModWallOpe(Operator): <NEW_LINE> <INDENT> bl_label = 'Wall' <NEW_LINE> bl_idname = 'my.modwall' <NEW_LINE> def execute(self, context): <NEW_LINE> <INDENT> obj = context.object <NEW_LINE> bpy.ops.object.modifier_add(type='ARRAY') <NEW_LINE> bpy.context.object.modifiers["Array"].count = 10 <NEW_LINE> bpy.context.ob...
Visualizes selected object in a modular wall
625990328e05c05ec3f6f6ca
class RepulsionForce: <NEW_LINE> <INDENT> def __init__(self, coefficient): <NEW_LINE> <INDENT> self.coefficient = coefficient <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return str(self.__class__) <NEW_LINE> <DEDENT> def apply_node_to_node(self, node1, node2): <NEW_LINE> <INDENT> raise NotImplementedErro...
Here are all the formulas for attraction and repulsion.
6259903276d4e153a661dae0
class HammerFirst(CloudAPI): <NEW_LINE> <INDENT> def list_servers(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> endpoint = self._get_endpoint('compute', type_name='cloudServers') <NEW_LINE> <DEDENT> except Exception: <NEW_LINE> <INDENT> log.debug(( 'Exception: HammerFirst.list_servers no firstgen endpoint' )) <NE...
Firstgen api library for hammercloud
625990328c3a8732951f7637
class UnsupportedS3ControlConfigurationError(BotoCoreError): <NEW_LINE> <INDENT> fmt = ( 'Unsupported configuration when using S3 Control: {msg}' )
Error when an unsupported configuration is used with S3 Control
62599032d10714528d69eefb
class MsgDetailedInfo: <NEW_LINE> <INDENT> QUALNAME = "pyrogram.raw.base.MsgDetailedInfo" <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> raise TypeError("Base types can only be used for type checking purposes: " "you tried to use a base type instance as argument, " "but you need to instantiate one of its constructo...
This base type has 2 constructors available. Constructors: .. hlist:: :columns: 2 - :obj:`MsgDetailedInfo <pyrogram.raw.types.MsgDetailedInfo>` - :obj:`MsgNewDetailedInfo <pyrogram.raw.types.MsgNewDetailedInfo>`
625990328a349b6b4368731d
class ContactPredictionHead(nn.Module): <NEW_LINE> <INDENT> def __init__(self, in_features, bias=True): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.regression = nn.Linear(in_features, 1, bias) <NEW_LINE> self.activation = nn.Sigmoid() <NEW_LINE> <DEDENT> def forward(self, features): <NEW_LINE> <INDENT> featu...
Performs symmetrization, apc, and computes a logistic regression on the output features
62599032d164cc6175822052
class BaseURLs(object): <NEW_LINE> <INDENT> def __init__(self, values, links): <NEW_LINE> <INDENT> self.values = values <NEW_LINE> self.links = links <NEW_LINE> <DEDENT> def to_xml(self): <NEW_LINE> <INDENT> dom = etree.Element("baseURLs") <NEW_LINE> dom.set(u"xmlns", "http://docs.openstack.org/identity/api/v2.0") <NEW...
A collection of baseURls.
625990328e05c05ec3f6f6cb
class Email(XMLSerializable): <NEW_LINE> <INDENT> def __init__( self, to, subject, body, cc=None, bcc=None, content_type=None, attachments=None ): <NEW_LINE> <INDENT> super(Email, self).__init__(xml_tag='email') <NEW_LINE> self.to = to <NEW_LINE> self.subject = subject <NEW_LINE> self.body = body <NEW_LINE> self.cc = c...
Email action for use within a workflow.
62599032be383301e02548f4
class IEC104_IO_M_EI_NA_1(IEC104_IO_Packet): <NEW_LINE> <INDENT> name = 'M_EI_NA_1' <NEW_LINE> _DEFINED_IN = [IEC104_IO_Packet.DEFINED_IN_IEC_101, IEC104_IO_Packet.DEFINED_IN_IEC_104] <NEW_LINE> _IEC104_IO_TYPE_ID = IEC104_IO_ID_M_EI_NA_1 <NEW_LINE> fields_desc = IEC104_IE_COI.informantion_element_fields
end of initialization EN 60870-5-101:2003, sec. 7.3.3.1 (p. 106)
62599032ec188e330fdf9975
class PriceModificationFixedPrice(object): <NEW_LINE> <INDENT> openapi_types = { 'type': 'str', 'price': 'PriceModificationFixedPriceHolder' } <NEW_LINE> attribute_map = { 'type': 'type', 'price': 'price' } <NEW_LINE> def __init__(self, type='FIXED_PRICE', price=None, local_vars_configuration=None): <NEW_LINE> <INDENT>...
NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually.
625990324e696a045264e692
class Linear_Sparse(torch.nn.Module): <NEW_LINE> <INDENT> def __init__(self,input_size, output_size, bias=True, cuda_device="cuda:0"): <NEW_LINE> <INDENT> super(self.__class__, self).__init__() <NEW_LINE> self.input_size=input_size <NEW_LINE> self.output_size=output_size <NEW_LINE> self.weight = torch.nn.Parameter(torc...
A linear module with mask
62599032c432627299fa40d8
class adict(util.ReprMixin, util.PrivAttrKeyMixin, AttrDict): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> def convert(o): <NEW_LINE> <INDENT> if isinstance(o, dict): <NEW_LINE> <INDENT> return adict((k, convert(v)) for k, v in o.items()) <NEW_LINE> <DEDENT> elif isinstance(o, (list, tup...
Customized attribute dictionary type.
6259903263f4b57ef00865e4
class TankRunner(object): <NEW_LINE> <INDENT> def __init__( self, cfg, manager_queue, session_id, tank_config, first_break): <NEW_LINE> <INDENT> work_dir = os.path.join(cfg['tests_dir'], session_id) <NEW_LINE> lock_dir = cfg['lock_dir'] <NEW_LINE> load_ini_path = os.path.join(work_dir, 'load.yaml') <NEW_LINE> _log.info...
Manages the tank process and its working directory.
625990326e29344779b01733
class LoggedScalarScalarSample(LoggedScalarScalar): <NEW_LINE> <INDENT> def get(self, reset: bool = True) -> Optional[float]: <NEW_LINE> <INDENT> result = self.reduce() <NEW_LINE> reset = True <NEW_LINE> if reset: <NEW_LINE> <INDENT> self.reset() <NEW_LINE> <DEDENT> return result
Keeps the latest sample of a scalar.
62599032d53ae8145f919547
class SettingsCredSnmpV3FailGridRemote(RemoteModel): <NEW_LINE> <INDENT> properties = ("id", "Collector", "DeviceID", "DeviceName", "DeviceType", "DeviceIPDotted", "DeviceIPNumeric", "VirtualNetworkID", "Network", "DeviceAssurance", )
| ``id:`` none | ``attribute type:`` string | ``Collector:`` none | ``attribute type:`` string | ``DeviceID:`` none | ``attribute type:`` string | ``DeviceName:`` none | ``attribute type:`` string | ``DeviceType:`` none | ``attribute type:`` string | ``DeviceIPDotted:`` none | ``attribute type:`` strin...
625990336fece00bbaccca93
class VscodeCli(object): <NEW_LINE> <INDENT> def install(self): <NEW_LINE> <INDENT> var_full_path = os.path.dirname(os.path.realpath(__file__)) <NEW_LINE> var_install = input("安装vscode吗? [y/n]: ") <NEW_LINE> if var_install.lower() == "y": <NEW_LINE> <INDENT> var_host_target = input("请输入目标主机ip地址(例如: 192.168.1.20:8080): ...
管理vscode cli程序,OS support: ubuntu
6259903350485f2cf55dc061
class Square: <NEW_LINE> <INDENT> __size = None <NEW_LINE> def __init__(self, size=0): <NEW_LINE> <INDENT> if size != int(size): <NEW_LINE> <INDENT> raise TypeError('size must be an integer') <NEW_LINE> <DEDENT> if size < 0: <NEW_LINE> <INDENT> raise ValueError('size must be >= 0') <NEW_LINE> <DEDENT> self.__size = siz...
a class named square
62599033d10714528d69eefd
class Bullet(Sprite): <NEW_LINE> <INDENT> def __init__(self, ai_settings, screen, ship): <NEW_LINE> <INDENT> super().__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_LINE> self.r...
A class to manage bullets fired from the ship
6259903326068e7796d4da2f
class BatchBuildOperation(BatchOperation): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(BatchBuildOperation, self).__init__() <NEW_LINE> self.valid_keys = models.BUILD_VALID_KEYS
A batch operation for the `build` collection.
625990339b70327d1c57fe69
class Solution: <NEW_LINE> <INDENT> def canPermutePalindrome(self, s): <NEW_LINE> <INDENT> d = {ll:0 for ll in s} <NEW_LINE> for ll in s: <NEW_LINE> <INDENT> if d[ll] is 0: <NEW_LINE> <INDENT> d[ll] = 1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> d[ll] = 0 <NEW_LINE> <DEDENT> <DEDENT> num = 0 <NEW_LINE> for ll in d: ...
@param s: the given string @return: if a permutation of the string could form a palindrome
62599033a8ecb03325872302
class DummyContainer(TestcaseContainer): <NEW_LINE> <INDENT> def __init__(self, logger=None): <NEW_LINE> <INDENT> super(DummyContainer, self).__init__(logger) <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def find_testcases(modulename, moduleroot, tc_meta_schema, path=None, suiteconfig=None, logger=None): <NEW_LINE> <IN...
Class DummyContainer subclasses TestcaseContainer, acts as a dummy object for listing test cases that were not found when importing test cases.
6259903307d97122c4217d8c
class Indicator(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.strategy_id = '' <NEW_LINE> self.account_id = '' <NEW_LINE> self.nav = 0.0 <NEW_LINE> self.pnl = 0.0 <NEW_LINE> self.profit_ratio = 0.0 <NEW_LINE> self.profit_ratio_bench = 0.0 <NEW_LINE> self.sharp_ratio = 0.0 <NEW_LINE> self.ris...
账户业绩指标
62599033d53ae8145f919549
class DatasetTestBase(test.TestCase): <NEW_LINE> <INDENT> def _assert_datasets_equal(self, dataset1, dataset2): <NEW_LINE> <INDENT> next1 = dataset1.make_one_shot_iterator().get_next() <NEW_LINE> next2 = dataset2.make_one_shot_iterator().get_next() <NEW_LINE> with self.cached_session() as sess: <NEW_LINE> <INDENT> whil...
Base class for dataset tests.
62599033d6c5a102081e320b
class LeoAssaultsSummary(object): <NEW_LINE> <INDENT> TABLENAME = 'leo_assaults_summary' <NEW_LINE> COLUMNS = [ ColumnDefinition('year', 'INT'), ColumnDefinition('county', 'TEXT'), ColumnDefinition('injury_status', 'TEXT'), ColumnDefinition('assaults', 'INT'), ColumnDefinition('population', 'INT'), ColumnDefinition('as...
Table containing CA LEO assaults summary data. Would be better were we to create this from an event level dataset.
6259903396565a6dacd2d800
class UpdateOwnProfile(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.id == request.user.id
Allow user to edit their own profile only
6259903366673b3332c314d8
class UserAlreadyExists(QSDockerException): <NEW_LINE> <INDENT> def __init__(self, message="User already exists in the system", error="User exists", status_code=409): <NEW_LINE> <INDENT> super(UserAlreadyExists,self).__init__(message=message, error=error, status_code=status_code)
An exception class to be thrown when trying to register a user which already exists in the system.
62599033d4950a0f3b1116b1
class StdOutListener(StreamListener): <NEW_LINE> <INDENT> def __init__(self, fetched_tweets_filename): <NEW_LINE> <INDENT> self.fetched_tweets_filename = fetched_tweets_filename <NEW_LINE> <DEDENT> def on_data(self, data, data_print = False): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if data_print == True: <NEW_LINE...
This is a basic listener that just prints received tweets to stdout.
62599033be383301e02548fa
class TestOnData(object): <NEW_LINE> <INDENT> @pytest.fixture(autouse=True) <NEW_LINE> def set_common_fixtures(self): <NEW_LINE> <INDENT> filepath = os.path.dirname(os.path.realpath(__file__)) <NEW_LINE> testfilepath = os.path.join(filepath, 'test_files') <NEW_LINE> corpus = USPublications(testfilepath) <NEW_LINE> self...
Testing functions on Patent Example.
62599033796e427e5384f863
class OpenXMLParserFormatterTest(test_lib.EventFormatterTestCase): <NEW_LINE> <INDENT> def testInitialization(self): <NEW_LINE> <INDENT> event_formatter = oxml.OpenXMLParserFormatter() <NEW_LINE> self.assertNotEqual(event_formatter, None) <NEW_LINE> <DEDENT> def testGetFormatStringAttributeNames(self): <NEW_LINE> <INDE...
Tests for the OXML event formatter.
62599033d164cc6175822059
class FritzDectSwitch(SwitchDevice): <NEW_LINE> <INDENT> def __init__(self, hass, data, name): <NEW_LINE> <INDENT> self.units = hass.config.units <NEW_LINE> self.data = data <NEW_LINE> self._name = name <NEW_LINE> <DEDENT> @property <NEW_LINE> def name(self): <NEW_LINE> <INDENT> return self._name <NEW_LINE> <DEDENT> @p...
Representation of a FRITZ!DECT switch.
625990333eb6a72ae038b74f
class ZMQBaseComponent(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._context = zmq.Context() <NEW_LINE> self._loop = None <NEW_LINE> self.dataset = [] <NEW_LINE> <DEDENT> def _prepare_reactor(self): <NEW_LINE> <INDENT> raise NotImplementedError(self._prepare_reactor) <NEW_LINE> <DEDENT> def...
Base class for zmq components.
62599033cad5886f8bdc58ef
class TestRsyncRemote(rsync_base.TestRsyncBase): <NEW_LINE> <INDENT> def test__init_directory_structure(self): <NEW_LINE> <INDENT> for remote in self.rsyncd[self.testname]: <NEW_LINE> <INDENT> url = remote.url + '/initial_test_path/test-subdir' <NEW_LINE> rsync = RsyncRemote(url, init_directory_structure=True) <NEW_LIN...
Test case class for rsync_remote module
6259903350485f2cf55dc065
class ProportionalSelector(Selector): <NEW_LINE> <INDENT> def select(self, population): <NEW_LINE> <INDENT> n = len(population) <NEW_LINE> sum_fitness = sum(x.fitness for x in population) <NEW_LINE> probabilty = [(x.fitness/sum_fitness) for x in population] <NEW_LINE> return random.choice(range(n), size=self._size, rep...
Selects using a probabilty distribution given the normalized values of each genome's fitness
6259903315baa72349463082
class RemoveUTCTimestampTest(fixtures.TablesTest): <NEW_LINE> <INDENT> __only_on__ = 'mysql' <NEW_LINE> __backend__ = True <NEW_LINE> @classmethod <NEW_LINE> def define_tables(cls, metadata): <NEW_LINE> <INDENT> Table( 't', metadata, Column('id', Integer, primary_key=True), Column('x', Integer), Column('data', DateTime...
This test exists because we removed the MySQL dialect's override of the UTC_TIMESTAMP() function, where the commit message for this feature stated that "it caused problems with executemany()". Since no example was provided, we are trying lots of combinations here. [ticket:3966]
6259903376d4e153a661dae5
class SignerReminderEmail(BaseMailerService): <NEW_LINE> <INDENT> name = 'Signer Reminder Email' <NEW_LINE> subject = '[ACTION REQUIRED] Invitation to sign a document' <NEW_LINE> email_template = 'sign_reminder'
m = SignerReminderEmail(recipients=(('Alex', 'alex@lawpal.com'),), from_tuple=(from_user.get_full_name(), from_user.email,)) m.process(subject='[ACTION REQUIRED] Reminder to sign', action_url='http://lawpal.com/etc/')
6259903330c21e258be998f5
class YouBlockedUser(BadRequest): <NEW_LINE> <INDENT> ID = "YOU_BLOCKED_USER" <NEW_LINE> MESSAGE = __doc__
You blocked this user
62599033ec188e330fdf997d
class GoddessWallFrenchLanguage(BaseElement): <NEW_LINE> <INDENT> @property <NEW_LINE> def selector(self): <NEW_LINE> <INDENT> return (By.XPATH,"\\android.support.v7.widget.RecyclerView[@resource-id='com.videochat.livu:id/recycle_goddess']/android.widget.FrameLayout[2]/android.widget.TextView")
Goddess wall French language
62599033e76e3b2f99fd9af5
class ReporterContextQueue(ReporterContext): <NEW_LINE> <INDENT> def __init__(self, kind=None, verbosity=Reporter.DEFAULT, queue=None, prefix=None): <NEW_LINE> <INDENT> ReporterContext.__init__(self, kind, verbosity, None, prefix) <NEW_LINE> if queue is None: <NEW_LINE> <INDENT> queue = multiprocessing.Queue() <NEW_LIN...
A context for the reporter object. It has the following attributes: kind: The message kind to report to this context. (Reporter.KIND_ERR, Reporter.KIND_ERR or None.) verbosity: The verbosity of this context. queue: The multiprocessing.Queue. prefix: The default message prefix (str or callable).
625990338c3a8732951f7641
class SimplePlayer(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.position = maths.VECTOR3() <NEW_LINE> self.viewDirection = maths.VECTOR3() <NEW_LINE> self.teamId = 0 <NEW_LINE> self.address = 0x0 <NEW_LINE> <DEDENT> def initialise(self): <NEW_LINE> <INDENT> self.position = maths.VECTOR3() <...
Holding the esp-friendly player data
625990338c3a8732951f7642
class CharacterClassViewSet(viewsets.ModelViewSet): <NEW_LINE> <INDENT> queryset = models.CharacterClass.objects.all() <NEW_LINE> serializer_class = serializers.CharacterClassSerializer <NEW_LINE> permission_classes = (permissions.IsAuthenticatedOrReadOnly,)
This viewset automatically provides a 'list', 'create', 'retrieve', 'update', and 'destroy' actions
62599033ac7a0e7691f735d2
class ApiFlowResultsRendererRegressionTest( api_test_lib.ApiCallRendererRegressionTest): <NEW_LINE> <INDENT> renderer = "ApiFlowResultsRenderer" <NEW_LINE> def setUp(self): <NEW_LINE> <INDENT> super(ApiFlowResultsRendererRegressionTest, self).setUp() <NEW_LINE> self.client_id = self.SetupClients(1)[0] <NEW_LINE> <DEDEN...
Regression test for ApiFlowResultsRenderer.
625990339b70327d1c57fe6f
class WeightRecorder(object): <NEW_LINE> <INDENT> def __init__(self, sampling_interval, projection): <NEW_LINE> <INDENT> self.interval = sampling_interval <NEW_LINE> self.projection = projection <NEW_LINE> self._weights = [] <NEW_LINE> <DEDENT> def __call__(self, t): <NEW_LINE> <INDENT> self._weights.append(self.projec...
Recording of weights is not yet built in to PyNN, so therefore we need to construct a callback object, which reads the current weights from the projection at regular intervals.
6259903330c21e258be998f7
class TestCreatingLargeObjects(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.c = connect() <NEW_LINE> self.c.query('begin') <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> self.c.query('rollback') <NEW_LINE> self.c.close() <NEW_LINE> <DEDENT> def assertIsLargeObject(self,...
Test creating large objects using a connection.
62599033a8ecb03325872308
class TbSetmealfoodmappSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = TbSetmealfoodmapp <NEW_LINE> fields = ( 'mealfoodmapid', 'temp_commonfoodid', 'temp_setmealinfoid', 'mealfoodmapremarks', )
套餐食物映射表
62599033ec188e330fdf997f
class Account(ndb.Model): <NEW_LINE> <INDENT> email = ndb.StringProperty() <NEW_LINE> nickname = ndb.StringProperty() <NEW_LINE> registered = ndb.BooleanProperty() <NEW_LINE> permissions = ndb.IntegerProperty(repeated=True) <NEW_LINE> shadow_banned = ndb.BooleanProperty(default=False) <NEW_LINE> created = ndb.DateTimeP...
Accounts represent accounts people use on TBA.
625990338c3a8732951f7643
class TableMapEvent(BinLogEvent): <NEW_LINE> <INDENT> def __init__(self, from_packet, event_size, table_map, ctl_connection, **kwargs): <NEW_LINE> <INDENT> super().__init__(from_packet, event_size, table_map, ctl_connection, **kwargs) <NEW_LINE> self._only_tables = kwargs["only_tables"] <NEW_LINE> self._only_schemas = ...
This evenement describe the structure of a table. It's send before a change append on a table. A end user of the lib should have no usage of this
625990336fece00bbaccca9b
class HungarianMatcher(nn.Module): <NEW_LINE> <INDENT> def __init__( self, cost_class: float = 1, cost_bbox: float = 1, cost_giou: float = 1, use_focal_loss=False, ): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.cost_class = cost_class <NEW_LINE> self.cost_bbox = cost_bbox <NEW_LINE> self.cost_giou = cost_gio...
This class computes an assignment between the targets and the predictions of the network For efficiency reasons, the targets don't include the no_object. Because of this, in general, there are more predictions than targets. In this case, we do a 1-to-1 matching of the best predictions, while the others are un-matched ...
62599033d53ae8145f91954f
class DBStorage: <NEW_LINE> <INDENT> __engine = None <NEW_LINE> __session = None <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> self.__engine = create_engine( 'mysql+mysqldb://{}:{}@{}/{}'.format( os.environ.get('HBNB_MYSQL_USER'), os.environ.get('HBNB_MYSQL_PWD'), os.environ.get('HBNB_MYSQL_HOST'), os.environ.get(...
storage of class insts like one from filestorage
6259903330c21e258be998f8
class Meta: <NEW_LINE> <INDENT> model = Question <NEW_LINE> fields = ('url', 'question_text', 'pub_date')
using the ModelSerializer class to refactor serializer
62599033287bf620b6272cd3
class GRIDB(BaseCard): <NEW_LINE> <INDENT> type = 'GRIDB' <NEW_LINE> _field_map = {1: 'nid', 4:'phi', 6:'cd', 7:'ps', 8:'idf'} <NEW_LINE> def __init__(self, nid, phi, cd, ps, idf, comment=''): <NEW_LINE> <INDENT> if comment: <NEW_LINE> <INDENT> self.comment = comment <NEW_LINE> <DEDENT> self.nid = nid <NEW_LINE> self.p...
defines the GRIDB class
6259903321bff66bcd723d51
class Exam(models.Model): <NEW_LINE> <INDENT> name = models.CharField(max_length=30) <NEW_LINE> num_questions = models.IntegerField() <NEW_LINE> def __str__(self): <NEW_LINE> <INDENT> return self.name
Table containing the list of all exams
6259903350485f2cf55dc069
class IdentityMediumConfig(object): <NEW_LINE> <INDENT> init_scale = 0.05 <NEW_LINE> learning_rate = 0.8 <NEW_LINE> max_grad_norm = 5 <NEW_LINE> num_layers = 2 <NEW_LINE> num_steps = 35 <NEW_LINE> hidden_size = 650 <NEW_LINE> max_epoch = 6 <NEW_LINE> max_max_epoch = 39 <NEW_LINE> keep_prob = 0.5 <NEW_LINE> lr_decay = 0...
Identity Medium config.
62599033a4f1c619b294f6e3
class StringEditingTests(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.myString = MyString() <NEW_LINE> <DEDENT> def test_reverse(self): <NEW_LINE> <INDENT> tests = ["Hello World!", (1,2,3,4), [9,8,7,6,5,4,3,2,1]] <NEW_LINE> for i in tests: <NEW_LINE> <INDENT> orig = i <...
StringEditing will contain a bunch of methods to edit and play with strings
62599033ac7a0e7691f735d4
class Sleep(_State): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def set(cls, user): <NEW_LINE> <INDENT> user.messages = "" <NEW_LINE> super().set(user) <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def _jump(cls, user, user_msg): <NEW_LINE> <INDENT> if user_msg.startswith('/start'): <NEW_LINE> <INDENT> change_state(Wait...
Zzzz-State. Waiting for user actions Sleep -/start-> Waiting
6259903323e79379d538d5f7
class DbFind: <NEW_LINE> <INDENT> def __init__(self,editor): <NEW_LINE> <INDENT> if 0: <NEW_LINE> <INDENT> assert isinstance(editor,Scintilla) <NEW_LINE> <DEDENT> self.editor = editor <NEW_LINE> editor.setSelBack(QColor('blue')) <NEW_LINE> editor.setSelFore(QColor('white')) <NEW_LINE> <DEDENT> def doubleClick(self, pos...
双击的时候,查找相同项 editor.setExtraHight()
6259903373bcbd0ca4bcb374
class AttachmentException(BugsyException): <NEW_LINE> <INDENT> pass
If we try do something that is not allowed to an attachment then this error is raised
62599033287bf620b6272cd5
class Ircrr(callbacks.Plugin): <NEW_LINE> <INDENT> threaded = True <NEW_LINE> class rr(callbacks.Commands): <NEW_LINE> <INDENT> zone_id = conf.supybot.plugins.Ircrr.rr.zone_id() <NEW_LINE> zone_name = conf.supybot.plugins.Ircrr.rr.zone() <NEW_LINE> pattern = re.compile(r"\b(\w+)\s*:\s*([^\s]+)") <NEW_LINE> def add(self...
Allows access to the Cloudflare (tm) API to manage Round Robins
62599033287bf620b6272cd6
class DisplayError(Exception): <NEW_LINE> <INDENT> pass
An error prevent display to be done correctly.
6259903350485f2cf55dc06b
class SignAuthorizedResource(Resource): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super().__init__(*args, **kwargs) <NEW_LINE> <DEDENT> method_decorators = [query_authorized, handle_db_exception_inner]
The resource will use sign in query to ensure the request will be called by authorized client.
62599033d10714528d69ef02
class NGImageNoteDetail(generics.RetrieveAPIView): <NEW_LINE> <INDENT> serializer_class = NGImageNoteSerializer <NEW_LINE> permission_classes = (permissions.IsAuthenticated,) <NEW_LINE> def get_queryset(self): <NEW_LINE> <INDENT> user = self.request.user <NEW_LINE> return ImageNote.objects.filter(owner=user)
a restful detail view of an ImageNote, without the coordinate data
6259903376d4e153a661dae8
class LoginTestCase(unittest.TestCase): <NEW_LINE> <INDENT> pass
def setUp(self) -> None: def test_login_success(self): self.assertTrue() def test_login_fail(self): self.assertTrue() def test_password_expired(self): self.assertTrue() def test_password_reset_success(self): self.assertTrue() def test_password_reset_fail(self): self.assertTrue()
6259903330c21e258be998fb
class UnaryOperationMutator(AbstractMutator): <NEW_LINE> <INDENT> def __init__(self, identifier, operation_type: UnaryOperation): <NEW_LINE> <INDENT> super().__init__(identifier, MutatorType.UNARY_OP) <NEW_LINE> self._operation_type = operation_type <NEW_LINE> <DEDENT> @property <NEW_LINE> def operation_type(self): <NE...
A simple UNARY_OP (e.g., NOT, INC, DEC) mutator does the actual work of altering the message
6259903307d97122c4217d96
class RedirectError(HttxException): <NEW_LINE> <INDENT> def __init__(self, response, *args): <NEW_LINE> <INDENT> HttxException.__init__(self, response, *args)
A class representing a redirection error (like missing location header, not allowed in a POST request and others)
62599033d99f1b3c44d06792
class size_t_t( _D.fundamental_t ): <NEW_LINE> <INDENT> CPPNAME = 'size_t' <NEW_LINE> def __init__( self ): <NEW_LINE> <INDENT> _D.fundamental_t.__init__( self, size_t_t.CPPNAME )
represents size_t type
62599033796e427e5384f86b
class State: <NEW_LINE> <INDENT> def __init__(self, json_filename, collab=None): <NEW_LINE> <INDENT> with open(json_filename) as f: <NEW_LINE> <INDENT> data = json.load(f) <NEW_LINE> <DEDENT> if collab: <NEW_LINE> <INDENT> self._authors = [] <NEW_LINE> for author in data['authors']: <NEW_LINE> <INDENT> if 'collab' in a...
The authorlist state. Args: json_filename (str): name of json file holding state collab (str): (optional) name of collaboration to filter by
625990331d351010ab8f4c08
class A: <NEW_LINE> <INDENT> def __init__(): <NEW_LINE> <INDENT> pass
Hello and goodbye
62599033b830903b9686ecf2
class drawobj_empty(drawobj_base): <NEW_LINE> <INDENT> def __init__( self, parent=None ): <NEW_LINE> <INDENT> super().__init__(parent=parent) <NEW_LINE> <DEDENT> def get_xx_yy(self): <NEW_LINE> <INDENT> drawobj_base.debug_logger.info("drawobj_empty.get_xx_yy") <NEW_LINE> return [0.0], [0.0] <NEW_LINE> <DEDENT> def set_...
なにも描画しないコンテナとしての描画オブジェクト
62599033cad5886f8bdc58f3
class Modify_State_Delete(basic.SimpleProtocol): <NEW_LINE> <INDENT> def runTest(self): <NEW_LINE> <INDENT> of_logger.info("Running Modify_State_Delete test") <NEW_LINE> of_ports = of_port_map.keys() <NEW_LINE> of_ports.sort() <NEW_LINE> rc = delete_all_flows(self.controller,of_logger) <NEW_LINE> self.assertEqual(rc, 0...
Check Basic Flow Delete request is implemented a) Send OFPT_FLOW_MOD, command = OFPFC_ADD b) Send ofp_table_stats request , verify active_count=1 in reply c) Send OFPT_FLOW_MOD, command = OFPFC_DELETE c) Send ofp_table_stats request , verify active_count=0 in reply
62599033d4950a0f3b1116b6
class MywVMEEntry(MywEntry): <NEW_LINE> <INDENT> def __init__(self, master, label='label',vmeaddr='VMEADDR',vb=None, side='left', helptext="", width=None, userupdate=None): <NEW_LINE> <INDENT> self.vb= vb <NEW_LINE> self.userupdate= userupdate <NEW_LINE> self.vmeaddr= vmeaddr <NEW_LINE> self.getvme() <NEW_LINE> MywEntr...
See MywEntry. This class in addition to MywEntry: - is initialised by VME value (VME read in __init__) - when entry field modified, VME register vmeaddr is updated when: mouse cursor leaves the entry, ENTER is pressed or when label button pressed - userupdate(oldval,newval) method: converts the string given by us...
62599033b57a9660fecd2b75
class AlphaBetaAgent(MultiAgentSearchAgent): <NEW_LINE> <INDENT> def getAction(self, gameState): <NEW_LINE> <INDENT> def maxAgent(state, depth, alpha, beta): <NEW_LINE> <INDENT> if terminalTest(state): <NEW_LINE> <INDENT> return state.getScore() <NEW_LINE> <DEDENT> actions = state.getLegalActions(0) <NEW_LINE> curMin =...
Your minimax agent with alpha-beta pruning (question 3)
625990338e05c05ec3f6f6d3