uid
stringlengths
24
24
split
stringclasses
1 value
category
stringclasses
2 values
content
stringlengths
5
482k
signature
stringlengths
1
14k
suffix
stringlengths
1
482k
prefix
stringlengths
9
14k
prefix_token_count
int64
3
5.01k
prefix_token_budget
int64
64
256
element_token_count
int64
1
292k
signature_token_count
int64
1
5.01k
prefix_context_token_count
int64
0
255
repo
stringlengths
7
112
path
stringlengths
4
208
language
stringclasses
1 value
name
stringlengths
1
218
qualname
stringlengths
1
218
start_line
int64
1
26.7k
end_line
int64
1
26.7k
signature_start_line
int64
1
26.7k
signature_end_line
int64
1
26.7k
source_hash
stringlengths
40
40
source_dataset
stringclasses
1 value
source_split
stringclasses
1 value
43c12753bc908367ee73aa01
train
function
def new_single_star(mass, pos, vel): single_star = Particle() single_star.mass = mass single_star.position = pos single_star.velocity = vel single_star.radius = 1.0 | units.RSun return single_star
def new_single_star(mass, pos, vel):
single_star = Particle() single_star.mass = mass single_star.position = pos single_star.velocity = vel single_star.radius = 1.0 | units.RSun return single_star
.MSun) pot_halo = self.halo_potential(pos, Mc=5.0E+10 | units.MSun, Rc=6.0 | units.kpc) return pot_disk + pot_bulge + pot_halo def new_single_star(mass, pos, vel):
64
64
57
11
52
joshuawall/amuse
examples/simple/orbit_in_potential.py
Python
new_single_star
new_single_star
80
86
80
80
f0e81b7455c3ea89c9850d1d0d8ff68665b81f4f
bigcode/the-stack
train
bdf18706aec04721f86b1813
train
function
def new_option_parser(): result = OptionParser() result.add_option("-t", dest="t_end", type="float", default=250, unit=units.Myr, help="end time [%unit]") result.add_option("-d", dest="dt_diag", type="float", default=10, unit=units.Myr, help="diagnostic timestep [...
def new_option_parser():
result = OptionParser() result.add_option("-t", dest="t_end", type="float", default=250, unit=units.Myr, help="end time [%unit]") result.add_option("-d", dest="dt_diag", type="float", default=10, unit=units.Myr, help="diagnostic timestep [%unit]") result.add_o...
= [] | size_unit while time < t_end: evolve_particle_in_potential(single_star, potential, dt_diag) time += dt_diag print( "time=", time, single_star.position.length().as_quantity_in(units.AU)) x.append(single_star.x) y.append(single_star.y) ...
118
118
396
5
113
joshuawall/amuse
examples/simple/orbit_in_potential.py
Python
new_option_parser
new_option_parser
124
149
124
124
6e40e224f1cf094800c564be87b239a842f069bc
bigcode/the-stack
train
d87f8b01f4296805020875ea
train
function
def plot_orbit(x, y): pyplot.figure(figsize=(10, 10)) plot(x, y) pyplot.show()
def plot_orbit(x, y):
pyplot.figure(figsize=(10, 10)) plot(x, y) pyplot.show()
+= dt_diag print( "time=", time, single_star.position.length().as_quantity_in(units.AU)) x.append(single_star.x) y.append(single_star.y) z.append(single_star.y) return x, y, z def plot_orbit(x, y):
64
64
28
8
55
joshuawall/amuse
examples/simple/orbit_in_potential.py
Python
plot_orbit
plot_orbit
118
121
118
118
15d20e3aaf735add5132010bee80a4545294d9c4
bigcode/the-stack
train
d4a2ec6482917d6c3c8e07d4
train
class
class MilkyWay_galaxy(object): def __init__(self, potential="point_particle", M=1.6e10 | units.MSun): print("pot=", potential) if potential.find("Milky") >= 0: print("Milky Way Potential") self.potential = self.Milky_Way_potential else: self.potential = se...
class MilkyWay_galaxy(object):
def __init__(self, potential="point_particle", M=1.6e10 | units.MSun): print("pot=", potential) if potential.find("Milky") >= 0: print("Milky Way Potential") self.potential = self.Milky_Way_potential else: self.potential = self.point_particle_potential ...
""" Integrates a stellar orbit in the galactic potential This example illustrates the use of a simple external potential and simple integrator, no amuse community code is used. """ # import numpy from amuse.units.optparse import OptionParser from math import atan from math import log from amuse.units import units, co...
108
204
680
9
98
joshuawall/amuse
examples/simple/orbit_in_potential.py
Python
MilkyWay_galaxy
MilkyWay_galaxy
20
77
20
20
6a094df896ebf36b45d4b43b42832cb22b8c53b4
bigcode/the-stack
train
4fd19378e987966a7f94d345
train
function
def frame_args(duration): return { "frame": {"duration": duration, "redraw": True}, "mode": "immediate", "fromcurrent": True, "transition": {"duration": duration, "easing": "linear"}, }
def frame_args(duration):
return { "frame": {"duration": duration, "redraw": True}, "mode": "immediate", "fromcurrent": True, "transition": {"duration": duration, "easing": "linear"}, }
(**constants.FIG_LAYOUT_DEFAULTS) return fig df = df[ (df.event_name == race) & (df.gender == gender) ].copy() color = constants.GENDER_COLORS[gender] return figgen(df, color, **kwargs) def frame_args(duration):
64
64
56
5
59
manorman5/changing-times
utils/utils.py
Python
frame_args
frame_args
37
43
37
37
518c9f9871af6ac7daac59245d9d6201f55256de
bigcode/the-stack
train
ca7d78f34dabae6a776976cf
train
function
def get_filename(typep, contents, modifier,race_group, speed): def parameter_test(param, paramtype): options = constants.DATAFILES_CONFIG[paramtype] options_str = ", ".join(options) assert param in constants.DATAFILES_CONFIG[paramtype], f"`{paramtype}` parameter is invalid. {param} is not in...
def get_filename(typep, contents, modifier,race_group, speed):
def parameter_test(param, paramtype): options = constants.DATAFILES_CONFIG[paramtype] options_str = ", ".join(options) assert param in constants.DATAFILES_CONFIG[paramtype], f"`{paramtype}` parameter is invalid. {param} is not in {options_str}" parameter_test(typep, "type"), paramete...
import constants def get_filename(typep, contents, modifier,race_group, speed):
18
64
189
15
2
manorman5/changing-times
utils/utils.py
Python
get_filename
get_filename
3
23
3
3
76eb6f9ab06710dd1a9d8fbdee4f0305d3627d48
bigcode/the-stack
train
027c3d80d2428fe023257001
train
function
def create_fig_by_gender_and_by_race(df, race, gender, figgen, **kwargs): if (not race) or (not gender): fig = go.Figure(data=[], layout={}, frames=[]) fig.update_layout(**constants.FIG_LAYOUT_DEFAULTS) return fig df = df[ (df.event_name == race) & (df.gender == gender) ...
def create_fig_by_gender_and_by_race(df, race, gender, figgen, **kwargs):
if (not race) or (not gender): fig = go.Figure(data=[], layout={}, frames=[]) fig.update_layout(**constants.FIG_LAYOUT_DEFAULTS) return fig df = df[ (df.event_name == race) & (df.gender == gender) ].copy() color = constants.GENDER_COLORS[gender] return figgen(...
}" if modifier: modifier = f"{modifier}_" if contents: contents = f"{contents}_" return f"{contents}{modifier}{typep}{race_group}{speed}.csv" def create_fig_by_gender_and_by_race(df, race, gender, figgen, **kwargs):
64
64
108
21
43
manorman5/changing-times
utils/utils.py
Python
create_fig_by_gender_and_by_race
create_fig_by_gender_and_by_race
25
35
25
25
9313ba2ddbf6b2a4a430960412d7e3b579b5fe7f
bigcode/the-stack
train
aa40e5ff4a92b56d366841db
train
function
def download_all(): subprocess.check_call("python -m spacy download en".split()) subprocess.check_call("bash install_coref.sh".split())
def download_all():
subprocess.check_call("python -m spacy download en".split()) subprocess.check_call("bash install_coref.sh".split())
import subprocess def download_all():
7
64
32
4
2
sally14/easycoref
src/easycoref/__init__.py
Python
download_all
download_all
4
6
4
4
44deac8bed6c174c8c7bb2ebbacf7a8bb79e65f6
bigcode/the-stack
train
2426a17e7202976bdb3c2091
train
function
def test_fixture(testdir): testdir.makepyfile( """ from click.testing import CliRunner def test_fixture(cli_runner): assert isinstance(cli_runner, CliRunner) """ ) result = testdir.runpytest("--verbose") result.stdout.fnmatch_lines("test_fixture.py::test_fixture PASSED*")
def test_fixture(testdir):
testdir.makepyfile( """ from click.testing import CliRunner def test_fixture(cli_runner): assert isinstance(cli_runner, CliRunner) """ ) result = testdir.runpytest("--verbose") result.stdout.fnmatch_lines("test_fixture.py::test_fixture PASSED*")
def test_fixture(testdir):
6
64
70
6
0
auvipy/pytest-click
test/fixtures/test_cli_runner.py
Python
test_fixture
test_fixture
1
11
1
1
e560738c176c7ea79dc3d7cd46b59619b859a51d
bigcode/the-stack
train
6853d0f7a8eeb8954d8f93d9
train
function
def test_runner_setup(testdir): testdir.makepyfile( """ import pytest @pytest.mark.runner_setup(charset='cp1251', env={'test': 1}, echo_stdin=True) def test_runner_setup(cli_runner): assert cli_runner.charset == 'cp1251' assert cli_runner.env == {'test': 1} assert cli_ru...
def test_runner_setup(testdir):
testdir.makepyfile( """ import pytest @pytest.mark.runner_setup(charset='cp1251', env={'test': 1}, echo_stdin=True) def test_runner_setup(cli_runner): assert cli_runner.charset == 'cp1251' assert cli_runner.env == {'test': 1} assert cli_runner.echo_stdin """ ) ...
['Peter']) assert result.exit_code == 0 assert result.output == 'Hello Peter!\\n' """ ) result = testdir.runpytest("--verbose") result.stdout.fnmatch_lines("test_real_invocation.py::test_fixture PASSED*") def test_runner_setup(testdir):
64
64
117
7
57
auvipy/pytest-click
test/fixtures/test_cli_runner.py
Python
test_runner_setup
test_runner_setup
35
48
35
35
c3cfb397dac574918fffaf0ce92eba35eeff77fb
bigcode/the-stack
train
9f8032e71a9f1e149ba87752
train
function
def test_real_invocation(testdir): testdir.makepyfile( """ import click def test_fixture(cli_runner): @click.command() @click.argument('name') def hello(name): click.echo('Hello %s!' % name) result = cli_runner.invoke(hello, ['Peter']) assert re...
def test_real_invocation(testdir):
testdir.makepyfile( """ import click def test_fixture(cli_runner): @click.command() @click.argument('name') def hello(name): click.echo('Hello %s!' % name) result = cli_runner.invoke(hello, ['Peter']) assert result.exit_code == 0 assert ...
""" from click.testing import CliRunner def test_fixture(cli_runner): assert isinstance(cli_runner, CliRunner) """ ) result = testdir.runpytest("--verbose") result.stdout.fnmatch_lines("test_fixture.py::test_fixture PASSED*") def test_real_invocation(testdir):
64
64
122
8
56
auvipy/pytest-click
test/fixtures/test_cli_runner.py
Python
test_real_invocation
test_real_invocation
14
32
14
14
88295fc72bb81e260f270c096cb802a2a90d53df
bigcode/the-stack
train
04d18fafb21ead9daa2b76d9
train
function
def test_docstring(testdir): result = testdir.runpytest("--fixtures") assert ( " Instance of `click.testing.CliRunner`. Can be " "configured with `@pytest.mark.runner_setup`." in result.stdout.lines )
def test_docstring(testdir):
result = testdir.runpytest("--fixtures") assert ( " Instance of `click.testing.CliRunner`. Can be " "configured with `@pytest.mark.runner_setup`." in result.stdout.lines )
cp1251' assert cli_runner.env == {'test': 1} assert cli_runner.echo_stdin """ ) result = testdir.runpytest("--verbose") result.stdout.fnmatch_lines("test_runner_setup.py::test_runner_setup PASSED*") def test_docstring(testdir):
64
64
54
7
57
auvipy/pytest-click
test/fixtures/test_cli_runner.py
Python
test_docstring
test_docstring
51
56
51
51
9230c666b77dd4d795b144f173fbaea3f511803d
bigcode/the-stack
train
0c1fcbfcd0467437c4ceaf18
train
class
class _multifile(object): def __init__(self, *fileobjs): for f in fileobjs: if not util.safehasattr(f, 'length'): raise ValueError( '_multifile only supports file objects that ' 'have a length but this one does not:', type(f), f) se...
class _multifile(object):
def __init__(self, *fileobjs): for f in fileobjs: if not util.safehasattr(f, 'length'): raise ValueError( '_multifile only supports file objects that ' 'have a length but this one does not:', type(f), f) self._fileobjs = fileobjs ...
' 'if the error persists, consider contacting the ' 'network or server operator')) except httplib.HTTPException as e: raise error.PeerTransportError( _('HTTP request error (%s)') % e, hint=_('this ...
95
95
319
7
87
EnjoyLifeFund/Debian_py36_packages
mercurial/httppeer.py
Python
_multifile
_multifile
98
135
98
98
cc5955d4dff0a98408374fbebc221cac02f0be92
bigcode/the-stack
train
ae8e631609c8d59fa45ee1e9
train
class
class httpspeer(httppeer): def __init__(self, ui, path): if not url.has_https: raise error.Abort(_('Python support for SSL and HTTPS ' 'is not installed')) httppeer.__init__(self, ui, path)
class httpspeer(httppeer):
def __init__(self, ui, path): if not url.has_https: raise error.Abort(_('Python support for SSL and HTTPS ' 'is not installed')) httppeer.__init__(self, ui, path)
() if fh is not None: fh.close() os.unlink(filename) def _callcompressable(self, cmd, **args): return self._callstream(cmd, _compressible=True, **args) def _abort(self, exception): raise exception class httpspeer(httppeer):
64
64
55
6
57
EnjoyLifeFund/Debian_py36_packages
mercurial/httppeer.py
Python
httpspeer
httpspeer
443
448
443
443
d1501a80b5e80ba4d5505aca68bad7d814ec378c
bigcode/the-stack
train
4b1b825a6f80357f22f6a8d1
train
function
def instance(ui, path, create): if create: raise error.Abort(_('cannot create new http repository')) try: if path.startswith('https:'): inst = httpspeer(ui, path) else: inst = httppeer(ui, path) try: # Try to do useful work when checking compat...
def instance(ui, path, create):
if create: raise error.Abort(_('cannot create new http repository')) try: if path.startswith('https:'): inst = httpspeer(ui, path) else: inst = httppeer(ui, path) try: # Try to do useful work when checking compatibility. # Usually s...
class httpspeer(httppeer): def __init__(self, ui, path): if not url.has_https: raise error.Abort(_('Python support for SSL and HTTPS ' 'is not installed')) httppeer.__init__(self, ui, path) def instance(ui, path, create):
64
64
193
8
56
EnjoyLifeFund/Debian_py36_packages
mercurial/httppeer.py
Python
instance
instance
450
472
450
450
c49fe9310644126a04fc17a0ad06cee709c6b74a
bigcode/the-stack
train
a192fae406cafc97e159ad90
train
class
class httppeer(wireproto.wirepeer): def __init__(self, ui, path): self._path = path self._caps = None self._urlopener = None self._requestbuilder = None u = util.url(path) if u.query or u.fragment: raise error.Abort(_('unsupported URL component: "%s"') % ...
class httppeer(wireproto.wirepeer):
def __init__(self, ui, path): self._path = path self._caps = None self._urlopener = None self._requestbuilder = None u = util.url(path) if u.query or u.fragment: raise error.Abort(_('unsupported URL component: "%s"') % (u.query...
objs = fileobjs self._index = 0 @property def length(self): return sum(f.length for f in self._fileobjs) def read(self, amt=None): if amt <= 0: return ''.join(f.read() for f in self._fileobjs) parts = [] while amt and self._index < len(self._fileobjs): ...
256
256
2,578
10
245
EnjoyLifeFund/Debian_py36_packages
mercurial/httppeer.py
Python
httppeer
httppeer
137
441
137
137
9b3c24b6574550551416aaf5ce84b74a4695c9ad
bigcode/the-stack
train
edb0df39f79a919f10014303
train
function
def _wraphttpresponse(resp): """Wrap an HTTPResponse with common error handlers. This ensures that any I/O from any consumer raises the appropriate error and messaging. """ origread = resp.read class readerproxy(resp.__class__): def read(self, size=None): try: ...
def _wraphttpresponse(resp):
"""Wrap an HTTPResponse with common error handlers. This ensures that any I/O from any consumer raises the appropriate error and messaging. """ origread = resp.read class readerproxy(resp.__class__): def read(self, size=None): try: return origread(size) ...
limit - len(fmt % r'000') - len(': \r\n') result = [] n = 0 for i in xrange(0, len(value), valuelen): n += 1 result.append((fmt % str(n), pycompat.strurl(value[i:i + valuelen]))) return result def _wraphttpresponse(resp):
78
78
262
7
70
EnjoyLifeFund/Debian_py36_packages
mercurial/httppeer.py
Python
_wraphttpresponse
_wraphttpresponse
63
96
63
63
f0191bc2df1932ccf679b417478f27d433046c48
bigcode/the-stack
train
b88f0d5c6344a5a1b1fca8c0
train
function
def encodevalueinheaders(value, header, limit): """Encode a string value into multiple HTTP headers. ``value`` will be encoded into 1 or more HTTP headers with the names ``header-<N>`` where ``<N>`` is an integer starting at 1. Each header name + value will be at most ``limit`` bytes long. Returns...
def encodevalueinheaders(value, header, limit):
"""Encode a string value into multiple HTTP headers. ``value`` will be encoded into 1 or more HTTP headers with the names ``header-<N>`` where ``<N>`` is an integer starting at 1. Each header name + value will be at most ``limit`` bytes long. Returns an iterable of 2-tuples consisting of header na...
import struct import tempfile from .i18n import _ from .node import nullid from . import ( bundle2, error, httpconnection, pycompat, statichttprepo, url, util, wireproto, ) httplib = util.httplib urlerr = util.urlerr urlreq = util.urlreq def encodevalueinheaders(value, header, limit):...
90
90
302
11
78
EnjoyLifeFund/Debian_py36_packages
mercurial/httppeer.py
Python
encodevalueinheaders
encodevalueinheaders
35
61
35
35
0398c32b9974550f6663e6cd56126a4a02e05160
bigcode/the-stack
train
2a4a1220110bf7f313462c13
train
function
def main(): argument_specs = dict( state=dict(default='present', choices=['absent', 'present']), admin_auth_configuration=dict(type='dict',), dns_configuration=dict(type='dict',), dns_virtualservice_refs=dict(type='list',), docker_mode=dict(type='bool',), ...
def main():
argument_specs = dict( state=dict(default='present', choices=['absent', 'present']), admin_auth_configuration=dict(type='dict',), dns_configuration=dict(type='dict',), dns_virtualservice_refs=dict(type='list',), docker_mode=dict(type='bool',), email...
: sample_systemconfiguration """ RETURN = ''' obj: description: SystemConfiguration (api/systemconfiguration) object returned: success, changed type: dict ''' from ansible.module_utils.basic import AnsibleModule try: from ansible.module_utils.avi import ( avi_common_argument_spec, HAS_AVI, av...
88
88
295
3
84
EnjoyLifeFund/py36pkgs
ansible/modules/network/avi/avi_systemconfiguration.py
Python
main
main
137
167
137
137
f601e31a6e6b88006b38375193701bf93615f19f
bigcode/the-stack
train
841ddfa4fecebf71165dfe22
train
class
class FramesTestFunctions(unittest.TestCase): def testVector2(self,v): self.assertEqual(2*v-v,v) self.assertEqual(v*2-v,v) self.assertEqual(v+v+v-2*v,v) v2=Vector(v) self.assertEqual(v,v2) v2+=v self.assertEqual(2*v,v2) v2-=v self.assertEqual(...
class FramesTestFunctions(unittest.TestCase):
def testVector2(self,v): self.assertEqual(2*v-v,v) self.assertEqual(v*2-v,v) self.assertEqual(v+v+v-2*v,v) v2=Vector(v) self.assertEqual(v,v2) v2+=v self.assertEqual(2*v,v2) v2-=v self.assertEqual(v,v2) v2.ReverseSign() self.ass...
its at mech dot kuleuven dot be> # Version: 1.0 # Author: Ruben Smits <ruben dot smits at mech dot kuleuven dot be> # Maintainer: Ruben Smits <ruben dot smits at mech dot kuleuven dot be> # URL: http://www.orocos.org/kdl # This library is free software; you can redistribute it and/or # modify it under the terms of th...
256
256
1,594
8
248
matchRos/simulation_multirobots
src/orocos_kinematics_dynamics/python_orocos_kdl/tests/framestest.py
Python
FramesTestFunctions
FramesTestFunctions
27
179
27
28
a2e445e2850c75ef894748af3dfaada14cbcc061
bigcode/the-stack
train
a9651c0a2d8f49bdb28dd2f4
train
function
def suite(): suite=unittest.TestSuite() suite.addTest(FramesTestFunctions('testVector')) suite.addTest(FramesTestFunctions('testTwist')) suite.addTest(FramesTestFunctions('testWrench')) suite.addTest(FramesTestFunctions('testRotation')) suite.addTest(FramesTestFunctions('testFrame')) suite.a...
def suite():
suite=unittest.TestSuite() suite.addTest(FramesTestFunctions('testVector')) suite.addTest(FramesTestFunctions('testTwist')) suite.addTest(FramesTestFunctions('testWrench')) suite.addTest(FramesTestFunctions('testRotation')) suite.addTest(FramesTestFunctions('testFrame')) suite.addTest(Frames...
['v']) f = open('/tmp/pickle_test', 'w') pickle.dump(data, f) f.close() f = open('/tmp/pickle_test', 'r') data1 = pickle.load(f) f.close() self.assertEqual(data, data1) def suite():
64
64
90
3
61
matchRos/simulation_multirobots
src/orocos_kinematics_dynamics/python_orocos_kdl/tests/framestest.py
Python
suite
suite
182
190
182
182
dce9c9b5a99e3e58cd62bc227872fd475b12e542
bigcode/the-stack
train
3e1d8e2c1806ca4d93f85d47
train
class
class ComponentInstaller(ResourceAdapterManagementComponentInstaller): name = 'management' version = '6.3.0' os_list = [ {'family': 'centos', 'version': '7', 'arch': 'x86_64'}, {'family': 'oracle', 'version': '7', 'arch': 'x86_64'}, {'family': 'rhel', 'version': '7', 'arch': 'x86_64'...
class ComponentInstaller(ResourceAdapterManagementComponentInstaller):
name = 'management' version = '6.3.0' os_list = [ {'family': 'centos', 'version': '7', 'arch': 'x86_64'}, {'family': 'oracle', 'version': '7', 'arch': 'x86_64'}, {'family': 'rhel', 'version': '7', 'arch': 'x86_64'}, ]
AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from tortuga.kit.mixins.resource_adapter import \ ResourceAdapterManagementComponentInstaller class ComponentInstaller(Reso...
64
64
100
9
54
dtougas/tortuga-kit-oraclecloudadapter
tortuga_kits/oraclecloudadapter_6_3_0/components/management/component.py
Python
ComponentInstaller
ComponentInstaller
19
26
19
19
2fabf093ba45241e5d4cfef4297add3df06f80bb
bigcode/the-stack
train
1a2c8ae2c7f1adc2f5fb8805
train
class
class TupleTransTest(unittest.TestCase): def test(self): lx = TestLexer() toks = list(lx.get_tokens_unprocessed('abcde')) self.assertEquals(toks, [(0, Text.Root, 'a'), (1, Text.Rag, 'b'), (2, Text.Rag, 'c'), (3, Text.Beer, 'd'), (4, Text.Root, 'e')])
class TupleTransTest(unittest.TestCase):
def test(self): lx = TestLexer() toks = list(lx.get_tokens_unprocessed('abcde')) self.assertEquals(toks, [(0, Text.Root, 'a'), (1, Text.Rag, 'b'), (2, Text.Rag, 'c'), (3, Text.Beer, 'd'), (4, Text.Root, 'e')])
'beer': [ ('d', Text.Beer, ('#pop', '#pop')), ], 'rag': [ ('b', Text.Rag, '#push'), ('c', Text.Rag, ('#pop', 'beer')), ], } class TupleTransTest(unittest.TestCase):
64
64
91
8
56
google-code-export/django-hotclub
libs/external_libs/Pygments-0.11.1/tests/test_regexlexer.py
Python
TupleTransTest
TupleTransTest
31
37
31
31
7bd6d76c12ebae780ea2cd336ea7f99039235d3d
bigcode/the-stack
train
67ee5debcec72f4bcea0df68
train
class
class TestLexer(RegexLexer): """Test tuple state transitions including #pop.""" tokens = { 'root': [ ('a', Text.Root, 'rag'), ('e', Text.Root), ], 'beer': [ ('d', Text.Beer, ('#pop', '#pop')), ], 'rag': [ ('b', Text.Rag, '#p...
class TestLexer(RegexLexer):
"""Test tuple state transitions including #pop.""" tokens = { 'root': [ ('a', Text.Root, 'rag'), ('e', Text.Root), ], 'beer': [ ('d', Text.Beer, ('#pop', '#pop')), ], 'rag': [ ('b', Text.Rag, '#push'), ('c', Text...
Pygments regex lexer tests ~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: 2007 by Georg Brandl. :license: BSD, see LICENSE for more details. """ import unittest from pygments.token import Text from pygments.lexer import RegexLexer class TestLexer(RegexLexer):
64
64
102
7
56
google-code-export/django-hotclub
libs/external_libs/Pygments-0.11.1/tests/test_regexlexer.py
Python
TestLexer
TestLexer
15
29
15
15
93cae4e70792323ee0e4b71ff900d787381981cc
bigcode/the-stack
train
363b97fb5c5f13725b4538e4
train
function
def iv_plot(df, var_name=None, suffix='_dev'): """Returns an IV plot for a specified variable""" p_suffix = suffix.replace('_','').upper() sub_df = df if var_name is None else df.loc[df.var_name==var_name, ['var_cuts_string'+suffix, 'ln_odds'+suffix, 'resp_rate'+suffix, 'iv'+suffix]] sub_df['resp_rate_t...
def iv_plot(df, var_name=None, suffix='_dev'):
"""Returns an IV plot for a specified variable""" p_suffix = suffix.replace('_','').upper() sub_df = df if var_name is None else df.loc[df.var_name==var_name, ['var_cuts_string'+suffix, 'ln_odds'+suffix, 'resp_rate'+suffix, 'iv'+suffix]] sub_df['resp_rate_trend'+suffix] = _trend(sub_df['resp_rate'+suffi...
1,10), np.linspace(0,1,10)) ax.set(xlabel='False Positive Rate', ylabel='True Positive Rate', title='Gains Plot / Lift Chart') return f def _trend(Y): y = np.array(Y) x = np.arange(0, len(y)) z = np.polyfit(x,y,1) trend_line = z[1] + z[0]*(x+1) return trend_line def iv_plot(df, var_name=Non...
111
111
371
13
97
avinashknmr/ml-utils
ml_utils/draw.py
Python
iv_plot
iv_plot
23
40
23
23
512d42de44ae232ef48da1c45027efcf3600a649
bigcode/the-stack
train
b9930100d1e52416e42bddfb
train
function
def _trend(Y): y = np.array(Y) x = np.arange(0, len(y)) z = np.polyfit(x,y,1) trend_line = z[1] + z[0]*(x+1) return trend_line
def _trend(Y):
y = np.array(Y) x = np.arange(0, len(y)) z = np.polyfit(x,y,1) trend_line = z[1] + z[0]*(x+1) return trend_line
.lineplot(fpr, tpr) sns.lineplot(np.linspace(0,1,10), np.linspace(0,1,10)) ax.set(xlabel='False Positive Rate', ylabel='True Positive Rate', title='Gains Plot / Lift Chart') return f def _trend(Y):
64
64
56
5
58
avinashknmr/ml-utils
ml_utils/draw.py
Python
_trend
_trend
16
21
16
16
1fde3fa5c8ad70908a73035fc2c54c281a3047fd
bigcode/the-stack
train
1bcc4a6d2decdc7bb7e9dd48
train
function
def gain_plot(y_actual, y_pred): """Returns a lift chart or gains plot against True Positive Rate vs False Positive Rate""" f, ax = plt.subplots() fpr, tpr, _ = roc_curve(y_actual, y_pred) sns.lineplot(fpr, tpr) sns.lineplot(np.linspace(0,1,10), np.linspace(0,1,10)) ax.set(xlabel='False Positive...
def gain_plot(y_actual, y_pred):
"""Returns a lift chart or gains plot against True Positive Rate vs False Positive Rate""" f, ax = plt.subplots() fpr, tpr, _ = roc_curve(y_actual, y_pred) sns.lineplot(fpr, tpr) sns.lineplot(np.linspace(0,1,10), np.linspace(0,1,10)) ax.set(xlabel='False Positive Rate', ylabel='True Positive Rat...
import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt from sklearn.metrics import roc_curve def gain_plot(y_actual, y_pred):
38
64
113
9
28
avinashknmr/ml-utils
ml_utils/draw.py
Python
gain_plot
gain_plot
7
14
7
7
35c74d025a8adea87efe8f8c3da896cadc0e67cf
bigcode/the-stack
train
2daf58849b245b4ab16360a1
train
function
def csi_plot(df, var_name): """Returns a CSI plot for a specified variable""" sub_df = df.loc[df.var_name==var_name, ['var_cuts_string_dev','resp_rate_dev','resp_rate_val']] sub_df['resp_rate_trend_dev'] = _trend(sub_df['resp_rate_dev']) sub_df['resp_rate_trend_val'] = _trend(sub_df['resp_rate_val']) ...
def csi_plot(df, var_name):
"""Returns a CSI plot for a specified variable""" sub_df = df.loc[df.var_name==var_name, ['var_cuts_string_dev','resp_rate_dev','resp_rate_val']] sub_df['resp_rate_trend_dev'] = _trend(sub_df['resp_rate_dev']) sub_df['resp_rate_trend_val'] = _trend(sub_df['resp_rate_val']) f, ax = plt.subplots() ...
_name} ({iv_val})') ax2.set(ylabel=f'Log Odds ({p_suffix})') ax.legend(handles=[l for a in [ax, ax2] for l in a.lines], labels=[f'Resp Rate ({p_suffix})', f'Resp Rate Trend ({p_suffix})', f'Log Odds ({p_suffix})'], loc=0) return f def csi_plot(df, var_name):
90
90
302
9
80
avinashknmr/ml-utils
ml_utils/draw.py
Python
csi_plot
csi_plot
42
54
42
42
800e02c792c2e03c258fedcd9fc24b84326acd97
bigcode/the-stack
train
1b8459772dc67eeff3c69a24
train
class
class Raha(TaustaObjekti): def __init__(self): self.kuva = pygame.image.load(resource_path("kolikko.png")) self.x = random.randint(0, nayton_leveys) self.y = random.randint(0, nayton_korkeus) self.hitbox = pygame.Rect(self.x+2, self.y+2, self.kuva.get_width()-4, self.kuva.get_height(...
class Raha(TaustaObjekti):
def __init__(self): self.kuva = pygame.image.load(resource_path("kolikko.png")) self.x = random.randint(0, nayton_leveys) self.y = random.randint(0, nayton_korkeus) self.hitbox = pygame.Rect(self.x+2, self.y+2, self.kuva.get_width()-4, self.kuva.get_height()-4) self.nopeus = ...
if taustan_suunta == 7: self.y += self.nopeus if taustan_suunta == 8: self.y += self.nopeus self.x -= self.nopeus self.hae_hitbox() class Raha(TaustaObjekti):
64
64
147
9
55
stgpepper/moocgame
main.pyw
Python
Raha
Raha
381
390
381
381
1aae01a5ef16a5c67c00f3c79f227b7169e7f920
bigcode/the-stack
train
19d1186bce4f021b6e1b4fe9
train
class
class Este(TaustaObjekti): # Esteet scrollaa (liikkuu) aina samaan suuntaan. def __init__(self): self.x = random.randint(-rajaus_alue_leveys, nayton_leveys + rajaus_alue_leveys) self.y = random.randint(-rajaus_alue_korkeus, nayton_korkeus + rajaus_alue_korkeus) self.leveys = random.randint(...
class Este(TaustaObjekti): # Esteet scrollaa (liikkuu) aina samaan suuntaan.
def __init__(self): self.x = random.randint(-rajaus_alue_leveys, nayton_leveys + rajaus_alue_leveys) self.y = random.randint(-rajaus_alue_korkeus, nayton_korkeus + rajaus_alue_korkeus) self.leveys = random.randint(5, nayton_leveys / 10) self.korkeus = random.randint(5, nayton_korkeus...
(self): self.hitbox = pygame.Rect(self.x+2, self.y+2, self.kuva.get_width()-4, self.kuva.get_height()-4) class Este(TaustaObjekti): # Esteet scrollaa (liikkuu) aina samaan suuntaan.
64
64
189
27
37
stgpepper/moocgame
main.pyw
Python
Este
Este
392
402
392
392
6c1fc1a68a45558b7ed8ac0de8c601d070a69e1e
bigcode/the-stack
train
3a93098985981b66f4a80e39
train
class
class TaustaObjekti: def looppi(self, nuolinappaimet, robotin_sijainti, taustan_suunta): if taustan_suunta == 1: self.x -= self.nopeus if taustan_suunta == 2: self.x -= self.nopeus self.y -= self.nopeus if taustan_suunta == 3: self.y -= self.n...
class TaustaObjekti:
def looppi(self, nuolinappaimet, robotin_sijainti, taustan_suunta): if taustan_suunta == 1: self.x -= self.nopeus if taustan_suunta == 2: self.x -= self.nopeus self.y -= self.nopeus if taustan_suunta == 3: self.y -= self.nopeus if taust...
ritetään mörön sijainti self.x += self.nopeus_x self.y += self.nopeus_y self.hitbox = pygame.Rect(self.x+7, self.y+4, self.kuva.get_width()-10, self.kuva.get_height()-7) class TaustaObjekti:
70
70
235
7
63
stgpepper/moocgame
main.pyw
Python
TaustaObjekti
TaustaObjekti
355
379
355
356
0b8d83f476485978f7e2c67576f87c15efa1c306
bigcode/the-stack
train
80f5b0b1c93a05e6d83a67cf
train
class
class Morko: def __init__(self): self.kuva = pygame.image.load(resource_path("hirvio.png")) self.x = 0 self.y = 0 self.nopeus_x = 0.0 self.nopeus_y = 0.0 self.kiihtyvyys = 0 self.max_vauhti = 3 # 3 self.hitbox = pygame.Rect(self.x+7, self.y+4, self.ku...
class Morko:
def __init__(self): self.kuva = pygame.image.load(resource_path("hirvio.png")) self.x = 0 self.y = 0 self.nopeus_x = 0.0 self.nopeus_y = 0.0 self.kiihtyvyys = 0 self.max_vauhti = 3 # 3 self.hitbox = pygame.Rect(self.x+7, self.y+4, self.kuva.get_width()...
aimet[0]: self.x -= 1 * self.nopeus if self.y > rajaus_alue_korkeus: if nuolinappaimet[1]: self.y -= 1 * self.nopeus if nayton_leveys - rajaus_alue_leveys - self.kuva.get_width() > self.x: if nuolinappaimet[2]: self.x += 1 * self.no...
189
189
631
5
184
stgpepper/moocgame
main.pyw
Python
Morko
Morko
305
353
305
306
71267ac90921b33855a01551bcc5b2ca9ea65510
bigcode/the-stack
train
1346c7a8926c9280c9064b2e
train
class
class Robotti: def __init__(self): self.kuva = pygame.image.load(resource_path("robo.png")) self.x = nayton_leveys / 2 - self.kuva.get_width() self.y = nayton_korkeus / 2 - self.kuva.get_height() self.hitbox = pygame.Rect(self.x + 6, self.y+1, self.kuva.get_width()-13, self.kuva.get...
class Robotti:
def __init__(self): self.kuva = pygame.image.load(resource_path("robo.png")) self.x = nayton_leveys / 2 - self.kuva.get_width() self.y = nayton_korkeus / 2 - self.kuva.get_height() self.hitbox = pygame.Rect(self.x + 6, self.y+1, self.kuva.get_width()-13, self.kuva.get_height()-2) ...
255, 0)) self.naytto.blit(textsurface, (rajaus_alue_leveys + 10, nayton_korkeus / 2 + 125)) pygame.draw.rect(self.naytto, (0, 0, 0), pygame.Rect(0, nayton_korkeus - rajaus_alue_korkeus, nayton_leveys, rajaus_alue_korkeus)) pygame.display.flip() def uusi_peli(self): Peli()...
111
111
373
4
107
stgpepper/moocgame
main.pyw
Python
Robotti
Robotti
278
303
278
279
5de549987388a8454ec097fdbd64eefd7a3be1c4
bigcode/the-stack
train
f7fadf0a2a496b2d33144b40
train
class
class Peli: def __init__(self, peli_kaynnissa = True): pygame.init() self.peli_kaynnissa = peli_kaynnissa self.kello = pygame.time.Clock() self.aloitus_aika = pygame.time.get_ticks() self.trigger_aika = pygame.time.get_ticks() self.este_objektit = 1 self.est...
class Peli:
def __init__(self, peli_kaynnissa = True): pygame.init() self.peli_kaynnissa = peli_kaynnissa self.kello = pygame.time.Clock() self.aloitus_aika = pygame.time.get_ticks() self.trigger_aika = pygame.time.get_ticks() self.este_objektit = 1 self.este_objektit_no...
import random import pygame import math import sys import os # Määritellään muutamia koko ohjelman kannalta olennaisia muuttujia, # jotka eivät muutu pelin aikana. nayton_leveys = 1300 nayton_korkeus = 800 rajaus_alue_leveys = 100 rajaus_alue_korkeus = 100 def resource_path(relative_path): """ Get absolute path ...
165
256
3,576
4
161
stgpepper/moocgame
main.pyw
Python
Peli
Peli
25
276
25
26
0421f40bf185b99a3f41786f0b7188f17d2f83d5
bigcode/the-stack
train
0cfc58dc56dbd1e272d0cd9f
train
function
def resource_path(relative_path): """ Get absolute path to resource, works for dev and for PyInstaller """ try: # PyInstaller creates a temp folder and stores path in _MEIPASS base_path = sys._MEIPASS except Exception: base_path = os.path.abspath(".") return os.path.join(base_pa...
def resource_path(relative_path):
""" Get absolute path to resource, works for dev and for PyInstaller """ try: # PyInstaller creates a temp folder and stores path in _MEIPASS base_path = sys._MEIPASS except Exception: base_path = os.path.abspath(".") return os.path.join(base_path, relative_path)
alta olennaisia muuttujia, # jotka eivät muutu pelin aikana. nayton_leveys = 1300 nayton_korkeus = 800 rajaus_alue_leveys = 100 rajaus_alue_korkeus = 100 def resource_path(relative_path):
64
64
76
6
57
stgpepper/moocgame
main.pyw
Python
resource_path
resource_path
15
23
15
15
25ec5b88a7b6213f5ddca6acbbad3352a756f094
bigcode/the-stack
train
61c98739d46c0a74d3357648
train
class
@patch("openprocurement.tender.core.validation.RELEASE_ECRITERIA_ARTICLE_17", get_now() - timedelta(days=1)) @patch("openprocurement.tender.core.models.RELEASE_ECRITERIA_ARTICLE_17", get_now() - timedelta(days=1)) class TenderBidRequirementResponseTestMixin(object): test_create_bid_requirement_response = snitch(cre...
@patch("openprocurement.tender.core.validation.RELEASE_ECRITERIA_ARTICLE_17", get_now() - timedelta(days=1)) @patch("openprocurement.tender.core.models.RELEASE_ECRITERIA_ARTICLE_17", get_now() - timedelta(days=1)) class TenderBidRequirementResponseTestMixin(object):
test_create_bid_requirement_response = snitch(create_bid_requirement_response) test_patch_bid_requirement_response = snitch(patch_bid_requirement_response) test_get_bid_requirement_response = snitch(get_bid_requirement_response) test_patch_bid_with_responses = snitch(patch_bid_with_responses) initi...
_bidder_document) test_create_tender_bidder_document_nopending = snitch(create_tender_bidder_document_nopending) @patch("openprocurement.tender.core.validation.RELEASE_ECRITERIA_ARTICLE_17", get_now() - timedelta(days=1)) @patch("openprocurement.tender.core.models.RELEASE_ECRITERIA_ARTICLE_17", get_now() - timedelt...
97
97
326
69
28
ProzorroUKR/openprocurement.api
src/openprocurement/tender/openua/tests/bid.py
Python
TenderBidRequirementResponseTestMixin
TenderBidRequirementResponseTestMixin
111
132
111
113
6156347f59cec7afe08ccfe7e8ae0e4ff271d2d6
bigcode/the-stack
train
8a1a3657ce76d86c8ccb7956
train
class
class TenderBidDocumentWithDSResourceTest(TenderBidDocumentWithDSResourceTestMixin, TenderBidDocumentResourceTest): pass
class TenderBidDocumentWithDSResourceTest(TenderBidDocumentWithDSResourceTestMixin, TenderBidDocumentResourceTest):
pass
_bidder_document_nopending = snitch(create_tender_bidder_document_nopending_json) test_tender_bidder_confidential_document = snitch(tender_bidder_confidential_document) class TenderBidDocumentWithDSResourceTest(TenderBidDocumentWithDSResourceTestMixin, TenderBidDocumentResourceTest):
64
64
27
24
40
ProzorroUKR/openprocurement.api
src/openprocurement/tender/openua/tests/bid.py
Python
TenderBidDocumentWithDSResourceTest
TenderBidDocumentWithDSResourceTest
265
266
265
265
22644809a89be67fe45c8c1498dfff0f443d09ad
bigcode/the-stack
train
3052488cb146ad4d80d59291
train
class
class TenderBidRequirementResponseResourceTest( TenderBidRequirementResponseTestMixin, CreateBidMixin, BaseTenderUAContentWebTest, ): initial_data = test_tender_data base_bid_status = "draft" initial_status = "active.tendering"
class TenderBidRequirementResponseResourceTest( TenderBidRequirementResponseTestMixin, CreateBidMixin, BaseTenderUAContentWebTest, ):
initial_data = test_tender_data base_bid_status = "draft" initial_status = "active.tendering"
create_tender_bid_with_document = snitch(create_tender_bid_with_document) create_tender_bid_with_documents = snitch(create_tender_bid_with_documents) class TenderBidRequirementResponseResourceTest( TenderBidRequirementResponseTestMixin, CreateBidMixin, BaseTenderUAContentWebTest, ):
64
64
57
30
34
ProzorroUKR/openprocurement.api
src/openprocurement/tender/openua/tests/bid.py
Python
TenderBidRequirementResponseResourceTest
TenderBidRequirementResponseResourceTest
286
293
286
290
cbc9e5dd845b51b12dbb896984b5b5fca5f32ecb
bigcode/the-stack
train
5cd5a6c978da7e2d8b9780e4
train
class
class TenderBidActivateDocumentTest(CreateBidMixin, BaseTenderUAContentWebTest): docservice = True initial_status = "active.tendering" test_bids_data = test_bids author_data = test_author base_bid_status = "draft" test_doc_date_modified = snitch(doc_date_modified)
class TenderBidActivateDocumentTest(CreateBidMixin, BaseTenderUAContentWebTest):
docservice = True initial_status = "active.tendering" test_bids_data = test_bids author_data = test_author base_bid_status = "draft" test_doc_date_modified = snitch(doc_date_modified)
BidMixin, BaseTenderUAContentWebTest): initial_status = "active.tendering" test_bids_data = test_bids author_data = test_author test_not_found = snitch(not_found) class TenderBidActivateDocumentTest(CreateBidMixin, BaseTenderUAContentWebTest):
64
64
70
17
47
ProzorroUKR/openprocurement.api
src/openprocurement/tender/openua/tests/bid.py
Python
TenderBidActivateDocumentTest
TenderBidActivateDocumentTest
247
253
247
247
dc1fdfcb16668481edcf3ceb8e2fa67cc4dbf109
bigcode/the-stack
train
467e3d999b7e795113d149c1
train
class
class TenderBidRequirementResponseEvidenceResourceTest( TenderBidRequirementResponseEvidenceTestMixin, CreateBidMixin, BaseTenderUAContentWebTest, ): initial_data = test_tender_data base_bid_status = "draft" initial_status = "active.tendering" test_bid_invalidation_after_requirement_put = s...
class TenderBidRequirementResponseEvidenceResourceTest( TenderBidRequirementResponseEvidenceTestMixin, CreateBidMixin, BaseTenderUAContentWebTest, ):
initial_data = test_tender_data base_bid_status = "draft" initial_status = "active.tendering" test_bid_invalidation_after_requirement_put = snitch(bid_invalidation_after_requirement_put)
ContentWebTest, ): initial_data = test_tender_data base_bid_status = "draft" initial_status = "active.tendering" class TenderBidRequirementResponseEvidenceResourceTest( TenderBidRequirementResponseEvidenceTestMixin, CreateBidMixin, BaseTenderUAContentWebTest, ):
64
64
78
32
32
ProzorroUKR/openprocurement.api
src/openprocurement/tender/openua/tests/bid.py
Python
TenderBidRequirementResponseEvidenceResourceTest
TenderBidRequirementResponseEvidenceResourceTest
296
305
296
300
151a2d4ff70b1e1aadb4876b188235f8682a50d3
bigcode/the-stack
train
608dfbcf8d82a60f7029ec38
train
class
class CreateBidMixin(object): base_bid_status = "active" def setUp(self): super(CreateBidMixin, self).setUp() bid_data = deepcopy(test_bids[0]) bid_data["status"] = self.base_bid_status # Create bid response = self.app.post_json( "/tenders/{}/bids".format(se...
class CreateBidMixin(object):
base_bid_status = "active" def setUp(self): super(CreateBidMixin, self).setUp() bid_data = deepcopy(test_bids[0]) bid_data["status"] = self.base_bid_status # Create bid response = self.app.post_json( "/tenders/{}/bids".format(self.tender_id), {"d...
"0" * 32, "format": "application/msword", } }, ) self.assertEqual(response.status, "201 Created") self.assertEqual(response.content_type, "application/json") self.doc_id = response.json["data"]["id"] class CreateBidMixin(object):
63
64
120
6
57
ProzorroUKR/openprocurement.api
src/openprocurement/tender/openua/tests/bid.py
Python
CreateBidMixin
CreateBidMixin
192
207
192
192
46f2cc023817edb49bfd70039c279c3b5c29841a
bigcode/the-stack
train
9da4cfc0e829a93767631a95
train
class
class TenderBidResourceTestMixin(object): test_create_tender_biddder_invalid = snitch(create_tender_biddder_invalid) test_create_tender_bidder = snitch(create_tender_bidder) test_patch_tender_bidder = snitch(patch_tender_bidder) test_patch_tender_draft_bidder = snitch(patch_tender_draft_bidder) test...
class TenderBidResourceTestMixin(object):
test_create_tender_biddder_invalid = snitch(create_tender_biddder_invalid) test_create_tender_bidder = snitch(create_tender_bidder) test_patch_tender_bidder = snitch(patch_tender_bidder) test_patch_tender_draft_bidder = snitch(patch_tender_draft_bidder) test_get_tender_bidder = snitch(get_tender_bid...
_activate_with_cancelled_tenderer_criterion, bid_invalidation_after_requirement_put, # TenderBidRequirementResponseEvidenceResourceTest create_bid_requirement_response_evidence, patch_bid_requirement_response_evidence, get_bid_requirement_response_evidence, bid_activate, # TenderBidDocumentA...
88
88
295
8
80
ProzorroUKR/openprocurement.api
src/openprocurement/tender/openua/tests/bid.py
Python
TenderBidResourceTestMixin
TenderBidResourceTestMixin
84
99
84
84
ac65fdd9a76d7a082cbdf10d7a3f4243c99e755f
bigcode/the-stack
train
a3a376da53cd52c87b68f2e7
train
class
class TenderBidDocumentResourceTest(CreateBidMixin, BaseTenderUAContentWebTest): initial_status = "active.tendering" test_bids_data = test_bids author_data = test_author test_not_found = snitch(not_found)
class TenderBidDocumentResourceTest(CreateBidMixin, BaseTenderUAContentWebTest):
initial_status = "active.tendering" test_bids_data = test_bids author_data = test_author test_not_found = snitch(not_found)
initial_status = "active.tendering" test_bids_data = test_bids test_features_bidder = snitch(features_bidder) test_features_bidder_invalid = snitch(features_bidder_invalid) class TenderBidDocumentResourceTest(CreateBidMixin, BaseTenderUAContentWebTest):
64
64
54
17
47
ProzorroUKR/openprocurement.api
src/openprocurement/tender/openua/tests/bid.py
Python
TenderBidDocumentResourceTest
TenderBidDocumentResourceTest
239
244
239
239
32bb5995d9a18fa7fb84dc63031b14d98b9a7a57
bigcode/the-stack
train
7c2d55a69830e53fa42ee685
train
class
class TenderBidResourceTest(BaseTenderUAContentWebTest, TenderBidResourceTestMixin): initial_data = test_tender_data initial_status = "active.tendering" test_bids_data = test_bids author_data = test_author test_draft1_bid = snitch(draft1_bid) test_draft2_bids = snitch(draft2_bids)
class TenderBidResourceTest(BaseTenderUAContentWebTest, TenderBidResourceTestMixin):
initial_data = test_tender_data initial_status = "active.tendering" test_bids_data = test_bids author_data = test_author test_draft1_bid = snitch(draft1_bid) test_draft2_bids = snitch(draft2_bids)
".format(self.tender_id), {"data": bid_data}, ) bid = response.json["data"] self.bid_id = bid["id"] self.bid_token = response.json["access"]["token"] class TenderBidResourceTest(BaseTenderUAContentWebTest, TenderBidResourceTestMixin):
63
64
84
18
45
ProzorroUKR/openprocurement.api
src/openprocurement/tender/openua/tests/bid.py
Python
TenderBidResourceTest
TenderBidResourceTest
210
217
210
210
7e421b95149ac980f9daddb341e908e06392acf1
bigcode/the-stack
train
6ac1cf28431630ef4758edc0
train
class
class TenderBidderBatchDocumentWithDSResourceTest(BaseTenderUAContentWebTest): docservice = True initial_status = "active.tendering" test_bids_data = test_bids bid_data_wo_docs = { "tenderers": [test_organization], "value": {"amount": 500}, "selfEligible": True, "selfQual...
class TenderBidderBatchDocumentWithDSResourceTest(BaseTenderUAContentWebTest):
docservice = True initial_status = "active.tendering" test_bids_data = test_bids bid_data_wo_docs = { "tenderers": [test_organization], "value": {"amount": 500}, "selfEligible": True, "selfQualified": True, "documents": [], } create_tender_bid_with_docume...
test_tender_bidder_confidential_document = snitch(tender_bidder_confidential_document) class TenderBidDocumentWithDSResourceTest(TenderBidDocumentWithDSResourceTestMixin, TenderBidDocumentResourceTest): pass class TenderBidderBatchDocumentWithDSResourceTest(BaseTenderUAContentWebTest):
64
64
146
17
46
ProzorroUKR/openprocurement.api
src/openprocurement/tender/openua/tests/bid.py
Python
TenderBidderBatchDocumentWithDSResourceTest
TenderBidderBatchDocumentWithDSResourceTest
269
283
269
269
fc2a3d788da55123c7cabc4030f56af1d8341c53
bigcode/the-stack
train
edb33dd7aa05d1a956df2744
train
class
@patch("openprocurement.tender.core.validation.RELEASE_ECRITERIA_ARTICLE_17", get_now() - timedelta(days=1)) @patch("openprocurement.tender.core.models.RELEASE_ECRITERIA_ARTICLE_17", get_now() - timedelta(days=1)) class TenderBidDocumentResourceTestMixin(object): test_create_tender_bidder_document = snitch(create_t...
@patch("openprocurement.tender.core.validation.RELEASE_ECRITERIA_ARTICLE_17", get_now() - timedelta(days=1)) @patch("openprocurement.tender.core.models.RELEASE_ECRITERIA_ARTICLE_17", get_now() - timedelta(days=1)) class TenderBidDocumentResourceTestMixin(object):
test_create_tender_bidder_document = snitch(create_tender_bidder_document) test_put_tender_bidder_document = snitch(put_tender_bidder_document) test_patch_tender_bidder_document = snitch(patch_tender_bidder_document) test_create_tender_bidder_document_nopending = snitch(create_tender_bidder_document_nop...
@patch("openprocurement.tender.core.validation.RELEASE_ECRITERIA_ARTICLE_17", get_now() - timedelta(days=1)) @patch("openprocurement.tender.core.models.RELEASE_ECRITERIA_ARTICLE_17", get_now() - timedelta(days=1)) class TenderBidDocumentResourceTestMixin(object):
69
64
149
69
0
ProzorroUKR/openprocurement.api
src/openprocurement/tender/openua/tests/bid.py
Python
TenderBidDocumentResourceTestMixin
TenderBidDocumentResourceTestMixin
102
108
102
104
990ed858f6b9be3003ffdfcb80b77c514e4b470f
bigcode/the-stack
train
a5d9a44b57e389269ddbfc1f
train
function
def suite(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(TenderBidDocumentResourceTest)) suite.addTest(unittest.makeSuite(TenderBidDocumentWithDSResourceTest)) suite.addTest(unittest.makeSuite(TenderBidFeaturesResourceTest)) suite.addTest(unittest.makeSuite(TenderBidResourceTest)) ...
def suite():
suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(TenderBidDocumentResourceTest)) suite.addTest(unittest.makeSuite(TenderBidDocumentWithDSResourceTest)) suite.addTest(unittest.makeSuite(TenderBidFeaturesResourceTest)) suite.addTest(unittest.makeSuite(TenderBidResourceTest)) suite.add...
, CreateBidMixin, BaseTenderUAContentWebTest, ): initial_data = test_tender_data base_bid_status = "draft" initial_status = "active.tendering" test_bid_invalidation_after_requirement_put = snitch(bid_invalidation_after_requirement_put) def suite():
64
64
102
3
61
ProzorroUKR/openprocurement.api
src/openprocurement/tender/openua/tests/bid.py
Python
suite
suite
308
316
308
308
3fd3ac5e0894fb6f1c7e2dc67fd4fd58cb139fae
bigcode/the-stack
train
2db4f8d0bdfc1224f7d44cfb
train
class
@patch("openprocurement.tender.core.validation.RELEASE_ECRITERIA_ARTICLE_17", get_now() - timedelta(days=1)) @patch("openprocurement.tender.core.models.RELEASE_ECRITERIA_ARTICLE_17", get_now() - timedelta(days=1)) class TenderBidRequirementResponseEvidenceTestMixin: docservice = True test_create_bid_requirement...
@patch("openprocurement.tender.core.validation.RELEASE_ECRITERIA_ARTICLE_17", get_now() - timedelta(days=1)) @patch("openprocurement.tender.core.models.RELEASE_ECRITERIA_ARTICLE_17", get_now() - timedelta(days=1)) class TenderBidRequirementResponseEvidenceTestMixin:
docservice = True test_create_bid_requirement_response_evidence = snitch(create_bid_requirement_response_evidence) test_patch_bid_requirement_response_evidence = snitch(patch_bid_requirement_response_evidence) test_get_bid_requirement_response_evidence = snitch(get_bid_requirement_response_evidence) ...
, self).setUp() response = self.app.get("/tenders/{}/criteria".format(self.tender_id)) criteria = response.json["data"] requirement = criteria[0]["requirementGroups"][0]["requirements"][0] self.requirement_id = requirement["id"] self.requirement_title = requirement["title"] ...
180
181
604
69
111
ProzorroUKR/openprocurement.api
src/openprocurement/tender/openua/tests/bid.py
Python
TenderBidRequirementResponseEvidenceTestMixin
TenderBidRequirementResponseEvidenceTestMixin
135
189
135
137
b581d4d72929aeb014b8a6ff5b65dd2f2c2940b8
bigcode/the-stack
train
cf54fddaef20a3cbc4a682b9
train
class
class TenderBidDocumentWithDSResourceTestMixin: docservice = True test_create_tender_bidder_document_json = snitch(create_tender_bidder_document_json) test_put_tender_bidder_document_json = snitch(put_tender_bidder_document_json) test_patch_tender_bidder_document = snitch(patch_tender_bidder_document_js...
class TenderBidDocumentWithDSResourceTestMixin:
docservice = True test_create_tender_bidder_document_json = snitch(create_tender_bidder_document_json) test_put_tender_bidder_document_json = snitch(put_tender_bidder_document_json) test_patch_tender_bidder_document = snitch(patch_tender_bidder_document_json) test_create_tender_bidder_document_nopen...
): docservice = True initial_status = "active.tendering" test_bids_data = test_bids author_data = test_author base_bid_status = "draft" test_doc_date_modified = snitch(doc_date_modified) class TenderBidDocumentWithDSResourceTestMixin:
64
64
122
10
54
ProzorroUKR/openprocurement.api
src/openprocurement/tender/openua/tests/bid.py
Python
TenderBidDocumentWithDSResourceTestMixin
TenderBidDocumentWithDSResourceTestMixin
256
262
256
256
ddcd6c3f33919fc1a1bb49707b68708503efa611
bigcode/the-stack
train
b62c5c0fe55aec16eb9d99ce
train
class
class Tender2LotBidResourceTest(BaseTenderUAContentWebTest): initial_data = test_tender_data test_bids_data = test_bids initial_lots = 2 * test_lots initial_status = "active.tendering" test_patch_tender_with_bids_lots_none = snitch(patch_tender_with_bids_lots_none) test_create_bid_after_removin...
class Tender2LotBidResourceTest(BaseTenderUAContentWebTest):
initial_data = test_tender_data test_bids_data = test_bids initial_lots = 2 * test_lots initial_status = "active.tendering" test_patch_tender_with_bids_lots_none = snitch(patch_tender_with_bids_lots_none) test_create_bid_after_removing_lot = snitch(create_bid_after_removing_lot)
endering" test_bids_data = test_bids author_data = test_author test_draft1_bid = snitch(draft1_bid) test_draft2_bids = snitch(draft2_bids) class Tender2LotBidResourceTest(BaseTenderUAContentWebTest):
64
64
100
14
50
ProzorroUKR/openprocurement.api
src/openprocurement/tender/openua/tests/bid.py
Python
Tender2LotBidResourceTest
Tender2LotBidResourceTest
220
227
220
220
1953072cb4b44df3174dfaaa37da2b916d2eda03
bigcode/the-stack
train
bf81eccf673f2893d0d82290
train
class
class TenderBidFeaturesResourceTest(BaseTenderUAContentWebTest): initial_data = test_features_tender_ua_data initial_status = "active.tendering" test_bids_data = test_bids test_features_bidder = snitch(features_bidder) test_features_bidder_invalid = snitch(features_bidder_invalid)
class TenderBidFeaturesResourceTest(BaseTenderUAContentWebTest):
initial_data = test_features_tender_ua_data initial_status = "active.tendering" test_bids_data = test_bids test_features_bidder = snitch(features_bidder) test_features_bidder_invalid = snitch(features_bidder_invalid)
"active.tendering" test_patch_tender_with_bids_lots_none = snitch(patch_tender_with_bids_lots_none) test_create_bid_after_removing_lot = snitch(create_bid_after_removing_lot) class TenderBidFeaturesResourceTest(BaseTenderUAContentWebTest):
64
64
71
13
51
ProzorroUKR/openprocurement.api
src/openprocurement/tender/openua/tests/bid.py
Python
TenderBidFeaturesResourceTest
TenderBidFeaturesResourceTest
230
236
230
230
30f4aec1441c03f726406919b55f0b27948776ed
bigcode/the-stack
train
666b33366c408039b71eb3e7
train
class
class Migration(migrations.Migration): dependencies = [ ('inventory', '0056_machine_snapshot_program_instances_on_delete_cascade'), ] operations = [ migrations.CreateModel( name='Disk', fields=[ ('id', models.AutoField(auto_created=True, primary_key=...
class Migration(migrations.Migration):
dependencies = [ ('inventory', '0056_machine_snapshot_program_instances_on_delete_cascade'), ] operations = [ migrations.CreateModel( name='Disk', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'...
# Generated by Django 2.2.24 on 2021-07-01 06:01 from django.db import migrations, models class Migration(migrations.Migration):
38
64
167
7
30
janheise/zentral
zentral/contrib/inventory/migrations/0057_auto_20210701_0601.py
Python
Migration
Migration
6
31
6
7
ba326116522a9ae8217586f2cb679c864c35b085
bigcode/the-stack
train
e4d952a7429bf29bdaa1270a
train
function
def is_mutex(action): return isinstance(action, argparse._MutuallyExclusiveGroup)
def is_mutex(action):
return isinstance(action, argparse._MutuallyExclusiveGroup)
''' _actions possessing the `required` flag and not implicitly optional through `nargs` being '*' or '?' ''' return not isinstance(action, _SubParsersAction) and ( action.required == True and action.nargs not in ['*', '?']) def is_mutex(action):
63
64
17
5
58
nelsonjchen/Gooey
gooey/python_bindings/argparse_to_json.py
Python
is_mutex
is_mutex
226
227
226
226
dba6b4e9f92607e318b2aede3709a27bd874330e
bigcode/the-stack
train
90c0b8142ddb58d7337caa1a
train
function
def is_required(action): ''' _actions possessing the `required` flag and not implicitly optional through `nargs` being '*' or '?' ''' return not isinstance(action, _SubParsersAction) and ( action.required == True and action.nargs not in ['*', '?'])
def is_required(action):
''' _actions possessing the `required` flag and not implicitly optional through `nargs` being '*' or '?' ''' return not isinstance(action, _SubParsersAction) and ( action.required == True and action.nargs not in ['*', '?'])
: raise UnknownWidgetType(action) def get_widget(widgets, action, default): supplied_widget = widgets.get(action.dest, None) type_arg_widget = 'FileChooser' if action.type == argparse.FileType else None return supplied_widget or type_arg_widget or default def is_required(action):
64
64
64
5
58
nelsonjchen/Gooey
gooey/python_bindings/argparse_to_json.py
Python
is_required
is_required
217
223
217
217
19a29602ad1394d5f38618361ff61c2719b3ec06
bigcode/the-stack
train
5ae8cf766f69af92660675c0
train
function
def has_required(actions): return list(filter(None, list(filter(is_required, actions))))
def has_required(actions):
return list(filter(None, list(filter(is_required, actions))))
`nargs` being '*' or '?' ''' return not isinstance(action, _SubParsersAction) and ( action.required == True and action.nargs not in ['*', '?']) def is_mutex(action): return isinstance(action, argparse._MutuallyExclusiveGroup) def has_required(actions):
64
64
19
5
59
nelsonjchen/Gooey
gooey/python_bindings/argparse_to_json.py
Python
has_required
has_required
230
231
230
230
cfd9d200778e8087dc8ba62d09aa859719cb6d43
bigcode/the-stack
train
24a3ee5994f5ab37b113381b
train
function
def get_widget(widgets, action, default): supplied_widget = widgets.get(action.dest, None) type_arg_widget = 'FileChooser' if action.type == argparse.FileType else None return supplied_widget or type_arg_widget or default
def get_widget(widgets, action, default):
supplied_widget = widgets.get(action.dest, None) type_arg_widget = 'FileChooser' if action.type == argparse.FileType else None return supplied_widget or type_arg_widget or default
get_widget(action, 'Counter'), options) # pre-fill the 'counter' dropdown _json['data']['choices'] = list(map(str, range(1, 11))) yield _json else: raise UnknownWidgetType(action) def get_widget(widgets, action, default):
64
64
51
10
54
nelsonjchen/Gooey
gooey/python_bindings/argparse_to_json.py
Python
get_widget
get_widget
211
214
211
211
b2eed69fe5e1fb46162beba81a758cc4d218d9c4
bigcode/the-stack
train
5f2e2d465b9586eb34a55fab
train
function
def convert(parser, **kwargs): assert_subparser_constraints(parser) x = { 'layout': 'standard', 'widgets': OrderedDict( (choose_name(name, sub_parser), { 'command': name, 'contents': process(sub_parser, getat...
def convert(parser, **kwargs):
assert_subparser_constraints(parser) x = { 'layout': 'standard', 'widgets': OrderedDict( (choose_name(name, sub_parser), { 'command': name, 'contents': process(sub_parser, getattr(sub_parser, 'widgets', {}), ...
item_default = { 'error_color': '#ea7878', 'validator': { 'type': 'local', 'test': 'lambda x: True', 'message': '' }, 'external_validator': { 'cmd': '', } } def convert(parser, **kwargs):
64
64
113
7
57
nelsonjchen/Gooey
gooey/python_bindings/argparse_to_json.py
Python
convert
convert
68
83
68
68
fbeccb399b2a7b96c61021837204a6dbed76b808
bigcode/the-stack
train
2449d4d8a468d172f899663d
train
function
def contains_actions(a, b): ''' check if any actions(a) are present in actions(b) ''' return set(a).intersection(set(b))
def contains_actions(a, b):
''' check if any actions(a) are present in actions(b) ''' return set(a).intersection(set(b))
(spec, path) for group in contents: if group['name'] == 'positional arguments': group['name'] = 'Required Arguments' if group['name'] == 'optional arguments': group['name'] = 'Optional Arguments' return spec def contains_actions(a, b):
64
64
31
7
56
nelsonjchen/Gooey
gooey/python_bindings/argparse_to_json.py
Python
contains_actions
contains_actions
145
147
145
145
c7c62798563531e1d7b5cba39c14166b24b323c4
bigcode/the-stack
train
ab6ce29943450ddaf51bccf9
train
function
def is_default_progname(name, subparser): return subparser.prog == '{} {}'.format(os.path.split(sys.argv[0])[-1], name)
def is_default_progname(name, subparser):
return subparser.prog == '{} {}'.format(os.path.split(sys.argv[0])[-1], name)
, _StoreFalseAction, _StoreConstAction] return any(list(map(lambda Action: isinstance(action, Action), action_types))) def is_counter(action): """ _actions which are of type _CountAction """ return isinstance(action, _CountAction) def is_default_progname(name, subparser):
64
64
33
10
54
nelsonjchen/Gooey
gooey/python_bindings/argparse_to_json.py
Python
is_default_progname
is_default_progname
285
286
285
285
f5b08ada2fbe4d739bc4c3519646887bd2c07fe2
bigcode/the-stack
train
9ec13e40a1c7487a81eba159
train
function
def is_counter(action): """ _actions which are of type _CountAction """ return isinstance(action, _CountAction)
def is_counter(action):
""" _actions which are of type _CountAction """ return isinstance(action, _CountAction)
_actions) def is_flag(action): """ _actions which are either storeconst, store_bool, etc.. """ action_types = [_StoreTrueAction, _StoreFalseAction, _StoreConstAction] return any(list(map(lambda Action: isinstance(action, Action), action_types))) def is_counter(action):
63
64
26
5
58
nelsonjchen/Gooey
gooey/python_bindings/argparse_to_json.py
Python
is_counter
is_counter
280
282
280
280
6e9c56bc85585e3173b3881583a006097b79c79b
bigcode/the-stack
train
eb9db5d087c138e4c23a27a2
train
function
def get_subparser(actions): return list(filter(is_subparser, actions))[0]
def get_subparser(actions):
return list(filter(is_subparser, actions))[0]
uallyExclusiveGroup) def has_required(actions): return list(filter(None, list(filter(is_required, actions)))) def is_subparser(action): return isinstance(action, _SubParsersAction) def has_subparsers(actions): return list(filter(is_subparser, actions)) def get_subparser(actions):
63
64
18
6
57
nelsonjchen/Gooey
gooey/python_bindings/argparse_to_json.py
Python
get_subparser
get_subparser
242
243
242
242
2568dab3ef47a950eb73e18bf962b85cee94e8ef
bigcode/the-stack
train
865e3cb25ae8189b8189460f
train
function
def choose_cli_type(action): return 'positional' \ if action.required and not action.option_strings \ else 'optional'
def choose_cli_type(action):
return 'positional' \ if action.required and not action.option_strings \ else 'optional'
action.nargs or '', 'commands': action.option_strings, 'choices': action.choices or [], 'default': clean_default(action.default), 'dest': action.dest, }, 'options': merge(base, options.get(action.dest) or {}) } def choose_cli_type(action):
64
64
28
6
58
nelsonjchen/Gooey
gooey/python_bindings/argparse_to_json.py
Python
choose_cli_type
choose_cli_type
348
351
348
348
5a42afc189cd656a0b57c43feedac706eb7d8aa1
bigcode/the-stack
train
6397461da0daf6960f01eb46
train
function
def is_help_message(action): return isinstance(action, _HelpAction)
def is_help_message(action):
return isinstance(action, _HelpAction)
is_counter(action): """ _actions which are of type _CountAction """ return isinstance(action, _CountAction) def is_default_progname(name, subparser): return subparser.prog == '{} {}'.format(os.path.split(sys.argv[0])[-1], name) def is_help_message(action):
64
64
15
6
58
nelsonjchen/Gooey
gooey/python_bindings/argparse_to_json.py
Python
is_help_message
is_help_message
289
290
289
289
2dfe0b17acaaa61f6e5ee77829d069c2b860cdfd
bigcode/the-stack
train
7d018ff999e379a18bc441b6
train
function
def iter_parsers(parser): ''' Iterate over name, parser pairs ''' try: return get_subparser(parser._actions).choices.items() except: return iter([('::gooey/default', parser)])
def iter_parsers(parser):
''' Iterate over name, parser pairs ''' try: return get_subparser(parser._actions).choices.items() except: return iter([('::gooey/default', parser)])
group['items']] def assert_subparser_constraints(parser): if has_subparsers(parser._actions): if has_required(parser._actions): raise UnsupportedConfiguration( "Gooey doesn't currently support top level required arguments " "when subparsers are present....
63
64
46
6
57
nelsonjchen/Gooey
gooey/python_bindings/argparse_to_json.py
Python
iter_parsers
iter_parsers
106
111
106
106
9961f2710ad3301ba1a66b31aecd6480cda584cc
bigcode/the-stack
train
1f4ce44d49fcfe1fd4b39ffc
train
function
def is_optional(action): ''' _actions either not possessing the `required` flag or implicitly optional through `nargs` being '*' or '?' ''' return (not action.required) or action.nargs in ['*', '?']
def is_optional(action):
''' _actions either not possessing the `required` flag or implicitly optional through `nargs` being '*' or '?' ''' return (not action.required) or action.nargs in ['*', '?']
_required, actions)))) def is_subparser(action): return isinstance(action, _SubParsersAction) def has_subparsers(actions): return list(filter(is_subparser, actions)) def get_subparser(actions): return list(filter(is_subparser, actions))[0] def is_optional(action):
63
64
52
5
58
nelsonjchen/Gooey
gooey/python_bindings/argparse_to_json.py
Python
is_optional
is_optional
246
251
246
246
70748980caca4f884486a8a778e45dd72c5e539c
bigcode/the-stack
train
9b408346963eddc9ab3dee0f
train
class
class UnknownWidgetType(Exception): pass
class UnknownWidgetType(Exception):
pass
'FileSaver', 'DirChooser', 'DateChooser', 'TextField', 'Dropdown', 'Counter', 'RadioGroup', 'CheckBox', 'MultiDirChooser', 'Textarea', 'PasswordField', 'Listbox' ) class UnknownWidgetType(Exception):
64
64
9
6
58
nelsonjchen/Gooey
gooey/python_bindings/argparse_to_json.py
Python
UnknownWidgetType
UnknownWidgetType
40
41
40
40
98802d24bf48a1db820a4915ebf032ad101f25ab
bigcode/the-stack
train
9971734fe5e71010046627fe
train
function
def categorize(actions, widget_dict, options): _get_widget = partial(get_widget, widget_dict) for action in actions: if is_mutex(action): yield build_radio_group(action, widget_dict, options) elif is_standard(action): yield action_to_json(action, _get_widget(act...
def categorize(actions, widget_dict, options):
_get_widget = partial(get_widget, widget_dict) for action in actions: if is_mutex(action): yield build_radio_group(action, widget_dict, options) elif is_standard(action): yield action_to_json(action, _get_widget(action, 'TextField'), options) elif is_c...
'items': list(categorize(group['items'], widget_dict, options)), 'groups': categorize2(group['groups'], widget_dict, options), 'description': group['description'], 'options': group['options'] } for group in groups] def categorize(actions, widget_dict, options):
63
64
186
9
54
nelsonjchen/Gooey
gooey/python_bindings/argparse_to_json.py
Python
categorize
categorize
186
208
186
186
d791ce06d2f4499a03cb8b9292dfafd03edaefd4
bigcode/the-stack
train
ad525ec8d67215d4a3749504
train
function
def is_subparser(action): return isinstance(action, _SubParsersAction)
def is_subparser(action):
return isinstance(action, _SubParsersAction)
sersAction) and ( action.required == True and action.nargs not in ['*', '?']) def is_mutex(action): return isinstance(action, argparse._MutuallyExclusiveGroup) def has_required(actions): return list(filter(None, list(filter(is_required, actions)))) def is_subparser(action):
63
64
17
6
57
nelsonjchen/Gooey
gooey/python_bindings/argparse_to_json.py
Python
is_subparser
is_subparser
234
235
234
234
4f8fdd7b856128703e308ffa9d7308fe8cb6bb4e
bigcode/the-stack
train
a145c75ffe208a000f2327ed
train
class
class UnsupportedConfiguration(Exception): pass
class UnsupportedConfiguration(Exception):
pass
', 'DateChooser', 'TextField', 'Dropdown', 'Counter', 'RadioGroup', 'CheckBox', 'MultiDirChooser', 'Textarea', 'PasswordField', 'Listbox' ) class UnknownWidgetType(Exception): pass class UnsupportedConfiguration(Exception):
64
64
8
5
58
nelsonjchen/Gooey
gooey/python_bindings/argparse_to_json.py
Python
UnsupportedConfiguration
UnsupportedConfiguration
44
45
44
44
4ace6519cfc0d38b49798ad46801e1003cd3823b
bigcode/the-stack
train
3497629e7c48fa849968de8a
train
function
def is_standard(action): """ actions which are general "store" instructions. e.g. anything which has an argument style like: $ script.py -f myfilename.txt """ boolean_actions = ( _StoreConstAction, _StoreFalseAction, _StoreTrueAction ) return (not action.choices ...
def is_standard(action):
""" actions which are general "store" instructions. e.g. anything which has an argument style like: $ script.py -f myfilename.txt """ boolean_actions = ( _StoreConstAction, _StoreFalseAction, _StoreTrueAction ) return (not action.choices and not isinst...
possessing the `required` flag or implicitly optional through `nargs` being '*' or '?' ''' return (not action.required) or action.nargs in ['*', '?'] def is_choice(action): ''' action with choices supplied ''' return action.choices def is_standard(action):
64
64
102
5
58
nelsonjchen/Gooey
gooey/python_bindings/argparse_to_json.py
Python
is_standard
is_standard
259
271
259
259
149bd8fe3fda2b2e5fe3471e8181ab5a1fbbfd35
bigcode/the-stack
train
ab3e50e732275d1783ee4910
train
function
def build_radio_group(mutex_group, widget_group, options): return { 'id': str(uuid4()), 'type': 'RadioGroup', 'cli_type': 'optional', 'group_name': 'Choose Option', 'required': mutex_group.required, 'options': getattr(mutex_group, 'gooey_options', {}), 'data': { 'commands': ...
def build_radio_group(mutex_group, widget_group, options):
return { 'id': str(uuid4()), 'type': 'RadioGroup', 'cli_type': 'optional', 'group_name': 'Choose Option', 'required': mutex_group.required, 'options': getattr(mutex_group, 'gooey_options', {}), 'data': { 'commands': [action.option_strings for action in mutex_group._group_acti...
.argv[0])[-1], name) def is_help_message(action): return isinstance(action, _HelpAction) def choose_name(name, subparser): return name if is_default_progname(name, subparser) else subparser.prog def build_radio_group(mutex_group, widget_group, options):
64
64
120
13
50
nelsonjchen/Gooey
gooey/python_bindings/argparse_to_json.py
Python
build_radio_group
build_radio_group
297
309
297
297
160e392cc6afe1783f1b43ec2ae9cc354f59b8a0
bigcode/the-stack
train
6f0f3d1778a4d537dd7d6bc2
train
function
def clean_default(default): ''' Attemps to safely coalesce the default value down to a valid JSON type. See: Issue #147. function references supplied as arguments to the `default` parameter in Argparse cause errors in Gooey. ''' return default.__name__ if callable(default) else...
def clean_default(default):
''' Attemps to safely coalesce the default value down to a valid JSON type. See: Issue #147. function references supplied as arguments to the `default` parameter in Argparse cause errors in Gooey. ''' return default.__name__ if callable(default) else default
clean_default(action.default), 'dest': action.dest, }, 'options': merge(base, options.get(action.dest) or {}) } def choose_cli_type(action): return 'positional' \ if action.required and not action.option_strings \ else 'optional' def clean_default...
64
64
71
5
59
nelsonjchen/Gooey
gooey/python_bindings/argparse_to_json.py
Python
clean_default
clean_default
353
362
353
353
983fc41762768ae07684cea2d186fde3e672e5cd
bigcode/the-stack
train
14b169b90bf40a1a2e391913
train
function
def has_subparsers(actions): return list(filter(is_subparser, actions))
def has_subparsers(actions):
return list(filter(is_subparser, actions))
', '?']) def is_mutex(action): return isinstance(action, argparse._MutuallyExclusiveGroup) def has_required(actions): return list(filter(None, list(filter(is_required, actions)))) def is_subparser(action): return isinstance(action, _SubParsersAction) def has_subparsers(actions):
64
64
17
7
57
nelsonjchen/Gooey
gooey/python_bindings/argparse_to_json.py
Python
has_subparsers
has_subparsers
238
239
238
238
bb6b96d4b512e8f08b208e0bea711ac743383442
bigcode/the-stack
train
a1cd353e733cca416bdd1036
train
function
def assert_subparser_constraints(parser): if has_subparsers(parser._actions): if has_required(parser._actions): raise UnsupportedConfiguration( "Gooey doesn't currently support top level required arguments " "when subparsers are present.")
def assert_subparser_constraints(parser):
if has_subparsers(parser._actions): if has_required(parser._actions): raise UnsupportedConfiguration( "Gooey doesn't currently support top level required arguments " "when subparsers are present.")
group._group_actions] corrected_action_groups = reapply_mutex_groups(mutex_groups, raw_action_groups) return categorize2(strip_empty(corrected_action_groups), widget_dict, options) def strip_empty(groups): return [group for group in groups if group['items']] def assert_subparser_constraints(parser)...
63
64
52
7
56
nelsonjchen/Gooey
gooey/python_bindings/argparse_to_json.py
Python
assert_subparser_constraints
assert_subparser_constraints
98
103
98
98
bd4a89675f44607b9e2b952a0949ffd2e658575c
bigcode/the-stack
train
3f1736c925c5935eaf2d3e9f
train
function
def action_to_json(action, widget, options): if action.required: # check that it's present and not just spaces validator = 'user_input and not user_input.isspace()' error_msg = 'This field is required' else: # not required; do nothing; validator = 'True' e...
def action_to_json(action, widget, options):
if action.required: # check that it's present and not just spaces validator = 'user_input and not user_input.isspace()' error_msg = 'This field is required' else: # not required; do nothing; validator = 'True' error_msg = '' base = merge(item_default...
'options': getattr(mutex_group, 'gooey_options', {}), 'data': { 'commands': [action.option_strings for action in mutex_group._group_actions], 'widgets': list(categorize(mutex_group._group_actions, widget_group, options)) } } def action_to_json(action, widget, options):
72
72
242
10
62
nelsonjchen/Gooey
gooey/python_bindings/argparse_to_json.py
Python
action_to_json
action_to_json
312
345
312
312
93c9c399e03873a35288cb9ccb29b809541d0e2d
bigcode/the-stack
train
f86ca26e5c845a1ef31068e1
train
function
def reapply_mutex_groups(mutex_groups, action_groups): # argparse stores mutually exclusive groups independently # of all other groups. So, they must be manually re-combined # with the groups/subgroups to which they were originally declared # in order to have them appear in the correct location in t...
def reapply_mutex_groups(mutex_groups, action_groups): # argparse stores mutually exclusive groups independently # of all other groups. So, they must be manually re-combined # with the groups/subgroups to which they were originally declared # in order to have them appear in the correct location in t...
def swap_actions(actions): for mutexgroup in mutex_groups: mutex_actions = mutexgroup._group_actions if contains_actions(mutex_actions, actions): # make a best guess as to where we should store the group targetindex = actions.index(mutexgroup._gro...
def reapply_mutex_groups(mutex_groups, action_groups): # argparse stores mutually exclusive groups independently # of all other groups. So, they must be manually re-combined # with the groups/subgroups to which they were originally declared # in order to have them appear in the correct location in t...
107
72
243
107
0
nelsonjchen/Gooey
gooey/python_bindings/argparse_to_json.py
Python
reapply_mutex_groups
reapply_mutex_groups
150
173
150
158
886344fc6e75ed6563a0771b064112c0f6015246
bigcode/the-stack
train
d7a56626db30097fbadd965f
train
function
def process(parser, widget_dict, options): mutex_groups = parser._mutually_exclusive_groups raw_action_groups = [extract_groups(group) for group in parser._action_groups if group._group_actions] corrected_action_groups = reapply_mutex_groups(mutex_groups, raw_action_groups) ...
def process(parser, widget_dict, options):
mutex_groups = parser._mutually_exclusive_groups raw_action_groups = [extract_groups(group) for group in parser._action_groups if group._group_actions] corrected_action_groups = reapply_mutex_groups(mutex_groups, raw_action_groups) return categorize2(strip_empty(corrected_...
(sub_parser, 'widgets', {}), getattr(sub_parser, 'options', {})) }) for name, sub_parser in iter_parsers(parser)) } if kwargs.get('use_legacy_titles'): return apply_default_rewrites(x) return x def process(parser, widget_dict, options):
64
64
79
9
54
nelsonjchen/Gooey
gooey/python_bindings/argparse_to_json.py
Python
process
process
86
92
86
86
1fb79bcc3c7b7c5221cc923b7024ca70f6ebb70c
bigcode/the-stack
train
6a21bfcaf8e377a8a074ef05
train
function
def extract_groups(action_group): ''' Recursively extract argument groups and associated actions from ParserGroup objects ''' return { 'name': action_group.title, 'description': action_group.description, 'items': [action for action in action_group._group_actions ...
def extract_groups(action_group):
''' Recursively extract argument groups and associated actions from ParserGroup objects ''' return { 'name': action_group.title, 'description': action_group.description, 'items': [action for action in action_group._group_actions if not is_help_messag...
arguments " "when subparsers are present.") def iter_parsers(parser): ''' Iterate over name, parser pairs ''' try: return get_subparser(parser._actions).choices.items() except: return iter([('::gooey/default', parser)]) def extract_groups(action_group):
63
64
110
6
57
nelsonjchen/Gooey
gooey/python_bindings/argparse_to_json.py
Python
extract_groups
extract_groups
114
128
114
114
367b96029bd3c7a1a575ddceaf39723ad6bd3306
bigcode/the-stack
train
d23d0515fda041698ed3a333
train
function
def is_flag(action): """ _actions which are either storeconst, store_bool, etc.. """ action_types = [_StoreTrueAction, _StoreFalseAction, _StoreConstAction] return any(list(map(lambda Action: isinstance(action, Action), action_types)))
def is_flag(action):
""" _actions which are either storeconst, store_bool, etc.. """ action_types = [_StoreTrueAction, _StoreFalseAction, _StoreConstAction] return any(list(map(lambda Action: isinstance(action, Action), action_types)))
= ( _StoreConstAction, _StoreFalseAction, _StoreTrueAction ) return (not action.choices and not isinstance(action, _CountAction) and not isinstance(action, _HelpAction) and type(action) not in boolean_actions) def is_flag(action):
64
64
56
5
59
nelsonjchen/Gooey
gooey/python_bindings/argparse_to_json.py
Python
is_flag
is_flag
274
277
274
274
64e3b0f876f8df9793ca148041bbf697b5341280
bigcode/the-stack
train
2dcbdcc8af809154c655effe
train
function
def categorize2(groups, widget_dict, options): return [{ 'name': group['name'], 'items': list(categorize(group['items'], widget_dict, options)), 'groups': categorize2(group['groups'], widget_dict, options), 'description': group['description'], 'options': group['options'...
def categorize2(groups, widget_dict, options):
return [{ 'name': group['name'], 'items': list(categorize(group['items'], widget_dict, options)), 'groups': categorize2(group['groups'], widget_dict, options), 'description': group['description'], 'options': group['options'] } for group in groups]
# remove the duplicated individual actions return [action for action in actions if action not in mutex_actions] return actions return [group.update({'items': swap_actions(group['items'])}) or group for group in action_groups] def categorize2(groups...
63
64
77
10
53
nelsonjchen/Gooey
gooey/python_bindings/argparse_to_json.py
Python
categorize2
categorize2
176
183
176
176
6b382c51fc0f9eff9decc07159cfeb1169329b1f
bigcode/the-stack
train
fb360a1f7d91434964bf800a
train
function
def is_choice(action): ''' action with choices supplied ''' return action.choices
def is_choice(action):
''' action with choices supplied ''' return action.choices
, actions))[0] def is_optional(action): ''' _actions either not possessing the `required` flag or implicitly optional through `nargs` being '*' or '?' ''' return (not action.required) or action.nargs in ['*', '?'] def is_choice(action):
63
64
18
5
58
nelsonjchen/Gooey
gooey/python_bindings/argparse_to_json.py
Python
is_choice
is_choice
254
256
254
254
8b9a2dfb97addce598df2cdba08a123fb1228123
bigcode/the-stack
train
a9b215f040690f692538d86b
train
function
def choose_name(name, subparser): return name if is_default_progname(name, subparser) else subparser.prog
def choose_name(name, subparser):
return name if is_default_progname(name, subparser) else subparser.prog
return isinstance(action, _CountAction) def is_default_progname(name, subparser): return subparser.prog == '{} {}'.format(os.path.split(sys.argv[0])[-1], name) def is_help_message(action): return isinstance(action, _HelpAction) def choose_name(name, subparser):
64
64
27
8
56
nelsonjchen/Gooey
gooey/python_bindings/argparse_to_json.py
Python
choose_name
choose_name
293
294
293
293
3e83f4197ba68615a6807121ad49be8759e316cc
bigcode/the-stack
train
8b719e87953f5a971970a2e7
train
function
def strip_empty(groups): return [group for group in groups if group['items']]
def strip_empty(groups):
return [group for group in groups if group['items']]
raw_action_groups = [extract_groups(group) for group in parser._action_groups if group._group_actions] corrected_action_groups = reapply_mutex_groups(mutex_groups, raw_action_groups) return categorize2(strip_empty(corrected_action_groups), widget_dict, options) def strip_empt...
64
64
19
5
59
nelsonjchen/Gooey
gooey/python_bindings/argparse_to_json.py
Python
strip_empty
strip_empty
94
95
94
94
42ed2914f95834ac1040205ee9152fa565b2679f
bigcode/the-stack
train
b52d09a17142437814324ee4
train
function
def apply_default_rewrites(spec): top_level_subgroups = list(spec['widgets'].keys()) for subgroup in top_level_subgroups: path = ['widgets', subgroup, 'contents'] contents = getin(spec, path) for group in contents: if group['name'] == 'positional arguments': ...
def apply_default_rewrites(spec):
top_level_subgroups = list(spec['widgets'].keys()) for subgroup in top_level_subgroups: path = ['widgets', subgroup, 'contents'] contents = getin(spec, path) for group in contents: if group['name'] == 'positional arguments': group['name'] = 'Required A...
in action_group._group_actions if not is_help_message(action)], 'groups': [extract_groups(group) for group in action_group._action_groups], 'options': merge(group_defaults, getattr(action_group, 'gooey_options', {})) } def ap...
64
64
103
7
57
nelsonjchen/Gooey
gooey/python_bindings/argparse_to_json.py
Python
apply_default_rewrites
apply_default_rewrites
131
142
131
131
7911158a304b3fcbb100848f7dec7209a99836e3
bigcode/the-stack
train
71ec1da5916d6664e1d8f09a
train
function
def _from_pretrained(cls, *args, **kw): """Load a transformers model in TF2, with fallback to PyTorch weights.""" try: return cls.from_pretrained(*args, **kw) except OSError as e: logging.warning('Caught OSError loading model: %s', e) logging.warning( 'Re-trying to convert from PyTorch checkpo...
def _from_pretrained(cls, *args, **kw):
"""Load a transformers model in TF2, with fallback to PyTorch weights.""" try: return cls.from_pretrained(*args, **kw) except OSError as e: logging.warning('Caught OSError loading model: %s', e) logging.warning( 'Re-trying to convert from PyTorch checkpoint (from_pt=True)') return cls.from...
.api import model as lit_model from lit_nlp.api import types as lit_types from lit_nlp.examples.coref import retokenize from lit_nlp.lib import utils import numpy as np import tensorflow as tf import transformers def _from_pretrained(cls, *args, **kw):
64
64
103
13
50
johnson7788/lit
lit_nlp/examples/coref/encoders.py
Python
_from_pretrained
_from_pretrained
15
23
15
15
414034454c861e4df8078326372591db8ab88c0a
bigcode/the-stack
train
f396d46573366cbcccb0bc56
train
class
class BertEncoderWithOffsets(lit_model.Model): """BERT encoder for pre-tokenized text.""" @property def max_seq_length(self): return self.model.config.max_position_embeddings def __init__(self, model_name_or_path: str): self.tokenizer = transformers.AutoTokenizer.from_pretrained( model_name_or...
class BertEncoderWithOffsets(lit_model.Model):
"""BERT encoder for pre-tokenized text.""" @property def max_seq_length(self): return self.model.config.max_position_embeddings def __init__(self, model_name_or_path: str): self.tokenizer = transformers.AutoTokenizer.from_pretrained( model_name_or_path) self.model = _from_pretrained( ...
"""Encoder implementation for frozen-encoder coref.""" import os from typing import Dict from absl import logging from lit_nlp.api import model as lit_model from lit_nlp.api import types as lit_types from lit_nlp.examples.coref import retokenize from lit_nlp.lib import utils import numpy as np import tensorflow as tf ...
192
220
734
10
182
johnson7788/lit
lit_nlp/examples/coref/encoders.py
Python
BertEncoderWithOffsets
BertEncoderWithOffsets
26
108
26
26
e6e5cbb783e6ad620450bc2f5a42feb8c177b105
bigcode/the-stack
train
37ea2f466a2f394e7142bfbb
train
class
class Dependency: """ A python dependency object. Internal variables with `_reserved_` prefix are used for policy evaluation. """ _raw: str = "" _reserved_name: str = "" _version: str = "" _version_major: str = "" _version_minor: str = "" _version_release: str = "" _operato...
class Dependency:
""" A python dependency object. Internal variables with `_reserved_` prefix are used for policy evaluation. """ _raw: str = "" _reserved_name: str = "" _version: str = "" _version_major: str = "" _version_minor: str = "" _version_release: str = "" _operator: str = "" _f...
import dateutil.parser import json import pkgutil import re from packaging.specifiers import Version from packaging.version import parse from typing import Any, Dict, List, Union, Sequence, Tuple from ochrona.client import pypi_fetch PEP_SUPPORTED_OPERATORS = r"==|>=|<=|!=|~=|<|>" INVALID_SPEC_CHARACTERS = r"\'|\"|\...
154
256
1,506
3
151
pepastach/ochrona-cli
ochrona/model/dependency.py
Python
Dependency
Dependency
20
201
20
20
25198f8a9e508df6ab78c400d73ae7c254523357
bigcode/the-stack
train
19b32f808695072a978bd1e0
train
class
class DefaultDetector(AnomalyDetectorAlgorithm): """ Default detector. Not configurable. """ def __init__(self, time_series, baseline_time_series=None): """ Initializer :param TimeSeries time_series: a TimeSeries object. :param TimeSeries baseline_time_series: baseline TimeSeries. """ ...
class DefaultDetector(AnomalyDetectorAlgorithm):
""" Default detector. Not configurable. """ def __init__(self, time_series, baseline_time_series=None): """ Initializer :param TimeSeries time_series: a TimeSeries object. :param TimeSeries baseline_time_series: baseline TimeSeries. """ self.exp_avg_detector = ExpAvgDetector(time_serie...
agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. """ from exp_avg_detector import ExpAvgDetector from derivative_detector import DerivativeDetector from luminol.algorithms.anomaly_detector_algorithm...
93
93
311
9
83
RiteshMaheshwari/naarad
lib/luminol/src/luminol/algorithms/anomaly_detector_algorithms/default_detector.py
Python
DefaultDetector
DefaultDetector
19
48
19
20
177b69c019f0504236e4109499679b363db8c3ad
bigcode/the-stack
train
2c3ff4093dd613b350dc89c5
train
class
class PyPem(PythonPackage): """ pem is an MIT-licensed Python module for parsing and splitting of PEM files, i.e. Base64 encoded DER keys and certificates. """ homepage = "https://pem.readthedocs.io/en/stable/" url = "https://github.com/hynek/pem/archive/20.1.0.tar.gz" version('20.1.0...
class PyPem(PythonPackage):
""" pem is an MIT-licensed Python module for parsing and splitting of PEM files, i.e. Base64 encoded DER keys and certificates. """ homepage = "https://pem.readthedocs.io/en/stable/" url = "https://github.com/hynek/pem/archive/20.1.0.tar.gz" version('20.1.0', sha256='140df7388f72bdf95...
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class PyPem(PythonPackage):
61
179
597
7
54
player1537-forks/spack
var/spack/repos/builtin/packages/py-pem/package.py
Python
PyPem
PyPem
9
29
9
9
a2f31f3a65a11c8e954bab7ae7f4f7e72481e520
bigcode/the-stack
train
ed825f6d14f17e571b408c40
train
class
class TestDataTable: def test_ctor(self, DataTable): table = DataTable() xml = tostring(table.to_tree()) expected = """ <dTable /> """ diff = compare_xml(xml, expected) assert diff is None, diff def test_from_xml(self, DataTable): src = """ ...
class TestDataTable:
def test_ctor(self, DataTable): table = DataTable() xml = tostring(table.to_tree()) expected = """ <dTable /> """ diff = compare_xml(xml, expected) assert diff is None, diff def test_from_xml(self, DataTable): src = """ <dTable /> ...
Id == [211326240, 211330000] assert chart.x_axis.axId == 211326240 assert chart.y_axis.axId == 211330000 @pytest.fixture def DataTable(): from ..plotarea import DataTable return DataTable class TestDataTable:
64
64
100
5
58
mr-love/openpyxl
openpyxl/chart/tests/test_plotarea.py
Python
TestDataTable
TestDataTable
130
148
130
131
9769d5dbffa1323de9351198ba29ee4892258cb3
bigcode/the-stack
train
dfa62ba363d635524685f0a4
train
class
class TestPlotArea: def test_ctor(self, PlotArea): plot = PlotArea() xml = tostring(plot.to_tree()) expected = """ <plotArea /> """ diff = compare_xml(xml, expected) assert diff is None, diff def test_from_xml(self, PlotArea): src = """ ...
class TestPlotArea:
def test_ctor(self, PlotArea): plot = PlotArea() xml = tostring(plot.to_tree()) expected = """ <plotArea /> """ diff = compare_xml(xml, expected) assert diff is None, diff def test_from_xml(self, PlotArea): src = """ <plotArea /> ...
from __future__ import absolute_import # Copyright (c) 2010-2018 openpyxl import pytest from openpyxl.xml.functions import fromstring, tostring from openpyxl.tests.helper import compare_xml from ..line_chart import LineChart from ..bar_chart import BarChart @pytest.fixture def PlotArea(): from ..plotarea impor...
90
253
846
5
84
mr-love/openpyxl
openpyxl/chart/tests/test_plotarea.py
Python
TestPlotArea
TestPlotArea
19
121
19
20
ef83f7d9d290de2abd19db8631e8a6c6df041084
bigcode/the-stack
train
d791ffb01f76ee911b6745cb
train
function
@pytest.fixture def DataTable(): from ..plotarea import DataTable return DataTable
@pytest.fixture def DataTable():
from ..plotarea import DataTable return DataTable
PlotArea.from_tree(tree) chart = plot._charts[0] assert chart.axId == [211326240, 211330000] assert chart.x_axis.axId == 211326240 assert chart.y_axis.axId == 211330000 @pytest.fixture def DataTable():
64
64
21
7
56
mr-love/openpyxl
openpyxl/chart/tests/test_plotarea.py
Python
DataTable
DataTable
124
127
124
125
27520083095ac2ab02aa281a1088f38af67f5fee
bigcode/the-stack
train
de52a9963a8eca6a15d5ff15
train
function
@pytest.fixture def PlotArea(): from ..plotarea import PlotArea return PlotArea
@pytest.fixture def PlotArea():
from ..plotarea import PlotArea return PlotArea
# Copyright (c) 2010-2018 openpyxl import pytest from openpyxl.xml.functions import fromstring, tostring from openpyxl.tests.helper import compare_xml from ..line_chart import LineChart from ..bar_chart import BarChart @pytest.fixture def PlotArea():
64
64
21
7
56
mr-love/openpyxl
openpyxl/chart/tests/test_plotarea.py
Python
PlotArea
PlotArea
13
16
13
14
ad31cc45e2e23abf915b286dcfdab3dffefb0af0
bigcode/the-stack
train
802a933fad99e5e4925a4058
train
class
class GetMemberServerImageListRequest(object): """NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ """ Attributes: swagger_types (dict): The key is attribute name and the value is attribute type. a...
class GetMemberServerImageListRequest(object):
"""NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ """ Attributes: swagger_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name ...
# coding: utf-8 """ server Generated by: https://github.com/swagger-api/swagger-codegen.git """ import pprint import re # noqa: F401 import six class GetMemberServerImageListRequest(object):
52
256
2,019
9
42
NaverCloudPlatform/ncloud-sdk-python
lib/services/server/ncloud_server/model/get_member_server_image_list_request.py
Python
GetMemberServerImageListRequest
GetMemberServerImageListRequest
17
279
17
17
91922738c34317f330b9380004d167fa34cd537d
bigcode/the-stack
train
2c71fe32989d648d3af02e4a
train
function
def get_page_content(url, timeout=1): """ get page `content` and `content-length` from html request """ response = requests.get(url, timeout=timeout) content = response.content.decode(response.encoding).encode('utf-8') try: content_length = int(response.headers.get('content-length')) ...
def get_page_content(url, timeout=1):
""" get page `content` and `content-length` from html request """ response = requests.get(url, timeout=timeout) content = response.content.decode(response.encoding).encode('utf-8') try: content_length = int(response.headers.get('content-length')) except TypeError: content_len...
datefmt='%Y-%m-%d %H:%M:%S', format='%(asctime)s - %(name)s - %(levelname)s - %(message)s' ) logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) def get_page_content(url, timeout=1):
64
64
92
10
54
horizon3385/websiteClassifier
parseRawData/parseRawXML.py
Python
get_page_content
get_page_content
18
29
18
18
7840756eed77e6b90f0671799cf2538543b4338c
bigcode/the-stack
train
1d9941c6e22b7e13db3298e5
train
function
def extract_xml(markup): """ Extract `url`, `title`, 'description`, and `topic` from XML 'ExternalPage' markup """ soup = BeautifulSoup(markup, 'lxml') tag = soup.externalpage result = dict() result['url'] = tag['about'] result['title'] = tag.title.text result['description'] = tag.d...
def extract_xml(markup):
""" Extract `url`, `title`, 'description`, and `topic` from XML 'ExternalPage' markup """ soup = BeautifulSoup(markup, 'lxml') tag = soup.externalpage result = dict() result['url'] = tag['about'] result['title'] = tag.title.text result['description'] = tag.description.text resul...
(url, timeout=timeout) content = response.content.decode(response.encoding).encode('utf-8') try: content_length = int(response.headers.get('content-length')) except TypeError: content_length = None response.close() return content, content_length def extract_xml(markup):
64
64
208
6
57
horizon3385/websiteClassifier
parseRawData/parseRawXML.py
Python
extract_xml
extract_xml
32
57
32
32
37c6471a00107a40215a70fb02e34c2343ed9b90
bigcode/the-stack
train
04f8b740ac25cb719acb35a1
train
function
def main(argv): cnt = 0 xml = '' trigger = False with sys.stdin as f: for line in f: # set up start tag if '<ExternalPage' in line: trigger = True # set up close tag elif '</ExternalPage>' in line: cnt += 1 ...
def main(argv):
cnt = 0 xml = '' trigger = False with sys.stdin as f: for line in f: # set up start tag if '<ExternalPage' in line: trigger = True # set up close tag elif '</ExternalPage>' in line: cnt += 1 trigger =...
EncodeError\t%s' % result['url']) return except Exception as e: logger.warning('%s\t%s' % (e, result['url'])) return result['content'] = content result['content_length'] = content_length return result def main(argv):
64
64
154
4
59
horizon3385/websiteClassifier
parseRawData/parseRawXML.py
Python
main
main
60
84
60
61
b3b7e9cfe13773a4ce83566e499adb8e83859146
bigcode/the-stack
train
b531a3f6c61d6d1a87a2fd04
train
function
def nf_slug(name): """ National Forest related slug generation. """ deletes = [ 'District', 'Office', 'Ranger Station', 'Information Center', 'NF', "Visitor's Center", "Management Unit", 'Visitor Center', 'Nature Center'] name = delete_from(name, deletes) return slugify('nf %s' ...
def nf_slug(name):
""" National Forest related slug generation. """ deletes = [ 'District', 'Office', 'Ranger Station', 'Information Center', 'NF', "Visitor's Center", "Management Unit", 'Visitor Center', 'Nature Center'] name = delete_from(name, deletes) return slugify('nf %s' % name)
'NWR', 'Complex', 'District', 'National Wildlife Refuge', '(also sold at fee booth)', 'National Wildlife & Fish Refuge', 'Fish and Wildlife Service'] name = delete_from(name, deletes) return slugify('nwr %s' % name) def nf_slug(name):
64
64
77
5
59
OpenGlobe/OpenGlobeEKiPAPI
ekip/nationalparks/management/commands/slugify.py
Python
nf_slug
nf_slug
27
35
27
27
aa8b92f86a5b7abf6b644d5c377f5810f671fe39
bigcode/the-stack
train
2e7b8a5df539e2ee369b20a9
train
function
def blm_slug(name): """ BLM related slug generation. """ deletes = [ 'BLM', 'Field', 'Office', 'District', 'National', 'Historic', 'Monument'] name = delete_from(name, deletes) return slugify('blm %s' % name)
def blm_slug(name):
""" BLM related slug generation. """ deletes = [ 'BLM', 'Field', 'Office', 'District', 'National', 'Historic', 'Monument'] name = delete_from(name, deletes) return slugify('blm %s' % name)
slugify('nps %s' % components[0]) def nps_name_slug(name): deletes = [ 'Recreation Area', 'National River' ] name = delete_from(name, deletes) return slugify('nps %s' % name) def blm_slug(name):
64
64
66
6
58
OpenGlobe/OpenGlobeEKiPAPI
ekip/nationalparks/management/commands/slugify.py
Python
blm_slug
blm_slug
54
60
54
54
1b56256f919ac88da240cf8b66efca19bddf8f60
bigcode/the-stack
train
0233908cfb6d3b7092a3282c
train
function
def nps_name_slug(name): deletes = [ 'Recreation Area', 'National River' ] name = delete_from(name, deletes) return slugify('nps %s' % name)
def nps_name_slug(name):
deletes = [ 'Recreation Area', 'National River' ] name = delete_from(name, deletes) return slugify('nps %s' % name)
_slug(nps_url): """ National Park Service related slug generation. """ path = urlparse(nps_url).path components = [i for i in path.split('/') if i != ''] return slugify('nps %s' % components[0]) def nps_name_slug(name):
64
64
45
7
57
OpenGlobe/OpenGlobeEKiPAPI
ekip/nationalparks/management/commands/slugify.py
Python
nps_name_slug
nps_name_slug
46
51
46
46
725c7c55c0e67e3e17b2c73995fe49ed83a55fdf
bigcode/the-stack
train