text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: BimiLevi/Covid19 path: /venv/Lib/site-packages/branca/__init__.py
import branca.colormap as colormap
import branca.element as element
<|fim_suffix|>__all__ = [
'colormap',
'element',
]<|fim_middle|>from ._version import get_versions
__version__ = get_versions()['version']
del get_ve... | code_fim | medium | {
"lang": "python",
"repo": "BimiLevi/Covid19",
"path": "/venv/Lib/site-packages/branca/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>__version__ = get_versions()['version']
del get_versions
__all__ = [
'colormap',
'element',
]<|fim_prefix|># repo: BimiLevi/Covid19 path: /venv/Lib/site-packages/branca/__init__.py
import branca.colormap as colormap
import branca.element as element
<|fim_middle|>from ._version import get_v... | code_fim | easy | {
"lang": "python",
"repo": "BimiLevi/Covid19",
"path": "/venv/Lib/site-packages/branca/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self._step += amt
class LarsonScanner(BaseAnimation):
"""Larson scanner (i.e. Cylon Eye or K.I.T.T.)."""
def __init__(self, led_strip, color, tail=2, fade=0.75, start=0, end=0):
super(LarsonScanner, self).__init__(led_strip, start, end)
self._color = color
self.... | code_fim | hard | {
"lang": "python",
"repo": "cghercoias/LPD8806_PI",
"path": "/raspledstrip/animation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cghercoias/LPD8806_PI path: /raspledstrip/animation.py
import math
import random
from color import *
import util
class BaseAnimation(object):
def __init__(self, led_strip, start, end):
self._led = led_strip
self._start = start
self._end = end
if self._end ==... | code_fim | hard | {
"lang": "python",
"repo": "cghercoias/LPD8806_PI",
"path": "/raspledstrip/animation.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class FillFromCenter(BaseAnimation):
def __init__(self, led_strip, fill_color, start=0, end=0):
self._strip_length = led_strip.last_index
self._center_point = int(self._strip_length / 2)
self._color = fill_color
super(FillFromCenter, self).__init__(led_strip, start, end... | code_fim | hard | {
"lang": "python",
"repo": "cghercoias/LPD8806_PI",
"path": "/raspledstrip/animation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def merge(self, nums1, m, nums2, n):
"""
:type nums1: List[int]
:type m: int
:type nums2: List[int]
:type n: int
:rtype: void Do not return anything, modify nums1 in-place instead.
"""
while m and n:
if nums1[m - 1] > nums2[n ... | code_fim | medium | {
"lang": "python",
"repo": "mickey0524/leetcode",
"path": "/88.Merge-Sorted-Array.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mickey0524/leetcode path: /88.Merge-Sorted-Array.py
# https://leetcode.com/problems/gray-code/
#
# algorithms
# Easy (35.75%)
# Total Accepted: 365,649
# Total Submissions: 1,022,741
# beats 95.52% of python submissions
class Solution(object):
<|fim_suffix|> """
:type nums1: L... | code_fim | medium | {
"lang": "python",
"repo": "mickey0524/leetcode",
"path": "/88.Merge-Sorted-Array.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chenzheng128/SoRec path: /recsys19_hybridsvd/data_preprocessing.py
import numpy as np
import pandas as pd
from polara import RecommenderData
from polara import get_movielens_data as get_ml_data
from polara import get_bookcrossing_data as get_bx_data
from polara import get_amazon_data as get_az_d... | code_fim | hard | {
"lang": "python",
"repo": "chenzheng128/SoRec",
"path": "/recsys19_hybridsvd/data_preprocessing.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if filter_no_meta:
not_empty = meta_info.applymap(len).sum(axis=1) > 0
if not not_empty.all():
meta_info = meta_info.loc[not_empty]
ratings = ratings.query(f'songid in @meta_info.index')
while pcore: # do only if pcore is specified
... | code_fim | hard | {
"lang": "python",
"repo": "chenzheng128/SoRec",
"path": "/recsys19_hybridsvd/data_preprocessing.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> userid = 'userid'
itemid = meta_info.index.name
similarities = {userid: None, itemid: item_similarity}
indices = {userid: None, itemid: meta_info.index}
labels = {userid: None, itemid: lbls}
return similarities, indices, labels
def prepare_data_model(data_label, raw_data, similar... | code_fim | hard | {
"lang": "python",
"repo": "chenzheng128/SoRec",
"path": "/recsys19_hybridsvd/data_preprocessing.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ondrejholecek/fortidebug path: /auxi/simplify.py
#!/usr/bin/env python2.7
import sys
import datetime
import re
import pytz
import argparse
def do(params):
re_datetime = re.compile("^\[(\d+)-(\d+)-(\d+)\s+(\d+):(\d+):(\d+)\]\s+(.*)$")
re_split = re.compile(params['split'])
unix... | code_fim | hard | {
"lang": "python",
"repo": "ondrejholecek/fortidebug",
"path": "/auxi/simplify.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> elif in_progress['block'] != None and params['operation'] == 'average':
print_it(in_progress['block']+params['interval'], " ".join(str(int(round(float(s)/in_progress['count']))) for s in in_progress['data']), params)
in_progress = { 'block': current_block, 'count': 1, 'data': ocols}
else:... | code_fim | hard | {
"lang": "python",
"repo": "ondrejholecek/fortidebug",
"path": "/auxi/simplify.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|># print uts, current_block, group_name, ocols
# print uts, data
def print_it(ts, data, params):
if params['timeformat'] == "unixts":
print "%i %s" % (ts, data,)
elif params['timeformat'] == "human":
print "%s %s" % (pytz.UTC.localize(datetime.datetime.utcfromtimestamp(ts)).astimezone(params['time... | code_fim | hard | {
"lang": "python",
"repo": "ondrejholecek/fortidebug",
"path": "/auxi/simplify.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: beattykariuki/Pitches path: /app/main/error.py
from flask import render_template
from . import main
@main.app_errorhandler(404)
def four_ow_four(error):
<|fim_suffix|>
return render_template('fourOwfour.html'),404
1<|fim_middle|>
return render_template
from . import main... | code_fim | medium | {
"lang": "python",
"repo": "beattykariuki/Pitches",
"path": "/app/main/error.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
return render_template('fourOwfour.html'),404
1<|fim_prefix|># repo: beattykariuki/Pitches path: /app/main/error.py
from flask import render_template
from . import main
<|fim_middle|>@main.app_errorhandler(404)
def four_ow_four(error):
return render_template
from . import main... | code_fim | medium | {
"lang": "python",
"repo": "beattykariuki/Pitches",
"path": "/app/main/error.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Start collecting tweets from the live Twitter stream that include search terms provided as parameters"""
listener = TwitterListener()
listener._max_tweets = num_tweets
twitter_stream = Stream(auth, listener)
twitter_stream.filter(track=terms, languages=['en'])
... | code_fim | medium | {
"lang": "python",
"repo": "jasonflorack/OS-tweets",
"path": "/app/ListenerInterface.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jasonflorack/OS-tweets path: /app/ListenerInterface.py
from tweepy import Stream
from app.TwitterListener import TwitterListener
<|fim_suffix|>
@staticmethod
def get_live_tweets_from_twitter_stream(auth, terms, num_tweets):
"""Start collecting tweets from the live Twitter stream... | code_fim | medium | {
"lang": "python",
"repo": "jasonflorack/OS-tweets",
"path": "/app/ListenerInterface.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.m_staticText25 = wx.StaticText( self, wx.ID_ANY, u"latitude (y) (-90° to +90° degrees)", wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText25.Wrap( -1 )
gSizer2.Add( self.m_staticText25, 0, wx.ALL, 5 )
gSizer4 = wx.GridSizer( 0, 2, 0, 0 )
self.m_stati... | code_fim | hard | {
"lang": "python",
"repo": "WamdamProject/WaMDaM_Wizard",
"path": "/src/viewer/Exporter/ExportModels.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: WamdamProject/WaMDaM_Wizard path: /src/viewer/Exporter/ExportModels.py
)
self.btn_back.Bind( wx.EVT_BUTTON, self.btn_backOnButtonClick )
self.btn_next.Bind( wx.EVT_BUTTON, self.btn_nextOnButtonClick )
def __del__( self ):
pass
# Virtual event handlers, overide ... | code_fim | hard | {
"lang": "python",
"repo": "WamdamProject/WaMDaM_Wizard",
"path": "/src/viewer/Exporter/ExportModels.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.btn_back = wx.Button( self, 28, u"Back", wx.DefaultPosition, wx.DefaultSize, 0 )
gSizer5.Add( self.btn_back, 0, wx.ALL|wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 5 )
self.btn_next = wx.Button( self, 29, u"Next", wx.DefaultPosition, wx.DefaultSize, 0 )
gSizer5.Add( self.... | code_fim | hard | {
"lang": "python",
"repo": "WamdamProject/WaMDaM_Wizard",
"path": "/src/viewer/Exporter/ExportModels.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ibell/thermopack path: /addon/pyExamples/pets.py
#!/usr/bin/python
# Support for python2
from __future__ import print_function
#Modify system path
import sys
sys.path.append('../pycThermopack/')
# Importing pyThermopack
from pyctp import pets
# Importing Numpy (math, arrays, etc...)
import numpy ... | code_fim | medium | {
"lang": "python",
"repo": "ibell/thermopack",
"path": "/addon/pyExamples/pets.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Plot phase envelope
z = np.array([1.0])
T, P, v = PeTS.get_envelope_twophase(1.0e4, z, maximum_pressure=1.5e7, calc_v=True)
Tc, vc, Pc = PeTS.critical(z)
plt.plot(1.0/v, T)
plt.plot([1.0/vc], [Tc], "ko")
plt.xlabel(r"$\rho$ (mol/m$^3$)")
plt.ylabel(r"$T$ (K)")
plt.title("PeTS phase diagram")
plt.show()
... | code_fim | medium | {
"lang": "python",
"repo": "ibell/thermopack",
"path": "/addon/pyExamples/pets.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''Try to modify the target path to the updated path.
'''
childless_params = ['avg', 'count', 'max', 'min', 'sum', 'value']
new_data = dashboard.data
for panel in _yield_panels(new_data):
if panel['datasource'] in ['null', 'Aggregate All Global']:
LOGGER.warn('In %... | code_fim | hard | {
"lang": "python",
"repo": "luke-powers/grafana_dashboard_manipulator",
"path": "/dashboard_processors.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@make_db_processor
def update_old_paths(dashboard, processor_arg=None):
'''Try to modify the target path to the updated path.
'''
childless_params = ['avg', 'count', 'max', 'min', 'sum', 'value']
new_data = dashboard.data
for panel in _yield_panels(new_data):
if panel['dataso... | code_fim | hard | {
"lang": "python",
"repo": "luke-powers/grafana_dashboard_manipulator",
"path": "/dashboard_processors.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: luke-powers/grafana_dashboard_manipulator path: /dashboard_processors.py
json_data = json.loads(data, encoding="latin-1")
for rows in json_data['rows']:
for panel in rows['panels']:
if'targets' not in panel:
continue
yield panel
def make_... | code_fim | hard | {
"lang": "python",
"repo": "luke-powers/grafana_dashboard_manipulator",
"path": "/dashboard_processors.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Fendrel-/Common_Characters path: /code.py
"""
Common Characters - Code Adventure
INTRODUCTION:
Lets take a look at two strings and see if we can count the number of
commmon characters using some Python. This sounds like a
super easy task, but appearances can be deceiving. There is actually
... | code_fim | hard | {
"lang": "python",
"repo": "Fendrel-/Common_Characters",
"path": "/code.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
There are many ways to accomplish this. It can be done with conditionals,
counters and recursion. It can be done with a loop, a simple search, and
a counter. So feel free to experiment and explore. As is so often the case
with code, there isn't just one right answer.
There are a number of steps to a... | code_fim | hard | {
"lang": "python",
"repo": "Fendrel-/Common_Characters",
"path": "/code.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert optionset.parse("DELETE", (None, {"format": "yaml"})).format == "yaml"
assert optionset.parse("POST", (None, {"dev": "true"})).dev is True
assert optionset.parse("GET", ()).raw is True
def test_04():
option = OptionSet(
{
"*": {"p1": {"group": "a"}},
... | code_fim | hard | {
"lang": "python",
"repo": "biothings/biothings.api",
"path": "/tests/web/options/test_optionset.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> with pytest.raises(OptionError) as err:
optionset.parse("POST", ())
assert err.value.info["missing"] == "ids"
assert "alias" not in err.value.info
assert "keyword" not in err.value.info
assert "reason" not in err.value.info
def test_03():
commondef = {
"*": {"form... | code_fim | hard | {
"lang": "python",
"repo": "biothings/biothings.api",
"path": "/tests/web/options/test_optionset.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: biothings/biothings.api path: /tests/web/options/test_optionset.py
import pytest
from biothings.web.options import OptionError, OptionSet
def test_01():
ans = OptionSet(
{
"*": {
"raw": {"type": bool, "default": False, "group": "a"},
"siz... | code_fim | hard | {
"lang": "python",
"repo": "biothings/biothings.api",
"path": "/tests/web/options/test_optionset.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_solution_filepaths(language=""):
all_solution_filepaths = glob.glob(os.path.join(solutions_dir(language), f"*.{language2ext[language]}"))
all_problem_filepaths = glob.glob(os.path.join(problems_dir(), "problems", "*.py"))
solutions = [os.path.splitext(os.path.basename(fp))[0] for fp i... | code_fim | medium | {
"lang": "python",
"repo": "project-lovelace/lovelace-engine",
"path": "/tests/helpers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: project-lovelace/lovelace-engine path: /tests/helpers.py
import os
import glob
# User can set solutions and problems dir and server/port for lovelace engine if it's different
# from the default. Don't forget http:// at the beginning of the engine URI
# export LOVELACE_ENGINE_URI="https://custom-... | code_fim | hard | {
"lang": "python",
"repo": "project-lovelace/lovelace-engine",
"path": "/tests/helpers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> prob_dir = os.environ.get("LOVELACE_PROBLEMS_DIR", "/home/ada/lovelace/lovelace-problems/")
if not os.path.isdir(prob_dir):
raise ValueError(
f"Cannot find solutions dir at: {prob_dir}. "
"Is the env var LOVELACE_PROBLEMS_DIR set properly?"
)
return prob... | code_fim | hard | {
"lang": "python",
"repo": "project-lovelace/lovelace-engine",
"path": "/tests/helpers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for f_mz,_ in sorted(zip(ent.mz,ent.I),key=operator.itemgetter(1),reverse=True):
frago.write('{}\t{}\t{}\t{}\t{:.4f}\t{}\t{}\t{}\t{}'.format(x[1],id_with_count,alt_id_with_count,'',x[0],ent.adduct,identified,sum(1 for basename0 in basename_l if mzML_f[basename0][f_mz]>0),f_mz))
... | code_fim | hard | {
"lang": "python",
"repo": "DIMSkit/DIMSkit",
"path": "/DIms.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> frago=open('quant_frag.txt','w')
frago.write('group\tID\talt_IDs\tMS1\tmz\tadduct\tID\tcount\tfrag_m/z\t'+'\t'.join(basename_l)+'\t'+'\t'.join('score_'+x for x in basename_l)+'\t'+'\t'.join('mass_error_'+x for x in basename_l)+'\n')
for x,y in sorted(con_tab.items(),key=lambda x:x[0][0]):
... | code_fim | hard | {
"lang": "python",
"repo": "DIMSkit/DIMSkit",
"path": "/DIms.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DIMSkit/DIMSkit path: /DIms.py
import sys
import collections
import operator
import itertools
from bisect import bisect_left
import os
import glob
import concurrent.futures
import math
import time
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from matplotlib.backends.ba... | code_fim | hard | {
"lang": "python",
"repo": "DIMSkit/DIMSkit",
"path": "/DIms.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, return_probs: Dict[CLASS_LABEL_TYPE, float]):
self._class_probs = return_probs
def predict_text(self, text: str):
#guess = WeightedR
guess = random.choices(
tuple(self._class_probs.keys()), weights=tuple(self._class_probs.values()), k=1)[0]
... | code_fim | hard | {
"lang": "python",
"repo": "DNGros/R-U-A-Robot",
"path": "/classify_text_plz/classifiers/stupid_classifiers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DNGros/R-U-A-Robot path: /classify_text_plz/classifiers/stupid_classifiers.py
from collections import Counter
from typing import Dict
from classify_text_plz.modeling import TextModelTrained, TextModelMaker, Prediction
from classify_text_plz.dataing import MyTextData, DataSplit
import statistics
... | code_fim | hard | {
"lang": "python",
"repo": "DNGros/R-U-A-Robot",
"path": "/classify_text_plz/classifiers/stupid_classifiers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>t_funcs.cat_feature_engineering import getCatFeatures<|fim_prefix|># repo: evanmiller29/DonorChoose path: /stacknet/stacknet_funcs/__init__.py
from stacknet.stacknet_funcs.sparse_funcs import from_sparse_to_file
from stacknet.stacknet_funcs.datetim<|fim_middle|>e_funcs import getTimeFeatures
from stackne... | code_fim | easy | {
"lang": "python",
"repo": "evanmiller29/DonorChoose",
"path": "/stacknet/stacknet_funcs/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: evanmiller29/DonorChoose path: /stacknet/stacknet_funcs/__init__.py
from stacknet.stacknet_funcs.sparse_funcs import from_sparse_to_file
from stacknet.stacknet_funcs.datetim<|fim_suffix|>t_funcs.cat_feature_engineering import getCatFeatures<|fim_middle|>e_funcs import getTimeFeatures
from stackne... | code_fim | easy | {
"lang": "python",
"repo": "evanmiller29/DonorChoose",
"path": "/stacknet/stacknet_funcs/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ntrrgc/dotfiles path: /wtfd/update_time.py
import datetime
from wtfd.bar_singleton import bar
from wtfd.io_loop import io_loop
<|fim_suffix|> now = datetime.datetime.now()
time = now.strftime('%{U#00FF00}%{+u}%a %Y-%m-%d %H:%M%{-u}')
bar.time = time
bar.update()
seconds_to_... | code_fim | medium | {
"lang": "python",
"repo": "ntrrgc/dotfiles",
"path": "/wtfd/update_time.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> now = datetime.datetime.now()
time = now.strftime('%{U#00FF00}%{+u}%a %Y-%m-%d %H:%M%{-u}')
bar.time = time
bar.update()
seconds_to_next_min = 60 - now.second
io_loop.call_later(seconds_to_next_min, update_time)<|fim_prefix|># repo: ntrrgc/dotfiles path: /wtfd/update_time.py
imp... | code_fim | medium | {
"lang": "python",
"repo": "ntrrgc/dotfiles",
"path": "/wtfd/update_time.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tbereau/tbereau path: /scripts/generate_publications_yaml.py
from my_scientific_profile.database.papers import load_all_papers_from_s3
from my_scientific_profile.database.aws_s3 import S3_BUCKET, S3_CLIENT
<|fim_suffix|>for paper in papers:
print(paper.to_yaml())<|fim_middle|>papers = load_a... | code_fim | medium | {
"lang": "python",
"repo": "tbereau/tbereau",
"path": "/scripts/generate_publications_yaml.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>for paper in papers:
print(paper.to_yaml())<|fim_prefix|># repo: tbereau/tbereau path: /scripts/generate_publications_yaml.py
from my_scientific_profile.database.papers import load_all_papers_from_s3
from my_scientific_profile.database.aws_s3 import S3_BUCKET, S3_CLIENT
<|fim_middle|>papers = load_a... | code_fim | medium | {
"lang": "python",
"repo": "tbereau/tbereau",
"path": "/scripts/generate_publications_yaml.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> __tablename__ = 'Users'
id = Column(Integer, primary_key=True)
firstName = Column('first_name', String)
lastName = Column('last_name', String)
#passwordhash = Column(String)
#avatar = Column(String)
email = Column(String)
admin = Column(Boolean)
owner = Column(Boolean)
... | code_fim | hard | {
"lang": "python",
"repo": "ScJa/projectr",
"path": "/recommender/recommender/database/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ScJa/projectr path: /recommender/recommender/database/models.py
from sqlalchemy import Column, Integer, String, Boolean, Date, Float
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
def printRow(self):
elems = dict()
for key in set(dir(self.__class__)) - ... | code_fim | hard | {
"lang": "python",
"repo": "ScJa/projectr",
"path": "/recommender/recommender/database/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def create_api(app, HOST="localhost", PORT=5000,
API_PREFIX="/api/v2"):
api = SAFRSAPI(app, host=HOST, port=PORT, prefix=API_PREFIX)
api.expose_object(UserModel)
api.expose_object(PostModel)
def create_admin(app):
admin = Admin(app, name='Dashboard')
admin.add_view(Mod... | code_fim | hard | {
"lang": "python",
"repo": "sanif/Simple-Blog-Flask",
"path": "/app/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sanif/Simple-Blog-Flask path: /app/__init__.py
import logging.config
from os import environ
import bcrypt
from celery import Celery
from dotenv import load_dotenv
from flask import Flask
from flask_admin import Admin
from flask_admin.contrib.sqla import ModelView
from flask_cors import CORS
from... | code_fim | hard | {
"lang": "python",
"repo": "sanif/Simple-Blog-Flask",
"path": "/app/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Blueprints
create_blueprints(app)
# Admin
create_admin(app)
@app.route('/', methods=['GET'])
def index():
"""
Blog endpoint
"""
return 'Server is up and running'
with app.app_context():
# Open APi
create_api(app)
return a... | code_fim | hard | {
"lang": "python",
"repo": "sanif/Simple-Blog-Flask",
"path": "/app/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kimjiwook0129/Coding-Interivew-Cheatsheet path: /greedy/change.py
# Best # of coins to give change using changes g<|fim_suffix|> = [500, 100, 50, 10]
for change in changes:
count += n // change
n %= change
print(count)<|fim_middle|>iven to make n
n = int(input())
count = 0
changes | code_fim | easy | {
"lang": "python",
"repo": "kimjiwook0129/Coding-Interivew-Cheatsheet",
"path": "/greedy/change.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>count += n // change
n %= change
print(count)<|fim_prefix|># repo: kimjiwook0129/Coding-Interivew-Cheatsheet path: /greedy/change.py
# Best # of coins to give change using changes given to make n
n = int(input())
count = 0
changes<|fim_middle|> = [500, 100, 50, 10]
for change in changes:
| code_fim | easy | {
"lang": "python",
"repo": "kimjiwook0129/Coding-Interivew-Cheatsheet",
"path": "/greedy/change.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert testapp.get("/echo_matchdict/42").json == {"mymatch": 42}<|fim_prefix|># repo: marshmallow-code/webargs path: /tests/test_pyramidparser.py
from webargs.testing import CommonTestCase
class TestPyramidParser(CommonTestCase):
<|fim_middle|> def create_app(self):
from .apps.pyrami... | code_fim | hard | {
"lang": "python",
"repo": "marshmallow-code/webargs",
"path": "/tests/test_pyramidparser.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: marshmallow-code/webargs path: /tests/test_pyramidparser.py
from webargs.testing import CommonTestCase
class TestPyramidParser(CommonTestCase):
def create_app(self):
from .apps.pyramid_app import create_app
return create_app()
def test_use_args_with_callable_view(self,... | code_fim | medium | {
"lang": "python",
"repo": "marshmallow-code/webargs",
"path": "/tests/test_pyramidparser.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>word] = max(dp.get(word, 0), dp.get(temp, 0) + 1)
return max(dp.values() or [1])<|fim_prefix|># repo: NoraXie/LeetCode_Archiver path: /LeetCode/python3/1048.py
class Solution:
def longestStrChain(self, words: List[str]) -> int:
dp = {}<|fim_middle|>
for word in sorted(words, k... | code_fim | hard | {
"lang": "python",
"repo": "NoraXie/LeetCode_Archiver",
"path": "/LeetCode/python3/1048.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>in range(len(word)):
temp = word[:i] + word[i + 1:]
dp[word] = max(dp.get(word, 0), dp.get(temp, 0) + 1)
return max(dp.values() or [1])<|fim_prefix|># repo: NoraXie/LeetCode_Archiver path: /LeetCode/python3/1048.py
class Solution:
def longestStrChain(self, word... | code_fim | hard | {
"lang": "python",
"repo": "NoraXie/LeetCode_Archiver",
"path": "/LeetCode/python3/1048.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NoraXie/LeetCode_Archiver path: /LeetCode/python3/1048.py
class Solution:
def longestStrChain(self, words: List[str]) -> int:
dp = {}<|fim_suffix|>in range(len(word)):
temp = word[:i] + word[i + 1:]
dp[word] = max(dp.get(word, 0), dp.get(temp, 0) + 1)
... | code_fim | hard | {
"lang": "python",
"repo": "NoraXie/LeetCode_Archiver",
"path": "/LeetCode/python3/1048.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>optim_wrapper = dict(
optimizer=dict(type='SGD', lr=0.01, momentum=0.9, weight_decay=0.0001),
clip_grad=dict(max_norm=40, norm_type=2))<|fim_prefix|># repo: open-mmlab/mmaction2 path: /configs/_base_/schedules/sgd_150e_warmup.py
train_cfg = dict(
type='EpochBasedTrainLoop', max_epochs=150, va... | code_fim | hard | {
"lang": "python",
"repo": "open-mmlab/mmaction2",
"path": "/configs/_base_/schedules/sgd_150e_warmup.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: open-mmlab/mmaction2 path: /configs/_base_/schedules/sgd_150e_warmup.py
train_cfg = dict(
type='EpochBasedTrainLoop', max_epochs=150, val_begin=1, val_interval=1)
val_cfg = dict(type='ValLoop')
test_cfg = dict(type='TestLoop')
<|fim_suffix|>optim_wrapper = dict(
optimizer=dict(type='SGD'... | code_fim | hard | {
"lang": "python",
"repo": "open-mmlab/mmaction2",
"path": "/configs/_base_/schedules/sgd_150e_warmup.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@rnaseq.command()
@click.argument('ribo', type = click.Path( ))
@click.option('--name',
help = "experiment name",
type = click.STRING ,
required = True)
@click.option( '--force',
is_flag = True,
help = 'Delete RNA-... | code_fim | hard | {
"lang": "python",
"repo": "ribosomeprofiling/ribopy",
"path": "/ribopy/cli/rnaseq.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ribosomeprofiling/ribopy path: /ribopy/cli/rnaseq.py
from .main import *
from ..rnaseq import *
@cli.group()
def rnaseq():
"""
Display, set or delete RNA-Seq data
"""
pass
@rnaseq.command()
@click.argument('ribo', type = click.Path( ))
@click.option('-n', '--name',
... | code_fim | hard | {
"lang": "python",
"repo": "ribosomeprofiling/ribopy",
"path": "/ribopy/cli/rnaseq.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> 2) ribopy rnaseq get --name WT test.ribo
"""
get_rnaseq_wrapper(ribo_file = ribo,
name = name,
output = out,
sep = sep)
@rnaseq.command()
@click.argument('ribo', type = click.Path( ))
@click.option('--name'... | code_fim | hard | {
"lang": "python",
"repo": "ribosomeprofiling/ribopy",
"path": "/ribopy/cli/rnaseq.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: betty29/code-1 path: /recipes/Python/161173_Stateful_Objects_use_Mixins_define/recipe-161173.py
# ! /usr/bin/env python
# Lumberjack.py
# Author: D. Haynes
# 9th July 2002
#
# For more details on mix-ins, see
# http://www.linuxjournal.com/article.php?sid=4540
class CambridgeMan:
def roots(s... | code_fim | hard | {
"lang": "python",
"repo": "betty29/code-1",
"path": "/recipes/Python/161173_Stateful_Objects_use_Mixins_define/recipe-161173.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def SkipAndJump(self):
return "%s skips and jumps." % self.name
def HangAroundInBars(self):
return "%s is in the bar." % self.name
def WishIdBeenAGirlie(self):
return 0
class VeteranLumberjackMixIn:
"""
I cut down trees, I wear high heels, suspenders and ... | code_fim | hard | {
"lang": "python",
"repo": "betty29/code-1",
"path": "/recipes/Python/161173_Stateful_Objects_use_Mixins_define/recipe-161173.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __str__(self) -> str:
"""Return name as string."""
return self.name<|fim_prefix|># repo: keeners/capp path: /capp/data/models/category.py
"""Category model."""
from django.db import models
from django.utils.translation import gettext_lazy as _
<|fim_middle|>
class Category(model... | code_fim | medium | {
"lang": "python",
"repo": "keeners/capp",
"path": "/capp/data/models/category.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Return name as string."""
return self.name<|fim_prefix|># repo: keeners/capp path: /capp/data/models/category.py
"""Category model."""
from django.db import models
from django.utils.translation import gettext_lazy as _
class Category(models.Model):
"""Category - a way to group t... | code_fim | medium | {
"lang": "python",
"repo": "keeners/capp",
"path": "/capp/data/models/category.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: keeners/capp path: /capp/data/models/category.py
"""Category model."""
from django.db import models
from django.utils.translation import gettext_lazy as _
<|fim_suffix|> def __str__(self) -> str:
"""Return name as string."""
return self.name<|fim_middle|>class Category(model... | code_fim | medium | {
"lang": "python",
"repo": "keeners/capp",
"path": "/capp/data/models/category.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Test constructing role acl for valid role."""
zk = zksasl.SASLZkClient()
zk.make_role_acl('servers', 'ra')
make_acl_mock.assert_called_once_with(
scheme='sasl', credential='file:///treadmill/roles/servers',
read=True, write=False, delete=False, c... | code_fim | hard | {
"lang": "python",
"repo": "bretttegartms/treadmill-aws",
"path": "/tests/zookeeper_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bretttegartms/treadmill-aws path: /tests/zookeeper_test.py
"""Unit test for zookeeper plugin.
"""
import unittest
import mock
import pkg_resources
from treadmill_aws.plugins import zookeeper as zksasl
@unittest.skipUnless('sasl' in pkg_resources.get_distribution('kazoo').extras,
... | code_fim | hard | {
"lang": "python",
"repo": "bretttegartms/treadmill-aws",
"path": "/tests/zookeeper_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Bolaxax/valhalla path: /run_route_scripts/generate_tests/create_test_request_routes.py
#!/usr/bin/env python
import sys
import math
import random
import json
import re
### This script can take either a *_locations.txt file generated with randomness
### (created from create_random_points_within_... | code_fim | medium | {
"lang": "python",
"repo": "Bolaxax/valhalla",
"path": "/run_route_scripts/generate_tests/create_test_request_routes.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for c in range(0, len(lls)):
for i in range(1, len(lls)):
from_ll = re.split(',',str(lls[c]))
to_ll = re.split(',',str(lls[i]))
if sys.argv[3:] and sys.argv[4:]:
print '-j \'' + json.dumps({'costing': sys.argv[2], 'locations': [{'lat': from_ll[0], 'lon': from_ll[1]}, {'lat'... | code_fim | medium | {
"lang": "python",
"repo": "Bolaxax/valhalla",
"path": "/run_route_scripts/generate_tests/create_test_request_routes.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return yrange
def roundup(x):
return np.ceil(x /100) * 100
def rounddown(x):
return np.floor(x /100) * 100
def predict_tt(evdp, dist, phase='ScS'):
model = TauPyModel()
# uses IASP91 by default
arrivals = model.get_travel_times(source_depth_in_km=evdp,
... | code_fim | hard | {
"lang": "python",
"repo": "Jasplet/SWSTomo",
"path": "/plot_inversion_data.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Jasplet/SWSTomo path: /plot_inversion_data.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 28 16:27:43 2021
Contains functions to make plots of ScS, SKS and SKKS waveforms prior to inversion
and after corrections for the predicted splitting have been made.
i.e if obs(x,... | code_fim | hard | {
"lang": "python",
"repo": "Jasplet/SWSTomo",
"path": "/plot_inversion_data.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> plt.rc('font', size=SMALL_SIZE) # controls default text sizes
plt.rc('axes', titlesize=SMALL_SIZE) # fontsize of the axes title
plt.rc('axes', labelsize=MEDIUM_SIZE) # fontsize of the x and y labels
plt.rc('xtick', labelsize=SMALL_SIZE) # fontsize of the tick labels
... | code_fim | hard | {
"lang": "python",
"repo": "Jasplet/SWSTomo",
"path": "/plot_inversion_data.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Christovis/astrild path: /src/astrild/power_spectra/powmes.py
# Functions to handle power spectra
import os, sys, glob
from typing import Dict, List, Optional, Tuple, Type, Union
import pandas as pd
import numpy as np
from scipy import integrate
import astropy
import astropy.units as u
from ast... | code_fim | hard | {
"lang": "python",
"repo": "Christovis/astrild",
"path": "/src/astrild/power_spectra/powmes.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> else:
raise "Error"
print("Power-spectrum of %s" % label)
# power-spectrum of density-fluctuations
mesh = ArrayMesh(
value_map,
Nmesh=grid_size,
compensated=Fals... | code_fim | hard | {
"lang": "python",
"repo": "Christovis/astrild",
"path": "/src/astrild/power_spectra/powmes.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Pk settings
boxsize = 200 # [Mpc/h]
grid_size = 256 # default number of mesh cells per coordinate axis
# Delta_k = 1.0e-2 # size of k bins (where k is the wave vector in Fourier Space)
k_min = 2 * np.pi / boxsize # smallest k value
... | code_fim | hard | {
"lang": "python",
"repo": "Christovis/astrild",
"path": "/src/astrild/power_spectra/powmes.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Raniac/NEURO-LEARN path: /env/lib/python3.6/site-packages/dipy/viz/tests/test_regtools.py
import numpy as np
from dipy.viz import regtools
import numpy.testing as npt
from dipy.align.metrics import SSDMetric
from dipy.align.imwarp import SymmetricDiffeomorphicRegistration
<|fim_suffix|>@npt.dec.... | code_fim | hard | {
"lang": "python",
"repo": "Raniac/NEURO-LEARN",
"path": "/env/lib/python3.6/site-packages/dipy/viz/tests/test_regtools.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>@npt.dec.skipif(not have_matplotlib)
def test_plot_2d_diffeomorphic_map():
# Test the regtools plotting interface (lightly).
mv_shape = (11, 12)
moving = np.random.rand(*mv_shape)
st_shape = (13, 14)
static = np.random.rand(*st_shape)
dim = static.ndim
metric = SSDMetric(dim)
... | code_fim | hard | {
"lang": "python",
"repo": "Raniac/NEURO-LEARN",
"path": "/env/lib/python3.6/site-packages/dipy/viz/tests/test_regtools.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Test the regtools plotting interface (lightly).
mv_shape = (11, 12)
moving = np.random.rand(*mv_shape)
st_shape = (13, 14)
static = np.random.rand(*st_shape)
dim = static.ndim
metric = SSDMetric(dim)
level_iters = [200, 100, 50, 25]
sdr = SymmetricDiffeomorphicRegistr... | code_fim | hard | {
"lang": "python",
"repo": "Raniac/NEURO-LEARN",
"path": "/env/lib/python3.6/site-packages/dipy/viz/tests/test_regtools.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Args:
v: np.ndarray, float32
The index faced vertices of shape (nv, 3, 3)
select: string
Use either 'inside' or 'outside'.
progress: pyqt progress bar
The progress bar.
"""
# Compute on non-masked... | code_fim | hard | {
"lang": "python",
"repo": "MunsuDC/visbrain",
"path": "/visbrain/brain/base/SourcesBase.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def update(self):
"""Update sources without rendering.
The only difference with the plot() method is that the update method
doesn't recreate the cloud of point, it only re-set the data for
non-masked sources. This is faster than re-create the source object.
"""... | code_fim | hard | {
"lang": "python",
"repo": "MunsuDC/visbrain",
"path": "/visbrain/brain/base/SourcesBase.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MunsuDC/visbrain path: /visbrain/brain/base/SourcesBase.py
ling
self.radiusmin = s_radiusmin
self.radiusmax = s_radiusmax
self.symbol = s_symbol
self.stext = s_text
self.stextcolor = color2vb(s_textcolor)
self.stextsize = s_textsize
self.ste... | code_fim | hard | {
"lang": "python",
"repo": "MunsuDC/visbrain",
"path": "/visbrain/brain/base/SourcesBase.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: WSCKY/RDA5981_Develop path: /tools/test/config_test/test17/test_data.py
# Build on top of test16
# Adds an invalid macro redefinition in the app
expected_results = {
"K64F": {
"desc": "test invalid macro re<|fim_suffix|>in both 'library:lib2' and 'application' with incompatible value... | code_fim | medium | {
"lang": "python",
"repo": "WSCKY/RDA5981_Develop",
"path": "/tools/test/config_test/test17/test_data.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>in both 'library:lib2' and 'application' with incompatible values"
}
}<|fim_prefix|># repo: WSCKY/RDA5981_Develop path: /tools/test/config_test/test17/test_data.py
# Build on top of test16
# Adds an invalid macro redefinition in the app
expected_results = {
"K64F": {
"desc": "test invali... | code_fim | medium | {
"lang": "python",
"repo": "WSCKY/RDA5981_Develop",
"path": "/tools/test/config_test/test17/test_data.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> df = pd.read_csv(f'{context.run_dir.absolute()}/trimmed_cpu_mem_measurements.csv', sep=',', header=None)
df.columns = ['timestamp', 'cpu', 'mem']
variation['avg_mem'] = df['mem'].mean()
# Ignore zero mearuements from psutil inaccuracy.
df = df[df.cpu != 0]
v... | code_fim | hard | {
"lang": "python",
"repo": "engelhamer/thesis-replication-package",
"path": "/robot_runner/experiments/slam_experiment/config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with open(f'{context.run_dir.absolute()}/cpu_mem_measurements.csv', 'r') as infile, \
open(f'{context.run_dir.absolute()}/trimmed_cpu_mem_measurements.csv', 'w+') as outfile:
reader = csv.DictReader(infile, fieldnames=['timestamp', 'cpu_usage', 'mem_usage'])
... | code_fim | hard | {
"lang": "python",
"repo": "engelhamer/thesis-replication-package",
"path": "/robot_runner/experiments/slam_experiment/config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: engelhamer/thesis-replication-package path: /robot_runner/experiments/slam_experiment/config.py
from EventManager.Models.RobotRunnerEvents import RobotRunnerEvents
from EventManager.EventSubscriptionController import EventSubscriptionController
from ConfigValidator.Config.Models.RunTableModel im... | code_fim | hard | {
"lang": "python",
"repo": "engelhamer/thesis-replication-package",
"path": "/robot_runner/experiments/slam_experiment/config.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertEqual(gfapy.Trace([12,14,15]),
gfapy.Alignment([12,14,15]))
def test_list_invalid(self):
self.assertRaises(gfapy.FormatError,
gfapy.Alignment,["12x1", "2I"])<|fim_prefix|># repo: ggonnella/gfapy path: /tests/test_gfapy_alignment.py
import u... | code_fim | hard | {
"lang": "python",
"repo": "ggonnella/gfapy",
"path": "/tests/test_gfapy_alignment.py",
"mode": "spm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ggonnella/gfapy path: /tests/test_gfapy_alignment.py
import unittest
import gfapy
class TestAlignment(unittest.TestCase):
def test_string_to_cigar(self):
self.assertEqual(gfapy.CIGAR([
gfapy.CIGAR.Operation(12, "M"),
gfapy.CIGAR.Operation(1, "D"),
gfapy.CIGAR.Operation(... | code_fim | medium | {
"lang": "python",
"repo": "ggonnella/gfapy",
"path": "/tests/test_gfapy_alignment.py",
"mode": "psm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_suffix|> if axis[1] is 'angleT':
yyaxis = r'Ángulo de incidencia en tope $\theta$ [$\circ$]'
elif axis[1] is 'angleB':
yyaxis = r'Ángulo de incidencia en base $\theta$ [$\circ$]'
elif axis[1] is 'dhT':
yyaxis = 'Espesor de capa [m]'
elif axis[1] is 'dhB':
yyaxis = 'E... | code_fim | hard | {
"lang": "python",
"repo": "vidalgp/USB-AFVA",
"path": "/main/AFVAplots.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> gs = gridspec.GridSpec(1,1)
fig = plt.figure(figsize=(8,6))
ax0 = plt.subplot( gs[0,0] )
im = ax0.imshow(PAM.T, origin='lower', extent=(xmin, xmax, ymin, ymax))
ax0.plot(pointsx, pointsy, 'k.', ms=0.5)
cbar = plt.colorbar(im)
cbar.set_label(marker)
ax0.set_ylabel(yyaxis)
... | code_fim | hard | {
"lang": "python",
"repo": "vidalgp/USB-AFVA",
"path": "/main/AFVAplots.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vidalgp/USB-AFVA path: /main/AFVAplots.py
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import gridspec
from scipy.interpolate import CubicSpline, interp1d
from utils import*
import seaborn as sns
def plot_AFVO(gather, angles, tmin1, tmax1, tmin2, tmax2, dt, sps=0, name=''):... | code_fim | hard | {
"lang": "python",
"repo": "vidalgp/USB-AFVA",
"path": "/main/AFVAplots.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not (0 <= index < len(self)):
raise IndexError("index en dehors de la plage admissible.")
i = 0
courante = self.tete
while i < index:
i += 1
courante = courante.suivante
return courante.valeur
def __setitem__(self, index, ... | code_fim | hard | {
"lang": "python",
"repo": "efloti/plc_nsi_algo",
"path": "/algo/struct/liste_simple.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: efloti/plc_nsi_algo path: /algo/struct/liste_simple.py
class Cellule:
"""Fondation du type Liste"""
def __init__(self, valeur, suivante=None):
self.valeur = valeur
self._suivante = suivante # éviter de jouer avec ce pointeur...
@property
def suivante(self):
... | code_fim | hard | {
"lang": "python",
"repo": "efloti/plc_nsi_algo",
"path": "/algo/struct/liste_simple.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Ashokkommi0001/patterns path: /Symbols/left_num_tri_1.py
a=8
def for_left_num_tri_1():
for i in range(1, a):
for j in range(1, i+1):
print(j, end=" ")
print()
<|fim_suffix|> row=1
while row<=8:
col=1
while col<=row:
pr... | code_fim | easy | {
"lang": "python",
"repo": "Ashokkommi0001/patterns",
"path": "/Symbols/left_num_tri_1.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> row=1
while row<=8:
col=1
while col<=row:
print(col, end=" ")
col+=1
row+=1
print()
left_num_tri_1()<|fim_prefix|># repo: Ashokkommi0001/patterns path: /Symbols/left_num_tri_1.py
a=8
def for_left_num_tri_1():
for i in range(1, ... | code_fim | easy | {
"lang": "python",
"repo": "Ashokkommi0001/patterns",
"path": "/Symbols/left_num_tri_1.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gitbenji/uru-crm path: /tests/factories.py
# -*- coding: utf-8 -*-
"""
tests.factories
~~~~~~~~~~~~~~~
object factory for testing application data models
"""
<|fim_suffix|> class Meta:
abstract = True
sqlalchemy_session = db.session
class UserFactory(BaseFactory... | code_fim | medium | {
"lang": "python",
"repo": "gitbenji/uru-crm",
"path": "/tests/factories.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> name = Sequence(lambda n: "user{0}".format(n))
email = Sequence(lambda n: "user{0}@example.com".format(n))
fullname = Sequence(lambda n: "user{0}".format(n))
class Meta:
model = User<|fim_prefix|># repo: gitbenji/uru-crm path: /tests/factories.py
# -*- coding: utf-8 -*-
"""
t... | code_fim | medium | {
"lang": "python",
"repo": "gitbenji/uru-crm",
"path": "/tests/factories.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class BaseFactory(SQLAlchemyModelFactory):
class Meta:
abstract = True
sqlalchemy_session = db.session
class UserFactory(BaseFactory):
name = Sequence(lambda n: "user{0}".format(n))
email = Sequence(lambda n: "user{0}@example.com".format(n))
fullname = Sequence(lambda n... | code_fim | medium | {
"lang": "python",
"repo": "gitbenji/uru-crm",
"path": "/tests/factories.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pkess/easydms path: /test/test_core.py
# -*- coding: utf-8 -*-
#
# This file is part of easydms.
# Copyright (c) 2015 Peter Kessen
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in ... | code_fim | hard | {
"lang": "python",
"repo": "pkess/easydms",
"path": "/test/test_core.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.