text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: Descent098/PYTH-101 path: /Solutions.py
ach
possible value (1-5), write the code to make
the input 11.
I.e. Someone inputs 1 the result is 11, if someone
inputs 2 the result is 11 etc. If someone puts in a
number not in range (1-5) print:
'value not between 1-5 please ... | code_fim | hard | {
"lang": "python",
"repo": "Descent098/PYTH-101",
"path": "/Solutions.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if number == 1:
number += 10 # 1 + 10 is eleven
elif number == 2:
number *= 5 # 2 * 5 is 10
number += 1 # 10 + 1 is 11
elif number == 3:
number *= 4 # 3 * 4 is 12
number -= 1 # 12 - 1 is 11
elif number == 4:
number *= 3 # 4 * 3 is 12
number -= 1 # 12 - 1 is 11
elif number =... | code_fim | hard | {
"lang": "python",
"repo": "Descent098/PYTH-101",
"path": "/Solutions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Returns a list of all one tests in this singleton test. For uniformity
with MultiTest."""
return [self]
_MultiTest = namedtuple(
'MultiTest', 'name make_ctx_call destroy_ctx_call tests atomic')
class MultiTest(_MultiTest):
"""A wrapper around one or more Test instances.
Allows t... | code_fim | hard | {
"lang": "python",
"repo": "petrhosek/recipes-py",
"path": "/recipe_engine/third_party/expect_tests/type_definitions.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: petrhosek/recipes-py path: /recipe_engine/third_party/expect_tests/type_definitions.py
nction)
]
indent += 2
lines.append('%s`%s`' % ((' '*indent), self.code))
indent += 2
if self.varmap:
lines.extend('%s%s: %s' % ((' '*indent), k, v)
for k, v in self.... | code_fim | hard | {
"lang": "python",
"repo": "petrhosek/recipes-py",
"path": "/recipe_engine/third_party/expect_tests/type_definitions.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: petrhosek/recipes-py path: /recipe_engine/third_party/expect_tests/type_definitions.py
ine function code varmap')):
def format(self, indent):
lines = [
'%s%s:%s - %s()' % ((' '*indent), self.fname, self.line, self.function)
]
indent += 2
lines.append('%s`%s`' % ((' '*inden... | code_fim | hard | {
"lang": "python",
"repo": "petrhosek/recipes-py",
"path": "/recipe_engine/third_party/expect_tests/type_definitions.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: raelgc/scudcloud path: /scudcloud/speller.py
from scudcloud.resources import Resources
import os
from PyQt5 import QtGui, QtWidgets
from PyQt5.QtWidgets import QAction
from PyQt5.QtCore import QObject
from PyQt5.QtCore import QLocale, QFile, QTextBoundaryFinder
# Checking if python-hunspell is ... | code_fim | hard | {
"lang": "python",
"repo": "raelgc/scudcloud",
"path": "/scudcloud/speller.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> action = self.sender()
new = action.data()
if isinstance(new, bytes):
new = new.decode('utf8')
text = self._getText(element)
cursorPos = self._getSelectionStart(element)
text = text[:self.startPos] + new + text[self.startPos+len(word):]
t... | code_fim | hard | {
"lang": "python",
"repo": "raelgc/scudcloud",
"path": "/scudcloud/speller.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def dictionaryExists(self, path):
return QFile(path + ".dic").exists() and QFile(path + ".aff").exists();
def getDictionaryPath(self):
dicPath = os.path.join(Resources.SPELL_DICT_PATH, QLocale.system().name())
if self.dictionaryExists(dicPath):
return dicPath
... | code_fim | hard | {
"lang": "python",
"repo": "raelgc/scudcloud",
"path": "/scudcloud/speller.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>urlpatterns = patterns('', url(r'^hijack/', include('hijack.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^hello/', include('hijack.tests.test_app.urls')))<|fim_prefix|># repo: rizumu/django-hijack path: /hijack/tests/urls.py
"""URLs to run the te... | code_fim | easy | {
"lang": "python",
"repo": "rizumu/django-hijack",
"path": "/hijack/tests/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rizumu/django-hijack path: /hijack/tests/urls.py
"""URLs to run the tests."""
from compat import patterns, include, url
<|fim_suffix|>urlpatterns = patterns('', url(r'^hijack/', include('hijack.urls')),
url(r'^admin/', include(admin.site.urls)),
url(... | code_fim | easy | {
"lang": "python",
"repo": "rizumu/django-hijack",
"path": "/hijack/tests/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: qyb225/similar-cloth path: /classification/database.py
import os
import numpy as np
from scipy.spatial.distance import cdist
<|fim_suffix|> db = np.array(data)
np.save(_DATABASE_PATH, db)
def topN(vec, n=5, method='cosine'):
if db is None:
raise Exception('empyt db')
res... | code_fim | hard | {
"lang": "python",
"repo": "qyb225/similar-cloth",
"path": "/classification/database.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> db = np.array(data)
np.save(_DATABASE_PATH, db)
def topN(vec, n=5, method='cosine'):
if db is None:
raise Exception('empyt db')
result = cdist([vec], db, metric=method)[0]
indices = np.argsort(result)[:n]
return indices<|fim_prefix|># repo: qyb225/similar-cloth path: /cl... | code_fim | hard | {
"lang": "python",
"repo": "qyb225/similar-cloth",
"path": "/classification/database.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# The company _SETE QUATRO COMUNICACAO E PUBLICIDADE LTDA - EPP_ is clearly in a [office building](https://goo.gl/maps/k6z8bdHLVxR2), probably the same building in which _Yume Espaço Terapêutico_ offers their service.
# ### Céu Azul Motel
#
# Finally [CONTRASTE EDITORA E INDUSTRIA GRAFICA EIRELI](https... | code_fim | hard | {
"lang": "python",
"repo": "cleytonVale/serenata-de-amor",
"path": "/research/develop/2017-04-21-cuducos-explore-sex-places-dataset.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cleytonVale/serenata-de-amor path: /research/develop/2017-04-21-cuducos-explore-sex-places-dataset.py
# coding: utf-8
# # Exploring the first version of Sex Place Distances dataset
# This notebook plays around with data from the first version of the dataset `data/2017-04-21-sex-place-distance.... | code_fim | hard | {
"lang": "python",
"repo": "cleytonVale/serenata-de-amor",
"path": "/research/develop/2017-04-21-cuducos-explore-sex-places-dataset.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# ### Villa Gorini
#
# Two CNPJs were assigned to a night club called Villa Gorini:
# In[9]:
close_enough[close_enough.cnpj == '03874976000181'].iloc[0]
# In[10]:
close_enough[close_enough.cnpj == '17084369000122'].iloc[0]
# However the point here is that Google Places API seems rather imprecise ... | code_fim | hard | {
"lang": "python",
"repo": "cleytonVale/serenata-de-amor",
"path": "/research/develop/2017-04-21-cuducos-explore-sex-places-dataset.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Raised if a storage get() function finds no data at all."""
pass
class FloatConversionError(Exception):
"""Raise to group the various exceptions that can lead to the impossibility of converting a value to a floating point."""
pass<|fim_prefix|># repo: sarusso/Timeseria path: /timeser... | code_fim | medium | {
"lang": "python",
"repo": "sarusso/Timeseria",
"path": "/timeseria/exceptions.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sarusso/Timeseria path: /timeseria/exceptions.py
# -*- coding: utf-8 -*-
"""Exceptions."""
class ConsistencyException(Exception):
"""Rasied when the internal consistency is broken."""
pass
class NotFittedError(Exception):
"""Raised when trying to save, apply or evaluate a model tha... | code_fim | medium | {
"lang": "python",
"repo": "sarusso/Timeseria",
"path": "/timeseria/exceptions.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>class FloatConversionError(Exception):
"""Raise to group the various exceptions that can lead to the impossibility of converting a value to a floating point."""
pass<|fim_prefix|># repo: sarusso/Timeseria path: /timeseria/exceptions.py
# -*- coding: utf-8 -*-
"""Exceptions."""
class Consistency... | code_fim | hard | {
"lang": "python",
"repo": "sarusso/Timeseria",
"path": "/timeseria/exceptions.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> BEGIN
-- Get the device details
IF (p_device_name is null) THEN
-- return all of them...
RETURN QUERY SELECT device_id, device_type, properties,
hostname, ip_address, mac_address, profile_name, cast(null AS J... | code_fim | hard | {
"lang": "python",
"repo": "intel-ctrlsys/actsys",
"path": "/datastore/datastore/database_schema/schema_migration/versions/8d64bce23c6b_add_device_history_in_favor_of_logical_.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: intel-ctrlsys/actsys path: /datastore/datastore/database_schema/schema_migration/versions/8d64bce23c6b_add_device_history_in_favor_of_logical_.py
"""Add device history in favor of logical deletion
Revision ID: 8d64bce23c6b
Revises: e4d4e95ae481
Create Date: 2017-03-16 12:52:57.852420
"""
from a... | code_fim | hard | {
"lang": "python",
"repo": "intel-ctrlsys/actsys",
"path": "/datastore/datastore/database_schema/schema_migration/versions/8d64bce23c6b_add_device_history_in_favor_of_logical_.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> GET DIAGNOSTICS num_rows = ROW_COUNT;
RETURN QUERY SELECT num_rows, v_device_id;
END IF;
RETURN QUERY SELECT 0, 0;
END;
$BODY$
LANGUAGE plpgsql VOLATILE
COST 100;
"""))
op.drop... | code_fim | hard | {
"lang": "python",
"repo": "intel-ctrlsys/actsys",
"path": "/datastore/datastore/database_schema/schema_migration/versions/8d64bce23c6b_add_device_history_in_favor_of_logical_.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> payload.update(kwargs)
r = requests.post(
self._api_url, json=payload, auth=(self.api_key, self.api_secret)
)
return r.json()<|fim_prefix|># repo: agmm/contratospr-api path: /contratospr/utils/filepreviews.py
import requests
class FilePreviews:
def __in... | code_fim | medium | {
"lang": "python",
"repo": "agmm/contratospr-api",
"path": "/contratospr/utils/filepreviews.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> payload = {"url": url}
payload.update(kwargs)
r = requests.post(
self._api_url, json=payload, auth=(self.api_key, self.api_secret)
)
return r.json()<|fim_prefix|># repo: agmm/contratospr-api path: /contratospr/utils/filepreviews.py
import requests
... | code_fim | medium | {
"lang": "python",
"repo": "agmm/contratospr-api",
"path": "/contratospr/utils/filepreviews.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: agmm/contratospr-api path: /contratospr/utils/filepreviews.py
import requests
class FilePreviews:
def __init__(self, api_key=None, api_secret=None):
<|fim_suffix|> payload.update(kwargs)
r = requests.post(
self._api_url, json=payload, auth=(self.api_key, self.api... | code_fim | hard | {
"lang": "python",
"repo": "agmm/contratospr-api",
"path": "/contratospr/utils/filepreviews.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> boxes = torch.from_numpy(boxes).float()
scores = torch.from_numpy(scores).float()
ids, count = nms(boxes, scores, self.nms_thresh, self.top_k)
# ids, count = non_maximum_supression(boxes = boxes,
# ... | code_fim | hard | {
"lang": "python",
"repo": "puruBHU/SSD300_with_keras",
"path": "/Detector.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: puruBHU/SSD300_with_keras path: /Detector.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 8 12:24:14 2019
@author: Purnendu Mishra
"""
import torch
from box_utils import nms
import numpy as np
from utility import non_maximum_supression, decode
class Detect(object):
... | code_fim | hard | {
"lang": "python",
"repo": "puruBHU/SSD300_with_keras",
"path": "/Detector.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># loc_data = prediction[:,:,:4]
# conf_data = prediction[:,:,4:]
num_priors = priors.shape[0]
batch_size = loc_data.shape[0]
output = np.zeros(shape=(batch_size, self.num_classes, self.top_k, 5), dtype= np.float32)
conf_preds =... | code_fim | hard | {
"lang": "python",
"repo": "puruBHU/SSD300_with_keras",
"path": "/Detector.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> mask_erod = self.erode(
mask_vab, 3, cv2.MORPH_ELLIPSE, self.rois_list, "mask", 2
)
mask_dil = self.dilate(
mask_erod, 3, cv2.MORPH_ELLIPSE, self.rois_list, "mask", 2
)
self.mask = self.apply_rois(mask_dil, "mask_... | code_fim | hard | {
"lang": "python",
"repo": "tpmp-inra/ipapi",
"path": "/class_pipelines/ip_tabac.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Build leaf extended mask
mask_a_med, stored_img = self.get_mask(
img, "a", 140, 255, self.rois_list, False, 15
)
self.store_image(mask_a_med, stored_img, self.rois_list, mosaic_line_1)
# Build noisy leaf mask
mask_a... | code_fim | hard | {
"lang": "python",
"repo": "tpmp-inra/ipapi",
"path": "/class_pipelines/ip_tabac.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tpmp-inra/ipapi path: /class_pipelines/ip_tabac.py
import cv2
import os
import numpy as np
from ipso_phen.ipapi.base.ip_abstract import BaseImageProcessor
from ipso_phen.ipapi.tools.common_functions import (
time_method,
add_header_footer,
force_directories,
)
class TpmpImageProces... | code_fim | hard | {
"lang": "python",
"repo": "tpmp-inra/ipapi",
"path": "/class_pipelines/ip_tabac.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
s.encode(encoding='utf-8').decode('ascii')
except UnicodeDecodeError:
return False
else:
return True
log.info('Transforming geonames data...')
log.info('Reading geo data...')
df = self.get_geon... | code_fim | hard | {
"lang": "python",
"repo": "srfda/local-geocode",
"path": "/geocode/geocode.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: srfda/local-geocode path: /geocode/geocode.py
import pandas as pd
import os
import pickle
import logging
from tqdm import tqdm
import sys
from flashtext import KeywordProcessor
import joblib
import multiprocessing
import numpy as np
import urllib.request
import zipfile
logging.basicConfig(level... | code_fim | hard | {
"lang": "python",
"repo": "srfda/local-geocode",
"path": "/geocode/geocode.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with open(self.keyword_processor_pickle_path, 'rb') as f:
kp = pickle.load(f)
return kp
def create_geonames_pickle(self):
"""Create list of place/country data from geonames data and sort according to priorities"""
def is_ascii(s):
try:
... | code_fim | hard | {
"lang": "python",
"repo": "srfda/local-geocode",
"path": "/geocode/geocode.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ttm/dissertacao path: /article/scripts/formas_de_onda.py
#-*- coding: utf-8 -*-
# http://matplotlib.sourceforge.net/examples/api/legend_demo.html
#
import pylab as p, numpy as n, matplotlib as m
from scipy.io import wavfile as w
p.figure(figsize=(10.,5.))
p.subplots_adjust(left=0.12,bottom=0.13... | code_fim | hard | {
"lang": "python",
"repo": "ttm/dissertacao",
"path": "/article/scripts/formas_de_onda.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
p.subplot(211)
#p.title("Formas de onda")
p.plot(senoide,'o',linewidth=3, label=u"sinusoid")
p.plot(dente,'o',linewidth=3, label="sawtooth")
p.plot(triangular,'o',linewidth=3, label="triangular")
p.plot(quadrada,'o',linewidth=3, label="square")
p.xlim(0,T)
p.ylim(-1.1,1.1)
foo=p.gca()
foo.axes.get_xaxis... | code_fim | hard | {
"lang": "python",
"repo": "ttm/dissertacao",
"path": "/article/scripts/formas_de_onda.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rps21/indra path: /rest_api/api.py
import json
import logging
from bottle import route, run, request, default_app, response
from indra import trips, reach, bel, biopax
from indra.statements import *
from indra.assemblers import PysbAssembler, CxAssembler, GraphAssembler,\
... | code_fim | hard | {
"lang": "python",
"repo": "rps21/indra",
"path": "/rest_api/api.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Assemble INDRA Statements and return Graphviz graph dot string."""
response = request.body.read().decode('utf-8')
body = json.loads(response)
stmts_json = body.get('statements')
stmts = stmts_from_json(stmts_json)
ga = GraphAssembler(stmts)
model_str = ga.make_model()
re... | code_fim | hard | {
"lang": "python",
"repo": "rps21/indra",
"path": "/rest_api/api.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>### PYSB ###
@route('/assemblers/pysb', method='POST')
def assemble_pysb():
"""Assemble INDRA Statements and return PySB model string."""
response = request.body.read().decode('utf-8')
body = json.loads(response)
stmts_json = body.get('statements')
stmts = stmts_from_json(stmts_json)
... | code_fim | hard | {
"lang": "python",
"repo": "rps21/indra",
"path": "/rest_api/api.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> twisted_headers = Headers()
for k, v in headers.items():
key = k.encode('ascii', 'ignore')
val = v.encode('ascii', 'ignore')
twisted_headers.addRawHeader(key, val)
return twisted_headers
def encode_body(data):
if not data:
return None
if not isinstance... | code_fim | hard | {
"lang": "python",
"repo": "olaan/calvin-base",
"path": "/calvin/runtime/south/plugins/async/twistedimpl/http_client.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, callbacks=None):
super(HTTPClient, self).__init__(callbacks)
self._agent = self.create_agent()
def _receive_headers(self, response, request):
request.parse_headers(response)
self._callback_execute('receive-headers', request)
finished = De... | code_fim | hard | {
"lang": "python",
"repo": "olaan/calvin-base",
"path": "/calvin/runtime/south/plugins/async/twistedimpl/http_client.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: olaan/calvin-base path: /calvin/runtime/south/plugins/async/twistedimpl/http_client.py
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Ericsson AB
#
# 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 ... | code_fim | hard | {
"lang": "python",
"repo": "olaan/calvin-base",
"path": "/calvin/runtime/south/plugins/async/twistedimpl/http_client.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: marchingphoenix/py-graph-ql-client path: /py_graph_ql_client/Query.py
from __future__ import annotations
from abc import ABC, abstractmethod
from itertools import chain
from typing import List, Optional, Tuple, Union
class GQLObject(ABC):
name = str()
variables = None
@abstractmet... | code_fim | hard | {
"lang": "python",
"repo": "marchingphoenix/py-graph-ql-client",
"path": "/py_graph_ql_client/Query.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self,
name: str,
variables: Optional[dict] = None,
sub_resource: bool = False,
page_info: bool = False,
cursor: bool = False,
name_override: Optional[str] = None,
) -> None:
self.name = name
self.variables = variables
self... | code_fim | hard | {
"lang": "python",
"repo": "marchingphoenix/py-graph-ql-client",
"path": "/py_graph_ql_client/Query.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def run(self):
""" Loops over trials and runs them! """
self.create_trials() # create them *before* running!
self.start_experiment()
for trail in self.trials:
trial.run()
self.close()
class HRFMapperTrial(Trial):
def __init__(self, session... | code_fim | hard | {
"lang": "python",
"repo": "tknapen/hrf_mapper",
"path": "/hrfmapper.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, session, trial_nr, phase_durations, phase_names,
parameters, timing, load_next_during_phase,
verbose, condition='hrf'):
""" Initializes a HRFMapperTrial object.
Parameters
----------
session : exptools Session object... | code_fim | hard | {
"lang": "python",
"repo": "tknapen/hrf_mapper",
"path": "/hrfmapper.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tknapen/hrf_mapper path: /hrfmapper.py
from exptools2.core import Session
import numpy as np
import h5py
from psychopy.visual import GratingStim, Circle
class HRFMapperSession(Session):
def create_trials(self):
""" Creates trials before running the session"""
exp_s = self.se... | code_fim | hard | {
"lang": "python",
"repo": "tknapen/hrf_mapper",
"path": "/hrfmapper.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Pairs with length [0, bucket_width) go to bucket 0, length
# [bucket_width, 2 * bucket_width) go to bucket 1, etc. Pairs with length
# over ((num_bucket-1) * bucket_width) words all go into the last bucket.
# If there is a max length find ... | code_fim | hard | {
"lang": "python",
"repo": "cainesap/Dialogue-systems-for-language-learning",
"path": "/utils/end2end_iterator_utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cainesap/Dialogue-systems-for-language-learning path: /utils/end2end_iterator_utils.py
Translation: https://github.com/lmthang/thesis
And on the paper Building End-To-End Dialogue Systems
Using Generative Hierarchical Neural Network Models:
https://arxiv.org/pdf/1507.04808.pdf
Created by Tudor... | code_fim | hard | {
"lang": "python",
"repo": "cainesap/Dialogue-systems-for-language-learning",
"path": "/utils/end2end_iterator_utils.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Constructs a new RemoteConnectionManager, setting it's dictionary of
connections to the empty dict.
"""
self.remoteConnections = {}
#-------------------------------------------------------------------------
# Create a connection, generate a unique id fo... | code_fim | hard | {
"lang": "python",
"repo": "scottwittenburg/web-hpc-manager",
"path": "/python/webserver/RemoteConnection.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: scottwittenburg/web-hpc-manager path: /python/webserver/RemoteConnection.py
import paramiko
import uuid
##############################################################################
# RemoteConnection
##################################################################... | code_fim | hard | {
"lang": "python",
"repo": "scottwittenburg/web-hpc-manager",
"path": "/python/webserver/RemoteConnection.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: giganano/VICE path: /vice/yields/ccsne/LC18/__init__.py
r"""
Limongi & Chieffi (2018), ApJS, 237, 13 core collapse supernova (CCSN) yields
**Signature**: from vice.yields.ccsne import LC18
Importing this module will automatically set the CCSN yield settings for all
elements to the IMF-averaged ... | code_fim | hard | {
"lang": "python",
"repo": "giganano/VICE",
"path": "/vice/yields/ccsne/LC18/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> - -3
- -2
- -1
- 0
Example Code
------------
>>> import vice
>>> from vice.yields.ccsne import LC18
>>> vice.yields.ccsne.settings['o']
0.0036512768277795864
>>> LC18.set_params(IMF = "salpeter")
>>> vice.yields.ccsne.settings['o']
0.0022556257770960713
>>> LC18.set_params... | code_fim | hard | {
"lang": "python",
"repo": "giganano/VICE",
"path": "/vice/yields/ccsne/LC18/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if (num1 > num2):
max = num1;
elif(num1 == num2):
max = num1
else:
max = num2;
print('최댓값',':',max);<|fim_prefix|># repo: yoojunwoong/python_review01 path: /test2_08.py
# max함수의 초기화와 조건문을 사용하여 최댓값 구하기.
<|fim_middle|># 두개의 숫자를 입력 받는다
# 두수 중 최대 값을 출력하시오.
num1 = int(input('input num1.... | code_fim | medium | {
"lang": "python",
"repo": "yoojunwoong/python_review01",
"path": "/test2_08.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yoojunwoong/python_review01 path: /test2_08.py
# max함수의 초기화와 조건문을 사용하여 최댓값 구하기.
<|fim_suffix|>if (num1 > num2):
max = num1;
elif(num1 == num2):
max = num1
else:
max = num2;
print('최댓값',':',max);<|fim_middle|># 두개의 숫자를 입력 받는다
# 두수 중 최대 값을 출력하시오.
num1 = int(input('input num1.... | code_fim | medium | {
"lang": "python",
"repo": "yoojunwoong/python_review01",
"path": "/test2_08.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>class Migration(migrations.Migration):
dependencies = [
('products', '0070_auto_20210322_0835'),
]
operations = [
migrations.RemoveField(
model_name='product',
name='early_access',
),
]<|fim_prefix|># repo: flavoi/diventi path: /diventi/pr... | code_fim | easy | {
"lang": "python",
"repo": "flavoi/diventi",
"path": "/diventi/products/migrations/0071_remove_product_early_access.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: flavoi/diventi path: /diventi/products/migrations/0071_remove_product_early_access.py
# Generated by Django 2.2.24 on 2021-10-02 14:38
<|fim_suffix|> dependencies = [
('products', '0070_auto_20210322_0835'),
]
operations = [
migrations.RemoveField(
model_n... | code_fim | medium | {
"lang": "python",
"repo": "flavoi/diventi",
"path": "/diventi/products/migrations/0071_remove_product_early_access.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.RemoveField(
model_name='product',
name='early_access',
),
]<|fim_prefix|># repo: flavoi/diventi path: /diventi/products/migrations/0071_remove_product_early_access.py
# Generated by Django 2.2.24 on 2021-10-02 14:38
from django.d... | code_fim | medium | {
"lang": "python",
"repo": "flavoi/diventi",
"path": "/diventi/products/migrations/0071_remove_product_early_access.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> newIndexIn=(self.offset+indexIn)%self.size
mutliOutput=self.wiring.getMultiPairdPin(indexIn)
for i in range(len(mutliOutput)):
mutliOutput[i]=(mutliOutput[i]-self.offset)%self.size
return mutliOutput
def reverseSignal(self,indexReverseIn):
raise Exc... | code_fim | medium | {
"lang": "python",
"repo": "mrfawy/ModernEnigma",
"path": "/MapperSwitch.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> raise Exception("Unsupported operation by SwappingSwitch")<|fim_prefix|># repo: mrfawy/ModernEnigma path: /MapperSwitch.py
from Wiring import Wiring
from Rotor import Rotor
"""Extends Switch , allowing for single Pin in , and multi-Pin out"""
class MapperSwitch(Rotor):
<|fim_middle|> def __in... | code_fim | hard | {
"lang": "python",
"repo": "mrfawy/ModernEnigma",
"path": "/MapperSwitch.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mrfawy/ModernEnigma path: /MapperSwitch.py
from Wiring import Wiring
from Rotor import Rotor
"""Extends Switch , allowing for single Pin in , and multi-Pin out"""
class MapperSwitch(Rotor):
def __init__(self,wiring):
super().__init__(0,wiring)
def signalIn(self,indexIn):
<|fim_su... | code_fim | hard | {
"lang": "python",
"repo": "mrfawy/ModernEnigma",
"path": "/MapperSwitch.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Kenan7/nProject path: /waterdebt/models.py
from django.db import models
# Create your models here.
class Post(models.Model):
title = models.CharField(max_length=255)
briefContent = models.CharField(max_length=255, default='Some content')
content = models.TextField()
image = model... | code_fim | medium | {
"lang": "python",
"repo": "Kenan7/nProject",
"path": "/waterdebt/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __unicode__(self):
return u'{}'.format(self.title)<|fim_prefix|># repo: Kenan7/nProject path: /waterdebt/models.py
from django.db import models
# Create your models here.
class Post(models.Model):
title = models.CharField(max_length=255)
briefContent = models.CharField(max_length... | code_fim | medium | {
"lang": "python",
"repo": "Kenan7/nProject",
"path": "/waterdebt/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PrabaRock7/Python-Calculator path: /calc.py
from tkinter import Tk, Label, Button, Entry
class Root(Tk):
def __init__(self):
<|fim_suffix|> def onclick(self):
self.label.configure(text=str(eval(self.entry.get())))
root = Root()
root.mainloop()<|fim_middle|> super().__ini... | code_fim | hard | {
"lang": "python",
"repo": "PrabaRock7/Python-Calculator",
"path": "/calc.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.label.configure(text=str(eval(self.entry.get())))
root = Root()
root.mainloop()<|fim_prefix|># repo: PrabaRock7/Python-Calculator path: /calc.py
from tkinter import Tk, Label, Button, Entry
class Root(Tk):
def __init__(self):
super().__init__()
self.title_label = Labe... | code_fim | medium | {
"lang": "python",
"repo": "PrabaRock7/Python-Calculator",
"path": "/calc.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jeremyosborne/python path: /third_party/pygame/05_petri/engine.py
import pygame
import pygame.locals
from pygame.locals import *
class GameWorld(object):
windowWidth = 600
windowHeight = 600
backgroundColor = (254, 184, 188)
fps = 40
keepRunning = True
gameClock... | code_fim | hard | {
"lang": "python",
"repo": "jeremyosborne/python",
"path": "/third_party/pygame/05_petri/engine.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if event.type == KEYDOWN:
# MODIFIED CODE
# Go through each key down event in the keydown callbacks
# and pass the event object.
# Each keydown will have the following props:
# unicode,... | code_fim | hard | {
"lang": "python",
"repo": "jeremyosborne/python",
"path": "/third_party/pygame/05_petri/engine.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: qhjqhj00/NLI path: /src/utils/bert_config.py
import json
import copy
import logging
import numpy as np
class Config(object):
@classmethod
def from_dict(cls, json_object):
config_instance = Config()
for key, value in json_object.items():
try:
... | code_fim | hard | {
"lang": "python",
"repo": "qhjqhj00/NLI",
"path": "/src/utils/bert_config.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def init_log(log, output_file):
"""初始化log设置"""
output_file.mkdir(parents=True, exist_ok=True)
output_file = output_file / 'training.log'
fh = logging.FileHandler(output_file, mode='a')
formatter = logging.Formatter('%(asctime)-15s %(message)s')
fh.setFormatter(formatter)
log.ad... | code_fim | hard | {
"lang": "python",
"repo": "qhjqhj00/NLI",
"path": "/src/utils/bert_config.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zhaowenbo/petsc path: /config/PETSc/options/arch.py
import config.base
import os
import re
class Configure(config.base.Configure):
def __init__(self, framework):
config.base.Configure.__init__(self, framework)
self.headerPrefix = 'PETSC'
self.substPrefix = 'PETSC'
return
de... | code_fim | hard | {
"lang": "python",
"repo": "zhaowenbo/petsc",
"path": "/config/PETSc/options/arch.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''Checks if configure needs to be run'''
'''Checks if files in config have changed, the command line options have changed or the PATH has changed'''
import os
import sys
import hashlib
hashfile = os.path.join(self.arch,'lib','petsc','conf','configure-hash')
args = sorted(set(f... | code_fim | hard | {
"lang": "python",
"repo": "zhaowenbo/petsc",
"path": "/config/PETSc/options/arch.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>@pytest.fixture
def xdist_runner(allure_pytest_runner: AllurePytestRunner):
allure_pytest_runner.in_memory = False
allure_pytest_runner.enable_plugins("xdist")
yield allure_pytest_runner
@allure.issue("292")
@allure.feature("Integration")
def test_xdist_and_select_test_by_bdd_label(xdist_run... | code_fim | medium | {
"lang": "python",
"repo": "allure-framework/allure-python",
"path": "/tests/allure_pytest/externals/pytest_xdist/pytest_xdist_select_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: allure-framework/allure-python path: /tests/allure_pytest/externals/pytest_xdist/pytest_xdist_select_test.py
import pytest
from hamcrest import assert_that, ends_with, has_entry
from tests.allure_pytest.pytest_runner import AllurePytestRunner
import allure
from allure_commons_test.report import ... | code_fim | hard | {
"lang": "python",
"repo": "allure-framework/allure-python",
"path": "/tests/allure_pytest/externals/pytest_xdist/pytest_xdist_select_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DincerDogan/Data-Science-Learning-Path path: /Data Scientist Career Path/7. Summary Statistics/7. Visualizing Categorical Data/2. Pie/1. matplotlib.py
import matplotlib.pyplot as plt
import pandas as pd
import codecademylib3
<|fim_suffix|>wedge_sizes = water_usage['prop']
pie_labels = water_usag... | code_fim | medium | {
"lang": "python",
"repo": "DincerDogan/Data-Science-Learning-Path",
"path": "/Data Scientist Career Path/7. Summary Statistics/7. Visualizing Categorical Data/2. Pie/1. matplotlib.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>wedge_sizes = water_usage['prop']
pie_labels = water_usage['water_source']
plt.pie(wedge_sizes, labels = pie_labels)
plt.axis('equal')
plt.title('Distribution of House Water Usage')
plt.show()<|fim_prefix|># repo: DincerDogan/Data-Science-Learning-Path path: /Data Scientist Career Path/7. Summary Statis... | code_fim | medium | {
"lang": "python",
"repo": "DincerDogan/Data-Science-Learning-Path",
"path": "/Data Scientist Career Path/7. Summary Statistics/7. Visualizing Categorical Data/2. Pie/1. matplotlib.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>plt.pie(wedge_sizes, labels = pie_labels)
plt.axis('equal')
plt.title('Distribution of House Water Usage')
plt.show()<|fim_prefix|># repo: DincerDogan/Data-Science-Learning-Path path: /Data Scientist Career Path/7. Summary Statistics/7. Visualizing Categorical Data/2. Pie/1. matplotlib.py
import matplotl... | code_fim | medium | {
"lang": "python",
"repo": "DincerDogan/Data-Science-Learning-Path",
"path": "/Data Scientist Career Path/7. Summary Statistics/7. Visualizing Categorical Data/2. Pie/1. matplotlib.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def feh(self, filenames: list[str]):
"""Human review for outliers, use C-Del to remove bad examples."""
feh = "/usr/bin/feh --on-last-slide quit".split()
temp = {f: self.bbox(f) for f in filenames}
feh.extend(temp.values())
subprocess.run(feh, check=True)
... | code_fim | hard | {
"lang": "python",
"repo": "jcrocholl/sorter",
"path": "/outliers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("name:", self.name)
print("total:", self.total)
print("min:", self.min)
print("max:", self.max)
percentile = {}
for p in (1, 2, 5, 10, 20, 50, 80, 90, 95, 98, 99):
n = self.percentile(p)
percentile[n] = p
for n in range(... | code_fim | hard | {
"lang": "python",
"repo": "jcrocholl/sorter",
"path": "/outliers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jcrocholl/sorter path: /outliers.py
#!/usr/bin/env python3
from collections import defaultdict
from collections.abc import Iterable
import os
import re
import subprocess
import cv2
RED = (0, 0, 255)
GREEN = (0, 255, 0)
BLUE = (255, 0, 0)
class Histogram:
def __init__(self, name: str, reg... | code_fim | hard | {
"lang": "python",
"repo": "jcrocholl/sorter",
"path": "/outliers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for d in data:
player, state, action = d
action_score = score
if player == 2:
state = tuple(2 if s == 1 else 1 for s in state)
action_score = -action_score
states[state]['total_reward'][action] += action_score
states[state]['count'][actio... | code_fim | hard | {
"lang": "python",
"repo": "jmhummel/Tic-Tac-Toe-ML",
"path": "/ml.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jmhummel/Tic-Tac-Toe-ML path: /ml.py
import random
from collections import defaultdict
from keras.models import Sequential
from keras.layers import Dense
import numpy as np
from tic_tac_toe import TicTacToe
def default_factory():
<|fim_suffix|>model = Sequential()
model.add(Dense(units=64, a... | code_fim | hard | {
"lang": "python",
"repo": "jmhummel/Tic-Tac-Toe-ML",
"path": "/ml.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>setup = format3.setup()
G, o, g, o_bytes = setup
secret = petlib.pack.decode(file("secretProvider.prv", "rb").read())
_, name, port, host, _ = petlib.pack.decode(file("publicProvider.bin", "rb").read())
try:
provider = Provider(name, port, host, setup, privk=secret)
#provider.readInData('example.db')... | code_fim | hard | {
"lang": "python",
"repo": "grnet/loopix",
"path": "/loopix/run_provider.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def lineReceived(self, line):
if line.upper() == "-P":
print self.provider
elif line.upper() == "-R":
self.provider.readMixnodesFromDatabase('example.db')
elif line.upper() == "-E":
reactor.stop()
else:
print "Command not found."
self.transport.write(">>>")
setup = format3.setup()... | code_fim | medium | {
"lang": "python",
"repo": "grnet/loopix",
"path": "/loopix/run_provider.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: grnet/loopix path: /loopix/run_provider.py
import os
import sys
current_path = os.getcwd()
print "Current path %s" % current_path
sys.path += [current_path]
from provider import Provider
import format3
from twisted.internet import reactor, stdio
from twisted.protocols import basic
from twisted.a... | code_fim | medium | {
"lang": "python",
"repo": "grnet/loopix",
"path": "/loopix/run_provider.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>gLength2
__all__ = [
"NistschemaSvIvListNormalizedStringLength2",
]<|fim_prefix|># repo: tefra/xsdata-w3c-tests path: /output/models/nist_data/list_pkg/normalized_string/schema_instance/nistschema_sv_iv_list_normalized_string_length_2_xsd/__init__.py
from output.models.nist_data.list_pkg.normalized_... | code_fim | medium | {
"lang": "python",
"repo": "tefra/xsdata-w3c-tests",
"path": "/output/models/nist_data/list_pkg/normalized_string/schema_instance/nistschema_sv_iv_list_normalized_string_length_2_xsd/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ist_normalized_string_length_2 import NistschemaSvIvListNormalizedStringLength2
__all__ = [
"NistschemaSvIvListNormalizedStringLength2",
]<|fim_prefix|># repo: tefra/xsdata-w3c-tests path: /output/models/nist_data/list_pkg/normalized_string/schema_instance/nistschema_sv_iv_list_normalized_string_len... | code_fim | medium | {
"lang": "python",
"repo": "tefra/xsdata-w3c-tests",
"path": "/output/models/nist_data/list_pkg/normalized_string/schema_instance/nistschema_sv_iv_list_normalized_string_length_2_xsd/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tefra/xsdata-w3c-tests path: /output/models/nist_data/list_pkg/normalized_string/schema_instance/nistschema_sv_iv_list_normalized_string_length_2_xsd/__init__.py
from output.models.nist_data.list_pkg.normalized_string.schema_instance<|fim_suffix|>ist_normalized_string_length_2 import NistschemaSv... | code_fim | medium | {
"lang": "python",
"repo": "tefra/xsdata-w3c-tests",
"path": "/output/models/nist_data/list_pkg/normalized_string/schema_instance/nistschema_sv_iv_list_normalized_string_length_2_xsd/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># perm_prop = lambda p: p.avoids([2,3,1])
# perm_prop = lambda p: stack_sort(p) == range(1,len(p)+1)
# perm_bound = 7
# # inp_dag = permstruct.dag.N_P_X(perm_prop, perm_bound)
# max_rule_size = (3, 3)
# max_non_empty = 4
# max_rules = 100
# ignored = 1
#-- 2-passes --#
# No luck with... | code_fim | hard | {
"lang": "python",
"repo": "PermutaTriangle/PermStruct",
"path": "/scratch/test_sortable.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PermutaTriangle/PermStruct path: /scratch/test_sortable.py
import permstruct
import permstruct.dag
from permstruct.lib import Permutations
def loc_max(w):
'''
Helper function for stack-sort and bubble-sort. Returns the index of the
maximal element in w. It is assumed that w is non-em... | code_fim | hard | {
"lang": "python",
"repo": "PermutaTriangle/PermStruct",
"path": "/scratch/test_sortable.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|># The perm_props are of course the same
# perm_prop = lambda p: p.avoids([2,3,1])
# perm_prop = lambda p: stack_sort(p) == range(1,len(p)+1)
# perm_bound = 7
# # inp_dag = permstruct.dag.N_P_X(perm_prop, perm_bound)
# max_rule_size = (3, 3)
# max_non_empty = 4
# max_rules = 100
# ignored ... | code_fim | hard | {
"lang": "python",
"repo": "PermutaTriangle/PermStruct",
"path": "/scratch/test_sortable.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_finished_path():
finished_path = []
for s in app_config["ydl_options"].get("output").split("/"):
if "%" in s and "%%" not in s:
break
finished_path.append(s)
finished_path = "/".join(finished_path) + "/"
if not os.path.isdir(finished_path):
os.mk... | code_fim | hard | {
"lang": "python",
"repo": "nbr23/youtube-dl-server",
"path": "/ydl_server/config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nbr23/youtube-dl-server path: /ydl_server/config.py
import os
import yaml
import shutil
YDL_FORMATS = {
"Video": {
"video/best": "Best",
"video/bestvideo": "Best Video",
"video/mp4": "MP4",
"video/flv": "Flash Video (FLV)",
"video/webm": "WebM",
... | code_fim | hard | {
"lang": "python",
"repo": "nbr23/youtube-dl-server",
"path": "/ydl_server/config.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not os.path.isfile(config_file_path):
print("{} does not exist, creating it from default values".format(config_file_path))
copy_default_config(config_file_path)
with open(config_file_path) as configfile:
config = yaml.load(configfile, Loader=yaml.SafeLoader)
return ... | code_fim | hard | {
"lang": "python",
"repo": "nbr23/youtube-dl-server",
"path": "/ydl_server/config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shinh/chainer-compiler path: /chainer_compiler/elichika/links_builtin.py
import chainer
import chainer.functions as F
import chainer.links as L
import onnx
import onnx.helper as oh
from onnx import numpy_helper
from onnx import TensorProto
from onnx import ModelProto
from chainer_compiler.elich... | code_fim | hard | {
"lang": "python",
"repo": "shinh/chainer-compiler",
"path": "/chainer_compiler/elichika/links_builtin.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def convert_onnx_chainer_NStepBiLSTM(onnx_graph: 'ONNXGraph', node: 'nodes.NodeCall'):
chainer_inst = node.func.owner.inst # type: chainer.links.NStepBiLSTM
hd = chainer_inst.children().__next__()
if not(hd.w0 is None):
n_in = hd.w0.shape[1]
else:
n_in = None
out_s... | code_fim | hard | {
"lang": "python",
"repo": "shinh/chainer-compiler",
"path": "/chainer_compiler/elichika/links_builtin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> onnx_graph.add_node(
'Conv',
[x, w] + ([] if b is None else [b]),
[o],
str(node.lineprop),
kernel_shape=ksize,
pads=pads,
strides=stride)
def convert_onnx_chainer_batch_normalization(onnx_graph: 'ONNXGraph', node: 'nodes.NodeCall'):
chainer... | code_fim | hard | {
"lang": "python",
"repo": "shinh/chainer-compiler",
"path": "/chainer_compiler/elichika/links_builtin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: omidtarh/iranian-BOT path: /seed/decorators.py
"""
:copyright: (c) 2014 Building Energy Inc
"""
from functools import wraps
from seed.utils.cache import make_key, lock_cache, unlock_cache, get_lock
SEED_CACHE_PREFIX = 'SEED:{0}'
LOCK_CACHE_PREFIX = SEED_CACHE_PREFIX + ':LOCK'
PROGRESS_CACHE_PRE... | code_fim | medium | {
"lang": "python",
"repo": "omidtarh/iranian-BOT",
"path": "/seed/decorators.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> return _get_cache_key(
LOCK_CACHE_PREFIX.format(func_name), import_file_pk
)
def get_prog_key(func_name, import_file_pk):
"""Return the progress key for the cache"""
return _get_cache_key(
PROGRESS_CACHE_PREFIX.format(func_name), import_file_pk
)
def lock_and_track(... | code_fim | medium | {
"lang": "python",
"repo": "omidtarh/iranian-BOT",
"path": "/seed/decorators.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> + otDigiValid
+ rechitValidIT
)<|fim_prefix|># repo: aebid/cmssw path: /Validation/SiTrackerPhase2V/python/Phase2TrackerValidationFirstStep_cff.py
import FWCore.ParameterSet.Config as cms
from Validation.SiTrackerPhase2V.Phase2TrackerValidateDig... | code_fim | hard | {
"lang": "python",
"repo": "aebid/cmssw",
"path": "/Validation/SiTrackerPhase2V/python/Phase2TrackerValidationFirstStep_cff.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aebid/cmssw path: /Validation/SiTrackerPhase2V/python/Phase2TrackerValidationFirstStep_cff.py
import FWCore.ParameterSet.Config as cms
from Validation.SiTrackerPhase2V.Phase2TrackerVali<|fim_suffix|> + otDigiValid
+ rechitValidIT
)<|fim_m... | code_fim | hard | {
"lang": "python",
"repo": "aebid/cmssw",
"path": "/Validation/SiTrackerPhase2V/python/Phase2TrackerValidationFirstStep_cff.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jdf/processing.py path: /mode/examples/Topics/Shaders/EdgeFilter/EdgeFilter.pyde
"""
Edge Filter
Apply a custom shader to the filter() function to affect the geometry drawn to the screen.
<|fim_suffix|>edges = None
applyFilter = True
def setup():
global edges
size(640, 360, P3D)
e... | code_fim | medium | {
"lang": "python",
"repo": "jdf/processing.py",
"path": "/mode/examples/Topics/Shaders/EdgeFilter/EdgeFilter.pyde",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.