text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> @property
def file_format(self):
return self._file_format
@property
def encoding(self):
return self._encoding
@property
def delete_on_start(self):
return self._delete_on_start
def load_config_section(self, configuration_file, configuration, bot_root):... | code_fim | hard | {
"lang": "python",
"repo": "secrecy27/chatbot",
"path": "/src/programy/config/brain/debugfile.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: secrecy27/chatbot path: /src/programy/config/brain/debugfile.py
"""
Copyright (c) 2016-2018 Keith Sterling http://www.keithsterling.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in th... | code_fim | hard | {
"lang": "python",
"repo": "secrecy27/chatbot",
"path": "/src/programy/config/brain/debugfile.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> (r'\(', lambda _, w: TokenKind(TokenKind.LEFT_PAR, w)),
(r'\)', lambda _, w: TokenKind(TokenKind.RIGHT_PAR, w)),
(r'\{', lambda _, w: TokenKind(TokenKind.LEFT_BRACE, w)),
(r'\}', lambda _, w: TokenKind(TokenKind.RIGHT_BRACE, w)),
(r'\[', lambda _... | code_fim | hard | {
"lang": "python",
"repo": "BenoitPerrot/kuac",
"path": "/src/generator/python/protobuf/scanner.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BenoitPerrot/kuac path: /src/generator/python/protobuf/scanner.py
# Copyright 2019 Benoit Perrot
#
# 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
#
# http://www.apache... | code_fim | hard | {
"lang": "python",
"repo": "BenoitPerrot/kuac",
"path": "/src/generator/python/protobuf/scanner.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Una simple cuenta atras
"""
while n > 0:
n -= 1
countdown(10000000)
# Acuérdate: ¿qué debería hacer en mi decorador para que aquí me informara correctamente de lo que hace mi método?
help(countdown)<|fim_prefix|># repo: workready/pythonbasic path: /ejercicios_resuelt... | code_fim | hard | {
"lang": "python",
"repo": "workready/pythonbasic",
"path": "/ejercicios_resueltos/t08/t08ejer01.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: workready/pythonbasic path: /ejercicios_resueltos/t08/t08ejer01.py
import time
from functools import wraps
def timethis(func):
'''
Decorador que informa sobre el tiempo de ejecucion de una funcion
'''
@wraps(func)
def wrapper(*args, **kwargs):
<|fim_suffix|># Codigo de prueba... | code_fim | medium | {
"lang": "python",
"repo": "workready/pythonbasic",
"path": "/ejercicios_resueltos/t08/t08ejer01.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ourse',
name='slope',
field=models.FloatField(blank=True, default=0.0, editable=False, null=True, verbose_name='Slope'),
),
migrations.AddField(
model_name='site',
name='ascent',
field=models.IntegerField(blank=True, default=0, ed... | code_fim | hard | {
"lang": "python",
"repo": "GeotrekCE/Geotrek-admin",
"path": "/geotrek/outdoor/migrations/0019_auto_20210311_1101.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GeotrekCE/Geotrek-admin path: /geotrek/outdoor/migrations/0019_auto_20210311_1101.py
# Generated by Django 3.1.7 on 2021-03-11 11:01
from django.conf import settings
import django.contrib.gis.db.models.fields
from django.db import migrations, models
class Migration(migrations.Migration):
... | code_fim | hard | {
"lang": "python",
"repo": "GeotrekCE/Geotrek-admin",
"path": "/geotrek/outdoor/migrations/0019_auto_20210311_1101.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>ield(
model_name='site',
name='length',
field=models.FloatField(blank=True, default=0.0, editable=False, null=True, verbose_name='3D Length'),
),
migrations.AddField(
model_name='site',
name='max_elevation',
field=mode... | code_fim | hard | {
"lang": "python",
"repo": "GeotrekCE/Geotrek-admin",
"path": "/geotrek/outdoor/migrations/0019_auto_20210311_1101.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> return samples
def normalize_data(
reference_signatures: List[str],
raw_reference_samples: List[Sample],
query_signatures: List[str],
raw_query_samples: List[Sample],
) -> Tuple[List[str], List[Dict[str, Any]], List[Dict[str, Any]]]:
signatures = list(set(reference_signatures + q... | code_fim | hard | {
"lang": "python",
"repo": "madetunj/mtsg",
"path": "/mtsg/commands/visualize.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: madetunj/mtsg path: /mtsg/commands/visualize.py
from dataclasses import dataclass, field
from pathlib import Path
from typing import Any, Dict, List, Optional, Tuple
import csv
import json
import re
import jinja2
import mtsg
HEADER_DELIMITER = "|"
MAX_SIGNATURE_NAME_COMPONENTS = 2
SIGNATURE_N... | code_fim | hard | {
"lang": "python",
"repo": "madetunj/mtsg",
"path": "/mtsg/commands/visualize.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>timer = Timer()
timer.start()
ea.analyze()
timer.stop()
timer.join()
if __name__ == '__main__':
print('ENERGY ANALYSIS')
print('---------------')
print(f'- Annual yield = {ea.get_annual_yield():.0f} kWh')
print(f'- Annual load = {ea.get_annual_load():.0f} kWh')
print('- monthly over... | code_fim | medium | {
"lang": "python",
"repo": "TomLXXVI/pypv",
"path": "/pypv/scripts/energy_analysis_03.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TomLXXVI/pypv path: /pypv/scripts/energy_analysis_03.py
# PART 3
# USER:
# -> PROGRAM: ENERGY ANALYSIS
from timer import Timer
from energy_analysis_02 import *
# **********************************************************************************************************************
ea = pv.Ene... | code_fim | medium | {
"lang": "python",
"repo": "TomLXXVI/pypv",
"path": "/pypv/scripts/energy_analysis_03.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>"""
import numpy as np
import transitionMatrix as tm
from transitionMatrix.predefined import JLT
from transitionMatrix import dataset_path
myState = tm.SnP_SS
print(myState.get_states())
print(myState.get_state_labels())
print(myState.definition)<|fim_prefix|># repo: Mill7/transitionMatrix path: /exa... | code_fim | medium | {
"lang": "python",
"repo": "Mill7/transitionMatrix",
"path": "/examples/python/state_space_operations.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>myState = tm.SnP_SS
print(myState.get_states())
print(myState.get_state_labels())
print(myState.definition)<|fim_prefix|># repo: Mill7/transitionMatrix path: /examples/python/state_space_operations.py
# encoding: utf-8
# (c) 2017-2019 Open Risk, all rights reserved
#
# TransitionMatrix is licensed under... | code_fim | hard | {
"lang": "python",
"repo": "Mill7/transitionMatrix",
"path": "/examples/python/state_space_operations.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Mill7/transitionMatrix path: /examples/python/state_space_operations.py
# encoding: utf-8
# (c) 2017-2019 Open Risk, all rights reserved
#
# TransitionMatrix is licensed under the Apache 2.0 license a copy of which is included
# in the source distribution of TransitionMatrix. This is notwithstan... | code_fim | medium | {
"lang": "python",
"repo": "Mill7/transitionMatrix",
"path": "/examples/python/state_space_operations.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if os.path.exists(self.source_file):
os.remove(self.source_file)
def get_classifier_from_file(self, source):
if os.path.isdir(source):
file_join(source, "classifier.save", FILE_CHUNK_SIZE)
self.source_file = "classifier.save"
else:
... | code_fim | hard | {
"lang": "python",
"repo": "AntDest/NURSE",
"path": "/src/Classifier.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AntDest/NURSE path: /src/Classifier.py
import os
import pickle
import pandas as pd
import numpy as np
import sklearn.feature_extraction
from src.utils.utils_file import file_join, FILE_CHUNK_SIZE
from src.utils.features import *
from src.utils.utils_variables import ENGLISH_WORDS
class ... | code_fim | hard | {
"lang": "python",
"repo": "AntDest/NURSE",
"path": "/src/Classifier.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self.activity_data is None:
return
# Fetch the current data entry based on the index
activity_data = self.activity_data[self.activity_index]
# Get the activity type and message from the activities configuration
activity_type = discord.ActivityType[a... | code_fim | medium | {
"lang": "python",
"repo": "captainkidd5/ChungleBot",
"path": "/cogs/activity_manager.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> message_values = {
"${guild_count}": str(len(self.bot.guilds)),
"${user_count}": str(len(self.bot.users)),
"${prefix}": self.bot.command_prefix
}
# Replace some template placeholders to create a dynamic string
replace = dict((re.escape(k... | code_fim | medium | {
"lang": "python",
"repo": "captainkidd5/ChungleBot",
"path": "/cogs/activity_manager.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: captainkidd5/ChungleBot path: /cogs/activity_manager.py
from discord.ext import commands, tasks
import discord, json, re
class activity_manager(commands.Cog):
def __init__(self, bot, file):
self.bot = bot
self.activity_data = None
self.activity_index = 0
# Lo... | code_fim | hard | {
"lang": "python",
"repo": "captainkidd5/ChungleBot",
"path": "/cogs/activity_manager.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tanmaylaud/incubator-superset path: /tests/db_engine_specs/hive_tests.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 li... | code_fim | hard | {
"lang": "python",
"repo": "tanmaylaud/incubator-superset",
"path": "/tests/db_engine_specs/hive_tests.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_job_1_launched_stage_1_map_80_reduce_40_progress(): # pylint: disable=invalid-name
log = """
17/02/07 19:15:55 INFO ql.Driver: Total jobs = 2
17/02/07 19:15:55 INFO ql.Driver: Launching Job 1 out of 2
17/02/07 19:16:09 INFO exec.Task: 2017-02-07 19:16:09,173 Stage-1 ... | code_fim | hard | {
"lang": "python",
"repo": "tanmaylaud/incubator-superset",
"path": "/tests/db_engine_specs/hive_tests.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __call__(self, *inputs: Tensor) -> Tensor:
...
def init_weights(self, seed: _int) -> None:
...
def copy_weights(self, net: MetaDRN) -> None:
...
...<|fim_prefix|># repo: RehmaRizvi/meta-drn-pytorch path: /typings/_model.pyi
import builtins
from torch import Tensor
from torch.nn... | code_fim | medium | {
"lang": "python",
"repo": "RehmaRizvi/meta-drn-pytorch",
"path": "/typings/_model.pyi",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RehmaRizvi/meta-drn-pytorch path: /typings/_model.pyi
import builtins
from torch import Tensor
from torch.nn import Module
from typing import Callable
import builtins
_int = builtins.int
class MetaDRN(Module):
def __init__(self, loss_fn: Callable[[Tensor], Tensor]) -> None:
...
<|fim_s... | code_fim | medium | {
"lang": "python",
"repo": "RehmaRizvi/meta-drn-pytorch",
"path": "/typings/_model.pyi",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> ...
def __call__(self, *inputs: Tensor) -> Tensor:
...
def init_weights(self, seed: _int) -> None:
...
def copy_weights(self, net: MetaDRN) -> None:
...
...<|fim_prefix|># repo: RehmaRizvi/meta-drn-pytorch path: /typings/_model.pyi
import builtins
from torch import Tensor
from... | code_fim | medium | {
"lang": "python",
"repo": "RehmaRizvi/meta-drn-pytorch",
"path": "/typings/_model.pyi",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Runtime optimization
tuple=tuple):
operators, operands = get_primitives(all_operators)
combo = get_sub_combinations(numops)
paren_combos = get_paren_combos()
product = itertools.product
try:
izip = itertools.izip
except AttributeError:
izip = z... | code_fim | hard | {
"lang": "python",
"repo": "berkerpeksag/astor",
"path": "/tests/build_expressions.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: berkerpeksag/astor path: /tests/build_expressions.py
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
Part of the astor library for Python AST manipulation.
License: 3-clause BSD
Copyright (c) 2015 Patrick Maupin
This module generates a lot of permutations of Python
expressions, and dumps th... | code_fim | hard | {
"lang": "python",
"repo": "berkerpeksag/astor",
"path": "/tests/build_expressions.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: diek/build_library_database path: /get_isbn_books.py
import simplejson as json
import requests
import os
BASE_URL = 'http://isbndb.com/api/v2/json/' + os.environ["ISBN_KEY"]
def get_subject_titles(subject):
url = BASE_URL + '/subjects?q=' + subject
resp = requests.get(url=url)
ret... | code_fim | hard | {
"lang": "python",
"repo": "diek/build_library_database",
"path": "/get_isbn_books.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def main():
subject = 'espionage'
book_titles = get_subject_titles(subject)
write_json(book_titles, 'espionage_titles')
json_book_detail = get_book_detail()
write_json(json_book_detail, 'espionage_books')
if __name__ == '__main__':
main()<|fim_prefix|># repo: diek/build_library_d... | code_fim | medium | {
"lang": "python",
"repo": "diek/build_library_database",
"path": "/get_isbn_books.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dimagi/commcare-hq path: /corehq/apps/reports/management/commands/prepare_projects_for_case_list_explorer.py
from datetime import datetime
from django.core.management import BaseCommand
from dimagi.utils.couch.database import iter_docs
from corehq.apps.case_search.models import DomainsNotInCase... | code_fim | hard | {
"lang": "python",
"repo": "dimagi/commcare-hq",
"path": "/corehq/apps/reports/management/commands/prepare_projects_for_case_list_explorer.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if DomainsNotInCaseSearchIndex.objects.count() > 0:
# don't run data integrity checks unless DomainsNotInCaseSearchIndex are all deleted
return
self.stdout.write("\n\nRunning data integrity checks...")
domain_mismatches = []
all_domain_ids = [d['id'... | code_fim | hard | {
"lang": "python",
"repo": "dimagi/commcare-hq",
"path": "/corehq/apps/reports/management/commands/prepare_projects_for_case_list_explorer.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: elgatito/script.elementum.burst path: /resources/site-packages/dns/flags.py
# Copyright (C) 2001-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provided that the above... | code_fim | hard | {
"lang": "python",
"repo": "elgatito/script.elementum.burst",
"path": "/resources/site-packages/dns/flags.py",
"mode": "psm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def from_text(text):
"""Convert a space-separated list of flag text values into a flags
value.
@rtype: int"""
return _from_text(text, _by_text)
def to_text(flags):
"""Convert a flags value into a space-separated list of flag text
values.
@rtype: string"""
return _to_te... | code_fim | hard | {
"lang": "python",
"repo": "elgatito/script.elementum.burst",
"path": "/resources/site-packages/dns/flags.py",
"mode": "spm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_suffix|> #initialize variable to hold list of numbers to traverse
numberList = [10, 15, 3, 7]
print ("Number List: " + str(numberList))
print ("Sum Of Any Two Numbers Target: " + str(sumTargetAnyTwo))
#initialize iterator variables to assist with the check
length= len(numberList)
iter1 ... | code_fim | hard | {
"lang": "python",
"repo": "JimLusk/python-algorithms",
"path": "/any-two-numbers-in-set-equal-given.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JimLusk/python-algorithms path: /any-two-numbers-in-set-equal-given.py
"""
Algorithm Objective
Given a list of numbers and a number k, return whether any two numbers from the list add up to k.
For example, given [10, 15, 3, 7] and k of 17, return true since 10 + 7 is 17.
Bonus: Can you do this i... | code_fim | hard | {
"lang": "python",
"repo": "JimLusk/python-algorithms",
"path": "/any-two-numbers-in-set-equal-given.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: luisparravicini/housapp path: /plot.py
#!/usr/bin/env python3
import re
import csv
import sys
import os
from datetime import datetime
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
if len(sys.argv) < 2:
print(f'usage: {sys.argv[0]} <path>')
os.sys.exit(1)
path =... | code_fim | hard | {
"lang": "python",
"repo": "luisparravicini/housapp",
"path": "/plot.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> index = pd.Index(np.arange(0, 24), name='Hour')
du = du.set_index('Hour').reindex(index)
du = du.fillna(0).reset_index()
values = du['count'].values
if bottom is None:
bottom = np.zeros(len(values))
ax.bar(du['Hour'].values, values, bottom=bot... | code_fim | hard | {
"lang": "python",
"repo": "luisparravicini/housapp",
"path": "/plot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>on we have to rely on the loading of
# this models.py
try:
import django.apps # noqa
except ImportError:
from .autoload import autoload_backends
autoload_backends()<|fim_prefix|># repo: team23/django_backend path: /django_backend/models.py
# Our goal is to auto-load all the default backends... | code_fim | medium | {
"lang": "python",
"repo": "team23/django_backend",
"path": "/django_backend/models.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: team23/django_backend path: /django_backend/models.py
# Our goal is to auto-load all the default backends when Django starts up.
# The preferre<|fim_suffix|>
except ImportError:
from .autoload import autoload_backends
autoload_backends()<|fim_middle|>d way to do so would be in DjangoBack... | code_fim | medium | {
"lang": "python",
"repo": "team23/django_backend",
"path": "/django_backend/models.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: meder411/Tangent-Images path: /examples/compare_sift_keypoints.py
import torch
import torch.nn.functional as F
from spherical_distortion.functional import create_tangent_images, unresample
from spherical_distortion.util import *
import matplotlib.pyplot as plt
from skimage import io
import os
# ... | code_fim | hard | {
"lang": "python",
"repo": "meder411/Tangent-Images",
"path": "/examples/compare_sift_keypoints.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|># Create a figure and axis handle
fig, ax = plt.subplots(1, 1)
# Set up the plot
ax.set_aspect(1, adjustable='box')
ax.imshow(img)
ax.get_xaxis().set_ticks([])
ax.get_yaxis().set_ticks([])
ax.plot(erp_kp[:, 0], erp_kp[:, 1], 'r.', markersize=0.7)
tangent_image_kp[(tangent_image_kp[:, [0]] >= img.shape[-2... | code_fim | hard | {
"lang": "python",
"repo": "meder411/Tangent-Images",
"path": "/examples/compare_sift_keypoints.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|># ---------------------------------------------------
# Compute SIFT descriptors on equirectangular image
# ---------------------------------------------------
erp_kp_details = sift_equirectangular(img, crop_degree=25)
erp_kp = erp_kp_details[0]
erp_desc = erp_kp_details[1]
print('Num Equirect. Keypoints:... | code_fim | hard | {
"lang": "python",
"repo": "meder411/Tangent-Images",
"path": "/examples/compare_sift_keypoints.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PrasongDev/django-postgres-vue-gitlab-ecs path: /backend/core/asgi_middleware.py
import jwt
from channels.auth import AuthMiddlewareStack, CookieMiddleware
from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.auth.models import AnonymousUser
from dja... | code_fim | hard | {
"lang": "python",
"repo": "PrasongDev/django-postgres-vue-gitlab-ecs",
"path": "/backend/core/asgi_middleware.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __call__(self, scope):
close_old_connections()
cookies = scope['cookies']
if 'user-token' in cookies:
token = jwt.decode(
cookies['user-token'],
settings.SECRET_KEY,
algorithms=['HS256']
)
u... | code_fim | medium | {
"lang": "python",
"repo": "PrasongDev/django-postgres-vue-gitlab-ecs",
"path": "/backend/core/asgi_middleware.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if x.dim() == 1:
x = x.unsqueeze(0)
x = x.int()
return torch.cat([self._evaluate_single(x[i]) for i in range(x.size(0))], dim=0)
def _evaluate_single(self, x):
assert x.numel() == self.n_variables
assert x.dim() == 1
command = self._generate_cmd(x)
start_time = time.time()
processes =... | code_fim | hard | {
"lang": "python",
"repo": "eric-vader/COMBO",
"path": "/COMBO/experiments/NAS/nas_binary.py",
"mode": "spm",
"license": "BSD-2-Clause-Views",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.n_vertices = np.array([2] * self.n_variables)
most_complex_model = NASBinaryCNN(data_type, np.ones(2 * (self.n_nodes - 2)),
np.triu(np.ones((self.n_nodes, self.n_nodes)), 1),
n_ch_in=self.n_ch_in, h_in=self.h_in, w_in=self.w... | code_fim | hard | {
"lang": "python",
"repo": "eric-vader/COMBO",
"path": "/COMBO/experiments/NAS/nas_binary.py",
"mode": "spm",
"license": "BSD-2-Clause-Views",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: eric-vader/COMBO path: /COMBO/experiments/NAS/nas_binary.py
import os
import sys
import time
import GPUtil
import subprocess
import numpy as np
from pthflops import count_ops
import torch
import torch.cuda
from COMBO.experiments.NAS.architecture_generate_binary import NASBinaryCNN
from COMBO.ex... | code_fim | hard | {
"lang": "python",
"repo": "eric-vader/COMBO",
"path": "/COMBO/experiments/NAS/nas_binary.py",
"mode": "psm",
"license": "BSD-2-Clause-Views",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PanDAWMS/panda-bigmon-core path: /core/monitor/views.py
import json
import logging
import pickle
import collections
from datetime import datetime, timedelta
from django.http import HttpResponse
from django.views.decorators.cache import never_cache
from core.monitor.modelsMonitor import AtlasDBA... | code_fim | hard | {
"lang": "python",
"repo": "PanDAWMS/panda-bigmon-core",
"path": "/core/monitor/views.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # end of test filling
currenthost = q.popleft()
runninghost = request.session["hostname"]
if (currenthost == runninghost):
if (datetime.now() - lastupdate) > timedelta(minutes=(periodOfAllServWorkRestart)) and \
(datetime.now() - lastupdate) < timedelta(mi... | code_fim | hard | {
"lang": "python",
"repo": "PanDAWMS/panda-bigmon-core",
"path": "/core/monitor/views.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.window = Window()
if __name__ == '__main__':
_application = App()<|fim_prefix|># repo: douglasciole/PySpriter path: /Application.py
#!/usr/bin/env python3
from Modules.Window import Window
class App():
<|fim_middle|>
def __init__(self):
| code_fim | easy | {
"lang": "python",
"repo": "douglasciole/PySpriter",
"path": "/Application.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
_application = App()<|fim_prefix|># repo: douglasciole/PySpriter path: /Application.py
#!/usr/bin/env python3
from Modules.Window import Window
class App():
<|fim_middle|> def __init__(self):
self.window = Window()
| code_fim | easy | {
"lang": "python",
"repo": "douglasciole/PySpriter",
"path": "/Application.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: douglasciole/PySpriter path: /Application.py
#!/usr/bin/env python3
from Modules.Window import Window
class App():
<|fim_suffix|>if __name__ == '__main__':
_application = App()<|fim_middle|> def __init__(self):
self.window = Window()
| code_fim | easy | {
"lang": "python",
"repo": "douglasciole/PySpriter",
"path": "/Application.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> attachments = [
{
"mrkdwn_in":[
"text",
"value"
],
"color":"#e1eb34",
"fallback":"["+ project_name +"] k8s Public Cluster",
"title":"Kubernetes Public Cluster",
"fields":[
{
"title":"Project",
"value": project_name,
"short":True
},
{
... | code_fim | medium | {
"lang": "python",
"repo": "isabella232/dollhouse",
"path": "/cloudfunction/rules/k8s_public_cluster.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: isabella232/dollhouse path: /cloudfunction/rules/k8s_public_cluster.py
import json
import requests
def k8s_public_cluster(message, token, url, channel):
project_name = message.get('resource').get('labels').get('project_id')
actor = message.get('protoPayload').get('authenticationInfo').get('pri... | code_fim | medium | {
"lang": "python",
"repo": "isabella232/dollhouse",
"path": "/cloudfunction/rules/k8s_public_cluster.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mrozekma/pytypecheck path: /predicates.py
class Predicate:
def __init__(self, fn, desc, onFail = None):
self.fn = fn
self.desc = desc
self.onFail = onFail
def __call__(self, *args, **kw):
<|fim_suffix|> def __repr__(self):
return self.desc
def oneof(*members):
return Predicate(
lam... | code_fim | medium | {
"lang": "python",
"repo": "mrozekma/pytypecheck",
"path": "/predicates.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return Predicate(
lambda candidate: start <= candidate <= end,
"between %s and %s" % (start, end),
lambda candidate: "%s not between %s and %s" % (candidate, start, end)
)<|fim_prefix|># repo: mrozekma/pytypecheck path: /predicates.py
class Predicate:
def __init__(self, fn, desc, onFail = None):... | code_fim | hard | {
"lang": "python",
"repo": "mrozekma/pytypecheck",
"path": "/predicates.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def inrange(start, end):
return Predicate(
lambda candidate: start <= candidate <= end,
"between %s and %s" % (start, end),
lambda candidate: "%s not between %s and %s" % (candidate, start, end)
)<|fim_prefix|># repo: mrozekma/pytypecheck path: /predicates.py
class Predicate:
def __init__(self, ... | code_fim | hard | {
"lang": "python",
"repo": "mrozekma/pytypecheck",
"path": "/predicates.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#! Nonlinear solver parameters
#! ---------------------------
#! Even linear problems are solved by a nonlinear solver (KISS rule) - only one
#! iteration is needed and the final rezidual is obtained for free.
solver_1 = {
'name' : 'newton',
'kind' : 'nls.newton',
'i_max' : 1,
'eps_a... | code_fim | hard | {
"lang": "python",
"repo": "certik/sfepy",
"path": "/input/poisson.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> 'i_max' : 1,
'eps_a' : 1e-10,
'eps_r' : 1.0,
'macheps' : 1e-16,
'lin_red' : 1e-2, # Linear system error < (eps_a * lin_red).
'ls_red' : 0.1,
'ls_red_warp' : 0.001,
'ls_on' : 1.1,
'ls_min' : 1e-5,
'check' : 0,
'delta' : 1e... | code_fim | hard | {
"lang": "python",
"repo": "certik/sfepy",
"path": "/input/poisson.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: certik/sfepy path: /input/poisson.py
# 14.02.2007
# last revision: 20.03.2008
#!
#! Poisson Equation
#! ================
#$ \centerline{Example input file, \today}
#! Mesh
#! ----
filename_mesh = 'database/simple.mesh'
#! Materials
#! ---------
#$ Here we define just a constant coefficient $c$ ... | code_fim | hard | {
"lang": "python",
"repo": "certik/sfepy",
"path": "/input/poisson.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>peptide = 'Ac-PEPTIDE-NH2'
RT = biolccc.calculateRT(peptide,
biolccc.rpAcnFaRod,
myChromoConditions)
print 'The retention time of', peptide, 'is', RT<|fim_prefix|># repo: levitsky/biolccc path: /src/examples/chromoconditions.py
from pyteomics import biolccc
myChromoConditions = biolccc.ChromoCon... | code_fim | hard | {
"lang": "python",
"repo": "levitsky/biolccc",
"path": "/src/examples/chromoconditions.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># The shape of the gradient. The example is a linear gradient
# from 0% to 90% of component B over 60 minutes.
myChromoConditions.setGradient(biolccc.Gradient(0.0, 90.0, 60.0))
# The flow rate in ml/min.
myChromoConditions.setFlowRate(0.0005)
peptide = 'Ac-PEPTIDE-NH2'
RT = biolccc.calculateRT(peptide,... | code_fim | medium | {
"lang": "python",
"repo": "levitsky/biolccc",
"path": "/src/examples/chromoconditions.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: levitsky/biolccc path: /src/examples/chromoconditions.py
from pyteomics import biolccc
myChromoConditions = biolccc.ChromoConditions()
# The column length in mm.
myChromoConditions.setColumnLength(100.0)
# The internal column diameter in mm.
myChromoConditions.setColumnDiameter(0.1)
# The ave... | code_fim | medium | {
"lang": "python",
"repo": "levitsky/biolccc",
"path": "/src/examples/chromoconditions.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>for i in range(Npts):
x = (i+.5)/Npts
r = Rmin*(Rmax/Rmin)**x
S_bkgnd = sigma_backgnd( r , disk_params )
Sigma = get_sigma( r , rs , qs , alphas , Machs , disk_params )
print r , Sigma , S_bkgnd<|fim_prefix|># repo: duffell/Duffell_Gap path: /gap.py
import math
#Only two parts of this code need to... | code_fim | hard | {
"lang": "python",
"repo": "duffell/Duffell_Gap",
"path": "/gap.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>qs = [2.5e-4,2e-4,2e-4]
rs = [13.1,33.0,68.6]
alphas = [1e-3,1e-3,1e-3]
Machs = [10.,12.,14.]
#Potential Disk Parameters to Feed to sigma_backgnd:
disk_params = [1,2,3,4,5,6]
#Range and Resolution of Output:
Rmin = 0.1
Rmax = 130
Npts = 1000
for i in range(Npts):
x = (i+.5)/Npts
r = Rmin*(Rmax/Rmi... | code_fim | hard | {
"lang": "python",
"repo": "duffell/Duffell_Gap",
"path": "/gap.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: duffell/Duffell_Gap path: /gap.py
import math
#Only two parts of this code need to be modified by the user. The "sigma_backgnd" function, and the values of qs, rs, alphas, Machs, and potentially Rmin, Rmax, Npts, which define the range and resolution you want to sample the disk model.
def del... | code_fim | medium | {
"lang": "python",
"repo": "duffell/Duffell_Gap",
"path": "/gap.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Ro9ueAdmin/django-orchestra path: /orchestra/contrib/services/migrations/0003_auto_20150917_0942.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('services', '0002_a... | code_fim | hard | {
"lang": "python",
"repo": "Ro9ueAdmin/django-orchestra",
"path": "/orchestra/contrib/services/migrations/0003_auto_20150917_0942.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>the bill lines of this services.<br>Defaults to <tt>'%s: %s' % (ugettext(handler.description), instance)</tt>", blank=True, max_length=256, verbose_name='Order description'),
),
migrations.AlterField(
model_name='service',
name='rate_algorithm',
field=mo... | code_fim | hard | {
"lang": "python",
"repo": "Ro9ueAdmin/django-orchestra",
"path": "/orchestra/contrib/services/migrations/0003_auto_20150917_0942.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>b = Matrix(4,4,
[[1,0,0,0],
[0,1,0,4],
[0,0,1,0],
[0,0,0,1]]
)
t = Tuple(4,3,2,1)
print(identity_matrix.inverse())
print(a * a.inverse())
print(a.inverse().transpose())
print(a.transpose().inverse())
print((identity_matrix * t).coords)
print((b * t).coords)
print((t *... | code_fim | medium | {
"lang": "python",
"repo": "joemfox/ray-tracer-challenge",
"path": "/matrix-test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: joemfox/ray-tracer-challenge path: /matrix-test.py
from features.Matrix import Matrix
from features.Tuple import Tuple
identity_matrix = Matrix(4,4,
[[1,0,0,0],
[0,1,0,0],
[0,0,1,0],
[0,0,0,1]]
)
a = Matrix(4,4,
[[8,2,2,2],
[3,-1,7,0],
[7,0,5,4],
... | code_fim | medium | {
"lang": "python",
"repo": "joemfox/ray-tracer-challenge",
"path": "/matrix-test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>t = Tuple(4,3,2,1)
print(identity_matrix.inverse())
print(a * a.inverse())
print(a.inverse().transpose())
print(a.transpose().inverse())
print((identity_matrix * t).coords)
print((b * t).coords)
print((t * identity_matrix).coords)<|fim_prefix|># repo: joemfox/ray-tracer-challenge path: /matrix-test.py
f... | code_fim | medium | {
"lang": "python",
"repo": "joemfox/ray-tracer-challenge",
"path": "/matrix-test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> options = {'use_gpu': False, 'verbose': True, 'accumulate_privacy': True, 'debugging': True}
instance = DpAdultSvmSgd(hyperparams, options)
priv, acc = instance.run()
print("Instance privacy: {}".format((priv, hyperparams['fixed_delta'])))
print("Instance accuracy: {}".format(acc))
... | code_fim | hard | {
"lang": "python",
"repo": "amzn/differential-privacy-bayesian-optimization",
"path": "/dpareto/models/adult/svm/dp_sgd.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: amzn/differential-privacy-bayesian-optimization path: /dpareto/models/adult/svm/dp_sgd.py
import mxnet as mx
from mxnet import nd, gluon
import numpy as np
import dpareto.data.adult.importer as importer
from dpareto.models.adult.base import AdultBase
from dpareto.utils.lot_sampler import LotSamp... | code_fim | hard | {
"lang": "python",
"repo": "amzn/differential-privacy-bayesian-optimization",
"path": "/dpareto/models/adult/svm/dp_sgd.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return num_training_examples, num_testing_examples, train_data_lot_iterator, train_data_eval_iterator, test_data
@staticmethod
def _get_loss_func():
return mx.gluon.loss.HingeLoss()
def _evaluate_accuracy(self, data_iterator):
num_correct = 0
total = 0
... | code_fim | hard | {
"lang": "python",
"repo": "amzn/differential-privacy-bayesian-optimization",
"path": "/dpareto/models/adult/svm/dp_sgd.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>@Runtime([numInstructions], 2)
def IsRegInstr(x): return 1 if x < numRegInstrs else 0
@Runtime([numInstructions], numRegInstrs)
def ToRegInstr(x): return x if x < numRegInstrs else 0
@Runtime([numInstructions], 2)
def IsCons(x): return 1 if x == 0 else 0
@Runtime([mutableStackSize], maxScalar)
def StackPt... | code_fim | hard | {
"lang": "python",
"repo": "briancabbott/GitHub-Repository-Downloader",
"path": "/TypeScript/codeql-processor/code/Microsoft-DPU/TerpreT/models/nfp_assembly_fixed_alloc.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>rue, default='', help_text='information about research fundings(e.g. JST CREST JPMJCR15E2).', max_length=512),
),
migrations.AlterField(
model_name='bibtex',
name='is_published',
field=models.BooleanField(blank=True, default=False, help_text='set True wh... | code_fim | hard | {
"lang": "python",
"repo": "getty708/PubZ",
"path": "/src/core/migrations/0005_auto_20200224_2253.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: getty708/PubZ path: /src/core/migrations/0005_auto_20200224_2253.py
# Generated by Django 2.2 on 2020-02-24 13:53
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('co... | code_fim | hard | {
"lang": "python",
"repo": "getty708/PubZ",
"path": "/src/core/migrations/0005_auto_20200224_2253.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: symmy596/uravu path: /uravu/tests/test_utils.py
"""
Tests for utils module
"""
# Copyright (c) Andrew R. McCluskey
# Distributed under the terms of the MIT License
# author: Andrew R. McCluskey
import unittest
import numpy as np
import scipy.stats
from uncertainties import ufloat
from numpy.tes... | code_fim | hard | {
"lang": "python",
"repo": "symmy596/uravu",
"path": "/uravu/tests/test_utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Test straight line function.
"""
test_x = np.linspace(0, 9, 10)
test_y = np.linspace(0, 18, 10)
result_y = utils.straight_line(test_x, 2, 0)
assert_almost_equal(result_y, test_y)
def test_bayes_factor_a(self):
"""
Test the ba... | code_fim | medium | {
"lang": "python",
"repo": "symmy596/uravu",
"path": "/uravu/tests/test_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_straight_line(self):
"""
Test straight line function.
"""
test_x = np.linspace(0, 9, 10)
test_y = np.linspace(0, 18, 10)
result_y = utils.straight_line(test_x, 2, 0)
assert_almost_equal(result_y, test_y)
def test_bayes_factor_a(self... | code_fim | medium | {
"lang": "python",
"repo": "symmy596/uravu",
"path": "/uravu/tests/test_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: baronrustamov/realtime-flask-experiment path: /realtime/webserver/socket_io.py
from flask import request
from flask_socketio import SocketIO
from realtime.database.adapter import db
from realtime.database.models import Subscriptions
from realtime.webserver.webapp import app
socket_io = SocketI... | code_fim | medium | {
"lang": "python",
"repo": "baronrustamov/realtime-flask-experiment",
"path": "/realtime/webserver/socket_io.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@socket_io.on('disconnect', namespace='/')
def on_disconnect():
(
db.session.query(Subscriptions)
.filter(Subscriptions.socket_io_id == request.sid)
.delete()
)
db.session.commit()<|fim_prefix|># repo: baronrustamov/realtime-flask-experiment path: /realtime/web... | code_fim | hard | {
"lang": "python",
"repo": "baronrustamov/realtime-flask-experiment",
"path": "/realtime/webserver/socket_io.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Case: Include defaults and internals.
"""
chunk_count = 2
chunk_index = 1
guild_id = 202307010009
nonce = 'koishi'
users = [User.precreate(202307010010), User.precreate(202307010011)]
for user in users:
user.guild_profiles[guild_id] = GuildProfile()
gu... | code_fim | hard | {
"lang": "python",
"repo": "HuyaneMatsu/hata",
"path": "/hata/discord/guild/guild_user_chunk_event/tests/test__GuildUserChunkEvent__data.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|> GuildUserChunkEvent.from_data(data)
vampytest.assert_eq(guild.users, {user.id: user for user in users})
def test__GuildUserChunkEvent__to_data__defaults_and_internals():
"""
Tests whether ``GuildUserChunkEvent.to_data`` works as intended.
Case: Include defaults and internal... | code_fim | hard | {
"lang": "python",
"repo": "HuyaneMatsu/hata",
"path": "/hata/discord/guild/guild_user_chunk_event/tests/test__GuildUserChunkEvent__data.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HuyaneMatsu/hata path: /hata/discord/guild/guild_user_chunk_event/tests/test__GuildUserChunkEvent__data.py
import vampytest
from ....guild import Guild
from ....user import User, GuildProfile
from ..guild_user_chunk_event import GuildUserChunkEvent
from .test__GuildUserChunkEvent__constructor ... | code_fim | hard | {
"lang": "python",
"repo": "HuyaneMatsu/hata",
"path": "/hata/discord/guild/guild_user_chunk_event/tests/test__GuildUserChunkEvent__data.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''
defines the type of sentence embedding
@param word_embeds: word embeddings - np array of arrays
@param rule: type of sentence embedding
@return sentence_embedding
'''
if rule == 'MEAN':
return np.mean(word_embeds, axis=0)
if rule == 'SUM':
ret... | code_fim | hard | {
"lang": "python",
"repo": "nstfk/SentEval",
"path": "/examples/elmo.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nstfk/SentEval path: /examples/elmo.py
from __future__ import absolute_import, division, unicode_literals
import sys
import numpy as np
import logging
import sklearn
import torch
import keras
import os
import sys
from allennlp.commands.elmo import ElmoEmbedder
import numpy as np
impo... | code_fim | hard | {
"lang": "python",
"repo": "nstfk/SentEval",
"path": "/examples/elmo.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|># import SentEval
sys.path.insert(0, PATH_TO_SENTEVAL)
import senteval
# Set params for SentEval
# we use logistic regression (usepytorch: Fasle) and kfold 10
# In this dictionary you can add extra information that you model needs for initialization
params_senteval = {'task_path': PATH_TO_DATA, 'u... | code_fim | hard | {
"lang": "python",
"repo": "nstfk/SentEval",
"path": "/examples/elmo.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>d=True,
help='An integer value representing the width of the cropping box.')
parser.add_argument('--H', metavar='<INIT_H', dest='INIT_H', action='store', required=True,
help='An integer value representing the height of the cropping box.')
args = va... | code_fim | hard | {
"lang": "python",
"repo": "JulianPitney/Glycine_Transporter-1_Antagonist_Provides_Neuroprotection_in_Vivo_Lightsheet_Analysis",
"path": "/Step3_CropVolume/tiff_stack_crop_tool/tiff_stack_crop_tool/cli.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JulianPitney/Glycine_Transporter-1_Antagonist_Provides_Neuroprotection_in_Vivo_Lightsheet_Analysis path: /Step3_CropVolume/tiff_stack_crop_tool/tiff_stack_crop_tool/cli.py
"""Console script for tiff_stack_crop_tool."""
import argparse
import sys
from tiff_stack_crop_tool.tiff_stack_crop_tool impo... | code_fim | hard | {
"lang": "python",
"repo": "JulianPitney/Glycine_Transporter-1_Antagonist_Provides_Neuroprotection_in_Vivo_Lightsheet_Analysis",
"path": "/Step3_CropVolume/tiff_stack_crop_tool/tiff_stack_crop_tool/cli.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vitroid/GenIce path: /genice2/lattices/RHO.py
# coding: utf-8
"""
Data source:
Huang, Y et al. “A New Phase Diagram of Water Under Negative Pressure: the Rise of the Lowest-Density Clathrate S-III.” Science Advances 2.2 (2016): e1501010–e1501010.
"""
from genice2.cell import cellvectors
import ge... | code_fim | medium | {
"lang": "python",
"repo": "vitroid/GenIce",
"path": "/genice2/lattices/RHO.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.cell = """
13.339813507 13.339813507 13.339813507
"""
self.waters = """
8.05324541418 1.38333866068 10.0048601303
1.38333866068 8.05324541418 3.33495337675
11.9564748463 3.33495337675 8.05324541418
5.28656809283 10.0048601303 1.383338660... | code_fim | medium | {
"lang": "python",
"repo": "vitroid/GenIce",
"path": "/genice2/lattices/RHO.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self):
self.cell = """
13.339813507 13.339813507 13.339813507
"""
self.waters = """
8.05324541418 1.38333866068 10.0048601303
1.38333866068 8.05324541418 3.33495337675
11.9564748463 3.33495337675 8.05324541418
5.28656809283 1... | code_fim | medium | {
"lang": "python",
"repo": "vitroid/GenIce",
"path": "/genice2/lattices/RHO.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: awesomemachinelearning/ELL path: /docs/tutorials/Boosting-classifier-accuracy-by-grouping-categories/pets_callback.py
#!/usr/bin/env python3
###############################################################################
#
# Project: Embedded Learning Library (ELL)
# File: pets_callback.py... | code_fim | hard | {
"lang": "python",
"repo": "awesomemachinelearning/ELL",
"path": "/docs/tutorials/Boosting-classifier-accuracy-by-grouping-categories/pets_callback.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if group:
# A group was detected, so take action
if group == "Dog":
# A prediction in the dog category group was detected, print a `woof`
print("Woof!")
elif group == "Cat":
# A prediction in the cat category group... | code_fim | hard | {
"lang": "python",
"repo": "awesomemachinelearning/ELL",
"path": "/docs/tutorials/Boosting-classifier-accuracy-by-grouping-categories/pets_callback.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # prepare required args
if code is None:
raise ValueError("Code must be set.")
if redirect_uri is None:
raise ValueError("Redirect_uri must be set.")
args = {
'type': 'web_server',
'client_id': self.client_id,
'cli... | code_fim | hard | {
"lang": "python",
"repo": "dpnova/django-socialite",
"path": "/socialite/apps/base/oauth20/helper.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dpnova/django-socialite path: /socialite/apps/base/oauth20/helper.py
import httplib2
import urllib
import sys
from utils import Error
try:
from urlparse import parse_qs, parse_qsl, urljoin
except ImportError:
from urlparse import urljoin
from cgi import parse_qs, parse_qsl
REQUEST_TO... | code_fim | hard | {
"lang": "python",
"repo": "dpnova/django-socialite",
"path": "/socialite/apps/base/oauth20/helper.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # prepare required args
args = {
'type': 'refresh',
'client_id': self.client_id,
'client_secret': self.client_secret,
'refresh_token': refresh_token,
}
# prepare optional args
if secret_type is not None:
a... | code_fim | hard | {
"lang": "python",
"repo": "dpnova/django-socialite",
"path": "/socialite/apps/base/oauth20/helper.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>Field(label=u'Teléfono',
required=False,
initial='',
help_text=u"¿Hay algún teléfono donde los ciudadanos interesados en tu campaña se puedan comunicar con tu comando?")<|fim_prefix|># repo: RedCiudadana/Votaithem... | code_fim | hard | {
"lang": "python",
"repo": "RedCiudadana/VotaithemeGuate",
"path": "/votainteligente_theme_red_ciudadana/forms.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.