code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
class Solution: <NEW_LINE> <INDENT> def NumberOf1(self, n): <NEW_LINE> <INDENT> number_of_1 = 0 <NEW_LINE> flag = 1 <NEW_LINE> while flag <= MAXINT: <NEW_LINE> <INDENT> if flag & n: <NEW_LINE> <INDENT> number_of_1 += 1 <NEW_LINE> <DEDENT> flag <<= 1 <NEW_LINE> <DEDENT> return number_of_1
输入一个整数,输出该数二进制表示中1的个数。其中负数用补码表示。 算法2: 依次检查所有的 bit,Python2 最大是 64 bit,所以要检测 64 次。 检查第 k(0<=k<64) 位是否是1:将其与 0000...1(从右开始数第k个,k从0开始)...0 进行位与操作, 如果结果是 0,说明第 k 位是 0,否则第 k 位是 1。因为 0 与任何数位与都为 0,而另一个数除了第 k 位 都是0,所以只有当第 k 位为 1 时的位与结果才不会为 0.
62599080f9cc0f698b1c6020
class TheGuardianCredentials: <NEW_LINE> <INDENT> def __init__(self, key): <NEW_LINE> <INDENT> self.key = key <NEW_LINE> <DEDENT> @property <NEW_LINE> def valid(self): <NEW_LINE> <INDENT> response = requests.get(BASE_URL, {'api-key': self.key}) <NEW_LINE> return response.status_code == 200 <NEW_LINE> <DEDENT> def __eq_...
The Guardian API credentials.
62599080099cdd3c6367614e
class LocationField(Field): <NEW_LINE> <INDENT> def check_type(self, value): <NEW_LINE> <INDENT> if not isinstance(value, (tuple, list)): <NEW_LINE> <INDENT> raise TypeError("Value '%s' should be tuple or list", value) <NEW_LINE> <DEDENT> if len(value) != 2: <NEW_LINE> <INDENT> raise ValidateError( "LocationField shoul...
Location(longitude, latitude) field, the value should be something like (x, y) or [x, y], in which both x and y are float`.
625990805fc7496912d48fc0
class XFrameOptionsSameOrigin(generic.View): <NEW_LINE> <INDENT> xframe_options_same_origin = True <NEW_LINE> @classonlymethod <NEW_LINE> def as_view(cls, **kwargs): <NEW_LINE> <INDENT> view = super(XFrameOptionsSameOrigin, cls).as_view(**kwargs) <NEW_LINE> return ( clickjacking.xframe_options_sameorigin(view) if cls.x...
A view behavior that adds a SAMEORIGIN X-Frame-Options header to the response at the top level of the dispatch. Set the xframe_options_same_origin attribute to a falsy value to disable the behavior. See the django.views.decorators.clickjacking.xframe_options_sameorigin() decorator for details.
62599080a8370b77170f1e7a
class Router: <NEW_LINE> <INDENT> def __init__(self, view_404=None, view_500=None): <NEW_LINE> <INDENT> self.routes = {} <NEW_LINE> self.handler404 = view_404 if view_404 else default404 <NEW_LINE> self.handler500 = view_500 if view_500 else default500 <NEW_LINE> <DEDENT> def add_route(self, route: str, view: FunctionT...
Route different matching string patterns to different urls.
6259908097e22403b383c9aa
class ProductTest(unittest.TestCase): <NEW_LINE> <INDENT> def test_product_defines_properties_and_methods(self): <NEW_LINE> <INDENT> product = Product('some_value') <NEW_LINE> self.assertEqual(product.some_property, 'some_value') <NEW_LINE> self.assertTrue(hasattr(product, 'some_method')) <NEW_LINE> self.assertEqual(pr...
Unittest for the Product class
625990803d592f4c4edbc8b4
class MultiplePSIMITerms(MultipleItems): <NEW_LINE> <INDENT> _item_class = PSIMITerm
A list of PSI-MI Terms.
6259908076e4537e8c3f1029
class TestTotalsCommittee(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 testTotalsCommittee(self): <NEW_LINE> <INDENT> pass
TotalsCommittee unit test stubs
62599080a8370b77170f1e7b
class AllocateIp6AddressesBandwidthRequest(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.Ip6Addresses = None <NEW_LINE> self.InternetMaxBandwidthOut = None <NEW_LINE> self.InternetChargeType = None <NEW_LINE> self.BandwidthPackageId = None <NEW_LINE> <DEDENT> def _deserialize(self, pa...
AllocateIp6AddressesBandwidth请求参数结构体
625990802c8b7c6e89bd5290
class AsyncTask(object): <NEW_LINE> <INDENT> def __init__(self, thread_function, callback=None, timeout=0): <NEW_LINE> <INDENT> self.event = Event() <NEW_LINE> wrapped_function = self.wrap_thread(thread_function) <NEW_LINE> self.thread = Thread(target=wrapped_function) <NEW_LINE> self.thread.daemon = True <NEW_LINE> se...
run <thread_function> in a new thread it until it ends or has run for longer than <timeout> seconds. If <callback> is provided, it will be executed when the task completes or times out. The return value, if any, will be the final state of the task.
6259908099fddb7c1ca63b2e
class Ritchie(object): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def Ritchie(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None): <NEW_LINE> <INDENT> return grpc.experimental.unary_unary(request, target, '/r...
The Formula service definition.
625990805fdd1c0f98e5fa2a
class MatchException(Exception): <NEW_LINE> <INDENT> pass
Exception raised when matching fails, for example if input dictionary contains keys with the wrong data type for the specified query.
62599080ad47b63b2c5a92fb
class AppBuildViewSet(BaseAppViewSet): <NEW_LINE> <INDENT> model = models.Build <NEW_LINE> serializer_class = serializers.BuildSerializer <NEW_LINE> def post_save(self, build, created=False): <NEW_LINE> <INDENT> if created: <NEW_LINE> <INDENT> release = build.app.release_set.latest() <NEW_LINE> self.release = release.n...
RESTful views for :class:`~api.models.Build`.
62599080f548e778e596d03d
class Grant(models.Model): <NEW_LINE> <INDENT> user = models.ForeignKey(AUTH_USER_MODEL) <NEW_LINE> client = models.ForeignKey(Client) <NEW_LINE> code = models.CharField(max_length=255, default=long_token) <NEW_LINE> expires = models.DateTimeField(default=get_code_expiry) <NEW_LINE> redirect_uri = models.CharField(max_...
Default grant implementation. A grant is a code that can be swapped for an access token. Grants have a limited lifetime as defined by :attr:`provider.constants.EXPIRE_CODE_DELTA` and outlined in :rfc:`4.1.2` Expected fields: * :attr:`user` * :attr:`client` - :class:`Client` * :attr:`code` * :attr:`expires` - :attr:`d...
625990804f6381625f19a204
class Solution: <NEW_LINE> <INDENT> def intToRoman(self, num: int) -> str: <NEW_LINE> <INDENT> symbols = {1: "I", 5: "V", 10: "X", 50: "L", 100: "C", 500: "D", 1000: "M"} <NEW_LINE> ans = "" <NEW_LINE> for val in [1000, 100, 10, 1]: <NEW_LINE> <INDENT> i = num // val <NEW_LINE> if i > 0: <NEW_LINE> <INDENT> if i == 4: ...
check through 1000, 100, 10, 1. if > 9, insert "I"+Roman(val*10); if > 4 but < 5, insert "I"+Roman(val*5) if >= 5 but < 9, insert Roman(val*5) + "I"/"II"/"III"
625990805fcc89381b266eb2
class UnnormalizedMeasure(UnnormalizedCutoffMeasure): <NEW_LINE> <INDENT> thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") <NEW_LINE> __repr__ = _swig_repr <NEW_LINE> def __init__(self, *args): <NEW_LINE> <INDENT> _nsubjettiness.UnnormalizedMeasure_swiginit(self, _nsubje...
Proxy of C++ fastjet::contrib::UnnormalizedMeasure class.
62599080ec188e330fdfa356
class IDLE(Operation): <NEW_LINE> <INDENT> NAME = "IDLE" <NEW_LINE> def __init__(self, cycles): <NEW_LINE> <INDENT> self.cycles = cycles <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return "%s %d cycles" % (self.NAME, self.cycles) <NEW_LINE> <DEDENT> def as_bytes(self): <NEW_LINE> <INDENT> if not (IDLE_MI...
Idle operation Attributes: cycles (int): Number of FPGA cycles to idle.
6259908023849d37ff852b65
class ChartDelegate(CustomDelegate): <NEW_LINE> <INDENT> editor = ChartEditor <NEW_LINE> def __init__(self, parent=None, **kwargs): <NEW_LINE> <INDENT> super(ChartDelegate, self).__init__(parent) <NEW_LINE> <DEDENT> def setModelData(self, editor, model, index): <NEW_LINE> <INDENT> pass
Custom delegate for Matplotlib charts
62599080a05bb46b3848be7e
class Url: <NEW_LINE> <INDENT> def __init__(self , url , visitedTime = 1): <NEW_LINE> <INDENT> self.url = url <NEW_LINE> self.visitedTime = visitedTime <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return "[Url:url=" + self.url + ",visitedTime=" + self.visitedTime + "]" <NEW_LINE> <DEDENT> __repr__ = __str...
A url class to describe a url
625990805166f23b2e244e84
class TimeStamped(models.Model): <NEW_LINE> <INDENT> created = models.DateTimeField(auto_now_add=True) <NEW_LINE> updated = models.DateTimeField(auto_now=True) <NEW_LINE> objects = managers.CustomModelManager() <NEW_LINE> class Meta: <NEW_LINE> <INDENT> abstract = True
TimeStamped Model Definition
625990803317a56b869bf29c
class PubsubProjectsSubscriptionsTestIamPermissionsRequest(_messages.Message): <NEW_LINE> <INDENT> resource = _messages.StringField(1, required=True) <NEW_LINE> testIamPermissionsRequest = _messages.MessageField('TestIamPermissionsRequest', 2)
A PubsubProjectsSubscriptionsTestIamPermissionsRequest object. Fields: resource: REQUIRED: The resource for which policy detail is being requested. Resource is usually specified as a path, such as, projects/{project}. testIamPermissionsRequest: A TestIamPermissionsRequest resource to be passed as the r...
6259908076e4537e8c3f102b
class TcpipPluginMixin(object): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def args(cls, parser): <NEW_LINE> <INDENT> super(TcpipPluginMixin, cls).args(parser) <NEW_LINE> parser.add_argument("--tcpip_guid", default=None, help="Force this profile to be used for tcpip.") <NEW_LINE> <DEDENT> def __init__(self, tcpip_guid...
A mixin for plugins that want to use tcpip.sys profiles.
625990804527f215b58eb6f6
class MyGame(arcade.Window): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super().__init__(SCREEN_WIDTH, SCREEN_HEIGHT, "Sprite Example") <NEW_LINE> self.player_list = None <NEW_LINE> self.coin_list = None <NEW_LINE> self.player_sprite = None <NEW_LINE> self.score = 0 <NEW_LINE> self.set_mouse_visible(Fa...
Our custom Window Class
6259908044b2445a339b76b3
class JSONEncoder(json.JSONEncoder): <NEW_LINE> <INDENT> def default(self, obj): <NEW_LINE> <INDENT> if isinstance(obj, Promise): <NEW_LINE> <INDENT> return force_text(obj) <NEW_LINE> <DEDENT> elif isinstance(obj, datetime.datetime): <NEW_LINE> <INDENT> representation = obj.isoformat() <NEW_LINE> if obj.microsecond: <N...
JSONEncoder subclass that knows how to encode date/time/timedelta, decimal types, generators and other basic python objects. Taken from https://github.com/tomchristie/django-rest-framework/blob/master/rest_framework/utils/encoders.py
625990803346ee7daa3383b8
class OnesWeightInitializer(WeightInitializer): <NEW_LINE> <INDENT> def init(self, dimension: Tuple) -> Tensor: <NEW_LINE> <INDENT> return np.ones(dimension)
Initializes a Tensor with all ones. Example:: weight_init = OnesWeightInitializer() w = weight_init.init((10, 20))
62599080fff4ab517ebcf2c4
class ShowIpOspfDatabaseRouterSchema(MetaParser): <NEW_LINE> <INDENT> schema = { 'vrf': {Any(): {'address_family': {Any(): {'instance': {Any(): {Optional('areas'): {Any(): {'database': {'lsa_types': {Any(): {'lsa_type': int, 'lsas': {Any(): {'lsa_id': str, 'adv_router': str, 'ospfv2': {'header': {'option': str, 'option...
Schema for: * show ip ospf database router'
625990804428ac0f6e659fdc
class City(object): <NEW_LINE> <INDENT> def __init__(self, areaName=None, country=None, region=None, weatherUrl=None, latitude=None, longitude=None, population=None): <NEW_LINE> <INDENT> self.areaName = areaName <NEW_LINE> self.country = country <NEW_LINE> self.region = region <NEW_LINE> self.weatherUrl = weatherUrl <N...
Describe City object according to real city
62599080283ffb24f3cf534e
class Range(BaseMetadataObject): <NEW_LINE> <INDENT> _type = "sc:Range" <NEW_LINE> _uri_segment = "range/" <NEW_LINE> _required = ["@id", "label", "canvases"] <NEW_LINE> _warn = [] <NEW_LINE> canvases = [] <NEW_LINE> def __init__(self, factory, ident="", label="", mdhash={}): <NEW_LINE> <INDENT> super(Range, self).__in...
Range object in Presentation API.
62599080ec188e330fdfa358
class TestUpgrade(BaseTestCase): <NEW_LINE> <INDENT> def test_to1010_available(self): <NEW_LINE> <INDENT> upgradeSteps = listUpgradeSteps(self.st, self.profile, '1000') <NEW_LINE> step = [step for step in upgradeSteps if (step[0]['dest'] == ('1010',)) and (step[0]['source'] == ('1000',))] <NEW_LINE> self.assertEqual(le...
Ensure product upgrades work.
62599080796e427e53850228
class NucleicAcidMethods(unittest.TestCase): <NEW_LINE> <INDENT> def test_complement(self): <NEW_LINE> <INDENT> foo = NucleicAcid('ACTG') <NEW_LINE> foo2 = 'TGAC' <NEW_LINE> self.assertEqual(foo.complement(), foo2) <NEW_LINE> <DEDENT> def test_codon(self): <NEW_LINE> <INDENT> foo = NucleicAcid('GGTGCG') <NEW_LINE> foo2...
Test NucleicAcid methods
62599080091ae356687066ed
@abstract <NEW_LINE> class DataRenderer(Renderer): <NEW_LINE> <INDENT> pass
An abstract base class for data renderer types (e.g. ``GlyphRenderer``, ``TileRenderer``).
625990807d847024c075de8b
class SocialServicesDetailsForm(NannyForm): <NEW_LINE> <INDENT> error_summary_title = "There was a problem" <NEW_LINE> error_summary_template_name = "standard-error-summary.html" <NEW_LINE> auto_replace_widgets = True <NEW_LINE> social_services_details = forms.CharField( widget=forms.Textarea(), label="Give details of ...
GOV.UK form for the social services details page
6259908092d797404e3898b3
@six.add_metaclass(ABCMeta) <NEW_LINE> class IconFontDownloader(object): <NEW_LINE> <INDENT> css_path = None <NEW_LINE> ttf_path = None <NEW_LINE> @property <NEW_LINE> def css_url(self): <NEW_LINE> <INDENT> raise NotImplementedError <NEW_LINE> <DEDENT> @property <NEW_LINE> def ttf_url(self): <NEW_LINE> <INDENT> raise N...
Abstract class for downloading icon font CSS and TTF files
6259908097e22403b383c9ae
class EmsRoutingGetIterKeyTd(NetAppObject): <NEW_LINE> <INDENT> _key_0 = None <NEW_LINE> @property <NEW_LINE> def key_0(self): <NEW_LINE> <INDENT> return self._key_0 <NEW_LINE> <DEDENT> @key_0.setter <NEW_LINE> def key_0(self, val): <NEW_LINE> <INDENT> if val != None: <NEW_LINE> <INDENT> self.validate('key_0', val) <NE...
Key typedef for table ems_definition
62599080dc8b845886d55068
class ColossusApi(BasicAPIClient): <NEW_LINE> <INDENT> pagination_param_names = ("page",) <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> super(ColossusApi, self).__init__( os.environ.get("COLOSSUS_API_URL", COLOSSUS_API_URL), username=os.environ.get("COLOSSUS_API_USERNAME"), password=os.environ.get("COLOSSUS_API_PA...
Colossus API class.
62599080656771135c48ad87
class BehanceOAuth2(BaseOAuth2): <NEW_LINE> <INDENT> name = 'behance' <NEW_LINE> AUTHORIZATION_URL = 'https://www.behance.net/v2/oauth/authenticate' <NEW_LINE> ACCESS_TOKEN_URL = 'https://www.behance.net/v2/oauth/token' <NEW_LINE> ACCESS_TOKEN_METHOD = 'POST' <NEW_LINE> SCOPE_SEPARATOR = '|' <NEW_LINE> EXTRA_DATA = [('...
Behance OAuth authentication backend
62599080ad47b63b2c5a92ff
@final <NEW_LINE> class FadeoutMusicAction(EventAction[FadeoutMusicActionParameters]): <NEW_LINE> <INDENT> name = "fadeout_music" <NEW_LINE> param_class = FadeoutMusicActionParameters <NEW_LINE> def start(self) -> None: <NEW_LINE> <INDENT> time = self.parameters.duration <NEW_LINE> mixer.music.fadeout(time) <NEW_LINE> ...
Fade out the music over a set amount of time in milliseconds. Script usage: .. code-block:: fadeout_music <duration> Script parameters: duration: Number of milliseconds to fade out the music over.
62599080099cdd3c63676151
class PhantomDataTransferServer(socketserver.ThreadingTCPServer, DataTransferServer): <NEW_LINE> <INDENT> def __init__(self, ip, port, fmt, handler_class=PhantomDataTransferHandler): <NEW_LINE> <INDENT> DataTransferServer.__init__(self, ip, port, fmt, handler_class) <NEW_LINE> socketserver.ThreadingTCPServer.__init__(s...
This is a threaded server, that is being started, by the main phantom control instance, the PhantomSocket. It listens for incoming connections FROM the phantom camera, because over these secondary channels the camera transmits the raw byte data. The way it works: The main program execution maintains a reference to thi...
62599080fff4ab517ebcf2c7
class Meta(element.Element): <NEW_LINE> <INDENT> resource_type = "Meta" <NEW_LINE> def __init__(self, jsondict=None, strict=True): <NEW_LINE> <INDENT> self.lastUpdated = None <NEW_LINE> self.profile = None <NEW_LINE> self.security = None <NEW_LINE> self.source = None <NEW_LINE> self.tag = None <NEW_LINE> self.versionId...
Metadata about a resource. The metadata about a resource. This is content in the resource that is maintained by the infrastructure. Changes to the content might not always be associated with version changes to the resource.
6259908097e22403b383c9af
class ThreathunterJsonParser(BaseParser): <NEW_LINE> <INDENT> def __init__(self, name): <NEW_LINE> <INDENT> self.name = name or "" <NEW_LINE> <DEDENT> def parse(self, data): <NEW_LINE> <INDENT> if not data: <NEW_LINE> <INDENT> return {} <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> result = json.loads(data) <NEW_LINE> i...
Parse config from json with threathunter format. Threathunter api uses special json format.
625990804f6381625f19a206
class WussStructureInitTests(StructureStringInitTests): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.Struct = WussStructure <NEW_LINE> self.Empty = '' <NEW_LINE> self.NoPairs = '__--_' <NEW_LINE> self.OneHelix = '[{(<()>)}]' <NEW_LINE> self.ManyHelices = '<,,(({___})~((:((({{__}}),))),,<<[(__)]>>)):::>...
Test for initializing WussStructures
62599080be7bc26dc9252bad
class TemplateParameters(ASTNode): <NEW_LINE> <INDENT> positional = List(PositionalParameter) <NEW_LINE> keywords = List(KeywordParameter) <NEW_LINE> starparam = Str()
An AST node for template parameters.
6259908066673b3332c31eaf
class CompanyCreateView(LoginRequiredMixin, CreateView): <NEW_LINE> <INDENT> model = Company <NEW_LINE> template_name = 'add_or_update_company.html' <NEW_LINE> form_class = CompanyForm <NEW_LINE> success_url = reverse_lazy('companies') <NEW_LINE> def form_valid(self, form): <NEW_LINE> <INDENT> form.instance.added_by = ...
This view is responsible for adding companies.
625990805fdd1c0f98e5fa2f
class ZookeeperTest(unittest.TestCase): <NEW_LINE> <INDENT> @mock.patch('builtins.open', create=True) <NEW_LINE> def test_zookeeper_configuration_script_data(self, open_mock): <NEW_LINE> <INDENT> config = configuration.Zookeeper( hostname='zookeeper', ldap_hostname='ldap_host', ipa_server_hostname='ipa_server_hostname'...
Tests zookeeper configuration
625990804f88993c371f127a
class V1beta3_PodList(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.swaggerTypes = { 'apiVersion': 'str', 'items': 'list[V1beta3_Pod]', 'kind': 'str', 'resourceVersion': 'str', 'selfLink': 'str' } <NEW_LINE> self.attributeMap = { 'apiVersion': 'apiVersion', 'items': 'items', 'kind': 'kind', ...
NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
62599080d268445f2663a8b6
class VirtualDiskAdapterTypeTest(test.TestCase): <NEW_LINE> <INDENT> def test_is_valid(self): <NEW_LINE> <INDENT> self.assertTrue(volumeops.VirtualDiskAdapterType.is_valid("lsiLogic")) <NEW_LINE> self.assertTrue(volumeops.VirtualDiskAdapterType.is_valid("busLogic")) <NEW_LINE> self.assertTrue(volumeops.VirtualDiskAdapt...
Unit tests for VirtualDiskAdapterType.
625990807d847024c075de8d
class LoginForm(Form): <NEW_LINE> <INDENT> email = StringField("Email", validators = [DataRequired()]) <NEW_LINE> password = PasswordField("Password", validators = [DataRequired()]) <NEW_LINE> submit = SubmitField('Submit')
form template for login in
6259908055399d3f05627fc5
class TestReleaseApi(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.api = swagger_client.apis.release_api.ReleaseApi() <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def test_create(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def test_dele...
ReleaseApi unit test stubs
6259908063b5f9789fe86c1a
class TestQuickSort(unittest.TestCase): <NEW_LINE> <INDENT> def test_base_case(self): <NEW_LINE> <INDENT> B = [1] <NEW_LINE> self.assertEqual(B, qS.quickSort(B, 0, 0)) <NEW_LINE> <DEDENT> def test_array_of_length_5(self): <NEW_LINE> <INDENT> D = [3, 5, 4, 1, 2] <NEW_LINE> DPrime = [1, 2, 3, 4, 5] <NEW_LINE> self.a...
Unit test quickSort subroutine.
62599080796e427e5385022c
class Map(SchemaField): <NEW_LINE> <INDENT> def __init__(self, target_name=None, converter=None, key_converter=converters.ToJsonString, value_converter=converters.ToJsonString): <NEW_LINE> <INDENT> super(Map, self).__init__(target_name, converter) <NEW_LINE> self.key_converter = key_converter <NEW_LINE> self.value_conv...
Represents a leaf node where the value itself is a map. Expected input type: Dictionary Output type: Dictionary
62599080f548e778e596d044
class ParseError(Error): <NEW_LINE> <INDENT> pass
Error that is raised when value data cannot be parsed.
625990802c8b7c6e89bd5297
class CTD_ANON_11 (structLinkType): <NEW_LINE> <INDENT> _TypeDefinition = None <NEW_LINE> _ContentTypeTag = pyxb.binding.basis.complexTypeDefinition._CT_ELEMENT_ONLY <NEW_LINE> _Abstract = False <NEW_LINE> _ExpandedName = None <NEW_LINE> _XSDLocation = pyxb.utils.utility.Location('/home/claudio/Applications/eudat/b2saf...
The structural link section element <structLink> allows for the specification of hyperlinks between the different components of a METS structure that are delineated in a structural map. This element is a container for a single, repeatable element, <smLink> which indicates a hyperlink between two nodes in the structural...
62599080442bda511e95dab0
class Consumer(object): <NEW_LINE> <INDENT> @remote <NEW_LINE> def unregister(self): <NEW_LINE> <INDENT> log.info('Consumer has been unregistered. ' 'Katello agent will no longer function until ' 'this system is reregistered.')
When a consumer is unregistered, Katello notifies the goferd.
625990808a349b6b43687d10
class BinariesCriteria(object): <NEW_LINE> <INDENT> def __eq__(self, other): <NEW_LINE> <INDENT> self_dict = copy.copy(self.__dict__) <NEW_LINE> self_dict['hash'] = None <NEW_LINE> other_dict = copy.copy(other.__dict__) <NEW_LINE> other_dict['hash'] = None <NEW_LINE> return (isinstance(other, self.__class__) and self_d...
The Criteria used for downloading a set of binaries.
62599080be7bc26dc9252baf
class AuthenticatedAndGroupMember(permissions.IsAuthenticatedOrReadOnly): <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 request.user.is_staff or obj.group in request.u...
Users can only manipulate objects belonging to their group(s).
6259908060cbc95b06365ac6
class PythonExpression(ASTNode): <NEW_LINE> <INDENT> ast = Typed(ast.Expression)
An ASTNode representing a Python expression.
6259908092d797404e3898b6
class Rotate2D(object): <NEW_LINE> <INDENT> def __init__(self, rotation, reference=None, lazy=False): <NEW_LINE> <INDENT> self.rotation = rotation <NEW_LINE> self.lazy = lazy <NEW_LINE> self.reference = reference <NEW_LINE> self.tx = tio.ANTsTransform( precision="float", dimension=2, transform_type="AffineTransform" ) ...
Create an ANTs Affine Transform with a specified level of rotation.
62599080a8370b77170f1e85
class DecoderBlock(chainer.Chain): <NEW_LINE> <INDENT> def __init__(self, in_ch=3, mid_ch=0, out_ch=13, ksize=3, stride=1, pad=1, residual=False, nobias=False, outsize=None, upsample=False, use_bn=True, use_prelu=False): <NEW_LINE> <INDENT> super(DecoderBlock, self).__init__() <NEW_LINE> self.residual = residual <NEW_L...
DecoderBlock Abstract
6259908076e4537e8c3f1033
class DiscoSNSTests(TestCase): <NEW_LINE> <INDENT> @mock_sns <NEW_LINE> def get_region(self): <NEW_LINE> <INDENT> return boto.connect_sns().region.name <NEW_LINE> <DEDENT> @mock_sns <NEW_LINE> def test_constructor(self): <NEW_LINE> <INDENT> disco_sns = DiscoSNS(account_id=ACCOUNT_ID) <NEW_LINE> self.assertIsNotNone(dis...
Test DiscoSNS class
625990802c8b7c6e89bd5299
class NotAnIntervalError(Error): <NEW_LINE> <INDENT> pass
Raised when user input string is not in valid interval form.
62599080a05bb46b3848be82
class FieldPreparationErrors(Exception, collections.Mapping): <NEW_LINE> <INDENT> def __init__(self, exceptions): <NEW_LINE> <INDENT> message = 'Setting the field{} {} failed.'.format( 's' if len(exceptions) > 1 else '', ', '.join('"{}"'.format(name) for name in exceptions) ) <NEW_LINE> Exception.__init__(self, message...
This exception is thrown if preparation of at least one field fails, when setting multiple field at once by assigning a mapping to the ``FIELDS`` attribute on a field container instance. This exception is a mapping from field names to the appropriate exception objects thrown by the :meth:`Field.prepare` calls.
62599080656771135c48ad8a
class LoginSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> token = serializers.SerializerMethodField('get_json_web_token') <NEW_LINE> class Meta: <NEW_LINE> <INDENT> model = Account <NEW_LINE> fields = ('token',) <NEW_LINE> <DEDENT> def get_json_web_token(self, obj): <NEW_LINE> <INDENT> return get_json_web...
Account Signup serializer to handle user registration.
625990804a966d76dd5f099a
class Timer(object): <NEW_LINE> <INDENT> def __init__(self, description, param=None, silent=None, verbose=None, too_long=0): <NEW_LINE> <INDENT> self.template = description <NEW_LINE> self.param = wrap(coalesce(param, {})) <NEW_LINE> self.verbose = coalesce(verbose, False if silent is True else True) <NEW_LINE> self.ag...
USAGE: with Timer("doing hard time"): something_that_takes_long() OUTPUT: doing hard time took 45.468 sec param - USED WHEN LOGGING debug - SET TO False TO DISABLE THIS TIMER
62599080aad79263cf43026f
class Workflow(resource.Resource): <NEW_LINE> <INDENT> id = wtypes.text <NEW_LINE> name = wtypes.text <NEW_LINE> namespace = wtypes.text <NEW_LINE> input = wtypes.text <NEW_LINE> definition = wtypes.text <NEW_LINE> tags = [wtypes.text] <NEW_LINE> scope = SCOPE_TYPES <NEW_LINE> project_id = wtypes.text <NEW_LINE> create...
Workflow resource.
625990804428ac0f6e659fe4
class mac_netstat(mac_tasks.mac_tasks): <NEW_LINE> <INDENT> def render_text(self, outfd, data): <NEW_LINE> <INDENT> self.table_header(outfd, [("Proto", "6"), ("Local IP", "20"), ("Local Port", "6"), ("Remote IP", "20"), ("Remote Port", "6"), ("State", "20"), ("Process", "24")]) <NEW_LINE> for proc in data: <NEW_LINE> <...
Lists active per-process network connections
625990807c178a314d78e945
class TimeWrapper: <NEW_LINE> <INDENT> warned = False <NEW_LINE> def sleep(self, *args, **kwargs): <NEW_LINE> <INDENT> if not TimeWrapper.warned: <NEW_LINE> <INDENT> TimeWrapper.warned = True <NEW_LINE> _LOGGER.warning("Using time.sleep can reduce the performance of " "Home Assistant") <NEW_LINE> <DEDENT> time.sleep(*a...
Wrapper of the time module.
62599080be7bc26dc9252bb0
class TestDemoUtilities(unittest.TestCase): <NEW_LINE> <INDENT> def test_sys_path_inserted(self): <NEW_LINE> <INDENT> path = os.path.join("dirname", "file.py") <NEW_LINE> with demo_path(path): <NEW_LINE> <INDENT> self.assertIn("dirname", sys.path) <NEW_LINE> <DEDENT> self.assertNotIn("dirname", sys.path)
Test utility functions in the _demo module.
6259908063b5f9789fe86c1e
class ScaleImage(BrowserView): <NEW_LINE> <INDENT> def update(self): <NEW_LINE> <INDENT> self.params = self.request.form <NEW_LINE> self.path = self.params.get('path', []) <NEW_LINE> if self.path: <NEW_LINE> <INDENT> self.path = self.path.split(';') <NEW_LINE> <DEDENT> self.uid = self.params.get('uid', []) <NEW_LINE> i...
Returns JSON with resized image information
625990804c3428357761bd70
class Customer(models.Model): <NEW_LINE> <INDENT> app = models.ForeignKey(Application, verbose_name=_('Application'), help_text=_('The application that holds this customer record')) <NEW_LINE> name = models.CharField(_('İsim'), max_length=100, help_text=_('Name of the customer')) <NEW_LINE> mail = models.CharField(_('E...
musteri kayitlari
625990807d847024c075de93
class Route(A10BaseClass): <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> self.ERROR_MSG = "" <NEW_LINE> self.b_key = "route" <NEW_LINE> self.DeviceProxy = "" <NEW_LINE> self.ipv6_destination_cfg = [] <NEW_LINE> self.ip_destination_cfg = [] <NEW_LINE> for keys, value in kwargs.items(): <NEW_LINE>...
This class does not support CRUD Operations please use parent. :param ipv6_destination_cfg: {"minItems": 1, "items": {"type": "object"}, "uniqueItems": true, "type": "array", "array": [{"properties": {"distance": {"description": "Route's administrative distance (default: match any)", "minimum": 1, "type": "number", "m...
6259908023849d37ff852b6f
class CancelScriptWatcher(bpy.types.Operator): <NEW_LINE> <INDENT> bl_idname = "wm.sw_watch_end" <NEW_LINE> bl_label = "Stop Watching" <NEW_LINE> def execute(self, context): <NEW_LINE> <INDENT> context.scene.sw_settings.running = False <NEW_LINE> return {'FINISHED'}
Sets a flag which tells the modal to cancel itself.
625990803d592f4c4edbc8ba
@freeze_time("2010-10-10 00:00:00") <NEW_LINE> class BaseBallotVoteTestCase(TestCase): <NEW_LINE> <INDENT> urls = 'django_elect.tests.urls' <NEW_LINE> def run(self, result=None): <NEW_LINE> <INDENT> if not hasattr(self, "ballot_type"): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> return super(BaseBallotVoteTestCase, ...
Base class for testing the vote() view using specific ballots
62599080d268445f2663a8b9
class BayeuxChannel(object): <NEW_LINE> <INDENT> __slots__ = ('name', '_clients', '_subchannels') <NEW_LINE> def __init__(self, name): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self._clients = [] <NEW_LINE> self._subchannels = {} <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> return '<BayeuxChannel n...
Represents a Bayeux channel and operations on it.
62599080f548e778e596d048
class Scheduler(_object): <NEW_LINE> <INDENT> __swig_setmethods__ = {} <NEW_LINE> __setattr__ = lambda self, name, value: _swig_setattr(self, Scheduler, name, value) <NEW_LINE> __swig_getmethods__ = {} <NEW_LINE> __getattr__ = lambda self, name: _swig_getattr(self, Scheduler, name) <NEW_LINE> def __init__(self, *args, ...
Proxy of C++ YACS::ENGINE::Scheduler class
62599080f548e778e596d049
class LoginMainWindow(base_frame_view.BaseFrameView): <NEW_LINE> <INDENT> def __init__(self, parent): <NEW_LINE> <INDENT> super(LoginMainWindow, self).__init__(parent) <NEW_LINE> <DEDENT> @property <NEW_LINE> def account_field(self): <NEW_LINE> <INDENT> return text_field.UIATextField(self.parent, type='UIATextField') <...
Summary: 登陆活动页 Attributes: parent: 该活动页的父亲framework
62599080be7bc26dc9252bb1
@six.add_metaclass(abc.ABCMeta) <NEW_LINE> class _ShareHandler(object): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def setup_instance(cls, remote): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def create_from_id(cls, share_id, client): <NEW_LINE> <INDENT> share = manila.get_share(client, share_...
Handles mounting of a single share to any number of instances.
625990805fdd1c0f98e5fa37
class ValiFilteredSelectMultiple(FilteredSelectMultiple): <NEW_LINE> <INDENT> def get_context(self, name, value, attrs): <NEW_LINE> <INDENT> context = super(ValiFilteredSelectMultiple, self).get_context(name, value, attrs) <NEW_LINE> context['widget']['attrs']['class'] = 'selectfilter' <NEW_LINE> if self.is_stacked: <N...
customize FilteredSelectMultiple, not used for now
625990804c3428357761bd72
class Info(mlbgame.object.Object): <NEW_LINE> <INDENT> def nice_output(self): <NEW_LINE> <INDENT> return '{0} ({1})'.format(self.club_full_name, self.club.upper()) <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return self.nice_output()
Holds information about the league or teams Properties: club club_common_name club_common_url club_full_name club_id club_spanish_name dc_site display_code division es_track_code esp_common_name esp_common_url facebook facebook_es fanphotos_url fb_app_id field google_tag_manager googleplus_id historical_team_code id i...
625990802c8b7c6e89bd529d
class Expect(object): <NEW_LINE> <INDENT> def __init__(self, actual_data): <NEW_LINE> <INDENT> self.actual_data = actual_data <NEW_LINE> self.negate = False <NEW_LINE> <DEDENT> def not_(self): <NEW_LINE> <INDENT> self.negate = True <NEW_LINE> return self <NEW_LINE> <DEDENT> def to_be(self, expected_data): <NEW_LINE> <I...
A class for making assertions on data.
625990807b180e01f3e49dc1
class Main: <NEW_LINE> <INDENT> def __init__(self) -> None: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.config() <NEW_LINE> sys.exit(self.run()) <NEW_LINE> <DEDENT> except (EOFError, KeyboardInterrupt): <NEW_LINE> <INDENT> sys.exit(114) <NEW_LINE> <DEDENT> except SystemExit as exception: <NEW_LINE> <INDENT> sys.e...
Main class
62599080e1aae11d1e7cf56e
class StringCompressTest(unittest.TestCase): <NEW_LINE> <INDENT> data = [('aabbb', 'a2b3'), ('aabbccaa', 'aabbccaa'), ('', None), ('a', 'a'), (None, None)] <NEW_LINE> def test_compress_string(self): <NEW_LINE> <INDENT> for inp_string, output in self.data: <NEW_LINE> <INDENT> self.assertEqual(output, compress(inp_string...
Test Cases for compressing the strings
62599080dc8b845886d55072
class Visualizer(): <NEW_LINE> <INDENT> def __init__(self, root, name, subdir_label='img_label'): <NEW_LINE> <INDENT> self.img_label_path = os.path.join(root, name, subdir_label) <NEW_LINE> <DEDENT> def save_img(self, fn, img_label): <NEW_LINE> <INDENT> assert isinstance(img_label, ndarray) <NEW_LINE> self.save_fp = os...
此 class 用来存储所有图像, 图像内容共有如下 X 个: 1. img_origin 2. img_label '.png' Draw_Label-master | |__ dataset (saveroot = 'Draw_Label-master//dataset') | |__ 恶性 ( name = '恶性') | | |__ img_origin (sub_dir_origin = 'img_origin') | | |__ img_label (sub_dir_label = 'img_label) | |__ 良性 | | |__ img_origin | ...
6259908044b2445a339b76b9
class MaccabiGamesGoalsTiming(object): <NEW_LINE> <INDENT> def __init__(self, maccabi_games_stats: MaccabiGamesStats): <NEW_LINE> <INDENT> self.maccabi_games_stats = maccabi_games_stats <NEW_LINE> self.games = maccabi_games_stats.games <NEW_LINE> <DEDENT> def fastest_two_goals(self, top_games_number=_TOP_GAMES_NUMBER) ...
This class will handle all goals timing statistics.
625990805fc7496912d48fc7
class _FakeUrllib2Request(object): <NEW_LINE> <INDENT> def __init__(self, uri): <NEW_LINE> <INDENT> self.uri = uri <NEW_LINE> self.headers = Headers() <NEW_LINE> self.type, rest = splittype(self.uri.decode('charmap')) <NEW_LINE> self.host, rest = splithost(rest) <NEW_LINE> <DEDENT> def has_header(self, header): <NEW_LI...
A fake C{urllib2.Request} object for C{cookielib} to work with. @see: U{http://docs.python.org/library/urllib2.html#request-objects} @type uri: C{str} @ivar uri: Request URI. @type headers: L{twisted.web.http_headers.Headers} @ivar headers: Request headers. @type type: C{str} @ivar type: The scheme of the URI. @ty...
62599080f548e778e596d04b
class DayLogAnalyze(Base): <NEW_LINE> <INDENT> __tablename__ = "DayLogAnalyze" <NEW_LINE> id = Column(Integer , nullable = False , primary_key = True) <NEW_LINE> date = Column(LONGTEXT , nullable = False) <NEW_LINE> api_order = Column(LONGT...
每日日志重要信息记录
62599080fff4ab517ebcf2d1
class DemoApp(wx.App): <NEW_LINE> <INDENT> ASPECT_RATIOS = [(4, 3), (16, 8)] <NEW_LINE> def OnRadioSelect(self, event): <NEW_LINE> <INDENT> aspect_ratio = self.ASPECT_RATIOS[event.GetInt()] <NEW_LINE> self.render_window_panel.aspect_ratio = aspect_ratio <NEW_LINE> <DEDENT> def OnInit(self): <NEW_LINE> <INDENT> frame = ...
Demonstrative application.
62599080aad79263cf430273
class GuaraniPresence(models.Model): <NEW_LINE> <INDENT> presence = models.BooleanField(_('Indigenous Presence')) <NEW_LINE> date = models.DateField(_('Date')) <NEW_LINE> source = models.CharField(_('Source'), max_length=512) <NEW_LINE> village = models.ForeignKey( IndigenousVillage, verbose_name=_('Village'), related_...
We have been asked to rename all Guarani Presence fields to Indigenous Presence. So, changed on the presentation - the backend stays the same
625990801f5feb6acb1646b3
class ParserState: <NEW_LINE> <INDENT> NORMAL = 1 <NEW_LINE> COMMA = 2 <NEW_LINE> STRING = 3 <NEW_LINE> STRING_ESCAPE = 4
A namespace for an enumeration.
6259908092d797404e3898b9
class AcornChildrenSource(BaseAcornSource): <NEW_LINE> <INDENT> def create_default(self, name, obj): <NEW_LINE> <INDENT> setattr(obj, name, []) <NEW_LINE> <DEDENT> def fromxml(self, name, obj, xml_el): <NEW_LINE> <INDENT> child_cls = self.meta['type'] <NEW_LINE> child_tag = child_cls.xml_tag <NEW_LINE> children_objs = ...
Load a series of objects from the direct children (children's children are ignored). .. code-block:: XML <person> <weapon type='sword'/> <weapon type='bow'/> <weapon type='dirk'/> </person> .. code-block:: python class Weapon(Acorn): ... class Person(Acorn): x...
62599080a8370b77170f1e8b
class Node: <NEW_LINE> <INDENT> def __init__(self, info): <NEW_LINE> <INDENT> self.info = info <NEW_LINE> <DEDENT> def visit(self, visitor): <NEW_LINE> <INDENT> return visitor(self) <NEW_LINE> <DEDENT> def toBB(self, Labellist, cBB): <NEW_LINE> <INDENT> raise NotImplementedError('%s' % self.__class__) <NEW_LINE> <DEDEN...
Base class for all nodes in AST. All methods raise exceptions to ensure proper derivation.
625990804527f215b58eb6fd
class Solution: <NEW_LINE> <INDENT> def lastPosition(self, nums, target): <NEW_LINE> <INDENT> if not nums: <NEW_LINE> <INDENT> return -1 <NEW_LINE> <DEDENT> start, end = 0, len(nums) -1 <NEW_LINE> while(start + 1 < end): <NEW_LINE> <INDENT> mid = int( (start + end) / 2 ) <NEW_LINE> if nums[mid] == target: <NEW_LINE> <I...
@param nums: An integer array sorted in ascending order @param target: An integer @return: An integer
62599080f548e778e596d04c
class TagasaurisUnauthorizedException(TagasaurisApiException): <NEW_LINE> <INDENT> pass
Not authorized to Tagasauris.
62599080656771135c48ad8d
class MyInt(type): <NEW_LINE> <INDENT> def __call__(cls, *args, **kwargs): <NEW_LINE> <INDENT> print("-- 내가 정의한 int 클래스 -- ", args) <NEW_LINE> return type.__call__(cls, *args, **kwargs)
커스텀 Int 클래스. __call__ 매직메서드는 객체가 초기화 될때 수행할 메서드임.
62599080e1aae11d1e7cf56f
class NASPool(Base): <NEW_LINE> <INDENT> __tablename__ = 'nas_pools' <NEW_LINE> __table_args__ = ( Comment('NAS IP pools'), Index('nas_pools_u_linkage', 'nasid', 'poolid', unique=True), Index('nas_pools_i_poolid', 'poolid'), { 'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8', 'info': { 'cap_menu': 'BASE...
NAS IP Pools
62599080ad47b63b2c5a930b
class OrderItem(models.Model): <NEW_LINE> <INDENT> order = models.ForeignKey(Order, related_name='items') <NEW_LINE> product = models.ForeignKey('catalog.Product') <NEW_LINE> price = models.DecimalField(max_digits=9, decimal_places=2, help_text='Unit price of the product') <NEW_LINE> quantity = models.IntegerField() <N...
Represents a purchase product
625990805fc7496912d48fc8
class AdaptorEthAdvFilterProfile(ManagedObject): <NEW_LINE> <INDENT> consts = AdaptorEthAdvFilterProfileConsts() <NEW_LINE> naming_props = set([]) <NEW_LINE> mo_meta = MoMeta("AdaptorEthAdvFilterProfile", "adaptorEthAdvFilterProfile", "eth-adv-filter", VersionMeta.Version151a, "InputOutput", 0x1f, [], ["admin", "ls-con...
This is AdaptorEthAdvFilterProfile class.
62599080f9cc0f698b1c6029
class CASAuth(BaseAuth): <NEW_LINE> <INDENT> name = 'CAS' <NEW_LINE> login_inputs = ['username', 'password'] <NEW_LINE> logout_possible = True <NEW_LINE> def __init__(self, auth_server, login_path="/login", logout_path="/logout", validate_path="/validate"): <NEW_LINE> <INDENT> BaseAuth.__init__(self) <NEW_LINE> self.ca...
handle login from CAS
625990805fdd1c0f98e5fa3a
class CreateTemplateCommand(CreateModelCommand): <NEW_LINE> <INDENT> @property <NEW_LINE> def short_name(self): <NEW_LINE> <INDENT> return 'create-model-template' <NEW_LINE> <DEDENT> def add_args(self, parser): <NEW_LINE> <INDENT> parser.add_argument( 'template_name', help="Template name", type=str, ) <NEW_LINE> parser...
Create a new model template.
62599080099cdd3c63676157
class ReplStringifier( FreeVarStringifier, ListStringifier, LitNormalStringifier ): <NEW_LINE> <INDENT> pass
A stringifier for REPL output. This translates free variables into identifiers _a, _b, etc. and represents literals in the usual, human-readable, way.
62599080442bda511e95dab4
class ValidationError(ClientError): <NEW_LINE> <INDENT> pass
Base validation error.
625990808a349b6b43687d18