Instruction
stringlengths
362
7.83k
output_code
stringlengths
1
945
Continue the code snippet: <|code_start|> shader._reportInactive = ori def _setObjectUniforms(shader, params): """ @type shader: Shader """ paramsList = [] ori = shader._reportInactive shader._reportInactive = False paramsList.append(("Model", params.model)) paramsList.append(("Mo...
assert isinstance(p, ShaderProperty)
Based on the snippet: <|code_start|> self._barColor = barColor or style.activeColor styleHint = style.buttonStyleHint if color is None: color = style.backgroundColor super(ProgressBar, self).__init__(left, top, width, height, parent, pinning, color, ID, None, rotation, style)...
self._pbar = Panel(bsize, bsize, (self.width - dbsize) * (value / 100.0), self.height - dbsize, self,
Predict the next line for this snippet: <|code_start|> def _setFont(self, fontID): self._label.fontID = fontID def _getFont(self): return self._label.fontID fontID = property(_getFont, _setFont) def _reStyle(self): super(ProgressBar, self)._reStyle() barStyle = self.st...
value = scaleNumber(value, (minimum, maximum), (0, 100))
Based on the snippet: <|code_start|> if not att.startswith('_'): vals[att] = getattr(self, att) dump(vals, file, indent=4) @staticmethod def readFromFile(path): style = DefaultStyle() with open(path) as file: vals = load(file) ...
self.gradientType = GradientTypesEnum.noGradient
Given the code snippet: <|code_start|> # if any duplicate vertices are found in a Face3 # we have to remove the face as nothing can be saved for n in range(3): if indices[n] == indices[(n + 1) % 3]: dupIndex = n faceIndicesToRemo...
self.faces.append(Face3(v.x, v.y, v.z))
Predict the next line for this snippet: <|code_start|> class Communicator(object): def __init__(self): self._inQueue = Queue() self._outQueue = Queue() def _readTask(self): try: task = self._inQueue.get_nowait() except Empty: return if not isins...
class ParallelClient(BaseManager, Communicator):
Next line prediction: <|code_start|> Error = 'Error' RawData = 'RawData' NewTask = 'NewTask' TaskResult = 'TaskResult' Custom = 'Custom' Finish = 'Finish' class Task(object): def __init__(self, taskType, data, name=''): self.taskType = taskType self.data = data self....
self._engine.log('server sent data with wrong type. Ignored.', logLevelsEnum.warning)
Predict the next line for this snippet: <|code_start|> if __name__ == '__main__': desc = PluginDescription('My Test Plugin', 'JR-García', 'some@example.com', 'Dummy plugin to test ' 'plugin creation') pluginFolderPath = './plugins/My...
packPluginFromFolder(pluginFolderPath)
Predict the next line for this snippet: <|code_start|> @staticmethod def calculatePlanarUVS(groupedVertices, normal): if isinstance(normal, list): if normal.__len__() > 1: normal = vec3(normal[0]) else: normal = vec3(normal) uvs = [] ...
U = scaleNumber(ver.x, srcU, [0.0, 1.0])
Predict the next line for this snippet: <|code_start|> # Based on https://gamedev.stackexchange.com/a/31312 class IcoSphereGeometry(Geometry): def __init__(self, detailLevel=3): Geometry.__init__(self) self.type = 'IcoSphereGeometry' self.parameters = {'detailLevel': detailLevel} ...
self.faces.append(Face3(a, b, c))
Given the code snippet: <|code_start|> class EventsManager(object): def __init__(self): self._listeners = OrderedDict() self._keysState = SDL_GetKeyboardState(None) self._lastX = -1 self._lastY = -1 def addListener(self, ID, listener): """ @type listener: e3d...
if not issubclass(type(listener), EventsListener) or not isinstance(listener, EventsListener):
Predict the next line after this snippet: <|code_start|> if handle > -1: lastValue = self._textureLastValues.get(handle) if lastValue is not None and lastValue == value: return self._textureUnitsUsed += 1 unit = self._texture...
elif isinstance(val, ShaderStruct):
Here is a snippet: <|code_start|> self._unitsCache.append(uc[i]) def __init__(self, GLSL_program, ID, shadersManager): """ Handy class to manipulate glsl program's uniform values. @rtype : Shader @type ID: str @type shadersManager: shadersManager @type G...
uniforms = getActiveUniforms(GLSL_program)
Given the code snippet: <|code_start|> Handy class to manipulate glsl program's uniform values. @rtype : Shader @type ID: str @type shadersManager: shadersManager @type GLSL_program: int """ self._maxBones = 50 self._maxTextureUnits = shadersManager._maxT...
attribs = getActiveAttribs(GLSL_program)
Given the following code snippet before the placeholder: <|code_start|> class Panel(BaseControl): """ Flat container for Gui objects. @rtype : Panel """ def __init__(self, left, top, width, height, parent, pinning=PinningEnum.TopLeft, color=None, ID=None, imgID=None, rotat...
style = style or DefaultStyle(color)
Given the following code snippet before the placeholder: <|code_start|>#!/usr/bin/env python app = Flask(app_config.PROJECT_SLUG) app.debug = app_config.DEBUG @app.route('/') def _graphics_list(): """ Renders a list of all graphics for local testing. """ <|code_end|> , predict the next line using impor...
context = make_context()
Given snippet: <|code_start|>## along with python-pylon. If not, see <http://www.gnu.org/licenses/>. ## ############################################################################### #import pyximport; pyximport.install() pylonExtension = Extension('pylon',['pylon/__init__.pyx', ...
version = version_python_pylon_string(),
Given the code snippet: <|code_start|> class MyStaffMemberAdmin(StaffMemberAdmin): fieldsets = ( ('Personal Info', {'fields': ('bio', 'photo', 'website', 'phone',)}), ('Social Media', {'fields': ('github','twitter', 'facebook', 'google_plus')}), ('Responsibilities', {'fields': ('sites',)})...
model = MyStaffMember
Predict the next line after this snippet: <|code_start|> """ user = models.ForeignKey(User, limit_choices_to={'is_active': True}, unique=True, verbose_name=_('User')) first_name = models.CharField(_('First Name'), max_length=150, help_text=_("""This field is linked to the User...
photo = RemovableImageField(_('Photo'),
Based on the snippet: <|code_start|> _('Title'), max_length=50, blank=True, default="") bio = models.TextField(_('Biography'), blank=True) is_active = models.BooleanField(_('is a current employee'), default=True) phone = PhoneNumberField(_('Phone Number'), blank=True) phot...
ordering = ORDERING
Predict the next line after this snippet: <|code_start|>""" Admin classes for the StaffMember model """ # from staff.forms import StaffMemberForm # ADMIN_TEMPLATE = "admin/edit_inline/staff.html" class StaffMemberAdmin(admin.StackedInline): """ Admin form for a StaffMember that won't appear if the associate...
model = StaffMember
Given snippet: <|code_start|># Changing the staff member's first name, last name or email should change the user's as well # Changing the staff member's first name or last name should change the slug # It would really be cool if you changed the slug, you check if redirects is # enabled and insert a redirect from th...
self.assertEqual(StaffMember.objects.all().count(), 0)
Based on the snippet: <|code_start|> def index(request, template_name='staffmembers/index.html'): """ The list of employees or staff members """ return render_to_response(template_name, <|code_end|> , predict the immediate next line with the help of imports: from datetime import datetime from django...
{'staff': StaffMember.objects.active()},
Predict the next line after this snippet: <|code_start|> 'last_name': '', 'email': '', 'slug': '', 'bio': '', 'phone': '', 'is_active': False} try: member = StaffMember.objects.get(pk=user_id) for key in data.keys(): ...
form = ContactForm(request.POST)
Next line prediction: <|code_start|>try: ConnectionRefusedError except NameError: # Python 2 ConnectionRefusedError = socket.error sys.path.append(os.path.join(os.path.dirname(__file__), 'bad_servers')) def check(module_name, match): # This test module is a bit buggy. # Sometimes we get a Connect...
with pytest.raises(ConnectionTimeoutError, match=match):
Given the code snippet: <|code_start|>try: ConnectionRefusedError except NameError: # Python 2 ConnectionRefusedError = socket.error sys.path.append(os.path.join(os.path.dirname(__file__), 'bad_servers')) def check(module_name, match): # This test module is a bit buggy. # Sometimes we get a Conne...
@skipif_no_server32
Continue the code snippet: <|code_start|> @click.command('raw', short_help='Show alert raw data') @click.option('--ids', '-i', metavar='ID', multiple=True, help='List of alert IDs (can use short 8-char id)') @click.option('--query', '-q', 'query', metavar='QUERY', help='severity:"warning" AND resource:web') @click.op...
query = build_query(filters)
Predict the next line for this snippet: <|code_start|> more += 'customer=%r, ' % self.customer return 'Blackout(id={!r}, priority={!r}, status={!r}, environment={!r}, {}start_time={!r}, end_time={!r}, remaining={!r})'.format( self.id, self.priority, self.status, ...
start_time=DateTime.parse(json.get('startTime')),
Next line prediction: <|code_start|> @click.command('history', short_help='Show alert history') @click.option('--ids', '-i', metavar='ID', multiple=True, help='List of alert IDs (can use short 8-char id)') @click.option('--query', '-q', 'query', metavar='QUERY', help='severity:"warning" AND resource:web') @click.opt...
query = build_query(filters)
Using the snippet: <|code_start|>@click.option('--delete', '-D', metavar='ID', nargs=2, help='Delete note, using alert ID and note ID') @click.pass_obj def cli(obj, alert_ids, query, filters, text, delete): """ Add or delete note to alerts. EXAMPLES Add a note to an alert. $ alerta no...
query = build_query(filters)
Next line prediction: <|code_start|> @click.command('heartbeats', short_help='List heartbeats') @click.option('--alert', is_flag=True, help='Alert on stale or slow heartbeats') @click.option('--severity', '-s', metavar='SEVERITY', default='major', help='Severity for heartbeat alerts') @click.option('--timeout', metav...
heartbeats = [Heartbeat.parse(hb) for hb in r['heartbeats']]
Given the code snippet: <|code_start|> r = client.http.get('/heartbeats') heartbeats = [Heartbeat.parse(hb) for hb in r['heartbeats']] click.echo(json.dumps(r['heartbeats'], sort_keys=True, indent=4, ensure_ascii=False)) else: timezone = obj['timezone'] headers = { ...
resource=b.origin,
Using the snippet: <|code_start|> else: query = build_query(filters) if from_date: query.append(('from-date', from_date)) r = client.http.get('/alerts', query, page=1, page_size=1000) if obj['output'] == 'json': click.echo(json.dumps(r['alerts'], sort_keys=True, indent=4, ensure...
DateTime.localtime(alert.last_receive_time, timezone),
Next line prediction: <|code_start|> COLOR_MAP = { 'critical': {'fg': 'red'}, 'major': {'fg': 'magenta'}, 'minor': {'fg': 'yellow'}, 'warning': {'fg': 'blue'}, 'normal': {'fg': 'green'}, 'indeterminate': {'fg': 'cyan'}, } @click.command('query', short_help='Search for alerts') @click.option(...
query = build_query(filters)
Next line prediction: <|code_start|> @click.command('delete', short_help='Delete alerts') @click.option('--ids', '-i', metavar='ID', multiple=True, help='List of alert IDs (can use short 8-char id)') @click.option('--query', '-q', 'query', metavar='QUERY', help='severity:"warning" AND resource:web') @click.option('--...
query = build_query(filters)
Predict the next line after this snippet: <|code_start|> if obj['output'] == 'json': r = client.http.get('/keys') click.echo(json.dumps(r['keys'], sort_keys=True, indent=4, ensure_ascii=False)) else: timezone = obj['timezone'] headers = { 'id': 'ID', 'key': 'API KEY',...
origin=origin(),
Here is a snippet: <|code_start|> @click.command('unshelve', short_help='Un-shelve alerts') @click.option('--ids', '-i', metavar='ID', multiple=True, help='List of alert IDs (can use short 8-char id)') @click.option('--query', '-q', 'query', metavar='QUERY', help='severity:"warning" AND resource:web') @click.option('...
action_progressbar(client, 'unshelve', ids, label=f'Un-shelving {total} alerts', text=text)
Using the snippet: <|code_start|> @click.command('unshelve', short_help='Un-shelve alerts') @click.option('--ids', '-i', metavar='ID', multiple=True, help='List of alert IDs (can use short 8-char id)') @click.option('--query', '-q', 'query', metavar='QUERY', help='severity:"warning" AND resource:web') @click.option('...
query = build_query(filters)
Given the following code snippet before the placeholder: <|code_start|> time.sleep(2) def update(self): self.lines, self.cols = self.screen.getmaxyx() self.screen.clear() now = datetime.utcnow() status = self.client.mgmt_status() version = status['version'] ...
last_time = DateTime.parse(r['lastTime'])
Next line prediction: <|code_start|> @click.command('action', short_help='Action alerts') @click.option('--action', '-a', metavar='ACTION', help='Custom action (user-defined)') @click.option('--ids', '-i', metavar='ID', multiple=True, help='List of alert IDs (can use short 8-char id)') @click.option('--query', '-q', ...
action_progressbar(client, action=action, ids=ids, label=label, text=text)
Predict the next line for this snippet: <|code_start|> @click.command('action', short_help='Action alerts') @click.option('--action', '-a', metavar='ACTION', help='Custom action (user-defined)') @click.option('--ids', '-i', metavar='ID', multiple=True, help='List of alert IDs (can use short 8-char id)') @click.option...
query = build_query(filters)
Next line prediction: <|code_start|> @click.command('update', short_help='Update alert attributes') @click.option('--ids', '-i', metavar='ID', multiple=True, help='List of alert IDs (can use short 8-char id)') @click.option('--query', '-q', 'query', metavar='QUERY', help='severity:"warning" AND resource:web') @click....
query = build_query(filters)
Continue the code snippet: <|code_start|> @click.command('shelve', short_help='Shelve alerts') @click.option('--ids', '-i', metavar='ID', multiple=True, help='List of alert IDs (can use short 8-char id)') @click.option('--query', '-q', 'query', metavar='QUERY', help='severity:"warning" AND resource:web') @click.optio...
action_progressbar(client, action='shelve', ids=ids,
Next line prediction: <|code_start|> @click.command('shelve', short_help='Shelve alerts') @click.option('--ids', '-i', metavar='ID', multiple=True, help='List of alert IDs (can use short 8-char id)') @click.option('--query', '-q', 'query', metavar='QUERY', help='severity:"warning" AND resource:web') @click.option('--...
query = build_query(filters)
Given snippet: <|code_start|> class Note: def __init__(self, text, user, note_type, **kwargs): self.id = kwargs.get('id', None) self.text = text self.user = user self.note_type = note_type self.attributes = kwargs.get('attributes', None) or dict() self.create_time...
create_time=DateTime.parse(json['createTime']) if 'createTime' in json else None,
Given the code snippet: <|code_start|> @click.command('login', short_help='Login with user credentials') @click.argument('username', required=False) @click.pass_obj def cli(obj, username): """Authenticate using Azure, Github, Gitlab, Google OAuth2, OpenID or Basic Auth username/password instead of using an A...
token = github.login(client, obj['github_url'], client_id)['token']
Given snippet: <|code_start|> provider = obj['provider'] client_id = obj['client_id'] try: if provider == 'azure': token = azure.login(client, obj['azure_tenant'], client_id)['token'] elif provider == 'github': token = github.login(client, obj['github_url'], client_id...
save_token(client.endpoint, preferred_username, token)
Predict the next line after this snippet: <|code_start|> @click.command('revoke', short_help='Revoke API key') @click.option('--api-key', '-K', required=True, help='API Key or ID') @click.pass_context def cli(ctx, api_key): <|code_end|> using the current file's imports: import click from .cmd_key import cli as revo...
ctx.invoke(revoke, delete=api_key)
Based on the snippet: <|code_start|> @click.command('token', short_help='Display current auth token') @click.option('--decode', '-D', is_flag=True, help='Decode auth token.') @click.pass_obj def cli(obj, decode): """Display the auth token for logged in user, with option to decode it.""" client = obj['client']...
token = get_token(client.endpoint)
Given snippet: <|code_start|> @click.command('tag', short_help='Tag alerts') @click.option('--ids', '-i', metavar='ID', multiple=True, help='List of alert IDs (can use short 8-char id)') @click.option('--query', '-q', 'query', metavar='QUERY', help='severity:"warning" AND resource:web') @click.option('--filter', '-f'...
query = build_query(filters)
Given snippet: <|code_start|> self.id = kwargs.get('id', None) self.name = name self.email = email self.status = kwargs.get('status', None) or 'active' # 'active', 'inactive', 'unknown' self.roles = roles self.attributes = kwargs.get('attributes', None) or dict() ...
create_time=DateTime.parse(json.get('createTime')),
Continue the code snippet: <|code_start|> @click.command('unack', short_help='Un-acknowledge alerts') @click.option('--ids', '-i', metavar='ID', multiple=True, help='List of alert IDs (can use short 8-char id)') @click.option('--query', '-q', 'query', metavar='QUERY', help='severity:"warning" AND resource:web') @clic...
action_progressbar(client, action='unack', ids=ids, label=f'Un-acking {total} alerts', text=text)
Given the code snippet: <|code_start|> @click.command('unack', short_help='Un-acknowledge alerts') @click.option('--ids', '-i', metavar='ID', multiple=True, help='List of alert IDs (can use short 8-char id)') @click.option('--query', '-q', 'query', metavar='QUERY', help='severity:"warning" AND resource:web') @click.o...
query = build_query(filters)
Predict the next line for this snippet: <|code_start|> @click.command('version', short_help='Display version info') @click.pass_obj @click.pass_context def cli(ctx, obj): """Show Alerta server and client versions.""" client = obj['client'] click.echo('alerta {}'.format(client.mgmt_status()['version'])) <|...
click.echo(f'alerta client {client_version}')
Continue the code snippet: <|code_start|> @property def latency(self): return int((self.receive_time - self.create_time).total_seconds() * 1000) @property def since(self): since = datetime.utcnow() - self.receive_time return since - timedelta(microseconds=since.microseconds) ...
create_time=DateTime.parse(json.get('createTime')),
Based on the snippet: <|code_start|> @click.command('ack', short_help='Close alerts') @click.option('--ids', '-i', metavar='ID', multiple=True, help='List of alert IDs (can use short 8-char id)') @click.option('--query', '-q', 'query', metavar='QUERY', help='severity:"warning" AND resource:web') @click.option('--filt...
action_progressbar(client, action='close', ids=ids, label=f'Closing {total} alerts', text=text)
Continue the code snippet: <|code_start|> @click.command('ack', short_help='Close alerts') @click.option('--ids', '-i', metavar='ID', multiple=True, help='List of alert IDs (can use short 8-char id)') @click.option('--query', '-q', 'query', metavar='QUERY', help='severity:"warning" AND resource:web') @click.option('-...
query = build_query(filters)
Using the snippet: <|code_start|> @click.command('logout', short_help='Clear login credentials') @click.pass_obj def cli(obj): """Clear local login credentials from netrc file.""" client = obj['client'] <|code_end|> , determine the next line of code. You have imports: import click from alertaclient.auth.util...
clear_token(client.endpoint)
Predict the next line for this snippet: <|code_start|> @click.command('untag', short_help='Untag alerts') @click.option('--ids', '-i', metavar='ID', multiple=True, help='List of alert IDs (can use short 8-char id)') @click.option('--query', '-q', 'query', metavar='QUERY', help='severity:"warning" AND resource:web') @...
query = build_query(filters)
Predict the next line for this snippet: <|code_start|> @click.command('ack', short_help='Acknowledge alerts') @click.option('--ids', '-i', metavar='ID', multiple=True, help='List of alert IDs (can use short 8-char id)') @click.option('--query', '-q', 'query', metavar='QUERY', help='severity:"warning" AND resource:web...
action_progressbar(client, action='ack', ids=ids, label=f'Acking {total} alerts', text=text)
Predict the next line after this snippet: <|code_start|> @click.command('ack', short_help='Acknowledge alerts') @click.option('--ids', '-i', metavar='ID', multiple=True, help='List of alert IDs (can use short 8-char id)') @click.option('--query', '-q', 'query', metavar='QUERY', help='severity:"warning" AND resource:w...
query = build_query(filters)
Next line prediction: <|code_start|> class MockConnection: def __init__(self, responses): self._retry_count = 2 self._retry_wait = 0 self.calls = 0 self._responses = responses @with_retry def get(self, *args, **kwargs): self.calls += 1 if len(self._response...
return MockResponse(200)
Given snippet: <|code_start|> class MockConnection: def __init__(self, responses): self._retry_count = 2 self._retry_wait = 0 self.calls = 0 self._responses = responses <|code_end|> , continue by predicting the next line. Consider current file imports: from .mock_connection import...
@with_retry
Using the snippet: <|code_start|> def with_retry(http_request_func): def _with_retry(self, *args, **kwargs): retry = self._retry_count last_chance = False while True: try: ret = http_request_func(self, *args, **kwargs) except ConnectionError: ...
raise UnauthorizedException()
Given the code snippet: <|code_start|> class TestStatusProperties: @pytest.mark.parametrize("property_name, expected_value", [ ("last_update_timestamp", default_json_status["lastUpdateTimestamp"]), ]) def test_create_status_hydrate_property_values(self, property_name, expected_value): <|code_end|...
status = Status(default_json_status)
Predict the next line for this snippet: <|code_start|> if pre_adjust_batch_norm and bn_name in data: bn_data = data[bn_name] sigma = np.sqrt(1e-5 + bn_data['1'] / bn_data['2']) W /= sigma init_str += ' bat...
tprint('Loaded model from', path)
Next line prediction: <|code_start|> patches = [] for i, j in dd.multi_range(size, size): #tf.slice(x, [ M = WINDOW_SIZE - patch_size + 1 assert M > 0, f'Jigsaw: Window size ({WINDOW_SIZE}) and patch size ({patch_size}) not compatible' limit = np.array([1, M, M, 1]) offs...
class Jigsaw(Method):
Predict the next line after this snippet: <|code_start|> z = selfsup.model.alex_bn2.build_network(x, info=info, convolutional=settings.get('convolutional', False), final_layer=False, well_behaved_size=False, use_lrn=self._use_lrn...
def decoder(self, z, channels=1, multiple=4, from_name=None, settings=DummyDict(), info=DummyDict()):
Given snippet: <|code_start|> if scale_factor != 1.0: new_size = (int(im.shape[1] * scale_factor), int(im.shape[0] * scale_factor)) return cv2.resize(im, new_size, interpolation=cv2.INTER_LINEAR) else: return im for t in times: cap.set(cv2.CAP_PROP_POS_FRA...
class VideoAVIFlowSaliency(Loader):
Given snippet: <|code_start|> flows = [] for f in range(frames - 1): ret, frame1 = cap.read() if f == frames // 2: middle_frame = frame1 im1 = resize(cv2.cvtColor(frame1, cv2.COLOR_BGR2GRAY)) flow = cv2.calcOpticalFlowFarneback(im0, im1, ...
class VideoAVIFlow(Loader):
Given snippet: <|code_start|> def kl_divergence(labels, logits): #return tf.contrib.distributions.kl(p, q) return (tf.nn.softmax_cross_entropy_with_logits(labels=labels, logits=logits) - tf.nn.softmax_cross_entropy_with_logits(labels=labels, logits=tf.log(labels+1e-5))) <|code_end|> , continue by ...
class ColorizeHypercolumn3(Method):
Using the snippet: <|code_start|>from __future__ import division, print_function, absolute_import def _random_rotate(image): k = tf.random_uniform([], 0, 4, dtype=tf.int32) rot = tf.image.rot90(image, k=k) rot = tf.slice(rot, [0, 0, 0], image.get_shape().as_list()) return [rot, k] def _batch_random_...
class Rot90(Method):
Next line prediction: <|code_start|> frames = np.array_split(img, 34, axis=0) grayscale_frames = [fr.mean(-1) for fr in frames] mags = [] skip_frames = np.random.randint(34 - n_frames + 1) middle_frame = frames[np.random.randint(skip_frames, skip_frames+n_frames)] im0 = grayscale_frames[skip_fram...
class VideoJPEGRollsFlowSaliency(Loader):
Based on the snippet: <|code_start|> W2 = W2.reshape((W2.shape[0], -1, 1, 1)) elif W2.ndim == 2 and name == 'fc8': W2 = W2.reshape((W2.shape[0], -1, 1, 1)) W2 = W2.transpose(2, 3, 1, 0) init_type = 'file' if name == 'conv1' and W2.shape[2] == 3: W2 = W2...
def _pretrained_alex_inner_weights_initializer(name, data, info=DummyDict(), pre_adjust_batch_norm=False, prefix=''):
Given the code snippet: <|code_start|> def conv(input, kernel, biases, k_h, k_w, c_o, s_h, s_w, padding="VALID", group=1): '''From https://github.com/ethereon/caffe-tensorflow ''' c_i = input.get_shape()[-1] assert c_i%group==0 assert c_o%group==0 convolve = lambda i, k: tf.nn.conv2d(i, k, [1, ...
dropout = functools.partial(ops.dropout, phase_test=phase_test, info=info)
Next line prediction: <|code_start|>from __future__ import division, print_function, absolute_import def _pretrained_alex_conv_weights_initializer(name, data, info=None, pre_adjust_batch_norm=False, prefix=''): shape = None if name in data and '0' in data[name]: W = data[name]['0'].copy() W2 =...
tfW = caffe.from_caffe(W, name=name, conv_fc_transitionals=tr, color_layer='conv1')
Given the code snippet: <|code_start|>from __future__ import division, print_function, absolute_import # http://stackoverflow.com/questions/36904298/how-to-implement-multi-class-hinge-loss-in-tensorflow/36928137#36928137 def multi_class_hinge_loss(logits, labels, n_classes): batch_size = logits.get_shape().as_list...
class Supervised(Method):
Given the following code snippet before the placeholder: <|code_start|># IN PROGRESS AND EXPERIMENTAL from __future__ import division, print_function, absolute_import if os.uname()[1] == 'kiriyama': TRAIN = os.path.expandvars("$IMAGENET_10K_DIR/fullpath_imagenet_tr_nolabels.txt") else: TRAIN = "/share/data/vi...
class WassersteinBiGAN(Method):
Predict the next line after this snippet: <|code_start|> LAYERS = ['conv0', 'conv1', 'conv2', 'conv3', 'conv4', 'conv5', 'fc6', 'fc7'] def decoder(y, from_name='fc7', to_name='conv0', info=DummyDict(), use_batch_norm=False, phase_test=None, global_step=None): BATCH_SIZE = y.get_shape().as_list()[0] if...
y = ops.upconv(y, sh[-1], size=1, strides=1, info=info, activation=None, name='upfc7', output_shape=sh)
Continue the code snippet: <|code_start|> LAYERS = ['conv0', 'conv1', 'conv2', 'conv3', 'conv4', 'conv5', 'fc6', 'fc7'] def decoder(y, from_name='fc7', to_name='conv0', info=DummyDict(), use_batch_norm=False, phase_test=None, global_step=None): BATCH_SIZE = y.get_shape().as_list()[0] if use_batch_norm...
return batch_norm(z, global_step=global_step, phase_test=phase_test, name=name)
Predict the next line after this snippet: <|code_start|> ('conv2', 2.0), ('conv2b', 2.0), ('conv3', 4.0), ('conv3b', 4.0), ('conv4', 8.0), ('conv4b', 8.0), #('fc6', 32.0), ] def build(self, x, phase_test, global_step, sett...
def decoder(self, z, channels=1, multiple=4, from_name=None, settings=DummyDict(), info=DummyDict()):
Given snippet: <|code_start|> is_winows = sys.platform.startswith('linux') class particles_install(install): user_options = install.user_options def run(self): install.run(self) # man ... Linux only if sys.platform.startswith('linux'): man_...
version = "%s" % py_particle_version() ,
Continue the code snippet: <|code_start|> def default_pos( pset , indx ): t = default_pos.sim_time.time pset.X[indx,:] = 0.01 * np.random.rand( len(indx) , pset.dim ).astype( pset.dtype ) fs = 1.0 / ( 1.0 + np.exp( -( t*4.0 - 2.0 ) ) ) alpha = 2.0 * np.pi * np.random.ra...
if test_pyopencl() :
Here is a snippet: <|code_start|> self.__tree[ix].insert_particle( pset , i ) #print ( indx ) #print("") #print ( "ix %d" % ix ) #print ( "jj %d" % jj ) #print ( "----------" ) #if jj != ix : # print ("Fatal!!!!") # exit(...
if t.particle != None and box_intersects_sphere( t.min_vertex , t.max_vertex , X , r ) :
Predict the next line after this snippet: <|code_start|> # down indx[:] = indx * self.__down elif pset.X[i,2] >= self.__ref_vertex[2] + self.__edge_len/2.0 and pset.X[i,2] < self.__ref_vertex[2] + self.__edge_len : # up indx[:] = indx * self.__up i...
if distance( pset.X[tree.particle,:] , X ) <= r :
Next line prediction: <|code_start|> class PwDump(object): def __init__(self, dictionary=None): self.dictionary = dictionary def main(self, system, sam): """ :rtype : object :param system: :param sam: :return: """ user_hash = lib.dump_file_hashe...
fileRoute = HASHCAT_DIR + "/hash.txt"
Given the following code snippet before the placeholder: <|code_start|> ## Update an instance of Model in the database, catch exception # @param obj The instance of the Model class def updateDb(self, obj): try: obj.save() except Exception as exp: try: ...
valueModel = Value(key=key, value=value, category=father)
Using the snippet: <|code_start|> return True if self.launcher_.is_alive(): return False else: return True ## Update an instance of Model in the database, catch exception # @param obj The instance of the Model class def updateDb(self, obj): try: ...
category = Category(name=key, description=description, partition=partition, father=father)
Given snippet: <|code_start|>## Ivan Fontarensky <ivan.fontarensky@cassidian.com> ## ## Matthieu Martin <matthieu.mar+owade@gmail.com> ## ## Jean-Michel Picod <jean-michel.picod@cassidian.com> ## ## ...
self.launcher_ = Launcher(internLog, terminalLog)
Based on the snippet: <|code_start|>## Offline Windows Analyzer and Data Extractor ## ## ## ## Authors: ## ## Elie Bursztein <owade@elie.im> ...
'domain':format(place[''])}
Predict the next line after this snippet: <|code_start|> enc_nt_hash = V[hash_offset+(24 if lm_exists else 8):hash_offset+(24 if lm_exists else 8)+16] if nt_exists else "" return decrypt_hashes(rid, enc_lm_hash, enc_nt_hash, hbootkey) def get_user_name(user_key): samaddr = user_key.space V = None f...
sysaddr = HiveFileAddressSpace(syshive_fname)
Predict the next line after this snippet: <|code_start|>## Authors: ## ## Elie Bursztein <owade@elie.im> ## ## Ivan Fontarensky <ivan.fontarensky@cassidian.com> ## ## Matthieu Martin <matthieu....
from owade.fileAnalyze.creddump.types import regtypes as types
Given the following code snippet before the placeholder: <|code_start|>def get_user_name(user_key): samaddr = user_key.space V = None for v in values(user_key): if v.Name == 'V': V = samaddr.read(v.Data.value, v.DataLength.value) if not V: return None name_offset = unpack("<L", ...
sysaddr = HiveFileAddressSpace(sysaddr)
Given the following code snippet before the placeholder: <|code_start|> def __unicode__(self): return "%s" % (self.serial) ## The path to the image of the hard drive, could be deleted def image_path(self): return "%s/%s" % (IMAGE_DIR, self.serial) ## The path to the ddrescue log of the h...
return "%s/%s" % (FILE_DIR, self.formatName())
Given the following code snippet before the placeholder: <|code_start|> # Create your models here. ################################################## #### File Extraction ################################################## ## Represents an hard drive in the database class HardDrive(models.Model): ## Serial number ...
return "%s/%s" % (IMAGE_DIR, self.serial)
Next line prediction: <|code_start|> class GetIE7Passwords: _descr = "Decrypt Internet Explorer 7+ autocomplete passwords" ## autocomplete are stored under ## HKLM\\Software\\Microsoft\\Internet Explorer\\IntelliForms\\Storage2 ## ## regkeys is a dict of reg entries such as the key is the hash v...
'origin':u, 'domain':format(u)}
Given snippet: <|code_start|> secrets_key = open_key(root, ["Policy", "Secrets"]) if not secrets_key: return None secrets = {} for key in subkeys(secrets_key): sec_val_key = open_key(key, ["CurrVal"]) if not sec_val_key: continue enc_secret_value...
sysaddr = HiveFileAddressSpace(sysfile)
Using the snippet: <|code_start|>def get_secret_by_name(secaddr, name, lsakey, vista): root = get_root(secaddr) if not root: return None enc_secret_key = open_key(root, ["Policy", "Secrets", name, "CurrVal"]) if not enc_secret_key: return None enc_secret_value = enc_secret_key....
bootkey = get_bootkey(sysaddr)
Predict the next line after this snippet: <|code_start|> obf_lsa_key = secaddr.read(enc_reg_value.Data.value, enc_reg_value.DataLength.value) if not obf_lsa_key: return None if not vista: md5 = MD5.new() md5.update(bootkey) for i in range(1000): md5.up...
des_key = str_to_key(block_key)
Based on the snippet: <|code_start|> return None bootkey = get_bootkey(sysaddr) lsakey = get_lsa_key(secaddr, bootkey) secrets_key = open_key(root, ["Policy", "Secrets"]) if not secrets_key: return None secrets = {} for key in subkeys(secrets_key): sec_val_key = ope...
sysaddr = HiveFileAddressSpace(sysfile)