text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|>
def test03_driver_api(self):
from bob.db.base.script.dbmanage import main
self.assertEqual(main('biosecurid.face dumplist --self-test'.split()), 0)
self.assertEqual(main('biosecurid.face dumplist --protocol=A --class=client --group=dev --purpose=enrol --client=1151 --self-test'.split()),... | code_fim | hard | {
"lang": "python",
"repo": "bioidiap/bob.db.biosecurid.face",
"path": "/bob/db/biosecurid/face/test.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>urlpatterns = [path("", views.UnitsList.as_view(), name="units")]<|fim_prefix|># repo: uktrade/lite-api path: /api/staticdata/units/urls.py
from django.urls import path
<|fim_middle|>from api.staticdata.units import views
app_name = "units"
| code_fim | medium | {
"lang": "python",
"repo": "uktrade/lite-api",
"path": "/api/staticdata/units/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: uktrade/lite-api path: /api/staticdata/units/urls.py
from django.urls import path
<|fim_suffix|>app_name = "units"
urlpatterns = [path("", views.UnitsList.as_view(), name="units")]<|fim_middle|>from api.staticdata.units import views
| code_fim | easy | {
"lang": "python",
"repo": "uktrade/lite-api",
"path": "/api/staticdata/units/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.filename = value
def get_data(self):
with open(self.filename, 'rb') as output:
return json.load(output)<|fim_prefix|># repo: AI-Pree/WebScraper path: /parsedata.py
#! python
# Data parser for json file
import json
class ParseJson():
def __init__(self, filen... | code_fim | medium | {
"lang": "python",
"repo": "AI-Pree/WebScraper",
"path": "/parsedata.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.filename
@dataFile.setter
def dataFile(self, value):
self.filename = value
def get_data(self):
with open(self.filename, 'rb') as output:
return json.load(output)<|fim_prefix|># repo: AI-Pree/WebScraper path: /parsedata.py
#! python
# Data ... | code_fim | medium | {
"lang": "python",
"repo": "AI-Pree/WebScraper",
"path": "/parsedata.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AI-Pree/WebScraper path: /parsedata.py
#! python
# Data parser for json file
import json
class ParseJson():
def __init__(self, filename):
self.filename = filename
@property
def dataFile(self):
return self.filename
<|fim_suffix|> with open(self.filename, 'rb'... | code_fim | medium | {
"lang": "python",
"repo": "AI-Pree/WebScraper",
"path": "/parsedata.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# test data
def function(a: int, b: int) -> int:
return a + b
test_header = "type_, value"
test_data = [
(int, 1234567890),
(float, 1.234567890),
(complex, 1.2345 + 6.7890j),
(str, "lorem ipsum"),
(bytes, b"lorem ipsum"),
(tuple, (123, 4.56, 7.8e90)),
(range, range(12345... | code_fim | medium | {
"lang": "python",
"repo": "astropenguin/morecopy",
"path": "/tests/test_copy.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: astropenguin/morecopy path: /tests/test_copy.py
# standard library
from copy import copy as stdlib_copy
from types import FunctionType, LambdaType
from typing import Type, TypeVar
# dependencies
from morecopy.copy import copy
from pytest import mark
# type hints
T = TypeVar("T")
# test data... | code_fim | hard | {
"lang": "python",
"repo": "astropenguin/morecopy",
"path": "/tests/test_copy.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if type_ is FunctionType:
return
assert value == copy(value)
assert value == stdlib_copy(value)
@mark.parametrize(test_header, test_data)
def test_copy_is(type_: Type[T], value: T) -> None:
assert value is not copy(value)
assert value is stdlib_copy(value)<|fim_prefix|># rep... | code_fim | hard | {
"lang": "python",
"repo": "astropenguin/morecopy",
"path": "/tests/test_copy.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>process.inputs = cms.PSet (
fileNames = cms.vstring(
'reco_7TeV_380_pat.root'
),
lumisToProcess = cms.untracked.VLuminosityBlockRange( myList )
)
process.outputs = cms.PSet (
outputName = cms.string('jetPlots.root')
)<|fim_prefix|># repo: cms-sw/cmssw path: /PhysicsTools/Pat... | code_fim | hard | {
"lang": "python",
"repo": "cms-sw/cmssw",
"path": "/PhysicsTools/PatExamples/bin/PatBasicFWLiteJetAnalyzer_Selector_cfg.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cms-sw/cmssw path: /PhysicsTools/PatExamples/bin/PatBasicFWLiteJetAnalyzer_Selector_cfg.py
import FWCore.ParameterSet.Config as cms
process = cms.Process("FWLitePlots")
#input stuff for Run/Lumi selection with the "JSON"-formatted files from the PVT group
import FWCore.PythonUtilities.LumiList ... | code_fim | medium | {
"lang": "python",
"repo": "cms-sw/cmssw",
"path": "/PhysicsTools/PatExamples/bin/PatBasicFWLiteJetAnalyzer_Selector_cfg.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># Set up the parameters for the PF jet analyzer
process.pfJetStudies = process.jetStudies.clone( useCalo = cms.bool(False) )
process.load('PhysicsTools.SelectorUtils.pfJetIDSelector_cfi')
process.load('PhysicsTools.SelectorUtils.jetIDSelector_cfi')
process.plotParameters = cms.PSet (
doTracks = cms... | code_fim | hard | {
"lang": "python",
"repo": "cms-sw/cmssw",
"path": "/PhysicsTools/PatExamples/bin/PatBasicFWLiteJetAnalyzer_Selector_cfg.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if Translator._isInteger(iface.switch_port):
ifaceModel.port = iface.switch_port
ifaceModel.save()
if not sModel.ifaces.filter(ifaceName = iface.name):
sModel.ifaces.add(ifaceModel)
sModel.setVMs()
... | code_fim | hard | {
"lang": "python",
"repo": "dana-i2cat/felix",
"path": "/expedient/src/python/plugins/vt_plugin/utils/Translator.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dana-i2cat/felix path: /expedient/src/python/plugins/vt_plugin/utils/Translator.py
from vt_plugin.models import *
from vt_plugin.models.Action import Action
import copy, uuid
from datetime import datetime
from expedient.clearinghouse.aggregate.models import Aggregate
from vt_plugin.models import ... | code_fim | hard | {
"lang": "python",
"repo": "dana-i2cat/felix",
"path": "/expedient/src/python/plugins/vt_plugin/utils/Translator.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> @staticmethod
def PopulateNewVMifaces(VMclass, VMmodel):
for iface in VMclass.xen_configuration.interfaces.interface:
if VMmodel.ifaces.filter(name = iface.name):
ifaceModel = VMmodel.ifaces.get(name = iface.name)
else:
ifaceModel = i... | code_fim | hard | {
"lang": "python",
"repo": "dana-i2cat/felix",
"path": "/expedient/src/python/plugins/vt_plugin/utils/Translator.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|># Needed on Windows, else output newlines will be corrupted
try:
import msvcrt
except ImportError:
pass
else:
msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
def encode_latin_1_unicode(x, r):
bencode.encode_bytes(x.encode("latin-1"), r)
# This is the most convenient place to add support for our lat... | code_fim | medium | {
"lang": "python",
"repo": "ludios/quickmunge",
"path": "/bin/json-to-bencode",
"mode": "spm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ludios/quickmunge path: /bin/json-to-bencode
#!/usr/bin/python3 -B
"""
Converts the first JSON item in stdin to bencode
"""
import os
import sys
from quickmunge import bencode
import collections
import json
# Needed on Windows, else output newlines will be corrupted
try:
import msvcrt
except ... | code_fim | medium | {
"lang": "python",
"repo": "ludios/quickmunge",
"path": "/bin/json-to-bencode",
"mode": "psm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_suffix|>if sys.argv[1:]:
f = open(sys.argv[1], "rb")
else:
f = sys.stdin.buffer
sys.stdout.buffer.write(
bencode.bencode(
json.loads(
f.read(),
object_pairs_hook=collections.OrderedDict)))<|fim_prefix|># repo: ludios/quickmunge path: /bin/json-to-bencode
#!/usr/bin/python3 -B
"""
Converts the first ... | code_fim | hard | {
"lang": "python",
"repo": "ludios/quickmunge",
"path": "/bin/json-to-bencode",
"mode": "spm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_suffix|>class RegionFilter:
def __init__(self, regions):
self.regions = regions
def matches(self, opportunity):
if opportunity['related_region'] \
and opportunity['related_region']['title'] \
and opportunity['related_region']['title'] in self.regions:
... | code_fim | hard | {
"lang": "python",
"repo": "ozorowski/great-international-ui",
"path": "/core/helpers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ozorowski/great-international-ui path: /core/helpers.py
from collections import namedtuple
from urllib.parse import urlencode
from django.urls import reverse
from django.utils import translation
import requests
from core import constants
def create_response(status_code=200, json_payload=None):... | code_fim | hard | {
"lang": "python",
"repo": "ozorowski/great-international-ui",
"path": "/core/helpers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class SortFilter:
sort_by_with_values = [
Sort_by(title='Project name: A to Z', value='title', reverse=False),
Sort_by(title='Project name: Z to A', value='title', reverse=True),
Sort_by(
title='Scale: Low to High', value='scale_value', reverse=False
),
... | code_fim | hard | {
"lang": "python",
"repo": "ozorowski/great-international-ui",
"path": "/core/helpers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: raznem/sac_ppo path: /rltoolkit/buffer.py
import numpy as np
import torch
from typing import Iterable
class Memory:
def __init__(self):
self._obs = []
self._next_obs_idx = []
self._actions = []
self._action_logprobs = []
self._rewards = []
sel... | code_fim | hard | {
"lang": "python",
"repo": "raznem/sac_ppo",
"path": "/rltoolkit/buffer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self._obs_idx[self.ts_idx] = obs_idx
self._next_obs_idx[self.ts_idx] = next_obs_idx
self._actions[self.ts_idx] = action
self._rewards[self.ts_idx] = rew
self._done[self.ts_idx] = done
self.ts_idx += 1
self.current_len = max(self.ts_idx, self.current_... | code_fim | hard | {
"lang": "python",
"repo": "raznem/sac_ppo",
"path": "/rltoolkit/buffer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bhagyakjain/debaised-analysis path: /intents/test_show.py
"""
Copyright 2020 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENS... | code_fim | hard | {
"lang": "python",
"repo": "bhagyakjain/debaised-analysis",
"path": "/intents/test_show.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_9():
"""An example from "salary in various regions" to test mean vs median suggestion
question :show mean of salary in each resident city
"""
table = pandas.read_csv('data/salary_in_various_regions.csv')
query_result = show.show(table,
metric='S... | code_fim | hard | {
"lang": "python",
"repo": "bhagyakjain/debaised-analysis",
"path": "/intents/test_show.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_4():
"""An example from the IPL dataset
question :show all matches where Royal Challengers Bangalore won the match in season 2008
"""
table = pandas.read_csv('data/matches.csv')
query_result = show.show(table,
slices=[('season', Filters.EQUAL_TO... | code_fim | hard | {
"lang": "python",
"repo": "bhagyakjain/debaised-analysis",
"path": "/intents/test_show.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fbenites/TRANSLIT path: /code/prepare_geonames.py
import shelve
import pandas as pd
geonames = pd.read_csv("../data/geonames/alternateNamesV2.txt", sep='\t', error_bad_lines=False)
<|fim_suffix|>names_clean={}
languages=set()
for key in skeys:
for data in names[key]:
if type(data... | code_fim | hard | {
"lang": "python",
"repo": "fbenites/TRANSLIT",
"path": "/code/prepare_geonames.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>names_clean={}
languages=set()
for key in skeys:
for data in names[key]:
if type(data[0]) is not float:
if len(data[0])==2:
languages.add(data[0])
if key not in names_clean:
names_clean[key]=[data]
else:
... | code_fim | hard | {
"lang": "python",
"repo": "fbenites/TRANSLIT",
"path": "/code/prepare_geonames.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fatestigma/gaia-visualization path: /model.py
bel_location = """
SELECT DISTINCT ?label ?start ?end ?justificationType WHERE {
?justification a aida:TextJustification ;
skos:prefLabel ?label ;
aida:source ?source ;
a... | code_fim | hard | {
"lang": "python",
"repo": "fatestigma/gaia-visualization",
"path": "/model.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
def type_text(self):
_, text = split_uri(self.type)
return text
@property
def target(self):
if self.__target is None:
self._init_member()
return self.__target
@property
def qid(self):
if self.__qid is None and self.tar... | code_fim | hard | {
"lang": "python",
"repo": "fatestigma/gaia-visualization",
"path": "/model.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fatestigma/gaia-visualization path: /model.py
= 0
for label, start, end, j in sparql.query(query_label_location, namespaces, {'source': Literal(doc_id)}):
doc_recover += ' ' * (int(start)-lend)
if json.loads(j).get('justificationType') == 'pronominal_mention':
doc... | code_fim | hard | {
"lang": "python",
"repo": "fatestigma/gaia-visualization",
"path": "/model.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def HitTest(self, pos):
# Handle socket hittest
for socket in self._sockets:
if socket.HitTest(pos - self.pos):
return socket
def EditParameter(self, idname, value):
pass
def InitHeaderColor(self):
self._headercolor = NODE_CATEGORY_... | code_fim | hard | {
"lang": "python",
"repo": "Correct-Syntax/gsnodegraph",
"path": "/gsnodegraph/node/node.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Correct-Syntax/gsnodegraph path: /gsnodegraph/node/node.py
# ----------------------------------------------------------------------------
# GS Nodegraph Copyright 2019-2021 by Noah Rahm and contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this fil... | code_fim | hard | {
"lang": "python",
"repo": "Correct-Syntax/gsnodegraph",
"path": "/gsnodegraph/node/node.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_name(self):
return self.player_name['name_input']
def __str__(self):
return f'{self.player_score}'<|fim_prefix|># repo: alan-dx/snake-game path: /app/player_pk/player_class.py
class Player():
def __init__(self, name):
self.player_score = 0
self.player_... | code_fim | medium | {
"lang": "python",
"repo": "alan-dx/snake-game",
"path": "/app/player_pk/player_class.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __str__(self):
return f'{self.player_score}'<|fim_prefix|># repo: alan-dx/snake-game path: /app/player_pk/player_class.py
class Player():
def __init__(self, name):
<|fim_middle|> self.player_score = 0
self.player_name = name
def increase_score(self):
self.p... | code_fim | medium | {
"lang": "python",
"repo": "alan-dx/snake-game",
"path": "/app/player_pk/player_class.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alan-dx/snake-game path: /app/player_pk/player_class.py
class Player():
def __init__(self, name):
self.player_score = 0
self.player_name = name
<|fim_suffix|> def __str__(self):
return f'{self.player_score}'<|fim_middle|> def increase_score(self):
self.p... | code_fim | medium | {
"lang": "python",
"repo": "alan-dx/snake-game",
"path": "/app/player_pk/player_class.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert len(correlate(self.rand1, self.channels, 1)) == 1
# If the arrays are the same, an error should be raised
with pytest.raises(ValueError):
correlate(self.im, self.channels, 1)
def test_fit_clusters(self):
# If 1 cluster is passed, the outpu... | code_fim | hard | {
"lang": "python",
"repo": "Software-Engineering-BBSRC-Group-6/auto-coloc-gui",
"path": "/coloc/tests/test-vis.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_compare_dists(self):
clust1 = [(1,1),(10,10),(20,20),(40,40)]
clust2 = [(1,1),(10,10),(20,20)]
with pytest.raises(ValueError):
compare_dists(clust1, clust2, 5)
def test_run_visualiser(self):
# If source file does not exist, raise er... | code_fim | hard | {
"lang": "python",
"repo": "Software-Engineering-BBSRC-Group-6/auto-coloc-gui",
"path": "/coloc/tests/test-vis.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Software-Engineering-BBSRC-Group-6/auto-coloc-gui path: /coloc/tests/test-vis.py
import pytest
import numpy as np
import matplotlib.pyplot as plt
try:
from ..backend.Visualiser import correlate, fit_clusters, run_visualiser, annotate, scaled_dist, compare_dists
except ModuleNotFoundError:
... | code_fim | hard | {
"lang": "python",
"repo": "Software-Engineering-BBSRC-Group-6/auto-coloc-gui",
"path": "/coloc/tests/test-vis.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: T4rk1n/dazzler path: /tests/apps/pages/storage.py
"""
Page storage of dazzler
Created 2019-07-17
"""
import json
from dazzler.components import core
from dazzler.system import Page, Trigger, BindingContext
page = Page(
__name__,
core.Container([
core.Button('Set local', identity... | code_fim | hard | {
"lang": "python",
"repo": "T4rk1n/dazzler",
"path": "/tests/apps/pages/storage.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@page.bind(Trigger('session-btn', 'clicks'))
async def on_clicks_session(ctx: BindingContext):
data = await ctx.get_session_storage('data')
if not data:
data = {'clicks': 0}
data['clicks'] += 1
await ctx.set_session_storage('data', data)
await ctx.set_aspect('session-output', ... | code_fim | hard | {
"lang": "python",
"repo": "T4rk1n/dazzler",
"path": "/tests/apps/pages/storage.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> temps_l = temps[stationName]
temps_l.sort(key=lambda tup: tup[0])
date_temp = [i[0] for i in temps_l]
date_dji = [i[0] for i in dji]
date_unif = [filter(lambda x: x in date_dji, [sublist]) for sublist in date_temp]
date_unif = [i[0] for i in date_unif if len(i)>0]
if len(date_... | code_fim | hard | {
"lang": "python",
"repo": "ppaulojr/CrazyCorrelation",
"path": "/weather/correlation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> plt.show()
def main (param = "print"):
djil = readDownJones("DJCA_2014.csv")
djil.sort(key=lambda tup: tup[0])
temps = readTemps("2014_TMAX_US.csv")
if (param == "print"):
print "Station, Correlation, #Samples"
for i in temps.keys():
if len(temps[i])>1... | code_fim | hard | {
"lang": "python",
"repo": "ppaulojr/CrazyCorrelation",
"path": "/weather/correlation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ppaulojr/CrazyCorrelation path: /weather/correlation.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import math
from datetime import datetime
import matplotlib.pyplot as plt
import matplotlib.lines as mlines
def string2Date(s):
return datetime.strptime("-".join([s[:4],s[4:6],s[6:]]),"%Y-%m... | code_fim | hard | {
"lang": "python",
"repo": "ppaulojr/CrazyCorrelation",
"path": "/weather/correlation.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TavOexe/algorithmic_complexity path: /mazebuilder.py
import random
import numpy as np
import algorithmic_complexity.disjointset as ds
def makeMaze(rows, cols: int):
maze = np.zeros((rows*2 + 1, cols*2+1))
maze[1::2, 1::2] = 1
maze[ 1][ 0] = 3
maze[-2][-1] = 3
<|fim_suffix|> ... | code_fim | hard | {
"lang": "python",
"repo": "TavOexe/algorithmic_complexity",
"path": "/mazebuilder.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> s = ds.DisjointSet(len(walls))
random.shuffle(walls)
while len(walls) > 0:
e1, e2 = walls.pop()
r1, c1 = e1 // cols, e1 % cols
r2, c2 = e2 // cols, e2 % cols
if not s.sameset(e1, e2):
if r1 == r2 and c1 < c2:
maze[r1*2+1][c1*2+2] = 1
... | code_fim | hard | {
"lang": "python",
"repo": "TavOexe/algorithmic_complexity",
"path": "/mazebuilder.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Monika-After-Story/MonikaModDev path: /tools/spritemaker.py
same as other
:param other: the StaticSprite to compare to
:returns: False if not None and does not match, True otherwise
"""
if self.sweatdrop is None:
return True
return self.sweatd... | code_fim | hard | {
"lang": "python",
"repo": "Monika-After-Story/MonikaModDev",
"path": "/tools/spritemaker.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def run_lstc_show(sprite_db, sprite_db_keys, ss_filter):
"""
Show sprites, based on filter
"""
# filter valid sprites
filtered = filter(
ss_filter.filter,
SortedKeySpriteDBIter(sprite_db, sprite_db_keys)
)
# show codes
menutils.paginate(
"Sprite Co... | code_fim | hard | {
"lang": "python",
"repo": "Monika-After-Story/MonikaModDev",
"path": "/tools/spritemaker.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Monika-After-Story/MonikaModDev path: /tools/spritemaker.py
up
"""
self.mouth = self._get_smap(self.MTH, code, None)
def __fmt_flt(self, msg_arr, string, value):
"""
adds appropraitely formatted filter string to msg arr
"""
if value is None:
... | code_fim | hard | {
"lang": "python",
"repo": "Monika-After-Story/MonikaModDev",
"path": "/tools/spritemaker.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|> """DO NOT MODIFY THIS FUNCTION.
Turns a concatenated string of integers separated by commas into
an array of integers. (Inverse of array_to_concatenated_string).
"""
return np.array([int(x) for x in string.split(",")])
def parse_input(giant_string):
"""DO NOT MODIFY THI... | code_fim | hard | {
"lang": "python",
"repo": "lockwo/quantum_computation",
"path": "/Pennylane/circuit_training_500_template.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lockwo/quantum_computation path: /Pennylane/circuit_training_500_template.py
#! /usr/bin/python3
import sys
import pennylane as qml
import numpy as np
def classify_data(X_train, Y_train, X_test):
"""Develop and train your very own variational quantum classifier.
Use the prov... | code_fim | hard | {
"lang": "python",
"repo": "lockwo/quantum_computation",
"path": "/Pennylane/circuit_training_500_template.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for W in weights:
layer(W)
return qml.expval(qml.PauliZ(0))
def variational_classifier(var, x):
weights = var[0]
bias = var[1]
return circuit(weights, x) + bias
def square_loss(labels, predictions):
loss = 0
... | code_fim | hard | {
"lang": "python",
"repo": "lockwo/quantum_computation",
"path": "/Pennylane/circuit_training_500_template.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: huihonkit/csci4140prj path: /app.py
#! /usr/bin/env python
import BaseHTTPServer
import CGIHTTPServer
import webbrowser
import sqlite3
<|fim_suffix|>httpd = server_class(server_address, handler_class)
url = 'http://localhost:{0}/{1}'.format(PORT, script_path)
httpd.serve_forever()<|fim_middle... | code_fim | medium | {
"lang": "python",
"repo": "huihonkit/csci4140prj",
"path": "/app.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>url = 'http://localhost:{0}/{1}'.format(PORT, script_path)
httpd.serve_forever()<|fim_prefix|># repo: huihonkit/csci4140prj path: /app.py
#! /usr/bin/env python
import BaseHTTPServer
import CGIHTTPServer
import webbrowser
import sqlite3
PORT = 8080
script_path = "cgi-bin/index.py"
server_class = Bas... | code_fim | easy | {
"lang": "python",
"repo": "huihonkit/csci4140prj",
"path": "/app.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>server_class = BaseHTTPServer.HTTPServer
handler_class = CGIHTTPServer.CGIHTTPRequestHandler
server_address = ("", PORT)
httpd = server_class(server_address, handler_class)
url = 'http://localhost:{0}/{1}'.format(PORT, script_path)
httpd.serve_forever()<|fim_prefix|># repo: huihonkit/csci4140prj path:... | code_fim | easy | {
"lang": "python",
"repo": "huihonkit/csci4140prj",
"path": "/app.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|><<<<<<< HEAD
class Vec2:
def __init__(self, x, y):
self.x = x
self.y = y
v1 = Vec2(12, 45) # constructor is called
=======
class Vec2:
def __init__(self, x, y):
self.x = x
self.y = y
v1 = Vec2(12, 45) # constructor is called
>>>>>>> 23fb4d348bb9c7b7b3... | code_fim | medium | {
"lang": "python",
"repo": "bgoonz/UsefulResourceRepo2.0",
"path": "/GIT-USERS/TOM-Lambda/CSEUFLEX_Intro_Python_GP/day3.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bgoonz/UsefulResourceRepo2.0 path: /GIT-USERS/TOM-Lambda/CSEUFLEX_Intro_Python_GP/day3.py
# lets talk about classes
# holds data
# methods to act upon that data
# class called Vec2
# hold x and y as integers
# constructor that can take in x and y
# class Vec2 {
<<<<<<< HEAD
# constructor(x... | code_fim | medium | {
"lang": "python",
"repo": "bgoonz/UsefulResourceRepo2.0",
"path": "/GIT-USERS/TOM-Lambda/CSEUFLEX_Intro_Python_GP/day3.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: allansid/DotaScene path: /Program/fileOutputFunctions.py
# coding: utf-8
# Owner: Vinícius Aguiar de Oliveira
# Program I'm coding to learn the dota2api and maybe use it afterwards as an opening to start on the e-sports scence, you never know.
##################IMPORTS#####################
impor... | code_fim | medium | {
"lang": "python",
"repo": "allansid/DotaScene",
"path": "/Program/fileOutputFunctions.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> with open(jsonDirectory) as loadFile:
data = json.load(loadFile)
loadFile.close()
return data
def jsonWriteFile(jsonDirectory, data):
with open(jsonDirectory, 'w') as writeFile:
json.dump(data, writeFile, indent = 4, sort_keys = True)
writeFile.close
def optionOneWrite(name, content... | code_fim | medium | {
"lang": "python",
"repo": "allansid/DotaScene",
"path": "/Program/fileOutputFunctions.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> with open(fileDirectory + str(name) + ".txt", writer) as toCreate:
toCreate.write(content)
toCreate.close()
def updateAdminFile(content):
with open(adminDirectory, 'a') as writeFile:
writeFile.write(content)
writeFile.close<|fim_prefix|># repo: allansid/DotaScene path: /Program/fileOutputFunctio... | code_fim | hard | {
"lang": "python",
"repo": "allansid/DotaScene",
"path": "/Program/fileOutputFunctions.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>predictions = list()
for t in range(len(testData)):
model = ARIMA(history, order=(1,1,1)) # Here we must calculate the order with the AIC number but we choose one
model_fit = model.fit(trend='nc', disp=False)
ar_coef, ma_coef = model_fit.arparams, model_fit.maparams
resid = model_fit.resid #residue fo... | code_fim | hard | {
"lang": "python",
"repo": "lilstipher/DatascienceChallenge3",
"path": "/temperature/temperature.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>"""Seabold, Skipper, and Josef Perktold.
“Statsmodels: Econometric and statistical modeling with python.
” Proceedings of the 9th Python in Science Conference. 2010."""
"""We follow this course for modeling ARIMA model : https://machinelearningmastery.com/make-manual-predictions-arima-models-python/
manu... | code_fim | hard | {
"lang": "python",
"repo": "lilstipher/DatascienceChallenge3",
"path": "/temperature/temperature.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lilstipher/DatascienceChallenge3 path: /temperature/temperature.py
from pandas import Series #For plot time ourdataset from 2004 to 2016
from matplotlib import pyplot
from statsmodels.tsa.arima_model import ARIMA #Library for Modeling our prediction problem
from sklearn.metrics import mean_square... | code_fim | hard | {
"lang": "python",
"repo": "lilstipher/DatascienceChallenge3",
"path": "/temperature/temperature.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lightstep/ls-trace-py path: /tests/test_hook.py
import mock
from ddtrace.compat import reload_module
from ddtrace.utils.hook import (
register_post_import_hook,
deregister_post_import_hook,
)
from tests.subprocesstest import SubprocessTestCase, run_in_subprocess
@run_in_subprocess
cla... | code_fim | hard | {
"lang": "python",
"repo": "lightstep/ls-trace-py",
"path": "/tests/test_hook.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_hook_exception(self):
"""
Test that when a hook throws an exception that it is caught and logged
as a warning.
"""
def test_hook(module):
raise Exception('test_hook_failed')
register_post_import_hook('tests.utils.test_module', test_h... | code_fim | hard | {
"lang": "python",
"repo": "lightstep/ls-trace-py",
"path": "/tests/test_hook.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.methods_configs = [
{ 'name': 'EI',
'model_type' : model_type,
'initial_design_numdata' : initial_design_numdata,
'initial_design_type' : initial_design_type,
... | code_fim | hard | {
"lang": "python",
"repo": "puneetjain-iclp/GPyOpt",
"path": "/GPyOpt/testing/functional_tests/test_acquisitions_evaluations.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # -- Problem setup
np.random.seed(1)
n_inital_design = 5
input_dim = 5
f_bounds = (-5,5)
self.f_inits = samples_multidimensional_uniform([f_bounds]*input_dim,n_inital_design)
self.f_inits = self.f_inits.reshape(input_dim, self.f_inits.shape[-1])
... | code_fim | hard | {
"lang": "python",
"repo": "puneetjain-iclp/GPyOpt",
"path": "/GPyOpt/testing/functional_tests/test_acquisitions_evaluations.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: puneetjain-iclp/GPyOpt path: /GPyOpt/testing/functional_tests/test_acquisitions_evaluations.py
# Copyright (c) 2016, the GPyOpt Authors
# Licensed under the BSD 3-clause license (see LICENSE.txt)
import numpy as np
import GPyOpt
from GPyOpt.util.general import samples_multidimensional_uniform
... | code_fim | hard | {
"lang": "python",
"repo": "puneetjain-iclp/GPyOpt",
"path": "/GPyOpt/testing/functional_tests/test_acquisitions_evaluations.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>eck_output('cmd /c -C --np %s' % keyword, shell=True)
print(r)
return r<|fim_prefix|># repo: maou-shonen/LINE-chat-bot path: /module/google.py
import subprocess
import os
def google_search(keyword):
print(os.getcwd(<|fim_middle|>))
r = subprocess.run(['E:\\GoogleDrive\\codes\\Lin... | code_fim | medium | {
"lang": "python",
"repo": "maou-shonen/LINE-chat-bot",
"path": "/module/google.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: maou-shonen/LINE-chat-bot path: /module/google.py
import subprocess
import os
def google_search(keyword):
print(os.getcwd(<|fim_suffix|>p', keyword], stdout=subprocess.PIPE).commun
icate()
#r = subprocess.check_output('cmd /c -C --np %s' % keyword, shell=True)
print(r)
... | code_fim | medium | {
"lang": "python",
"repo": "maou-shonen/LINE-chat-bot",
"path": "/module/google.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: facebookresearch/mmf path: /mmf/models/vilbert.py
# Take the dot product between "query2" and "key1" to get the raw
# attention scores for value 1.
attention_scores1 = torch.matmul(query_layer2, key_layer1.transpose(-1, -2))
attention_scores1 = attention_scores1 / ... | code_fim | hard | {
"lang": "python",
"repo": "facebookresearch/mmf",
"path": "/mmf/models/vilbert.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: facebookresearch/mmf path: /mmf/models/vilbert.py
d(
self,
txt_embedding: Tensor,
image_embedding: Tensor,
txt_attention_mask: Tensor,
txt_attention_mask2: Tensor,
image_attention_mask: Tensor,
co_attention_mask: Tensor,
output_all_e... | code_fim | hard | {
"lang": "python",
"repo": "facebookresearch/mmf",
"path": "/mmf/models/vilbert.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> self,
input_ids: Tensor,
image_feature: Tensor,
image_location: Tensor,
token_type_ids: Tensor,
attention_mask: Tensor,
image_attention_mask: Tensor,
masked_lm_labels: Optional[Tensor] = None,
image_label: Optional[Tensor] = None,
... | code_fim | hard | {
"lang": "python",
"repo": "facebookresearch/mmf",
"path": "/mmf/models/vilbert.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: timothyb89/tracking path: /tracking/main.py
import cv2
from Queue import Queue
from threading import Thread
from vision import preprocess, find_edges, find_circles
from point import find_points
from cluster import find_clusters
class TrackingThread(Thread):
def __init__(self, camera_id, ... | code_fim | hard | {
"lang": "python",
"repo": "timothyb89/tracking",
"path": "/tracking/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def show_dummy(thread, frame, iterations = 1):
"""
Processes the given frame in the given TrackingThread for some number of
iterations. Useful for simulating against a still image when a tracking
history is needed.
:param thread: a TrackingThread instance
:param frame: the frame t... | code_fim | hard | {
"lang": "python",
"repo": "timothyb89/tracking",
"path": "/tracking/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: meidli/libbgp path: /libbgp/bgp/ciscorouterefresh.py
# Copyright 2015-2017 Cisco Systems, Inc.
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License... | code_fim | hard | {
"lang": "python",
"repo": "meidli/libbgp",
"path": "/libbgp/bgp/ciscorouterefresh.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> @classmethod
def unpack(cls, data, length, capability):
afi, res, safi = struct.unpack("!HBB", data)
return cls(value=str(Family(afi, safi)), length=length)
@classmethod
def pack(cls, data, capability):
afi, safi = Family.str_2_int(data)
if afi and safi:
... | code_fim | hard | {
"lang": "python",
"repo": "meidli/libbgp",
"path": "/libbgp/bgp/ciscorouterefresh.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> @classmethod
def pack(cls, data, capability):
afi, safi = Family.str_2_int(data)
if afi and safi:
msg_body = struct.pack('!H', afi) + b'\x00' + struct.pack('!B', safi)
return cls(value=data, hex_value=msg_body)
else:
raise RuntimeError('A... | code_fim | hard | {
"lang": "python",
"repo": "meidli/libbgp",
"path": "/libbgp/bgp/ciscorouterefresh.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pmacosta/pre-commit-hooks path: /pre_commit_hooks/identity.py
#!/usr/bin/env python
# identity.py
# Copyright (c) 2019 Pablo Acosta-Serafini
# See LICENSE for details
# pylint: disable=C0111
# Standard library imports
from __future__ import print_function
import argparse
import os
import re
impo... | code_fim | hard | {
"lang": "python",
"repo": "pmacosta/pre-commit-hooks",
"path": "/pre_commit_hooks/identity.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Return value of Git configuration field/token."""
stdout, _ = subprocess.Popen(
["git", "config", token], stdout=subprocess.PIPE, stderr=subprocess.PIPE
).communicate()
return _tostr(stdout).strip()
def _tostr(line): # pragma: no cover
return (
line
if isi... | code_fim | hard | {
"lang": "python",
"repo": "pmacosta/pre-commit-hooks",
"path": "/pre_commit_hooks/identity.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Script entry point."""
parser = argparse.ArgumentParser()
parser.add_argument(
"-a", "--author-file", help="Author(s) file", nargs=1, required=True
)
parser.add_argument("files", nargs="*", help="Files in commit")
args = parser.parse_args(argv)
author_file = args.aut... | code_fim | hard | {
"lang": "python",
"repo": "pmacosta/pre-commit-hooks",
"path": "/pre_commit_hooks/identity.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wsstriving/Vivi_3.0 path: /models/Seq2seq_7/modules.py
import math
import torch
from torch.nn import Module, Parameter
import torch.nn.functional as F
from torch.autograd import Variable
def clip_grad(v, min, max):
v_tmp = v.expand_as(v)
v_tmp.register_hook(lambda g: g.clamp(min, max))... | code_fim | hard | {
"lang": "python",
"repo": "wsstriving/Vivi_3.0",
"path": "/models/Seq2seq_7/modules.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class LSTMPCell(RNNCellBase):
def __init__(self, input_size, hidden_size, recurrent_size, bias=True, grad_clip=None):
super(LSTMPCell, self).__init__()
self.input_size = input_size
self.hidden_size = hidden_size
self.recurrent_size = recurrent_size
self.grad_c... | code_fim | hard | {
"lang": "python",
"repo": "wsstriving/Vivi_3.0",
"path": "/models/Seq2seq_7/modules.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>intersphinx_mapping = {
'python': ('https://docs.python.org/3/', None),
'sphinx': ('https://www.sphinx-doc.org/en/master/', None),
'fitlins': ('https://fitlins.readthedocs.io/en/latest/', None),
'pyNS': ('https://pyns.readthedocs.io/en/latest/', None),
'neuroscout': ('https://neuroscou... | code_fim | hard | {
"lang": "python",
"repo": "neuroscout/neuroscout-cli",
"path": "/docs/source/conf.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: neuroscout/neuroscout-cli path: /docs/source/conf.py
# Configuration file for the Sphinx documentation builder.
import os
import sys
sys.path.insert(0, os.path.abspath('../../'))
from neuroscout_cli import __version__
# -- Project information
<|fim_suffix|>version = __version__
# -- General c... | code_fim | medium | {
"lang": "python",
"repo": "neuroscout/neuroscout-cli",
"path": "/docs/source/conf.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aideenf/machnamh path: /machnamh/demo_data.py
ded a law school accredited by
the American Bar Association(ABA).
</li>
<li><b>Region_first:</b> The geographic region in which the first BAR exam was taken. The jurisdictions
used in this study match those used by the Law School Admission C... | code_fim | hard | {
"lang": "python",
"repo": "aideenf/machnamh",
"path": "/machnamh/demo_data.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> <p>A 2014 report showed that black children although accounting for only 18% of preschoolers account for
48% of children suspended more than once a seperat study suggests that teachers “increased the severity
of suggested disciplinary actions when the race of the teachers didn’t match that of the ch... | code_fim | hard | {
"lang": "python",
"repo": "aideenf/machnamh",
"path": "/machnamh/demo_data.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> If we follow the timelines of the educational path in the USA, which is reflected in this database,
the chronology of academic milestones and their corresponding measurements are, first
the undergraduate grade point average(UGPA), followed by the LSAT which is the standardised
test necessary to ... | code_fim | hard | {
"lang": "python",
"repo": "aideenf/machnamh",
"path": "/machnamh/demo_data.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pmchozas/termitup path: /modules_api/frecuency.py
def frecuency(freqlist, cleanlist):
listmax=list()
i=int()
while(len(listmax) <301):
spl=freqlist[i].split(',')
freq=spl[0]
term=spl[1]
if(term in cleanlist):
listmax.append(freqlist[i])
i=i+1
return(listmax)
<|fim_suffix|> ... | code_fim | easy | {
"lang": "python",
"repo": "pmchozas/termitup",
"path": "/modules_api/frecuency.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def frequencyTerm(freqlist, termin):
freqTerm=int()
for i in freqlist:
spl=i.split(',')
freq=spl[0]
term=spl[1][:-1]
if(termin in term):
freqTerm=freq
return(freqTerm)<|fim_prefix|># repo: pmchozas/termitup path: /modules_api/frecuency.py
def frecuency(freqlist, cleanlist):
listmax=lis... | code_fim | easy | {
"lang": "python",
"repo": "pmchozas/termitup",
"path": "/modules_api/frecuency.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> freqTerm=int()
for i in freqlist:
spl=i.split(',')
freq=spl[0]
term=spl[1][:-1]
if(termin in term):
freqTerm=freq
return(freqTerm)<|fim_prefix|># repo: pmchozas/termitup path: /modules_api/frecuency.py
def frecuency(freqlist, cleanlist):
listmax=list()
i=int()
while(len(listmax) <301... | code_fim | easy | {
"lang": "python",
"repo": "pmchozas/termitup",
"path": "/modules_api/frecuency.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def serialize_for_event(self):
d = super().serialize_for_event()
d["root"] = self.root
return d
def download_all_catalog(self):
filepath = self.get_all_catalog_local_path()
r = requests.get(os.path.join(self.root, "catalogs/all"))
if not r.status_co... | code_fim | medium | {
"lang": "python",
"repo": "ankurvaishley/zentral",
"path": "/zentral/contrib/monolith/repository_backends/http.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> url = os.path.join(self.root, section, name)
if cache_server:
url = cache_server.get_cache_url(url)
return HttpResponseRedirect(url)<|fim_prefix|># repo: ankurvaishley/zentral path: /zentral/contrib/monolith/repository_backends/http.py
import os.path
from django.http i... | code_fim | hard | {
"lang": "python",
"repo": "ankurvaishley/zentral",
"path": "/zentral/contrib/monolith/repository_backends/http.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ankurvaishley/zentral path: /zentral/contrib/monolith/repository_backends/http.py
import os.path
from django.http import HttpResponseRedirect
import requests
from zentral.contrib.monolith.exceptions import RepositoryError
from .base import BaseRepository
class Repository(BaseRepository):
de... | code_fim | hard | {
"lang": "python",
"repo": "ankurvaishley/zentral",
"path": "/zentral/contrib/monolith/repository_backends/http.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SBEMimage/SBEMimage path: /src/sem_control.py
_limits: range of the SEM XY motors in micrometres
# [x_min, x_max, y_min, y_max]
self.stage_limits = json.loads(
self.syscfg['stage']['sem_stage_limits'])
# speed in microns/second of X and Y stage motors
s... | code_fim | hard | {
"lang": "python",
"repo": "SBEMimage/SBEMimage",
"path": "/src/sem_control.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SBEMimage/SBEMimage path: /src/sem_control.py
T License.
# See LICENSE.txt in the project root folder.
# ==============================================================================
"""This module provides the commands to operate the SEM. Only the functions
that are actually required in SBEM... | code_fim | hard | {
"lang": "python",
"repo": "SBEMimage/SBEMimage",
"path": "/src/sem_control.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Set the scan rotation angle (in degrees)."""
raise NotImplementedError
def acquire_frame(self, save_path_filename, extra_delay=0):
"""Acquire a full frame and save it to save_path_filename.
All imaging parameters must be applied BEFORE calling this function.
... | code_fim | hard | {
"lang": "python",
"repo": "SBEMimage/SBEMimage",
"path": "/src/sem_control.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def say(text: str):
args = text.split(' ', 1)
if len(args) == 1 or len(args[1]) == 0:
logger.info('say <message>')
else:
if pcrc.is_online():
pcrc.chat(args[1])
else:
logger.warning('PCRC is not online, cannot chat')
def whitelist_commands(text: str, config: Config):
whitelist = config.... | code_fim | hard | {
"lang": "python",
"repo": "Fallen-Breath/PCRC",
"path": "/pcrc/cli_entry.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Fallen-Breath/PCRC path: /pcrc/cli_entry.py
import sys
import time
from logging import Logger
from pcrc import constant
from pcrc.config import SettableOptions, Config
from pcrc.pcrc_client import PcrcClient
from pcrc.protocol import SUPPORTED_MINECRAFT_VERSIONS
pcrc = PcrcClient()
logger: Logg... | code_fim | hard | {
"lang": "python",
"repo": "Fallen-Breath/PCRC",
"path": "/pcrc/cli_entry.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if pcrc.has_authenticated():
if warn_if_already_auth:
logger.warning('Minecraft authentication is already done')
else:
pcrc.authenticate()
def say(text: str):
args = text.split(' ', 1)
if len(args) == 1 or len(args[1]) == 0:
logger.info('say <message>')
else:
if pcrc.is_online():
pcrc... | code_fim | hard | {
"lang": "python",
"repo": "Fallen-Breath/PCRC",
"path": "/pcrc/cli_entry.py",
"mode": "spm",
"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.