text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: geertj/draco2 path: /draco2/database/test/test_dbapi.py lumns.""" conn = self.database.connection() cursor = conn.cursor() dialect = self.database.dialect() dbapi = self.database.dbapi() query = dialect.translate('DROP TABLE test_integer') try: ...
code_fim
hard
{ "lang": "python", "repo": "geertj/draco2", "path": "/draco2/database/test/test_dbapi.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_blob(self): """Test data insertion and retrieval to text columns.""" conn = self.database.connection() cursor = conn.cursor() dialect = self.database.dialect() dbapi = self.database.dbapi() query = dialect.translate('DROP TABLE test_blob') ...
code_fim
hard
{ "lang": "python", "repo": "geertj/draco2", "path": "/draco2/database/test/test_dbapi.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>lsView urlpatterns = [ path('<pk>', MbuDetailsView.as_view(), name="mbu>details"), ]<|fim_prefix|># repo: dchaplinsky/ragoogle path: /mbu/urls.py from django.urls import path from django.con<|fim_middle|>f.urls import url from .views import MbuDetai
code_fim
easy
{ "lang": "python", "repo": "dchaplinsky/ragoogle", "path": "/mbu/urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dchaplinsky/ragoogle path: /mbu/urls.py from django.urls import path from django.con<|fim_suffix|>DetailsView.as_view(), name="mbu>details"), ]<|fim_middle|>f.urls import url from .views import MbuDetailsView urlpatterns = [ path('<pk>', Mbu
code_fim
medium
{ "lang": "python", "repo": "dchaplinsky/ragoogle", "path": "/mbu/urls.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> This method changes the power state and polls AMT until the desired power state is reached. :param task: a TaskManager instance contains the target node. :param target_state: desired power state. :returns: one of ironic.common.states. :raises: PowerStateFailure if cannot set the n...
code_fim
hard
{ "lang": "python", "repo": "foxhua/ironic", "path": "/ironic/drivers/modules/amt/power.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: foxhua/ironic path: /ironic/drivers/modules/amt/power.py # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
code_fim
hard
{ "lang": "python", "repo": "foxhua/ironic", "path": "/ironic/drivers/modules/amt/power.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return list(self._plugins) def isregistered(self, plugin): return plugin in self._plugins def listattr(self, attrname, plugins=None, extra=(), reverse=False): l = [] if plugins is None: plugins = self._plugins if extra: plugins += ...
code_fim
hard
{ "lang": "python", "repo": "yanhongliu/DARLAB", "path": "/InvTL/lm_py/analysis/dotviewer/py/_com.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yanhongliu/DARLAB path: /InvTL/lm_py/analysis/dotviewer/py/_com.py """ py lib plugins and events. you can write plugins that extend the py lib API. currently this is mostly used by py.test registering a plugin ++++++++++++++++++++++++++++++++++ :: >>> class MyPlugin: ... def pyev...
code_fim
hard
{ "lang": "python", "repo": "yanhongliu/DARLAB", "path": "/InvTL/lm_py/analysis/dotviewer/py/_com.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rodrigosilvanew/pythonexercicios-guanabara path: /ex028.py import random, emoji from time import sleep #sleep faz com que o computador demore alguns segundos n = int(input('Adivinhe qual o número escolhido pelo computador: ')) lista = [0, 1, 2, 3, 4, 5] #lista = randint(0, 5) o randint sorteari...
code_fim
medium
{ "lang": "python", "repo": "rodrigosilvanew/pythonexercicios-guanabara", "path": "/ex028.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ojize('Sinto muito, mas você errou. Precisas treinar tuas técnicas mentais. Fala com o Professor X, talvez ele possa te ajudar! :disappointed:', use_aliases=True)) print('-=-' * 50)<|fim_prefix|># repo: rodrigosilvanew/pythonexercicios-guanabara path: /ex028.py import random, emoji from time import sleep...
code_fim
hard
{ "lang": "python", "repo": "rodrigosilvanew/pythonexercicios-guanabara", "path": "/ex028.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vra/python-cookbook path: /chapter1/1-19.py import itertools import os def anyTrue(predicate, sequence): return True in itertools.imap(predicate, sequence) def is_endwith(s, *ends): <|fim_suffix|> if __name__ == '__main__': print is_endwith('hello world', 'd', 'a', 'b') # example: fin...
code_fim
medium
{ "lang": "python", "repo": "vra/python-cookbook", "path": "/chapter1/1-19.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == '__main__': print is_endwith('hello world', 'd', 'a', 'b') # example: find image file in dir for filename in os.listdir('.'): if is_endwith(filename, '.jpg', '.png', '.jpeg', '.gif'): print filename #Bound Method example l = ['apple', 'grape', 'banan...
code_fim
medium
{ "lang": "python", "repo": "vra/python-cookbook", "path": "/chapter1/1-19.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>params = { 'format': 'json', 'action': 'query', 'prop': 'revisions', 'rvlimit': 1, 'titles': 'Python_(programming_language)' } url = 'http://en.wikipedia.org/w/api.php' pages = Wikipedia(url, params, max_requests=2) for page in pages: rev_pages = page['query']['pages'] for pag...
code_fim
medium
{ "lang": "python", "repo": "yaph/breq", "path": "/tests/wikipedia_revisions.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yaph/breq path: /tests/wikipedia_revisions.py # coding: utf-8 # Print the last 10 users that edited the Python language page. import sys sys.path.insert(0, '..') <|fim_suffix|>pages = Wikipedia(url, params, max_requests=2) for page in pages: rev_pages = page['query']['pages'] for pageid,...
code_fim
hard
{ "lang": "python", "repo": "yaph/breq", "path": "/tests/wikipedia_revisions.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: TheusZer0/ctf-archives path: /VolgaCTF/2021/Quals/crypto/Carry/fcsr.py import random import math class FCSR(): def __init__(self, q: int, m: int, a: int): self.m = m self.q = q + 1 self.k = int(math.log(q, 2)) self.a = a @staticmethod def...
code_fim
hard
{ "lang": "python", "repo": "TheusZer0/ctf-archives", "path": "/VolgaCTF/2021/Quals/crypto/Carry/fcsr.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return a_0 def encrypt(self, data: bytes) -> bytes: encrypted = b'' for byte in data: key_byte = 0 for _ in range(8): bit = self.clock() key_byte = (key_byte << 1) | bit encrypted += int.to_bytes(key_...
code_fim
hard
{ "lang": "python", "repo": "TheusZer0/ctf-archives", "path": "/VolgaCTF/2021/Quals/crypto/Carry/fcsr.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def clock(self) -> int: s = self.m for i in range(1, self.k + 1): s += self.get_i(self.q, i) * self.get_i(self.a, self.k - i) a_k = s % 2 a_0 = self.a & 0b1 self.m = s // 2 self.a = (self.a >> 1) | (a_k << (self.k - 1)) retu...
code_fim
medium
{ "lang": "python", "repo": "TheusZer0/ctf-archives", "path": "/VolgaCTF/2021/Quals/crypto/Carry/fcsr.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_rendering.py #calss header class _RENDERING(): def __init__(self,): self.name = "RENDERING" self.definitions = [u'the way that something is performed, written, drawn, etc.: ', u'a translation of a book or piece of writing into a different lang...
code_fim
medium
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/nouns/_rendering.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>Ustr = Intern.intern ustrStr = Intern.internIfStr ustr_property = Intern.internProperty ustr_func = Intern.internFuncStrings ustr_method = Intern.internMethodStrings def reset(): """Reset the module, forgetting previously defined Ustr instances. This exists for backward compatability only. It do...
code_fim
hard
{ "lang": "python", "repo": "paul-ollis/cleversheep3", "path": "/Prog/Ustr.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: paul-ollis/cleversheep3 path: /Prog/Ustr.py #!/usr/bin/env python """A module that maps unique strings to the same objects. This is useful when, for example, you have some complicated structures that are identified and referenced by names. """ __docformat__ = "restructuredtext" import os import...
code_fim
medium
{ "lang": "python", "repo": "paul-ollis/cleversheep3", "path": "/Prog/Ustr.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> { 'ENGINE': 'django.db.backends.postgresql', 'NAME': 'metanic', 'USER': 'MetanicUser', 'PASSWORD': 'MetanicDevelopment', 'HOST': 'postgres', 'PORT': '5432', } }<|fim_prefix|># repo: metanic/services path: /metanic/setti...
code_fim
medium
{ "lang": "python", "repo": "metanic/services", "path": "/metanic/settings/compose.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: metanic/services path: /metanic/settings/compose.py from metanic.settings.development import * CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', 'LOCATION': 'memcached:11211', } } DATABASES = { 'default': ...
code_fim
medium
{ "lang": "python", "repo": "metanic/services", "path": "/metanic/settings/compose.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>ser', 'PASSWORD': 'MetanicDevelopment', 'HOST': 'postgres', 'PORT': '5432', } }<|fim_prefix|># repo: metanic/services path: /metanic/settings/compose.py from metanic.settings.development import * CACHES = { 'default': { 'BACKEND': 'djan...
code_fim
hard
{ "lang": "python", "repo": "metanic/services", "path": "/metanic/settings/compose.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: xe1gyq/flydan path: /src/nav.py Returns: bool: True if success, False if killed by `EXIT` command. """ shared.status['command'] = 'STDBY' util.log_info("%s Standby, awaiting 'LIFT'." % shared.AGENT_ID) wait_count = 0 while True: time.sleep(.1) ...
code_fim
hard
{ "lang": "python", "repo": "xe1gyq/flydan", "path": "/src/nav.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: xe1gyq/flydan path: /src/nav.py perform takeoff of the copter. Because it requires a high-level command link with the GCS (`gcs.py`), an `xbee.XBee` or `xbee.Zigbee` object (either a real one or simulated) is need. See the module `xbee`, `comm.py` and the datasheets for more ...
code_fim
hard
{ "lang": "python", "repo": "xe1gyq/flydan", "path": "/src/nav.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # new position in decimal degrees newlat = original_location.lat + math.degrees(dLat) newlon = original_location.lon + math.degrees(dLon) # return according to the input coordinate Class if isinstance(original_location,LocationGlobal): targetlocation = LocationGlobal(newla...
code_fim
hard
{ "lang": "python", "repo": "xe1gyq/flydan", "path": "/src/nav.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: vintasoftware/django-zombodb path: /django_zombodb/base_indexes.py # From Django 2.1, for Django < 2.1 from django.db.models import Index from django.utils.functional import cached_property <|fim_suffix|> @cached_property def max_name_length(self): # Allow an index name longer t...
code_fim
medium
{ "lang": "python", "repo": "vintasoftware/django-zombodb", "path": "/django_zombodb/base_indexes.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @cached_property def max_name_length(self): # Allow an index name longer than 30 characters when the suffix is # longer than the usual 3 character limit. The 30 character limit for # cross-database compatibility isn't applicable to PostgreSQL-specific # indexes. ...
code_fim
medium
{ "lang": "python", "repo": "vintasoftware/django-zombodb", "path": "/django_zombodb/base_indexes.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: smygt/DjangoSchoolSystem path: /CourseOnline/MainProject/migrations/0038_auto_20200111_1850.py # Generated by Django 3.0.1 on 2020-01-11 15:50 from django.conf import settings from django.db import migrations, models import django.db.models.deletion import django.utils.timezone <|fim_suffix|> ...
code_fim
hard
{ "lang": "python", "repo": "smygt/DjangoSchoolSystem", "path": "/CourseOnline/MainProject/migrations/0038_auto_20200111_1850.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.RemoveField( model_name='lecture', name='syllabus', ), migrations.AlterField( model_name='studentuploadfile', name='doc_file', field=models.FileField(null=True, upload_to=''), ), ...
code_fim
hard
{ "lang": "python", "repo": "smygt/DjangoSchoolSystem", "path": "/CourseOnline/MainProject/migrations/0038_auto_20200111_1850.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('MainProject', '0037_auto_20200109_1521'), ] operations = [ migrations.RemoveField( model_name='lecture', name='syllabus', ), migrations.AlterField( ...
code_fim
hard
{ "lang": "python", "repo": "smygt/DjangoSchoolSystem", "path": "/CourseOnline/MainProject/migrations/0038_auto_20200111_1850.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>u$ = {0:3.1f}'.format(n_i) ax[1].plot(x2, st.t.pdf(x2, n_i), color='k', linestyle=styles[index], label=plot_label) ax[1].plot(x2, st.norm.pdf(x2), color='k', linestyle=styles[-1], label='$\\nu = \\infty$') ax[1].set_xlim(-6.5, 6.5) ax[1].set_ylim(0, 0.42) ax[1].set_xlabel('確率...
code_fim
hard
{ "lang": "python", "repo": "nakatsuma/python_for_bayes", "path": "/python/pybayes_invgamma_t.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nakatsuma/python_for_bayes path: /python/pybayes_invgamma_t.py # -*- coding: utf-8 -*- #%% NumPyの読み込み import numpy as np # SciPyのstatsモジュールの読み込み import scipy.stats as st # MatplotlibのPyplotモジュールの読み込み import matplotlib.pyplot as plt # 日本語フォントの設定 from matplotlib.font_manager import FontProper...
code_fim
hard
{ "lang": "python", "repo": "nakatsuma/python_for_bayes", "path": "/python/pybayes_invgamma_t.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def build( self, learning_rate_name: str, step_name: str, parameter_sequence_name: str, gradient_sequence_name: str, first_order_moment_sequence_name: str, second_order_moment_sequence_name: str, ) -> str: """ Build an AdamW o...
code_fim
hard
{ "lang": "python", "repo": "microsoft/onnxruntime", "path": "/orttraining/orttraining/python/training/onnxblock/optim/optim.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: microsoft/onnxruntime path: /orttraining/orttraining/python/training/onnxblock/optim/optim.py # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. from typing import Dict, List, Optional, Tuple import onnx import onnxruntime.training.onnxblock._graph_ut...
code_fim
hard
{ "lang": "python", "repo": "microsoft/onnxruntime", "path": "/orttraining/orttraining/python/training/onnxblock/optim/optim.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> learning_rate_name = "learning_rate" params_name = "params" gradients_name = "gradients" step_name = "step" first_order_moments_name = "first_order_moments" trainable_parameters, _ = parameters onnx_model.graph.input.extend( [ ...
code_fim
hard
{ "lang": "python", "repo": "microsoft/onnxruntime", "path": "/orttraining/orttraining/python/training/onnxblock/optim/optim.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ukasiu/whiskerboard path: /board/tasks.py import subprocess from celery.decorators import task from django.conf import settings import requests def http_checker(service): """GET on the provided URL. It should return a [2-4][0-9]{2}""" verify_ssl = getattr(settings, 'VERIFY_SSL', True) ...
code_fim
medium
{ "lang": "python", "repo": "ukasiu/whiskerboard", "path": "/board/tasks.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@task def check_ping(service): """Should ping service.host""" res = subprocess.call(('/bin/ping -c 5 -i 0.5 -w 5 %s' % service.connection.hostname).split()) if res == 0: service.update_status('Up', "ping okay") else: service.update_status('Down', "ping...
code_fim
hard
{ "lang": "python", "repo": "ukasiu/whiskerboard", "path": "/board/tasks.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @task def check_ping(service): """Should ping service.host""" res = subprocess.call(('/bin/ping -c 5 -i 0.5 -w 5 %s' % service.connection.hostname).split()) if res == 0: service.update_status('Up', "ping okay") else: service.update_status('Down', "pin...
code_fim
medium
{ "lang": "python", "repo": "ukasiu/whiskerboard", "path": "/board/tasks.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: W-analyser/us-financial-accounts-backend path: /models.py from django.db import models # Create your models here. class DataTable(models.Model): table_code = models.CharField(max_length=100, unique=True) class Symbol(models.Model): symbol = models.CharField(max_length=100, blank=False)...
code_fim
medium
{ "lang": "python", "repo": "W-analyser/us-financial-accounts-backend", "path": "/models.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>class Entry(models.Model): data = models.FloatField(null=True) date = models.ForeignKey(Date, on_delete=models.CASCADE) symbol = models.ForeignKey(Symbol, on_delete=models.CASCADE)<|fim_prefix|># repo: W-analyser/us-financial-accounts-backend path: /models.py from django.db import models # ...
code_fim
hard
{ "lang": "python", "repo": "W-analyser/us-financial-accounts-backend", "path": "/models.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: yjaeseok/super-mario-bros-dqn path: /test.py import numpy as np import torch from core.constants import PRETRAINED_MODELS from core.model import CNNDQN from core.wrappers import wrap_environment from os.path import join <|fim_suffix|> total_reward = 0.0 state = env.reset() while True:...
code_fim
hard
{ "lang": "python", "repo": "yjaeseok/super-mario-bros-dqn", "path": "/test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> total_reward = 0.0 state = env.reset() while True: state_v = torch.tensor(np.array([state], copy=False)) q_vals = net(state_v).data.numpy()[0] action = np.argmax(q_vals) state, reward, done, info = env.step(action) total_reward += reward if info[...
code_fim
hard
{ "lang": "python", "repo": "yjaeseok/super-mario-bros-dqn", "path": "/test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if text.isdigit(): total = long(text) else: if not text[0].isdigit(): raise BadTTL total = long(0) current = long(0) for c in text: if c.isdigit(): current *= 10 current += long(c) else: ...
code_fim
hard
{ "lang": "python", "repo": "elgatito/script.elementum.burst", "path": "/resources/site-packages/dns/ttl.py", "mode": "spm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_prefix|># repo: elgatito/script.elementum.burst path: /resources/site-packages/dns/ttl.py # Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose with or without fee is hereby granted, # provided that the above c...
code_fim
medium
{ "lang": "python", "repo": "elgatito/script.elementum.burst", "path": "/resources/site-packages/dns/ttl.py", "mode": "psm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_suffix|>mport * from merger_models import Coalescent<|fim_prefix|># repo: hcdenbakker/treetime path: /treetime/__init__.py from treeanc import TreeAnc from treetime im<|fim_middle|>port TreeTime from treetime import ttconf as treetime_conf from gtr import GTR from io i
code_fim
medium
{ "lang": "python", "repo": "hcdenbakker/treetime", "path": "/treetime/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hcdenbakker/treetime path: /treetime/__init__.py from treeanc import TreeAnc from treetime import TreeTime from treetime import ttconf as<|fim_suffix|>mport * from merger_models import Coalescent<|fim_middle|> treetime_conf from gtr import GTR from io i
code_fim
easy
{ "lang": "python", "repo": "hcdenbakker/treetime", "path": "/treetime/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hcdenbakker/treetime path: /treetime/__init__.py from treeanc import TreeAnc from treetime im<|fim_suffix|> treetime_conf from gtr import GTR from io import * from merger_models import Coalescent<|fim_middle|>port TreeTime from treetime import ttconf as
code_fim
easy
{ "lang": "python", "repo": "hcdenbakker/treetime", "path": "/treetime/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: alipay/alipay-sdk-python-all path: /alipay/aop/api/domain/ZolozIdentificationUserWebInitializeModel.py #!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * from alipay.aop.api.domain.IdentityParam import IdentityParam class ZolozIdentif...
code_fim
hard
{ "lang": "python", "repo": "alipay/alipay-sdk-python-all", "path": "/alipay/aop/api/domain/ZolozIdentificationUserWebInitializeModel.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def to_alipay_dict(self): params = dict() if self.biz_id: if hasattr(self.biz_id, 'to_alipay_dict'): params['biz_id'] = self.biz_id.to_alipay_dict() else: params['biz_id'] = self.biz_id if self.extern_param: if...
code_fim
hard
{ "lang": "python", "repo": "alipay/alipay-sdk-python-all", "path": "/alipay/aop/api/domain/ZolozIdentificationUserWebInitializeModel.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: fendouai/2018_mldm-deep_metric_learing path: /includes/anchor_positive_examples.py # returns all euclidean distances for which either the labels are the same or the jaccard distance is below the positive threshold def anchor_positive_examples(pw_label_equality, labels_in_batch, pw_jaccard_distanc...
code_fim
hard
{ "lang": "python", "repo": "fendouai/2018_mldm-deep_metric_learing", "path": "/includes/anchor_positive_examples.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # it's either an anchor-positive example because the jaccard distance is smaller than the threshold or because the labels are the same. pos_because_of_labels = tf.logical_and(labels_in_batch, labels_match) pos_because_of_jd = tf.logical_and(labels_not_in_batch, sequences_have_pos_jd) pos...
code_fim
hard
{ "lang": "python", "repo": "fendouai/2018_mldm-deep_metric_learing", "path": "/includes/anchor_positive_examples.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # exclude example itself from positive / negative - euclidean distance to between two identical vectors should always be 0 positive_ed = tf.where(condition=pos_cond , x=pw_euclidean_distances, y=tf.ones_like(pw_euclidean_distances)*-1) # -1 means non positive return positive_ed, pos_because_o...
code_fim
hard
{ "lang": "python", "repo": "fendouai/2018_mldm-deep_metric_learing", "path": "/includes/anchor_positive_examples.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class HyBeliefObserverationSpaceTEsts(unittest.TestCase): @timer def test_belief_observer_observation_space(self): params = ParameterServer( filename="configuration/params/iqn_params.json") splits = 8 params_behavior = ParameterServer( filename="co...
code_fim
medium
{ "lang": "python", "repo": "eeshakumar/hythe", "path": "/configuration/test/test_belief_observation_space.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: eeshakumar/hythe path: /configuration/test/test_belief_observation_space.py import numpy as np import os import unittest from bark.runtime.viewer.matplotlib_viewer import MPViewer from bark.runtime.commons.parameters import ParameterServer from hythe.libs.observer.belief_observer import BeliefOb...
code_fim
hard
{ "lang": "python", "repo": "eeshakumar/hythe", "path": "/configuration/test/test_belief_observation_space.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: laurisag/chat_socket.py path: /server.py import socket s = socket.socket() #servidor HOST = socket.gethostname() PORT = 8080 <|fim_suffix|>while 1: message = input(str('>>')) #input para escribir mensaje message = message.encode() #codificamos el mensaje para que le aparezca al ...
code_fim
hard
{ "lang": "python", "repo": "laurisag/chat_socket.py", "path": "/server.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>while 1: message = input(str('>>')) #input para escribir mensaje message = message.encode() #codificamos el mensaje para que le aparezca al cliente connection.send(message) print('Mensaje enviado') recv_message = connection.recv(1024) #recv_mensaje = recibir mensaje print('Cl...
code_fim
hard
{ "lang": "python", "repo": "laurisag/chat_socket.py", "path": "/server.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Starts ENERPI Logger if args.enerpi: from enerpi.enerpimeter import enerpi_logger # Demo logger if args.demo: set_logging_conf(FILE_LOGGING + '_demo.log', LOGGING_LEVEL, True) path_st = os.path.join(DATA_PATH, 'debug_bu...
code_fim
hard
{ "lang": "python", "repo": "d1aboilik/enerpi", "path": "/enerpi/command_enerpi.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: d1aboilik/enerpi path: /enerpi/command_enerpi.py nargs='?', type=int, metavar='∆T', const=60, help='⚡ SET Timeout to finish execution automatically') g_m.add_argument('--raw', type=int, action='store', nargs='?', const=5, metavar='∆T', help='☮ SET RA...
code_fim
hard
{ "lang": "python", "repo": "d1aboilik/enerpi", "path": "/enerpi/command_enerpi.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: d1aboilik/enerpi path: /enerpi/command_enerpi.py on='store', default=UDP_PORT, metavar='XX', help='⚡ SET Broadcast Receiver PORT') g_m.add_argument('-d', '--demo', action='store_true', help='☮ SET Demo Mode (broadcast random values)') g_m.add_argument('--timeout', ac...
code_fim
hard
{ "lang": "python", "repo": "d1aboilik/enerpi", "path": "/enerpi/command_enerpi.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Common.start_all() logging.info("started all") counter = 0 up2date = False cli = Common.get_client () while not up2date and counter < max_wait : time.sleep( 1.0 ) counter += 1 up2date = cli.expectProgressPossible() ...
code_fim
hard
{ "lang": "python", "repo": "Incubaid/arakoon", "path": "/pylabs/test/server/right/test_catchup_exercises.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Incubaid/arakoon path: /pylabs/test/server/right/test_catchup_exercises.py """ Copyright (2010-2014) INCUBAID BVBA Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://...
code_fim
hard
{ "lang": "python", "repo": "Incubaid/arakoon", "path": "/pylabs/test/server/right/test_catchup_exercises.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Kami/python-yubico-client path: /yubico_client/__init__.py # -*- coding: utf-8 -*- # # Name: Yubico Python Client # Description: Python class for verifying Yubico One Time Passwords (OTPs). # # Author: Tomaz Muraus (http://www.tomaz.me) # License: BSD # # Copyright (c) 2010-2019, Tomaž Muraus # C...
code_fim
easy
{ "lang": "python", "repo": "Kami/python-yubico-client", "path": "/yubico_client/__init__.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>__version__ = (1, 13, 0) # pylint: disable=cyclic-import from yubico_client.yubico import Yubico<|fim_prefix|># repo: Kami/python-yubico-client path: /yubico_client/__init__.py # -*- coding: utf-8 -*- # # Name: Yubico Python Client # Description: Python class for verifying Yubico One Time Passwords (OTP...
code_fim
easy
{ "lang": "python", "repo": "Kami/python-yubico-client", "path": "/yubico_client/__init__.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: open-mmlab/mmcv path: /mmcv/ops/deform_roi_pool.py # Copyright (c) OpenMMLab. All rights reserved. from typing import Optional, Tuple from torch import Tensor, nn from torch.autograd import Function from torch.autograd.function import once_differentiable from torch.nn.modules.utils import _pair ...
code_fim
hard
{ "lang": "python", "repo": "open-mmlab/mmcv", "path": "/mmcv/ops/deform_roi_pool.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> output_size: Tuple[int, ...], output_channels: int, deform_fc_channels: int = 1024, spatial_scale: float = 1.0, sampling_ratio: int = 0, gamma: float = 0.1): super().__init__(output_size, spatial_...
code_fim
hard
{ "lang": "python", "repo": "open-mmlab/mmcv", "path": "/mmcv/ops/deform_roi_pool.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># # Figure 19-11 on page 426 # times = get_BM_data('bm_results2012.csv')['time'] # mean_of_means, std_of_means = [], [] # sample_sizes = range(100, 1501, 200) # for sample_size in sample_sizes: # sample_means = [] # for t in range(200): # sample = random.sample(times, sample_size) # ...
code_fim
hard
{ "lang": "python", "repo": "jinjiaacademy/Intro-to-Computation-and-Programming", "path": "/code/chapter 19/chapter19.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|># # Figure 19-6 on page 419 # def gaussian(x, mu, sigma): # factor1 = (1/(sigma*((2*np.pi)**0.5))) # factor2 = np.e**-(((x-mu)**2)/(2*sigma**2)) # return factor1*factor2 # area = round(scipy.integrate.quad(gaussian, -3, 3, (0, 1))[0], 4) # print('Probability of being within 3', # 'of tr...
code_fim
hard
{ "lang": "python", "repo": "jinjiaacademy/Intro-to-Computation-and-Programming", "path": "/code/chapter 19/chapter19.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jinjiaacademy/Intro-to-Computation-and-Programming path: /code/chapter 19/chapter19.py # -*- coding: utf-8 -*- import random import numpy as np import matplotlib.pyplot as plt import scipy #set line width plt.rcParams['lines.linewidth'] = 4 #set font size for titles plt.rcParams['axes.titlesiz...
code_fim
hard
{ "lang": "python", "repo": "jinjiaacademy/Intro-to-Computation-and-Programming", "path": "/code/chapter 19/chapter19.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: upfront710/yardstick path: /yardstick/tests/unit/benchmark/scenarios/lib/test_delete_router_interface.py ############################################################################## # Copyright (c) 2017 Huawei Technologies Co.,Ltd and others. # # All rights reserved. This program and the accomp...
code_fim
medium
{ "lang": "python", "repo": "upfront710/yardstick", "path": "/yardstick/tests/unit/benchmark/scenarios/lib/test_delete_router_interface.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.mock_remove_router_interface.return_value = False with self.assertRaises(exceptions.ScenarioRemoveRouterIntError): self.delrout_obj.run(self.result) self.assertEqual({"delete_router_interface": 0}, self.result) self.mock_log.error.assert_called_once_with( ...
code_fim
hard
{ "lang": "python", "repo": "upfront710/yardstick", "path": "/yardstick/tests/unit/benchmark/scenarios/lib/test_delete_router_interface.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: dubreuia/alexandredubreuil.com path: /conferences/midi-visualization-with-visual-midi/code/example-01.py from pretty_midi import PrettyMIDI from visual_midi import Plotter <|fim_suffix|># Plot the result using VisualMidi plotter = Plotter() plotter.show(pm, "/tmp/example-01.html")<|fim_middle|>#...
code_fim
hard
{ "lang": "python", "repo": "dubreuia/alexandredubreuil.com", "path": "/conferences/midi-visualization-with-visual-midi/code/example-01.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Plot the result using VisualMidi plotter = Plotter() plotter.show(pm, "/tmp/example-01.html")<|fim_prefix|># repo: dubreuia/alexandredubreuil.com path: /conferences/midi-visualization-with-visual-midi/code/example-01.py from pretty_midi import PrettyMIDI from visual_midi import Plotter <|fim_middle|>#...
code_fim
hard
{ "lang": "python", "repo": "dubreuia/alexandredubreuil.com", "path": "/conferences/midi-visualization-with-visual-midi/code/example-01.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: glebite/Themista path: /tests/test_themista_execution.py """ test_themista_exeution.py """ import pytest # TODO: hack solution - need to fix later import sys sys.path.append('themista') from themista.themista import Themista <|fim_suffix|>@pytest.mark.test_id(2) def test_simple_argument(): t...
code_fim
hard
{ "lang": "python", "repo": "glebite/Themista", "path": "/tests/test_themista_execution.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@pytest.mark.test_id(2) def test_simple_argument(): try: access_obj = Themista() access_obj.main('http://www.practiceselenium.com/') assert True except Exception as e: assert False<|fim_prefix|># repo: glebite/Themista path: /tests/test_themista_execution.py """ te...
code_fim
hard
{ "lang": "python", "repo": "glebite/Themista", "path": "/tests/test_themista_execution.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> try: access_obj = Themista() access_obj.main('http://www.practiceselenium.com/') assert True except Exception as e: assert False<|fim_prefix|># repo: glebite/Themista path: /tests/test_themista_execution.py """ test_themista_exeution.py """ import pytest # TODO: ha...
code_fim
hard
{ "lang": "python", "repo": "glebite/Themista", "path": "/tests/test_themista_execution.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dssg/mlpolicylab_fall20_schools3_public path: /schools3/config/data/features/inv_features_config.py import sys from schools3.config import base_config <|fim_suffix|>sys.modules[__name__] = config<|fim_middle|> config = base_config.Config() config.categorical_columns = []
code_fim
medium
{ "lang": "python", "repo": "dssg/mlpolicylab_fall20_schools3_public", "path": "/schools3/config/data/features/inv_features_config.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>sys.modules[__name__] = config<|fim_prefix|># repo: dssg/mlpolicylab_fall20_schools3_public path: /schools3/config/data/features/inv_features_config.py import sys from schools3.config import base_config <|fim_middle|>config = base_config.Config() config.categorical_columns = []
code_fim
medium
{ "lang": "python", "repo": "dssg/mlpolicylab_fall20_schools3_public", "path": "/schools3/config/data/features/inv_features_config.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mattbriggs/single-source-modules path: /scripts/create_context.py import json import pystache as ST import common_utilities as CU with open(r"C:\git\mb\single-source-modules\source\contextdata.json", 'r') as json_file: full_context = json.load(json_file) <|fim_suffix|>for context in context...
code_fim
medium
{ "lang": "python", "repo": "mattbriggs/single-source-modules", "path": "/scripts/create_context.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>contexts = ["asdk", "ash", "mdc"] for context in contexts: for path in source_files: file_name = path.split("\\")[-1] template = CU.get_text_from_file(path) context_dict = {} for term in full_context.keys(): context_dict[term] = full_context[term][context] ...
code_fim
medium
{ "lang": "python", "repo": "mattbriggs/single-source-modules", "path": "/scripts/create_context.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>for context in contexts: for path in source_files: file_name = path.split("\\")[-1] template = CU.get_text_from_file(path) context_dict = {} for term in full_context.keys(): context_dict[term] = full_context[term][context] context_dict[context] = Tru...
code_fim
medium
{ "lang": "python", "repo": "mattbriggs/single-source-modules", "path": "/scripts/create_context.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>e = info[1].replace('[ ', '').replace(' ]', '') # weird exception if "DEMISE" in date: date = info[2].replace('[ ', '').replace(' ]', '') articles['Date'].append(date) articles['TEXT'].append(text.replace('\n\n', '')) # return information return articles...
code_fim
hard
{ "lang": "python", "repo": "akvallapuram/RelXTract", "path": "/read_dossier.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: akvallapuram/RelXTract path: /read_dossier.py # read the input.txt def read_dossier(): # store information articles = {'Authors': [], 'Date': [], 'SOURCE': [], 'TEXT': []} # open file dossier = open('Steele_dossier.txt', 'r', encoding='ascii', errors='ignore').r...
code_fim
hard
{ "lang": "python", "repo": "akvallapuram/RelXTract", "path": "/read_dossier.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Kyuunex/DiscordLinuxGoLiveAudioWorkaroundBot path: /go-live-bot-slash.py #!/usr/bin/env python3 import discord import sys import os # This version is only tested on Py-cord. When discord.py devs decided to shut down the project, # I moved the project to Py-cord, and got the slash commands somewh...
code_fim
hard
{ "lang": "python", "repo": "Kyuunex/DiscordLinuxGoLiveAudioWorkaroundBot", "path": "/go-live-bot-slash.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|>@bot.slash_command() async def join(ctx, channel_id=None): if not int(ctx.author.id) in owner_list: return target_channel = None if channel_id: target_channel = bot.get_channel(int(channel_id)) if not target_channel: await ctx.respond("can't find a channel...
code_fim
hard
{ "lang": "python", "repo": "Kyuunex/DiscordLinuxGoLiveAudioWorkaroundBot", "path": "/go-live-bot-slash.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: Forita/Coding path: /Python/reverse-words-in-a-string.py from __future__ import print_function # O(n) runtime, O(n) space. # Given an input string, reverse the string word by word. # For example, # Given s = "the sky is blue", # return "blue is sky the". class Solution(object): <|fim_suffix|>if...
code_fim
medium
{ "lang": "python", "repo": "Forita/Coding", "path": "/Python/reverse-words-in-a-string.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ :type s: str :rtype: str """ return ' '.join(reversed(s.split())) if __name__ == '__main__': print(Solution().reverseWords('the sky is blue'))<|fim_prefix|># repo: Forita/Coding path: /Python/reverse-words-in-a-string.py from __future__ import print_fu...
code_fim
easy
{ "lang": "python", "repo": "Forita/Coding", "path": "/Python/reverse-words-in-a-string.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': print(Solution().reverseWords('the sky is blue'))<|fim_prefix|># repo: Forita/Coding path: /Python/reverse-words-in-a-string.py from __future__ import print_function # O(n) runtime, O(n) space. # Given an input string, reverse the string word by word. # For example, # Give...
code_fim
medium
{ "lang": "python", "repo": "Forita/Coding", "path": "/Python/reverse-words-in-a-string.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: seanwu1105/pso-car path: /pso_car/gui/error_linechart.py from PySide2.QtGui import QPainter from PySide2.QtWidgets import QVBoxLayout, QFrame from PySide2.QtCharts import QtCharts class ErrorLineChart(QFrame): def __init__(self, nseries=1, series_names=None): super().__init__() ...
code_fim
hard
{ "lang": "python", "repo": "seanwu1105/pso-car", "path": "/pso_car/gui/error_linechart.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def clear(self): self.chart.removeAllSeries() self.serieses = [QtCharts.QLineSeries() for _ in range(self.nseries)] for idx, series in enumerate(self.serieses): self.chart.addSeries(series) if self.series_names is not None: series.setName...
code_fim
hard
{ "lang": "python", "repo": "seanwu1105/pso-car", "path": "/pso_car/gui/error_linechart.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> title_and_y_axis(displayParam, strUnit, txtEvol, txtField, "{} {}\n (Source: Johns Hopkins University)") name = file_name(figures_path, "{}_phase_diagram_Covid19_{}_{}_for_{}.png", txtEvol, txtField, zone) displayParam['FileName'] = name return di...
code_fim
hard
{ "lang": "python", "repo": "geoffroychaussonnet/script_to_monitor_Covid19", "path": "/plot_phase_portrait.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # Path to the folder containing the time series: data_path="https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/" figures_path = "../FIGURES" start_date = dt.date(2020, 1,1) # Start date of the plot: yscale = 'linear' # rec...
code_fim
hard
{ "lang": "python", "repo": "geoffroychaussonnet/script_to_monitor_Covid19", "path": "/plot_phase_portrait.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: geoffroychaussonnet/script_to_monitor_Covid19 path: /plot_phase_portrait.py # Author: Geoffroy Chaussonnet, Karlsruhe Institute of Technology, Germany # Script to load the data related to the COVID-19 gathered by the Johns Hopkins University and to plot the phase diagram of the confirmed cases or...
code_fim
hard
{ "lang": "python", "repo": "geoffroychaussonnet/script_to_monitor_Covid19", "path": "/plot_phase_portrait.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: andregtorres/ISTTOK path: /shieldingfilterPrim.py #Andre Torres - 27/07/2018 #computes horizontal and vertical displacement from the mirnovs from getMirnov import * import scipy.signal as signal from scipy.optimize import * from filters import CSfilter #43066 e 43063 shotnr=43066; #Coil signal...
code_fim
hard
{ "lang": "python", "repo": "andregtorres/ISTTOK", "path": "/shieldingfilterPrim.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #FIT popt, pcov = curve_fit(exponential, times[slice_start:slice_end], coil[slice_start:slice_end], p0=guessM[coilNr-1], maxfev=50000) #guessM[coilNr-1] #Calculate R squared residuals = coil[slice_start:slice_end] - exponential(times[slice_start:slice_end], *popt) #Sum of the residual...
code_fim
hard
{ "lang": "python", "repo": "andregtorres/ISTTOK", "path": "/shieldingfilterPrim.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: frasanz/Swarm-Surveys path: /app/models.py tion,'value') value.text = str(self.value) return condition @staticmethod def from_xml(root,question,msg): operation = findField('operation',root,msg) value = findField('value',root,msg) condition = Condi...
code_fim
hard
{ "lang": "python", "repo": "frasanz/Swarm-Surveys", "path": "/app/models.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, **kwargs): super(StateSurvey, self).__init__(**kwargs) sections = Section.query.filter(Section.survey== self.survey).order_by(Section.sequence) list = Section.sequenceSections(sections) # to load test if current_app.config.get('JMETER',False):...
code_fim
hard
{ "lang": "python", "repo": "frasanz/Swarm-Surveys", "path": "/app/models.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> for children in self.children: section.append(children.to_xml()) return section @staticmethod def from_xml(root,survey,msg): def from_xml_subSection(root,parent,msg): title = findField('title',root,msg) description = findField('descrip...
code_fim
hard
{ "lang": "python", "repo": "frasanz/Swarm-Surveys", "path": "/app/models.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: cheind/pytorch-blender path: /pkg_blender/blendtorch/btb/utils.py import bpy import numpy as np from mathutils import Vector def find_first_view3d(): """Helper function to find first space view 3d and associated window region. The three returned objects are useful for setting up offscr...
code_fim
hard
{ "lang": "python", "repo": "cheind/pytorch-blender", "path": "/pkg_blender/blendtorch/btb/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def compute_object_visibility(obj, cam, N=25, scene=None, view_layer=None, dist=None): """Computes object visibility using Monte Carlo ray-tracing.""" scene = scene or bpy.context.scene vl = view_layer or bpy.context.view_layer src = cam.bpy_camera.matrix_world.translation dist = dist ...
code_fim
hard
{ "lang": "python", "repo": "cheind/pytorch-blender", "path": "/pkg_blender/blendtorch/btb/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }