text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> fake_norm_loss = tf.square(grad_norms_fake - 1)
real_norm_loss = tf.square(grad_norms_real - 1)
dsc_loss += tf.reduce_mean([fake_norm_loss, real_norm_loss])
gen_grads = self.optimizer.compute_gradients(gen_loss, var_list=gen.vars)
dsc_grads = self.opti... | code_fim | hard | {
"lang": "python",
"repo": "ru8zj312/Machine-Learning",
"path": "/generative-waifu-network/waifunet.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cloudsmith-io/dj-stripe path: /djstripe/migrations/0007_auto_20150625_1243.py
# -*- coding: utf-8 -*-
from __future__ import (
absolute_import, division, print_function, unicode_literals
)
<|fim_suffix|>
dependencies = [
('djstripe', '0006_auto_20150602_1934'),
]
operati... | code_fim | medium | {
"lang": "python",
"repo": "cloudsmith-io/dj-stripe",
"path": "/djstripe/migrations/0007_auto_20150625_1243.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class Migration(migrations.Migration):
dependencies = [
('djstripe', '0006_auto_20150602_1934'),
]
operations = [
migrations.AddField(
model_name='customer',
name='card_exp_month',
field=models.PositiveIntegerField(null=True, blank=True),
... | code_fim | medium | {
"lang": "python",
"repo": "cloudsmith-io/dj-stripe",
"path": "/djstripe/migrations/0007_auto_20150625_1243.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('djstripe', '0006_auto_20150602_1934'),
]
operations = [
migrations.AddField(
model_name='customer',
name='card_exp_month',
field=models.PositiveIntegerField(null=True, blank=True),
),
migrations.AddField(
... | code_fim | medium | {
"lang": "python",
"repo": "cloudsmith-io/dj-stripe",
"path": "/djstripe/migrations/0007_auto_20150625_1243.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>sm.sendNext("I don't know all the details, but I know our relationship with the fairies is strained enough as it is. Will you go to the North Forest near Elinia and meet with #p1040002#.")
response = sm.sendAskYesNo("Fanzy will take you into the land of the fairies. I can send you to him directly, if you... | code_fim | hard | {
"lang": "python",
"repo": "ryantpayton/Swordie",
"path": "/scripts/quest/q32143s.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if response:
sm.startQuestNoCheck(THEME_DUNGEON_ELLINEL_FAIRY_ACADEMY)
sm.completeQuestNoRewards(parentID)
sm.warp(NORTH_FOREST_GIANT_TREE)
sm.dispose()<|fim_prefix|># repo: ryantpayton/Swordie path: /scripts/quest/q32143s.py
# [Theme Dungeon] Ellinel Fairy Academy
# This version appears for ... | code_fim | medium | {
"lang": "python",
"repo": "ryantpayton/Swordie",
"path": "/scripts/quest/q32143s.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ryantpayton/Swordie path: /scripts/quest/q32143s.py
# [Theme Dungeon] Ellinel Fairy Academy
# This version appears for Wind Archer
IRENA = 1101005 # NPC ID
THEME_DUNGEON_ELLINEL_FAIRY_ACADEMY = 32151 # QUEST ID
NORTH_FOREST_GIANT_TREE = 101030000 # MAP ID
sm.setSpeakerID(IRENA)
response = sm.se... | code_fim | hard | {
"lang": "python",
"repo": "ryantpayton/Swordie",
"path": "/scripts/quest/q32143s.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--dataset', type=str, default='ACM', help='Dataset')
parser.add_argument('--data_path', default='../GTN/data/', help='folder path of saved preprocessed data.')
parser.add_argument('--epoch', type=int, defaul... | code_fim | hard | {
"lang": "python",
"repo": "hetgnn/hetGTNet",
"path": "/SimpleHGN/train_simpleHGN.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hetgnn/hetGTNet path: /SimpleHGN/train_simpleHGN.py
import torch
import numpy as np
import torch.nn as nn
from run import SimpleHGN
import pickle
import argparse
import time
from sklearn import metrics
import gc
def evaluate_f1(y_val_pred, y_val_true, y_test_pred, y_test_true, average='macro'):
... | code_fim | hard | {
"lang": "python",
"repo": "hetgnn/hetGTNet",
"path": "/SimpleHGN/train_simpleHGN.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Thorfinson/pyside6-qt-uis path: /qml-accordion/ListModel.py
from PySide6 import QtCore
from dataGenerator import generate_data
# The ListModel - inheriting from QAbstractListModel
class AccordionList(QtCore.QAbstractListModel):
user_id = QtCore.Qt.UserRole + 1
user_name = QtCore.Qt.UserR... | code_fim | hard | {
"lang": "python",
"repo": "Thorfinson/pyside6-qt-uis",
"path": "/qml-accordion/ListModel.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> super().__init__(parent)
self.list_data = generate_data(size)
# get the data depending on role
def data(self, index, role=QtCore.Qt.DisplayRole):
row = index.row()
if index.isValid() and 0 <= row < self.rowCount():
if role == AccordionList.user_id:
... | code_fim | medium | {
"lang": "python",
"repo": "Thorfinson/pyside6-qt-uis",
"path": "/qml-accordion/ListModel.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # get the role names
def roleNames(self):
return {
AccordionList.user_id: b"user_id",
AccordionList.user_name: b"user_name",
AccordionList.user_text: b"user_text",
AccordionList.user_rank: b"user_rank",
AccordionList.user_imag... | code_fim | hard | {
"lang": "python",
"repo": "Thorfinson/pyside6-qt-uis",
"path": "/qml-accordion/ListModel.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GuilhermeSilvaCarpi/exercicios-programacao path: /treinamento progrmação/Python/w3schools/11. Arrays, Objectsm, Inheritance & Scope/4. Scope.py
'''
Uma variável só está disponível dentro da região (escopo) ao
qual ela é criada.
Uma variável que é feita dentro de uma função geralmente é
utilizáve... | code_fim | hard | {
"lang": "python",
"repo": "GuilhermeSilvaCarpi/exercicios-programacao",
"path": "/treinamento progrmação/Python/w3schools/11. Arrays, Objectsm, Inheritance & Scope/4. Scope.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Palavra chave "global"
'''
Com essa palavra chave é possível criar ou editar uma variável
global dentro de um escopo local.
'''
def função2():
global y
y = 5
global x
x = 25
função2()
print('"y" em escopo global:', y)
print('"x" em escopo global:', x)<|fim_prefix|># repo: GuilhermeSilvaC... | code_fim | hard | {
"lang": "python",
"repo": "GuilhermeSilvaCarpi/exercicios-programacao",
"path": "/treinamento progrmação/Python/w3schools/11. Arrays, Objectsm, Inheritance & Scope/4. Scope.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>for keyword in search_keyword:
for idx in range(1,100):
url = base_url + query + keyword + opt + page_idx + str(idx) + per_page
try:
issues = json.loads(urllib.urlopen(url).read(), "utf-8")["items"]
issues = filter_google(issues)
for issue in issu... | code_fim | medium | {
"lang": "python",
"repo": "gitcollect/pyDFAM",
"path": "/DFAM/util/searcher.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
issues = json.loads(urllib.urlopen(url).read(), "utf-8")["items"]
issues = filter_google(issues)
for issue in issues:
url = issue["html_url"]
body = issue["body"]
if url is not None and body is not None:
... | code_fim | medium | {
"lang": "python",
"repo": "gitcollect/pyDFAM",
"path": "/DFAM/util/searcher.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gitcollect/pyDFAM path: /DFAM/util/searcher.py
#-*- coding: utf-8 -*-
__author__ = 'kyeongwookma'
import json, urllib
search_keyword = ["android design", "android gui", "android ui", "android usability"]
<|fim_suffix|> return filter(lambda x:x["user"]["login"] != "GoogleCodeExporter", issue... | code_fim | medium | {
"lang": "python",
"repo": "gitcollect/pyDFAM",
"path": "/DFAM/util/searcher.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return render(request, 'dashboard.html')<|fim_prefix|># repo: essanpupil/moneytracker path: /moneytracker/views.py
from django.contrib.auth.decorators import login_required
from django.shortcuts import render
<|fim_middle|>def homepage(request):
return render(request, 'homepage.html')
@login_... | code_fim | medium | {
"lang": "python",
"repo": "essanpupil/moneytracker",
"path": "/moneytracker/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: essanpupil/moneytracker path: /moneytracker/views.py
from django.contrib.auth.decorators import login_required
from django.shortcuts import render
def homepage(request):
<|fim_suffix|>
@login_required
def dashboard(request):
return render(request, 'dashboard.html')<|fim_middle|> return r... | code_fim | easy | {
"lang": "python",
"repo": "essanpupil/moneytracker",
"path": "/moneytracker/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chicagopython/chipy.org path: /chipy_org/apps/profiles/urls.py
from django.contrib.auth.decorators import login_required
from django.urls import path
<|fim_suffix|>app_name = "profiles" # pylint: disable=invalid-name
urlpatterns = [
path("list/", ProfilesList.as_view(), name="list"),
p... | code_fim | medium | {
"lang": "python",
"repo": "chicagopython/chipy.org",
"path": "/chipy_org/apps/profiles/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>app_name = "profiles" # pylint: disable=invalid-name
urlpatterns = [
path("list/", ProfilesList.as_view(), name="list"),
path("edit/", login_required(ProfileEdit.as_view()), name="edit"),
path("list/organizers", ProfilesListOrganizers.as_view(), name="organizers"),
]<|fim_prefix|># repo: chi... | code_fim | medium | {
"lang": "python",
"repo": "chicagopython/chipy.org",
"path": "/chipy_org/apps/profiles/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> args = stats.ApiIncrementCounterMetricArgs(
metric_name="invalid_counter_does_not_exist",
field_values=[
stats.FieldValue(
field_type=stats_pb2.FieldValue.STRING, string_value="b"
),
stats.FieldValue(
field_type=stats_... | code_fim | hard | {
"lang": "python",
"repo": "google/grr",
"path": "/grr/server/grr_response_server/gui/api_plugins/stats_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.handler.Handle(args, context=self.context)
self.assertEqual(0, counter.GetValue(fields=["b", 1]))
self.assertEqual(1, counter.GetValue(fields=["b", 2]))
@mock.patch.object(
admin_ui_metrics,
"API_INCREASE_ALLOWLIST",
frozenset(["nothing_allowlisted"]),
)
def test... | code_fim | hard | {
"lang": "python",
"repo": "google/grr",
"path": "/grr/server/grr_response_server/gui/api_plugins/stats_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: google/grr path: /grr/server/grr_response_server/gui/api_plugins/stats_test.py
#!/usr/bin/env python
from unittest import mock
from absl.testing import absltest
from grr_response_core.stats import default_stats_collector
from grr_response_core.stats import metrics
from grr_response_proto.api im... | code_fim | hard | {
"lang": "python",
"repo": "google/grr",
"path": "/grr/server/grr_response_server/gui/api_plugins/stats_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kevinusername/vertex-converter path: /script.py
import sys
f = open(sys.argv[1], 'r')
output = f'vector<Vertex> {sys.argv[1][2:len(sys.argv[1])-4]} = {{'
<|fim_suffix|>output += f"}};\ndraw_curve({sys.argv[1][2:len(sys.argv[1])-4]}, 5);"
print(output)<|fim_middle|>for line in f:
comma = l... | code_fim | hard | {
"lang": "python",
"repo": "kevinusername/vertex-converter",
"path": "/script.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|>output += f"}};\ndraw_curve({sys.argv[1][2:len(sys.argv[1])-4]}, 5);"
print(output)<|fim_prefix|># repo: kevinusername/vertex-converter path: /script.py
import sys
f = open(sys.argv[1], 'r')
output = f'vector<Vertex> {sys.argv[1][2:len(sys.argv[1])-4]} = {{'
<|fim_middle|>for line in f:
comma = l... | code_fim | hard | {
"lang": "python",
"repo": "kevinusername/vertex-converter",
"path": "/script.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|>N", requires_grad=True), norm_eval=False))<|fim_prefix|># repo: hojihun5516/object-detection-level2-cv-02 path: /template/mmdetection/configs/gcnet/cascade_mask_rcnn_x101_32x4d_fpn_syncbn-backbone_dconv_c3-c5_1x_coco.py
_base_ = "../dcn/cascade_mask_rcnn_x101_32x4d_fpn_dconv_c3-c5_1x_coco.py"
model = di<... | code_fim | easy | {
"lang": "python",
"repo": "hojihun5516/object-detection-level2-cv-02",
"path": "/template/mmdetection/configs/gcnet/cascade_mask_rcnn_x101_32x4d_fpn_syncbn-backbone_dconv_c3-c5_1x_coco.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hojihun5516/object-detection-level2-cv-02 path: /template/mmdetection/configs/gcnet/cascade_mask_rcnn_x101_32x4d_fpn_syncbn-backbone_dconv_c3-c5_1x_coco.py
_base_ = "../dcn/cascade_mask_rcnn_x101_32x4d_fpn_dconv_c3-c5_1x_coco.py"
model = di<|fim_suffix|>N", requires_grad=True), norm_eval=False))<... | code_fim | easy | {
"lang": "python",
"repo": "hojihun5516/object-detection-level2-cv-02",
"path": "/template/mmdetection/configs/gcnet/cascade_mask_rcnn_x101_32x4d_fpn_syncbn-backbone_dconv_c3-c5_1x_coco.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: he66al/digital-signage-server path: /models/__init__.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created by: Rui Car<|fim_suffix|>its digital signage system.
License: MIT (see LICENSE for details)
"""
import os, sys, logging, datetime, time
log = logging.getLogger()<|fim_middle|>mo <ht... | code_fim | medium | {
"lang": "python",
"repo": "he66al/digital-signage-server",
"path": "/models/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>its digital signage system.
License: MIT (see LICENSE for details)
"""
import os, sys, logging, datetime, time
log = logging.getLogger()<|fim_prefix|># repo: he66al/digital-signage-server path: /models/__init__.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created by: Rui Car<|fim_middle|>mo <ht... | code_fim | medium | {
"lang": "python",
"repo": "he66al/digital-signage-server",
"path": "/models/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mattfoster/matplotlib path: /lib/enthought/traits/has_traits.py
for name, value in traits.items():
setattr( self, name, value )
finally:
self._trait_change_notify( True )
else:
for name, value in traits.items():
... | code_fim | hard | {
"lang": "python",
"repo": "mattfoster/matplotlib",
"path": "/lib/enthought/traits/has_traits.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # The following test should only succeed for objects created before
# traits has been fully initialized (such as the default Handler):
if view_elements is None:
return None
if name:
if view_element is None:
# If only a name was speci... | code_fim | hard | {
"lang": "python",
"repo": "mattfoster/matplotlib",
"path": "/lib/enthought/traits/has_traits.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mattfoster/matplotlib path: /lib/enthought/traits/has_traits.py
------------------------------------
# Imports:
#-------------------------------------------------------------------------------
import sys
import copy as copy_module
import weakref
from cPickle \
import dumps
from types \
... | code_fim | hard | {
"lang": "python",
"repo": "mattfoster/matplotlib",
"path": "/lib/enthought/traits/has_traits.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
(xlist, ylist) = pickle.load(open('stockTT.bin', 'rb'))
nInputs = len(xlist[0])
x = np.array(xlist, dtype = theano.config.floatX)
y = np.array(ylist, dtype = theano.config.floatX)
print "Std Dev of Price Change", np.std(y)
nHidden = 20
nOutputs = 1
... | code_fim | hard | {
"lang": "python",
"repo": "mike-bowles/hdDeepLearningStudy",
"path": "/2LayerLSTM/lstmClassOld.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> W_uo, W_ho, b_o, W_hy, b_hy):
g_t = T.tanh(T.dot(u_t, W_ug) + T.dot(h_tm1, W_hg) + b_g)
i_t = T.nnet.sigmoid(T.dot(u_t, W_ui) + T.dot(h_tm1, W_hi) + b_i)
f_t = T.nnet.sigmoid(T.dot(u_t, W_uf) + T.dot(h_tm1, W_hf) + b_f)
o_t = T.nnet.sigmoid(T.dot(u_t, W_uo) + T.dot(h_t... | code_fim | hard | {
"lang": "python",
"repo": "mike-bowles/hdDeepLearningStudy",
"path": "/2LayerLSTM/lstmClassOld.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mike-bowles/hdDeepLearningStudy path: /2LayerLSTM/lstmClassOld.py
import theano
import theano.tensor as T
import numpy as np
import random
import matplotlib.pyplot as plt
import cPickle as pickle
from math import sqrt
#from lstmClass import LstmLayer, recurrent_fn
'''Define lstm class for single... | code_fim | hard | {
"lang": "python",
"repo": "mike-bowles/hdDeepLearningStudy",
"path": "/2LayerLSTM/lstmClassOld.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: luka-papez/njuskalo-notifier path: /sniffer_scraper/main.py
import logging
import argparse
import configparser
from scrapy.crawler import CrawlerProcess
from sniffer_scraper.spider import NjuskaloSpider
<|fim_suffix|> logging.info( "Started..." )
config = load_config()
crawler_settin... | code_fim | hard | {
"lang": "python",
"repo": "luka-papez/njuskalo-notifier",
"path": "/sniffer_scraper/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> urls = [v for _, v in config.items('URLs')]
n_pages = config.getint('CRAWLER_PROCESS_SETTINGS', 'n_pages')
process = CrawlerProcess(crawler_settings)
process.crawl(NjuskaloSpider, urls, n_pages)
process.start()
logging.info( "Done..." )
if __name__ == '__main__':
main()<|fi... | code_fim | hard | {
"lang": "python",
"repo": "luka-papez/njuskalo-notifier",
"path": "/sniffer_scraper/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: skypilot-org/skypilot path: /sky/skylet/providers/kubernetes/node_provider.py
import copy
import logging
import time
from typing import Dict
from urllib.parse import urlparse
from uuid import uuid4
from ray.autoscaler._private.command_runner import SSHCommandRunner
from ray.autoscaler.node_provi... | code_fim | hard | {
"lang": "python",
"repo": "skypilot-org/skypilot",
"path": "/sky/skylet/providers/kubernetes/node_provider.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _set_node_tags(self, node_id, tags):
pod = kubernetes.core_api().read_namespaced_pod(node_id, self.namespace)
pod.metadata.labels.update(tags)
kubernetes.core_api().patch_namespaced_pod(node_id, self.namespace, pod)
def create_node(self, node_config, tags, count):
... | code_fim | hard | {
"lang": "python",
"repo": "skypilot-org/skypilot",
"path": "/sky/skylet/providers/kubernetes/node_provider.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: IMULMUL/DeepBinDiff path: /src/utility.py
r lines[idx+1].split()[3] == bin2_name)
binary = lines[idx+1].split()[0]
no = int(lines[idx][:-2])
if binary == 'Bin1':
bin1_functions[no] = function
if function['impo... | code_fim | hard | {
"lang": "python",
"repo": "IMULMUL/DeepBinDiff",
"path": "/src/utility.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> while len(curr_pairs) != 0:
curr_pair = curr_pairs.pop(0)
# preds1_ids = k_hop_preds_dict[curr_pair[0]]
# preds2_ids = k_hop_preds_dict[curr_pair[1]]
# succs1_ids = k_hop_succs_dict[curr_pair[0]]
# succs2_ids = k_hop_succs_dict[curr_pair[1]]
n... | code_fim | hard | {
"lang": "python",
"repo": "IMULMUL/DeepBinDiff",
"path": "/src/utility.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: IMULMUL/DeepBinDiff path: /src/utility.py
nction['import'] = not (lines[idx+1].split()[3] == bin1_name or lines[idx+1].split()[3] == bin2_name)
binary = lines[idx+1].split()[0]
no = int(lines[idx][:-2])
if binary == 'Bin1':
bin1_... | code_fim | hard | {
"lang": "python",
"repo": "IMULMUL/DeepBinDiff",
"path": "/src/utility.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DeusMechanicus/Omnissiah path: /code/raw_snmp.py
#!/usr/bin/env python3
import omni_const
import omni_config
import omni_unpwd
import sys
import nmap
from concurrent.futures import ThreadPoolExecutor, ProcessPoolExecutor, as_completed
from multiprocessing import cpu_count
from easysnmp import S... | code_fim | hard | {
"lang": "python",
"repo": "DeusMechanicus/Omnissiah",
"path": "/code/raw_snmp.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def select_vlan_ips(db, ips, log):
result = []
cur = db.cursor()
cur.execute(select_vlan_oid_sql)
for r in cur.fetchall():
record = ips[r[0]].copy()
record['vlan'] = int(r[1].split('.')[-1])
record['community'] = record['community'] + '@' + str(record['vlan'])
... | code_fim | hard | {
"lang": "python",
"repo": "DeusMechanicus/Omnissiah",
"path": "/code/raw_snmp.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HMS-IDAC/UnMicst path: /toolbox/GPUselect.py
import numpy as np
def pick_gpu_lowest_memory():
try:
import pynvml as nv
except ImportError:
raise ImportError("pynvml not found")
<|fim_suffix|> # return the GPU that has the largest memory left
return np.argsort(gpu... | code_fim | hard | {
"lang": "python",
"repo": "HMS-IDAC/UnMicst",
"path": "/toolbox/GPUselect.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # return the GPU that has the largest memory left
return np.argsort(gpu_idle_memory)[-1]<|fim_prefix|># repo: HMS-IDAC/UnMicst path: /toolbox/GPUselect.py
import numpy as np
def pick_gpu_lowest_memory():
try:
import pynvml as nv
except ImportError:
raise ImportError("pyn... | code_fim | hard | {
"lang": "python",
"repo": "HMS-IDAC/UnMicst",
"path": "/toolbox/GPUselect.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: anissa-agahchen/gwells path: /app/backend/registries/migrations/0008_auto_20180613_2304.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-06-13 23:04
from __future__ import unicode_literals
from django.db import migrations, models
from django.conf import settings
<|fim_suffix|> ... | code_fim | hard | {
"lang": "python",
"repo": "anissa-agahchen/gwells",
"path": "/app/backend/registries/migrations/0008_auto_20180613_2304.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='proofofagecode',
name='registries_proof_of_age_code',
field=models.CharField(db_column='registries_proof_of_age_code', editable=False, max_length=10, primary_key=True, serialize=False),
),
mig... | code_fim | hard | {
"lang": "python",
"repo": "anissa-agahchen/gwells",
"path": "/app/backend/registries/migrations/0008_auto_20180613_2304.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
# The test scripts to run
tests = [
'test_bson_storage_python.py',
'test_postgresql_storage_python.py',
'test_yaml_storage_python.py',
'test_mongodb-atlas_python.py',
'test_mongodb_python.py',
]
thisdir = Path('.')
... | code_fim | medium | {
"lang": "python",
"repo": "SINTEF/dlite",
"path": "/storages/python/tests-python/run_python_storage_tests.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SINTEF/dlite path: /storages/python/tests-python/run_python_storage_tests.py
import runpy
import shutil
import sys
from pathlib import Path
sys.dont_write_bytecode = True
screen_width = shutil.get_terminal_size().columns - 1
<|fim_suffix|>
if __name__ == '__main__':
# The test scripts to ru... | code_fim | medium | {
"lang": "python",
"repo": "SINTEF/dlite",
"path": "/storages/python/tests-python/run_python_storage_tests.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: airspot-dev/iot-demo path: /rulesets/middleware/on-middleware-url-change-notify-slack/ruleset_functions/__init__.py
from krules_core.base_functions import *
class PrepareSlackTextMessage(RuleFunctionBase):
<|fim_suffix|>
public = self.payload["value"].startswith("https")
if publ... | code_fim | hard | {
"lang": "python",
"repo": "airspot-dev/iot-demo",
"path": "/rulesets/middleware/on-middleware-url-change-notify-slack/ruleset_functions/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if public:
self.payload["text"] = ":unlock: new *{}* available *publicly* for *{}* at {}".format(
self.payload["subject_match"]["app"],
self.payload["subject_match"]["fleet"],
self.payload["value"]
)
else:
... | code_fim | hard | {
"lang": "python",
"repo": "airspot-dev/iot-demo",
"path": "/rulesets/middleware/on-middleware-url-change-notify-slack/ruleset_functions/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Fazendaaa/project-euler path: /src/python/1-25/problem_10.py
"""
Summation of primes
The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
<|fim_suffix|>print(ft.reduce(lambda x, y: x+y, pe.erastosthenes_sieve(2000000)))<|fim_middle|> Find the sum of all the prime... | code_fim | hard | {
"lang": "python",
"repo": "Fazendaaa/project-euler",
"path": "/src/python/1-25/problem_10.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Answer: 142913828922
"""
import functools as ft
import sys
sys.path.append('../')
# pylint: disable=wrong-import-position,import-error
import project_euler as pe
print(ft.reduce(lambda x, y: x+y, pe.erastosthenes_sieve(2000000)))<|fim_prefix|># repo: Fazendaaa/project-euler path... | code_fim | medium | {
"lang": "python",
"repo": "Fazendaaa/project-euler",
"path": "/src/python/1-25/problem_10.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_tempscale(self, text=False):
""" What is our tempscale? """
if text:
return text_tscale[self.tempscale]
return self.tempscale
def get_timescale(self, text=False):
""" What is our timescale? """
if text:
return text_timescale[... | code_fim | hard | {
"lang": "python",
"repo": "bggardner/pybalboa",
"path": "/pybalboa/balboa.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bggardner/pybalboa path: /pybalboa/balboa.py
return
# Setup the basic things we know
data = bytearray(9)
data[0] = M_START
data[1] = 7
data[2] = mtypes[BMTS_CONTROL_REQ][0]
data[3] = mtypes[BMTS_CONTROL_REQ][1]
data[4] = mtypes[BMT... | code_fim | hard | {
"lang": "python",
"repo": "bggardner/pybalboa",
"path": "/pybalboa/balboa.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> async def change_temprange(self, newmode):
""" Change the spa's temprange to newmode. """
if not self.connected:
return
# check for sanity
if newmode > 1:
return
# this is a toggle switch, not on/off
if self.temprange == newmode... | code_fim | hard | {
"lang": "python",
"repo": "bggardner/pybalboa",
"path": "/pybalboa/balboa.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class test_uses_scipy(ContextDecorator):
def __init__(self, strict=True):
"""Context to construct tests that use the optional dependency Scipy.
:param strict: Throw error if Scipy is not used (to remove context where not necessary)
:return: Numpy stub
"""
self... | code_fim | hard | {
"lang": "python",
"repo": "wannesm/dtaidistance",
"path": "/dtaidistance/util_numpy.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, strict=True):
"""Context to construct tests that use the optional dependency Scipy.
:param strict: Throw error if Scipy is not used (to remove context where not necessary)
:return: Numpy stub
"""
self.strict = strict
self.testwithouts... | code_fim | hard | {
"lang": "python",
"repo": "wannesm/dtaidistance",
"path": "/dtaidistance/util_numpy.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wannesm/dtaidistance path: /dtaidistance/util_numpy.py
from contextlib import ContextDecorator
import os
import logging
from .exceptions import NumpyException, ScipyException
logger = logging.getLogger("be.kuleuven.dtai.distance")
try:
import numpy as np
except ImportError:
np = None... | code_fim | hard | {
"lang": "python",
"repo": "wannesm/dtaidistance",
"path": "/dtaidistance/util_numpy.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> z = torch.randn(x.size(0), NLAT, 1, 1).to(device)
C_loss, EG_loss = wali(x, z, lamb=LAMBDA)
if C_update:
optimizerC.zero_grad()
C_loss.backward()
C_losses.append(C_loss.item())
optimizerC.step()
C_iter += 1
if C_iter == C_ITERS:
... | code_fim | hard | {
"lang": "python",
"repo": "zwbjtu123/Wasserstein-BiGAN",
"path": "/wali_svhn.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zwbjtu123/Wasserstein-BiGAN path: /wali_svhn.py
import torch
import torch.nn as nn
import torch.backends.cudnn as cudnn
import matplotlib.pyplot as plt
from torch.optim import Adam
from torch.utils import data
from torch.nn import Conv2d, ConvTranspose2d, BatchNorm2d, LeakyReLU, ReLU, Tanh
from u... | code_fim | hard | {
"lang": "python",
"repo": "zwbjtu123/Wasserstein-BiGAN",
"path": "/wali_svhn.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: IntelLabsEurope/infrastructure-repository path: /api/opendaylight_glue.py
# Copyright 2015 Intel Corporation
#
# 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
#
# htt... | code_fim | hard | {
"lang": "python",
"repo": "IntelLabsEurope/infrastructure-repository",
"path": "/api/opendaylight_glue.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_os_dev_by_switch_interface(pop_url, pop_id, uuid):
"""
Retrieve the ID of the OS device connected to the given
Switch Interface. None if there is no OS device connected
:param pop_url: Url of Neo4j PoP DB
:param pop_id: PoP ID
:param uuid: Switch Interface OpenFlow ID
... | code_fim | hard | {
"lang": "python",
"repo": "IntelLabsEurope/infrastructure-repository",
"path": "/api/opendaylight_glue.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> msg = os.read(fd, 1024).decode() # 阻塞的方式,不用担心
print("[进程1]]%s" % msg)
if __name__ == '__main__':
main()<|fim_prefix|># repo: dunitian/BaseCode path: /python/5.concurrent/Linux/进程通信/4.fifo/3.rw_fifo2.py
import os
import time
def main():
file_name = "fifo_temp"
if not os.path.exist... | code_fim | easy | {
"lang": "python",
"repo": "dunitian/BaseCode",
"path": "/python/5.concurrent/Linux/进程通信/4.fifo/3.rw_fifo2.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dunitian/BaseCode path: /python/5.concurrent/Linux/进程通信/4.fifo/3.rw_fifo2.py
import os
import time
def main():
file_name = "fifo_temp"
if not os.path.exists(file_name):
os.mkfifo(file_name)
<|fim_suffix|> msg = os.read(fd, 1024).decode() # 阻塞的方式,不用担心
print("[进程1]]%s" % ... | code_fim | medium | {
"lang": "python",
"repo": "dunitian/BaseCode",
"path": "/python/5.concurrent/Linux/进程通信/4.fifo/3.rw_fifo2.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ryanoberto/homevolution path: /homevolution/zoneminder.py
"""
The MIT License (MIT)
Copyright (c) 2014 Ryan Oberto
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 the Software without r... | code_fim | hard | {
"lang": "python",
"repo": "ryanoberto/homevolution",
"path": "/homevolution/zoneminder.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ret_data = { 'Name': None, 'Id': None}
if list():
try:
cur = g.db.execute('select * from zoneminder')
zhost = [r[0] for r in cur.fetchall()]
cur = g.db.execute('select * from zoneminder')
zm = cur.fetchall()
for row in zm:
zhost = row[1]
zurl = row[2]
zpo... | code_fim | hard | {
"lang": "python",
"repo": "ryanoberto/homevolution",
"path": "/homevolution/zoneminder.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: afcarl/ingredient-phrase-tagger path: /get.py
import json
import operator
<|fim_suffix|>sorted_x = sorted(x.items(), key=operator.itemgetter(1), reverse=True)
for i,xs in enumerate(sorted_x):
if i > 500:
break
print(xs[0])<|fim_middle|>x = json.load(open('ingredients.json','r'))
| code_fim | easy | {
"lang": "python",
"repo": "afcarl/ingredient-phrase-tagger",
"path": "/get.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>sorted_x = sorted(x.items(), key=operator.itemgetter(1), reverse=True)
for i,xs in enumerate(sorted_x):
if i > 500:
break
print(xs[0])<|fim_prefix|># repo: afcarl/ingredient-phrase-tagger path: /get.py
import json
import operator
<|fim_middle|>x = json.load(open('ingredients.json','r'))
| code_fim | easy | {
"lang": "python",
"repo": "afcarl/ingredient-phrase-tagger",
"path": "/get.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # read data
df_pred = read_fasta_files(predicted_haplos_list)
df_true = read_fasta_files(true_haplos_list, with_method=False)
df_true["method"] = "ground_truth"
df_stats = read_haplostats(haplostats_list)
df_runstats = read_runstats(runstatus_list)
df_bench = read_benchmarks(b... | code_fim | hard | {
"lang": "python",
"repo": "cbg-ethz/V-pipe",
"path": "/resources/auxiliary_workflows/benchmark/workflow/scripts/performance_measures_global.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cbg-ethz/V-pipe path: /resources/auxiliary_workflows/benchmark/workflow/scripts/performance_measures_global.py
)
return pd.DataFrame(tmp)
def read_haplostats(haplostats_list):
df_list = []
for fname in tqdm(haplostats_list, desc="Read haplostat files"):
parts = str(f... | code_fim | hard | {
"lang": "python",
"repo": "cbg-ethz/V-pipe",
"path": "/resources/auxiliary_workflows/benchmark/workflow/scripts/performance_measures_global.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: imageio/imageio path: /imageio/plugins/pillow_info.py
e subsampling for the encoder.
* ``keep``: Only valid for JPEG files, will retain the original image setting.
* ``4:4:4``, ``4:2:2``, ``4:2:0``: Specific sampling values
* ``-1``: equivalent to ``keep``
* ``0``... | code_fim | hard | {
"lang": "python",
"repo": "imageio/imageio",
"path": "/imageio/plugins/pillow_info.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> im = Image.open('image001.spi').convert2byte()
Writing files in SPIDER format
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The extension of SPIDER files may be any 3 alphanumeric characters. Therefore
the output format must be specified explicitly::
im.save('newimage.spi', format='SPI... | code_fim | hard | {
"lang": "python",
"repo": "imageio/imageio",
"path": "/imageio/plugins/pillow_info.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: imageio/imageio path: /imageio/plugins/pillow_info.py
= Image.open(...)
if im.tile[0][0] == "gif":
# only read the first "local image" from this GIF file
tag, (x0, y0, x1, y1), offset, extra = im.tile[0]
im.size = (x1 - x0, y1 - y0)
im.tile... | code_fim | hard | {
"lang": "python",
"repo": "imageio/imageio",
"path": "/imageio/plugins/pillow_info.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Arunken/PythonScripts path: /2_Python Advanced/7_Gui/12_radiobutton.py
# -*- coding: utf-8 -*-
"""
Created on Fri May 25 09:36:01 2018
@author: SilverDoe
"""
from tkinter import *
def sel():
<|fim_suffix|>R3 = Radiobutton(root, text = "Option 3", variable = var, value = 3,
co... | code_fim | hard | {
"lang": "python",
"repo": "Arunken/PythonScripts",
"path": "/2_Python Advanced/7_Gui/12_radiobutton.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
#============================ Methods =======================================
'''
deselect() : Clears (turns off) the radiobutton.
flash() : Flashes the radiobutton a few times between its active and normal colors, but leaves it the way it started.
invoke() : You can call this method to get the sam... | code_fim | hard | {
"lang": "python",
"repo": "Arunken/PythonScripts",
"path": "/2_Python Advanced/7_Gui/12_radiobutton.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return [
'id',
'created_at',
'parsed_created_at',
'text',
'bounding_box',
'longitude',
'latitude',
'country_code',
'location',
'tweet_type',
'lang',
'user_id'
]
# def get_row(t, extra_fields=None, exc... | code_fim | hard | {
"lang": "python",
"repo": "Geneseo/Covid19",
"path": "/json22csv.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> place = get('place')
if place is None:
if 'retweeted_status' not in t:
return None
retweeted_status = get('retweeted_status')
place = retweeted_status.get('place')
if place is None:
if 'quoted_status' not in retweeted_status:
... | code_fim | hard | {
"lang": "python",
"repo": "Geneseo/Covid19",
"path": "/json22csv.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Geneseo/Covid19 path: /json22csv.py
#!/usr/bin/env python
"""
A sample JSON to CSV program. Multivalued JSON properties are space delimited
CSV columns.
"""
from twarc import json2csv
import os
import sys
import json
import codecs
import argparse
import fileinput
from dateutil.parser import p... | code_fim | hard | {
"lang": "python",
"repo": "Geneseo/Covid19",
"path": "/json22csv.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> If the units are given along with the value, they must be <BYTES>.
The image location is given by the value.
This may raise a ValueError.
"""
imagePointer = self.labels['^IMAGE'].split()
if len(imagePointer) == 1:
recordBytes = int(self.labels['RECORD_BYTES'])
imageLocation = (int(image... | code_fim | hard | {
"lang": "python",
"repo": "pedrohasselmann/shapeimager",
"path": "/support/pds/imageextractor.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> imageIsSupported = True
if not self.labels.has_key('IMAGE'):
if self.log: self.log.warn("No image data found")
imageIsSupported = False
recordType = self.labels['RECORD_TYPE']
imageSampleBits = int(self.labels['IMAGE']['SAMPLE_BITS'])
imageSampleType = self.labels['IMAGE']['SAMPLE_TYPE']... | code_fim | hard | {
"lang": "python",
"repo": "pedrohasselmann/shapeimager",
"path": "/support/pds/imageextractor.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pedrohasselmann/shapeimager path: /support/pds/imageextractor.py
#!/usr/bin/env python
# vim: set noexpandtab
# encoding: utf-8
"""
imageextractor.py
Created by Ryan Matthew Balfanz on 2009-05-28.
Copyright (c) 2009 Ryan Matthew Balfanz. All rights reserved.
"""
import hashlib
import logging
i... | code_fim | hard | {
"lang": "python",
"repo": "pedrohasselmann/shapeimager",
"path": "/support/pds/imageextractor.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> _delete_folder(folder=r"project_sample\backend_django\venv")
_delete_folder(folder=r"django_rest_auth_embedded.egg-info")
_delete_folder(folder=r"dist")
subprocess.run(["python", "setup.py", "sdist"])
subprocess.run(["pip", "install", "virtualenv"])
subprocess.run(["virtualenv", ... | code_fim | medium | {
"lang": "python",
"repo": "Volkova-Natalia/django_rest_auth_embedded",
"path": "/test_after_building_local.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Volkova-Natalia/django_rest_auth_embedded path: /test_after_building_local.py
import os
import shutil
import subprocess
# --------------------------------------------------
def _delete_folder(folder):
if os.path.exists(folder):
shutil.rmtree(folder)
# -------------------------------... | code_fim | hard | {
"lang": "python",
"repo": "Volkova-Natalia/django_rest_auth_embedded",
"path": "/test_after_building_local.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> subprocess.run(["python", "setup.py", "sdist"])
subprocess.run(["pip", "install", "virtualenv"])
subprocess.run(["virtualenv", r"project_sample\backend_django\venv"])
# subprocess.run([r"project_sample\backend_django\venv\Scripts\pip", "install", "-r", r"project_sample\backend_django\requi... | code_fim | hard | {
"lang": "python",
"repo": "Volkova-Natalia/django_rest_auth_embedded",
"path": "/test_after_building_local.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # We cast to values here
indexlist = kgcnn_ops_change_edge_tensor_indexing_by_row_partition(edge_index, node_part, edge_part,
partition_type_node="row_splits",
... | code_fim | hard | {
"lang": "python",
"repo": "RushaliRajesh/gcnn_keras",
"path": "/kgcnn/layers/gather.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, **kwargs):
"""Initialize layer."""
super(GatherState, self).__init__(**kwargs)
def build(self, input_shape):
"""Build layer."""
super(GatherState, self).build(input_shape)
def call(self, inputs, **kwargs):
"""Forward pass.
A... | code_fim | hard | {
"lang": "python",
"repo": "RushaliRajesh/gcnn_keras",
"path": "/kgcnn/layers/gather.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RushaliRajesh/gcnn_keras path: /kgcnn/layers/gather.py
import tensorflow as tf
from kgcnn.layers.base import GraphBaseLayer
from kgcnn.ops.partition import kgcnn_ops_change_edge_tensor_indexing_by_row_partition
@tf.keras.utils.register_keras_serializable(package='kgcnn',name='GatherNodes')
cla... | code_fim | hard | {
"lang": "python",
"repo": "RushaliRajesh/gcnn_keras",
"path": "/kgcnn/layers/gather.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # this is moment * h / I
front_bending_stress = -E / (L**2) * (-6 * u0z + 2 * r0y * L + 6 * u1z + 4 * r1y * L) * hfront[ielem]
# this is moment * h / I
rear_bending_stress = E / (L**2) * (-6 * u0z + 2 * r0y * L + 6 * u1z + 4 * r1y * L) * hrear[ielem]
... | code_fim | hard | {
"lang": "python",
"repo": "mdolab/OpenAeroStruct",
"path": "/openaerostruct/structures/vonmises_wingbox.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mdolab/OpenAeroStruct path: /openaerostruct/structures/vonmises_wingbox.py
import numpy as np
import openmdao.api as om
from openaerostruct.structures.utils import norm, unit
class VonMisesWingbox(om.ExplicitComponent):
"""Compute the von Mises stresses for each element.
See Chauhan e... | code_fim | hard | {
"lang": "python",
"repo": "mdolab/OpenAeroStruct",
"path": "/openaerostruct/structures/vonmises_wingbox.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yourequiremorecitygas/process-server path: /mqtt_processor/listen_and_getfile.py
import paho.mqtt.client as mqtt
import datetime
def on_connect(client, userdata, flags, rc):
print("Connected with result code " + str(rc))
client.subscribe("topic")
def on_message(client, userdata, ... | code_fim | medium | {
"lang": "python",
"repo": "yourequiremorecitygas/process-server",
"path": "/mqtt_processor/listen_and_getfile.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>client.connect("52.194.252.52", 1883, 60)
client.loop_forever()<|fim_prefix|># repo: yourequiremorecitygas/process-server path: /mqtt_processor/listen_and_getfile.py
import paho.mqtt.client as mqtt
import datetime
def on_connect(client, userdata, flags, rc):
<|fim_middle|> print("Connected with ... | code_fim | hard | {
"lang": "python",
"repo": "yourequiremorecitygas/process-server",
"path": "/mqtt_processor/listen_and_getfile.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: saullocastro/panels path: /theory/multidomain_panels/tstiff2d_clt_donnell_bardell/failed_attempts/tstiff2d_clt_donnell_bardell_conn3/print_expressions_python.py
import os
import glob
from ast import literal_eval
import numpy as np
import sympy
from sympy import pi, sin, cos, var
from compmech.c... | code_fim | medium | {
"lang": "python",
"repo": "saullocastro/panels",
"path": "/theory/multidomain_panels/tstiff2d_clt_donnell_bardell/failed_attempts/tstiff2d_clt_donnell_bardell_conn3/print_expressions_python.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>for i, filepath in enumerate(
glob.glob(r'./output_expressions_mathematica/fortran_*.txt')):
print(filepath)
with open(filepath) as f:
filename = os.path.basename(filepath)
names = filename[:-4].split('_')
lines = [line.strip() for line in f.readlines()]
str... | code_fim | medium | {
"lang": "python",
"repo": "saullocastro/panels",
"path": "/theory/multidomain_panels/tstiff2d_clt_donnell_bardell/failed_attempts/tstiff2d_clt_donnell_bardell_conn3/print_expressions_python.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i in counter.keys():
j = 2020-i
if j in counter.keys():
return i*j<|fim_prefix|># repo: SilvestrePerret/adventofcode-2020 path: /day-01/part-1/david.py
from tool.runners.python import SubmissionPy
from collections import defaultdict
class DavidSubmiss... | code_fim | hard | {
"lang": "python",
"repo": "SilvestrePerret/adventofcode-2020",
"path": "/day-01/part-1/david.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SilvestrePerret/adventofcode-2020 path: /day-01/part-1/david.py
from tool.runners.python import SubmissionPy
from collections import defaultdict
class DavidSubmission(SubmissionPy):
<|fim_suffix|> del counter[1010]
for i in counter.keys():
j = 2020-i
if j... | code_fim | hard | {
"lang": "python",
"repo": "SilvestrePerret/adventofcode-2020",
"path": "/day-01/part-1/david.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> del counter[1010]
for i in counter.keys():
j = 2020-i
if j in counter.keys():
return i*j<|fim_prefix|># repo: SilvestrePerret/adventofcode-2020 path: /day-01/part-1/david.py
from tool.runners.python import SubmissionPy
from collections import defa... | code_fim | hard | {
"lang": "python",
"repo": "SilvestrePerret/adventofcode-2020",
"path": "/day-01/part-1/david.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tykling/tlsscout path: /src/group/models.py
from django.db import models
### configuration groups
class Group(models.Model):
<|fim_suffix|> def __str__(self):
return self.name<|fim_middle|> name = models.CharField(max_length=50)
interval_hours = models.PositiveIntegerField(defa... | code_fim | hard | {
"lang": "python",
"repo": "tykling/tlsscout",
"path": "/src/group/models.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.