code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class MaryTTSPlugin(plugin.TTSPlugin): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> plugin.TTSPlugin.__init__(self, *args, **kwargs) <NEW_LINE> self._logger = logging.getLogger(__name__) <NEW_LINE> try: <NEW_LINE> <INDENT> server = self.profile['mary-tts']['server'] <NEW_LINE> <DEDENT> e... | Uses the MARY Text-to-Speech System (MaryTTS)
MaryTTS is an open-source, multilingual Text-to-Speech Synthesis platform
written in Java.
Please specify your own server instead of using the demonstration server
(http://mary.dfki.de:59125/) to save bandwidth and to protect your privacy. | 62598f8c29b78933be269eb2 |
class TestStudent(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.student = Student("some_student_id") <NEW_LINE> <DEDENT> def test_student_obj(self): <NEW_LINE> <INDENT> self.assertTrue(len(self.student.get_db_indices()) == 0) <NEW_LINE> self.student.add_db_index(1) <NEW_LINE> self.as... | Tests for Student. | 62598f8c3617ad0b5ee05cf3 |
class BaseError(Exception): <NEW_LINE> <INDENT> def __init__(self, code, error): <NEW_LINE> <INDENT> pass | The base class for all errors. | 62598f8cfb3f5b602db47f88 |
class AutotoolsBuild(Build): <NEW_LINE> <INDENT> __metaclass__ = ABCMeta <NEW_LINE> def configure(self, log): <NEW_LINE> <INDENT> configure = [ os.path.join(getcwd(), "configure"), "CXX=%s" % self.config.cxx, ] <NEW_LINE> if self.config.stdlib == '': <NEW_LINE> <INDENT> configure += [ "CXXFLAGS=%s" % self.config.opt, ]... | Build using the "configure" script. | 62598f8c4e696a045264dbdc |
class SectionsInfo(dict): <NEW_LINE> <INDENT> __info = collections.namedtuple("__info", "filename content") <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> self.sections = dict() <NEW_LINE> <DEDENT> def add_sections_info(self, sections_info_file): <NEW_LINE> <INDENT> first_line = sections_info_file.readline() <NEW_L... | Encapsulates an output of objdump. Contains information about the static library sections
and names | 62598f8cb830903b9686e249 |
class Driver(VISA_Driver): <NEW_LINE> <INDENT> def performOpen(self, options={}): <NEW_LINE> <INDENT> if not hasattr(self, 'write_raw'): <NEW_LINE> <INDENT> self.write_raw = self.write <NEW_LINE> <DEDENT> VISA_Driver.performOpen(self, options) <NEW_LINE> self.write('SOUR1:DATA:VOL:CLE') <NEW_LINE> self.write('SOUR2:DAT... | This class implements the Keysight 33622A AWG | 62598f8c71ff763f4b5e731f |
class SplitterSample(Form): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.Text = "Vertical Splitter" <NEW_LINE> self.treeView1 = TreeView() <NEW_LINE> self.button1 = Button() <NEW_LINE> self.splitter1 = Splitter() <NEW_LINE> self.treeView1.Dock = DockStyle.Left; <NEW_LINE> self.splitter1.Dock = DockS... | Splitter control class | 62598f8c0383005118f6d2a8 |
class BingoCage(): <NEW_LINE> <INDENT> def __init__(self, items): <NEW_LINE> <INDENT> self._items = list(items) <NEW_LINE> random.shuffle(self.items) <NEW_LINE> <DEDENT> @property <NEW_LINE> def items(self): <NEW_LINE> <INDENT> return self._items <NEW_LINE> <DEDENT> def pick(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <... | Constructor takes an iterable
:param an iterable list | 62598f8c3eb6a72ae038a1e3 |
class EditArchiveSubscriber(DelegatedAuthorization): <NEW_LINE> <INDENT> permission = "launchpad.Edit" <NEW_LINE> usedfor = IArchiveSubscriber <NEW_LINE> def __init__(self, obj): <NEW_LINE> <INDENT> super(EditArchiveSubscriber, self).__init__( obj, obj.archive, 'launchpad.Append') <NEW_LINE> <DEDENT> def checkAuthentic... | Restrict editing of archive subscribers.
The user should have append privilege to the archive or be an admin. | 62598f8c656771135c48922a |
class ModList(UserList): <NEW_LINE> <INDENT> type = 'moderator' <NEW_LINE> remove_self_action = _('leave') <NEW_LINE> remove_self_title = _('you are a moderator of this subreddit. %(action)s') <NEW_LINE> remove_self_confirm = _('stop being a moderator?') <NEW_LINE> remove_self_final = _('you are no longer a moderator')... | Moderator list for a reddit. | 62598f8c30dc7b766599f407 |
class VideoPageParseError(Exception): <NEW_LINE> <INDENT> pass | Error to parse page | 62598f8c50485f2cf55dab25 |
class Team(models.Model): <NEW_LINE> <INDENT> department = models.ForeignKey(Department, on_delete=models.CASCADE, related_name="teams") <NEW_LINE> lead = models.OneToOneField(Employee, on_delete=models.CASCADE, related_name="manager") <NEW_LINE> members = models.ManyToManyField(Employee, through='Member') <NEW_LINE> a... | A Model that will hold All Teams in app
New Fields can be added later | 62598f8c6fb2d068a7693c07 |
class UserLogout(Resource): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> @jwt_required <NEW_LINE> def post(cls): <NEW_LINE> <INDENT> jti = get_raw_jwt()["jti"] <NEW_LINE> BLACKLIST.add(jti) <NEW_LINE> return {"message": "Successfully logged out."}, 200 | User Logout resource | 62598f8cec188e330fdf844e |
class TestStudy(study.Study): <NEW_LINE> <INDENT> def get_model_config(self, model_num=0): <NEW_LINE> <INDENT> return [], resources.get_file( "config/tests/methods/unsupervised/train_test.gin") <NEW_LINE> <DEDENT> def get_postprocess_config_files(self): <NEW_LINE> <INDENT> return list( resources.get_files_in_folder( "c... | Defines a study for testing. | 62598f8ceab8aa0e5d30b929 |
class TestGitReceiveOldModified(Base): <NEW_LINE> <INDENT> expected_title = "git.receive" <NEW_LINE> expected_subti = ('rbean@redhat.com pushed to datanommer (master). "Try ' 'removing requirement on python-bunch."') <NEW_LINE> expected_secondary_icon = ("http://www.gravatar.com/avatar/1a0d2acfddb191" "1ecf55da42cfa34... | Sample message from the first generation of git-category messages that
have been modified in datanommer to match the new topics. | 62598f8c009cb60464d010dc |
class Twitter: <NEW_LINE> <INDENT> def __init__(self, bot): <NEW_LINE> <INDENT> self.bot = bot <NEW_LINE> bot.register_command('socks', self.socks) <NEW_LINE> bot.register_command('twitter', self.twitter) <NEW_LINE> <DEDENT> def twitter(self, data): <NEW_LINE> <INDENT> username = data['message'].split(' ')[0] <NEW_LINE... | Grab a twitter user's latest update. Also socks (sockington) is hardcoded. | 62598f8cb57a9660fecd162d |
class TradeInfoHandler(QABaseHandler): <NEW_LINE> <INDENT> broker = QA_SPEBroker() <NEW_LINE> def funcs(self, func, account, *args, **kwargs): <NEW_LINE> <INDENT> if func == 'ping': <NEW_LINE> <INDENT> data = self.broker.query_clients() <NEW_LINE> return data <NEW_LINE> <DEDENT> elif func == 'clients': <NEW_LINE> <INDE... | trade 信息查询句柄
Arguments:
QABaseHandler {[type]} -- [description]
?func=ping ping 服务器
?func=clients 查询当前的可用客户端
?func=accounts 查询当前的账户
?func=positions&account=xxx 查询账户持仓
?func=orders&status 查询订单
下单/撤单功能不在此handler提供 | 62598f8c379a373c97d98bc5 |
class JSONRPCError(object): <NEW_LINE> <INDENT> serialize = staticmethod(json.dumps) <NEW_LINE> deserialize = staticmethod(json.loads) <NEW_LINE> def __init__(self, code=None, message=None, data=None): <NEW_LINE> <INDENT> self._data = dict() <NEW_LINE> self.code = getattr(self.__class__, "CODE", code) <NEW_LINE> self.m... | Error for JSON-RPC communication.
When a rpc call encounters an error, the Response Object MUST contain the
error member with a value that is a Object with the following members:
Parameters
----------
code: int
A Number that indicates the error type that occurred.
This MUST be an integer.
The error codes ... | 62598f8c287bf620b6271768 |
class TopDecal(DisplayList): <NEW_LINE> <INDENT> texCoords = ( (0,0), (1,0), (1,1), (0,1) ) <NEW_LINE> def set(self, box): <NEW_LINE> <INDENT> self.center = box.center <NEW_LINE> self.size = box.size <NEW_LINE> self.angle = box.angle <NEW_LINE> self.render.decal = True <NEW_LINE> <DEDENT> def drawToList(self, rstate): ... | Abstract base class for decals covering the entire top of a box | 62598f8c07d97122c4216859 |
class MemRepo: <NEW_LINE> <INDENT> def __init__(self, data): <NEW_LINE> <INDENT> self.data = data <NEW_LINE> <DEDENT> def list(self, filters=None): <NEW_LINE> <INDENT> result = [r.Room.from_dict(i) for i in self.data] <NEW_LINE> if filters is None: <NEW_LINE> <INDENT> return result <NEW_LINE> <DEDENT> if 'code__eq' in ... | docstring | 62598f8cac7a0e7691f720bb |
class MultiplicativeLSTMCell(RNNCell): <NEW_LINE> <INDENT> def __init__(self, num_units, cell_clip=None, initializer=orthogonal_initializer(), forget_bias=1.0, activation=tf.tanh): <NEW_LINE> <INDENT> self.num_units = num_units <NEW_LINE> self.cell_clip = cell_clip <NEW_LINE> self.initializer = initializer <NEW_LINE> s... | Multiplicative LSTM.
Ben Krause, Liang Lu, Iain Murray, and Steve Renals,
"Multiplicative LSTM for sequence modelling, "
in Workshop Track of ICLA 2017,
https://openreview.net/forum?id=SJCS5rXFl¬eId=SJCS5rXFl | 62598f8cd4950a0f3b110c0e |
class BigQueryExecutorGetTableClusteringFields(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.db = dw.BigQueryExecutor() <NEW_LINE> <DEDENT> def test_get_table_clustering_fields_table1(self): <NEW_LINE> <INDENT> self.db.initiate_table( dataset_id='test', table_id='table1', schema_path... | Test | 62598f8c55399d3f056260cb |
class Post(db.Model): <NEW_LINE> <INDENT> title = db.StringProperty(required=True) <NEW_LINE> content = db.TextProperty(required=True) <NEW_LINE> created = db.DateTimeProperty(auto_now_add=True) <NEW_LINE> last_modified = db.DateTimeProperty(auto_now = True) <NEW_LINE> user_id = db.IntegerProperty(required=True) <NEW_L... | Database to store blog post information | 62598f8c0a50d4780f704f80 |
class PushMetricLocal(scenario.OpenStackScenario): <NEW_LINE> <INDENT> def run(self, monitor_vip, pushgateway_port, grafana, datasource_id, job_name, sleep_time=5, retries_total=30): <NEW_LINE> <INDENT> seed = self.generate_random_name() <NEW_LINE> grafana_svc = grafana_service.GrafanaService( dict(monitor_vip=monitor_... | Test monitoring system availability with local pushing random metric. | 62598f8ccb5e8a47e493bf48 |
class HelloViewSet(viewsets.ViewSet): <NEW_LINE> <INDENT> serializer_class = serializers.HelloSerializer <NEW_LINE> def list(self, request): <NEW_LINE> <INDENT> a_viewset = [ 'Uses actions(list, create, retrieve, update, partial_update)', 'Automatically maps to URLs using views', 'provides more functionality with less ... | Test API ViewSet | 62598f8cbde94217f370743f |
class UserProfileView(RetrieveUpdateAPIView): <NEW_LINE> <INDENT> serializer_class = UserProfileSerializer <NEW_LINE> def get_object(self): <NEW_LINE> <INDENT> return self.request.user | Return user profile. Used on user settings page. Supports also updates in profile. | 62598f8ce76e3b2f99fd85e1 |
class DockerAuthzPluginTest(unittest.TestCase): <NEW_LINE> <INDENT> def test_exec_user(self): <NEW_LINE> <INDENT> plugin = plugins.DockerExecUserPlugin() <NEW_LINE> (allow, msg) = plugin.run_req( 'POST', '/v1.26/containers/bar/exec', {}, ) <NEW_LINE> self.assertTrue(allow) <NEW_LINE> (allow, msg) = plugin.run_req( 'POS... | Tests for treadmill.api.docker_authz plugin | 62598f8cb7558d58954631e5 |
class NoDBRunner(DiscoverRunner): <NEW_LINE> <INDENT> def setup_databases(self, **kwargs): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def teardown_databases(self, old_config, **kwargs): <NEW_LINE> <INDENT> pass | Test runner that does not touch the database | 62598f8c3c8af77a43b67d0f |
class ArticleViewSet(viewsets.ModelViewSet): <NEW_LINE> <INDENT> queryset = Article.objects.all() <NEW_LINE> serializer_class = ArticleSerializer <NEW_LINE> def list(self, request, *args, **kwargs): <NEW_LINE> <INDENT> def get_queryset(self): <NEW_LINE> <INDENT> tag = self.request.QUERY_PARAMS.get('tag', None) <NEW_LIN... | A simple ViewSet for viewing and editing accounts. | 62598f8c73bcbd0ca4bc9e01 |
class PostSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> id = serializers.UUIDField(format='hex', read_only=True) <NEW_LINE> replyto = serializers.PrimaryKeyRelatedField(many=True, read_only=True) <NEW_LINE> class Meta: <NEW_LINE> <INDENT> model = Post <NEW_LINE> fields = ( 'id', 'creator', 'created', 'up... | Serializer for post object | 62598f8c596a897236127828 |
class SyncError(BundleError): <NEW_LINE> <INDENT> pass | Could not sync a resource. | 62598f8c23e79379d538c0b1 |
class DirProperty(LazyProperty): <NEW_LINE> <INDENT> def __init__(self, cls, *subdir, keyfunc=str): <NEW_LINE> <INDENT> self.cls = cls <NEW_LINE> self.subdir = subdir <NEW_LINE> self.keyfunc = keyfunc <NEW_LINE> <DEDENT> def compute(self, instance): <NEW_LINE> <INDENT> base = instance.path.joinpath(*self.subdir) <NEW_L... | Ordered dict of models from a subdirectory
If ``info.yml`` is present in the subdirectory, use it for the order
of the models. The rest is appended alphabetically. | 62598f8c7cff6e4e811b55c5 |
class FixedLengthString(BaseField): <NEW_LINE> <INDENT> def __init__(self, length, **kwargs): <NEW_LINE> <INDENT> super().__init__(**kwargs) <NEW_LINE> self.length = length <NEW_LINE> <DEDENT> @property <NEW_LINE> def bytes_required(self): <NEW_LINE> <INDENT> return self.length <NEW_LINE> <DEDENT> def pack(self, stream... | A string of a fixed number of bytes.
The specified number of bytes are read and then any null
bytes are stripped from the result.
:param length: Number of bytes to read.
:type length: Integer | 62598f8ca8ecb03325870db4 |
class F3(FunctionProvider): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def run(): <NEW_LINE> <INDENT> return None | Risk plugin for testing
:param requires category=='hazard'
:param requires category=='exposure' | 62598f8c379a373c97d98bc7 |
class KafkaTopicWriter(object): <NEW_LINE> <INDENT> KAFKA_PRODUCER_CLOSE_TIMEOUT = 180 <NEW_LINE> def __init__(self, bootstrap_servers, topic, batch_size, ssl_cafile=None, ssl_certfile=None, ssl_keyfile=None, compression_type='gzip', validate_topic=True, **kwargs): <NEW_LINE> <INDENT> _kwargs = { 'retry_backoff_ms': 30... | Kafka Writer which puts objects to a Kafka topic.
It retries sending in case of errors, checks that a topic exists,
and changes some of the defaults. | 62598f8cf7d966606f747b90 |
class MuscleListView(ListView): <NEW_LINE> <INDENT> context_object_name = 'muscle_list' <NEW_LINE> template_name = 'muscles/overview.html' <NEW_LINE> def get_queryset(self): <NEW_LINE> <INDENT> queryset = Muscle.objects.all().order_by('-is_front', 'name'), <NEW_LINE> return queryset <NEW_LINE> <DEDENT> def get_context_... | Overview of all muscles and their exercises | 62598f8cbe383301e02533b0 |
class BearerAuthentication(authentication.TokenAuthentication): <NEW_LINE> <INDENT> keyword = "Bearer" | Simple token based authentication using utvsapitoken.
Clients should authenticate by passing the token key in the 'Authorization'
HTTP header, prepended with the string 'Bearer '. For example:
Authorization: Bearer 956e252a-513c-48c5-92dd-bfddc364e812 | 62598f8cfb3f5b602db47f8a |
class CommonUtilsCase(unittest.TestCase): <NEW_LINE> <INDENT> def test_datetime_parsing(self): <NEW_LINE> <INDENT> pdtime = parse_datetime("2012-06-19T22:41:52+01:00") <NEW_LINE> self.assertEqual(pdtime.hour, 21) <NEW_LINE> self.assertEqual(pdtime.tzinfo, UTC_TZINFO) | Tests the stuff in the common_utils module. | 62598f8cbaa26c4b54d4ee66 |
class rule_003(previous_line): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> previous_line.__init__(self, 'package', '003', lTokens) <NEW_LINE> self.style = 'no_code' | This rule checks for blank lines or comments above the **package** keyword.
|configuring_previous_line_rules_link|
The default style is :code:`no_code`.
**Violation**
.. code-block:: vhdl
library ieee;
package FIFO_PKG is
**Fix**
.. code-block:: vhdl
library ieee;
package FIFO_PKG is | 62598f8c097d151d1a2c0bda |
class ExplosionButtonClass(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.enabled = True <NEW_LINE> self.checked = False <NEW_LINE> <DEDENT> def onClick(self): <NEW_LINE> <INDENT> pythonaddins.MessageBox("pre-script test","window1") <NEW_LINE> object = pythonaddins.GPToolDialog("m:/Documents/... | Implementation for addin_addin.explosionbutton (Button) | 62598f8c0fa83653e46f4aa1 |
class SourceOperatorImpl(SourceOperator, StreamOperator): <NEW_LINE> <INDENT> class SourceContextImpl(function.SourceContext): <NEW_LINE> <INDENT> def __init__(self, collectors): <NEW_LINE> <INDENT> self.collectors = collectors <NEW_LINE> <DEDENT> def collect(self, value): <NEW_LINE> <INDENT> for collector in self.coll... | Operator to run a :class:`function.SourceFunction` | 62598f8ce64d504609df918c |
class AverageBrainGenerator(SEMLikeCommandLine): <NEW_LINE> <INDENT> input_spec = AverageBrainGeneratorInputSpec <NEW_LINE> output_spec = AverageBrainGeneratorOutputSpec <NEW_LINE> _cmd = " AverageBrainGenerator " <NEW_LINE> _outputs_filenames = {'outputVolume':'outputVolume'} | title: Average Brain Generator
category: Registration
description:
This programs creates synthesized average brain.
version: 0.1
documentation-url: http:://mri.radiology.uiowa.edu/mriwiki
license: NEED TO ADD
contributor: This tool was developed by Yongqiang Zhao. | 62598f8c23849d37ff850c72 |
@implementer(interfaces.IEditCancelledEvent) <NEW_LINE> class EditCancelledEvent(ObjectEvent): <NEW_LINE> <INDENT> pass | An edit operation was cancelled | 62598f8c1f037a2d8b9e3c8d |
class TestJsonAbstractSourceTargetRequest(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 testJsonAbstractSourceTargetRequest(self): <NEW_LINE> <INDENT> pass | JsonAbstractSourceTargetRequest unit test stubs | 62598f8cb57a9660fecd1630 |
class VGG(nn.Module): <NEW_LINE> <INDENT> def __init__(self, pattern): <NEW_LINE> <INDENT> super(VGG, self).__init__() <NEW_LINE> self.vgg = self.create_layers(pattern) <NEW_LINE> self.classifier = nn.Linear(512, 10) <NEW_LINE> <DEDENT> def forward(self, x): <NEW_LINE> <INDENT> out = self.vgg(x) <NEW_LINE> out = out.vi... | creating VGG-like architechtures taking as input pattern
variable described in __init__ | 62598f8ca17c0f6771d5bdf5 |
class Alien(Sprite): <NEW_LINE> <INDENT> def __init__(self, ai_settings, screen): <NEW_LINE> <INDENT> super(Alien, self).__init__() <NEW_LINE> self.screen = screen <NEW_LINE> self.ai_settings = ai_settings <NEW_LINE> self.image = pygame.image.load('images/alien.bmp') <NEW_LINE> self.rect = self.image.get_rect() <NEW_LI... | A class to represent a single alien in the fleet | 62598f8c10dbd63aa1c7076b |
class TimeBox(object): <NEW_LINE> <INDENT> def __init__(self, item, start_time, end_time = None, parent = None): <NEW_LINE> <INDENT> self.parent = parent <NEW_LINE> self.item = item <NEW_LINE> self.start_time = start_time <NEW_LINE> self.end_time = end_time <NEW_LINE> <DEDENT> def __eq__(self, other): <NEW_LINE> <INDEN... | A container to hold an instance with an assigned time-span.
| 62598f8c16aa5153ce4000b8 |
class Command(BaseCommand): <NEW_LINE> <INDENT> def handle(self, *args, **options): <NEW_LINE> <INDENT> logging.critical('start Finance Daily Report ....') <NEW_LINE> try: <NEW_LINE> <INDENT> fr = LabJobReport() <NEW_LINE> fr.handle_daily_report() <NEW_LINE> <DEDENT> except Exception as e: <NEW_LINE> <INDENT> logging.c... | Daily Report Finance
created by guof.
2019.12.30 | 62598f8c07d97122c421685c |
class itkImageIOFactory(ITKCommonBasePython.itkObject): <NEW_LINE> <INDENT> thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') <NEW_LINE> def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined") <NEW_LINE> __repr__ = _swig_repr <NEW_LINE> R... | Proxy of C++ itkImageIOFactory class | 62598f8cd99f1b3c44d0525e |
class InternalError(Error): <NEW_LINE> <INDENT> pass | Unspecified internal failure. | 62598f8cbaa26c4b54d4ee68 |
class LoadWorkTests(CommonCommonTests, TestCase): <NEW_LINE> <INDENT> @inlineCallbacks <NEW_LINE> def setUp(self): <NEW_LINE> <INDENT> yield super(LoadWorkTests, self).setUp() <NEW_LINE> yield self.buildStoreAndDirectory() <NEW_LINE> <DEDENT> @inlineCallbacks <NEW_LINE> def test_basicWork(self): <NEW_LINE> <INDENT> yie... | Test L{TestWork}. | 62598f8c462c4b4f79dbb5b7 |
class GlobalIpCreate(CLIRunnable): <NEW_LINE> <INDENT> action = 'create' <NEW_LINE> options = ['confirm'] <NEW_LINE> def execute(self, args): <NEW_LINE> <INDENT> mgr = NetworkManager(self.client) <NEW_LINE> version = 4 <NEW_LINE> if args.get('--v6'): <NEW_LINE> <INDENT> version = 6 <NEW_LINE> <DEDENT> if not args.get('... | usage:
sl globalip create [options]
Add a new global IP address to your account.
Options:
--v6 Orders IPv6
--dry-run, --test Do not order the IP; just get a quote | 62598f8c097d151d1a2c0bdc |
class RelationHandler(o.SimpleHandler): <NEW_LINE> <INDENT> def __init__(self, routes): <NEW_LINE> <INDENT> super(RelationHandler, self).__init__() <NEW_LINE> self.routes = routes <NEW_LINE> <DEDENT> def way(self, w): <NEW_LINE> <INDENT> for route in filter(lambda x: x is not None, self.routes.values()): <NEW_LINE> <IN... | Loops over the ways to find the ones we need for the relations. | 62598f8cd53ae8145f918044 |
class BaseInteractiveCaseHandler: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.source = self.get_source() <NEW_LINE> self.debug_mode = False <NEW_LINE> <DEDENT> def get_source(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> yield sys.stdin.readline() <NEW_LINE> <D... | Boilerplate class. | 62598f8c4428ac0f6e6580d9 |
class EnvironmentLookup(abc.StrLookup): <NEW_LINE> <INDENT> def lookup(self, key): <NEW_LINE> <INDENT> return os.environ.get(key) | An `EnvironmentLookup` lookups keys in the environment variables. | 62598f8c15baa72349461b2e |
class BookSpider(Spider): <NEW_LINE> <INDENT> name = 'book_titles' <NEW_LINE> start_urls = ['http://books.toscrape.com/catalogue/page-1.html'] <NEW_LINE> custom_settings = {'LOG_ENABLED': False} <NEW_LINE> def parse(self, response): <NEW_LINE> <INDENT> for book in response.css('article.product_pod h3'): <NEW_LINE> <IND... | Класс парсера названий всех книг с сайта http://books.toscrape.com | 62598f8c91af0d3eaad399b4 |
class Splitter(Resource): <NEW_LINE> <INDENT> def post(self): <NEW_LINE> <INDENT> text = request.json["texto"] <NEW_LINE> if text[-1] not in PUNCTUATION: <NEW_LINE> <INDENT> text = text + "." <NEW_LINE> <DEDENT> tokens = tk.tokenize(text) <NEW_LINE> sentences = sp.split(tokens, 0) <NEW_LINE> outputSentences = [] <NEW_L... | Splits an input text into sentences. | 62598f8c8e71fb1e983bb665 |
class LevelBox(GUIelement): <NEW_LINE> <INDENT> def __init__(self, level_counter, **kwargs): <NEW_LINE> <INDENT> self.level_counter = level_counter <NEW_LINE> super(LevelBox, self).__init__(**kwargs) <NEW_LINE> self.formatted_messages = [] <NEW_LINE> <DEDENT> def display(self, window): <NEW_LINE> <INDENT> line = "Level... | generic container for displaying current level | 62598f8ccb5e8a47e493bf4a |
class CommentLike(db.Model): <NEW_LINE> <INDENT> comment = db.IntegerProperty(required=True, indexed=True) <NEW_LINE> liker = db.StringProperty(required=True, indexed=True) <NEW_LINE> likeTime = db.DateTimeProperty(auto_now_add=True) | Reader likes on the subordinate comments | 62598f8c8a43f66fc4bf1d3a |
@api.route('/games/create') <NEW_LINE> class CreateGame(Resource): <NEW_LINE> <INDENT> @api.response(200, 'Success') <NEW_LINE> @api.response(404, 'Not Found') <NEW_LINE> def get(self): <NEW_LINE> <INDENT> create_form = db.get_create_game() <NEW_LINE> if create_form is None: <NEW_LINE> <INDENT> raise (NotFound("Game fo... | This class allows the user to create a new game.
We will be passing in some sort of game object as a
parameter. Details unknown at present. | 62598f8c6e29344779b0020a |
class ClientConnectionError(AiosnowException): <NEW_LINE> <INDENT> pass | Raised when there was a problem connecting to the server | 62598f8c85dfad0860cbf84c |
class MiningBuddyService(BaseDBService): <NEW_LINE> <INDENT> settings = { 'require_user': False, 'require_password': False, 'provide_login': False, 'use_auth_username': False, 'database_name': 'dreddit_mining', 'password_salt': 's98ss7fsc7fd2rf62ctcrlwztstnzve9toezexcsdhfgviuinusxcdtsvbrg' } <NEW_LINE> SQL_ADD_USER = r... | Mining Buddy Class, allows registration and sign-in | 62598f8c004d5f362081edd4 |
class Meta(): <NEW_LINE> <INDENT> verbose_name_plural = "Published feedback policies" | Model metadata | 62598f8c0c0af96317c55f42 |
class RGB_LED(Actor): <NEW_LINE> <INDENT> def __init__(self, name, id, revpi_red, revpi_green, revpi_blue, topics=None): <NEW_LINE> <INDENT> super(RGB_LED, self).__init__(name=name) <NEW_LINE> self._name = name <NEW_LINE> self._id = id <NEW_LINE> self._value = False <NEW_LINE> self._opcuastate = "notInitialized" <NEW_L... | RGB LED class as an active object | 62598f8ce76e3b2f99fd85e6 |
class Jinja2Rendering(): <NEW_LINE> <INDENT> def render_template(self, template_file, _status_code=WebMessageHandler._SUCCESS_CODE, **context): <NEW_LINE> <INDENT> jinja_env = self.application.template_env <NEW_LINE> template = jinja_env.get_template(template_file) <NEW_LINE> body = template.render(**context or {}) <NE... | Jinja2Rendering is a mixin for for loading a Jinja2 rendering
environment.
Render success is transmitted via http 200. Rendering failures result in
http 500 errors. | 62598f8cec188e330fdf8454 |
class SeparateSampling(Sampler, Generic[T]): <NEW_LINE> <INDENT> def __init__(self, data: Iterable[T], batch_sizes: Dict[int, int], type_fn: Callable[[T], int], ): <NEW_LINE> <INDENT> mp: Dict[int, List[T]] = {} <NEW_LINE> for item in data: <NEW_LINE> <INDENT> idx = type_fn(item) <NEW_LINE> if idx not in mp: <NEW_LINE>... | independent sampling of both types.
self.iters: random iterators for each type. | 62598f8ceab8aa0e5d30b92f |
class DiskList(msrest.serialization.Model): <NEW_LINE> <INDENT> _validation = { 'value': {'required': True}, } <NEW_LINE> _attribute_map = { 'value': {'key': 'value', 'type': '[Disk]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } <NEW_LINE> def __init__( self, *, value: List["Disk"], next_link: Optional[str] = N... | The List Disks operation response.
All required parameters must be populated in order to send to Azure.
:ivar value: Required. A list of disks.
:vartype value: list[~azure.mgmt.compute.v2017_03_30.models.Disk]
:ivar next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch
the next page ... | 62598f8ca8ecb03325870db8 |
class SABoltzmann(SimulatedAnnealingValue): <NEW_LINE> <INDENT> def __init__(self, func, x0, T_max=100, T_min=1e-7, L=300, max_stay_counter=150, **kwargs): <NEW_LINE> <INDENT> super().__init__(func, x0, T_max, T_min, L, max_stay_counter, **kwargs) <NEW_LINE> self.learn_rate = kwargs.get('learn_rate', 0.5) <NEW_LINE> <D... | std = minimum(sqrt(T) * ones(d), (upper - lower) / (3*learn_rate))
y ~ Normal(0, std, size = d)
x_new = x_old + learn_rate * y
T_new = T0 / log(1 + k) | 62598f8c82261d6c5272fcb0 |
class StreaMiniAdaGrad(StreaMiniOptimizer): <NEW_LINE> <INDENT> def __init__(self, batchsize, model, cost, eps=1e-5, *args, **kwargs): <NEW_LINE> <INDENT> super(StreaMiniAdaGrad, self).__init__(batchsize, model, cost, *args, **kwargs) <NEW_LINE> self.sh_learningrate = _T.scalar('lrate') <NEW_LINE> self.eps = eps <NEW_L... | Implements Duchi's "Adaptive Subgradient" method, aka AdaGrad.
Chris Dyer's "Notes on AdaGrad" are pretty awesome for practical purposes.
TL;DR: AdaGrad doesn't need additional parameters (a lie) and makes the
optimization much less sensitive to the learning-rate!
The updates are:
g²_{e+1} = g²_e + ∇(p_e)... | 62598f8cbde94217f3707441 |
class TestV1beta1NetworkPolicyPeer(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 testV1beta1NetworkPolicyPeer(self): <NEW_LINE> <INDENT> model = k8sv1beta1.models.v1beta1_network_policy_peer.V1be... | V1beta1NetworkPolicyPeer unit test stubs | 62598f8c21a7993f00c65b2d |
class SortingHelpFormatter(argparse.ArgumentDefaultsHelpFormatter): <NEW_LINE> <INDENT> def add_arguments(self, actions): <NEW_LINE> <INDENT> actions = sorted(actions, key=attrgetter('option_strings')) <NEW_LINE> super(SortingHelpFormatter, self).add_arguments(actions) | Sort argparse arguments by argument name. | 62598f8cf7d966606f747b94 |
class CustomOperation(Base): <NEW_LINE> <INDENT> __tablename__ = 'sbds_op_customs' <NEW_LINE> __table_args__ = ( PrimaryKeyConstraint('block_num', 'transaction_num', 'operation_num'),) <NEW_LINE> block_num = Column(Integer, nullable=False, index=True) <NEW_LINE> transaction_num = Column(SmallInteger, nullable=False, in... | Steem Blockchain Example
======================
{
"id": 0,
"data": "276e1c988628df33",
"required_auths": [
"blocktrades"
]
} | 62598f8c596a89723612782d |
class RecipeDetailSerializer(RecipeSerializer): <NEW_LINE> <INDENT> information = InformationSerializer(many=True, read_only=True) <NEW_LINE> tags = TagSerializer(many=True, read_only=True) | Serialize a recipe detail | 62598f8c925a0f43d25e7bed |
class HelloViewSet(viewsets.ViewSet): <NEW_LINE> <INDENT> serializer_class = serializers.HelloSerializer <NEW_LINE> def list(self, request): <NEW_LINE> <INDENT> a_viewset = [ 'Uses HTTP methods as function (list, create, retrieve, update, delete)', 'Automatically maps to URLs using Routers', 'Provides more functionnali... | Test API viewset | 62598f8c50485f2cf55dab2c |
class AdalineGD(object): <NEW_LINE> <INDENT> def __init__(self,eta=0.01,n_iter=50,random_state=1): <NEW_LINE> <INDENT> self.eta=eta <NEW_LINE> self.n_iter=n_iter <NEW_LINE> self.random_state=random_state <NEW_LINE> <DEDENT> def fit(self,X,y): <NEW_LINE> <INDENT> rgen = np.random.RandomState(self.random_state) <NEW_LINE... | ADAptive LInear NEuron classifier.
Parameters
------------
eta : float
Learning rate (between 0.0 and 1.0)
n_iter : int
Passes over the training dataset.
random_state : int
Random number generator seed for random weight initialization.
Attributes
-----------
w_ : 1d-array
Weights after fitting.
cost_ : list
Sum-of-squ... | 62598f8c462c4b4f79dbb5b9 |
class TestInputParser(QISKitAcquaTestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> filepath = self._get_resource_path('H2-0.735.json') <NEW_LINE> self.parser = InputParser(filepath) <NEW_LINE> self.parser.parse() <NEW_LINE> <DEDENT> def test_save(self): <NEW_LINE> <INDENT> save_path = self._get_resour... | Input Parser and algorithms tests. | 62598f8c097d151d1a2c0bdd |
class GeoReplication(object): <NEW_LINE> <INDENT> pass | Contains statistics related to replication for the given service.
:ivar str status:
The status of the secondary location. Possible values are:
live: Indicates that the secondary location is active and operational.
bootstrap: Indicates initial synchronization from the primary location
to th... | 62598f8cf7d966606f747b95 |
class IriTemplateMapping(): <NEW_LINE> <INDENT> def __init__(self, variable: str, prop: str, required: bool = False): <NEW_LINE> <INDENT> self.variable = variable <NEW_LINE> self.prop = prop <NEW_LINE> self.required = required <NEW_LINE> <DEDENT> def generate(self) -> Dict[str, Any]: <NEW_LINE> <INDENT> iri_template_ma... | Class for hydra IriTemplateMapping | 62598f8cd6c5a102081e1cfa |
class Shape(object): <NEW_LINE> <INDENT> def __init__(self,source,vertex = None,tc = None,colour_info = None,index = None): <NEW_LINE> <INDENT> if index == None: <NEW_LINE> <INDENT> self.index = source.next() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.index = index <NEW_LINE> <DEDENT> self.source = source <NEW_... | Object representing a quad. Called with a quad buffer argument that the quad is allocated from | 62598f8c91af0d3eaad399b6 |
class Domain(db.Model): <NEW_LINE> <INDENT> id = db.Column(db.Integer, primary_key=True) <NEW_LINE> title = db.Column(db.String(255), nullable=False) <NEW_LINE> role_id = db.Column(db.Integer, db.ForeignKey('role.id'), nullable=False) <NEW_LINE> policies = db.relationship('Policy', backref='domain', cascade='all, delet... | Define a mapping to the database for a domain. | 62598f8cd4950a0f3b110c11 |
class MessageView(views.APIView): <NEW_LINE> <INDENT> def post(self, request, *args, **kwargs): <NEW_LINE> <INDENT> serializer = MessageSerializer(data=request.data) <NEW_LINE> serializer.is_valid(raise_exception=True) <NEW_LINE> return response.Response(serializer.data, status=status.HTTP_200_OK) | Returns a message POST-ed to it, i.e. echo. | 62598f8c55399d3f056260d1 |
class Parser(): <NEW_LINE> <INDENT> def __init__(self, pipeline): <NEW_LINE> <INDENT> self.pipeline = pipeline <NEW_LINE> pass <NEW_LINE> <DEDENT> def parse_input(self): <NEW_LINE> <INDENT> pipeline = self.pipeline <NEW_LINE> raw = self.pipeline.raw <NEW_LINE> config = pipeline.config <NEW_LINE> query = config.data.get... | That class represents the parser used to process some objects during
the ETL process. | 62598f8c15baa72349461b30 |
class WsgiApplication(Base): <NEW_LINE> <INDENT> def run(self, env): <NEW_LINE> <INDENT> from . import request, middleware <NEW_LINE> request_obj = request.Request(env, self) <NEW_LINE> return middleware.run(request_obj) <NEW_LINE> <DEDENT> def __call__(self, env, start_response): <NEW_LINE> <INDENT> response_obj = sel... | application for wsgi | 62598f8c0383005118f6d2b0 |
class DuplicateDrumError(StandardError): <NEW_LINE> <INDENT> pass | This drum already appears in this drum kit. | 62598f8ce76e3b2f99fd85e7 |
class IContactMetadata: <NEW_LINE> <INDENT> pass | OO-interface to OWS metadata.
Properties
----------
name : string
organization : string
address : string
city : string
region : string
postcode : string
country : string
email : string
hoursofservice: string
role: string | 62598f8ca4f1c619b294e19e |
class LocationMapDataSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> name = serializers.Field(source='__unicode__') <NEW_LINE> lat = serializers.SerializerMethodField('get_lat') <NEW_LINE> lng = serializers.SerializerMethodField('get_lng') <NEW_LINE> zoom = serializers.SerializerMethodField('get_zoom') <NE... | Serializer for map inputs - determine initial position and zoom.
| 62598f8c6e29344779b0020c |
class GroveBoard(Board): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(GroveBoard, self).__init__() <NEW_LINE> self.pin_mappings = PinMappings( motion_pin=4, i2c_bus=6 ) <NEW_LINE> if HARDWARE_CONFIG.platform == KNOWN_PLATFORMS.firmata: <NEW_LINE> <INDENT> addSubplatform(GENERIC_FIRMATA, "/dev/ttyAC... | Board class for Grove hardware. | 62598f8cb57a9660fecd1634 |
@dataclass <NEW_LINE> class HSiloItem: <NEW_LINE> <INDENT> pass | Individual HSilo (one physical file could have multiple | 62598f8c596a89723612782e |
class TfSSD(object): <NEW_LINE> <INDENT> def __init__(self, model, input_shape): <NEW_LINE> <INDENT> self.model = model <NEW_LINE> self.input_shape = input_shape <NEW_LINE> ssd_graph = tf.Graph() <NEW_LINE> with ssd_graph.as_default(): <NEW_LINE> <INDENT> graph_def = tf.GraphDef() <NEW_LINE> with tf.gfile.GFile('ssd/%s... | TfSSD class encapsulates things needed to run TensorFlow SSD. | 62598f8cbde94217f3707442 |
class Product(models.Model): <NEW_LINE> <INDENT> title = models.CharField(max_length=30) <NEW_LINE> description = models.TextField(blank=True, null=True) <NEW_LINE> slug = models.CharField(max_length=30) <NEW_LINE> imageSrc = models.ImageField( upload_to=products_image_locations, null=True, blank=True, width_field="wid... | all the products info | 62598f8c507cdc57c63a4947 |
class SysInfo(CLICmd): <NEW_LINE> <INDENT> name = 'sysinfo' <NEW_LINE> description = 'Collect system information' <NEW_LINE> def configure(self, parser): <NEW_LINE> <INDENT> parser = super(SysInfo, self).configure(parser) <NEW_LINE> help_msg = ('Directory where Avocado will dump sysinfo data. If one ' 'is not given ex... | Collect system information | 62598f8ccad5886f8bdc4e68 |
class RelateSingleWidget(RelateWidget): <NEW_LINE> <INDENT> template_name = 'djinn_forms/snippets/relatesinglewidget.html' <NEW_LINE> def value_from_datadict(self, data, files, name): <NEW_LINE> <INDENT> result = super(RelateSingleWidget, self).value_from_datadict( data, files, name) <NEW_LINE> result = result.get('add... | Relate widget where only one relation is allowed | 62598f8c3617ad0b5ee05cfd |
class ClientProcessing(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.is_login = False <NEW_LINE> <DEDENT> def process(self, data): <NEW_LINE> <INDENT> data = data.decode('UTF-8').split() <NEW_LINE> self.command, self.args = data[0], data[1:] <NEW_LINE> known_commands = { 'login': self._login... | Client Processing Logic | 62598f8c99cbb53fe6830a8a |
class DataRetrievalBase: <NEW_LINE> <INDENT> data = None <NEW_LINE> def __init__(self, dataset=None): <NEW_LINE> <INDENT> filename = dataset if dataset is not None else 'default.txt' <NEW_LINE> filepath = os.path.join(DATA_DIR, self.__class__.__name__, filename) <NEW_LINE> with open(filepath, 'r') as f: <NEW_LINE> <IND... | An abstract class for common dataset retrieval classes. | 62598f8c50485f2cf55dab2e |
class RequestValidationMixin(object): <NEW_LINE> <INDENT> def _validate_request(self): <NEW_LINE> <INDENT> if not self._request_parser: <NEW_LINE> <INDENT> raise OperationConfigException('required parser missing for request') <NEW_LINE> <DEDENT> for header in self._get_required_headers(): <NEW_LINE> <INDENT> if header ... | Validation mixin to assert Request() is properly constructed before
sending it off. | 62598f8cd4950a0f3b110c12 |
class Link: <NEW_LINE> <INDENT> def __init__(self, value, next=None): <NEW_LINE> <INDENT> self.value = value <NEW_LINE> self.next = next <NEW_LINE> <DEDENT> def insert(self, link): <NEW_LINE> <INDENT> link.next = self.next <NEW_LINE> self.next = link <NEW_LINE> <DEDENT> def __iter__(self): <NEW_LINE> <INDENT> return Li... | A link in a linked list.
Parameters
----------
value :
The value to be stored in the link.
link: : Link
The next link in the list. | 62598f8cac7a0e7691f720c3 |
class position(object): <NEW_LINE> <INDENT> def __init__(self, a, b, cartographer=None): <NEW_LINE> <INDENT> self.a = a <NEW_LINE> self.b = b <NEW_LINE> assert (np.size(a) == np.size(b)) <NEW_LINE> self.cartographer = cartographer <NEW_LINE> self.ccd = cartographer.ccd <NEW_LINE> self.camera = cartographer.camera <NEW_... | General (a,b) coordinate object. Each coordinate can be either a scalar, or an N-dimensional array. | 62598f8cb5575c28eb712aa6 |
class UndefinedStepError(KeyError): <NEW_LINE> <INDENT> pass | Error class for when there is an attempt to access a Step that doesnt exist | 62598f8c50485f2cf55dab2f |
class HankelCovariances(BaseEstimator, TransformerMixin): <NEW_LINE> <INDENT> def __init__(self, delays=4, estimator='scm'): <NEW_LINE> <INDENT> self.delays = delays <NEW_LINE> self.estimator = estimator <NEW_LINE> <DEDENT> def fit(self, X, y=None): <NEW_LINE> <INDENT> return self <NEW_LINE> <DEDENT> def transform(self... | Estimation of covariance matrix with time delayed hankel matrices.
This estimation is usefull to catch spectral dynamics of the signal,
similarly to the CSSP method. It is done by concatenating time delayed
version of the signal before covariance estimation.
Parameters
----------
delays: int, list of int (default, 2)... | 62598f8cb7558d58954631ed |
class License(models.Model): <NEW_LINE> <INDENT> license = models.CharField(max_length=100) <NEW_LINE> website = models.URLField(blank=True, help_text="Website defining License information") <NEW_LINE> notes = models.TextField(max_length=1000, blank=True) <NEW_LINE> def __unicode__(self): <NEW_LINE> <INDENT> return u"%... | This defines the data structure for the License model.
The only required field is license.
If the contents of this installation are being made available using some licencing criteria this can either be defined in the notes field, or in an external website. | 62598f8c26068e7796d4c516 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.