text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: durkinza/Crypto path: /crypto/ciphers/aes/aes.py
x14, 0xde, 0x5e, 0x0b, 0xdb,
0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79,
0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08,
0xb... | code_fim | hard | {
"lang": "python",
"repo": "durkinza/Crypto",
"path": "/crypto/ciphers/aes/aes.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> end_loc = self.message_loc + self.block_size
# get the next block from self.message
section = self.message[self.message_loc:end_loc]
# return true or false if the block was able to be grabbed
if len(section) == 0:
self.gotBlock = False
retur... | code_fim | hard | {
"lang": "python",
"repo": "durkinza/Crypto",
"path": "/crypto/ciphers/aes/aes.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: durkinza/Crypto path: /crypto/ciphers/aes/aes.py
0x19, 0x73,
0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb,
0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79,
0xe7, 0xc8, 0x37, 0x... | code_fim | hard | {
"lang": "python",
"repo": "durkinza/Crypto",
"path": "/crypto/ciphers/aes/aes.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print(f"creating new log '{LOG_FILE_NAME}'")
while True:
content = input("\n** type in your message (or RETURN to leave): ")
if content == "":
end = input(">> do you really want to leave? (y/N) ")
if end == "y":
break
continue
... | code_fim | medium | {
"lang": "python",
"repo": "cn-uofbasel/BACnet",
"path": "/doc/precursers/2019_09-Sneakernet/Sneakernet/_old/create-log.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cn-uofbasel/BACnet path: /doc/precursers/2019_09-Sneakernet/Sneakernet/_old/create-log.py
#!/usr/bin/env python3
# Sneakernet/create-log.py
"""
write the log
#create identity | True
#input loop (interruptable) |
#create event ... | code_fim | hard | {
"lang": "python",
"repo": "cn-uofbasel/BACnet",
"path": "/doc/precursers/2019_09-Sneakernet/Sneakernet/_old/create-log.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jac002020/DCASE2020-1 path: /APRI/get_model_utils.py
'''
This script contains methods to compute several modelling steps:
get_features_selection(): trains a random_forest classifier and select the features that contribute significantly to the model outputs
get_dataframe_split(): to split source d... | code_fim | hard | {
"lang": "python",
"repo": "jac002020/DCASE2020-1",
"path": "/APRI/get_model_utils.py",
"mode": "psm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_suffix|> pipe_svc = Pipeline([('scl', StandardScaler()), ('cls', SVC())])
if svc_gridsearch:
print('Tuning parameters...')
grid_params_svc = [{'cls__kernel': ['linear','rbf'],
'cls__gamma': [0.001],
'cls__C': [1,100,10000]}]
gs... | code_fim | hard | {
"lang": "python",
"repo": "jac002020/DCASE2020-1",
"path": "/APRI/get_model_utils.py",
"mode": "spm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CBSDigital/Hiero-Wiretap path: /plugins/FnWiretapShotProcessor.py
"""A processor for sending shots to an Autodesk IFFFS server (Stone FS) via
Wiretap.
@author Brendan Holt
@date May 2014
@defgroup modFnWiretapShotProcessor FnWiretapShotProcessor
@{
"""
import os.path
import hiero.core
from hie... | code_fim | hard | {
"lang": "python",
"repo": "CBSDigital/Hiero-Wiretap",
"path": "/plugins/FnWiretapShotProcessor.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Populate export structure
root = self.exportTemplate.rootElement()
if clipName:
root.createChild(elementPath, True)
leaf = root[elementPath]
# Add preset to leaf element
# NOTE: Be sure to update the string representation o... | code_fim | hard | {
"lang": "python",
"repo": "CBSDigital/Hiero-Wiretap",
"path": "/plugins/FnWiretapShotProcessor.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> @details This method is a Qt slot for when the contents of the clip
name text box are manually edited.
"""
substitutions = {
'/': '',
'\\': ''
}
cursorPos = self.clipNameEdit.cursorPosition()
for char in subs... | code_fim | hard | {
"lang": "python",
"repo": "CBSDigital/Hiero-Wiretap",
"path": "/plugins/FnWiretapShotProcessor.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.num_outputs = num_outputs
state_in_h = tf.keras.layers.Input(shape=(self.cell_size, ), name="h")
state_in_c = tf.keras.layers.Input(shape=(self.cell_size, ), name="c")
seq_in = tf.keras.layers.Input(shape=(), name="seq_in", dtype=tf.int32)
# Preprocess observ... | code_fim | hard | {
"lang": "python",
"repo": "ray-project/maze-raylit",
"path": "/rllib/models/tf/recurrent_net.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ray-project/maze-raylit path: /rllib/models/tf/recurrent_net.py
import numpy as np
import gym
from gym.spaces import Discrete, MultiDiscrete
from typing import Dict, List
from ray.rllib.models.modelv2 import ModelV2
from ray.rllib.models.tf.tf_modelv2 import TFModelV2
from ray.rllib.policy.rnn_s... | code_fim | hard | {
"lang": "python",
"repo": "ray-project/maze-raylit",
"path": "/rllib/models/tf/recurrent_net.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Try adding a self child edge
node = random.choice(range(nodeNumber))
checkChildEdgeCycleDetection(node, node)
# Try adding a follow on edge from a descendant to an ancestor
checkFollowOnEdgeCycleDetection(tNode, fNode)
# Try addin... | code_fim | hard | {
"lang": "python",
"repo": "DataBiosphere/toil",
"path": "/src/toil/test/src/jobTest.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertTrue(checkpointJob.checkpoint)
if checkpointJobService is not None:
checkpointJob.addService(checkpointJobService)
if checkpointJobChild is not None:
checkpointJob.addChild(checkpointJobChild)
if checkpointJobFollowOn is not None:
... | code_fim | hard | {
"lang": "python",
"repo": "DataBiosphere/toil",
"path": "/src/toil/test/src/jobTest.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DataBiosphere/toil path: /src/toil/test/src/jobTest.py
adjacencyList))) > 0
and (fNode, tNode) not in childEdges and (fNode, tNode) not in followOnEdges):
checkFollowOnEdgeCycleDetection(fNode, tNode)
@slow
def testNewCheckpointIsLeafVertexNonRootCase(self... | code_fim | hard | {
"lang": "python",
"repo": "DataBiosphere/toil",
"path": "/src/toil/test/src/jobTest.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Blackdevil132/MachineLearning path: /src/qrl/Qtable3.py
import numpy as np
from src.qrl.Qtable import Qtable
# Qtable for 3-dim storing
class Qtable3(Qtable):
def __init__(self, action_space, observation_space_1, observation_space_2, observation_space_3):
Qtable.__init__(self)
... | code_fim | hard | {
"lang": "python",
"repo": "Blackdevil132/MachineLearning",
"path": "/src/qrl/Qtable3.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for dim1 in range(self.observation_space[0]):
print("%i " % dim1, end='')
for dim2 in self.table[dim1].keys():
print("%i " % dim2, end='')
for key in self.table[dim1][dim2].keys():
print("\t%i: " % key, end='')
... | code_fim | hard | {
"lang": "python",
"repo": "Blackdevil132/MachineLearning",
"path": "/src/qrl/Qtable3.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.table[state[0]][state[1]][state[2]][action]
def update(self, state, action, newValue):
self.table[state[0]][state[1]][state[2]][action] = newValue
def show(self):
for dim1 in range(self.observation_space[0]):
print("%i " % dim1, end='')
... | code_fim | hard | {
"lang": "python",
"repo": "Blackdevil132/MachineLearning",
"path": "/src/qrl/Qtable3.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class MeasuringPointAdmin(admin.ModelAdmin):
fieldsets = (
(None, {
'fields': (('name', 'slug'), ('location', 'city'), 'amsl', 'form_id', 'eu_typing',
'category', 'image', 'position'),
}),
('Angezeigte Messwerte', {
'description': 'Nur d... | code_fim | hard | {
"lang": "python",
"repo": "CodeforLeipzig/luftqualitaet_sachsen",
"path": "/luftqualitaet_sachsen/measuring_stations/admin.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CodeforLeipzig/luftqualitaet_sachsen path: /luftqualitaet_sachsen/measuring_stations/admin.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from .models import IndicatedValue, MeasuringPoint
<|fim_suffix|> date_hierarchy = 'date_created'
... | code_fim | medium | {
"lang": "python",
"repo": "CodeforLeipzig/luftqualitaet_sachsen",
"path": "/luftqualitaet_sachsen/measuring_stations/admin.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> fieldsets = (
(None, {
'fields': (('name', 'slug'), ('location', 'city'), 'amsl', 'form_id', 'eu_typing',
'category', 'image', 'position'),
}),
('Angezeigte Messwerte', {
'description': 'Nur die ausgewählten Messwerte werden auf der Detai... | code_fim | medium | {
"lang": "python",
"repo": "CodeforLeipzig/luftqualitaet_sachsen",
"path": "/luftqualitaet_sachsen/measuring_stations/admin.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
### Utility TF functions ###
def infer_length(seq, eos_ix, time_major=False, dtype=tf.int32):
"""
compute length given output indices and eos code
:param seq: tf matrix [time,batch] if time_major else [batch,time]
:param eos_ix: integer index of end-of-sentence token
:returns: lengt... | code_fim | hard | {
"lang": "python",
"repo": "rongpenl/nlp_course",
"path": "/week04_seq2seq/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def to_lines(self, matrix, crop=True):
"""
Convert matrix of token ids into strings
:param matrix: matrix of tokens of int32, shape=[batch,time]
:param crop: if True, crops BOS and EOS from line
:return:
"""
lines = []
for line_ix in map(... | code_fim | hard | {
"lang": "python",
"repo": "rongpenl/nlp_course",
"path": "/week04_seq2seq/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rongpenl/nlp_course path: /week04_seq2seq/utils.py
import sys
import numpy as np
import tensorflow as tf
class Vocab:
def __init__(self, tokens, bos="_BOS_", eos="_EOS_", unk='_UNK_'):
"""
A special class that converts lines of tokens into matrices and backwards
"""
... | code_fim | hard | {
"lang": "python",
"repo": "rongpenl/nlp_course",
"path": "/week04_seq2seq/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Update 1 minute bar into generator
"""
if not xmin_bar:
xmin_bar = BarData(
symbol=bar.symbol,
exchange=bar.exchange,
datetime=bar.datetime,
gateway_name=bar.gateway_name,
open_p... | code_fim | hard | {
"lang": "python",
"repo": "zhengquantao/ctpbee",
"path": "/ctpbee/data_handle/generator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zhengquantao/ctpbee path: /ctpbee/data_handle/generator.py
# encoding: UTF-8
from ctpbee.constant import BarData, TickData, SharedData, EVENT_BAR, EVENT_SHARED
from ctpbee.event_engine import Event
class DataGenerator:
"""
For:
1. generating 1 minute bar data from tick data
2. ... | code_fim | hard | {
"lang": "python",
"repo": "zhengquantao/ctpbee",
"path": "/ctpbee/data_handle/generator.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def generate(self):
if self.bar is not None:
self.bar.interval = 1
event = Event(type=EVENT_BAR, data=self.bar)
self.rpo.put(event)
for x in self.XMIN:
if self.bar is not None:
bar = getattr(self, "min_{}_bar".format(x))
... | code_fim | hard | {
"lang": "python",
"repo": "zhengquantao/ctpbee",
"path": "/ctpbee/data_handle/generator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: omni-us/narchi path: /narchi_tests/instantiators_tests.py
#!/usr/bin/env python3
"""Unit tests for instantiators."""
# pylint: disable=no-member
import os
import shutil
import tempfile
import unittest
from copy import deepcopy
from narchi.instantiators.common import import_object
from narchi.mo... | code_fim | hard | {
"lang": "python",
"repo": "omni-us/narchi",
"path": "/narchi_tests/instantiators_tests.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> widths = [128, 96, 64]
images = [torch.rand(3, 64, widths[0]), torch.rand(3, 64, widths[1]), torch.rand(3, 64, widths[2])]
# Conv2dPacked #
block = Conv2dPacked(in_channels=3, out_channels=5, kernel_size=7, padding=3)
packed_images = pack_2d_sequences(images, gap_s... | code_fim | hard | {
"lang": "python",
"repo": "omni-us/narchi",
"path": "/narchi_tests/instantiators_tests.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>__all__ = [
'filter_tilespec_using_features'
]<|fim_prefix|># repo: Rhoana/rh_aligner path: /rh_aligner/image_filter/__init__.py
"""
Image filtering library - to filter out empty images
"""
<|fim_middle|>from .filter_tilespec_using_features import filter_tilespec_using_features
| code_fim | medium | {
"lang": "python",
"repo": "Rhoana/rh_aligner",
"path": "/rh_aligner/image_filter/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Rhoana/rh_aligner path: /rh_aligner/image_filter/__init__.py
"""
Image filtering library - to filter out empty images
"""
<|fim_suffix|>__all__ = [
'filter_tilespec_using_features'
]<|fim_middle|>from .filter_tilespec_using_features import filter_tilespec_using_features
| code_fim | medium | {
"lang": "python",
"repo": "Rhoana/rh_aligner",
"path": "/rh_aligner/image_filter/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class BiphaseMarkPainter(ManchesterPainter):
_was_white = True
def draw_rectangle(self, bit, context, width, height):
if bit:
if self._was_white:
first_callback = self._draw_black_rectangle
second_callback = self._draw_white_rectangle
... | code_fim | hard | {
"lang": "python",
"repo": "erbridge/codify",
"path": "/codify.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: erbridge/codify path: /codify.py
#!/usr/bin/env python
import math
import cairo
from bitarray import bitarray
class Painter:
black_rgba = (0, 0, 0, 1)
white_rgba = (1, 1, 1, 0)
def _draw_black_rectangle(self, context, width, height):
context.set_source_rgba(0, 0, 0, 1)
... | code_fim | hard | {
"lang": "python",
"repo": "erbridge/codify",
"path": "/codify.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert result == {'foo': {'bar': 'baz'}, 'spam': 'ham'}
def test_loads() -> None:
result = loads('{ "foo": { "bar": "baz" }, "spam": "ham" }')
assert result == {'foo': {'bar': 'baz'}, 'spam': 'ham'}
@pytest.mark.parametrize(
'data,key,expected',
[
({'foo': {'bar': {'baz': ... | code_fim | medium | {
"lang": "python",
"repo": "vaelen/Erasmus",
"path": "/tests/test_json.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vaelen/Erasmus path: /tests/test_json.py
from __future__ import annotations
from typing import Any
import pytest
import pytest_mock
from erasmus.json import get, has, load, loads
def test_load(mocker: pytest_mock.MockFixture) -> None:
mock = mocker.mock_open(read_data='{ "foo": { "bar": ... | code_fim | hard | {
"lang": "python",
"repo": "vaelen/Erasmus",
"path": "/tests/test_json.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> info = {"user_id":self.data["user"].id,"text":text}
Skill.insert(**info)
def delete_skill(self, text):
get_core = Skill.find_user_id(self.data["user"].id)
if get_core["status"]:
for i in get_core["skills"]:
if i.text == text:
... | code_fim | hard | {
"lang": "python",
"repo": "PooyaFekri/LinkedIn",
"path": "/ui/next_page_of_edite_person.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PooyaFekri/LinkedIn path: /ui/next_page_of_edite_person.py
from datetime import datetime
from PyQt5 import QtCore, QtGui, QtWidgets
from tables import Skill, Language, Experience, Connection
from tables.notification import Notification
class Ui_MainWindow(object):
def setupUi(self, MainWi... | code_fim | hard | {
"lang": "python",
"repo": "PooyaFekri/LinkedIn",
"path": "/ui/next_page_of_edite_person.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ignaeche/recaman-sequence path: /plot.py
from recaman import recaman, recaman_circles, Quadrant, Direction
import argparse, os, itertools
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from matplotlib import patches, animation
from matplotlib.axes import Axes
from tqdm... | code_fim | hard | {
"lang": "python",
"repo": "ignaeche/recaman-sequence",
"path": "/plot.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def remove_patches(axes: Axes):
[p.remove() for p in reversed(axes.patches)]
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Plot the first N numbers of the Recamán sequence')
parser.add_argument('N', type=int)
parser.add_argument('--start', type=int, default=0, m... | code_fim | hard | {
"lang": "python",
"repo": "ignaeche/recaman-sequence",
"path": "/plot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def animate_frame(frame, axes, circles, patch_list):
(n, deg) = frame
circle = circles[n]
if deg == 0:
# First frame on new semicircle
angle = 180 if circle['direction'] == Direction.RIGHT else 0
arc = make_semicircle(circle['center'], circle['diameter'], (angle, angle)... | code_fim | hard | {
"lang": "python",
"repo": "ignaeche/recaman-sequence",
"path": "/plot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dingmyu/facenet path: /ijcai18/extract_feature.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
import numpy as np
import argparse
import math
from scipy import misc
import time
import os
import sys
sys.path.... | code_fim | hard | {
"lang": "python",
"repo": "dingmyu/facenet",
"path": "/ijcai18/extract_feature.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def parse_arguments(argv):
parser = argparse.ArgumentParser()
parser.add_argument('--image_size', type=int,
help='Image size (height, width) in pixels.', default=160)
parser.add_argument('--batch_size', type=int,
default=1)
parser.add_argument('--filename', type=str,
... | code_fim | hard | {
"lang": "python",
"repo": "dingmyu/facenet",
"path": "/ijcai18/extract_feature.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>.linestyle'] = '--' # dashed grid
plt.rcParams.update({'font.size': 12.0}) # increase plot font size
# config_plots()<|fim_prefix|># repo: FMS-Mu2e/CalibMagnetCalc path: /FEMM/scripts/plotting.py
import matplotlib.pyplot as plt
# nicer plot formatting
def config_plots():
#must run twic... | code_fim | hard | {
"lang": "python",
"repo": "FMS-Mu2e/CalibMagnetCalc",
"path": "/FEMM/scripts/plotting.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>e # turn grid lines on
plt.rcParams['axes.axisbelow'] = True # put grid below points
plt.rcParams['grid.linestyle'] = '--' # dashed grid
plt.rcParams.update({'font.size': 12.0}) # increase plot font size
# config_plots()<|fim_prefix|># repo: FMS-Mu2e/CalibMagnetCal... | code_fim | medium | {
"lang": "python",
"repo": "FMS-Mu2e/CalibMagnetCalc",
"path": "/FEMM/scripts/plotting.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: FMS-Mu2e/CalibMagnetCalc path: /FEMM/scripts/plotting.py
import matplotlib.pyplot as plt
# nicer plot formatting
def config_plots():
#must run twice for some reason (glitch in Jupyte<|fim_suffix|>e # turn grid lines on
plt.rcParams['axes.axisbelow'] = True # put grid below... | code_fim | medium | {
"lang": "python",
"repo": "FMS-Mu2e/CalibMagnetCalc",
"path": "/FEMM/scripts/plotting.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> opengles.glNormalPointer(GL_BYTE, 0, RECT_NORMALS);
opengles.glVertexPointer(3, GL_BYTE, 0, verts);
Utility.load_identity()
Utility.translatef(x, y, z)
Utility.scalef(w, h, 1)
if r:
Utility.rotatef(r, 0, 0, 1)
with Texture.Loader(tex,RECT_TEX_COORDS,GL_BYTE):
opengles.glDrawElements(... | code_fim | hard | {
"lang": "python",
"repo": "JamesR1/pi3d",
"path": "/pi3d/util/Draw.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JamesR1/pi3d path: /pi3d/util/Draw.py
from pi3d import *
from pi3d import Texture
from pi3d.util import Utility
RECT_NORMALS = c_bytes(( 0,0,-1, 0,0,-1, 0,0,-1, 0,0,-1 ))
RECT_TEX_COORDS = c_bytes(( 0,255, 255,255, 255,0, 0,0))
RECT_TEX_COORDS2 = c_floats(( 0,1, 1,1, 1,0, 0,0))
RECT_VERTS_TL = c... | code_fim | hard | {
"lang": "python",
"repo": "JamesR1/pi3d",
"path": "/pi3d/util/Draw.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> view.set_view_manager(self)
view.set_size(self.size)
self.views.append(view)
def remove_top_view(self):
self.views.pop()
def handle_key(self, key_name):
self.get_top_view().handle_key(key_name)<|fim_prefix|># repo: vivlim/Adafruit_Python_SSD1306 path: /vi... | code_fim | hard | {
"lang": "python",
"repo": "vivlim/Adafruit_Python_SSD1306",
"path": "/view_manager.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.views.pop()
def handle_key(self, key_name):
self.get_top_view().handle_key(key_name)<|fim_prefix|># repo: vivlim/Adafruit_Python_SSD1306 path: /view_manager.py
from enum import Enum
from PIL import Image
from PIL import ImageDraw
class ViewManager:
def __init__(self, size, ... | code_fim | medium | {
"lang": "python",
"repo": "vivlim/Adafruit_Python_SSD1306",
"path": "/view_manager.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vivlim/Adafruit_Python_SSD1306 path: /view_manager.py
from enum import Enum
from PIL import Image
from PIL import ImageDraw
class ViewManager:
def __init__(self, size, root_view, mode):
self.size = size
self.image = Image.new(mode, size)
self.draw = ImageDraw.Draw(sel... | code_fim | hard | {
"lang": "python",
"repo": "vivlim/Adafruit_Python_SSD1306",
"path": "/view_manager.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Nike-Inc/signal_analog path: /signal_analog/errors.py
class SignalAnalogError(Exception):
"""Base exception for any invalid states in the Signal Analog library."""
pass
class ResourceMatchNotFoundError(SignalAnalogError):
"""Resource not found error."""
def __init__(self, resou... | code_fim | hard | {
"lang": "python",
"repo": "Nike-Inc/signal_analog",
"path": "/signal_analog/errors.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> error_msg = """
"{0}" has more than one exact match in SignalFx. Unwilling to choose a
resource at random.
"""
super(ResourceHasMultipleExactMatchesError, self).__init__(
error_msg.format(dashboard_name))
class ProgramValidationError(SignalAnalogError):
""... | code_fim | medium | {
"lang": "python",
"repo": "Nike-Inc/signal_analog",
"path": "/signal_analog/errors.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class ResourceAlreadyExistsError(SignalAnalogError):
"""Resource already exists error."""
def __init__(self, name):
# TODO this error message should be updated to add hints about a
# --force option when it becomes implemented.
error_msg = """
A resource with the name "... | code_fim | medium | {
"lang": "python",
"repo": "Nike-Inc/signal_analog",
"path": "/signal_analog/errors.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vnck/Connect-X-With-RL path: /backend/deepqconv_model.py
import torch
import torch.nn as nn
import torch.optim as optim
import numpy as np
class DeepModel(nn.Module):
def __init__(
self,
num_states,
num_actions,
):
super(DeepModel, self).__init__()
... | code_fim | hard | {
"lang": "python",
"repo": "vnck/Connect-X-With-RL",
"path": "/backend/deepqconv_model.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def predict(self, inputs):
return self.model(torch.from_numpy(inputs).float().to(self.device))
def train(self, TargetNet):
if len(self.experience['s']) < self.min_experiences:
# only start training process if enough experiences in buffer
return 0
#... | code_fim | hard | {
"lang": "python",
"repo": "vnck/Connect-X-With-RL",
"path": "/backend/deepqconv_model.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.model.load_state_dict(TrainNet.model.state_dict())
def save_weights(self, path):
torch.save(self.model.state_dict(), path)
def load_weights(self, path):
self.model.load_state_dict(torch.load(path, map_location=self.device))
def preprocess(self, state):
#... | code_fim | hard | {
"lang": "python",
"repo": "vnck/Connect-X-With-RL",
"path": "/backend/deepqconv_model.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jeremiedecock/snippets path: /python/pyqt/pyqt5/widget_QWebEngineView_with_mathjax_offline.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# See http://doc.qt.io/qt-5/qwebengineview.html#details
# This class replace the deprecated QWebView (based on QtWebKit).
# See:
# - https://stackoverflow... | code_fim | hard | {
"lang": "python",
"repo": "jeremiedecock/snippets",
"path": "/python/pyqt/pyqt5/widget_QWebEngineView_with_mathjax_offline.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># The next two lines are a workaround to fix an issue with QWebEngineView (see https://github.com/ContinuumIO/anaconda-issues/issues/9199#issuecomment-383842265)
import ctypes
ctypes.CDLL("libGL.so.1", mode=ctypes.RTLD_GLOBAL)
import sys
from PyQt5.QtCore import *
from PyQt5.QtWebEngineWidgets import QWe... | code_fim | hard | {
"lang": "python",
"repo": "jeremiedecock/snippets",
"path": "/python/pyqt/pyqt5/widget_QWebEngineView_with_mathjax_offline.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Heck-R/Packages path: /URL/url.py
# Keypirinha: a fast launcher for Windows (keypirinha.com)
import keypirinha as kp
import keypirinha_util as kpu
import re
import socket
class URL(kp.Plugin):
"""Launch URLs"""
WEB_SCHEMES = ("http", "https", "ftp")
KNOWN_TLDS = set(( # so... | code_fim | hard | {
"lang": "python",
"repo": "Heck-R/Packages",
"path": "/URL/url.py",
"mode": "psm",
"license": "Zlib",
"source": "the-stack-v2"
} |
<|fim_suffix|> if url_scheme in self.WEB_SCHEMES:
kpu.execute_default_action(self, item, action)
else:
kpu.shell_execute(item.target())
def on_events(self, flags):
if flags & kp.Events.PACKCONFIG:
self._read_config()
def _read_config(self):
... | code_fim | hard | {
"lang": "python",
"repo": "Heck-R/Packages",
"path": "/URL/url.py",
"mode": "spm",
"license": "Zlib",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sauravgarg540/executors path: /jinahub/segmenters/Sentencizer/tests/integration/test_exec.py
__copyright__ = "Copyright (c) 2020-2021 Jina AI Limited. All rights reserved."
__license__ = "Apache-2.0"
<|fim_suffix|> f = Flow().add(uses=Sentencizer)
with f:
resp = f.post(on='/test',... | code_fim | medium | {
"lang": "python",
"repo": "sauravgarg540/executors",
"path": "/jinahub/segmenters/Sentencizer/tests/integration/test_exec.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> f = Flow().add(uses=Sentencizer)
with f:
resp = f.post(on='/test', inputs=Document(text='Hello. World! Go? Back'), return_results=True)
assert resp[0].docs[0].chunks[0].text == 'Hello.'
assert resp[0].docs[0].chunks[1].text == 'World!'
assert resp[0].docs[0].chunks[... | code_fim | medium | {
"lang": "python",
"repo": "sauravgarg540/executors",
"path": "/jinahub/segmenters/Sentencizer/tests/integration/test_exec.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>se the Amazon Web Services (AWS) SDK
.. moduleauthor:: dataday
"""
__all__ = ['generate_identity', 'generate_policy']<|fim_prefix|># repo: dataday/aws-utilities-sdk path: /iam/__init__.py
"""
.. module:: aws_utilities_cli.iam
:platform: OS X
<|fim_middle|> :synopsis: Small collection of utilities... | code_fim | easy | {
"lang": "python",
"repo": "dataday/aws-utilities-sdk",
"path": "/iam/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dataday/aws-utilities-sdk path: /iam/__init__.py
"""
.. module:: aws_utilities_cli.iam
:platform: OS X
<|fim_suffix|>aday
"""
__all__ = ['generate_identity', 'generate_policy']<|fim_middle|> :synopsis: Small collection of utilities that
use the Amazon Web Services (AWS) SDK
.. mod... | code_fim | medium | {
"lang": "python",
"repo": "dataday/aws-utilities-sdk",
"path": "/iam/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HankyWang/project-in-BUPT path: /5-6 Foundations of Natural Language Processing/Detecting sentiment polarity/polar.py
#-*- coding: UTF-8 -*-
import re
import math
import numpy as np
# 否定词词典,仅通过简单观测构建
noDict = {
'no',
'not',
't',
'never',
'none',
'less',
'few',
't... | code_fim | hard | {
"lang": "python",
"repo": "HankyWang/project-in-BUPT",
"path": "/5-6 Foundations of Natural Language Processing/Detecting sentiment polarity/polar.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> count_no_word = 0
for sent in train_pos_sents:
for w in sent:
if w in polar_dict:
if count_no_word % 2 == 0:
pos_vec[polar_list.index(w)] += 1
else:
pos_vec[polar_list.index(w) + len_polar_dict] += 1
... | code_fim | hard | {
"lang": "python",
"repo": "HankyWang/project-in-BUPT",
"path": "/5-6 Foundations of Natural Language Processing/Detecting sentiment polarity/polar.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i, row in enumerate(csv_reader):
if i == 0:
continue
filename, name = row
write_name_to_image(name, filename, args.output_path)
if __name__ == "__main__":
main()<|fim_prefix|># repo: onhernandes/auto-cat-namer path: /auto_cat_namer/__m... | code_fim | medium | {
"lang": "python",
"repo": "onhernandes/auto-cat-namer",
"path": "/auto_cat_namer/__main__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: onhernandes/auto-cat-namer path: /auto_cat_namer/__main__.py
import argparse
import csv
from .catscanner import write_name_to_image
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--input-csv", help="Load data from CSV like (filename, name)")
parser.add_argument(... | code_fim | medium | {
"lang": "python",
"repo": "onhernandes/auto-cat-namer",
"path": "/auto_cat_namer/__main__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if args.input_csv is None or args.output_path is None:
print("You must pass --input-csv and output--path")
return
with open(args.input_csv) as csv_file:
csv_reader = csv.reader(csv_file, delimiter=",")
for i, row in enumerate(csv_reader):
if i ... | code_fim | hard | {
"lang": "python",
"repo": "onhernandes/auto-cat-namer",
"path": "/auto_cat_namer/__main__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mindspore-ai/models path: /research/cv/CTSDG/src/trainer.py
# Copyright 2022 Huawei Technologies Co., Ltd
#
# 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... | code_fim | hard | {
"lang": "python",
"repo": "mindspore-ai/models",
"path": "/research/cv/CTSDG/src/trainer.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Discriminator TrainOneStepCell"""
def construct(self, *inputs):
"""construct"""
loss = self.network(*inputs)
grads = self.grad(self.network, self.weights)(*inputs, self.scale_sense * 1.)
if self.reducer_flag:
grads = self.grad_reducer(grads)
l... | code_fim | hard | {
"lang": "python",
"repo": "mindspore-ai/models",
"path": "/research/cv/CTSDG/src/trainer.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TermiNutZ/pills_online path: /pills_online/permissions.py
from rest_framework import permissions
class RegistrationPermission(permissions.BasePermission):
"""
Permission:
For registration method for unauth users
"""
message = 'Access denied'
<|fim_suffix|> return Fal... | code_fim | hard | {
"lang": "python",
"repo": "TermiNutZ/pills_online",
"path": "/pills_online/permissions.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class GetAuthPermission(permissions.BasePermission):
"""
Permission:
For GET queries with auth permission
"""
message = 'No auth permission'
def has_permission(self, request, view):
if request.user.is_authenticated and request.method == 'GET':
return True
... | code_fim | medium | {
"lang": "python",
"repo": "TermiNutZ/pills_online",
"path": "/pills_online/permissions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print(d) # Checking if the dictionary was updated properly
first = 0
second = 0
# Calculating the final point of the turtle
for x in d:
if x == 'east':
first += d[x]
elif x == 'north':
second += d[x]
elif x == 'west':
first -= d[x]
elif x == 'south... | code_fim | hard | {
"lang": "python",
"repo": "sichkar-valentyn/Coordinates_of_turtle_by_input_commands",
"path": "/Coordinates_of_turtle_by_input_commands.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sichkar-valentyn/Coordinates_of_turtle_by_input_commands path: /Coordinates_of_turtle_by_input_commands.py
# File: Coordinates_of_turtle_by_input_commands.py
# Description: Calculating final coordinates for turtle by input commands
# Environment: PyCharm and Anaconda environment
#
# MIT Licen... | code_fim | hard | {
"lang": "python",
"repo": "sichkar-valentyn/Coordinates_of_turtle_by_input_commands",
"path": "/Coordinates_of_turtle_by_input_commands.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Going through all commands
for i in range(n):
string = input().split() # Splitting the line by gap into command and value
update_coordinates(d, string[0], int(string[1]))
print(d) # Checking if the dictionary was updated properly
first = 0
second = 0
# Calculating the final poin... | code_fim | hard | {
"lang": "python",
"repo": "sichkar-valentyn/Coordinates_of_turtle_by_input_commands",
"path": "/Coordinates_of_turtle_by_input_commands.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> rnn_in = batch_to_seq(fc_output, nenvs, step_size)
masks = batch_to_seq(masks, nenvs, step_size)
rnn_output, rnn_state = lstm_network(inputs=rnn_in,
keep_props=masks,
state... | code_fim | hard | {
"lang": "python",
"repo": "gstoica27/cpg_ppo",
"path": "/network_class.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> inpt,
masks,
rnn_state,
num_actions,
lstm_unit,
nenvs,
step_size,
scope,
is_train=False):
with tf.variable_scope('cnn... | code_fim | hard | {
"lang": "python",
"repo": "gstoica27/cpg_ppo",
"path": "/network_class.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gstoica27/cpg_ppo path: /network_class.py
import numpy as np
import tensorflow as tf
import tensorflow.contrib.layers as layers
from rlsaber.tf_util import lstm, batch_to_seq, seq_to_batch
from utils import *
from collections import defaultdict
class Network(object):
def __init__(self,
... | code_fim | hard | {
"lang": "python",
"repo": "gstoica27/cpg_ppo",
"path": "/network_class.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dpesce/LLAGNSED path: /example_script.py
#####################################
# inputs
m = 6.5e9 # black hole mass, in solar masses
mdot = 1.0e-5 # Eddington rate
nu_min = 1.0e8 # minimum frequency, in Hz
nu_max = 1.0e22 # maximum frequency, in Hz
####... | code_fim | medium | {
"lang": "python",
"repo": "dpesce/LLAGNSED",
"path": "/example_script.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ax.loglog()
ax.legend()
ax.set_xlabel(r'$\nu$ (Hz)')
ax.set_ylabel(r'$\nu L_{\nu}$ (erg s$^{-1}$)')
ax.set_xlim(1.0e8,1.0e22)
ax.set_ylim(1.0e35,1.0e43)
plt.savefig('example_SED.png',bbox_inches='tight',dpi=300)
plt.close()<|fim_prefix|># repo: dpesce/LLAGNSED path: /example_script.py
################... | code_fim | hard | {
"lang": "python",
"repo": "dpesce/LLAGNSED",
"path": "/example_script.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#####################################
# plot SED
fig = plt.figure(figsize=(4.25,4.25))
ax = fig.add_axes([0.1,0.1,0.8,0.8])
ax.plot(nu,nu*Lnu_synch,linestyle='-',color='C3',linewidth=3,alpha=0.5,label=r'$L_{\nu,\rm{synch}}$')
ax.plot(nu,nu*Lnu_compt,linestyle='-',color='C4',linewidth=3,alpha=0.5,label=r... | code_fim | hard | {
"lang": "python",
"repo": "dpesce/LLAGNSED",
"path": "/example_script.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with open(filename) as f:
lines = [l.rstrip() for l in f.readlines()]
return Solve(lines)
def solve_part_I(self):
logging.info("sum in decimal: {}".format(sum(self.fuels)))
return decimal_to_snafu(sum(self.fuels))
def solve_part_II(self):
retur... | code_fim | hard | {
"lang": "python",
"repo": "frankschmitt/advent_of_code",
"path": "/2022/25-full_of_hot_air/Solve.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, lines):
self.fuels = [snafu_to_decimal(l) for l in lines]
def read_input_file(filename):
with open(filename) as f:
lines = [l.rstrip() for l in f.readlines()]
return Solve(lines)
def solve_part_I(self):
logging.info("sum in decim... | code_fim | hard | {
"lang": "python",
"repo": "frankschmitt/advent_of_code",
"path": "/2022/25-full_of_hot_air/Solve.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: frankschmitt/advent_of_code path: /2022/25-full_of_hot_air/Solve.py
import logging
import functools
from string import ascii_lowercase, digits
snafu_vals = {
'2': 2,
'1': 1,
'0': 0,
'-': -1,
'=': -2
}
# convert num to its base 5 representation
def to_base... | code_fim | hard | {
"lang": "python",
"repo": "frankschmitt/advent_of_code",
"path": "/2022/25-full_of_hot_air/Solve.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Aditya-0912/recon path: /dashboard/core/models.py
from django.db import models
class Employee(models.Model):
name = models.CharField(max_length=150)
position = models.CharField(max_length=150)
office = models.CharField(max_length=150)
age = models.PositiveIntegerField()
star... | code_fim | hard | {
"lang": "python",
"repo": "Aditya-0912/recon",
"path": "/dashboard/core/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class merchant_data(models.Model):
branch_name = models.CharField(max_length=150)
branch_Code = models.CharField(max_length=150)
Business_Date = models.CharField(max_length=150)
ReceiptNo = models.CharField(max_length=150)
ReferenceID = models.CharField(max_length=150)
OrderId = mo... | code_fim | hard | {
"lang": "python",
"repo": "Aditya-0912/recon",
"path": "/dashboard/core/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.name
class reco_data(models.Model):
Reference_ID = models.CharField(max_length=150)
Receipt_No = models.CharField(max_length=150)
Order_ID = models.CharField(max_length=150)
Branch_name = models.CharField(max_length=150)
Branch_code = models.CharField(max_length=15... | code_fim | medium | {
"lang": "python",
"repo": "Aditya-0912/recon",
"path": "/dashboard/core/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rememerme/games-deployment path: /fabfile.py
from fabric.api import env, task, cd, sudo, prefix
from fabric.contrib.files import exists
import os
VIRTUALENV = '/virtualenv'
ENV = '/env'
REPO = 'friends'
VIRTUALENV_NAME = 'friends-api-env'
GIT_MODEL_URL = 'https://github.com/rememerme/friends-m... | code_fim | hard | {
"lang": "python",
"repo": "rememerme/games-deployment",
"path": "/fabfile.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> sudo('mkdir ' + REPO)
with cd(REPO):
sudo('git pull ' + GIT_API_URL)
sudo('git pull ' + GIT_MODEL_URL)
@task
def install_deps():
# set up directory for virtualenv
if not exists(VIRTUALENV, use_sudo=True):
sudo('mkdir ' + VIRTUALENV)
sudo('virtu... | code_fim | hard | {
"lang": "python",
"repo": "rememerme/games-deployment",
"path": "/fabfile.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class TestConvertToFile(TestCaseBase):
def setUp(self):
self._test_output_file = '.test'
# Unsigned byte.
self._ndarr_to_convert = np.array([0x0A, 0x0B, 0xFF], dtype='uint8')
self._expected = (b'\x00\x00\x08\x01\x00\x00\x00\x03' +
b'\x0A' +
... | code_fim | hard | {
"lang": "python",
"repo": "ivanyu/idx2numpy",
"path": "/idx2numpy/test/converters_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Float.
# No less fat, still no tests.
# Double.
result = idx2numpy.convert_to_string(
np.array([1.0, 2.0, -2.0, 0.0, -0.0], dtype='float64'))
self.assertEqual(result,
b'\x00\x00\x0E\x01\x00\x00\x00\x05' +
... | code_fim | hard | {
"lang": "python",
"repo": "ivanyu/idx2numpy",
"path": "/idx2numpy/test/converters_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ivanyu/idx2numpy path: /idx2numpy/test/converters_test.py
# -*- coding: utf-8 -*-
import sys
import unittest
import idx2numpy
import contextlib
import numpy as np
import os
import struct
try:
from StringIO import StringIO as BytesIO # for python 2.5
except ImportError:
from io import B... | code_fim | hard | {
"lang": "python",
"repo": "ivanyu/idx2numpy",
"path": "/idx2numpy/test/converters_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ITISFoundation/osparc-simcore path: /services/web/server/tests/unit/isolated/exporter/test_exporter_formatter_xlsx_templates.py
port (
ContributorEntryModel,
DatasetDescriptionParams,
DatasetDescriptionXLSXDocument,
DoiEntryModel,
LinkEntryModel,
)
from simcore_service_webserv... | code_fim | hard | {
"lang": "python",
"repo": "ITISFoundation/osparc-simcore",
"path": "/services/web/server/tests/unit/isolated/exporter/test_exporter_formatter_xlsx_templates.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> expected_outputs[f"B{row}"] = output_entry.service_alias
expected_outputs[f"C{row}"] = output_entry.service_name
expected_outputs[f"D{row}"] = output_entry.service_version
expected_outputs[f"E{row}"] = output_entry.output_name
expected_outputs[f"F{row}"] = output_en... | code_fim | hard | {
"lang": "python",
"repo": "ITISFoundation/osparc-simcore",
"path": "/services/web/server/tests/unit/isolated/exporter/test_exporter_formatter_xlsx_templates.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>Requirements:
You need these installed:
Git
""")
input("I have git installed(Press Enter to continue): ")
input("I am ready to download(Press Enter to continue): ")
os.system("git clone https://github.com/Sudo2td/Andromeda")<|fim_prefix|># repo: Sudo2td/Andromeda path: /Downloader.py
import os
print("... | code_fim | medium | {
"lang": "python",
"repo": "Sudo2td/Andromeda",
"path": "/Downloader.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Sudo2td/Andromeda path: /Downloader.py
import os
print("""
This file download's the latest version of Andromeda.
But it create's a new folder with the latest version.
If you want to update this Andromeda project then I
recommend using Update.py which will update your project.
If you don't wan... | code_fim | medium | {
"lang": "python",
"repo": "Sudo2td/Andromeda",
"path": "/Downloader.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if args.semfix:
args.use_semfix_synthesizer = True
if args.use_semfix_synthesizer:
args.semfix = True
if args.semfix:
# this should be tested first:
# args.use_semfix_synthesizer = True
if not (args.defect == DEFAULT_DEFECTS):
logger.warnin... | code_fim | hard | {
"lang": "python",
"repo": "mechtaev/angelix",
"path": "/src/repair/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if args.ignore_lines:
args.lines = None
tool = Angelix(working_dir,
src=args.src,
buggy=args.buggy,
oracle=abspath(args.oracle),
tests=args.tests,
golden=args.golden,
asserts=... | code_fim | hard | {
"lang": "python",
"repo": "mechtaev/angelix",
"path": "/src/repair/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mechtaev/angelix path: /src/repair/main.py
self.dump[counterexample],
self.frontend_src)
except NoSmtError:
logger.warning("no smt file for test {}".format(counterexample))
... | code_fim | hard | {
"lang": "python",
"repo": "mechtaev/angelix",
"path": "/src/repair/main.py",
"mode": "psm",
"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.