text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: openstack/python-zunclient path: /zunclient/tests/unit/v1/test_containers.py
g, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing pe... | code_fim | hard | {
"lang": "python",
"repo": "openstack/python-zunclient",
"path": "/zunclient/tests/unit/v1/test_containers.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: openstack/python-zunclient path: /zunclient/tests/unit/v1/test_containers.py
CREATE_CONTAINER1,
),
},
'/v1/containers/%s/rename?%s' % (CONTAINER1['id'],
parse.urlencode({'name': name})):
{
'POST': (
{},
... | code_fim | hard | {
"lang": "python",
"repo": "openstack/python-zunclient",
"path": "/zunclient/tests/unit/v1/test_containers.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bjmorgan/polyhedral-analysis path: /tests/test_orientation_parameters.py
import unittest
from polyhedral_analysis.orientation_parameters import cos_theta
import numpy as np
import math
class OrientationParametersTestCase( unittest.TestCase ):
def test_cos_theta_one( self ):
a = np.a... | code_fim | medium | {
"lang": "python",
"repo": "bjmorgan/polyhedral-analysis",
"path": "/tests/test_orientation_parameters.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> a = np.array( [ 0.0, 0.0, 1.0 ] )
b = np.array( [ 0.0, 0.0, 1.0 ] )
self.assertEqual( cos_theta( a, b ), 1.0 )
def test_cos_theta_three( self ):
a = np.array( [ 0.0, 0.0, 1.0 ] )
b = np.array( [ 0.0, 1.0, 1.0 ] )
self.assertTrue( cos_theta( a, b ) - mat... | code_fim | hard | {
"lang": "python",
"repo": "bjmorgan/polyhedral-analysis",
"path": "/tests/test_orientation_parameters.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vemel/tarantool-python path: /src/tarantool/space.py
# -*- coding: utf-8 -*-
### pylint: disable=C0301,W0105,W0401,W0614
'''
This module provides :class:`~tarantool.space.Space` class.
It is an object-oriented wrapper for request over Tarantool space.
'''
class Space(object):
<|fim_suffix|>
... | code_fim | hard | {
"lang": "python",
"repo": "vemel/tarantool-python",
"path": "/src/tarantool/space.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def select(self, values, **kwargs):
# Initialize arguments and its defaults from **kwargs
# I use the explicit argument initialization from the kwargs
# to make it impossible to pass positional arguments
index = kwargs.get("index", 0)
offset = kwargs.get("offset... | code_fim | hard | {
"lang": "python",
"repo": "vemel/tarantool-python",
"path": "/src/tarantool/space.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> alpha = self.mu * (1-self.phi)
return alpha
def fget_beta(self):
beta = self.phi * self.lambduh
return beta
def fget_gamma(self):
gamma = self.phi * (1-self.lambduh)
return gamma
class GARCHPriorHelper(PriorHelper):
def __init__(self):
self.names = ['log_mu', 'logit_... | code_fim | hard | {
"lang": "python",
"repo": "PeiKaLunCi/sgmcmc_ssm_code",
"path": "/sgmcmc_ssm/variables/garch_var.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PeiKaLunCi/sgmcmc_ssm_code path: /sgmcmc_ssm/variables/garch_var.py
import numpy as np
import scipy.stats
from scipy.special import expit, logit
from ..base_parameters import (
ParamHelper, PriorHelper, PrecondHelper,
get_value_func, get_hyperparam_func, get_dim_func,
set_... | code_fim | hard | {
"lang": "python",
"repo": "PeiKaLunCi/sgmcmc_ssm_code",
"path": "/sgmcmc_ssm/variables/garch_var.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> grad['logit_phi'] = (
(prior.hyperparams['alpha_phi'] - 1) / (1 + parameters.phi) -
(prior.hyperparams['beta_phi'] - 1) / (1 - parameters.phi)
) * parameters.phi * (1-parameters.phi)
grad['logit_lambduh'] = (
(prior.hyperparams['alpha_lambdu... | code_fim | hard | {
"lang": "python",
"repo": "PeiKaLunCi/sgmcmc_ssm_code",
"path": "/sgmcmc_ssm/variables/garch_var.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Verifica maior lado e atribui a 'a'
if(x >= y and x >= z):
a = x
b = y
c = z
elif(y >= x and y >= z):
a = y
b = x
c = z
else:
a = z
b = x
c = y
# Verifica se triangulo eh valido
if((a >= b + c) or a <= 0.0 or b <= 0.0 or c <= 0.0):
print("Valores invalidos na entr... | code_fim | medium | {
"lang": "python",
"repo": "matheusconceicao7/mc102z",
"path": "/Lab04/lab04.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Classifica de acordo com medida dos lados
if(a != b and b != c and c != a):
classif_lados = "Triangulo escaleno"
elif(a == b and b == c and c == a):
classif_lados = "Triangulo equilatero"
else:
classif_lados = "Triangulo isosceles"
print(classif_lados)
pr... | code_fim | hard | {
"lang": "python",
"repo": "matheusconceicao7/mc102z",
"path": "/Lab04/lab04.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: matheusconceicao7/mc102z path: /Lab04/lab04.py
# Considere que A é a medida do maior lado do triângulo e B e C são as outras
# medidas. Um teste simples para classificar o triângulo de acordo com as
# medidas do ângulos internos é a seguinte:
#
# Triângulo acutângulo: A² < B² + C²
# Triângulo ret... | code_fim | hard | {
"lang": "python",
"repo": "matheusconceicao7/mc102z",
"path": "/Lab04/lab04.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> data: Dict) -> EsResult:
hits: List[Dict] = data['hits']['hits'] # type: ignore
return cls([EsResultItem.from_dict(hit) for hit in hits])
def to_rank_item(self,
query_id: str) -> RankItem:
scores: Dict[Tuple[str, str], float] = {
... | code_fim | hard | {
"lang": "python",
"repo": "tarohi24/docsim",
"path": "/docsim/elas/search.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tarohi24/docsim path: /docsim/elas/search.py
"""
Module for elasticsaerch
"""
from __future__ import annotations # noqa
from dataclasses import dataclass, field
import logging
from typing import Dict, Generator, Iterable, List, Tuple
from elasticsearch.helpers import scan
from docsim.elas.clie... | code_fim | hard | {
"lang": "python",
"repo": "tarohi24/docsim",
"path": "/docsim/elas/search.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> query_id: str) -> RankItem:
scores: Dict[Tuple[str, str], float] = {
hit.get_id_and_tag(): hit.score
for hit in self.hits}
return RankItem(query_id=query_id, scores=scores)
def get_scores(self) -> Dict[str, float]:
dic: Dict[str, fl... | code_fim | hard | {
"lang": "python",
"repo": "tarohi24/docsim",
"path": "/docsim/elas/search.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: snifter/pymoq path: /tests/request_recorder_test.py
import unittest
from pymoq.stub.verification import RequestRecorder
from utils import HandlerMock
class RequestRecorderTestCase(unittest.TestCase):
def test_count_returns_requests_number(self):
self.__make_count_test(0)
se... | code_fim | hard | {
"lang": "python",
"repo": "snifter/pymoq",
"path": "/tests/request_recorder_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertEqual(1, len(actual))
self.assertEqual('/books/31', actual[0].url)
def test_requests_with_content_returns_filtered_requests(self):
target = RequestRecorder()
target.record(HandlerMock('/books/30', 'POST'))
target.record(HandlerMock('/books/31', 'POS... | code_fim | hard | {
"lang": "python",
"repo": "snifter/pymoq",
"path": "/tests/request_recorder_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> jaw.sweep(0,180)
rothead.sweep(0,180)
neck.sweep(0,180)
def stop():
global leftBicep, leftRotate, leftShoulder, leftOmoplate, jaw, rothead, neck
leftBicep.stop()
leftRotate.stop()
leftShoulder.stop()
leftOmoplate.stop()
jaw.stop()
rothead.stop()
neck.stop()<|fim_prefix|># repo: lec... | code_fim | hard | {
"lang": "python",
"repo": "lecagnois/pyrobotlab",
"path": "/home/GroG/IB2.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lecagnois/pyrobotlab path: /home/GroG/IB2.py
# create a Blender service, we'll call it ... blender
blender = Runtime.start("blender","Blender")
# WORKY
# i01.leftArm.bicep
# i01.leftArm.rotate
# i01.leftArm.shoulder
# i01.head.rothead
# FIXME
# omoplate
# eyeX
# eyeY
# FIXME - make sure a no-... | code_fim | hard | {
"lang": "python",
"repo": "lecagnois/pyrobotlab",
"path": "/home/GroG/IB2.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>class DummySerializer(BaseSerializer):
def __init__(self, **kwargs):
super(DummySerializer, self).__init__(**kwargs)
def serialize(self, value):
return value
def deserialize(self, value):
return value<|fim_prefix|># repo: sasodeixdd/django-hazelcast-cache path: /haz... | code_fim | hard | {
"lang": "python",
"repo": "sasodeixdd/django-hazelcast-cache",
"path": "/hazelcast_cache/serializers.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return json.dumps(value)
def deserialize(self, value):
return json.loads(value)
class MSGPackSerializer(BaseSerializer):
def serialize(self, value):
return msgpack.dumps(value)
def deserialize(self, value):
return msgpack.loads(value, encoding='utf-8')
cl... | code_fim | medium | {
"lang": "python",
"repo": "sasodeixdd/django-hazelcast-cache",
"path": "/hazelcast_cache/serializers.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sasodeixdd/django-hazelcast-cache path: /hazelcast_cache/serializers.py
try:
import cPickle as pickle
except ImportError:
import pickle
import json
try:
import msgpack
except ImportError:
pass
try:
import yaml
except ImportError:
pass
class BaseSerializer(object):
... | code_fim | medium | {
"lang": "python",
"repo": "sasodeixdd/django-hazelcast-cache",
"path": "/hazelcast_cache/serializers.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># function to print the result in a self-explanatory way
def print_corr_and_error(dframe, column1, column2):
phrase = 'The correlation coefficient between columns {} and {} is {:.2g} ± {:.2g}.'
corr, std_corr = corr_and_error(dframe, column1, column2)
print(phrase.format(column1, column2, corr... | code_fim | hard | {
"lang": "python",
"repo": "FlorentCLMichel/learning_data_science",
"path": "/Projects_Jupyter/correlation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: FlorentCLMichel/learning_data_science path: /Projects_Jupyter/correlation.py
'''
Python wrapper for the library correlation.so
'''
import ctypes as ct
import numpy as np
# C library with the bootstrap method
libc = ct.CDLL('../C/correlation.so')
# types of the arguments and return value for th... | code_fim | hard | {
"lang": "python",
"repo": "FlorentCLMichel/learning_data_science",
"path": "/Projects_Jupyter/correlation.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> dframe: pandas dataframe
column1: string
column2: string
'''
# remove nan values and ensure the type is float64
dframe = dframe.loc[-dframe[column1].isnull() & -dframe[column2].isnull(), [column1,column2]].astype('float64')
x = np.array(dframe[column1], dtype='float64')
y = np... | code_fim | hard | {
"lang": "python",
"repo": "FlorentCLMichel/learning_data_science",
"path": "/Projects_Jupyter/correlation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> res_folder_path: str = 'Report'):
"""
Generate the report for given sequence **[best for gene analysis]**
For nucleotide sequence, this generates reports of:
- RSCU
- CAI
- CBI
- ENc
For protein sequence, this generates reports of:
... | code_fim | hard | {
"lang": "python",
"repo": "SouradiptoC/CodonU",
"path": "/CodonU/analyzer/generate_report.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SouradiptoC/CodonU path: /CodonU/analyzer/generate_report.py
from os.path import join, abspath
from CodonU.analyzer import calculate_cai, calculate_enc, calculate_rscu, calculate_cbi, calculate_gravy, \
calculate_aromaticity
from CodonU.file_handler import make_dir
from CodonU.file_handler.in... | code_fim | hard | {
"lang": "python",
"repo": "SouradiptoC/CodonU",
"path": "/CodonU/analyzer/generate_report.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> For protein sequence, this generates reports of:
- GRAVY score
- Aromaticity score
**NOTE** Possible types are
- nuc: For nucleotide sequence
- aa: For protein sequence
:param handle: Handle to the file, or the filename as a string
:param _type: Type of t... | code_fim | hard | {
"lang": "python",
"repo": "SouradiptoC/CodonU",
"path": "/CodonU/analyzer/generate_report.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lzdh/vital_sqi path: /tests/sqi/test_rpeaks_sqi.py
import pytest
import numpy as np
from scipy import signal
import pandas as pd
import warnings
class TestSaveSegmentImage(object):
<|fim_suffix|> pass
class TestGetSplitRRIndex(object):
def test_on_get_split_rr_index(self):
pas... | code_fim | hard | {
"lang": "python",
"repo": "lzdh/vital_sqi",
"path": "/tests/sqi/test_rpeaks_sqi.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> pass
class TestGetSplitRRIndex(object):
def test_on_get_split_rr_index(self):
pass<|fim_prefix|># repo: lzdh/vital_sqi path: /tests/sqi/test_rpeaks_sqi.py
import pytest
import numpy as np
from scipy import signal
import pandas as pd
import warnings
class TestSaveSegmentImage(object):... | code_fim | medium | {
"lang": "python",
"repo": "lzdh/vital_sqi",
"path": "/tests/sqi/test_rpeaks_sqi.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> pass
class TestSplitToSegments(object):
def test_on_split_to_segments(self):
pass
class TestGetSplitTimeIndex(object):
def test_on_get_split_time_index(self):
pass
class TestGetSplitRRIndex(object):
def test_on_get_split_rr_index(self):
pass<|fim_prefix|># repo:... | code_fim | medium | {
"lang": "python",
"repo": "lzdh/vital_sqi",
"path": "/tests/sqi/test_rpeaks_sqi.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wsrpc/wsrpc-tornado path: /wsrpc/websocket/tools.py
#!/usr/bin/env python
# encoding: utf-8
try:
dict.iteritems
except AttributeError:
# Python 3
def itervalues(d):
<|fim_suffix|> def __init__(self, func):
self.func = func
def __str__(self):
return self.func()<... | code_fim | hard | {
"lang": "python",
"repo": "wsrpc/wsrpc-tornado",
"path": "/wsrpc/websocket/tools.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def iteritems(d):
return d.iteritems()
class Lazy(object):
def __init__(self, func):
self.func = func
def __str__(self):
return self.func()<|fim_prefix|># repo: wsrpc/wsrpc-tornado path: /wsrpc/websocket/tools.py
#!/usr/bin/env python
# encoding: utf-8
try:
dict... | code_fim | easy | {
"lang": "python",
"repo": "wsrpc/wsrpc-tornado",
"path": "/wsrpc/websocket/tools.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self):
# super(Children,self).__init__()
super().__init__()
@property
def fun(self):
pass
child = Children()
print(child.name)<|fim_prefix|># repo: wangjinyu124419/beginning-python path: /9_魔法方法/9.5_property.py
class Father():
def __init__(self):
... | code_fim | medium | {
"lang": "python",
"repo": "wangjinyu124419/beginning-python",
"path": "/9_魔法方法/9.5_property.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wangjinyu124419/beginning-python path: /9_魔法方法/9.5_property.py
class Father():
def __init__(self):
self.name = 'father'
<|fim_suffix|> pass
class Children(Parent):
def __init__(self):
# super(Children,self).__init__()
super().__init__()
@property
d... | code_fim | medium | {
"lang": "python",
"repo": "wangjinyu124419/beginning-python",
"path": "/9_魔法方法/9.5_property.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class Children(Parent):
def __init__(self):
# super(Children,self).__init__()
super().__init__()
@property
def fun(self):
pass
child = Children()
print(child.name)<|fim_prefix|># repo: wangjinyu124419/beginning-python path: /9_魔法方法/9.5_property.py
class Father():
... | code_fim | medium | {
"lang": "python",
"repo": "wangjinyu124419/beginning-python",
"path": "/9_魔法方法/9.5_property.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print(results)
assert results == expected_results
@pytest.mark.mpl_image_compare(baseline_dir='files/cf_calculation/', filename='cf_calculation.png')
def test_plot_crystal_field_calculation():
"""
Test of the plot illustrating the potential and charge density going into the calculation
... | code_fim | hard | {
"lang": "python",
"repo": "sailfish009/masci-tools",
"path": "/tests/test_cf_calculation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Test of the plot illustraing the resulting crystal field potential
"""
from masci_tools.tools.cf_calculation import CFCoefficient, plot_crystal_field_potential
coeffs = [
CFCoefficient(l=2,
m=0,
spin_up=(-1143.37690772798 + 0j),
... | code_fim | hard | {
"lang": "python",
"repo": "sailfish009/masci-tools",
"path": "/tests/test_cf_calculation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sailfish009/masci-tools path: /tests/test_cf_calculation.py
# -*- coding: utf-8 -*-
"""
Tests of the crystal field calculations
"""
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import pytest
def test_CFCalculation_txt_files():
"""
Test of the CFCalculation re... | code_fim | hard | {
"lang": "python",
"repo": "sailfish009/masci-tools",
"path": "/tests/test_cf_calculation.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pdeyhim/PerfKitBenchmarker path: /perfkitbenchmarker/providers/gcp/gcp_spanner.py
# Copyright 2017 PerfKitBenchmarker Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obta... | code_fim | hard | {
"lang": "python",
"repo": "pdeyhim/PerfKitBenchmarker",
"path": "/perfkitbenchmarker/providers/gcp/gcp_spanner.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> @classmethod
def FromSpec(cls, spanner_spec: SpannerSpec) -> 'GcpSpannerInstance':
"""Initialize Spanner from the provided spec."""
return cls(
name=spanner_spec.name,
description=spanner_spec.description,
database=spanner_spec.database,
ddl=spanner_spec.ddl,
... | code_fim | hard | {
"lang": "python",
"repo": "pdeyhim/PerfKitBenchmarker",
"path": "/perfkitbenchmarker/providers/gcp/gcp_spanner.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_qtable_str(self):
"""Used to represent the Q table as a readable string."""
output = "[\n"
for row in self.qtable:
output += "\t" + str([round(x,2) for x in row]) + ",\n"
output += "]\n"
return output
def main():
"""Create a maze, solv... | code_fim | hard | {
"lang": "python",
"repo": "KumarUniverse/building-evacuation-q-learning",
"path": "/src/maze-q-learning.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KumarUniverse/building-evacuation-q-learning path: /src/maze-q-learning.py
# By Akash Kumar and Dr. Burns
import copy
import time
import random
class Maze():
"""A pathfinding problem."""
possible_directions = ['N', 'S', 'E', 'W']
dirs_to_moves = {'N':(-1,0), 'S':(1,0), 'E':(0,1), '... | code_fim | hard | {
"lang": "python",
"repo": "KumarUniverse/building-evacuation-q-learning",
"path": "/src/maze-q-learning.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vwallen/hcde539-a2020 path: /e4/code.py
import board
import time
import analogio
import digitalio
import pulseio
from adafruit_motor import servo
from adafruit_circuitplayground import cp
<|fim_suffix|>angle = OPEN_ANGLE
direction = 3
while True:
if cp.switch:
angle = angle + directi... | code_fim | hard | {
"lang": "python",
"repo": "vwallen/hcde539-a2020",
"path": "/e4/code.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>CLOSED_ANGLE = 110
OPEN_ANGLE = 15
angle = OPEN_ANGLE
direction = 3
while True:
if cp.switch:
angle = angle + direction
time.sleep(0.05)
elif cp.button_a:
angle = angle + abs(direction)
elif cp.button_b:
angle = angle - abs(direction)
if angle > CLOSED_ANG... | code_fim | hard | {
"lang": "python",
"repo": "vwallen/hcde539-a2020",
"path": "/e4/code.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>power = digitalio.DigitalInOut(board.A0)
power.direction = digitalio.Direction.OUTPUT
power.value = True
CLOSED_ANGLE = 110
OPEN_ANGLE = 15
angle = OPEN_ANGLE
direction = 3
while True:
if cp.switch:
angle = angle + direction
time.sleep(0.05)
elif cp.button_a:
angle = angl... | code_fim | hard | {
"lang": "python",
"repo": "vwallen/hcde539-a2020",
"path": "/e4/code.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>from googlecloudsdk.api_lib.dataproc import dataproc as dp
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.dataproc import flags
from googlecloudsdk.command_lib.dataproc import workflow_templates
from googlecloudsdk.core import log
import six
DETAILED_HELP = {
'EXAMPLES':
... | code_fim | medium | {
"lang": "python",
"repo": "google-cloud-sdk-unofficial/google-cloud-sdk",
"path": "/lib/surface/dataproc/workflow_templates/set_dag_timeout.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> workflow_template.dagTimeout = six.text_type(args.dag_timeout) + 's'
response = dataproc.client.projects_regions_workflowTemplates.Update(
workflow_template)
log.status.Print('Set a DAG timeout of {0} on {1}.'.format(
workflow_template.dagTimeout, template_ref.Name()))
re... | code_fim | hard | {
"lang": "python",
"repo": "google-cloud-sdk-unofficial/google-cloud-sdk",
"path": "/lib/surface/dataproc/workflow_templates/set_dag_timeout.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: google-cloud-sdk-unofficial/google-cloud-sdk path: /lib/surface/dataproc/workflow_templates/set_dag_timeout.py
# -*- coding: utf-8 -*- #
# Copyright 2020 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in comp... | code_fim | medium | {
"lang": "python",
"repo": "google-cloud-sdk-unofficial/google-cloud-sdk",
"path": "/lib/surface/dataproc/workflow_templates/set_dag_timeout.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: evanascence27/py_prog path: /counting.py
#counting
l1=list()
c=0
for i in range(5):<|fim_suffix|> c+=1
print(l1)
print("count=%d"%(c))<|fim_middle|>
l1.append((input("enter string:")))
if len(l1[i])>=2 and l1[i][0]==l1[i][-1]:
| code_fim | medium | {
"lang": "python",
"repo": "evanascence27/py_prog",
"path": "/counting.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> c+=1
print(l1)
print("count=%d"%(c))<|fim_prefix|># repo: evanascence27/py_prog path: /counting.py
#counting
l1=list()
c=0
for i in range(5):
l1.append((input("enter string:")))
<|fim_middle|> if len(l1[i])>=2 and l1[i][0]==l1[i][-1]:
| code_fim | easy | {
"lang": "python",
"repo": "evanascence27/py_prog",
"path": "/counting.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chrisxue815/leetcode_python path: /problems/test_0458.py
import math
import unittest
import utils
# O(1) time. O(1) space. Math.
class Solution:
<|fim_suffix|> def test(self):
cases = utils.load_test_json(__file__).test_cases
for case in cases:
args = str(case.ar... | code_fim | hard | {
"lang": "python",
"repo": "chrisxue815/leetcode_python",
"path": "/problems/test_0458.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> for case in cases:
args = str(case.args)
actual = Solution().poorPigs(**case.args.__dict__)
self.assertEqual(case.expected, actual, msg=args)
if __name__ == '__main__':
unittest.main()<|fim_prefix|># repo: chrisxue815/leetcode_python path: /problems/test_... | code_fim | medium | {
"lang": "python",
"repo": "chrisxue815/leetcode_python",
"path": "/problems/test_0458.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vrd83/prometheus-pandas path: /prometheus_pandas/util.py
import re
PATTERN = re.compile(r'^([0-9]+)([smhdwy])$')
SUFFIX_MAP = {
's': 1,
'm': 60,
'h': 3600,
'd': 86400,
'w': 604800,
'y': 31536000,
}
<|fim_suffix|> return int(match.group(1)) * SUFFIX_MAP[suffix]<|fim_m... | code_fim | hard | {
"lang": "python",
"repo": "vrd83/prometheus-pandas",
"path": "/prometheus_pandas/util.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return int(match.group(1)) * SUFFIX_MAP[suffix]<|fim_prefix|># repo: vrd83/prometheus-pandas path: /prometheus_pandas/util.py
import re
PATTERN = re.compile(r'^([0-9]+)([smhdwy])$')
SUFFIX_MAP = {
's': 1,
'm': 60,
'h': 3600,
'd': 86400,
'w': 604800,
'y': 31536000,
}
<|fim_m... | code_fim | hard | {
"lang": "python",
"repo": "vrd83/prometheus-pandas",
"path": "/prometheus_pandas/util.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> conn.close()
if not dblist:
conn.close()
_print("no databases to vacuum, aborting")
sys.exit(1)
else:
dblist = args.dblist.split(',')
verbose_print("Flexible Freeze run starting")
verbose_print("list of databases is %s" % (', '.join(dblist)))
# connect to each databas... | code_fim | hard | {
"lang": "python",
"repo": "abishekk92/flexible-freeze",
"path": "/scripts/flexible_freeze.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: abishekk92/flexible-freeze path: /scripts/flexible_freeze.py
'''Flexible Freeze script for PostgreSQL databases
Version 0.5
(c) 2014 PostgreSQL Experts Inc.
Licensed under The PostgreSQL License
This script is designed for doing VACUUM FREEZE or VACUUM ANALYZE runs
on your database during known ... | code_fim | hard | {
"lang": "python",
"repo": "abishekk92/flexible-freeze",
"path": "/scripts/flexible_freeze.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>for db in dblist:
verbose_print("working on database {0}".format(db))
if time_exit:
break
else:
dbcount += 1
conn = dbconnect(db, args.dbuser, args.dbhost, args.dbport, args.dbpass)
cur = conn.cursor()
cur.execute("SET vacuum_cost_delay = {0}".format(args.costdelay)... | code_fim | hard | {
"lang": "python",
"repo": "abishekk92/flexible-freeze",
"path": "/scripts/flexible_freeze.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pythonprogsnscripts/geekttrustproblems path: /src/find_orbit_time.py
'''
Separating code for SRP
'''
class Orbit:
'''
This class calculates the orbit time for the inputs given
'''
def __str__(self):
'''
Introduced to remove the pylint warning:
Too few publi... | code_fim | hard | {
"lang": "python",
"repo": "pythonprogsnscripts/geekttrustproblems",
"path": "/src/find_orbit_time.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i in vehicles[0]:
if traffic_speed <= i['max_speed']:
temp_speed = traffic_speed
else:
temp_speed = i['max_speed']
temp = (orbit_distance + (vehicles[1] * craters_count)) \
* i['cross_crater_time'] + (60 / ... | code_fim | hard | {
"lang": "python",
"repo": "pythonprogsnscripts/geekttrustproblems",
"path": "/src/find_orbit_time.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|># # Second Option
# from functools import reduce
#
#
# def operate(operator, *args):
# return reduce(lambda x, y: eval(f"{x} {operator} {y}"), args) # Note! - don't use eval in real database
print(operate("+", 1, 2, 3))
print(operate("*", 3, 4))<|fim_prefix|># repo: karolinanikolova/SoftUni-Software... | code_fim | hard | {
"lang": "python",
"repo": "karolinanikolova/SoftUni-Software-Engineering",
"path": "/3-Python-Advanced (May 2021)/05-Functions/01_Lab/04-Operate.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: karolinanikolova/SoftUni-Software-Engineering path: /3-Python-Advanced (May 2021)/05-Functions/01_Lab/04-Operate.py
# 4. Operate
# Write a function called operate that receives an operator ("+", "-", "*" or "/") as first argument and multiple
# numbers (integers) as additional arguments (*args). ... | code_fim | medium | {
"lang": "python",
"repo": "karolinanikolova/SoftUni-Software-Engineering",
"path": "/3-Python-Advanced (May 2021)/05-Functions/01_Lab/04-Operate.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if operator == '+':
return sum(args)
elif operator == '-':
return reduce(lambda x, y: x - y, args)
elif operator == '*':
return reduce(lambda x, y: x * y, args)
elif operator == '/':
try:
return reduce(lambda x, y: x / y, args)
except Zer... | code_fim | medium | {
"lang": "python",
"repo": "karolinanikolova/SoftUni-Software-Engineering",
"path": "/3-Python-Advanced (May 2021)/05-Functions/01_Lab/04-Operate.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def getDataPoloniex():
polo = poloniex.Poloniex()
polo.timeout = 2
# chartUSDT_BTC = polo.returnChartData(
# 'USDT_BTC', period=polo.DAY, start=time.time() - polo.DAY * 500, end=time.time())
chartUSDT_BTC = polo.returnChartData(
'USDT_BTC', period=86400, start=time.time() - p... | code_fim | hard | {
"lang": "python",
"repo": "whitecat-22/btc_graph",
"path": "/btc_graph.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: whitecat-22/btc_graph path: /btc_graph.py
# -*- coding: utf-8 -*-
import poloniex
import time
import datetime
import numpy as np
import matplotlib.pyplot as plt
<|fim_suffix|> polo = poloniex.Poloniex()
polo.timeout = 2
# chartUSDT_BTC = polo.returnChartData(
# 'USDT_BTC', peri... | code_fim | hard | {
"lang": "python",
"repo": "whitecat-22/btc_graph",
"path": "/btc_graph.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CharlesAO/dsvo path: /test/zed_sptam.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import math
import argparse
import rospy
import rosbag
import sensor_msgs.msg
import yaml
import numpy as np
from numpy.linalg import inv
import cv2
import tf
# parse camera calibration yaml file
def load_int... | code_fim | hard | {
"lang": "python",
"repo": "CharlesAO/dsvo",
"path": "/test/zed_sptam.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> right_calib_stream = file(args.right_calibration, 'r')
right_calib_data = yaml.load( right_calib_stream )
# parse information from calibration euroc files
height_left, width_left, K_left, D_left = load_intrinsics( left_calib_data )
height_right, width_right, K_right, D_right = load_intrinsics( ... | code_fim | hard | {
"lang": "python",
"repo": "CharlesAO/dsvo",
"path": "/test/zed_sptam.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aadhithya/pytorch-yolo-v1 path: /loss.py
from model import YOLOv1
import torch
import torch.nn as nn
class YOLOv1Loss(nn.Module):
def __init__(self, S=7, B=2, C=20):
"""
__init__ initialize YOLOv1 Loss.
Args:
S (int, optional): split_size. Defaults to 7.
... | code_fim | hard | {
"lang": "python",
"repo": "aadhithya/pytorch-yolo-v1",
"path": "/loss.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> class_loss = self.mse(
torch.flatten(exists_box * predictions[...,:20], end_dim=-2),
torch.flatten(exists_box * target[...,:20], end_dim=-2)
)
# * Total Loss
loss = (
self.l_coord * box_loss
+ object_loss
+ self.... | code_fim | hard | {
"lang": "python",
"repo": "aadhithya/pytorch-yolo-v1",
"path": "/loss.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sujiiith/python-stix path: /stix/incident/history.py
# Copyright (c) 2017, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
from mixbox import fields
# internal
import stix
import stix.bindings.incident as incident_binding
from stix.common.datetimewithprecision ... | code_fim | medium | {
"lang": "python",
"repo": "sujiiith/python-stix",
"path": "/stix/incident/history.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class HistoryItem(stix.Entity):
_namespace = "http://stix.mitre.org/Incident-1"
_binding = incident_binding
_binding_class = incident_binding.HistoryItemType
action_entry = fields.TypedField("Action_Entry", COATaken)
journal_entry = fields.TypedField("Journal_Entry", JournalEntry)
... | code_fim | hard | {
"lang": "python",
"repo": "sujiiith/python-stix",
"path": "/stix/incident/history.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> _namespace = "http://stix.mitre.org/Incident-1"
_binding = incident_binding
_binding_class = incident_binding.HistoryType
history_items = fields.TypedField("History_Item", HistoryItem, multiple=True, key_name="history_items")
@classmethod
def _dict_as_list(cls):
return Fa... | code_fim | hard | {
"lang": "python",
"repo": "sujiiith/python-stix",
"path": "/stix/incident/history.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DLines-Uniun/greykite path: /greykite/tests/algo/changepoint/adalasso/test_changepoint_detector.py
o small
df = pd.DataFrame(
data={
"ts": pd.date_range(start='2020-1-1', end='2020-1-3', freq='D'),
"y": [1, 2, 3]
}
)
model = ChangepointDetector(... | code_fim | hard | {
"lang": "python",
"repo": "DLines-Uniun/greykite",
"path": "/greykite/tests/algo/changepoint/adalasso/test_changepoint_detector.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_get_changepoints_dict():
dl = DataLoader()
df_pt = dl.load_peyton_manning()
changepoints_dict = {
"method": "auto",
"yearly_seasonality_order": 8,
"resample_freq": "D",
"trend_estimator": "ridge",
"adaptive_lasso_initial_estimator": "ridge",
... | code_fim | hard | {
"lang": "python",
"repo": "DLines-Uniun/greykite",
"path": "/greykite/tests/algo/changepoint/adalasso/test_changepoint_detector.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # tests the functionality under cases that were not tested elsewhere
df = pd.DataFrame({
"ts": pd.date_range(start="2020-01-01", end="2020-01-30", freq="D"),
"y": np.random.randn(30)
})
# tests uniform trend change point dictionary
seasonality_changepoints_result = get_... | code_fim | hard | {
"lang": "python",
"repo": "DLines-Uniun/greykite",
"path": "/greykite/tests/algo/changepoint/adalasso/test_changepoint_detector.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mysunk/otdd path: /otdd/pytorch/datasets.py
class DiscreteRotation:
"""Rotate by one of the given angles."""
def __init__(self, angles):
self.angles = angles
def __call__(self, x):
angle = random.choice(self.angles)
return TF.rotate(x, angle)
class Cutout(ob... | code_fim | hard | {
"lang": "python",
"repo": "mysunk/otdd",
"path": "/otdd/pytorch/datasets.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ## load_vectors reindexes embeddings so that they match the vocab's itos indices.
train._vocab.load_vectors(vecname,cache=veccache,max_vectors = 50000)
test._vocab.load_vectors(vecname,cache=veccache, max_vectors = 50000)
## Define Fields for Text and Labels
text_f... | code_fim | hard | {
"lang": "python",
"repo": "mysunk/otdd",
"path": "/otdd/pytorch/datasets.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mysunk/otdd path: /otdd/pytorch/datasets.py
angle = random.choice(self.angles)
return TF.rotate(x, angle)
class Cutout(object):
def __init__(self, length):
self.length = length
def __call__(self, img):
h, w = img.size(1), img.size(2)
mask = np.ones((h, w... | code_fim | hard | {
"lang": "python",
"repo": "mysunk/otdd",
"path": "/otdd/pytorch/datasets.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: furas/python-examples path: /__scraping__/gmu.bncollege.com - selenium/main.py
# author: Bartlomiej "furas" Burek (https://blog.furas.pl)
# date: 2022.03.26
# [python - Selenium Selector is not consistent returning all options sometimes and other times not? - Stack Overflow](https://stackoverflow... | code_fim | hard | {
"lang": "python",
"repo": "furas/python-examples",
"path": "/__scraping__/gmu.bncollege.com - selenium/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> time.sleep(0.5) # time for JavaScript to create `<select>`
element = WebDriverWait(driver, 1).until(
EC.presence_of_element_located((By.XPATH, '(//div[@role="table"]//div[@role="row"])[2]//div[contains(@class, "department")]//input'))
)
element.send_keys(depar... | code_fim | hard | {
"lang": "python",
"repo": "furas/python-examples",
"path": "/__scraping__/gmu.bncollege.com - selenium/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: glennlopez/CS50.HarvardX path: /push.py
#!/usr/bin/env python
import subprocess
import os
# Colors the text
class colors:
PURPL = '\033[95m'
BLUE = '\033[94m'
GREEN = '\033[92m'
YELLOW = '\033[93m'
RED = '\033[91m'
WHITE = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\... | code_fim | hard | {
"lang": "python",
"repo": "glennlopez/CS50.HarvardX",
"path": "/push.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|>
##########################
# COMMANDS TO EXECUTE
##########################
# update setup routine
cmd('wget https://raw.githubusercontent.com/glennlopez/qdGit/stable/setup.sh && rm -f setup.sh.1 && rm -f setup.sh && wget https://raw.githubusercontent.com/glennlopez/qdGit/stable/setup.sh && chmod +x setu... | code_fim | medium | {
"lang": "python",
"repo": "glennlopez/CS50.HarvardX",
"path": "/push.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|># pull routine
cmd('clear')
print colors.BOLD + "Github Update Script" + colors.WHITE
print "---------------------"
comment = raw_input(colors.GREEN + "[!] " + colors.WHITE + "Type your update comment: ")
print
cmd('git add *') #updates changes made inside files
cmd('git add -u') #updated deleted files
... | code_fim | hard | {
"lang": "python",
"repo": "glennlopez/CS50.HarvardX",
"path": "/push.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
for sig in sigs:
i = sig["index"]
s = sig["signatures"]
self.tx.vin[i].scriptSig = CScript([OP_0, x(s[0]), x(s[1]), CScript(x(redeem_script))])
VerifyScript(self.tx.vin[i].scriptSig, CScript(x(redeem_script)).to_p2sh_scriptPubKey(),
... | code_fim | hard | {
"lang": "python",
"repo": "cevap/OpenBazaar-Server",
"path": "/market/transactions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def create_signature(self, privkey, reedem_script):
"""
Exports a raw signature suitable for use in a multisig transaction
"""
seckey = CIoncoinSecret.from_secret_bytes(x(ioncointools.encode_privkey(privkey, "hex")))
signatures = []
for i in range(len(se... | code_fim | hard | {
"lang": "python",
"repo": "cevap/OpenBazaar-Server",
"path": "/market/transactions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cevap/OpenBazaar-Server path: /market/transactions.py
__author__ = 'chris'
import struct
import ioncointools
from ioncoin import SelectParams
from ioncoin.core import x, lx, b2x, b2lx, COutPoint, CMutableTxOut, CMutableTxIn, CMutableTransaction
from ioncoin.core.script import CScript, SIGHASH_AL... | code_fim | hard | {
"lang": "python",
"repo": "cevap/OpenBazaar-Server",
"path": "/market/transactions.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: emirhanai/US-dry-natural-production-prediction-machine-learning.py path: /US-dry-natural-gas-production-machine-learning-polynomial-graph.py
import numpy
import matplotlib.pyplot as plt
import oil_years
import oil_production
import logging
<|fim_suffix|>mymodel = numpy.poly1d(numpy.polyf... | code_fim | hard | {
"lang": "python",
"repo": "emirhanai/US-dry-natural-production-prediction-machine-learning.py",
"path": "/US-dry-natural-gas-production-machine-learning-polynomial-graph.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>myline = numpy.linspace(2002, 2021, 100)
plt.scatter(year, productions)
plt.plot(myline, mymodel(myline))
plt.show()<|fim_prefix|># repo: emirhanai/US-dry-natural-production-prediction-machine-learning.py path: /US-dry-natural-gas-production-machine-learning-polynomial-graph.py
import numpy
imp... | code_fim | medium | {
"lang": "python",
"repo": "emirhanai/US-dry-natural-production-prediction-machine-learning.py",
"path": "/US-dry-natural-gas-production-machine-learning-polynomial-graph.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> _validate_type(argument, expected)
@keyword(types={'argument': set})
def set_(argument, expected=None):
_validate_type(argument, expected)
@keyword(types={'argument': abc.Set})
def set_abc(argument, expected=None):
_validate_type(argument, expected)
@keyword(types={'argument': abc.Mutabl... | code_fim | hard | {
"lang": "python",
"repo": "Lemonlemmings/robotframework",
"path": "/atest/testdata/keywords/type_conversion/KeywordDecorator.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Lemonlemmings/robotframework path: /atest/testdata/keywords/type_conversion/KeywordDecorator.py
try:
from collections import abc
except ImportError:
import collections as abc
from datetime import datetime, date, timedelta
from decimal import Decimal
try:
from enum import Enum
except I... | code_fim | hard | {
"lang": "python",
"repo": "Lemonlemmings/robotframework",
"path": "/atest/testdata/keywords/type_conversion/KeywordDecorator.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> :param float t_d: Non-dimensional time.
:return (numpy.array, float): Returns a tuple, with the first entry \
being the leakage over the length of the fracture. The \
number of entries corresponds to the number_of_segments used for the
semi-analytical solution. The ... | code_fim | hard | {
"lang": "python",
"repo": "dmcdougall/pas",
"path": "/pas/cincoley_meng.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dmcdougall/pas path: /pas/cincoley_meng.py
import numpy as np
from scipy import sparse, diag, integrate, special
import math as math
import scipy.sparse.linalg.dsolve as dsolve
import os
from multiprocessing import Pool
import itertools
def gaver_stehfest(time, lap_func):
""" Performs a nu... | code_fim | hard | {
"lang": "python",
"repo": "dmcdougall/pas",
"path": "/pas/cincoley_meng.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> :param screen:
:return:
"""
pygame.time.Clock().tick(30)
welcome_background = pygame.image.load('resources//pictures//startb.jpg').convert()
screen.blit(welcome_background, (0, 0))
pygame.display.flip()<|fim_prefix|># repo: cendrars59/OPC-DA-PY-P3 path: /views/welcomeView.py
#... | code_fim | medium | {
"lang": "python",
"repo": "cendrars59/OPC-DA-PY-P3",
"path": "/views/welcomeView.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cendrars59/OPC-DA-PY-P3 path: /views/welcomeView.py
# -*- coding: Utf-8 -*
import pygame
<|fim_suffix|> :param screen:
:return:
"""
pygame.time.Clock().tick(30)
welcome_background = pygame.image.load('resources//pictures//startb.jpg').convert()
screen.blit(welcome_backgro... | code_fim | medium | {
"lang": "python",
"repo": "cendrars59/OPC-DA-PY-P3",
"path": "/views/welcomeView.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def _ats2pypre_intrange_loop1_33(env0, env1, arg0, arg1, arg2):
apy0 = None
apy1 = None
apy2 = None
tmpret55 = None
tmp56 = None
a2rg0 = None
a2rg1 = None
a2rg2 = None
a2rg3 = None
a2rg4 = None
a2py0 = None
a2py1 = None
a2py2 = None
a2py3 = None
a2py4 = None
tmpret57 = Non... | code_fim | hard | {
"lang": "python",
"repo": "githwxi/ATS-Postiats-frozen",
"path": "/projects/SMALL/openshift-flask-2016-07-20/libatscc2py3/ats2pypre_intrange_dats.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, parent, backends: List[ICodeRepository], **kwargs):
super().__init__(parent, service=CodeService(backends=backends), **kwargs)
def create(self, *args, clz, handlers=None, **kwargs):
if handlers is None:
handlers = []
return ValidateableFactor... | code_fim | medium | {
"lang": "python",
"repo": "padre-lab-eu/pypadre",
"path": "/pypadre/pod/app/code_app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: padre-lab-eu/pypadre path: /pypadre/pod/app/code_app.py
from typing import List
from pypadre.core.validation.validation import ValidateableFactory
from pypadre.pod.app.base_app import BaseChildApp
from pypadre.pod.repository.i_repository import ICodeRepository
from pypadre.pod.service.code_servi... | code_fim | hard | {
"lang": "python",
"repo": "padre-lab-eu/pypadre",
"path": "/pypadre/pod/app/code_app.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rendy026/reverse-enginnering path: /GTOOL/1.py
0Z\x00\x00e\x00\x00j\x01\x00d\x02\x00\x83\x01\x00d\x01\x00\x04Ud\x01\x00S(\x03\x00\x00\x00i\xff\xff\xff\xffNsM\xb1\x00\x00c\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00@\x00\x00\x00s!\x00\x00\x00d\x00\x00d\x01\x00l\x00\x00Z\x00\x00e\x00\x00j\x01\x... | code_fim | hard | {
"lang": "python",
"repo": "rendy026/reverse-enginnering",
"path": "/GTOOL/1.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rendy026/reverse-enginnering path: /GTOOL/1.py
00\x00\x00i\xff\xff\xff\xffNs\xd4\x7f\x00\x00c\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00@\x00\x00\x00s!\x00\x00\x00d\x00\x00d\x01\x00l\x00\x00Z\x00\x00e\x00\x00j\x01\x00d\x02\x00\x83\x01\x00d\x01\x00\x04Ud\x01\x00S(\x03\x00\x00\x00i\xff\xff\xff... | code_fim | hard | {
"lang": "python",
"repo": "rendy026/reverse-enginnering",
"path": "/GTOOL/1.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>01\x00d\x02\x00\x83\x01\x00d\x01\x00\x04Ud\x01\x00S(\x03\x00\x00\x00i\xff\xff\xff\xffNs\x8e\x1a\x00\x00c\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00@\x00\x00\x00s!\x00\x00\x00d\x00\x00d\x01\x00l\x00\x00Z\x00\x00e\x00\x00j\x01\x00d\x02\x00\x83\x01\x00d\x01\x00\x04Ud\x01\x00S(\x03\x00\x00\x00i\xff\xff\x... | code_fim | hard | {
"lang": "python",
"repo": "rendy026/reverse-enginnering",
"path": "/GTOOL/1.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.