text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> query_execution_context = {
"Database": self.database
}
result_configuration = {
"OutputLocation": self.result_path
}
return {
"QueryString": self.sql,
"QueryExecutionContext": query_execution_context,
"Res... | code_fim | hard | {
"lang": "python",
"repo": "winfred958/athena-operation",
"path": "/athena-operation/connector/connector.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> :return: corresponding information of the template DNA strand.
"""
strand = [[], []]
for amino_acid in protein:
codon_chooser = base_maps[numpy.where(codons == amino_acid)]
for index in range(3):
strand[0].append(codon_chooser... | code_fim | hard | {
"lang": "python",
"repo": "HaolingZHANG/GenomeCompact",
"path": "/methods/dna.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Get the strand by strand type.
1 is the template strand; -1 is the complementary strand; the others is the whole strand.
:return: strand.
"""
if strand_type == 1:
return [self._t_strand]
elif strand_type == -1:
r... | code_fim | hard | {
"lang": "python",
"repo": "HaolingZHANG/GenomeCompact",
"path": "/methods/dna.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HaolingZHANG/GenomeCompact path: /methods/dna.py
"""
Name: PatternDNA
Coder: HaoLing ZHANG (BGI-Research)[V1]
Current Version: 1
Functions:
(1) Initiate Pattern DNA from a DNA single strand or a protein;
(2) Get Information of the created Pattern DNA.
"""
import copy
from methods... | code_fim | hard | {
"lang": "python",
"repo": "HaolingZHANG/GenomeCompact",
"path": "/methods/dna.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if data[0] == 0:
return None
return getPointsForImprovement(data[0],data[1], weight, maxHealthScore)
#Calculates improvement for a key that has a positive relationship
def getPositiveRecommendation(data, weight, maxHealthScore):
if data[0] != 2:
print("New method")
... | code_fim | hard | {
"lang": "python",
"repo": "rikenshah/Well-thy",
"path": "/pyScripts/get_recommendations.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rikenshah/Well-thy path: /pyScripts/get_recommendations.py
'''
Generates recommendation for the user based on
bmi, smoking, tobacco usage, alcohol consumption, exercise
travel time, sleep time, job type.
'''
import csv, re
featureWeights_dict={}
healthy_bmi = 0
moderate_travel = 1
excess_... | code_fim | hard | {
"lang": "python",
"repo": "rikenshah/Well-thy",
"path": "/pyScripts/get_recommendations.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if travel_time == excess_travel:
return ("If you reduce your travel_time to under 10 hours "
"your healthscore will improve 17 points.")
elif travel_time == moderate_travel:
return ("If you reduce your travel_time to under 5 hours "
"your healthscore will improve 17... | code_fim | hard | {
"lang": "python",
"repo": "rikenshah/Well-thy",
"path": "/pyScripts/get_recommendations.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if os.path.isfile(config_file):
with open(config_file) as config_file:
config = yaml.load(config_file, Loader=yaml.FullLoader)
return config
else:
print('Config file ' + config_file + ' does not exist!')
return False
c = load_config(config_file)<|fi... | code_fim | easy | {
"lang": "python",
"repo": "sethryder/certman",
"path": "/config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sethryder/certman path: /config.py
import os
import sys
import yaml
config_file = "config/certman-sample.conf"
<|fim_suffix|> if os.path.isfile(config_file):
with open(config_file) as config_file:
config = yaml.load(config_file, Loader=yaml.FullLoader)
return ... | code_fim | easy | {
"lang": "python",
"repo": "sethryder/certman",
"path": "/config.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tonykwok/pymvn path: /pymvn
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project ... | code_fim | hard | {
"lang": "python",
"repo": "tonykwok/pymvn",
"path": "/pymvn",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> args = parser.parse_args()
if not args.ARTIFACT_COORDINATE:
print("Artifact maven coordinate must be specified")
exit(1)
values = args.ARTIFACT_COORDINATE.split(":")
if not values or len(values) < 3:
print("Illegal artifact maven coordinate: %s" % args.ARTIFACT_COO... | code_fim | hard | {
"lang": "python",
"repo": "tonykwok/pymvn",
"path": "/pymvn",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nitinmehra/TodoApp path: /backend/todo_app/urls.py
from django.urls import path,re_path
from todo_app.viewsets import TodoViewSet
from django.conf.urls import url
urlpatterns = [
url('^getall<|fim_suffix|> url('^get/(?P<id>[0-9]+)/$', TodoViewSet.as_view({'get':'retrieve'}), name='todo_det... | code_fim | medium | {
"lang": "python",
"repo": "nitinmehra/TodoApp",
"path": "/backend/todo_app/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ew({'put':'update'}), name='todo_update' ),
url('^delete/(?P<id>[0-9]+)/$', TodoViewSet.as_view({'delete':'destroy'}), name='todo_delete' ),
]<|fim_prefix|># repo: nitinmehra/TodoApp path: /backend/todo_app/urls.py
from django.urls import path,re_path
from todo_app.viewsets import TodoViewSet
from dj... | code_fim | medium | {
"lang": "python",
"repo": "nitinmehra/TodoApp",
"path": "/backend/todo_app/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class Migration(migrations.Migration):
dependencies = [
('fias', '0013_auto_20160825_0524'),
]
operations = [
migrations.AddField(
model_name='addrobj',
name='plancode',
field=models.CharField(default='0000', max_length=4, verbose_name='Ко... | code_fim | medium | {
"lang": "python",
"repo": "aldev12/django-fias",
"path": "/fias/migrations/0014_addrobj_plancode.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aldev12/django-fias path: /fias/migrations/0014_addrobj_plancode.py
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2016-12-24 05:56
from __future__ import unicode_literals
<|fim_suffix|> operations = [
migrations.AddField(
model_name='addrobj',
name='pl... | code_fim | medium | {
"lang": "python",
"repo": "aldev12/django-fias",
"path": "/fias/migrations/0014_addrobj_plancode.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yoelcortes/free_properties path: /free_properties/_property_factory.py
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 18 14:18:27 2019
@author: Guest Group
"""
from ._free_property import metaProperty, FreeProperty
__all__ = ('PropertyFactory',)
# %% Property Factory
def PropertyFactory(fget... | code_fim | hard | {
"lang": "python",
"repo": "yoelcortes/free_properties",
"path": "/free_properties/_property_factory.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> .. code-block:: python
>>> from free_properties import PropertyFactory
>>> def getter(self):
... '''Weight (kg) based on volume (m^3).'''
... data = self.data
... rho = data['rho'] # Density (kg/m^3)
... vol = data['vol'] # Volume (m... | code_fim | hard | {
"lang": "python",
"repo": "yoelcortes/free_properties",
"path": "/free_properties/_property_factory.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> >>> weight_water + 30
3030
>>> weight_water + weight_ethanol
5367
Get and set the value through the 'value' attribute:
.. code-block:: python
>>> weight_water.value
3000
>>> weight_water.value = 4000
>>> weight... | code_fim | hard | {
"lang": "python",
"repo": "yoelcortes/free_properties",
"path": "/free_properties/_property_factory.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>reita de n, sem utilizar o operador de resto.
'''
n = int(input("n: "))
print(n - (n // 100 * 100))<|fim_prefix|># repo: neveSZ/fatecsp-ads path: /IAL-002/Listas/1-Sequência/03.py
'''
Fornecido um número inteiro n (n≥10), exibir <|fim_middle|>o valor correspondente aos dois
dígitos mais à di | code_fim | easy | {
"lang": "python",
"repo": "neveSZ/fatecsp-ads",
"path": "/IAL-002/Listas/1-Sequência/03.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: neveSZ/fatecsp-ads path: /IAL-002/Listas/1-Sequência/03.py
'''
Fornecido um número inteiro n (n≥10), exibir <|fim_suffix|>reita de n, sem utilizar o operador de resto.
'''
n = int(input("n: "))
print(n - (n // 100 * 100))<|fim_middle|>o valor correspondente aos dois
dígitos mais à di | code_fim | easy | {
"lang": "python",
"repo": "neveSZ/fatecsp-ads",
"path": "/IAL-002/Listas/1-Sequência/03.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
n = int(input("n: "))
print(n - (n // 100 * 100))<|fim_prefix|># repo: neveSZ/fatecsp-ads path: /IAL-002/Listas/1-Sequência/03.py
'''
Fornecido um número inteiro n (n≥10), exibir <|fim_middle|>o valor correspondente aos dois
dígitos mais à direita de n, sem utilizar o operador de resto.
''' | code_fim | medium | {
"lang": "python",
"repo": "neveSZ/fatecsp-ads",
"path": "/IAL-002/Listas/1-Sequência/03.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("webpContent, ", webpContent)
print("srcContent", srcContent)
stringifyProperty = " ".join(stringifyProperty)
print("stringifyProperty, ", stringifyProperty)
... | code_fim | hard | {
"lang": "python",
"repo": "pappagallos/web-optimization-tools",
"path": "/js_optimization.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pappagallos/web-optimization-tools path: /js_optimization.py
import os
# 변환할 파일 경로 정의
import re
global path
path = "/Users/leewoojin/Desktop/isoi-opti"
global sourceFileList
sourceFileList = []
# 디렉토리 리스트
global directoryPathList
directoryPathList = []
# 변환시킬 파일 확장자명 리스트 정의
global __AllowFil... | code_fim | hard | {
"lang": "python",
"repo": "pappagallos/web-optimization-tools",
"path": "/js_optimization.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # 스페이스바 수만큼 공백이 추가될 변수
emptyLine = ""
# 탭을 나타내는 공백 변수
tabLine = " "
# [2] 소스 라인에 공백 라인이 어느정도 있는지 가늠하기 위해 반복문을 돌려 검사
emptyCounter = 0
for index, value in enumerate(splitLine):
# <img 태그가 나타날 때까지 반복문을 돌리는... | code_fim | hard | {
"lang": "python",
"repo": "pappagallos/web-optimization-tools",
"path": "/js_optimization.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
_post_
Post execution checkpointing
"""
# Another emulator check
if emulator is not None:
return emulator.emulatePost(self.step)
logging.info("Steps.Executors.%s.post called", self.__class__.__name__)
for step in self.step... | code_fim | hard | {
"lang": "python",
"repo": "vkuznet/WMCore",
"path": "/src/python/WMCore/WMSpec/Steps/Executors/StageOut.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vkuznet/WMCore path: /src/python/WMCore/WMSpec/Steps/Executors/StageOut.py
#!/usr/bin/env python
"""
_Step.Executor.StageOut_
Implementation of an Executor for a StageOut step
"""
from __future__ import print_function
import logging
import os
import os.path
import signal
import sys
from WMCor... | code_fim | hard | {
"lang": "python",
"repo": "vkuznet/WMCore",
"path": "/src/python/WMCore/WMSpec/Steps/Executors/StageOut.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def render(self, context, instance, placeholder):
if instance.url:
link = instance.url
elif instance.page_link:
link = instance.page_link.get_absolute_url()
else:
link = ""
context.update({
'name':instance.name,
... | code_fim | medium | {
"lang": "python",
"repo": "eduncan911/django_cms",
"path": "/cms/plugins/link/cms_plugins.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: eduncan911/django_cms path: /cms/plugins/link/cms_plugins.py
from django.utils.translation import ugettext_lazy as _
from models import Link
from cms.settings import CMS_MEDIA_URL
from cms.plugin_pool import plugin_pool
from cms.plugin_base import CMSPluginBase
from cms.plugins.link.forms import ... | code_fim | hard | {
"lang": "python",
"repo": "eduncan911/django_cms",
"path": "/cms/plugins/link/cms_plugins.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> return CMS_MEDIA_URL + u"images/plugins/link.png"
plugin_pool.register_plugin(LinkPlugin)<|fim_prefix|># repo: eduncan911/django_cms path: /cms/plugins/link/cms_plugins.py
from django.utils.translation import ugettext_lazy as _
from models import Link
from cms.settings import CMS_MEDIA_URL
f... | code_fim | hard | {
"lang": "python",
"repo": "eduncan911/django_cms",
"path": "/cms/plugins/link/cms_plugins.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Saevon/config-sublime path: /sublime_helpers.py
'''
Helper functions for working with sublime
'''
import sublime
import sublime_plugin
def sublime_show_region(view, region):
''' Shows the region in the view (not moving if its already visible) '''
if not view.visible_region().intersects(... | code_fim | hard | {
"lang": "python",
"repo": "Saevon/config-sublime",
"path": "/sublime_helpers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def cursor_to_matches(*, cursors, matches, viewport, inverted=False, find_visible_only=False):
''' Loops through and generates a new set of cursors to jump to
a VisibleMatch() is yielded if that is the best region to show the user
'''
matches = list(matches)
if len(matches) == 0:
... | code_fim | hard | {
"lang": "python",
"repo": "Saevon/config-sublime",
"path": "/sublime_helpers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kgets/CF-Interview-Problems path: /BFS - DFS/graphDistances.py3
def graphDistances(g, s):
g=Graph(g)
return g.dijkstra(s)
class Graph():
def __init__(self, graph):
self.V = len(graph)
self.graph = graph
<|fim_suffix|> # Dijkstra's single source graph algorithm
def dijkstra(self, ... | code_fim | hard | {
"lang": "python",
"repo": "kgets/CF-Interview-Problems",
"path": "/BFS - DFS/graphDistances.py3",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Dijkstra's single source graph algorithm
def dijkstra(self, sourceNode):
print('Dijkstra')
dist = [1e9] * self.V
dist[sourceNode] = 0
SPT = [0] * self.V
# loop size(v) times to find all vertecies
for _ in range(self.V):
print('d:',dist)
print('spt:',SPT)
# find closest vertex not... | code_fim | hard | {
"lang": "python",
"repo": "kgets/CF-Interview-Problems",
"path": "/BFS - DFS/graphDistances.py3",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return """430592357,ZvCTasj4
430586149,ZvCTasj4
201397816,ZyrCGvQQ
214597966,ZSV4Hkiw
430584391,zy0RUZnG
431065083,ZvCTasj4
201361464,ZyrCGvQQ
302482929,ZSV4Hkiw
330117582,ZvCTasj4
433862262,ZSOmPzCw
426482194,ZSOmPzCw
425224044,ZSOmPzCw
201369542,ZzVi46JN
363734570,ZZS1KlwN
431246574,ZxqvpImX
431... | code_fim | hard | {
"lang": "python",
"repo": "Charuru/recomlive",
"path": "/test/test_recommender.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Charuru/recomlive path: /test/test_recommender.py
from unittest import TestCase
from recommender import Recommender
# TODO: write proper testcases
class AllInOne(TestCase):
def recommend(self):
recom = Recommender(documents_n = 20, persons_n = 20)
for vizit in Data():
... | code_fim | hard | {
"lang": "python",
"repo": "Charuru/recomlive",
"path": "/test/test_recommender.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>flag = True
while flag:
file_name = raw_input('Insert the dataset name ')
file_name = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'datasets/'+file_name)
if os.path.isfile(file_name + '.mat'):
choose = raw_input('A file with this name already exists, do you want to override... | code_fim | medium | {
"lang": "python",
"repo": "ACarfi/Regularization-networks",
"path": "/tests/datasetCreation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ACarfi/Regularization-networks path: /tests/datasetCreation.py
from regularizationNetworks import MixGauss
import scipy.io as sio
import numpy as np
import os.path
<|fim_suffix|>flag = True
while flag:
file_name = raw_input('Insert the dataset name ')
file_name = os.path.join(os.path.dir... | code_fim | medium | {
"lang": "python",
"repo": "ACarfi/Regularization-networks",
"path": "/tests/datasetCreation.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@pytest.mark.parametrize(
"actual, expected",
[
(" abc", "abc"),
("_abc", "abc"),
("ab c", "ab_c"),
("ab c d", "ab_c_d"),
("$abc", "abc"),
],
)
def test_make_as_identifier(actual, expected):
assert make_as_identifier(actual) == expected<|fim_prefix|>... | code_fim | hard | {
"lang": "python",
"repo": "GoLP-IST/nata",
"path": "/tests/utils/test_formatting.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@pytest.mark.parametrize(
"actual, expected",
[
(" abc", "abc"),
("_abc", "abc"),
("ab c", "ab_c"),
("ab c d", "ab_c_d"),
("$abc", "abc"),
],
)
def test_make_as_identifier(actual, expected):
assert make_as_identifier(actual) == expected<|fim_prefix|... | code_fim | hard | {
"lang": "python",
"repo": "GoLP-IST/nata",
"path": "/tests/utils/test_formatting.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GoLP-IST/nata path: /tests/utils/test_formatting.py
# -*- coding: utf-8 -*-
import numpy as np
import pytest
from nata.utils.formatting import array_format
from nata.utils.formatting import make_as_identifier
<|fim_suffix|> assert array_format(input_) == expected
@pytest.mark.parametrize(
... | code_fim | hard | {
"lang": "python",
"repo": "GoLP-IST/nata",
"path": "/tests/utils/test_formatting.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Takes two arguments, fst and snd, and returns [fst, snd]"""
return [first, second]<|fim_prefix|># repo: slavaGanzin/ramda.py path: /ramda/pair.py
from toolz import curry
<|fim_middle|>@curry
def pair(first, second):
| code_fim | easy | {
"lang": "python",
"repo": "slavaGanzin/ramda.py",
"path": "/ramda/pair.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: slavaGanzin/ramda.py path: /ramda/pair.py
from toolz import curry
<|fim_suffix|> """Takes two arguments, fst and snd, and returns [fst, snd]"""
return [first, second]<|fim_middle|>
@curry
def pair(first, second):
| code_fim | easy | {
"lang": "python",
"repo": "slavaGanzin/ramda.py",
"path": "/ramda/pair.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> fail_on_unknown=False):
# use filename as the stdin *for the shell object only*
scriptfile = os.path.join(testdir, filename)
with open(scriptfile) as fh:
cmd_inp = "%s\nquit\n" % fh.read()
cmd_inp = StringIO(cmd_inp)
# use inp as the std input for ... | code_fim | hard | {
"lang": "python",
"repo": "mvdbeek/twill3",
"path": "/tests/twilltestlib.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mvdbeek/twill3 path: /tests/twilltestlib.py
import sys, subprocess
import getpass
try:
import pkg_resources
except ImportError:
raise Exception("you must have setuptools installed to run the tests")
pkg_resources.require('quixote>=2.3')
from quixote.server.simple_server import run
from... | code_fim | hard | {
"lang": "python",
"repo": "mvdbeek/twill3",
"path": "/tests/twilltestlib.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> todays_file = []
today = datetime.today().strftime('%Y-%m-%d')
todays_file.append(today)
todays_file.append('.csv')
todays_file_name = ''.join(todays_file)
self.assertTrue(todays_file_name in os.listdir(self.DIRECTORY),"today's file has not been imported")
... | code_fim | hard | {
"lang": "python",
"repo": "mtna/covid-19",
"path": "/tests/csvTest.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mtna/covid-19 path: /tests/csvTest.py
import sys
import unittest
import xmlrunner
import csv
import os
from datetime import datetime, date, timedelta
class TestCovidCsvData(unittest.TestCase):
#first argument: defines where to look for the data
DIRECTORY = "./data/us-ak/ak-dhss"
#sec... | code_fim | hard | {
"lang": "python",
"repo": "mtna/covid-19",
"path": "/tests/csvTest.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
#creates a set of items that are found in only one of the header lists
diff = set(headers1).symmetric_difference(set(headers2))
msg = []
msg.append("these headers were found in one file but not the other: ")
for d in diff:
msg.append(d)
msg.a... | code_fim | hard | {
"lang": "python",
"repo": "mtna/covid-19",
"path": "/tests/csvTest.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GuilloteauQ/sucuri path: /example/modflask/__init__.py
from flask import Flask, render_template_string
from sucuri import rendering
<|fim_suffix|>@app.route("/")
def index():
template = rendering.template('template.suc',{"text": "Hello! I'm here!", "var":[1, 2, 3, 4]})
return render_temp... | code_fim | easy | {
"lang": "python",
"repo": "GuilloteauQ/sucuri",
"path": "/example/modflask/__init__.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> template = rendering.template('template.suc',{"text": "Hello! I'm here!", "var":[1, 2, 3, 4]})
return render_template_string(template)<|fim_prefix|># repo: GuilloteauQ/sucuri path: /example/modflask/__init__.py
from flask import Flask, render_template_string
from sucuri import rendering
<|fim_mi... | code_fim | easy | {
"lang": "python",
"repo": "GuilloteauQ/sucuri",
"path": "/example/modflask/__init__.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> valid_lines = 0
covered_lines = 0
for classes_node in package_node.getElementsByTagName('classes'):
for class_node in classes_node.getElementsByTagName('class'):
current_valid_lines, current_covered_lines = fix_class(class_node)
valid_lines += curren... | code_fim | medium | {
"lang": "python",
"repo": "Eijebong/dotenv",
"path": "/azure-pipelines/fix_coverage_for_cobertura.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for package_node in xml_doc.getElementsByTagName('package'):
current_valid_lines, current_covered_lines = fix_package(package_node)
valid_lines += current_valid_lines
covered_lines += current_covered_lines
xml_root.setAttribute(tag_valid_lines, repr(valid_lines))
... | code_fim | hard | {
"lang": "python",
"repo": "Eijebong/dotenv",
"path": "/azure-pipelines/fix_coverage_for_cobertura.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Eijebong/dotenv path: /azure-pipelines/fix_coverage_for_cobertura.py
'''
Created on Aug 3, 2016
@author: YLin2
'''
import sys
import os
from xml.dom import minidom
def fix_class(class_node):
valid_lines = 0
covered_lines = 0
for lines_node in class_node.getElementsByTagName('lines'... | code_fim | medium | {
"lang": "python",
"repo": "Eijebong/dotenv",
"path": "/azure-pipelines/fix_coverage_for_cobertura.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.retranslateUi(SublayersDialog)
self.buttonBox.accepted.connect(SublayersDialog.accept)
self.buttonBox.rejected.connect(SublayersDialog.reject)
QtCore.QMetaObject.connectSlotsByName(SublayersDialog)
def retranslateUi(self, SublayersDialog):
_translate = QtC... | code_fim | hard | {
"lang": "python",
"repo": "sourcepole/qgis-interlis-plugin",
"path": "/ui_sublayersdialog.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sourcepole/qgis-interlis-plugin path: /ui_sublayersdialog.py
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui_sublayersdialog.ui'
#
# Created by: PyQt5 UI code generator 5.9.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGu... | code_fim | hard | {
"lang": "python",
"repo": "sourcepole/qgis-interlis-plugin",
"path": "/ui_sublayersdialog.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self._dirty_mask = 0
self.id = id
self.child_action = None
self.oper_template_name = None
self.status = None
self.template_name = None
ManagedObject.__init__(self, "GlVnicTemplate", parent_mo_or_dn, **kwargs)<|fim_prefix|># repo: hrupprecht/ucscsdk ... | code_fim | hard | {
"lang": "python",
"repo": "hrupprecht/ucscsdk",
"path": "/ucscsdk/mometa/gl/GlVnicTemplate.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hrupprecht/ucscsdk path: /ucscsdk/mometa/gl/GlVnicTemplate.py
"""This module contains the general information for GlVnicTemplate ManagedObject."""
from ...ucscmo import ManagedObject
from ...ucsccoremeta import UcscVersion, MoPropertyMeta, MoMeta
from ...ucscmeta import VersionMeta
class GlVni... | code_fim | hard | {
"lang": "python",
"repo": "hrupprecht/ucscsdk",
"path": "/ucscsdk/mometa/gl/GlVnicTemplate.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='region',
name='polygons',
field=django.contrib.gis.db.models.fields.MultiPolygonField(srid=4326),
),
]<|fim_prefix|># repo: consbio/seedsource-core path: /seedsource_core/django/seedsource/migrat... | code_fim | medium | {
"lang": "python",
"repo": "consbio/seedsource-core",
"path": "/seedsource_core/django/seedsource/migrations/0006_auto_20201005_2121.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: consbio/seedsource-core path: /seedsource_core/django/seedsource/migrations/0006_auto_20201005_2121.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2020-10-06 04:21
from __future__ import unicode_literals
<|fim_suffix|> dependencies = [
('seedsource', '0005_transferlimit_e... | code_fim | medium | {
"lang": "python",
"repo": "consbio/seedsource-core",
"path": "/seedsource_core/django/seedsource/migrations/0006_auto_20201005_2121.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>print(granola_ids.size())
# unsqueeze IDs to get batch size of 1 as added dimension
# granola_ids = granola_ids.unsqueeze(0)
# print(granola_ids.size())
print(type(granola_ids))
with torch.no_grad():
out = model(input_ids=granola_ids)
# the output is a tuple
print(type(out))
# the tuple contains thr... | code_fim | medium | {
"lang": "python",
"repo": "Omkar-Ranadive/Fine-Tuning-BERT",
"path": "/src/temp.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Omkar-Ranadive/Fine-Tuning-BERT path: /src/temp.py
"""
Refer to https://github.com/BramVanroy/bert-for-inference/blob/master/introduction-to-bert.ipynb for a quick intro
Code credits to: Bram Vanroy
"""
from transformers import BertModel, BertTokenizer
import torch
tokenizer = BertTokenizer.f... | code_fim | medium | {
"lang": "python",
"repo": "Omkar-Ranadive/Fine-Tuning-BERT",
"path": "/src/temp.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tokirmanva22/Coursera-Data-Structures-and-Algorithms path: /Algorithmic Toolbox/week2_algorithmic_warmup/7_last_digit_of_the_sum_of_fibonacci_numbers_again/fibonacci_partial_sum.py
def get_fibonacci_last_digit(n):
if (n < 1):
return n
prev = 0
curr = 1
for _ in range(n -... | code_fim | hard | {
"lang": "python",
"repo": "tokirmanva22/Coursera-Data-Structures-and-Algorithms",
"path": "/Algorithmic Toolbox/week2_algorithmic_warmup/7_last_digit_of_the_sum_of_fibonacci_numbers_again/fibonacci_partial_sum.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if (last_digit_minuend < last_digit_subtrahend):
last_digit_minuend = last_digit_minuend + 10
return last_digit_minuend - last_digit_subtrahend
if __name__ == '__main__':
a, b = map(int, input().split())
print(get_fibonacci_partial_sum(a, b))<|fim_prefix|># repo: tokirmanva22/Cour... | code_fim | hard | {
"lang": "python",
"repo": "tokirmanva22/Coursera-Data-Structures-and-Algorithms",
"path": "/Algorithmic Toolbox/week2_algorithmic_warmup/7_last_digit_of_the_sum_of_fibonacci_numbers_again/fibonacci_partial_sum.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SHR-25/Text-Classification path: /GetData.py
"""
预处理部分1:
利用清华语料库,处理10类的新闻数据
从清华数据源文件中提取需要的5万数据
"""
import os
import shutil
class_list = {'财经': 'Economics', '房产': 'House', '社会': 'Society', '时尚': 'Fashion', '教育': 'Education',
'科技': 'Technology', '时政': 'Politics', '体育': 'PE', '游戏': 'G... | code_fim | hard | {
"lang": "python",
"repo": "SHR-25/Text-Classification",
"path": "/GetData.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># class_name = '社会'
# class_name_en = 'Society'
# dir_path = 'D:/下载/THUCNews/THUCNews/' + class_name
# file_list = os.listdir(dir_path)
# print(class_name + ':' + str(len(file_list)))
#
# if not os.path.exists('source_data_train/' + class_name_en):
# os.mkdir('source_data_train/' + class_name_en)
# fo... | code_fim | hard | {
"lang": "python",
"repo": "SHR-25/Text-Classification",
"path": "/GetData.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: juliecious/sinGAN_reload path: /inject.py
"""Inject a given image into the SinGAN. This can be used for Super-Resolution, Paint-to-Image, Harmonization and Editiing."""
import torch
from src.singan import SinGAN
import argparse
from datetime import datetime
from skimage import io
import numpy as ... | code_fim | hard | {
"lang": "python",
"repo": "juliecious/sinGAN_reload",
"path": "/inject.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Load clip art image
clip_art = load_img(path, device)
# Create SinGAN model
singan = SinGAN(device, 0.1, 0.1, 10, 1, 1, 1, None)
# Load trained model (look at standard path)
singan.load()
# Check for training progress of SinGAN
if not singan.trained_scale == singan.N:
print('SinGAN is not complet... | code_fim | hard | {
"lang": "python",
"repo": "juliecious/sinGAN_reload",
"path": "/inject.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AMWA-TV/AS-11_UK_DPP_HD path: /specification_data_files/www.amwa.tv_c0f7b64/block/989/artefacts/picture_ratio.py
if PRESENT( UKDPP_Picture_Ratio ):
CHECK( UKDPP_Picture_Ratio in [{"Numerator":4, "Denominator":3},
<|fim_suffix|> {"Numerator":16, "Denom... | code_fim | hard | {
"lang": "python",
"repo": "AMWA-TV/AS-11_UK_DPP_HD",
"path": "/specification_data_files/www.amwa.tv_c0f7b64/block/989/artefacts/picture_ratio.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|> {"Numerator":16, "Denominator":9},
{"Numerator":37, "Denominator":20},
{"Numerator":21, "Denominator":9},
{"Numerator":12, "Denominator":5}] )<|fim_prefix|># repo: AMWA-TV/AS-11_UK_DPP_... | code_fim | hard | {
"lang": "python",
"repo": "AMWA-TV/AS-11_UK_DPP_HD",
"path": "/specification_data_files/www.amwa.tv_c0f7b64/block/989/artefacts/picture_ratio.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|>4159 * R**2 * Alt
print('O volume da lata corresponde a: {}'.format(volume))<|fim_prefix|># repo: LarmIg/Algoritmos-Python path: /Capitulo 3/Exercicio C.py
# Calcular e apresentar o valor do volume de uma lata de óleo, utilizando a <|fim_middle|>fórmula VOLUME <- 3.14159 *R^2 * ALTURA.
Alt = float(in... | code_fim | medium | {
"lang": "python",
"repo": "LarmIg/Algoritmos-Python",
"path": "/Capitulo 3/Exercicio C.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LarmIg/Algoritmos-Python path: /Capitulo 3/Exercicio C.py
# Calcular e apresentar o valor do volume de uma lata de óleo, utilizando a <|fim_suffix|>4159 * R**2 * Alt
print('O volume da lata corresponde a: {}'.format(volume))<|fim_middle|>fórmula VOLUME <- 3.14159 *R^2 * ALTURA.
Alt = float(in... | code_fim | medium | {
"lang": "python",
"repo": "LarmIg/Algoritmos-Python",
"path": "/Capitulo 3/Exercicio C.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if values.get('name') is None:
values.pop('name', None)
if is_group:
model = models.ShareGroupTypes
exists_exc = exception.ShareGroupTypeExists
exists_args = {'type_id': values.get('name')}
else:
model = models.ShareTypes
exists_exc = exception.... | code_fim | hard | {
"lang": "python",
"repo": "openstack/manila",
"path": "/manila/db/sqlalchemy/api.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: openstack/manila path: /manila/db/sqlalchemy/api.py
ssion=None):
session = session or get_session()
export_location_id = share_export_location_get_by_uuid(
context, export_location_uuid).id
return model_query(
context, models.ShareInstanceExportLocationsMetadata, sess... | code_fim | hard | {
"lang": "python",
"repo": "openstack/manila",
"path": "/manila/db/sqlalchemy/api.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Apply filters
if not filters:
filters = {}
no_key = 'key_is_absent'
for k, v in filters.items():
temp_k = k.rstrip('~') if k in constants.LIKE_FILTER else k
filter_attr = getattr(models.ShareGroup, temp_k, no_key)
if filter_attr == no_key:
msg... | code_fim | hard | {
"lang": "python",
"repo": "openstack/manila",
"path": "/manila/db/sqlalchemy/api.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Args:
_: Present to mimic the behavior of RawLog.get_section_* functions, but not
used by the function
Returns: A list of the lines in file_read.txt with trailing whitespace
removed
"""
return ["scorevideo LOG", "File: log.mat"]
def test_get_actual_expected():
... | code_fim | hard | {
"lang": "python",
"repo": "U8NWXD/scorevideo_lib",
"path": "/tests/src/test_tests.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: U8NWXD/scorevideo_lib path: /tests/src/test_tests.py
# This file is part of scorevideo_lib: A library for working with scorevideo
# Use of this file is governed by the license in LICENSE.txt.
"""Test operations needed to run other tests.
"""
from tests.src.test_rawlog import get_actual_expecte... | code_fim | medium | {
"lang": "python",
"repo": "U8NWXD/scorevideo_lib",
"path": "/tests/src/test_tests.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> This is important because other functions use get_actual_expected
Returns: None
"""
exp, act = get_actual_expected(TEST_RES + "/file_read.txt",
return_file_read,
TEST_RES + "/file_read.txt")
assert exp == act<|fim_... | code_fim | hard | {
"lang": "python",
"repo": "U8NWXD/scorevideo_lib",
"path": "/tests/src/test_tests.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shanzi/pulse path: /pulse/knn.py
#!/usr/bin/env python
# encoding: utf-8
from mvpa2.clfs.knn import kNN
from mvpa2.measures.base import CrossValidation
from pulse.lda import lda
import numpy as np
<|fim_suffix|>def cv_kNN(data_set, partitioner):
clf = kNN(12)
clf.set_postproc(None)
... | code_fim | medium | {
"lang": "python",
"repo": "shanzi/pulse",
"path": "/pulse/knn.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> clf = kNN(12)
clf.set_postproc(None)
cv = CrossValidation(clf, partitioner)
cv_results = cv(data_set)
return np.mean(cv_results)
def train_kNN(data_set):
clf = kNN(12)
clf.train(data_set)
return clf<|fim_prefix|># repo: shanzi/pulse path: /pulse/knn.py
#!/usr/bin/env pyth... | code_fim | medium | {
"lang": "python",
"repo": "shanzi/pulse",
"path": "/pulse/knn.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Python3pkg/Eelbrain path: /eelbrain/_trf/_boosting.py
_WORKERS = cpu_count()
JOB_TERMINATE = -1
# error functions
ERROR_FUNC = {'l2': l2, 'l1': l1}
DELTA_ERROR_FUNC = {'l2': l2_for_delta, 'l1': l1_for_delta}
class BoostingResult(object):
"""Result from boosting a temporal response function... | code_fim | hard | {
"lang": "python",
"repo": "Python3pkg/Eelbrain",
"path": "/eelbrain/_trf/_boosting.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> has_nan = tuple(np.isnan(v.sum()) for v in data_scale)
else:
data_mean = data_scale = (None,) * (len(x) + 1)
has_nan = tuple(np.isnan(v.sum()) for v in data)
# check for NaN (blocks boosting process)
if any(has_nan):
raise ValueError("Can not use %s for boostin... | code_fim | hard | {
"lang": "python",
"repo": "Python3pkg/Eelbrain",
"path": "/eelbrain/_trf/_boosting.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Python3pkg/Eelbrain path: /eelbrain/_trf/_boosting.py
`` and ``x`` are left untouched; use ``'inplace'`` to save
memory by scaling the original ``y`` and ``x``.
delta : scalar
Step for changes in the kernel.
mindelta : scalar
If the error for the training data can'... | code_fim | hard | {
"lang": "python",
"repo": "Python3pkg/Eelbrain",
"path": "/eelbrain/_trf/_boosting.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cfpb/owning-a-home-api path: /ratechecker/tests/test_views_ratecheckerparameters.py
from decimal import Decimal
from django.test import TestCase
from ratechecker.models import Product
from ratechecker.ratechecker_parameters import ParamsSerializer, scrub_error
class RateCheckerParametersTestC... | code_fim | hard | {
"lang": "python",
"repo": "cfpb/owning-a-home-api",
"path": "/ratechecker/tests/test_views_ratecheckerparameters.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.data["state"] = 123
serializer = ParamsSerializer(data=self.data)
self.assertFalse(serializer.is_valid())
self.assertEqual(
serializer.errors.get("state"), ['"123" is not a valid choice.']
)
def test_is_valid__loan_type_invalid(self):
s... | code_fim | hard | {
"lang": "python",
"repo": "cfpb/owning-a-home-api",
"path": "/ratechecker/tests/test_views_ratecheckerparameters.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PacktPublishing/Learn-Python-Programming-Second-Edition path: /Chapter07/ch7/files/compression/tar.py
import tarfile
with tarfile.open('example.tar.gz', 'w:gz') as tar:
<|fim_suffix|>der/content3.txt')
tar.add('subfolder/content4.txt')
with tarfile.open('example.tar.gz', 'r:gz') as tar:
... | code_fim | medium | {
"lang": "python",
"repo": "PacktPublishing/Learn-Python-Programming-Second-Edition",
"path": "/Chapter07/ch7/files/compression/tar.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>open('example.tar.gz', 'r:gz') as tar:
tar.extractall('extract_tar')<|fim_prefix|># repo: PacktPublishing/Learn-Python-Programming-Second-Edition path: /Chapter07/ch7/files/compression/tar.py
import tarfile
with tarfile.open('example.tar.gz', 'w:gz') as tar:
tar.add('content1.txt')
tar.add('... | code_fim | medium | {
"lang": "python",
"repo": "PacktPublishing/Learn-Python-Programming-Second-Edition",
"path": "/Chapter07/ch7/files/compression/tar.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>mport InferCifarResNet
from .InferMobileNetV2 import InferMobileNetV2
from .InferTinyCellNet import DynamicShapeTinyNet<|fim_prefix|># repo: D-X-Y/AutoDL-Projects path: /xautodl/models/shape_infers/__init__.py
#####################################################
# Copyright (c) Xuanyi Dong [GitHub D-X-Y... | code_fim | medium | {
"lang": "python",
"repo": "D-X-Y/AutoDL-Projects",
"path": "/xautodl/models/shape_infers/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: D-X-Y/AutoDL-Projects path: /xautodl/models/shape_infers/__init__.py
#####################################################
# Copyright (c) Xuanyi Dong [GitHub D-X-Y], 2019.01 #
##########<|fim_suffix|>etResNet import InferImagenetResNet
from .InferCifarResNet_depth import InferDepthCifarResNet
fr... | code_fim | medium | {
"lang": "python",
"repo": "D-X-Y/AutoDL-Projects",
"path": "/xautodl/models/shape_infers/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>Map.setCenter(-122.262, 37.8719, 10)
Map.addLayer(median, vizParams, 'Median image')
# Display the map.
Map<|fim_prefix|># repo: xiangtaoxu/earthengine-py-examples path: /GetStarted/06_reducing.py
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
... | code_fim | hard | {
"lang": "python",
"repo": "xiangtaoxu/earthengine-py-examples",
"path": "/GetStarted/06_reducing.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xiangtaoxu/earthengine-py-examples path: /GetStarted/06_reducing.py
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
<|fim_suffix|># Compute the median of each pixel for each band of the 5 least cloudy scenes.
median = collection.limit(5... | code_fim | hard | {
"lang": "python",
"repo": "xiangtaoxu/earthengine-py-examples",
"path": "/GetStarted/06_reducing.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def testIsInterface(self):
itf1 = JPackage("jpype").jclassutil.TestInterface1
itf2 = JClass("jpype.jclassutil.TestInterface2")
itf3 = JPackage("java.lang").Cloneable
itf4 = JClass("java.io.Serializable")
cls1 = JPackage("java.lang").Integer
cls2 = JClas... | code_fim | medium | {
"lang": "python",
"repo": "karpierz/jtypes.jpype",
"path": "/tests/jpypetest/jclassutil.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertTrue(JClassUtil.isInterface(itf1))
self.assertTrue(JClassUtil.isInterface(itf2))
self.assertTrue(JClassUtil.isInterface(itf3))
self.assertTrue(JClassUtil.isInterface(itf4))
self.assertFalse(JClassUtil.isInterface(cls1))
self.assertFalse(JClassUtil... | code_fim | hard | {
"lang": "python",
"repo": "karpierz/jtypes.jpype",
"path": "/tests/jpypetest/jclassutil.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: karpierz/jtypes.jpype path: /tests/jpypetest/jclassutil.py
# Copyright 2013-2018 Adam Karpierz
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# <AK> added
#
from __future__ import absolute_import
from . import common
from jpype import JPackage, J... | code_fim | medium | {
"lang": "python",
"repo": "karpierz/jtypes.jpype",
"path": "/tests/jpypetest/jclassutil.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>peso)
print(f'O menor peso informado foi {min(listapesos)}kg')
print(f'O maior peso informado foi {max(listapesos)}kg')<|fim_prefix|># repo: marroni1103/exercicios-pyton path: /pythonexercicios/ex055-maioremenordasequencia.py
listapesos = []
for c in range(1, 6):
peso = float(input<|fim_middle|>(f'I... | code_fim | medium | {
"lang": "python",
"repo": "marroni1103/exercicios-pyton",
"path": "/pythonexercicios/ex055-maioremenordasequencia.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: marroni1103/exercicios-pyton path: /pythonexercicios/ex055-maioremenordasequencia.py
listapesos = []
for c in range(1, 6):
peso = float(input<|fim_suffix|>g')
print(f'O maior peso informado foi {max(listapesos)}kg')<|fim_middle|>(f'Informe o peso da {c}° pessoa: '))
listapesos.append(peso... | code_fim | medium | {
"lang": "python",
"repo": "marroni1103/exercicios-pyton",
"path": "/pythonexercicios/ex055-maioremenordasequencia.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>g')
print(f'O maior peso informado foi {max(listapesos)}kg')<|fim_prefix|># repo: marroni1103/exercicios-pyton path: /pythonexercicios/ex055-maioremenordasequencia.py
listapesos = []
for c in range(1, 6):
peso = float(input<|fim_middle|>(f'Informe o peso da {c}° pessoa: '))
listapesos.append(peso... | code_fim | medium | {
"lang": "python",
"repo": "marroni1103/exercicios-pyton",
"path": "/pythonexercicios/ex055-maioremenordasequencia.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pavelglebov/ggrc-core path: /test/selenium/src/lib/entities/mixin.py
# Copyright (C) 2020 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Mixins for entities."""
# pylint: disable=too-few-public-methods
class Reviewable(object):
"""A mixin for rev... | code_fim | hard | {
"lang": "python",
"repo": "pavelglebov/ggrc-core",
"path": "/test/selenium/src/lib/entities/mixin.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Update object review `reviewers` with new values if needed."""
if self.review["reviewers"]:
if new_reviewers and new_reviewers[0] not in self.review["reviewers"]:
self.review["reviewers"] = self.review["reviewers"] + new_reviewers
else:
self.review["reviewers"] = new_rev... | code_fim | medium | {
"lang": "python",
"repo": "pavelglebov/ggrc-core",
"path": "/test/selenium/src/lib/entities/mixin.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # ### commands auto generated by Alembic - please adjust! ###
op.drop_table('request_tracker')
op.execute("DROP TYPE request_tracker_type;")
op.execute("DROP TYPE request_tracker_servicename;")
# ### end Alembic commands ###<|fim_prefix|># repo: bcgov/lear path: /legal-api/migrations... | code_fim | hard | {
"lang": "python",
"repo": "bcgov/lear",
"path": "/legal-api/migrations/versions/86d8aca36208_request_tracker.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # ### commands auto generated by Alembic - please adjust! ###
op.create_table('request_tracker',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('request_type', sa.Enum('INFORM_CRA', 'GET_BN', name='request_tracker_type'), nullable=False),
sa.Column('is_processed', sa.Boolean(... | code_fim | medium | {
"lang": "python",
"repo": "bcgov/lear",
"path": "/legal-api/migrations/versions/86d8aca36208_request_tracker.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bcgov/lear path: /legal-api/migrations/versions/86d8aca36208_request_tracker.py
"""request_tracker
Revision ID: 86d8aca36208
Revises: 40015e4aa4f5
Create Date: 2022-04-25 14:55:03.076474
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '86d... | code_fim | hard | {
"lang": "python",
"repo": "bcgov/lear",
"path": "/legal-api/migrations/versions/86d8aca36208_request_tracker.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.