text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: yehonadav/yonadav_tutorials path: /learn_python/learn_appium/sample-code-master/sample-code/examples/python/desired_capabilities.py
desired_caps = {}
desired_caps['platfo<|fim_suffix|>['deviceName'] = 'sdk_google_phone_x86'<|fim_middle|>rmName'] = 'Android'
# desired_caps['platformVersion'] = '5.... | code_fim | medium | {
"lang": "python",
"repo": "yehonadav/yonadav_tutorials",
"path": "/learn_python/learn_appium/sample-code-master/sample-code/examples/python/desired_capabilities.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lsjsss/PythonClass path: /PythonBookAdditional/第17章 科学计算与可视化/code/matplotlib_chinese.py
import numpy as np
import pylab as pl
import matplotlib.font_manager as fm
<|fim_suffix|>t = np.arange(0.0, 2.0*np.pi, 0.01)
s = np.sin(t)
z = np.cos(t)
pl.plot(t, s, label='正弦')
pl.plot(t, z, label='余弦')
pl.... | code_fim | medium | {
"lang": "python",
"repo": "lsjsss/PythonClass",
"path": "/PythonBookAdditional/第17章 科学计算与可视化/code/matplotlib_chinese.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>t = np.arange(0.0, 2.0*np.pi, 0.01)
s = np.sin(t)
z = np.cos(t)
pl.plot(t, s, label='正弦')
pl.plot(t, z, label='余弦')
pl.xlabel('x-变量', fontproperties='STKAITI', fontsize=24)
pl.ylabel('y-正弦余弦函数值', fontproperties='STKAITI', fontsize=24)
pl.title('sin-cos函数图像', fontproperties='STKAITI', fontsize=32)
pl.legen... | code_fim | medium | {
"lang": "python",
"repo": "lsjsss/PythonClass",
"path": "/PythonBookAdditional/第17章 科学计算与可视化/code/matplotlib_chinese.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
dependencies = [
('parsed_data', '0002_auto_20190128_1126'),
]
operations = [
migrations.AddField(
model_name='fb_insight',
name='fb_value',
field=models.CharField(default=1, max_length=100),
preserve_default=False,
... | code_fim | medium | {
"lang": "python",
"repo": "YooInKeun/Facebook-Page-Insights-Web-Crawler",
"path": "/Web Application(DB Insert)/parsed_data/migrations/0003_fb_insight_fb_value.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: YooInKeun/Facebook-Page-Insights-Web-Crawler path: /Web Application(DB Insert)/parsed_data/migrations/0003_fb_insight_fb_value.py
# Generated by Django 2.1.5 on 2019-01-28 02:29
<|fim_suffix|> operations = [
migrations.AddField(
model_name='fb_insight',
na... | code_fim | medium | {
"lang": "python",
"repo": "YooInKeun/Facebook-Page-Insights-Web-Crawler",
"path": "/Web Application(DB Insert)/parsed_data/migrations/0003_fb_insight_fb_value.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pugna0/paasta path: /tests/test_mesos_tools.py
# Copyright 2015 Yelp Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE... | code_fim | hard | {
"lang": "python",
"repo": "pugna0/paasta",
"path": "/tests/test_mesos_tools.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>@mock.patch('paasta_tools.mesos_tools.get_mesos_state_from_leader', autospec=True)
def test_get_mesos_slaves_grouped_by_attribute_bombs_out_with_no_slaves(mock_fetch_state):
mock_fetch_state.return_value = {
'slaves': []
}
with raises(mesos_tools.NoSlavesAvailable):
mesos_tools... | code_fim | hard | {
"lang": "python",
"repo": "pugna0/paasta",
"path": "/tests/test_mesos_tools.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_get_cpu_usage_handles_missing_stats():
fake_task = mock.create_autospec(mesos.cli.task.Task)
fake_task.cpu_limit = 1.1
fake_duration = 100
fake_task.stats = {}
fake_task.__getitem__.return_value = [{
'state': 'TASK_RUNNING',
'timestamp': int(datetime.datetime.... | code_fim | hard | {
"lang": "python",
"repo": "pugna0/paasta",
"path": "/tests/test_mesos_tools.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: b3ttin4/network_simulation_and_analysis path: /analysis/tools/smooth_map.py
#!/usr/bin/python
'''
filter functions
'''
import numpy as np
import scipy.ndimage as snd
import warnings
warnings.filterwarnings("ignore")
import analysis.tools.conf as c
def low_normalize(frame, mask=None, sigma=c.s... | code_fim | hard | {
"lang": "python",
"repo": "b3ttin4/network_simulation_and_analysis",
"path": "/analysis/tools/smooth_map.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ## gaussian low pass
low_mask = snd.gaussian_filter(m2,sig_low,mode='constant',cval=0)
low_data = 1.*snd.gaussian_filter(data,sig_low,mode='constant',cval=0)/low_mask
low_data[np.logical_not(m)] = 0
high_mask = snd.gaussian_filter(m,sig_high,mode='constant',cval=0)
highlow_data = low_data - 1.*snd... | code_fim | hard | {
"lang": "python",
"repo": "b3ttin4/network_simulation_and_analysis",
"path": "/analysis/tools/smooth_map.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if mask is None:
mask=np.ones(frame.shape,dtype=np.bool)
data = np.copy(frame)
m = np.zeros(mask.shape)
m[mask] = 1.0
m[~np.isfinite(frame)] = 0.
data[np.logical_not(m)] = 0.
m2 = np.copy(m)
## gaussian low pass
low_mask = snd.gaussian_filter(m2,sig_low,mode='constant',cval=0)
low_data = 1.*... | code_fim | hard | {
"lang": "python",
"repo": "b3ttin4/network_simulation_and_analysis",
"path": "/analysis/tools/smooth_map.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: whkanggg/hyperion path: /tests/hyperion/metrics/test_roc.py
"""
Copyright 2018 Johns Hopkins University (Author: Jesus Villalba)
Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import divi... | code_fim | hard | {
"lang": "python",
"repo": "whkanggg/hyperion",
"path": "/tests/hyperion/metrics/test_roc.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> plt.subplot(2,3,2)
tar = np.array([0])
non = np.array([1])
pmiss, pfa = compute_rocch(tar,non)
pm, pf = compute_roc(tar,non)
plt.plot(pfa,pmiss,'r-^',pf,pm,'g--v',linewidth=2)
plt.axis('square')
plt.grid(True)
plt.title('2 scores: tar < non')
print(pmiss, pfa)
p... | code_fim | hard | {
"lang": "python",
"repo": "whkanggg/hyperion",
"path": "/tests/hyperion/metrics/test_roc.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> plt.subplot(2,3,3)
tar = np.array([0])
non = np.array([-1,1])
pmiss, pfa = compute_rocch(tar,non)
pm, pf = compute_roc(tar,non)
plt.plot(pfa,pmiss,'r-^',pf,pm,'g--v',linewidth=2)
plt.axis('square')
plt.grid(True)
plt.title('3 scores: non < tar < non')
print(pmiss, p... | code_fim | hard | {
"lang": "python",
"repo": "whkanggg/hyperion",
"path": "/tests/hyperion/metrics/test_roc.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # check the inventory count has been reduced
response = self.client.get('/product/2')
atfer_purchase_inventory_count = response.json['data'][0]['inventory_count']
self.assertEqual(initial_inventory_count - requested_quantity, atfer_purchase_inventory_count)<|fim_prefix|># r... | code_fim | hard | {
"lang": "python",
"repo": "veken1199/Simple-Flask-Cart",
"path": "/tests/test_purchase_api.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: veken1199/Simple-Flask-Cart path: /tests/test_purchase_api.py
import sys
from tests.base import BaseTestCase
class PurchaseApiTest(BaseTestCase):
def test_purchase_api_validations(self):
response = self.post('/purchase', dict())
self.assert_status(response, 422)
se... | code_fim | hard | {
"lang": "python",
"repo": "veken1199/Simple-Flask-Cart",
"path": "/tests/test_purchase_api.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # get the initial inventory count of product id =1
product_id = 2
requested_quantity = 2
response = self.client.get('/product/2')
initial_inventory_count = response.json['data'][0]['inventory_count']
# purchase 2 products of id = 1
response = self.... | code_fim | hard | {
"lang": "python",
"repo": "veken1199/Simple-Flask-Cart",
"path": "/tests/test_purchase_api.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 5l1v3r1/Interpretable_DDTS_AISTATS2020 path: /interpretable_ddts/runfiles/gym_runner.py
# Created by Andrew Silva on 8/28/19
import gym
import numpy as np
import torch
from interpretable_ddts.agents.ddt_agent import DDTAgent
from interpretable_ddts.agents.mlp_agent import MLPAgent
from interpreta... | code_fim | hard | {
"lang": "python",
"repo": "5l1v3r1/Interpretable_DDTS_AISTATS2020",
"path": "/interpretable_ddts/runfiles/gym_runner.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> running_reward_array = []
for episode in range(episodes):
reward = 0
returned_object = run_episode(None, agent_in=agent, ENV_NAME=ENV_NAME)
reward += returned_object[0]
running_reward_array.append(returned_object[0])
agent.replay_buffer.extend(returned_objec... | code_fim | hard | {
"lang": "python",
"repo": "5l1v3r1/Interpretable_DDTS_AISTATS2020",
"path": "/interpretable_ddts/runfiles/gym_runner.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>for provider in providers.registry.get_list():
try:
prov_mod = import_module(provider.get_package() + '.urls')
except ImportError:
pass
else:
prov_urlpatterns = getattr(prov_mod, 'urlpatterns', ())
urlpatterns.extend(prov_urlpatterns)<|fim_prefix|># repo: dssg/m... | code_fim | medium | {
"lang": "python",
"repo": "dssg/marketplace",
"path": "/src/marketplace/socialauth/provider_urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dssg/marketplace path: /src/marketplace/socialauth/provider_urls.py
from importlib import import_module
from allauth.socialaccount import providers
# Note: This is not the documented manner of installing allauth paths.
# Rather, for example, you might:
#
# path('accounts/', include('allaut... | code_fim | medium | {
"lang": "python",
"repo": "dssg/marketplace",
"path": "/src/marketplace/socialauth/provider_urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dj95/httpgrep path: /src/htmlparser.py
#!/usr/bin/env python3
#
# httpgrep
#
# (c) 2018 Daniel Jankowski
from html.parser import HTMLParser
class HtmlParser (HTMLParser):
<|fim_suffix|> def __init_ (self):
# initialize the html parser
HTMLParser.__init__(self)
def han... | code_fim | medium | {
"lang": "python",
"repo": "dj95/httpgrep",
"path": "/src/htmlparser.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # initialize the html parser
HTMLParser.__init__(self)
def handle_starttag(self, tag, attributes):
# convert attributes to array
attr = self.__attributesToDict ( attributes )
# check if script tag with src is the existing tag
if tag == 'script' and att... | code_fim | medium | {
"lang": "python",
"repo": "dj95/httpgrep",
"path": "/src/htmlparser.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aderugin/django-notifier path: /django_notifier/admin.py
# -*- coding: utf-8 -*-
from django.contrib import admin
from django import forms
from django.shortcuts import redirect
from django.core.urlresolvers import reverse
class BaseTemplateForm(forms.ModelForm):
def __init__(self, *args, **... | code_fim | medium | {
"lang": "python",
"repo": "aderugin/django-notifier",
"path": "/django_notifier/admin.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def has_add_permission(self, request):
if self.model.objects.count() > 0:
return False
else:
return True
def changelist_view(self, request, extra_context=None):
info = '{0}_{1}'.format(self.model._meta.app_label, self.model._meta.model_name)
... | code_fim | hard | {
"lang": "python",
"repo": "aderugin/django-notifier",
"path": "/django_notifier/admin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Tjccs/College-Python path: /SI/PL_06/test.py
from jogos_sint import *
class TicTacToe(Game):
"""Play TicTacToe on an h x v board, with Max (first player) playing 'X'.
A state has the player to move, a cached utility, a list of moves in
the form of a list of (x, y) positions, and a bo... | code_fim | hard | {
"lang": "python",
"repo": "Tjccs/College-Python",
"path": "/SI/PL_06/test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> "Return true if there is a line through move on board for player."
(delta_x, delta_y) = delta_x_y
x, y = move
n = 0 # n is number of moves in row
while board.get((x, y)) == player:
n += 1
x, y = x + delta_x, y + delta_y
x, y = move
... | code_fim | hard | {
"lang": "python",
"repo": "Tjccs/College-Python",
"path": "/SI/PL_06/test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: palashsharma891/Algorithms-in-Python path: /1. Elementary Data Structures/Queue/Deque.py
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 1 16:14:29 2020
@author: Palash
"""
class Deque(object):
""" Represents a Deque ADT"""
def __init__(self):
"""
Constructor to initial... | code_fim | hard | {
"lang": "python",
"repo": "palashsharma891/Algorithms-in-Python",
"path": "/1. Elementary Data Structures/Queue/Deque.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Returns the length of (number of elements in) the deque
"""
return len(self.deque)
def __str__(self):
"""
Returns the deque in the form of a string
For example: [1,2,3] is returned as '[1,2,3]'
"""
return str(self.deque)
... | code_fim | hard | {
"lang": "python",
"repo": "palashsharma891/Algorithms-in-Python",
"path": "/1. Elementary Data Structures/Queue/Deque.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Returns True if deque is empty, False otherwise
"""
return len(self.deque) == 0
def __len__(self):
"""
Returns the length of (number of elements in) the deque
"""
return len(self.deque)
def __str__(self):
"""
... | code_fim | hard | {
"lang": "python",
"repo": "palashsharma891/Algorithms-in-Python",
"path": "/1. Elementary Data Structures/Queue/Deque.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: amirj/unifying_explicit_implicit path: /utils.py
print('number of interactions before filtering: %s' %
format(len(uids), ','))
# count the number of user's explicit interactions
users_rates = {}
for (uid, rate) in zip(uids, ratings):
if rate > 0:
n... | code_fim | hard | {
"lang": "python",
"repo": "amirj/unifying_explicit_implicit",
"path": "/utils.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: amirj/unifying_explicit_implicit path: /utils.py
reads = shuffle(uids,
iids,
ratings,
... | code_fim | hard | {
"lang": "python",
"repo": "amirj/unifying_explicit_implicit",
"path": "/utils.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # re-maps the uids and iids into new continious IDs
uid_map = defaultdict(count().__next__)
iid_map = defaultdict(count().__next__)
uids = np.array([uid_map[uid] for uid in uids], dtype=np.int32)
iids = np.array([iid_map[iid] for iid in iids], dtype=np.int32)
# build the rate data... | code_fim | hard | {
"lang": "python",
"repo": "amirj/unifying_explicit_implicit",
"path": "/utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SECURED-FP7/secured-mobility-ned path: /PSC/Config.py
import ConfigParser
import os
import copy
class Configuration(object):
_instance = None
_AUTH_SERVER = None
def __new__(cls, *args, **kwargs):
if not cls._instance:
cls._instance = super(Con... | code_fim | hard | {
"lang": "python",
"repo": "SECURED-FP7/secured-mobility-ned",
"path": "/PSC/Config.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self):
#print 'Configuration - PATH : '+os.getcwd()
path = copy.copy(os.getcwd())
path_dirs = path.split("/")
for path_dir in path_dirs:
if path_dir == 'tests':
self.test = True
else:
self.test = False... | code_fim | medium | {
"lang": "python",
"repo": "SECURED-FP7/secured-mobility-ned",
"path": "/PSC/Config.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self._LOG_FILE
@property
def VERBOSE(self):
return self._VERBOSE
@property
def ORCHESTRATOR_ADDRESS(self):
return self._ORCHESTRATOR_ADDRESS
@property
def PSA_API_VERSION(self):
return self._PSA_API_VERSION
@property
def PSC_VE... | code_fim | hard | {
"lang": "python",
"repo": "SECURED-FP7/secured-mobility-ned",
"path": "/PSC/Config.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Returns:
Random boolean value.
"""
return random.randrange(100) < percent<|fim_prefix|># repo: uccser/codewof path: /codewof/tests/utils.py
"""Utility functions for testing."""
import random
<|fim_middle|>
def random_boolean(percent=50):
"""Return a random boolean.
Args:
... | code_fim | medium | {
"lang": "python",
"repo": "uccser/codewof",
"path": "/codewof/tests/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: uccser/codewof path: /codewof/tests/utils.py
"""Utility functions for testing."""
import random
<|fim_suffix|> Returns:
Random boolean value.
"""
return random.randrange(100) < percent<|fim_middle|>def random_boolean(percent=50):
"""Return a random boolean.
Args:
... | code_fim | medium | {
"lang": "python",
"repo": "uccser/codewof",
"path": "/codewof/tests/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: uccser/codewof path: /codewof/tests/utils.py
"""Utility functions for testing."""
<|fim_suffix|> Returns:
Random boolean value.
"""
return random.randrange(100) < percent<|fim_middle|>import random
def random_boolean(percent=50):
"""Return a random boolean.
Args:
... | code_fim | medium | {
"lang": "python",
"repo": "uccser/codewof",
"path": "/codewof/tests/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# returns vector
def localEfficiency(network):
bct.efficiency_wei(network, local=True)
# returns vector
def degreeCentrality(network):
dCentrality = []
for j in network:
dCentrality.append(sum(j))
return dCentrality<|fim_prefix|># repo: Sk7w4tch3r/universityProjects path: /Fift... | code_fim | hard | {
"lang": "python",
"repo": "Sk7w4tch3r/universityProjects",
"path": "/Fifth One/Numerical Linear Algebra/autism screening/functions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Sk7w4tch3r/universityProjects path: /Fifth One/Numerical Linear Algebra/autism screening/functions.py
from sklearn.naive_bayes import GaussianNB
from sklearn import svm
from sklearn.neighbors import NearestNeighbors
from scipy.stats import pearsonr
import numpy as np
import pandas as pd
import bc... | code_fim | medium | {
"lang": "python",
"repo": "Sk7w4tch3r/universityProjects",
"path": "/Fifth One/Numerical Linear Algebra/autism screening/functions.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def nice_numbers(x,y):
'''calls round_to_factor_of takes the number it returns and returns a nice looking value that is larger than it'''
r = round_to_factor_of(x,y)
if r <= 7:
return x
elif 7 < r <= 20:
return r
elif 20 < r < 1000:
return np.round(r/100... | code_fim | hard | {
"lang": "python",
"repo": "esaurette/multiplot-geochem-bydepth",
"path": "/roundto.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: esaurette/multiplot-geochem-bydepth path: /roundto.py
# -*- coding: utf-8 -*-
"""
Function for rounding a number to a nice number
Intended for use on the maximum value of a dataset for determining the axis range
Emily Saurette
March 11, 2019
"""
import numpy as np
<|fim_suffix|> '''c... | code_fim | hard | {
"lang": "python",
"repo": "esaurette/multiplot-geochem-bydepth",
"path": "/roundto.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''calls round_to_factor_of takes the number it returns and returns a nice looking value that is larger than it'''
r = round_to_factor_of(x,y)
if r <= 7:
return x
elif 7 < r <= 20:
return r
elif 20 < r < 1000:
return np.round(r/100, 1)*100
elif r >= ... | code_fim | hard | {
"lang": "python",
"repo": "esaurette/multiplot-geochem-bydepth",
"path": "/roundto.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
:param graph: (nx.classes.graph.Graph) A NetworkX graph.
:param probability: (float) A number in [0, 1] which gives the probability
each vertex lies on the right side of the cut.
:return: (structures.cut.Cut) The random cut which results from randomly
assigning vertices... | code_fim | hard | {
"lang": "python",
"repo": "hermish/cvx-graph-algorithms",
"path": "/cvxgraphalgs/algorithms/max_cut.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hermish/cvx-graph-algorithms path: /cvxgraphalgs/algorithms/max_cut.py
import numpy as np
import cvxpy as cp
import networkx as nx
from cvxgraphalgs.structures.cut import Cut
def greedy_max_cut(graph):
"""
Runs a greedy MAX-CUT approximation algorithm to partition the vertices of
t... | code_fim | hard | {
"lang": "python",
"repo": "hermish/cvx-graph-algorithms",
"path": "/cvxgraphalgs/algorithms/max_cut.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Get default params for specific case"""
item = default_params_for_case(case_id)
return item<|fim_prefix|># repo: DenRomanen/FEDOT.Web path: /app/api/sandbox/controller.py
from typing import List
from flask_accepts import responds
from flask_restx import Namespace, Resource
fr... | code_fim | hard | {
"lang": "python",
"repo": "DenRomanen/FEDOT.Web",
"path": "/app/api/sandbox/controller.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DenRomanen/FEDOT.Web path: /app/api/sandbox/controller.py
from typing import List
from flask_accepts import responds
from flask_restx import Namespace, Resource
from .models import PipelineEpochMapping, SandboxDefaultParams
from .schema import PipelineEpochMappingSchema, SandboxDefaultParamsSch... | code_fim | medium | {
"lang": "python",
"repo": "DenRomanen/FEDOT.Web",
"path": "/app/api/sandbox/controller.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def create_service():
core_v1_api = client.CoreV1Api()
body = client.V1Service(
api_version="v1",
kind="Service",
metadata=client.V1ObjectMeta(
name="service-example"
),
spec=client.V1ServiceSpec(
selector={"app": "deployment"},
... | code_fim | hard | {
"lang": "python",
"repo": "samlet/stack",
"path": "/k8s/ingress_create.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: samlet/stack path: /k8s/ingress_create.py
# Copyright 2019 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/license... | code_fim | hard | {
"lang": "python",
"repo": "samlet/stack",
"path": "/k8s/ingress_create.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> core_v1_api = client.CoreV1Api()
body = client.V1Service(
api_version="v1",
kind="Service",
metadata=client.V1ObjectMeta(
name="service-example"
),
spec=client.V1ServiceSpec(
selector={"app": "deployment"},
ports=[client.V... | code_fim | hard | {
"lang": "python",
"repo": "samlet/stack",
"path": "/k8s/ingress_create.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> df_osm = df_osm.select('id', 'h3Index').withColumnRenamed('h3Index', 'h3IndexOsm').withColumnRenamed('id', 'osmId')
df_google = df_google \
.withColumn('osmId', df_google['osmId'].cast(LongType())) \
.withColumn('osmId', concat('type', 'osmId')) \
.select('id', 'osmId', 'co... | code_fim | medium | {
"lang": "python",
"repo": "Avkash/kuwala",
"path": "/kuwala/core/neo4j/importer/src/PipelineConnector.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Avkash/kuwala path: /kuwala/core/neo4j/importer/src/PipelineConnector.py
import Neo4jConnection as Neo4jConnection
from pyspark.sql import DataFrame
from pyspark.sql.functions import concat
from pyspark.sql.types import LongType
# Create relationships from high resolution H3 indexes to lower re... | code_fim | medium | {
"lang": "python",
"repo": "Avkash/kuwala",
"path": "/kuwala/core/neo4j/importer/src/PipelineConnector.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Neo4jConnection.connect_to_graph()
Neo4jConnection.query_graph('CREATE CONSTRAINT poi IF NOT EXISTS ON (p:Poi) ASSERT p.id IS UNIQUE')
query = '''
// Create Poi nodes
UNWIND $rows AS row
WITH
CASE WHEN row.confidence >= 0.9
THEN row.h3Inde... | code_fim | hard | {
"lang": "python",
"repo": "Avkash/kuwala",
"path": "/kuwala/core/neo4j/importer/src/PipelineConnector.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def create_log_dir():
try:
os.mkdir(dirs['log'])
except:
pass
def setup_test_env():
clean()
create_log_dir()
def sigint_handler(signum, frame):
'''Handles the user hitting ctrl + C by exiting the routine'''
print ('Exiting program')
os._exit(1)
def main():
print("Routine Options... | code_fim | hard | {
"lang": "python",
"repo": "pjkaufman/Java_DiffChecker",
"path": "/routines.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pjkaufman/Java_DiffChecker path: /routines.py
import os
import signal
import platform
from sys import stdin
from sys import stdout
from subprocess import call
from subprocess import check_output
from shutil import rmtree
from shutil import copy
dirs = {'debug': 'build', 'dist':'bin', 'jar': 'lib... | code_fim | hard | {
"lang": "python",
"repo": "pjkaufman/Java_DiffChecker",
"path": "/routines.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
os.mkdir(dirs['log'])
except:
pass
def setup_test_env():
clean()
create_log_dir()
def sigint_handler(signum, frame):
'''Handles the user hitting ctrl + C by exiting the routine'''
print ('Exiting program')
os._exit(1)
def main():
print("Routine Options")
print("run - make... | code_fim | hard | {
"lang": "python",
"repo": "pjkaufman/Java_DiffChecker",
"path": "/routines.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ualissonribeiro/prog.2021.1 path: /primeiro_programa.py
idadeDoYuri = 27
frasedoyuri = "a idade do yuri é "
print(frasedoyuri)
print(idadeDoYuri)
<|fim_suffix|>
print("o tipo das variaveis é")
print(type(idadedoualisson))
print(type(frasedoualisson))<|fim_middle|>idadedoualisson = 35
frasedoual... | code_fim | medium | {
"lang": "python",
"repo": "ualissonribeiro/prog.2021.1",
"path": "/primeiro_programa.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
print("o tipo das variaveis é")
print(type(idadedoualisson))
print(type(frasedoualisson))<|fim_prefix|># repo: ualissonribeiro/prog.2021.1 path: /primeiro_programa.py
idadeDoYuri = 27
frasedoyuri = "a idade do yuri é "
<|fim_middle|>print(frasedoyuri)
print(idadeDoYuri)
idadedoualisson = 35
frasedoual... | code_fim | hard | {
"lang": "python",
"repo": "ualissonribeiro/prog.2021.1",
"path": "/primeiro_programa.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>idadedoualisson = 35
frasedoualisson = "a idade do ualisson é "
print(frasedoualisson)
print(idadedoualisson)
print("a soma das idades é")
print(idadedoualisson+idadeDoYuri)
print("o tipo das variaveis é")
print(type(idadedoualisson))
print(type(frasedoualisson))<|fim_prefix|># repo: ualissonribeiro/pro... | code_fim | easy | {
"lang": "python",
"repo": "ualissonribeiro/prog.2021.1",
"path": "/primeiro_programa.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xvybihal/zabbix-alerta path: /zabbix_alerta.py
#!/usr/bin/env python
import os
import sys
import argparse
import json
import urllib2
import logging as LOG
__version__ = '3.0.0'
_DEFAULT_LOG_FORMAT = "%(asctime)s.%(msecs).03d %(name)s[%(process)d] %(threadName)s %(levelname)s - %(message)s"
_D... | code_fim | hard | {
"lang": "python",
"repo": "xvybihal/zabbix-alerta",
"path": "/zabbix_alerta.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for line in args.body.split('\n'):
if '=' not in line:
continue
try:
macro, value = line.split('=', 1)
except ValueError, e:
LOG.warning('%s: %s', e, line)
continue
if macro == 'service':
value = value.split('... | code_fim | hard | {
"lang": "python",
"repo": "xvybihal/zabbix-alerta",
"path": "/zabbix_alerta.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if 'status' in alert:
if alert['status'] == 'OK':
alert['severity'] = 'normal'
del alert['status']
if 'ack' in alert:
if alert['ack'] == 'Yes':
alert['status'] = 'ack'
del alert['ack']
LOG.info(alert)
post = json.dumps(alert, ensur... | code_fim | hard | {
"lang": "python",
"repo": "xvybihal/zabbix-alerta",
"path": "/zabbix_alerta.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class ItemProxy(object):
"""Proxy for accessing serializable items."""
def __init__(self, field, factory, filter=None):
"""Initialise the Proxy.
Args:
field: Message of 'Repeated' type
factory (shellcraft.core.BaseFactory): Factory used to produce the ite... | code_fim | hard | {
"lang": "python",
"repo": "maebert/shellcraft",
"path": "/src/shellcraft/core.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: maebert/shellcraft path: /src/shellcraft/core.py
# -*- coding: utf-8 -*-
"""Core Classes."""
import os
import toml
from copy import copy
from shellcraft.utils import to_list, to_float
from google.protobuf.descriptor import Descriptor
from builtins import str
RESOURCES = ["clay", "energy", "ore"... | code_fim | hard | {
"lang": "python",
"repo": "maebert/shellcraft",
"path": "/src/shellcraft/core.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Load an item from dict representation."""
item = cls(name)
item.description = data.get("description", "")
item.difficulty = data.get("difficulty", 0)
item.prerequisites = data.get("prerequisites", {})
item.prerequisites["items"] = to_list(item.prerequis... | code_fim | hard | {
"lang": "python",
"repo": "maebert/shellcraft",
"path": "/src/shellcraft/core.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Azure/azure-functions-durable-extension path: /test/PerfTests/Python/ManyInstances/__init__.py
import logging
import azure.functions as func
import azure.durable_functions as df
from shared_utils.parse_and_validate_input import parse_and_validate_input
import asyncio
<|fim_suffix|>async def gath... | code_fim | hard | {
"lang": "python",
"repo": "Azure/azure-functions-durable-extension",
"path": "/test/PerfTests/Python/ManyInstances/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>async def gather(tasks, max_concurrency: int):
semaphore = asyncio.Semaphore(max_concurrency)
async def sem_task(task):
async with semaphore:
return await task
return await asyncio.gather(*(sem_task(task) for task in tasks))<|fim_prefix|># repo: Azure/azure-functions-durabl... | code_fim | hard | {
"lang": "python",
"repo": "Azure/azure-functions-durable-extension",
"path": "/test/PerfTests/Python/ManyInstances/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>REGISTERED_MODELS = {
'finetune': noisy_models.FineTune,
'mwnet': noisy_models.MWNetModel,
}<|fim_prefix|># repo: PTAEJOOO/noisy_label_pretrain path: /models/__init__.py
from models import encoder
from models import losses
from models import resnet
<|fim_middle|>from models import noisy_models
| code_fim | easy | {
"lang": "python",
"repo": "PTAEJOOO/noisy_label_pretrain",
"path": "/models/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PTAEJOOO/noisy_label_pretrain path: /models/__init__.py
from models import encoder
from models import losses
from models import resnet
<|fim_suffix|>REGISTERED_MODELS = {
'finetune': noisy_models.FineTune,
'mwnet': noisy_models.MWNetModel,
}<|fim_middle|>from models import noisy_models
| code_fim | easy | {
"lang": "python",
"repo": "PTAEJOOO/noisy_label_pretrain",
"path": "/models/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
gprint(make_sudoku(1)) # [[1]]
gprint(make_sudoku(2)) # [[1,2,3,4],[3,4,1,2],[2,1,4,3],[4,3,2,1]]
gprint(make_sudoku(3)) # [[3,5,8,1,2,7,6,4,9],[6,7,4,5,8,9,3,2,1],[2,1,9,3,4,6,5,7,8],[9,8,6,7,1,4,2,5,3],[4,3,1,2,6,5,8,9,7],[7,2,5,9,3,8,1,6,4],[1,6,3,4,7,2,9,8,5],[8,9,7,6,5,1,4,3,2],[5,4,2,8,9,3,7,1,6]]<... | code_fim | medium | {
"lang": "python",
"repo": "Vasniktel/prometheus-python",
"path": "/8/lab8_4.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Vasniktel/prometheus-python path: /8/lab8_4.py
def make_sudoku(size):
sudoku = []
tmp = [[j for j in range(size * (i - 1) + 1, size * i + 1)] for i in range(1, size + 1)]
for i in range(size):
for j in range(size):
sudoku.append(sum(tmp, []))
first = tmp[0]
tmp = tmp[1:]
tmp.ap... | code_fim | medium | {
"lang": "python",
"repo": "Vasniktel/prometheus-python",
"path": "/8/lab8_4.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def gprint(list_):
for i in list_:
print(i)
gprint(make_sudoku(1)) # [[1]]
gprint(make_sudoku(2)) # [[1,2,3,4],[3,4,1,2],[2,1,4,3],[4,3,2,1]]
gprint(make_sudoku(3)) # [[3,5,8,1,2,7,6,4,9],[6,7,4,5,8,9,3,2,1],[2,1,9,3,4,6,5,7,8],[9,8,6,7,1,4,2,5,3],[4,3,1,2,6,5,8,9,7],[7,2,5,9,3,8,1,6,4],[1,6,3,4,7,2,... | code_fim | medium | {
"lang": "python",
"repo": "Vasniktel/prometheus-python",
"path": "/8/lab8_4.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> 'interval of allowed orders U(x_k)'
U1 = (0, 10)
return (U1, ) # tuple, to support several controls
# Attach it to the system description.
invsys.control_box = admissible_orders
### Cost description g = r(x) + c.u
(h,p,c) = 0.5, 3, 1
def op_cost(x,u,w):
'operational cost of the s... | code_fim | hard | {
"lang": "python",
"repo": "acrowise/stodynprog",
"path": "/doc/example_inventory.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|># discretize the perturbation
N_w = len(demand_values)
dpsolv.discretize_perturb(demand_values[0], demand_values[-1], N_w)
# control discretization step:
dpsolv.control_steps=(1,) #
#dpsolv.print_summary()
### Value iteration
J_0 = np.zeros(N_x)
# first iteration
J,u = dpsolv.value_iteration(J_0)
print(... | code_fim | hard | {
"lang": "python",
"repo": "acrowise/stodynprog",
"path": "/doc/example_inventory.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: acrowise/stodynprog path: /doc/example_inventory.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
""" Example of an Inventory Control problem for the documentation
This code closely matches the code chunks of example_inventory.rst
Plots are in seperate file (for embedded plot generation)
* example... | code_fim | hard | {
"lang": "python",
"repo": "acrowise/stodynprog",
"path": "/doc/example_inventory.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("This will send infinite UDP packets and tries to exhaust host's resource fully.")
http = raw_input("Select a Target ( Ex http/site.suffix ) Don't use www in anyway : ")
os.system("python2 wp.py %s"% http)
if __name__ == '__main__':
main()<|fim_prefix|># repo: 5l1v3r1/S0u1Tool pat... | code_fim | hard | {
"lang": "python",
"repo": "5l1v3r1/S0u1Tool",
"path": "/Menu.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 5l1v3r1/S0u1Tool path: /Menu.py
#!/usr/bin/env python
import os
import re
import platform
import colorama
from colorama import Fore, Back, Style
R='\033[1;31m'
B='\033[1;34m'
Y='\033[1;33m'
G='\033[1;32m'
C='\033[1;36m'
N='\033[0m'
#if platform.system() == 'Windows':
#warn("This script ha... | code_fim | hard | {
"lang": "python",
"repo": "5l1v3r1/S0u1Tool",
"path": "/Menu.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: realflash7/raiden path: /raiden/network/transport/matrix/__init__.py
from raiden.network.transport.matrix.transport import ( # noqa
MatrixTransport,
UserPresence,
_RetryQueue,
)
from raiden.network.transport<|fim_suffix|>
make_client,
sort_servers_closest,
validate_userid... | code_fim | medium | {
"lang": "python",
"repo": "realflash7/raiden",
"path": "/raiden/network/transport/matrix/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
make_client,
sort_servers_closest,
validate_userid_signature,
)<|fim_prefix|># repo: realflash7/raiden path: /raiden/network/transport/matrix/__init__.py
from raiden.network.transport.matrix.transport import ( # noqa
MatrixTransport,
UserPresence,
_RetryQueue,
)
from raiden.netw... | code_fim | medium | {
"lang": "python",
"repo": "realflash7/raiden",
"path": "/raiden/network/transport/matrix/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> params[8],
params[9],
params[10],
params[11],
params[12],
params[13],
)
i = input("What is your argument? ")
i = i.lower().replace("[ref]", "")
i = "".join(c for c in i if c.isdigit() or c.isalpha() or c == " ")
i = re.sub(r" \W+", " ", i)
... | code_fim | hard | {
"lang": "python",
"repo": "Akash-Nayar/deBot",
"path": "/ArgumentQualityUsage.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|>w = []
for word in i:
try:
row.append(glove[word])
except:
continue
test.append(row)
for i in test:
for j in range(len(i), 78):
i.append(np.zeros(50))
w = np.ascontiguousarray(np.swapaxes(np.array(test).reshape(1, 78, 50), 0, 1))
... | code_fim | hard | {
"lang": "python",
"repo": "Akash-Nayar/deBot",
"path": "/ArgumentQualityUsage.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Akash-Nayar/deBot path: /ArgumentQualityUsage.py
import re
import numpy as np
from gensim.models.keyedvectors import KeyedVectors
from ArgumentQualityTrain import RNN
if __name__ == "__main__":
glove = KeyedVectors.load_word2vec_format("glove.6B.50d.txt.w2v", binary=False)
params = np.lo... | code_fim | hard | {
"lang": "python",
"repo": "Akash-Nayar/deBot",
"path": "/ArgumentQualityUsage.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nightsh/opennames path: /opensanctions/crawlers/eu_fsf.py
from lxml import etree
from lxml.etree import _Element as Element
from banal import as_bool
from prefixdate import parse_parts
from opensanctions.core import Context
from opensanctions import helpers as h
from opensanctions.core.entity im... | code_fim | hard | {
"lang": "python",
"repo": "nightsh/opennames",
"path": "/opensanctions/crawlers/eu_fsf.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> subject_type = entry.find("./subjectType")
schema = context.lookup_value(
"subject_type",
subject_type.get("code"),
dataset="eu_fsf",
)
if schema is None:
context.log.warning("Unknown subject type", type=subject_type)
return
entity = context.mak... | code_fim | hard | {
"lang": "python",
"repo": "nightsh/opennames",
"path": "/opensanctions/crawlers/eu_fsf.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
import core.models
from core.models.author import Author
# from core.models.article import Article
# from core.models.article import Revision
# from core.models.file import File
# from core.models.template import Template
#
# from core.control.article import ControlArticle
@singl... | code_fim | hard | {
"lang": "python",
"repo": "agolibroda/PyTorWiki",
"path": "/core/BaseHandlers.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@singleton
class SingletonAuthor(Author):
pass
class BaseHandler(SessionBaseHandler):
# @gen.coroutine
def get_current_user(self):
"""
Это Стандартный торнадовский функций, про получение данных о пользователе
"""
self.current_user = Si... | code_fim | hard | {
"lang": "python",
"repo": "agolibroda/PyTorWiki",
"path": "/core/BaseHandlers.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: agolibroda/PyTorWiki path: /core/BaseHandlers.py
#!/usr/bin/env python3.6
# -*- coding: utf-8 -*-
#
# Copyright 2015 Alec Golibroda
# Впринцепе, Это "тулБокс" - ящик с инструментами просто пользователя
# надо сюда добавить
# список ПОльзователей
# список Групп
import bcrypt
i... | code_fim | hard | {
"lang": "python",
"repo": "agolibroda/PyTorWiki",
"path": "/core/BaseHandlers.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self,
credential: "AsyncTokenCredential",
top: Optional[int] = None,
skip: Optional[int] = None,
search: Optional[str] = None,
filter: Optional[str] = None,
count: Optional[bool] = None,
base_url: Optional[str] = None,
**kwargs: Any
... | code_fim | hard | {
"lang": "python",
"repo": "BrianTJackett/msgraph-cli",
"path": "/msgraph-cli-extensions/beta/financials_beta/azext_financials_beta/vendored_sdks/financials/aio/_financials.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.financials_financials = FinancialsFinancialsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.financials = FinancialsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.financials_companies = F... | code_fim | hard | {
"lang": "python",
"repo": "BrianTJackett/msgraph-cli",
"path": "/msgraph-cli-extensions/beta/financials_beta/azext_financials_beta/vendored_sdks/financials/aio/_financials.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BrianTJackett/msgraph-cli path: /msgraph-cli-extensions/beta/financials_beta/azext_financials_beta/vendored_sdks/financials/aio/_financials.py
:vartype financials_companies_sales_credit_memos: financials.aio.operations.FinancialsCompaniesSalesCreditMemosOperations
:ivar financials_companie... | code_fim | hard | {
"lang": "python",
"repo": "BrianTJackett/msgraph-cli",
"path": "/msgraph-cli-extensions/beta/financials_beta/azext_financials_beta/vendored_sdks/financials/aio/_financials.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bryanherger/Vertica-ML-Python path: /verticapy/tests/vDataFrame/test_vDF_utilities.py
c
def test_vDF_magic(self, titanic_vd):
assert (
str(titanic_vd["name"]._in(["Madison", "Ashley", None]))
== "(\"name\") IN ('Madison', 'Ashley', NULL)"
)
ass... | code_fim | hard | {
"lang": "python",
"repo": "bryanherger/Vertica-ML-Python",
"path": "/verticapy/tests/vDataFrame/test_vDF_utilities.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # testing vDataFrame[].head
result = titanic_vd.copy().sort({"age": "desc"})["age"].head(2)
assert result["age"] == [80.0, 76.0]
# testing vDataFrame.head
result = titanic_vd.copy().sort({"age": "desc"}).head(2)
assert result["age"] == [80.0, 76.0]
... | code_fim | hard | {
"lang": "python",
"repo": "bryanherger/Vertica-ML-Python",
"path": "/verticapy/tests/vDataFrame/test_vDF_utilities.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_vDF_del_catalog(self, titanic_vd):
result = titanic_vd.copy()
result.describe(method="numerical")
assert "max" in result["age"].catalog
assert "avg" in result["age"].catalog
result.del_catalog()
assert "max" not in result["age"].catalog
... | code_fim | hard | {
"lang": "python",
"repo": "bryanherger/Vertica-ML-Python",
"path": "/verticapy/tests/vDataFrame/test_vDF_utilities.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Abhinav1004/Network_Programming path: /database/server.py
#server code
import sqlite3
from socket import *
s=socket(AF_INET,SOCK_STREAM)
host=gethostname()
port=5305
s.bind((host,port))
s.listen(2)
c,a=s.accept()
conn=sqlite3.connect('test.db')
cur=conn.cursor()
<|fim_suffix|>def print_table()... | code_fim | hard | {
"lang": "python",
"repo": "Abhinav1004/Network_Programming",
"path": "/database/server.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> cur.execute("SELECT * FROM COMPANY")
data=cur.fetchall()
for row in data:
print row
while True:
data=c.recv(1024)
if not data:
break
cur.execute(data)
conn.commit
print_table()
c.close()
conn.close()<|fim_prefix|># repo: Abhinav1004/Network_Programmin... | code_fim | hard | {
"lang": "python",
"repo": "Abhinav1004/Network_Programming",
"path": "/database/server.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class SubscribeForm(FlaskForm):
username = StringField('Your Name', validators=[DataRequired()])
email = StringField('Your Email Address',validators=[Required(),Email()])
submit = SubmitField('Submit')<|fim_prefix|># repo: FrancisSakwa89/Blog path: /app/main/forms.py
from flask_wtf import Fl... | code_fim | hard | {
"lang": "python",
"repo": "FrancisSakwa89/Blog",
"path": "/app/main/forms.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: FrancisSakwa89/Blog path: /app/main/forms.py
from flask_wtf import FlaskForm
from wtforms import StringField,TextAreaField,SubmitField, SelectField
from wtforms.validators import Required, DataRequired, Email
class UpdateProfile(FlaskForm):
<|fim_suffix|>class PostForm(FlaskForm):
title = S... | code_fim | medium | {
"lang": "python",
"repo": "FrancisSakwa89/Blog",
"path": "/app/main/forms.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Athenolabs/erpnext_customization path: /erpnext_customization/website/utils.py
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
<|fim_suffix|>import frappe
from frappe import _
import frappe.defaults
def update_websit... | code_fim | easy | {
"lang": "python",
"repo": "Athenolabs/erpnext_customization",
"path": "/erpnext_customization/website/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> context["footer_company_name"] = frappe.db.get_value("Website Settings", "Website Settings", "footer_company_name")
context["facebook_link"] = frappe.db.get_value("Website Settings", "Website Settings", "facebook_link")<|fim_prefix|># repo: Athenolabs/erpnext_customization path: /erpnext_customization/... | code_fim | medium | {
"lang": "python",
"repo": "Athenolabs/erpnext_customization",
"path": "/erpnext_customization/website/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.