prompt
large_stringlengths
72
9.34k
completion
large_stringlengths
0
7.61k
<|file_name|>csrf_test.py<|end_file_name|><|fim▁begin|>"""Tests for the CSRF helper.""" import unittest import mock import webapp2 import webtest from ctc.helpers import csrf from ctc.testing import testutil MOCKED_TIME = 123 # Tests don't need docstrings, so pylint: disable=C0111 # Tests can test protected memb...
self.login() response = self.testapp.get('/', status=200).body self.assertIn('CSRF Token:', response) self.assertEqual(response.split(':')[-1], csrf.make_token())
<|file_name|>csrf_test.py<|end_file_name|><|fim▁begin|>"""Tests for the CSRF helper.""" import unittest import mock import webapp2 import webtest from ctc.helpers import csrf from ctc.testing import testutil MOCKED_TIME = 123 # Tests don't need docstrings, so pylint: disable=C0111 # Tests can test protected memb...
self.login() self.testapp.put('/', status=403) self.testapp.post('/', status=403) self.testapp.delete('/', status=403) csrf_param = 'csrf_token=' + csrf.make_token(path='/') self.testapp.put('/', params=csrf_param, status=200) self.testapp.post('/', params=csrf_pa...
<|file_name|>csrf_test.py<|end_file_name|><|fim▁begin|>"""Tests for the CSRF helper.""" import unittest import mock import webapp2 import webtest from ctc.helpers import csrf from ctc.testing import testutil MOCKED_TIME = 123 # Tests don't need docstrings, so pylint: disable=C0111 # Tests can test protected memb...
modified_token = '1' + token[1:]
<|file_name|>csrf_test.py<|end_file_name|><|fim▁begin|>"""Tests for the CSRF helper.""" import unittest import mock import webapp2 import webtest from ctc.helpers import csrf from ctc.testing import testutil MOCKED_TIME = 123 # Tests don't need docstrings, so pylint: disable=C0111 # Tests can test protected memb...
unittest.main()
<|file_name|>csrf_test.py<|end_file_name|><|fim▁begin|>"""Tests for the CSRF helper.""" import unittest import mock import webapp2 import webtest from ctc.helpers import csrf from ctc.testing import testutil MOCKED_TIME = 123 # Tests don't need docstrings, so pylint: disable=C0111 # Tests can test protected memb...
get
<|file_name|>csrf_test.py<|end_file_name|><|fim▁begin|>"""Tests for the CSRF helper.""" import unittest import mock import webapp2 import webtest from ctc.helpers import csrf from ctc.testing import testutil MOCKED_TIME = 123 # Tests don't need docstrings, so pylint: disable=C0111 # Tests can test protected memb...
post
<|file_name|>csrf_test.py<|end_file_name|><|fim▁begin|>"""Tests for the CSRF helper.""" import unittest import mock import webapp2 import webtest from ctc.helpers import csrf from ctc.testing import testutil MOCKED_TIME = 123 # Tests don't need docstrings, so pylint: disable=C0111 # Tests can test protected memb...
put
<|file_name|>csrf_test.py<|end_file_name|><|fim▁begin|>"""Tests for the CSRF helper.""" import unittest import mock import webapp2 import webtest from ctc.helpers import csrf from ctc.testing import testutil MOCKED_TIME = 123 # Tests don't need docstrings, so pylint: disable=C0111 # Tests can test protected memb...
delete
<|file_name|>csrf_test.py<|end_file_name|><|fim▁begin|>"""Tests for the CSRF helper.""" import unittest import mock import webapp2 import webtest from ctc.helpers import csrf from ctc.testing import testutil MOCKED_TIME = 123 # Tests don't need docstrings, so pylint: disable=C0111 # Tests can test protected memb...
setUp
<|file_name|>csrf_test.py<|end_file_name|><|fim▁begin|>"""Tests for the CSRF helper.""" import unittest import mock import webapp2 import webtest from ctc.helpers import csrf from ctc.testing import testutil MOCKED_TIME = 123 # Tests don't need docstrings, so pylint: disable=C0111 # Tests can test protected memb...
test_get_secret_key
<|file_name|>csrf_test.py<|end_file_name|><|fim▁begin|>"""Tests for the CSRF helper.""" import unittest import mock import webapp2 import webtest from ctc.helpers import csrf from ctc.testing import testutil MOCKED_TIME = 123 # Tests don't need docstrings, so pylint: disable=C0111 # Tests can test protected memb...
test_tokens_are_equal
<|file_name|>csrf_test.py<|end_file_name|><|fim▁begin|>"""Tests for the CSRF helper.""" import unittest import mock import webapp2 import webtest from ctc.helpers import csrf from ctc.testing import testutil MOCKED_TIME = 123 # Tests don't need docstrings, so pylint: disable=C0111 # Tests can test protected memb...
test_make_token_includes_time
<|file_name|>csrf_test.py<|end_file_name|><|fim▁begin|>"""Tests for the CSRF helper.""" import unittest import mock import webapp2 import webtest from ctc.helpers import csrf from ctc.testing import testutil MOCKED_TIME = 123 # Tests don't need docstrings, so pylint: disable=C0111 # Tests can test protected memb...
test_make_token_requires_login
<|file_name|>csrf_test.py<|end_file_name|><|fim▁begin|>"""Tests for the CSRF helper.""" import unittest import mock import webapp2 import webtest from ctc.helpers import csrf from ctc.testing import testutil MOCKED_TIME = 123 # Tests don't need docstrings, so pylint: disable=C0111 # Tests can test protected memb...
test_make_token_includes_path
<|file_name|>csrf_test.py<|end_file_name|><|fim▁begin|>"""Tests for the CSRF helper.""" import unittest import mock import webapp2 import webtest from ctc.helpers import csrf from ctc.testing import testutil MOCKED_TIME = 123 # Tests don't need docstrings, so pylint: disable=C0111 # Tests can test protected memb...
test_token_is_valid
<|file_name|>csrf_test.py<|end_file_name|><|fim▁begin|>"""Tests for the CSRF helper.""" import unittest import mock import webapp2 import webtest from ctc.helpers import csrf from ctc.testing import testutil MOCKED_TIME = 123 # Tests don't need docstrings, so pylint: disable=C0111 # Tests can test protected memb...
test_get_has_csrf_token
<|file_name|>csrf_test.py<|end_file_name|><|fim▁begin|>"""Tests for the CSRF helper.""" import unittest import mock import webapp2 import webtest from ctc.helpers import csrf from ctc.testing import testutil MOCKED_TIME = 123 # Tests don't need docstrings, so pylint: disable=C0111 # Tests can test protected memb...
test_mutators_require_csrf_token
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import ( scoped_session, sessionmaker, ) from zope.sqlalchemy import ZopeTransactionExtension import tornado.web<|fim▁hole|> import logging logging.getLogger().setLevel(logging....
from handlers.index import IndexHandler from handlers.sensors import SensorsHandler
<|file_name|>circular_tree.py<|end_file_name|><|fim▁begin|>import networkx as nx import matplotlib.pyplot as plt try: import pygraphviz from networkx.drawing.nx_agraph import graphviz_layout except ImportError: try: import pydot from networkx.drawing.nx_pydot import graphviz_layout exce...
G = nx.balanced_tree(3, 5) pos = graphviz_layout(G, prog='twopi', args='')
<|file_name|>065-setselection.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python <|fim▁hole|>import pygtk pygtk.require('2.0') import gtk import time class SetSelectionExample: # Callback when the user toggles the selection def selection_toggled(self, widget, window): if widget.get_active(): ...
# example setselection.py
<|file_name|>065-setselection.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # example setselection.py import pygtk pygtk.require('2.0') import gtk import time class SetSelectionExample: # Callback when the user toggles the selection <|fim_middle|> def main(): gtk.main() return 0 if __name_...
def selection_toggled(self, widget, window): if widget.get_active(): self.have_selection = window.selection_owner_set("PRIMARY") # if claiming the selection failed, we return the button to # the out state if not self.have_selection: widget.set_...
<|file_name|>065-setselection.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # example setselection.py import pygtk pygtk.require('2.0') import gtk import time class SetSelectionExample: # Callback when the user toggles the selection def selection_toggled(self, widget, window): <|fim_middle|> ...
if widget.get_active(): self.have_selection = window.selection_owner_set("PRIMARY") # if claiming the selection failed, we return the button to # the out state if not self.have_selection: widget.set_active(False) else: if self.h...
<|file_name|>065-setselection.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # example setselection.py import pygtk pygtk.require('2.0') import gtk import time class SetSelectionExample: # Callback when the user toggles the selection def selection_toggled(self, widget, window): if widget.get_a...
self.have_selection = False widget.set_active(False) return True
<|file_name|>065-setselection.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # example setselection.py import pygtk pygtk.require('2.0') import gtk import time class SetSelectionExample: # Callback when the user toggles the selection def selection_toggled(self, widget, window): if widget.get_a...
current_time = time.time() timestr = time.asctime(time.localtime(current_time)) # When we return a single string, it should not be null terminated. # That will be done for us selection_data.set_text(timestr, len(timestr)) return
<|file_name|>065-setselection.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # example setselection.py import pygtk pygtk.require('2.0') import gtk import time class SetSelectionExample: # Callback when the user toggles the selection def selection_toggled(self, widget, window): if widget.get_a...
self.have_selection = False # Create the toplevel window window = gtk.Window(gtk.WINDOW_TOPLEVEL) window.set_title("Set Selection") window.set_border_width(10) window.connect("destroy", lambda w: gtk.main_quit()) self.window = window # Create an eventbox t...
<|file_name|>065-setselection.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # example setselection.py import pygtk pygtk.require('2.0') import gtk import time class SetSelectionExample: # Callback when the user toggles the selection def selection_toggled(self, widget, window): if widget.get_a...
gtk.main() return 0
<|file_name|>065-setselection.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # example setselection.py import pygtk pygtk.require('2.0') import gtk import time class SetSelectionExample: # Callback when the user toggles the selection def selection_toggled(self, widget, window): if widget.get_a...
self.have_selection = window.selection_owner_set("PRIMARY") # if claiming the selection failed, we return the button to # the out state if not self.have_selection: widget.set_active(False)
<|file_name|>065-setselection.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # example setselection.py import pygtk pygtk.require('2.0') import gtk import time class SetSelectionExample: # Callback when the user toggles the selection def selection_toggled(self, widget, window): if widget.get_a...
widget.set_active(False)
<|file_name|>065-setselection.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # example setselection.py import pygtk pygtk.require('2.0') import gtk import time class SetSelectionExample: # Callback when the user toggles the selection def selection_toggled(self, widget, window): if widget.get_a...
if self.have_selection: # Not possible to release the selection in PyGTK # just mark that we don't have it self.have_selection = False
<|file_name|>065-setselection.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # example setselection.py import pygtk pygtk.require('2.0') import gtk import time class SetSelectionExample: # Callback when the user toggles the selection def selection_toggled(self, widget, window): if widget.get_a...
self.have_selection = False
<|file_name|>065-setselection.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # example setselection.py import pygtk pygtk.require('2.0') import gtk import time class SetSelectionExample: # Callback when the user toggles the selection def selection_toggled(self, widget, window): if widget.get_a...
SetSelectionExample() main()
<|file_name|>065-setselection.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # example setselection.py import pygtk pygtk.require('2.0') import gtk import time class SetSelectionExample: # Callback when the user toggles the selection def <|fim_middle|>(self, widget, window): if widget.get_acti...
selection_toggled
<|file_name|>065-setselection.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # example setselection.py import pygtk pygtk.require('2.0') import gtk import time class SetSelectionExample: # Callback when the user toggles the selection def selection_toggled(self, widget, window): if widget.get_a...
selection_clear
<|file_name|>065-setselection.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # example setselection.py import pygtk pygtk.require('2.0') import gtk import time class SetSelectionExample: # Callback when the user toggles the selection def selection_toggled(self, widget, window): if widget.get_a...
selection_handle
<|file_name|>065-setselection.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # example setselection.py import pygtk pygtk.require('2.0') import gtk import time class SetSelectionExample: # Callback when the user toggles the selection def selection_toggled(self, widget, window): if widget.get_a...
__init__
<|file_name|>065-setselection.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # example setselection.py import pygtk pygtk.require('2.0') import gtk import time class SetSelectionExample: # Callback when the user toggles the selection def selection_toggled(self, widget, window): if widget.get_a...
main
<|file_name|>scikitbase.py<|end_file_name|><|fim▁begin|><|fim▁hole|>from termcolor import colored class ScikitBase(ABC): """ Base class for AI strategies """ arg_parser = configargparse.get_argument_parser() arg_parser.add('-p', '--pipeline', help='trained model/pipeline (*.pkl file)', required=Tr...
from abc import ABC import configargparse from sklearn.externals import joblib
<|file_name|>scikitbase.py<|end_file_name|><|fim▁begin|>from abc import ABC import configargparse from sklearn.externals import joblib from termcolor import colored class ScikitBase(ABC): <|fim_middle|> <|fim▁end|>
""" Base class for AI strategies """ arg_parser = configargparse.get_argument_parser() arg_parser.add('-p', '--pipeline', help='trained model/pipeline (*.pkl file)', required=True) arg_parser.add('-f', '--feature_names', help='List of features list pipeline (*.pkl file)') pipeline = None ...
<|file_name|>scikitbase.py<|end_file_name|><|fim▁begin|>from abc import ABC import configargparse from sklearn.externals import joblib from termcolor import colored class ScikitBase(ABC): """ Base class for AI strategies """ arg_parser = configargparse.get_argument_parser() arg_parser.add('-p', '-...
args = self.arg_parser.parse_known_args()[0] super(ScikitBase, self).__init__() self.pipeline = self.load_pipeline(args.pipeline) if args.feature_names: self.feature_names = self.load_pipeline(args.feature_names)
<|file_name|>scikitbase.py<|end_file_name|><|fim▁begin|>from abc import ABC import configargparse from sklearn.externals import joblib from termcolor import colored class ScikitBase(ABC): """ Base class for AI strategies """ arg_parser = configargparse.get_argument_parser() arg_parser.add('-p', '-...
""" Loads scikit model/pipeline """ print(colored('Loading pipeline: ' + pipeline_file, 'green')) return joblib.load(pipeline_file)
<|file_name|>scikitbase.py<|end_file_name|><|fim▁begin|>from abc import ABC import configargparse from sklearn.externals import joblib from termcolor import colored class ScikitBase(ABC): """ Base class for AI strategies """ arg_parser = configargparse.get_argument_parser() arg_parser.add('-p', '-...
""" Method fetches pipeline from server/cloud """ # TODO pass
<|file_name|>scikitbase.py<|end_file_name|><|fim▁begin|>from abc import ABC import configargparse from sklearn.externals import joblib from termcolor import colored class ScikitBase(ABC): """ Base class for AI strategies """ arg_parser = configargparse.get_argument_parser() arg_parser.add('-p', '-...
""" Returns predictions based on the model/pipeline """ try: return self.pipeline.predict(df) except (ValueError, TypeError): print(colored('Got ValueError while using scikit model.. ', 'red')) return None
<|file_name|>scikitbase.py<|end_file_name|><|fim▁begin|>from abc import ABC import configargparse from sklearn.externals import joblib from termcolor import colored class ScikitBase(ABC): """ Base class for AI strategies """ arg_parser = configargparse.get_argument_parser() arg_parser.add('-p', '-...
self.feature_names = self.load_pipeline(args.feature_names)
<|file_name|>scikitbase.py<|end_file_name|><|fim▁begin|>from abc import ABC import configargparse from sklearn.externals import joblib from termcolor import colored class ScikitBase(ABC): """ Base class for AI strategies """ arg_parser = configargparse.get_argument_parser() arg_parser.add('-p', '-...
__init__
<|file_name|>scikitbase.py<|end_file_name|><|fim▁begin|>from abc import ABC import configargparse from sklearn.externals import joblib from termcolor import colored class ScikitBase(ABC): """ Base class for AI strategies """ arg_parser = configargparse.get_argument_parser() arg_parser.add('-p', '-...
load_pipeline
<|file_name|>scikitbase.py<|end_file_name|><|fim▁begin|>from abc import ABC import configargparse from sklearn.externals import joblib from termcolor import colored class ScikitBase(ABC): """ Base class for AI strategies """ arg_parser = configargparse.get_argument_parser() arg_parser.add('-p', '-...
fetch_pipeline_from_server
<|file_name|>scikitbase.py<|end_file_name|><|fim▁begin|>from abc import ABC import configargparse from sklearn.externals import joblib from termcolor import colored class ScikitBase(ABC): """ Base class for AI strategies """ arg_parser = configargparse.get_argument_parser() arg_parser.add('-p', '-...
predict
<|file_name|>calculate_pi_old.py<|end_file_name|><|fim▁begin|>import tensorflow as tf import matplotlib.pyplot as plt import math x_node = tf.random_uniform([1], minval=-1, maxval=1, dtype=tf.float32, name='x_node') y_node = tf.random_uniform([1], minval=-1, maxval=1, dtype=tf.float32, name='y_node')...
with tf.Session() as session: for i in range(1, times):
<|file_name|>calculate_pi_old.py<|end_file_name|><|fim▁begin|>import tensorflow as tf import matplotlib.pyplot as plt import math x_node = tf.random_uniform([1], minval=-1, maxval=1, dtype=tf.float32, name='x_node') y_node = tf.random_uniform([1], minval=-1, maxval=1, dtype=tf.float32, name='y_node')...
hits += 1 pass
<|file_name|>ObjectToImageTest.py<|end_file_name|><|fim▁begin|>########################################################################## # # Copyright (c) 2013-2015, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted pro...
#
<|file_name|>ObjectToImageTest.py<|end_file_name|><|fim▁begin|>########################################################################## # # Copyright (c) 2013-2015, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted pro...
unittest.main()
<|file_name|>ObjectToImageTest.py<|end_file_name|><|fim▁begin|>########################################################################## # # Copyright (c) 2013-2015, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted pro...
test
<|file_name|>ObjectToImageTest.py<|end_file_name|><|fim▁begin|>########################################################################## # # Copyright (c) 2013-2015, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted pro...
testImageWithANegativeDataWindow
<|file_name|>ObjectToImageTest.py<|end_file_name|><|fim▁begin|>########################################################################## # # Copyright (c) 2013-2015, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted pro...
testHashVariesPerTileAndChannel
<|file_name|>ObjectToImageTest.py<|end_file_name|><|fim▁begin|>########################################################################## # # Copyright (c) 2013-2015, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted pro...
fileName = os.path.expandvars( "$GAFFER_ROOT/python/GafferImageTest/images/checker.exr" ) negFileName = os.path.expandvars( "$GAFFER_ROOT/python/GafferImageTest/images/checkerWithNegativeDataWindow.200x150.exr" ) def test( self ) : i = IECore.Reader.create( self.fileName ).read() n = GafferImage.ObjectToImage...
<|file_name|>ObjectToImageTest.py<|end_file_name|><|fim▁begin|>########################################################################## # # Copyright (c) 2013-2015, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted pro...
i = IECore.Reader.create( self.fileName ).read() n = GafferImage.ObjectToImage() n["object"].setValue( i ) self.assertEqual( n["out"].image(), i )
<|file_name|>ObjectToImageTest.py<|end_file_name|><|fim▁begin|>########################################################################## # # Copyright (c) 2013-2015, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted pro...
i = IECore.Reader.create( self.negFileName ).read() n = GafferImage.ObjectToImage() n["object"].setValue( i ) self.assertEqual( n["out"].image(), i )
<|file_name|>ObjectToImageTest.py<|end_file_name|><|fim▁begin|>########################################################################## # # Copyright (c) 2013-2015, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted pro...
n = GafferImage.ObjectToImage() n["object"].setValue( IECore.Reader.create( self.fileName ).read() ) self.assertNotEqual( n["out"].channelDataHash( "R", IECore.V2i( 0 ) ), n["out"].channelDataHash( "G", IECore.V2i( 0 ) ) ) self.assertNotEqual( n["out"].channelDataHash( "R", IECore.V2i( 0 ) ), n[...
<|file_name|>production.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Production Configurations - Use Redis for cache """ from __future__ import absolute_import, unicode_literals from boto.s3.connection import OrdinaryCallingFormat from django.utils import six from .common import * # noqa # SECRET...
<|file_name|>settings.py<|end_file_name|><|fim▁begin|>""" Django settings for keyman project. Generated by 'django-admin startproject' using Django 1.11.7. For more information on this file, see https://docs.djangoproject.com/en/1.11/topics/settings/ For the full list of settings and their values, see https://docs.d...
<|file_name|>partition_health.py<|end_file_name|><|fim▁begin|># coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code ...
'partition_id': {'key': 'PartitionId', 'type': 'str'}, 'replica_health_states': {'key': 'ReplicaHealthStates', 'type': '[ReplicaHealthState]'}, }
<|file_name|>partition_health.py<|end_file_name|><|fim▁begin|># coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code ...
"""Information about the health of a Service Fabric partition. :param aggregated_health_state: Possible values include: 'Invalid', 'Ok', 'Warning', 'Error', 'Unknown' :type aggregated_health_state: str or :class:`enum <azure.servicefabric.models.enum>` :param health_events: The list of health...
<|file_name|>partition_health.py<|end_file_name|><|fim▁begin|># coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code ...
super(PartitionHealth, self).__init__(aggregated_health_state=aggregated_health_state, health_events=health_events, unhealthy_evaluations=unhealthy_evaluations, health_statistics=health_statistics) self.partition_id = partition_id self.replica_health_states = replica_health_states
<|file_name|>partition_health.py<|end_file_name|><|fim▁begin|># coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code ...
__init__
<|file_name|>enkf_node.py<|end_file_name|><|fim▁begin|># Copyright (C) 2012 Statoil ASA, Norway. # # The file 'enkf_node.py' is part of ERT - Ensemble based Reservoir Tool. # # ERT is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published b...
super(EnkfNode, self).__init__(c_pointer, config_node, True)
<|file_name|>enkf_node.py<|end_file_name|><|fim▁begin|># Copyright (C) 2012 Statoil ASA, Norway. # # The file 'enkf_node.py' is part of ERT - Ensemble based Reservoir Tool. # # ERT is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published b...
def __init__(self, config_node, private=False): assert isinstance(config_node, EnkfConfigNode) if private: c_pointer = EnkfNode.cNamespace().alloc_private(config_node) else: c_pointer = EnkfNode.cNamespace().alloc(config_node) super(EnkfNode, self).__init__(...
<|file_name|>enkf_node.py<|end_file_name|><|fim▁begin|># Copyright (C) 2012 Statoil ASA, Norway. # # The file 'enkf_node.py' is part of ERT - Ensemble based Reservoir Tool. # # ERT is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published b...
assert isinstance(config_node, EnkfConfigNode) if private: c_pointer = EnkfNode.cNamespace().alloc_private(config_node) else: c_pointer = EnkfNode.cNamespace().alloc(config_node) super(EnkfNode, self).__init__(c_pointer, config_node, True)
<|file_name|>enkf_node.py<|end_file_name|><|fim▁begin|># Copyright (C) 2012 Statoil ASA, Norway. # # The file 'enkf_node.py' is part of ERT - Ensemble based Reservoir Tool. # # ERT is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published b...
return EnkfNode.cNamespace().value_ptr(self)
<|file_name|>enkf_node.py<|end_file_name|><|fim▁begin|># Copyright (C) 2012 Statoil ASA, Norway. # # The file 'enkf_node.py' is part of ERT - Ensemble based Reservoir Tool. # # ERT is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published b...
""" @rtype: GenData """ impl_type = EnkfNode.cNamespace().get_impl_type(self) assert impl_type == ErtImplType.GEN_DATA return GenData.createCReference(self.valuePointer(), self)
<|file_name|>enkf_node.py<|end_file_name|><|fim▁begin|># Copyright (C) 2012 Statoil ASA, Norway. # # The file 'enkf_node.py' is part of ERT - Ensemble based Reservoir Tool. # # ERT is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published b...
""" @rtype: GenKw """ impl_type = EnkfNode.cNamespace().get_impl_type(self) assert impl_type == ErtImplType.GEN_KW return GenKw.createCReference(self.valuePointer(), self)
<|file_name|>enkf_node.py<|end_file_name|><|fim▁begin|># Copyright (C) 2012 Statoil ASA, Norway. # # The file 'enkf_node.py' is part of ERT - Ensemble based Reservoir Tool. # # ERT is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published b...
""" @rtype: CustomKW """ impl_type = EnkfNode.cNamespace().get_impl_type(self) assert impl_type == ErtImplType.CUSTOM_KW return CustomKW.createCReference(self.valuePointer(), self)
<|file_name|>enkf_node.py<|end_file_name|><|fim▁begin|># Copyright (C) 2012 Statoil ASA, Norway. # # The file 'enkf_node.py' is part of ERT - Ensemble based Reservoir Tool. # # ERT is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published b...
""" @type fs: EnkfFS @type node_id: NodeId @rtype: bool """ assert isinstance(fs, EnkfFs) assert isinstance(node_id, NodeId) return EnkfNode.cNamespace().try_load(self, fs, node_id)
<|file_name|>enkf_node.py<|end_file_name|><|fim▁begin|># Copyright (C) 2012 Statoil ASA, Norway. # # The file 'enkf_node.py' is part of ERT - Ensemble based Reservoir Tool. # # ERT is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published b...
return EnkfNode.cNamespace().get_name(self)
<|file_name|>enkf_node.py<|end_file_name|><|fim▁begin|># Copyright (C) 2012 Statoil ASA, Norway. # # The file 'enkf_node.py' is part of ERT - Ensemble based Reservoir Tool. # # ERT is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published b...
if not self.tryLoad(fs, node_id): raise Exception("Could not load node: %s iens: %d report: %d" % (self.name(), node_id.iens, node_id.report_step))
<|file_name|>enkf_node.py<|end_file_name|><|fim▁begin|># Copyright (C) 2012 Statoil ASA, Norway. # # The file 'enkf_node.py' is part of ERT - Ensemble based Reservoir Tool. # # ERT is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published b...
assert isinstance(fs, EnkfFs) assert isinstance(node_id, NodeId) EnkfNode.cNamespace().store(self, fs, True, node_id)
<|file_name|>enkf_node.py<|end_file_name|><|fim▁begin|># Copyright (C) 2012 Statoil ASA, Norway. # # The file 'enkf_node.py' is part of ERT - Ensemble based Reservoir Tool. # # ERT is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published b...
EnkfNode.cNamespace().free(self)
<|file_name|>enkf_node.py<|end_file_name|><|fim▁begin|># Copyright (C) 2012 Statoil ASA, Norway. # # The file 'enkf_node.py' is part of ERT - Ensemble based Reservoir Tool. # # ERT is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published b...
c_pointer = EnkfNode.cNamespace().alloc_private(config_node)
<|file_name|>enkf_node.py<|end_file_name|><|fim▁begin|># Copyright (C) 2012 Statoil ASA, Norway. # # The file 'enkf_node.py' is part of ERT - Ensemble based Reservoir Tool. # # ERT is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published b...
c_pointer = EnkfNode.cNamespace().alloc(config_node)
<|file_name|>enkf_node.py<|end_file_name|><|fim▁begin|># Copyright (C) 2012 Statoil ASA, Norway. # # The file 'enkf_node.py' is part of ERT - Ensemble based Reservoir Tool. # # ERT is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published b...
raise Exception("Could not load node: %s iens: %d report: %d" % (self.name(), node_id.iens, node_id.report_step))
<|file_name|>enkf_node.py<|end_file_name|><|fim▁begin|># Copyright (C) 2012 Statoil ASA, Norway. # # The file 'enkf_node.py' is part of ERT - Ensemble based Reservoir Tool. # # ERT is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published b...
__init__
<|file_name|>enkf_node.py<|end_file_name|><|fim▁begin|># Copyright (C) 2012 Statoil ASA, Norway. # # The file 'enkf_node.py' is part of ERT - Ensemble based Reservoir Tool. # # ERT is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published b...
valuePointer
<|file_name|>enkf_node.py<|end_file_name|><|fim▁begin|># Copyright (C) 2012 Statoil ASA, Norway. # # The file 'enkf_node.py' is part of ERT - Ensemble based Reservoir Tool. # # ERT is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published b...
asGenData
<|file_name|>enkf_node.py<|end_file_name|><|fim▁begin|># Copyright (C) 2012 Statoil ASA, Norway. # # The file 'enkf_node.py' is part of ERT - Ensemble based Reservoir Tool. # # ERT is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published b...
asGenKw
<|file_name|>enkf_node.py<|end_file_name|><|fim▁begin|># Copyright (C) 2012 Statoil ASA, Norway. # # The file 'enkf_node.py' is part of ERT - Ensemble based Reservoir Tool. # # ERT is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published b...
asCustomKW
<|file_name|>enkf_node.py<|end_file_name|><|fim▁begin|># Copyright (C) 2012 Statoil ASA, Norway. # # The file 'enkf_node.py' is part of ERT - Ensemble based Reservoir Tool. # # ERT is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published b...
tryLoad
<|file_name|>enkf_node.py<|end_file_name|><|fim▁begin|># Copyright (C) 2012 Statoil ASA, Norway. # # The file 'enkf_node.py' is part of ERT - Ensemble based Reservoir Tool. # # ERT is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published b...
name
<|file_name|>enkf_node.py<|end_file_name|><|fim▁begin|># Copyright (C) 2012 Statoil ASA, Norway. # # The file 'enkf_node.py' is part of ERT - Ensemble based Reservoir Tool. # # ERT is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published b...
load
<|file_name|>enkf_node.py<|end_file_name|><|fim▁begin|># Copyright (C) 2012 Statoil ASA, Norway. # # The file 'enkf_node.py' is part of ERT - Ensemble based Reservoir Tool. # # ERT is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published b...
save
<|file_name|>enkf_node.py<|end_file_name|><|fim▁begin|># Copyright (C) 2012 Statoil ASA, Norway. # # The file 'enkf_node.py' is part of ERT - Ensemble based Reservoir Tool. # # ERT is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published b...
free
<|file_name|>382-linked-list-random-node.py<|end_file_name|><|fim▁begin|>import random # Definition for singly-linked list. # class ListNode(object): # def __init__(self, x):<|fim▁hole|>class Solution(object): _largesize = 300 def __init__(self, head): self.head = head self.lsize = 0 ...
# self.val = x # self.next = None
<|file_name|>382-linked-list-random-node.py<|end_file_name|><|fim▁begin|>import random # Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): <|fim_middle|> <|fim▁end|>
_largesize = 300 def __init__(self, head): self.head = head self.lsize = 0 while head.next: head = head.next self.lsize += 1 self.m1_idx = None self.m2_idx = None if self.lsize > self._largesize: self.m1_idx = self.lsize / 3 ...
<|file_name|>382-linked-list-random-node.py<|end_file_name|><|fim▁begin|>import random # Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): _largesize = 300 def __init__(self, head): <|fim...
self.head = head self.lsize = 0 while head.next: head = head.next self.lsize += 1 self.m1_idx = None self.m2_idx = None if self.lsize > self._largesize: self.m1_idx = self.lsize / 3 # start from 1/3 self.m1 = self._getN(s...
<|file_name|>382-linked-list-random-node.py<|end_file_name|><|fim▁begin|>import random # Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): _largesize = 300 def __init__(self, head): self....
n -= 1 p = self.head while n: p = p.next n -= 1 return p
<|file_name|>382-linked-list-random-node.py<|end_file_name|><|fim▁begin|>import random # Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): _largesize = 300 def __init__(self, head): self....
def _get(delta, start): p = start while delta: p = p.next delta -= 1 return p.val nextpos = random.randint(0, self.lsize) if not self.m1_idx: return _get(nextpos, self.head) if nextpos < self.m1_idx: ...
<|file_name|>382-linked-list-random-node.py<|end_file_name|><|fim▁begin|>import random # Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): _largesize = 300 def __init__(self, head): self....
p = start while delta: p = p.next delta -= 1 return p.val
<|file_name|>382-linked-list-random-node.py<|end_file_name|><|fim▁begin|>import random # Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): _largesize = 300 def __init__(self, head): self....
self.m1_idx = self.lsize / 3 # start from 1/3 self.m1 = self._getN(self.m1_idx) self.m2_idx = self.m1_idx * 2 # start from 2/3 self.m2 = self._getN(self.m2_idx)
<|file_name|>382-linked-list-random-node.py<|end_file_name|><|fim▁begin|>import random # Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): _largesize = 300 def __init__(self, head): self....
return _get(nextpos, self.head)
<|file_name|>382-linked-list-random-node.py<|end_file_name|><|fim▁begin|>import random # Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): _largesize = 300 def __init__(self, head): self....
val = _get(nextpos, self.head)
<|file_name|>382-linked-list-random-node.py<|end_file_name|><|fim▁begin|>import random # Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): _largesize = 300 def __init__(self, head): self....
val = _get(nextpos - self.m1_idx, self.m1)
<|file_name|>382-linked-list-random-node.py<|end_file_name|><|fim▁begin|>import random # Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): _largesize = 300 def __init__(self, head): self....
val = _get(nextpos - self.m2_idx, self.m2)