text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: lgbouma/cdips path: /cdips/catalogbuild/construct_unique_cluster_name_column.py
tains(k)].iloc[0]
return uname
if (
pd.isnull(mdfr['k13_name_match']) and
mdfr['why_not_in_k13'] in
['is_gagne_mg','is_oh_mg','is_rizzuto_mg','is_bell_mg','is_kraus_mg']
):... | code_fim | hard | {
"lang": "python",
"repo": "lgbouma/cdips",
"path": "/cdips/catalogbuild/construct_unique_cluster_name_column.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>m = folium.Map([40, -100], zoom_start=4, control_scale=True, tiles='cartodbpositron')
for index, row in laws.iterrows():
category = row['category']
location = row['location']
level = row['level']
folium.Marker(
location=[row['lat'], row['long']],
popup=f'<h3>Category</h3>{... | code_fim | hard | {
"lang": "python",
"repo": "tooabown/leaflet-gsheets",
"path": "/folium-gspread/folium-gspread.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def highlight_function(feature):
return {
'fillColor': '#2ca25f',
'color': 'green',
'weight': 3
}
for key, value in states_dict.items():
if len(value['summary']) > 0:
c = folium.GeoJson(
value['geom'],
style_function=style_function,
... | code_fim | hard | {
"lang": "python",
"repo": "tooabown/leaflet-gsheets",
"path": "/folium-gspread/folium-gspread.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tooabown/leaflet-gsheets path: /folium-gspread/folium-gspread.py
import numpy as np
import pandas as pd
from shapely.geometry import Point
import folium
import geopandas as gpd
from shapely.wkt import loads
from math import isnan
import gspread
from oauth2client.service_account import ServiceAcco... | code_fim | hard | {
"lang": "python",
"repo": "tooabown/leaflet-gsheets",
"path": "/folium-gspread/folium-gspread.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Gets the latitude of the intersection."""
if self.buffer == None :
self.buffer = self.fetch ()
return self.buffer.latitude
## private (unpublished) support routines
def fetch (self) :
return Intersection2d.get (gid=self.ident)<|fim_prefix... | code_fim | hard | {
"lang": "python",
"repo": "CityofEdmonton/bikespace",
"path": "/bicycleparking/intersection.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CityofEdmonton/bikespace path: /bicycleparking/intersection.py
# MIT License
# Copyright 2017, Cycle Toronto
# written by and for the bicycle parking project, a joint project of
# Civic Tech Toronto, Cycle Toronto, Code 4 Canada, and the
# City of Toronto
#
# Written 2017 10 15
#
# Modified
# ... | code_fim | hard | {
"lang": "python",
"repo": "CityofEdmonton/bikespace",
"path": "/bicycleparking/intersection.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def getType (self) :
"""Gets a string description of the intersection type (major, minor,
one/two level, cul de sac, etc)."""
if self.buffer == None :
self.buffer = self.fetch ()
return self.buffer.classifi7
def getLongitude (self) :
"""Gets th... | code_fim | hard | {
"lang": "python",
"repo": "CityofEdmonton/bikespace",
"path": "/bicycleparking/intersection.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mysidewalk/pykc-meetup1 path: /demo/apps/common/middleware.py
""" Common middleware items
"""
from django.core import urlresolvers
<|fim_suffix|> viewset = func.cls
model = viewset.model
except:
viewset, model = None, None
return viewset, model
... | code_fim | hard | {
"lang": "python",
"repo": "mysidewalk/pykc-meetup1",
"path": "/demo/apps/common/middleware.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> viewset = func.cls
model = viewset.model
except:
viewset, model = None, None
return viewset, model
def process_request(self, request):
viewset, model = self.resolve_request(request)
request.model = model
request.viewset =... | code_fim | medium | {
"lang": "python",
"repo": "mysidewalk/pykc-meetup1",
"path": "/demo/apps/common/middleware.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ckeitt/llama path: /django/llama/vehicle/models.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import random
from llama import settings
from django.contrib.gis.db import models
from django.dispatch import receiver
from django.db.models.signals import post_save
class Vehicl... | code_fim | hard | {
"lang": "python",
"repo": "ckeitt/llama",
"path": "/django/llama/vehicle/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> random_qr = random.randint(10**(settings.QR_CODE_LENGTH-1), (10**settings.QR_CODE_LENGTH)-1)
while (Vehicle.objects.filter(qr_verification_code=random_qr).count() > 0):
random_qr = random.randint(10**(settings.QR_CODE_LENGTH-1), (10**settings.QR_CODE_LENGTH)-1)
random... | code_fim | medium | {
"lang": "python",
"repo": "ckeitt/llama",
"path": "/django/llama/vehicle/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: UnbFeelings/unb-feelings-api path: /api/fixtures/scripts/load_dev_data.py
from api.models import Course, Post, Student, Subject, Tag
print("GETTINGS courses")
engenharia = Course.objects.get(name="ENGENHARIA")
software = Course.objects.get(name="SOFTWARE")
eletronica = Course.objects.get(name="E... | code_fim | hard | {
"lang": "python",
"repo": "UnbFeelings/unb-feelings-api",
"path": "/api/fixtures/scripts/load_dev_data.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print("\nPOST")
contents = [
"Trueborn son of Lannister.",
"Tell my lord father",
"Jon said.",
"He favored Jon with a rueful grin.",
"All dwarfs may be bastards",
"Whistling a tune.",
"Just a moment",
"Tyrion Lannister stood tall as a king.",
"― George R.R. Martin",
]
... | code_fim | hard | {
"lang": "python",
"repo": "UnbFeelings/unb-feelings-api",
"path": "/api/fixtures/scripts/load_dev_data.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chywoo/py_posixtools path: /pxt/process.py
import psutil
import platform
__author__ = 'Sungho Park'
def ps():
"""
Display process list. Processes which you do not have permission are not displayed.
"""
for p in psutil.process_iter():
try:
pid = p.pid
... | code_fim | hard | {
"lang": "python",
"repo": "chywoo/py_posixtools",
"path": "/pxt/process.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if platform.system() == "Windows":
name += ".exe"
for ps in psutil.process_iter():
cmdline = ""
try:
if ps.name() != name:
continue
if params:
cmdline = ps.cmdline()
except psutil.AccessDenied:
co... | code_fim | hard | {
"lang": "python",
"repo": "chywoo/py_posixtools",
"path": "/pxt/process.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: punkdit/bruhat path: /bruhat/geometry.py
ag, nbd
for i in nbd:
if i in flag:
continue
yield flag+[i]
for _flag in self.ordered_flags(flag+[i]):
yield _flag
def all_flags(self):
flags = [flag for flag in self.... | code_fim | hard | {
"lang": "python",
"repo": "punkdit/bruhat",
"path": "/bruhat/geometry.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: punkdit/bruhat path: /bruhat/geometry.py
graphs[tp].add_edge(flag, _flag)
# union graph
graph = nx.Graph()
for i in flags:
graph.add_node(i)
for tp, equ in list(graphs.items()):
for flag, _flag in nx.edges(equ):
graph.... | code_fim | hard | {
"lang": "python",
"repo": "punkdit/bruhat",
"path": "/bruhat/geometry.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test():
# triangle:
g = Geometry(
"aB aC bA bC cB cA".split(),
{'a':'p', 'b':'p', 'c':'p', 'A':'l', 'B':'l', 'C':'l'})
assert len(g.items) == 6
#print g.flags_type('l')
#print g.flags_type('p')
#g = g.residue(["a"])
for n in range(2, 7):
g = ... | code_fim | hard | {
"lang": "python",
"repo": "punkdit/bruhat",
"path": "/bruhat/geometry.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: liyaochong/robot path: /Mobile-Robot-Foundation/p3/p3.py
import numpy as np
from matplotlib import pyplot as plt
def sense(p, z, world, pHit, pMiss):
q = np.zeros(np.size(p))
for i in range(len(p)):
hit = cmp(z, world[i])
q[i] = (p[i] * (hit * pHit + (1 - hit) * pMiss))
... | code_fim | hard | {
"lang": "python",
"repo": "liyaochong/robot",
"path": "/Mobile-Robot-Foundation/p3/p3.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>world = np.array(['green', 'red', 'red', 'green', 'green'])
p = np.array([0.2, 0.2, 0.2, 0.2, 0.2]) # Prior
measurements=np.array(['red', 'red','green']) # Observation
pHit = 0.6 # Observation model
pMiss = 0.2
for k in range(len(measurements)):
q = sense(p, me... | code_fim | medium | {
"lang": "python",
"repo": "liyaochong/robot",
"path": "/Mobile-Robot-Foundation/p3/p3.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: qianjinfighter/py_tutorials path: /earlier-2020/TF_codes/tf_new_tutorials/_test_tf_ckpt/restore_model.py
'''Restores a model from checkpoint and evaluates it on CIFAR-10'''
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensor... | code_fim | hard | {
"lang": "python",
"repo": "qianjinfighter/py_tutorials",
"path": "/earlier-2020/TF_codes/tf_new_tutorials/_test_tf_ckpt/restore_model.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>"""
# checkpoint_path = os.path.join(FLAGS.train_dir, "tf_logs")
checkpoint_path = FLAGS.train_dir
reader = pywrap_tensorflow.NewCheckpointReader(checkpoint_path)
var_to_shape_map = reader.get_variable_to_shape_map()
for key in var_to_shape_map:
print("tensor_name: ", key)
print(reader.get_tensor(... | code_fim | hard | {
"lang": "python",
"repo": "qianjinfighter/py_tutorials",
"path": "/earlier-2020/TF_codes/tf_new_tutorials/_test_tf_ckpt/restore_model.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>saver = tf.train.Saver()
with tf.Session() as sess:
sess.run(tf.initialize_all_variables())
ckpt = tf.train.get_checkpoint_state(FLAGS.train_dir)
if ckpt and ckpt.model_checkpoint_path:
print('Restoring variables from checkpoint')
saver.restore(sess, ckpt.model_checkpoint_path... | code_fim | hard | {
"lang": "python",
"repo": "qianjinfighter/py_tutorials",
"path": "/earlier-2020/TF_codes/tf_new_tutorials/_test_tf_ckpt/restore_model.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Return a list of classes from a table."""
return [
utils.clean(row.find('a').get('title'))
for row in table.find('tbody').findAll('tr') if row.find('a')
]
def map_def_classes(self, table):
"""Given a table of classes, returns a MapperDefiniti... | code_fim | hard | {
"lang": "python",
"repo": "AviFS/berkeleytime",
"path": "/backend/playlist/resource/foreign_language.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AviFS/berkeleytime path: /backend/playlist/resource/foreign_language.py
"""Foreign Language resource."""
from urllib.request import urlopen
from bs4 import BeautifulSoup
from playlist.utils import utils
from playlist.utils.definition import MapperDefinition
class ForeignLanguageResource:
"... | code_fim | medium | {
"lang": "python",
"repo": "AviFS/berkeleytime",
"path": "/backend/playlist/resource/foreign_language.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Args:
module_name: The name to be given to the module.
source_code: The source code for the module.
origin: The origin of the module. Defaults to None.
Returns:
A new module from the source code.
"""
module = create_empty_module(module_name, origin)
exe... | code_fim | medium | {
"lang": "python",
"repo": "scorphus/importit",
"path": "/importit/util/module.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: scorphus/importit path: /importit/util/module.py
from importlib.util import spec_from_loader, module_from_spec
from types import ModuleType
def create_empty_module(module_name: str, origin: str = None) -> ModuleType:
"""Creates a blank module.
Args:
module_name: The name to be... | code_fim | medium | {
"lang": "python",
"repo": "scorphus/importit",
"path": "/importit/util/module.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> module_name: str, source_code: str, origin: str = None
) -> ModuleType:
"""Creates a module from python code.
Args:
module_name: The name to be given to the module.
source_code: The source code for the module.
origin: The origin of the module. Defaults to None.
Re... | code_fim | medium | {
"lang": "python",
"repo": "scorphus/importit",
"path": "/importit/util/module.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return False
class OrderModelAdmin(ReadOnlyModelAdmin):
list_per_page = 20
search_fields = ('order_content',)
list_display = (
'id', 'third_orderid', 'order_status', 'usermodel', 'username', 'target_username', 'txid', 'fee',
'created_time')
list_filter = ('order_s... | code_fim | hard | {
"lang": "python",
"repo": "XiaoBiaoBai/xiaobiaobai.api",
"path": "/orders/admin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> list_per_page = 20
search_fields = ('order_content',)
list_display = (
'id', 'third_orderid', 'order_status', 'usermodel', 'username', 'target_username', 'txid', 'fee',
'created_time')
list_filter = ('order_status', 'city', 'fee')
def get_actions(self, request):
... | code_fim | medium | {
"lang": "python",
"repo": "XiaoBiaoBai/xiaobiaobai.api",
"path": "/orders/admin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: XiaoBiaoBai/xiaobiaobai.api path: /orders/admin.py
from django.contrib import admin
# Register your models here.
from .models import WxOrderModel, OrderModel, BlessingModel
from accounts.models import UserModel
from django.urls import reverse
from django.utils.html import format_html
class Re... | code_fim | hard | {
"lang": "python",
"repo": "XiaoBiaoBai/xiaobiaobai.api",
"path": "/orders/admin.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Qix-/starfuse path: /starfuse/main.py
"""StarFuse, the StarBound packfile FUSE filesystem
This program allows you to mount StarBound PAK files as a directory,
granting you the ability to work directly within the PAK file instead
of having to unpack/re-pack it over and over again.
"""
import log... | code_fim | medium | {
"lang": "python",
"repo": "Qix-/starfuse",
"path": "/starfuse/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """StarFuse entry point"""
log.info('starting StarFuse')
log.info('mounting pakfile %s as %s', config.pak_file, ('read-only' if config.read_only else 'read/write'))
pak = FusePAK(config.pak_file, page_count=config.page_count, read_only=config.read_only)
log.info('mounting on %s', confi... | code_fim | medium | {
"lang": "python",
"repo": "Qix-/starfuse",
"path": "/starfuse/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wafiqtaher/TheQube path: /src/url_shortener/shorteners/__init__.py
from url_shortener import URLShortener
# from hkcim import HKCShortener
from isgd import IsgdShortener
from googl import GooglShortener
# from onjme import <|fim_suffix|>, "IsgdShortener", "TinyArrowsShortener", "TinyurlShorte... | code_fim | hard | {
"lang": "python",
"repo": "wafiqtaher/TheQube",
"path": "/src/url_shortener/shorteners/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>aShortener
from readability import ReadabilityShortener
from qpsru import QpsruShortener
from uxnu import UxnuShortener
__all__ = sorted(["GooglShortener", "IsgdShortener", "TinyArrowsShortener", "TinyurlShortener", "ClckruShortener", "SentalaShortener", "ReadabilityShortener", "QpsruShortener", "Ux... | code_fim | medium | {
"lang": "python",
"repo": "wafiqtaher/TheQube",
"path": "/src/url_shortener/shorteners/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: City-of-Turku/munpalvelut_backend path: /logger/tests.py
from django.core.urlresolvers import reverse
from django.utils import timezone
from rest_framework.test import APITestCase
from rest_framework import status
from palvelutori.test_mixins import BasicCRUDApiTestCaseSetupMixin
from logger.mod... | code_fim | hard | {
"lang": "python",
"repo": "City-of-Turku/munpalvelut_backend",
"path": "/logger/tests.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Test creation
user = self.template_users['normal_user1']
self.client.login(email=user['email'], password=user['password'])
response = self.client.post(url, {
'message': 'Anon test',
'severity': 0,
'category': 'test',
})
... | code_fim | hard | {
"lang": "python",
"repo": "City-of-Turku/munpalvelut_backend",
"path": "/logger/tests.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def ruby_cas(auth_success, attrs):
style = etree.SubElement(auth_success, CAS + 'attraStyle')
style.text = 'RubyCAS'
for name, value in sorted(attrs.items()):
if isinstance(value, collections.abc.Iterable) and not isinstance(value, basestring):
for e in value:
... | code_fim | hard | {
"lang": "python",
"repo": "fnp/django-cas-provider",
"path": "/cas_provider/attribute_formatters.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fnp/django-cas-provider path: /cas_provider/attribute_formatters.py
from lxml import etree
import collections
CAS_URI = 'http://www.yale.edu/tp/cas'
NSMAP = {'cas': CAS_URI}
CAS = '{%s}' % CAS_URI
try:
basestring
except NameError:
basestring = (str, bytes)
<|fim_suffix|>
def ruby_cas(... | code_fim | hard | {
"lang": "python",
"repo": "fnp/django-cas-provider",
"path": "/cas_provider/attribute_formatters.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bionick87/DiameterNet path: /train.py
id_Diam_MSE(self):
MSEfileDiam = os.path.join(self.validSavePath,\
"ValidLossDiam.txt")
minindexDiam = self.getMinIndexDiam(MSEfileDiam)
return minindexDiam
def getDiamEsimation(self,gtVal,\... | code_fim | hard | {
"lang": "python",
"repo": "bionick87/DiameterNet",
"path": "/train.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> MSEfileDiam = os.path.join(self.validSavePath,\
"ValidLossDiam.txt")
minindexDiam = self.getMinIndexDiam(MSEfileDiam)
return minindexDiam
def getDiamEsimation(self,gtVal,\
predVal,typePred,p):
typeName ... | code_fim | hard | {
"lang": "python",
"repo": "bionick87/DiameterNet",
"path": "/train.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bionick87/DiameterNet path: /train.py
T(MSEfileIMT)
return minindexIMT
def getMinValid_Diam_MSE(self):
MSEfileDiam = os.path.join(self.validSavePath,\
"ValidLossDiam.txt")
minindexDiam = self.getMinIndexDiam(MSEfileDiam)
... | code_fim | hard | {
"lang": "python",
"repo": "bionick87/DiameterNet",
"path": "/train.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> inputs = [str(i) for i in range(100)]
solver = ParallelSolver()
outputs = solver.execute(func, inputs, num_workers=50, print_status=True)
print(outputs)
if __name__ == '__main__':
main()<|fim_prefix|># repo: brn-dev/CC_Lib path: /Python/main.py
import math
import time
from cclib.... | code_fim | medium | {
"lang": "python",
"repo": "brn-dev/CC_Lib",
"path": "/Python/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: brn-dev/CC_Lib path: /Python/main.py
import math
import time
from cclib.parallel import ParallelSolver
<|fim_suffix|>def main():
inputs = [str(i) for i in range(100)]
solver = ParallelSolver()
outputs = solver.execute(func, inputs, num_workers=50, print_status=True)
print(outpu... | code_fim | medium | {
"lang": "python",
"repo": "brn-dev/CC_Lib",
"path": "/Python/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Metrics associated apis"""
def get_app_history_metrics(self, cluster_id, app_alias):
"""List app history metrics"""
resp = self.http.get(url_maker("/clusters", cluster_id, "apps",
app_alias, "monitor"))
return self.process_data(r... | code_fim | medium | {
"lang": "python",
"repo": "Dataman-Cloud/python-sryapicli",
"path": "/python-sryapicli/omegaclient/metrics.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Dataman-Cloud/python-sryapicli path: /python-sryapicli/omegaclient/metrics.py
# Copyright (c) 2016 Dataman Cloud
# 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
# ... | code_fim | medium | {
"lang": "python",
"repo": "Dataman-Cloud/python-sryapicli",
"path": "/python-sryapicli/omegaclient/metrics.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class GenerateStreamRequest(pydantic.BaseModel):
inputs: str
parameters: GenerateStreamParameters
class Token(pydantic.BaseModel):
text: str
logprob: float | None
id: int
def __len__(self) -> int:
return len(self.text)
def to_token_response(self, request_id: str) -... | code_fim | hard | {
"lang": "python",
"repo": "LAION-AI/Open-Assistant",
"path": "/inference/worker/interface.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LAION-AI/Open-Assistant path: /inference/worker/interface.py
from typing import Literal
import pydantic
from oasst_shared.schemas import inference
class GenerateStreamParameters(pydantic.BaseModel):
max_new_tokens: int = 1024
do_sample: bool = True
top_k: int | None = None
top_... | code_fim | medium | {
"lang": "python",
"repo": "LAION-AI/Open-Assistant",
"path": "/inference/worker/interface.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> generated_tokens: int
seed: int | None
finish_reason: Literal["length", "eos_token", "stop_sequence"]
class GenerateStreamResponse(pydantic.BaseModel):
token: Token | None
generated_text: str | None
details: StreamDetails | None
error: str | None
@property
def is_end... | code_fim | medium | {
"lang": "python",
"repo": "LAION-AI/Open-Assistant",
"path": "/inference/worker/interface.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: krenshaw2018/tensor2tensor path: /tensor2tensor/data_generators/multilabeling_legal.py
# coding=utf-8
# Copyright 2017 The Tensor2Tensor Authors.
#
# 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": "krenshaw2018/tensor2tensor",
"path": "/tensor2tensor/data_generators/multilabeling_legal.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return "vocab.labeling.it"
def generator(self, data_dir, tmp_dir, train):
vocab = generator_utils.get_or_generate_vocab(
data_dir, tmp_dir, self.vocab_file, self.targeted_vocab_size, [_TRAIN_DATASETS["it"]])
datasets = _TRAIN_DATASETS["it"] if train else _TEST_DATA... | code_fim | hard | {
"lang": "python",
"repo": "krenshaw2018/tensor2tensor",
"path": "/tensor2tensor/data_generators/multilabeling_legal.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 150619/Practice_mall_B path: /meiduo_mall/celery_tasks/main.py
from celery import Celery
<|fim_suffix|>celery_app.config_from_object('celery_tasks.config')
celery_app.autodiscover_tasks(['celery_tasks.sms'])<|fim_middle|># 创建celery对象
celery_app = Celery('meiduo')
| code_fim | easy | {
"lang": "python",
"repo": "150619/Practice_mall_B",
"path": "/meiduo_mall/celery_tasks/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>celery_app.config_from_object('celery_tasks.config')
celery_app.autodiscover_tasks(['celery_tasks.sms'])<|fim_prefix|># repo: 150619/Practice_mall_B path: /meiduo_mall/celery_tasks/main.py
from celery import Celery
<|fim_middle|># 创建celery对象
celery_app = Celery('meiduo')
| code_fim | easy | {
"lang": "python",
"repo": "150619/Practice_mall_B",
"path": "/meiduo_mall/celery_tasks/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mehta-lab/reconstruct-order path: /tests/integration_tests/multidim_complete_pipeline_tests.py
# bchhun, {2019-12-12}
from ReconstructOrder.workflow.reconstructBatch import reconstruct_batch
import os, glob
import tifffile as tf
import pytest
import numpy as np
from ..testMetrics import mse
d... | code_fim | hard | {
"lang": "python",
"repo": "mehta-lab/reconstruct-order",
"path": "/tests/integration_tests/multidim_complete_pipeline_tests.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> p_sort = sorted(processed_files)
s_sort = sorted(target_files)
for idx, file in enumerate(p_sort):
if os.path.basename(file) == os.path.basename(s_sort[idx]):
predict = tf.imread(file)
target = tf.imread(s_sort[idx])
try:
assert mse... | code_fim | hard | {
"lang": "python",
"repo": "mehta-lab/reconstruct-order",
"path": "/tests/integration_tests/multidim_complete_pipeline_tests.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>_module import SparseLinearModule
__all__ = ["IdentityModule", "LSTMModule", "SparseLinearModule"]<|fim_prefix|># repo: tridao/metal path: /metal/modules/__init__.py
from .identity_module import IdentityModule
from <|fim_middle|>.lstm_module import LSTMModule
from .sparse_linear | code_fim | easy | {
"lang": "python",
"repo": "tridao/metal",
"path": "/metal/modules/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tridao/metal path: /metal/modules/__init__.py
from .identity_module import IdentityModule
from <|fim_suffix|>_module import SparseLinearModule
__all__ = ["IdentityModule", "LSTMModule", "SparseLinearModule"]<|fim_middle|>.lstm_module import LSTMModule
from .sparse_linear | code_fim | easy | {
"lang": "python",
"repo": "tridao/metal",
"path": "/metal/modules/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>entityModule", "LSTMModule", "SparseLinearModule"]<|fim_prefix|># repo: tridao/metal path: /metal/modules/__init__.py
from .identity_module import IdentityModule
from .lstm_module import LSTMModule
from .sparse_linear<|fim_middle|>_module import SparseLinearModule
__all__ = ["Id | code_fim | easy | {
"lang": "python",
"repo": "tridao/metal",
"path": "/metal/modules/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nbeckman/halotools path: /halotools/sim_manager/tests/test_tabular_ascii_reader.py
#!/usr/bin/env python
import os, shutil
import numpy as np
from unittest import TestCase
import pytest
from astropy.config.paths import _find_home
from ..tabular_ascii_reader import TabularAsciiReader
### De... | code_fim | hard | {
"lang": "python",
"repo": "nbeckman/halotools",
"path": "/halotools/sim_manager/tests/test_tabular_ascii_reader.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> @pytest.mark.slow
@pytest.mark.skipif('not APH_MACHINE')
def test_read_dummy_halo_catalog5(self):
"""
"""
fname = "/Users/aphearin/.astropy/cache/halotools/raw_halo_catalogs/bolplanck/rockstar/hlist_0.07812.list"
columns_to_keep_dict = {'spin_bullock': (43, 'f4... | code_fim | hard | {
"lang": "python",
"repo": "nbeckman/halotools",
"path": "/halotools/sim_manager/tests/test_tabular_ascii_reader.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> row_cut_eq_dict = {'spin_bullock': 0.5}
row_cut_neq_dict = {'spin_bullock': 0.5}
with pytest.raises(ValueError) as err:
reader = TabularAsciiReader(fname, columns_to_keep_dict,
row_cut_eq_dict = row_cut_eq_dict, row_cut_neq_dict=row_cut_neq_dict)
... | code_fim | hard | {
"lang": "python",
"repo": "nbeckman/halotools",
"path": "/halotools/sim_manager/tests/test_tabular_ascii_reader.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>header = """#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : %s
# @Author : %s
# @File : %s
# @Version : %s
\"\"\"Here's your Module Docstring!
Start More specific detail Docstring here!
\"\"\"
# Import the modules needed to run the script.
def main():
pass
if __name__ == '__main_... | code_fim | hard | {
"lang": "python",
"repo": "hehez/scripts_bak",
"path": "/pytemplate.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> pass
if __name__ == '__main__':
main()
""" % (time, auther, title, init_version)
filename = open(title, 'w')
filename.write(header)
filename.close()<|fim_prefix|># repo: hehez/scripts_bak path: /pytemplate.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 12/20/16 9:39PM
# @Author ... | code_fim | medium | {
"lang": "python",
"repo": "hehez/scripts_bak",
"path": "/pytemplate.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hehez/scripts_bak path: /pytemplate.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 12/20/16 9:39PM
# @Author : hehez
# @File : main.py
# @Version : 1.0.0
"""
A simple script to generate python file with header comment
"""
import os
from time import strftime
time = strftime... | code_fim | medium | {
"lang": "python",
"repo": "hehez/scripts_bak",
"path": "/pytemplate.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Nuitka/Nuitka path: /nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/lex.py
"""SCons.Tool.lex
Tool-specific initialization for lex.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
... | code_fim | hard | {
"lang": "python",
"repo": "Nuitka/Nuitka",
"path": "/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/lex.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Different options that are used to trigger the creation of extra files.
fileGenOptions = ["--header-file=", "--tables-file="]
lexflags = env.subst("$LEXFLAGS", target=target, source=source)
for option in SCons.Util.CLVar(lexflags):
for fileGenOption in fileGenOptions:
... | code_fim | hard | {
"lang": "python",
"repo": "Nuitka/Nuitka",
"path": "/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/lex.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>p3=subprocess.call('python /home/wang/CNN/test.py',shell=True)<|fim_prefix|># repo: wangzpeng/tf-faster-rcnn path: /data/whole.py
import subprocess
p1=subprocess.call('../tools/demo.py')
<|fim_middle|>p2=subprocess.call('python /home/wang/tf-faster-rcnn/tools/deal_roi.py',shell=True)
| code_fim | medium | {
"lang": "python",
"repo": "wangzpeng/tf-faster-rcnn",
"path": "/data/whole.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wangzpeng/tf-faster-rcnn path: /data/whole.py
import subprocess
p1=subprocess.call('../tools/demo.py')
<|fim_suffix|>p3=subprocess.call('python /home/wang/CNN/test.py',shell=True)<|fim_middle|>p2=subprocess.call('python /home/wang/tf-faster-rcnn/tools/deal_roi.py',shell=True)
| code_fim | medium | {
"lang": "python",
"repo": "wangzpeng/tf-faster-rcnn",
"path": "/data/whole.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return grid_mean, red_light_occ
def control_pid(self, waypoints, velocity, target, red_light):
''' Predicts vehicle control with a PID controller.
Args:
waypoints (tensor): output of self.plan()
velocity (tensor): speedometer input
'''
... | code_fim | hard | {
"lang": "python",
"repo": "jianshijim/neat",
"path": "/neat/architectures/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jianshijim/neat path: /neat/architectures/__init__.py
import numpy as np
import torch
from torch import nn
from .controller import PIDController
from .decoder import Decoder
from .encoder import Encoder
class AttentionField(nn.Module):
''' Occupancy and offset prediction with a recurrent ... | code_fim | hard | {
"lang": "python",
"repo": "jianshijim/neat",
"path": "/neat/architectures/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> angle = np.degrees(np.pi / 2 - np.arctan2(aim[1], aim[0])) / 90
angle_last = np.degrees(np.pi / 2 - np.arctan2(aim_last[1], aim_last[0])) / 90
angle_target = np.degrees(np.pi / 2 - np.arctan2(target[1], target[0])) / 90
# choice of point to aim for steering, removing outli... | code_fim | hard | {
"lang": "python",
"repo": "jianshijim/neat",
"path": "/neat/architectures/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>path = r'replays\14612289.fafreplay'
data = get_replay_bytes(path)
header, body = parser.parse(data).values()
# print(repl)
# mp = header['map']
# print(mp)
# print("HEADER")
# for key, it in header.items():
# print(key, )
# print(it)
cmds = set()
count = 0
for act in body['command... | code_fim | hard | {
"lang": "python",
"repo": "GrzegorzKrug/faf-replay-analyzer",
"path": "/src/reader_2.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
path = r'replays\14612289.fafreplay'
data = get_replay_bytes(path)
header, body = parser.parse(data).values()
# print(repl)
# mp = header['map']
# print(mp)
# print("HEADER")
# for key, it in header.items():
# print(key, )
# print(it)
cmds = set()
count = 0
for act in body['comma... | code_fim | hard | {
"lang": "python",
"repo": "GrzegorzKrug/faf-replay-analyzer",
"path": "/src/reader_2.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GrzegorzKrug/faf-replay-analyzer path: /src/reader_2.py
import base64
import json
import zlib
import zstd
import fafreplay
from fafreplay import Parser, commands
parser = Parser(
# Skip all commands except the ones defined here
# commands=[
# commands.... | code_fim | hard | {
"lang": "python",
"repo": "GrzegorzKrug/faf-replay-analyzer",
"path": "/src/reader_2.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: russab0/TFkit path: /tfkit/model/mcq/dataloader.py
import csv
from collections import defaultdict
from tqdm import tqdm
import tfkit.utility.tok as tok
def get_data_from_file(fpath):
tasks = defaultdict(list)
task = 'default'
tasks[task] = []
with open(fpath, encoding='utf') as ... | code_fim | hard | {
"lang": "python",
"repo": "russab0/TFkit",
"path": "/tfkit/model/mcq/dataloader.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> row_dict['target'] = [-1] * maxlen
if target is not None:
tokenized_target = []
targets_pointer = 0
for tok_pos, text in enumerate(tokenized_input):
if text == tok.tok_mask(tokenizer):
if targets_pointer == int(target)... | code_fim | hard | {
"lang": "python",
"repo": "russab0/TFkit",
"path": "/tfkit/model/mcq/dataloader.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>class ApplyBQSR(GATK):
name = "Apply BQSR"
mem_req = 8*1024
inputs = ['bam','recal']
outputs = ['bam']
# def map_inputs(self):
# d= dict([ ('bam',[p.get_output('bam')]) for p in self.parent.parents ])
# # d['recal'] = [bqsrG_tool.get_output('recal')]
# return d... | code_fim | hard | {
"lang": "python",
"repo": "Python3pkg/GenomeKey",
"path": "/obsolete/genomekey/tools/gatk.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Python3pkg/GenomeKey path: /obsolete/genomekey/tools/gatk.py
from cosmos.lib.ezflow.tool import Tool
from cosmos.Workflow.models import TaskFile
from cosmos.session import settings as cosmos_settings
import os
def list2input(l):
return "-I " +" -I ".join([str(x) for x in l])
def get_inter... | code_fim | hard | {
"lang": "python",
"repo": "Python3pkg/GenomeKey",
"path": "/obsolete/genomekey/tools/gatk.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>chart.set_xlabel("x axis")
chart.set_ylabel("y axis")
chart.set_zlabel("z axis")
pt.show()<|fim_prefix|># repo: rakesh-chinta/python-matplotlib path: /loop3d.py
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as pt
import numpy as np
<|fim_middle|>fig=pt.figure()
chart=fig.add_subplot... | code_fim | medium | {
"lang": "python",
"repo": "rakesh-chinta/python-matplotlib",
"path": "/loop3d.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rakesh-chinta/python-matplotlib path: /loop3d.py
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as pt
import numpy as np
fig=pt.figure()
<|fim_suffix|>chart.set_xlabel("x axis")
chart.set_ylabel("y axis")
chart.set_zlabel("z axis")
pt.show()<|fim_middle|>chart=fig.add_subplot... | code_fim | medium | {
"lang": "python",
"repo": "rakesh-chinta/python-matplotlib",
"path": "/loop3d.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SFPD/rlreloaded path: /throwaway/reshaped_breakout.py
from control4.misc.console_utils import call_and_print,Message
import os.path as osp
from control4.core.rollout import rollout
from control4.algs.save_load_utils import get_mdp,construct_agent,load_agent_and_mdp
from control4.maths.discount im... | code_fim | hard | {
"lang": "python",
"repo": "SFPD/rlreloaded",
"path": "/throwaway/reshaped_breakout.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>plt.figure(2)
plt.clf()
vs = []
cs = []
deltas = []
def plot_callback(arrs):
mdp.plot(arrs)
# vs.append(arrs['v'].sum())
vs.append(f(arrs['o'][:,goodinds]).sum())
cs.append(arrs['c'].sum())
if len(vs) > 1:
delta = cs[-1] + gamma * vs[-2] - vs[-1]
deltas.append(delta)
... | code_fim | hard | {
"lang": "python",
"repo": "SFPD/rlreloaded",
"path": "/throwaway/reshaped_breakout.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># for i in xrange(1):
# vtargs = []
# for (path,vold) in zip(paths,volds):
# c = path.c.sum(axis=1)[:-1]
# delta = c + gamma*vold[1:] - vold[:-1]
# vtarg = vold[:-1] + discount(delta,gamma*vf_lam)
# vtarg = np.concatenate([vtarg,[0]])
# vtargs.append(vtarg)
... | code_fim | hard | {
"lang": "python",
"repo": "SFPD/rlreloaded",
"path": "/throwaway/reshaped_breakout.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: justinharringa/aprendendo-python path: /dinheirosssss.py
jota = 800000.0
leta = 100000.0
jota_com_1000 = jota
leta_com_1000 = leta
for month in range(24):
print(f'jota com 1000: {jota_com_1000:.2f}')
print(f'leta com 1000: {jota_com_1000:.2f}')
jota_com_1000 += 1000
leta_com_1000 ... | code_fim | hard | {
"lang": "python",
"repo": "justinharringa/aprendendo-python",
"path": "/dinheirosssss.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>= jota + leta_com_1000
print(f'leta take 1000: jota: {jota:.2f} leta: {leta_com_1000:.2f} total = {leta_total:.2f}')
print(f'esse total tá egual? {round(jota_total, 2) == round(leta_total, 2)}')<|fim_prefix|># repo: justinharringa/aprendendo-python path: /dinheirosssss.py
jota = 800000.0
leta = 1... | code_fim | hard | {
"lang": "python",
"repo": "justinharringa/aprendendo-python",
"path": "/dinheirosssss.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>f2 = conn.create_file("test_asdf.h5", overwrite=True)
f2.delete()
# f2 = conn.create_file("test_asdf.h5", overwrite=True)
conn.close()<|fim_prefix|># repo: yetone/hurray path: /utils/test_bug.py
import logging
import hurraypy as hr
logger = logging.getLogger('hurraypy')
console = logging.StreamHandle... | code_fim | easy | {
"lang": "python",
"repo": "yetone/hurray",
"path": "/utils/test_bug.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yetone/hurray path: /utils/test_bug.py
import logging
import hurraypy as hr
logger = logging.getLogger('hurraypy')
console = logging.StreamHandler()
console.setLevel(logging.DEBUG)
console.setFormatter(logging.Formatter('%(levelname)s --- %(message)s'))
logger.addHandler(console)
logger.setLev... | code_fim | easy | {
"lang": "python",
"repo": "yetone/hurray",
"path": "/utils/test_bug.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> class Meta:
model = models.Transport
fields = {
'departure_time': ['exact', 'lte', 'gte'],
'departure_location': ['exact'],
'arrival_location': ['exact'],
'price': ['exact', 'lte', 'gte'],
'departed': ['exact'],
'a... | code_fim | hard | {
"lang": "python",
"repo": "jonpas/WebApps",
"path": "/transport/filters.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jonpas/WebApps path: /transport/filters.py
from django import db
import django_filters
from flatpickr import DateTimePickerInput
from . import models
<|fim_suffix|> class Meta:
model = models.Transport
fields = {
'departure_time': ['exact', 'lte', 'gte'],
... | code_fim | hard | {
"lang": "python",
"repo": "jonpas/WebApps",
"path": "/transport/filters.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def readme_image_url(filename: str) -> str:
# Returns a link to a readme image
return f'{RAWGITHUB_URL}/README/{filename}'<|fim_prefix|># repo: jdieks/gcal2clickup path: /app/utils.py
GITHUB_URL = 'https://github.com/esdandreu/gcal2clickup/tree/main'
RAWGITHUB_URL = 'https://raw.githubusercontent... | code_fim | medium | {
"lang": "python",
"repo": "jdieks/gcal2clickup",
"path": "/app/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jdieks/gcal2clickup path: /app/utils.py
GITHUB_URL = 'https://github.com/esdandreu/gcal2clickup/tree/main'
RAWGITHUB_URL = 'https://raw.githubusercontent.com/esdandreu/gcal2clickup/main'
<|fim_suffix|> # Returns a link to a readme image
return f'{RAWGITHUB_URL}/README/{filename}'<|fim_mid... | code_fim | medium | {
"lang": "python",
"repo": "jdieks/gcal2clickup",
"path": "/app/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def readme_image_url(filename: str) -> str:
# Returns a link to a readme image
return f'{RAWGITHUB_URL}/README/{filename}'<|fim_prefix|># repo: jdieks/gcal2clickup path: /app/utils.py
GITHUB_URL = 'https://github.com/esdandreu/gcal2clickup/tree/main'
RAWGITHUB_URL = 'https://raw.githubuserconten... | code_fim | medium | {
"lang": "python",
"repo": "jdieks/gcal2clickup",
"path": "/app/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: slott56/navtools path: /spike/usr_symbol_mapping.py
"""
Tech spike to examine Lowrance USR
and Lowrance GPX to attempt to identify
symbol name and color codes.
"""
from navtools.waypoint_merge import opencpn_GPX_to_WayPoint, lowrance_GPX_to_WayPoint, lowrance_USR_to_WayPoint
from collections impo... | code_fim | hard | {
"lang": "python",
"repo": "slott56/navtools",
"path": "/spike/usr_symbol_mapping.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>def icon_table() -> None:
sym_2 = t2()
sym_3 = t3()
print("Symbol Mappings from USR to GPX")
print("(icon id, color): name")
mapping = defaultdict(list)
for k in sym_3:
if k in sym_2:
mapping[sym_3[k]].append(sym_2[k])
for k in mapping:
print(f"{k}: ... | code_fim | hard | {
"lang": "python",
"repo": "slott56/navtools",
"path": "/spike/usr_symbol_mapping.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> else:
dst_path = self.dest / src_path.name
self.ext_map[dst_path] = src_path.parent
# XXX:
# 1. Should use Path arguments here
# 2. Too much indirection!
return self.appbuilder.copy_dylib(str(src_path), str(dst_path))
def copy_framework(se... | code_fim | hard | {
"lang": "python",
"repo": "ronaldoussoren/py2app",
"path": "/src/py2app/_standalone.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ronaldoussoren/py2app path: /src/py2app/_standalone.py
"""
Interaction with macholib.MachOStandalone
XXX: Longer term this needs a complete rewrite, but
that requires rewriting macholib as well.
"""
import pathlib
import typing
from os import sep as PATH_SEP
import macholib.MachO
from macholib.... | code_fim | hard | {
"lang": "python",
"repo": "ronaldoussoren/py2app",
"path": "/src/py2app/_standalone.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Ensure that the original name also exists, avoids problems when
# the filename is used from Python (see issue #65)
#
# NOTE: The if statement checks that the target link won't
# point to itself, needed for systems like homebrew that
... | code_fim | hard | {
"lang": "python",
"repo": "ronaldoussoren/py2app",
"path": "/src/py2app/_standalone.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
if payload is None: payload = {}
response = self.client().invoke(FunctionName=self.name, Payload = json.dumps(payload))
result_bytes = response.get('Payload').read()
result_string = result_bytes.decode('utf-8')
result =... | code_fim | hard | {
"lang": "python",
"repo": "artem7902/OSBot-AWS",
"path": "/osbot_aws/apis/Lambda.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> @catch
def layer_create(self, layer_name, description=None, compatible_runtimes=None, zip_file_bytes=None, s3_bucket=None, s3_key=None,s3_version=None):
params = { 'LayerName' : layer_name ,
'Description' : description,
'Content' : {
... | code_fim | hard | {
"lang": "python",
"repo": "artem7902/OSBot-AWS",
"path": "/osbot_aws/apis/Lambda.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: artem7902/OSBot-AWS path: /osbot_aws/apis/Lambda.py
import json
from osbot_aws.apis.Session import Session
from osbot_aws.helpers.Method_Wrappers import cache, catch, remove
from osbot_aws.tmp_utils.Temp_Misc import Temp_Misc
from osbot_aws.apis.S3 import S3
from osbot_utils.decorators.Lists impo... | code_fim | hard | {
"lang": "python",
"repo": "artem7902/OSBot-AWS",
"path": "/osbot_aws/apis/Lambda.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.