text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: Iotic-Labs/py-ubjson path: /ubjson/compat.py
# Copyright (c) 2019 Iotic Labs Ltd. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://g... | code_fim | hard | {
"lang": "python",
"repo": "Iotic-Labs/py-ubjson",
"path": "/ubjson/compat.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>if version_info[:2] == (3, 2):
# pylint: disable=exec-used
exec("""def raise_from(value, from_value):
if from_value is None:
raise value
raise value from from_value
""")
elif version_info[:2] > (3, 2):
# pylint: disable=exec-used
exec("""def raise_from(value, from_value):
... | code_fim | hard | {
"lang": "python",
"repo": "Iotic-Labs/py-ubjson",
"path": "/ubjson/compat.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mozilla/firefox-flicks path: /flicks/base/models.py
from django.conf import settings
from django.db import models
from product_details import product_details
ENGLISH_LANGUAGE_CHOICES = sorted(
[(key.lower(), u'{0} ({1})'.format(key, value['English']))
for key, value in product_details... | code_fim | hard | {
"lang": "python",
"repo": "mozilla/firefox-flicks",
"path": "/flicks/base/models.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# South introspection rules for custom fields
from south.modelsinspector import add_introspection_rules
add_introspection_rules([], ['^flicks\.base\.models\.LocaleField'])
add_introspection_rules([], ['^flicks\.base\.models\.CountryField'])<|fim_prefix|># repo: mozilla/firefox-flicks path: /flicks/base/... | code_fim | hard | {
"lang": "python",
"repo": "mozilla/firefox-flicks",
"path": "/flicks/base/models.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, *args, **kwargs):
options = {
'max_length': 32,
'default': settings.LANGUAGE_CODE,
'choices': ENGLISH_LANGUAGE_CHOICES
}
options.update(kwargs)
return super(LocaleField, self).__init__(*args, **options)
class Coun... | code_fim | hard | {
"lang": "python",
"repo": "mozilla/firefox-flicks",
"path": "/flicks/base/models.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: apache/tvm path: /tests/python/contrib/test_cublas.py
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# ... | code_fim | hard | {
"lang": "python",
"repo": "apache/tvm",
"path": "/tests/python/contrib/test_cublas.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@tvm.testing.requires_cuda
@pytest.mark.parametrize(
"n,m,k,batch_a,batch_b,transpose_a,transpose_b",
[
(64, 128, 32, 16, 16, False, False),
(17, 32, 16, 16, 1, True, False),
(24, 17, 12, 17, 17, False, True),
(96, 4, 17, 53, 1, True, True),
],
)
@pytest.mark.p... | code_fim | hard | {
"lang": "python",
"repo": "apache/tvm",
"path": "/tests/python/contrib/test_cublas.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@tvm.testing.requires_cuda
@pytest.mark.parametrize(
"n,m,k,transpose_a,transpose_b",
[
(64, 128, 32, False, False),
(17, 32, 16, True, False),
(24, 17, 12, False, True),
(96, 4, 17, True, True),
],
)
@pytest.mark.parametrize(
"in_dtype,out_dtype",
[
... | code_fim | hard | {
"lang": "python",
"repo": "apache/tvm",
"path": "/tests/python/contrib/test_cublas.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: impiyush83/insta-backend path: /insta_backend/resources/feed/feed.py
import json
from flask import Blueprint, request, jsonify
from datetime import datetime
from insta_backend.extensions import redis_client, db
from insta_backend.models.post.post import PostMethods, Post
from insta_backend.models... | code_fim | hard | {
"lang": "python",
"repo": "impiyush83/insta-backend",
"path": "/insta_backend/resources/feed/feed.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> sa_posts = PostMethods.get_latest_public_posts(
page
)
next_posts_url = None
prev_posts_url = None
if sa_posts.has_next:
next_posts_url = '/explore/' + page + 1
if sa_posts.has_prev:
prev_posts_url = '/explore/' + page - 1
posts = dict()
cnt = 1
... | code_fim | hard | {
"lang": "python",
"repo": "impiyush83/insta-backend",
"path": "/insta_backend/resources/feed/feed.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># can be used by everyone anonymous so no authentication
@bp_feed.route('/explore/<page>', methods=['GET'])
def explore(page):
sa_posts = PostMethods.get_latest_public_posts(
page
)
next_posts_url = None
prev_posts_url = None
if sa_posts.has_next:
next_posts_url = '/exp... | code_fim | hard | {
"lang": "python",
"repo": "impiyush83/insta-backend",
"path": "/insta_backend/resources/feed/feed.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nikhiljohn10/django-api-template path: /app/config/urls.py
from django.contrib import admin
from django.urls import path, include, re_path
from django.views.generic import RedirectView
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
re_p<|fim_suffix|>... | code_fim | medium | {
"lang": "python",
"repo": "nikhiljohn10/django-api-template",
"path": "/app/config/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>i.urls')),
path('admin/', admin.site.urls),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)<|fim_prefix|># repo: nikhiljohn10/django-api-template path: /app/config/urls.py
from django.contrib import admin
from django.urls import path, include, re_path
from django.views.generic impor... | code_fim | hard | {
"lang": "python",
"repo": "nikhiljohn10/django-api-template",
"path": "/app/config/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GoogleCloudPlatform/python-docs-samples path: /dialogflow-cx/page_management_test.py
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ... | code_fim | hard | {
"lang": "python",
"repo": "GoogleCloudPlatform/python-docs-samples",
"path": "/dialogflow-cx/page_management_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>@pytest.fixture(scope="module", autouse=True)
def setup_teardown():
loop = asyncio.new_event_loop()
agentName = "temp_agent_" + str(uuid.uuid4())
parent = "projects/" + PROJECT_ID + "/locations/global"
agents_client = AgentsClient()
agent = Agent(
display_name=agentName,
... | code_fim | hard | {
"lang": "python",
"repo": "GoogleCloudPlatform/python-docs-samples",
"path": "/dialogflow-cx/page_management_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> candidate_score_pairs = []
query_emb = self.embed(query)
query_emb_norm = np.linalg.norm(query_emb)
if query_emb is not None:
count = 0
for candidate in candidates:
if candidate == query:
continue
i... | code_fim | hard | {
"lang": "python",
"repo": "yd1996/PartialComparison",
"path": "/modules/retriever.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yd1996/PartialComparison path: /modules/retriever.py
import os
import json
import time
import random
import numpy as np
from nltk import pos_tag
from utils.evals import sentence_bleu
def pretrain_word2vec(paths, save_dir):
count = 0
lines = []
for path in paths:
file = open(... | code_fim | hard | {
"lang": "python",
"repo": "yd1996/PartialComparison",
"path": "/modules/retriever.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if type == 'json':
type = 'string'
if self.backend.type(key) != type: #没有缓存
raise TypeError
return
def before_put(self, key, value, type = ''):
self.backend.delete(key)
if type not in ['string', 'json']:
if not value:
... | code_fim | hard | {
"lang": "python",
"repo": "azhai/rdcache",
"path": "/src/rdcache/ext.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: azhai/rdcache path: /src/rdcache/ext.py
# -*- coding: utf-8 -*-
import redis
from .cache import Cache
from .utils import coerce_value, coerce_number
class RedisPool:
""" Redis connection registry """
registry = {}
def __init__(self, configs):
self.configs = config... | code_fim | hard | {
"lang": "python",
"repo": "azhai/rdcache",
"path": "/src/rdcache/ext.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_hash(self, key, **kwargs):
return self.backend.hgetall(key)
def put_hash(self, key, value, **kwargs):
for k, v in value.iteritems():
value[k] = coerce_value(v)
result = self.backend.hmset(key, value)
return result
def get_zset(self, key, **... | code_fim | hard | {
"lang": "python",
"repo": "azhai/rdcache",
"path": "/src/rdcache/ext.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # go over all the result and convert the name of the language to its index
# because we have only two classes, it's either english or not
# y = list(map(lambda x: lang_dict[x] if x == "english" else lang_dict["other"], y))
y = list(map(lambda x: lang_dict["english"] if x == "english" else ... | code_fim | hard | {
"lang": "python",
"repo": "guyeshet/keras-accent-trainer",
"path": "/data_loader/csv_parser.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''
Converts list of languages into a binary class matrix
:param y (list): list of languages
:return (numpy array): binary class matrix
'''
lang_dict = {"english": 0,
"other": 1}
# for index, language in enumerate(set(y)):
# lang_dict[language] = index
... | code_fim | hard | {
"lang": "python",
"repo": "guyeshet/keras-accent-trainer",
"path": "/data_loader/csv_parser.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: guyeshet/keras-accent-trainer path: /data_loader/csv_parser.py
from sklearn.model_selection import train_test_split
from keras import utils
def split_people(df, test_size=0.2):
'''
Create train test split of DataFrame
:param df (DataFrame): Pandas DataFrame of audio files to be spli... | code_fim | medium | {
"lang": "python",
"repo": "guyeshet/keras-accent-trainer",
"path": "/data_loader/csv_parser.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>+= 1
print(count)
break
else:
num = total_number
count += 1<|fim_prefix|># repo: ombreman/baekjoon_algorithm path: /algorithm_week/Q_1110.py
N = num = int(input()) # N = 26
count = 0
while True:
first_digit = num // 10 # 2
s<|fim_middle|>econd_digit = num % ... | code_fim | medium | {
"lang": "python",
"repo": "ombreman/baekjoon_algorithm",
"path": "/algorithm_week/Q_1110.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ombreman/baekjoon_algorithm path: /algorithm_week/Q_1110.py
N = num = int(input()) # N = 26
count = 0
while True:
first_digit = num // 10 # 2
s<|fim_suffix|>nt(str(second_digit) + str(a)) # 68 = "6" + "8"
if N == total_number: # 26
count += 1
print(count)
... | code_fim | medium | {
"lang": "python",
"repo": "ombreman/baekjoon_algorithm",
"path": "/algorithm_week/Q_1110.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>CRNN2D_LARGER_MODEL = 'crnn2d_larger'
CRNN2D_VGG_MODEL = 'crnn2d_vgg'
SVM_MODEL = 'svm'
BILSTM_MODEL = 'bilstm'
LSTM_MODEL = 'lstm'
LR_MODEL = 'lr'
ATTGRU = 'att_gru'<|fim_prefix|># repo: zhengying-liu/autodl path: /codalab_competition_bundle/AutoDL_starting_kit/AutoDL_simple_baseline_models/baseline3_al... | code_fim | hard | {
"lang": "python",
"repo": "zhengying-liu/autodl",
"path": "/codalab_competition_bundle/AutoDL_starting_kit/AutoDL_simple_baseline_models/baseline3_all_combined/AutoSpeech/PASA_NJU/models/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: seatgeek/dd-trace-py path: /ddtrace/profiling/bootstrap/sitecustomize.py
# -*- encoding: utf-8 -*-
"""Bootstrapping code that is run when using the `pyddprofile`."""
import os
from ddtrace.profiling import bootstrap
from ddtrace.profiling import profiler
<|fim_suffix|> if hasattr(bootstrap, ... | code_fim | medium | {
"lang": "python",
"repo": "seatgeek/dd-trace-py",
"path": "/ddtrace/profiling/bootstrap/sitecustomize.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def start_profiler():
if hasattr(bootstrap, "profiler"):
bootstrap.profiler.stop()
# Export the profiler so we can introspect it if needed
bootstrap.profiler = profiler.Profiler()
bootstrap.profiler.start()
start_profiler()
# When forking, all threads are stop in the child.
# Res... | code_fim | medium | {
"lang": "python",
"repo": "seatgeek/dd-trace-py",
"path": "/ddtrace/profiling/bootstrap/sitecustomize.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Harry-zklcdc/OnlineJudge path: /account/urls/admin.py
from django.conf.urls import url
<|fim_suffix|>urlpatterns = [
url(r"^user/?$", UserAdminAPI.as_view(), name="user_admin_api"),
url(r"^generate_user/?$", GenerateUserAPI.as_view(), name="generate_user_api"),
]<|fim_middle|>from ..view... | code_fim | easy | {
"lang": "python",
"repo": "Harry-zklcdc/OnlineJudge",
"path": "/account/urls/admin.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>urlpatterns = [
url(r"^user/?$", UserAdminAPI.as_view(), name="user_admin_api"),
url(r"^generate_user/?$", GenerateUserAPI.as_view(), name="generate_user_api"),
]<|fim_prefix|># repo: Harry-zklcdc/OnlineJudge path: /account/urls/admin.py
from django.conf.urls import url
<|fim_middle|>from ..view... | code_fim | easy | {
"lang": "python",
"repo": "Harry-zklcdc/OnlineJudge",
"path": "/account/urls/admin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> base=ch*64
#conf[ch].mem_wr_rst = 1
apb_conf.fifo_mask = 1 # If 0, RAM access is in FIFO mode
# Though I suppose fifo mode has its attractions; no need to calculate offsets
for i in range(8):
ram[base +i] = WS2812_1 if g&(0x80>>i) else WS2812_0
ram[base+ 8+i] = WS2812... | code_fim | hard | {
"lang": "python",
"repo": "hu-tianyi/AuTrix",
"path": "/ESP32S/workSpace/ws2812_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hu-tianyi/AuTrix path: /ESP32S/workSpace/ws2812_test.py
import uctypes
RMT_BASE = 0x3ff56000
conf = uctypes.struct(RMT_BASE+0x20, (uctypes.ARRAY | 0, 8,
{"mem_pd": uctypes.BFUINT32 | 0 | 30<<uctypes.BF_POS | 1<<uctypes.BF_LEN, # Only for ch0
"carrier_out_lv": uctypes.BFUINT32 |... | code_fim | hard | {
"lang": "python",
"repo": "hu-tianyi/AuTrix",
"path": "/ESP32S/workSpace/ws2812_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jorgediazjr/dials-dev20191018 path: /modules/cctbx_project/mmtbx/scaling/make_param.py
from __future__ import absolute_import, division, print_function
import iotbx.phil
import sys
class phil_lego(object):
"""
This class facilitates the construction of phil parameter files
for the FA estimatio... | code_fim | hard | {
"lang": "python",
"repo": "jorgediazjr/dials-dev20191018",
"path": "/modules/cctbx_project/mmtbx/scaling/make_param.py",
"mode": "psm",
"license": "BSD-3-Clause-LBNL",
"source": "the-stack-v2"
} |
<|fim_suffix|> scaler = scaler.replace('__EXPERT_LEVEL__',
'1' )
scaler = self.scaling_strategy.replace('__REPLACE__',
scaler )
scaler = scaler.replace('__EXPERT_LEVEL__',
'1' )
output = self.output
re... | code_fim | hard | {
"lang": "python",
"repo": "jorgediazjr/dials-dev20191018",
"path": "/modules/cctbx_project/mmtbx/scaling/make_param.py",
"mode": "spm",
"license": "BSD-3-Clause-LBNL",
"source": "the-stack-v2"
} |
<|fim_suffix|> omit = self.omit
omit = omit.replace('__EXPERT_LEVEL__',
'1' )
result = outer_level.replace('__REPLACE__',
basic+data+scaler+omit+output)
return result
def default_sir(self):
outer_level = self.scaling_input
outer_level =... | code_fim | hard | {
"lang": "python",
"repo": "jorgediazjr/dials-dev20191018",
"path": "/modules/cctbx_project/mmtbx/scaling/make_param.py",
"mode": "spm",
"license": "BSD-3-Clause-LBNL",
"source": "the-stack-v2"
} |
<|fim_suffix|>nt(millis)} milliseconds'
if int(millis) > 0:
return f'{int(millis)} milliseconds'
return f'{int(micros)} microseconds'<|fim_prefix|># repo: NebN/tt path: /src/util/TimeUtils.py
def timedelta_to_string(timedelta):
hours, minutes, details = str(timedelta).split(':')
seconds = detai... | code_fim | medium | {
"lang": "python",
"repo": "NebN/tt",
"path": "/src/util/TimeUtils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NebN/tt path: /src/util/TimeUtils.py
def timedelta_to_string(timedelta):
hours, minutes, details = str(timedelta).split(':')
seconds = details[0:2]
millis = details[3:6]
micros = details[6:]
if int(hours) > 0:
return f'{hours}:{minutes}.{seconds}'
if int(minutes) ... | code_fim | medium | {
"lang": "python",
"repo": "NebN/tt",
"path": "/src/util/TimeUtils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> yield tuple(set_ranges)
class SplitterT(tp.Protocol):
def split(self, X: tp.ArrayLike, **kwargs) -> RangesT:
...
class BaseSplitter:
"""Abstract splitter class."""
def split(self, X: tp.ArrayLike, **kwargs) -> RangesT:
raise NotImplementedError
class RangeSpl... | code_fim | hard | {
"lang": "python",
"repo": "davidandreoletti/vectorbt",
"path": "/vectorbt/generic/splitters.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: davidandreoletti/vectorbt path: /vectorbt/generic/splitters.py
"""Splitters for cross-validation.
Defines splitter classes similar (but may not compatible) to `sklearn.model_selection.BaseCrossValidator`."""
import numpy as np
import pandas as pd
import math
from vectorbt import _typing as tp
... | code_fim | hard | {
"lang": "python",
"repo": "davidandreoletti/vectorbt",
"path": "/vectorbt/generic/splitters.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> `**kwargs` are passed to `split_ranges_into_sets`."""
X = to_any_array(X)
if isinstance(X, (pd.Series, pd.DataFrame)):
index = X.index
else:
index = pd.Index(np.arange(X.shape[0]))
# Resolve start_idxs and end_idxs
if window_len is N... | code_fim | hard | {
"lang": "python",
"repo": "davidandreoletti/vectorbt",
"path": "/vectorbt/generic/splitters.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ljean/coop_cms path: /coop_cms/apps/test_app/admin.py
# -*- coding: utf-8 -*-
"""admin"""
from django.contrib import admin
<|fim_suffix|>@admin.register(models.TestClass)
class TestClassAdmin(admin.ModelAdmin):
pass<|fim_middle|>from . import models
| code_fim | easy | {
"lang": "python",
"repo": "ljean/coop_cms",
"path": "/coop_cms/apps/test_app/admin.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@admin.register(models.TestClass)
class TestClassAdmin(admin.ModelAdmin):
pass<|fim_prefix|># repo: ljean/coop_cms path: /coop_cms/apps/test_app/admin.py
# -*- coding: utf-8 -*-
"""admin"""
from django.contrib import admin
<|fim_middle|>from . import models
| code_fim | easy | {
"lang": "python",
"repo": "ljean/coop_cms",
"path": "/coop_cms/apps/test_app/admin.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: divyapy/odoo path: /pos_repair_order/models/res_partner.py
# -*- coding: utf-8 -*-
<|fim_suffix|> # attributes
is_mechanic = fields.Boolean(string="Is Mechanic")<|fim_middle|>from odoo import api, fields, models
class ResPartner(models.Model):
_inherit = "res.partner"
| code_fim | medium | {
"lang": "python",
"repo": "divyapy/odoo",
"path": "/pos_repair_order/models/res_partner.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # attributes
is_mechanic = fields.Boolean(string="Is Mechanic")<|fim_prefix|># repo: divyapy/odoo path: /pos_repair_order/models/res_partner.py
# -*- coding: utf-8 -*-
from odoo import api, fields, models
class ResPartner(models.Model):
<|fim_middle|> _inherit = "res.partner"
| code_fim | easy | {
"lang": "python",
"repo": "divyapy/odoo",
"path": "/pos_repair_order/models/res_partner.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Tile data
for y in range(len(self.tiles) // 32):
for x in range(32):
self.buffer.blit(self.tiles[y * 32 + x], (256 + x * 8, y * 8))
if not self.headless:
self.window.blit(
pygame.transform.scale(
... | code_fim | hard | {
"lang": "python",
"repo": "LaplaceKorea/rosettaboy",
"path": "/py/src/gpu.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LaplaceKorea/rosettaboy path: /py/src/gpu.py
import pygame
from typing import List
from .consts import *
from .cpu import CPU
SCALE = 2
class LCDC:
ENABLED = 1 << 7
WINDOW_MAP = 1 << 6
WINDOW_ENABLED = 1 << 5
DATA_SRC = 1 << 4
BG_MAP = 1 << 3
OBJ_SIZE = 1 << 2
OBJ_E... | code_fim | hard | {
"lang": "python",
"repo": "LaplaceKorea/rosettaboy",
"path": "/py/src/gpu.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> input_ = header_src
clang = subprocess.Popen(
clang_cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL)
output, _ = clang.communicate(input=input_)
if clang.returncode != 0:
return None
return output.de... | code_fim | hard | {
"lang": "python",
"repo": "iblislin/hack-py-import",
"path": "/c/__init__.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def create_module(self, spec):
self.spec = spec
return None
def exec_module(self, module):
c = self.spec.loader_state.dlopen(None)
for key in c.__dir__():
try:
setattr(module, key, getattr(c, key))
except NotImplementedError:... | code_fim | hard | {
"lang": "python",
"repo": "iblislin/hack-py-import",
"path": "/c/__init__.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: iblislin/hack-py-import path: /c/__init__.py
import subprocess
import sys
from importlib.abc import Loader, MetaPathFinder
from importlib.machinery import ModuleSpec
from itertools import starmap
from typing import Iterable
from pypi import cffi
from cffi import FFI
class CFFIMetaPathFinder(M... | code_fim | hard | {
"lang": "python",
"repo": "iblislin/hack-py-import",
"path": "/c/__init__.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Set the common fields of the goals
goal.robot_name = robot_name
goal.object_name = object_name
# Send the goal with the appropriate action client
if command == 'pick':
... | code_fim | hard | {
"lang": "python",
"repo": "kroglice/o2ac-ur",
"path": "/catkin_ws/src/o2ac_task_planning/pddl_converter/src/o2ac_task_planning_pddl_converter/pddl_converter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kroglice/o2ac-ur path: /catkin_ws/src/o2ac_task_planning/pddl_converter/src/o2ac_task_planning_pddl_converter/pddl_converter.py
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# Author: Karoly Istvan Artur
import argparse
import rospy
import rospkg
import... | code_fim | hard | {
"lang": "python",
"repo": "kroglice/o2ac-ur",
"path": "/catkin_ws/src/o2ac_task_planning/pddl_converter/src/o2ac_task_planning_pddl_converter/pddl_converter.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Joel-C-Johnson/learningPython path: /myCalc.py
# Calculator project for collaboration
a = raw_input("Enter the first number :")
b = raw_input("\nEnter the second Number :")
def sum(a,b):
return (a + b)
<|fim_suffix|>def subtraction(a, b):
return(a-b)
def mod(a,b):
return (a%b)<|fim_middle|>... | code_fim | medium | {
"lang": "python",
"repo": "Joel-C-Johnson/learningPython",
"path": "/myCalc.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return(a*b)
def subtraction(a, b):
return(a-b)
def mod(a,b):
return (a%b)<|fim_prefix|># repo: Joel-C-Johnson/learningPython path: /myCalc.py
# Calculator project for collaboration
a = raw_input("Enter the first number :")
b = raw_input("\nEnter the second Number :")
def sum(a,b):
return (a + b... | code_fim | easy | {
"lang": "python",
"repo": "Joel-C-Johnson/learningPython",
"path": "/myCalc.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_data_quality_operator(conf, dag):
kwargs = {
"conn_id" : conf["fields"]["conn_id"],
"sql" : conf["fields"]["sql"],
"push_conn_id" : conf["push_conn_id"],
"check_description" : conf["check_description"],
"email" : conf["notification_emails"]
}
if... | code_fim | hard | {
"lang": "python",
"repo": "sherrli/airflow-dq",
"path": "/example_dags/yaml_data_quality_check_dag.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sherrli/airflow-dq path: /example_dags/yaml_data_quality_check_dag.py
from datetime import datetime, timedelta
from collections import defaultdict
import os
import glob
import yaml
from airflow import DAG
from airflow.operators.data_quality_threshold_check_operator import DataQualityThresholdChe... | code_fim | hard | {
"lang": "python",
"repo": "sherrli/airflow-dq",
"path": "/example_dags/yaml_data_quality_check_dag.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: stephane/flask-skeleton path: /skeleton/items/data.py
from . import models
def load(db):
items = [
{'code<|fim_suffix|> 'Shovel'},
{'code': 'BUCKET', 'name': 'Bucket'}
]
for item in items:
db.session.add(models.Item(**item))<|fim_middle|>': 'KNIFE', 'name': 'K... | code_fim | medium | {
"lang": "python",
"repo": "stephane/flask-skeleton",
"path": "/skeleton/items/data.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> 'Shovel'},
{'code': 'BUCKET', 'name': 'Bucket'}
]
for item in items:
db.session.add(models.Item(**item))<|fim_prefix|># repo: stephane/flask-skeleton path: /skeleton/items/data.py
from . import models
def load(db):
items = [
{'code<|fim_middle|>': 'KNIFE', 'name': 'K... | code_fim | medium | {
"lang": "python",
"repo": "stephane/flask-skeleton",
"path": "/skeleton/items/data.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> encoded_entity = memcache.get('protobuf')
cached_entity = db.model_from_protobuf(encoded_entity)
assert cached_entity.name == 'foobar'
def testMulti(self):
"""Stores multiple keys' values at once."""
memcache.set_multi({'map_key_one': 1, 'map_key_two': u'some ... | code_fim | hard | {
"lang": "python",
"repo": "yejunzhou/typhoonae",
"path": "/src/typhoonae/memcache/tests/test_memcache.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Testing automatically incrementing and decrementing."""
memcache.incr('unknown_key')
assert memcache.get('unknown_key') == None
memcache.set('counter', 0)
assert memcache.get('counter') == 0
memcache.incr('counter')
assert memcache.get('counter')... | code_fim | hard | {
"lang": "python",
"repo": "yejunzhou/typhoonae",
"path": "/src/typhoonae/memcache/tests/test_memcache.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yejunzhou/typhoonae path: /src/typhoonae/memcache/tests/test_memcache.py
# -*- coding: utf-8 -*-
#
# Copyright 2009, 2010, 2011 Tobias Rodäbel
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a ... | code_fim | hard | {
"lang": "python",
"repo": "yejunzhou/typhoonae",
"path": "/src/typhoonae/memcache/tests/test_memcache.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: khazablanka/PhyloFisher path: /phylofisher/sgt_constructor.py
#!/usr/bin/env python
import configparser
import os
import subprocess
import textwrap
from pathlib import Path
from phylofisher import help_formatter
SNAKEFILE_PATH = f'{os.path.dirname(os.path.realpath(__file__))}/sgt_constructor.smk... | code_fim | hard | {
"lang": "python",
"repo": "khazablanka/PhyloFisher",
"path": "/phylofisher/sgt_constructor.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> smk_frags = [
f'snakemake',
f'-s {SNAKEFILE_PATH}',
f'--config {make_config()}',
f'--cores {args.threads}',
f'--rerun-incomplete',
f'--keep-going',
f'--nolock'
]
smk_cmd = ' '.join(smk_frags)
smk_cmd += ' ' + get_outfiles()
bash(s... | code_fim | hard | {
"lang": "python",
"repo": "khazablanka/PhyloFisher",
"path": "/phylofisher/sgt_constructor.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wn9081/MASTER-pytorch path: /model/master.py
# -*- coding: utf-8 -*-
# @Author: Wenwen Yu
# @Created Time: 10/4/2020 14:18
from copy import deepcopy
import numpy as np
import torch
from torch import nn
from .backbone import ConvEmbeddingGC
from .transformer import MultiHeadAttention, Positionw... | code_fim | hard | {
"lang": "python",
"repo": "wn9081/MASTER-pytorch",
"path": "/model/master.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''
Model prints with number of trainable parameters
'''
model_parameters = filter(lambda p: p.requires_grad, self.parameters())
params = sum([np.prod(p.size()) for p in model_parameters])
return super().__str__() + '\nTrainable parameters: {}'.format(params... | code_fim | hard | {
"lang": "python",
"repo": "wn9081/MASTER-pytorch",
"path": "/model/master.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BayesWatch/deficient-efficient path: /models/hashed.py
# HashedNet Convolutional Layer: https://arxiv.org/abs/1504.04788
from functools import reduce
import torch
import torch.nn as nn
import torch.nn.functional as F
class HashedConv2d(nn.Conv2d):
"""Conv2d with the weights of the convolut... | code_fim | hard | {
"lang": "python",
"repo": "BayesWatch/deficient-efficient",
"path": "/models/hashed.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def forward(self, x):
if self.grouped is not None:
x = self.grouped(x)
return self.hashed(x)
if __name__ == '__main__':
from timeit import timeit
setup = "from __main__ import HashedConv2d; import torch; X = torch.randn(128, 256, 28, 28).cuda(); conv = HashedConv2... | code_fim | hard | {
"lang": "python",
"repo": "BayesWatch/deficient-efficient",
"path": "/models/hashed.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self.grouped is not None:
x = self.grouped(x)
return self.hashed(x)
class HashedSeparable(nn.Module):
"""Separabled, where grouped and pointwise are both Hashed.."""
def __init__(self, in_channels, out_channels, kernel_size, budget,
stride=1, padding=0,... | code_fim | hard | {
"lang": "python",
"repo": "BayesWatch/deficient-efficient",
"path": "/models/hashed.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ringcentral/ringcentral-chatbot-python path: /ringcentral_bot_framework/core/__init__.py
'''
framework entry
'''
from .bot import initBotClass
from .db import initDBAction
from .user import initUserClass
from .bot_oauth import initBotAuthHandler
from .user_oauth import initUserAuth
from .bot_webh... | code_fim | hard | {
"lang": "python",
"repo": "ringcentral/ringcentral-chatbot-python",
"path": "/ringcentral_bot_framework/core/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return userWebhook(event)
@staticmethod
def router(event):
'''
process event and return result object:
{
'headers': dict,
'body': dict,
'statusCode': number
}
'''
for extension in extensions:
if hasattr(extension, 'route') ... | code_fim | hard | {
"lang": "python",
"repo": "ringcentral/ringcentral-chatbot-python",
"path": "/ringcentral_bot_framework/core/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MDudek-ICS/peach path: /3rdParty/waf/demos/c/shlib/wscript_build
#! /usr/bin/env python
bld.shlib(
source = 'test_shlib.c',
target = 'my_shared_lib',
vnum = '1.2.3',
defs = 'foo.def')
t = bld.program(
#features = 'my_precious',
source = 'main.c',
target = 'test_shared_link',
use ... | code_fim | hard | {
"lang": "python",
"repo": "MDudek-ICS/peach",
"path": "/3rdParty/waf/demos/c/shlib/wscript_build",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># 4. changing the class - setting flags such as LINKFLAGS_cshlib is usually a much better idea
#from waflib.Utils import run_once
#from waflib.Tools.c import cprogram
#class cprogram(cprogram):
# def runnable_status(self):
# self.set_flags()
# self.set_flags() # just to see
# return super(cprogram, sel... | code_fim | hard | {
"lang": "python",
"repo": "MDudek-ICS/peach",
"path": "/3rdParty/waf/demos/c/shlib/wscript_build",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> warning = 'Name mismatch between wrong and col_with_name. DataColumn and underlying series name are now col_with_name'
with pytest.warns(ColumnNameMismatchWarning, match=warning):
dt['col_with_name'] = DataColumn(new_series,
use_standard_tags=False,... | code_fim | hard | {
"lang": "python",
"repo": "chukarsten/woodwork",
"path": "/woodwork/tests/datatable/test_datatable.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chukarsten/woodwork path: /woodwork/tests/datatable/test_datatable.py
guage
}
dt = DataTable(latlong_df.loc[:, [column_name]], logical_types=ltypes)
dt = dt.set_types(logical_types={column_name: LatLong})
assert dt.columns[column_name].logical_type == LatLong
... | code_fim | hard | {
"lang": "python",
"repo": "chukarsten/woodwork",
"path": "/woodwork/tests/datatable/test_datatable.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chukarsten/woodwork path: /woodwork/tests/datatable/test_datatable.py
cted:
assert col_name in multi_params_df.columns
multi_params_df['full_name'].equals(col_name_df['full_name'])
multi_params_df['full_name'].equals(dt.describe()['full_name'])
def test_value_counts(categorical_... | code_fim | hard | {
"lang": "python",
"repo": "chukarsten/woodwork",
"path": "/woodwork/tests/datatable/test_datatable.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if word not in self.leaf:
return []
return self.leaf[word]
def DFS_create_UI(self, u, depth): # 通过dfs生成树形结构代码
cur = ''
if len(self.anspath) > depth and u == self.anspath[depth]:
self.UI_str += ' <li> <span>'
cur = '<i class="fa fa-m... | code_fim | hard | {
"lang": "python",
"repo": "water123li/Chatbot_CN",
"path": "/Chatbot_KG/toolkit/tree_API.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: water123li/Chatbot_CN path: /Chatbot_KG/toolkit/tree_API.py
# -*- coding: utf-8 -*-
"""
-------------------------------------------------
File Name: tree_API.py
Description : 树形图处理
Author : charl
date: 2018/10/26
-------------------------------------------------
... | code_fim | hard | {
"lang": "python",
"repo": "water123li/Chatbot_CN",
"path": "/Chatbot_KG/toolkit/tree_API.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>@app.route('/get_cookie')
def get_cookie():
c= request.cookies.get('cookie_name1')
return c
@app.route('/del_cookie')
def del_cookie():
resp =make_response('删除cookie')
resp.delete_cookie('cookie_name3') # 设置过期时间为0
return resp
if __name__ == '__main__':
app.run(host='127.0.0.1', port=... | code_fim | hard | {
"lang": "python",
"repo": "LiuJunb/PythonStudy",
"path": "/Flask/02-Flask-http-Base2/08-set-cookie.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LiuJunb/PythonStudy path: /Flask/02-Flask-http-Base2/08-set-cookie.py
# coding:utf-8
from flask import Flask, render_template, make_response, request
app = Flask(__name__)
@app.route('/')
def index():
<|fim_suffix|> resp =make_response('删除cookie')
resp.delete_cookie('cookie_name3') # 设置过期... | code_fim | hard | {
"lang": "python",
"repo": "LiuJunb/PythonStudy",
"path": "/Flask/02-Flask-http-Base2/08-set-cookie.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: namhoonlee/effect-dps-public path: /edps/evaluate.py
import numpy as np
def eval(model, sess, dataset, split, saver=None, model_file=None):
# load model
if saver is not None and model_file is not None:
try:
saver.restore(sess, model_file)
except:
... | code_fim | hard | {
"lang": "python",
"repo": "namhoonlee/effect-dps-public",
"path": "/edps/evaluate.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # run
accuracy = []
while True:
batch = dataset.get_next_batch(100, generator)
if batch is not None:
feed_dict = {}
feed_dict.update({model.inputs[key]: batch[key] for key in ['image', 'label']})
feed_dict.update({model.compress: False, model... | code_fim | medium | {
"lang": "python",
"repo": "namhoonlee/effect-dps-public",
"path": "/edps/evaluate.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>b_file = open(b_file_name, "w")
a_file = open(a_file_name, "w")
if(b_len % len(string_keys) != 0):
print("Expected b table length to be divisible by "+str(len(string_keys)))
exit(-1)
for i in range(0, int(b_len/len(string_keys))):
for s in string_keys:
x_val = int(random.random()*10)
if(x_val < 4... | code_fim | medium | {
"lang": "python",
"repo": "EquiJoins/EquiJoinsOverEncryptedData",
"path": "/testInput/generate_tables.py",
"mode": "spm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: EquiJoins/EquiJoinsOverEncryptedData path: /testInput/generate_tables.py
import sys, random
string_keys = ['test','jason','asdf','defg','DEADBEEF']
opt = sys.argv
if(len(opt) != 5):
print("Expecting 4 values - length of a table, length of b table, file for a table and file for b table")
exit(... | code_fim | hard | {
"lang": "python",
"repo": "EquiJoins/EquiJoinsOverEncryptedData",
"path": "/testInput/generate_tables.py",
"mode": "psm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_suffix|>a_len = int(opt[1])
b_len = int(opt[2])
a_file_name = str(opt[3])
b_file_name = str(opt[4])
b_file = open(b_file_name, "w")
a_file = open(a_file_name, "w")
if(b_len % len(string_keys) != 0):
print("Expected b table length to be divisible by "+str(len(string_keys)))
exit(-1)
for i in range(0, int(b_le... | code_fim | medium | {
"lang": "python",
"repo": "EquiJoins/EquiJoinsOverEncryptedData",
"path": "/testInput/generate_tables.py",
"mode": "spm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_suffix|> num = self.alumnos.count()
return num
def __str__(self):
return str(self.name)<|fim_prefix|># repo: Jeandev-z/Aula-Virtual path: /page/models.py
from django.db import models
from django.contrib.auth.models import AbstractUser
<|fim_middle|>class User(AbstractUser):
... | code_fim | hard | {
"lang": "python",
"repo": "Jeandev-z/Aula-Virtual",
"path": "/page/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class Curso(models.Model):
name = models.CharField(max_length = 50)
code = models.CharField(max_length = 10, default='')
alumnos = models.ManyToManyField(User, related_name='alumnos')
profesor = models.ForeignKey(User, related_name='profesor', on_delete=models.CASCADE)
def count_a... | code_fim | hard | {
"lang": "python",
"repo": "Jeandev-z/Aula-Virtual",
"path": "/page/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Jeandev-z/Aula-Virtual path: /page/models.py
from django.db import models
from django.contrib.auth.models import AbstractUser
class User(AbstractUser):
customer_id = models.CharField(max_length=100, blank=True, null=True)
email = models.EmailField(unique=True)
is_teach = models.Boole... | code_fim | medium | {
"lang": "python",
"repo": "Jeandev-z/Aula-Virtual",
"path": "/page/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> log_dir,
interval=500,
run_steps=50,
run_every_epoch=False):
self.log_dir = log_dir
self.interval = interval
self.run_steps = run_steps
self.run_every_epoch = '_inner_iter' if run_every_epoch else '_iter'
... | code_fim | medium | {
"lang": "python",
"repo": "johnbensnyder/deep-learning-models",
"path": "/models/vision/detection/awsdet/utils/runner/hooks/profiler.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: johnbensnyder/deep-learning-models path: /models/vision/detection/awsdet/utils/runner/hooks/profiler.py
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
# -*- coding: utf-8 -*-
import tensorflow as tf
import numpy as np
from .hook imp... | code_fim | hard | {
"lang": "python",
"repo": "johnbensnyder/deep-learning-models",
"path": "/models/vision/detection/awsdet/utils/runner/hooks/profiler.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if runner.__dict__[self.run_every_epoch] + 1 == self.interval:
tf.profiler.experimental.start(self.log_dir)
elif runner.__dict__[self.run_every_epoch] + 1 == self.interval + self.run_steps:
tf.profiler.experimental.stop()<|fim_prefix|># repo: johnbensnyder/deep-lear... | code_fim | hard | {
"lang": "python",
"repo": "johnbensnyder/deep-learning-models",
"path": "/models/vision/detection/awsdet/utils/runner/hooks/profiler.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: camall3n/markov-state-abstractions path: /markov_abstr/gridworld/plot_side_by_side_results.py
import glob
import json
import matplotlib.pyplot as plt
import numpy as np
import os
import pandas as pd
import seaborn as sns
from visgrid.utils import load_experiment, get_parser
parser = get_parser(... | code_fim | hard | {
"lang": "python",
"repo": "camall3n/markov-state-abstractions",
"path": "/markov_abstr/gridworld/plot_side_by_side_results.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> agents = [
'markov',
'inv-only',
'contr-only',
'autoenc',
'truestate',
'end-to-end',
'pixel-pred',
# 'random',
# 'rearrange_xy',
]
root = 'results/scores/'
unfiltered_paths = [(root + e + '/' + a + '/', (e, a)) for e i... | code_fim | hard | {
"lang": "python",
"repo": "camall3n/markov-state-abstractions",
"path": "/markov_abstr/gridworld/plot_side_by_side_results.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> g = sns.lineplot(
ax=ax,
x=x,
y=y,
data=data,
hue=hue,
hue_order=algs,
style=style,
# kind='line',
# legend='full',
legend=False,
dashes=dashes,
# height=... | code_fim | hard | {
"lang": "python",
"repo": "camall3n/markov-state-abstractions",
"path": "/markov_abstr/gridworld/plot_side_by_side_results.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: spenczar/thor path: /thor/taskqueue/jobs.py
from typing import AnyStr, List, Mapping
import datetime
import json
from google.cloud.storage import Bucket
from thor.orbits import Orbits
from thor.taskqueue.tasks import Task
class JobManifest:
"""
A manifest which lists all the orbit ID... | code_fim | hard | {
"lang": "python",
"repo": "spenczar/thor",
"path": "/thor/taskqueue/jobs.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> Parameters
----------
bucket : google.cloud.storage.Bucket
The GCS bucket where job data is stored.
manifest : thor.taskqueue.JobManifest
The manifest to upload.
"""
path = f"thor_jobs/v1/job-{manifest.job_id}/manifest.json"
bucket.blob(path).upload_from_string(... | code_fim | hard | {
"lang": "python",
"repo": "spenczar/thor",
"path": "/thor/taskqueue/jobs.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i in range(len(preds_)):
preds_[i]['feature_set'] = fs_name
preds_[i]['sub'] = sub
preds_[i]['rep'] = i
preds.append(pd.concat(preds_, axis=0))
coefs_df = pd.DataFrame(data=coefs_, columns=X.columns)
coefs_df['feature_set'] ... | code_fim | hard | {
"lang": "python",
"repo": "lukassnoek/FEED_behav_analyses",
"path": "/src/analysis/classification_analysis_train_withinsubject.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Define pipeline
model = make_pipeline(
#GridSearchCV(
# estimator=LogisticRegression(
# penalty='l2',
# class_weight='balanced',
# n_jobs=1,
# solver='liblinear',
# max_iter=1000
# ),
... | code_fim | hard | {
"lang": "python",
"repo": "lukassnoek/FEED_behav_analyses",
"path": "/src/analysis/classification_analysis_train_withinsubject.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lukassnoek/FEED_behav_analyses path: /src/analysis/classification_analysis_train_withinsubject.py
import sys
import joblib
import os.path as op
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from sklearn.linear_model import LogisticRegression
from skl... | code_fim | hard | {
"lang": "python",
"repo": "lukassnoek/FEED_behav_analyses",
"path": "/src/analysis/classification_analysis_train_withinsubject.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> cmd = ''
if force or not isfile(out_paths['diff_qza']):
cmd = '# model\n'
cmd += '\nqiime songbird multinomial \\\n'
cmd += ' --i-table %s \\\n' % new_qza
cmd += ' --m-metadata-file %s \\\n' % new_meta
cmd += ' --p-formula "%s" \\\n' % formula
cmd +=... | code_fim | hard | {
"lang": "python",
"repo": "FranckLejzerowicz/prep_songbird",
"path": "/prep_songbird/_cmds.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def get_new_meta_pd(meta_pd: pd.DataFrame, case: str,
case_var: str, case_vals: list) -> pd.DataFrame:
if 'ALL' in case:
new_meta_pd = meta_pd.copy()
elif len([x for x in case_vals if x[0] == '>' or x[0] == '<']):
new_meta_pd = meta_pd.copy()
for case_v... | code_fim | hard | {
"lang": "python",
"repo": "FranckLejzerowicz/prep_songbird",
"path": "/prep_songbird/_cmds.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: FranckLejzerowicz/prep_songbird path: /prep_songbird/_cmds.py
# ----------------------------------------------------------------------------
# Copyright (c) 2020, Franck Lejzerowicz.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distribu... | code_fim | hard | {
"lang": "python",
"repo": "FranckLejzerowicz/prep_songbird",
"path": "/prep_songbird/_cmds.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.