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
cf6d843dde5b89cdfcbacdf9
train
function
def check_keyword(error_type, keyword, value): assert_raises(error_type, scs.solve, data, cone, **{keyword: value})
def check_keyword(error_type, keyword, value):
assert_raises(error_type, scs.solve, data, cone, **{keyword: value})
use_indirect=False) yield check_solution, sol['x'][0], 0.5 sol = scs.solve(data, new_cone, use_indirect=True) yield check_solution, sol['x'][0], 0.5 def check_keyword(error_type, keyword, value):
64
64
31
10
53
alexfrolov/scs-python
test/test_scs_basic.py
Python
check_keyword
check_keyword
85
86
85
85
f21ab46d2da9f900b8939e57be28bc54fcf9cb32
bigcode/the-stack
train
0bd708264f45b6bdc3f32a00
train
class
class Multinomial(base.DiscreteDistribution): """Multinomial distribution for categorical data. Parameters ---------- events An optional list of events that already occurred. Examples -------- >>> from river import proba >>> p = proba.Multinomial(['green'] * 3) >>> p = p....
class Multinomial(base.DiscreteDistribution):
"""Multinomial distribution for categorical data. Parameters ---------- events An optional list of events that already occurred. Examples -------- >>> from river import proba >>> p = proba.Multinomial(['green'] * 3) >>> p = p.update('red') >>> p.pmf('red') 0.25 ...
import collections import typing from . import base __all__ = ['Multinomial'] class Multinomial(base.DiscreteDistribution):
29
99
330
9
20
brcharron/creme
river/proba/multinomial.py
Python
Multinomial
Multinomial
10
64
10
10
cef2cabe5af663fd278c0d264432dc2f8688b557
bigcode/the-stack
train
f4eb5e0f1706a270e509abcf
train
function
def test_jurisdiction_detail_by_jid(client): response = client.get( "/jurisdictions/ocd-jurisdiction/country:us/state:ne/government" ).json() assert response == NEBRASKA_RESPONSE assert query_logger.count == 1
def test_jurisdiction_detail_by_jid(client):
response = client.get( "/jurisdictions/ocd-jurisdiction/country:us/state:ne/government" ).json() assert response == NEBRASKA_RESPONSE assert query_logger.count == 1
assert query_logger.count == 1 def test_jurisdiction_detail_by_name(client): response = client.get("/jurisdictions/Nebraska").json() assert response == NEBRASKA_RESPONSE assert query_logger.count == 1 def test_jurisdiction_detail_by_jid(client):
64
64
61
11
52
johnseekins/api-v3
api/tests/test_jurisdictions.py
Python
test_jurisdiction_detail_by_jid
test_jurisdiction_detail_by_jid
136
141
136
136
1d8e53b8a72b083e66901635cacb7d13104d5b13
bigcode/the-stack
train
3d73d3dcd2b525ac36cec165
train
function
def test_jurisdiction_detail_by_name(client): response = client.get("/jurisdictions/Nebraska").json() assert response == NEBRASKA_RESPONSE assert query_logger.count == 1
def test_jurisdiction_detail_by_name(client):
response = client.get("/jurisdictions/Nebraska").json() assert response == NEBRASKA_RESPONSE assert query_logger.count == 1
08-02T00:00:00", } def test_jurisdiction_detail_by_abbr(client): response = client.get("/jurisdictions/ne").json() assert response == NEBRASKA_RESPONSE assert query_logger.count == 1 def test_jurisdiction_detail_by_name(client):
64
64
44
10
53
johnseekins/api-v3
api/tests/test_jurisdictions.py
Python
test_jurisdiction_detail_by_name
test_jurisdiction_detail_by_name
130
133
130
130
72f6e93b6d76cd881e8a81bb31fb2b982592402b
bigcode/the-stack
train
1b037c13682f8eefbae031db
train
function
def test_jurisdiction_include_organizations(client): response = client.get( "/jurisdictions?classification=state&per_page=1&include=organizations" ) response = response.json() # is included, organizations are inline assert query_logger.count == 4 assert len(response["results"][0]["organi...
def test_jurisdiction_include_organizations(client):
response = client.get( "/jurisdictions?classification=state&per_page=1&include=organizations" ) response = response.json() # is included, organizations are inline assert query_logger.count == 4 assert len(response["results"][0]["organizations"]) == 2 assert response["results"][0]["or...
== 2 assert query_logger.count == 2 response = client.get("/jurisdictions?classification=municipality") response = response.json() assert len(response["results"]) == 1 assert query_logger.count == 2 def test_jurisdiction_include_organizations(client):
64
64
176
10
53
johnseekins/api-v3
api/tests/test_jurisdictions.py
Python
test_jurisdiction_include_organizations
test_jurisdiction_include_organizations
34
54
34
34
c0a8c1082dc6f237ad80492184bdde00f2621a85
bigcode/the-stack
train
50d68421f560c5f15f049976
train
function
def test_jurisdiction_detail_404(client): response = client.get("/jurisdictions/xy") assert response.status_code == 404 assert response.json() == {"detail": "No such Jurisdiction."}
def test_jurisdiction_detail_404(client):
response = client.get("/jurisdictions/xy") assert response.status_code == 404 assert response.json() == {"detail": "No such Jurisdiction."}
_jid(client): response = client.get( "/jurisdictions/ocd-jurisdiction/country:us/state:ne/government" ).json() assert response == NEBRASKA_RESPONSE assert query_logger.count == 1 def test_jurisdiction_detail_404(client):
64
64
47
10
53
johnseekins/api-v3
api/tests/test_jurisdictions.py
Python
test_jurisdiction_detail_404
test_jurisdiction_detail_404
144
147
144
144
81ee3f0a8abfc04b19ca3ebe909d722354e444b4
bigcode/the-stack
train
30f7cad8f1feb21704c1ec91
train
function
def test_jurisdiction_include_sessions(client): response = client.get( "/jurisdictions?classification=state&per_page=1&include=legislative_sessions" ) response = response.json() # is included, legislative sessions are inline assert query_logger.count == 4 assert len(response["results"][0...
def test_jurisdiction_include_sessions(client):
response = client.get( "/jurisdictions?classification=state&per_page=1&include=legislative_sessions" ) response = response.json() # is included, legislative sessions are inline assert query_logger.count == 4 assert len(response["results"][0]["legislative_sessions"]) == 2 assert respo...
&per_page=1&include=latest_runs" ) response = response.json() # is included, but the field is empty assert len(response["results"][0]["latest_runs"]) == 0 assert query_logger.count == 3 def test_jurisdiction_include_sessions(client):
64
64
215
9
54
johnseekins/api-v3
api/tests/test_jurisdictions.py
Python
test_jurisdiction_include_sessions
test_jurisdiction_include_sessions
88
110
88
88
f52367861b27fa1ba0e0a619efbf1c38d47fd4d1
bigcode/the-stack
train
285f499dddf3592c9c254987
train
function
def test_jurisdiction_include_organizations_empty(client): response = client.get( "/jurisdictions?classification=municipality&per_page=1&include=organizations" ) response = response.json() # is included, but the field is empty assert len(response["results"][0]["organizations"]) == 0 asse...
def test_jurisdiction_include_organizations_empty(client):
response = client.get( "/jurisdictions?classification=municipality&per_page=1&include=organizations" ) response = response.json() # is included, but the field is empty assert len(response["results"][0]["organizations"]) == 0 assert query_logger.count == 3
"label": "1", "division_id": "ocd-division/country:us/state:ne/sldu:1", "role": "Senator", "maximum_memberships": 1, }, ], } def test_jurisdiction_include_organizations_empty(client):
64
64
80
11
53
johnseekins/api-v3
api/tests/test_jurisdictions.py
Python
test_jurisdiction_include_organizations_empty
test_jurisdiction_include_organizations_empty
57
64
57
57
fff870bf3dfa53119b370a97fb517d19ee3db00d
bigcode/the-stack
train
f90b7f6620b097e303486812
train
function
def test_jurisdictions_filter(client): response = client.get("/jurisdictions?classification=state") response = response.json() assert len(response["results"]) == 2 assert query_logger.count == 2 response = client.get("/jurisdictions?classification=municipality") response = response.json() as...
def test_jurisdictions_filter(client):
response = client.get("/jurisdictions?classification=state") response = response.json() assert len(response["results"]) == 2 assert query_logger.count == 2 response = client.get("/jurisdictions?classification=municipality") response = response.json() assert len(response["results"]) == 1 ...
"latest_bill_update": "2021-08-04T00:00:00", "latest_people_update": "2021-08-05T00:00:00", # note that organizations are not included here as a key } def test_jurisdictions_filter(client):
64
64
90
9
55
johnseekins/api-v3
api/tests/test_jurisdictions.py
Python
test_jurisdictions_filter
test_jurisdictions_filter
23
31
23
23
03f7625f4c23c1c73c989f26daae766794f29b6b
bigcode/the-stack
train
a3338c3ec7f45cae8a25fe50
train
function
def test_jurisdictions_simplest(client): response = client.get("/jurisdictions") assert query_logger.count == 2 response = response.json() assert len(response["results"]) == 3 assert response["results"][0]["name"] == "Mentor" assert response["results"][1]["name"] == "Nebraska" assert respons...
def test_jurisdictions_simplest(client):
response = client.get("/jurisdictions") assert query_logger.count == 2 response = response.json() assert len(response["results"]) == 3 assert response["results"][0]["name"] == "Mentor" assert response["results"][1]["name"] == "Nebraska" assert response["results"][2] == { "id": "ocd-j...
from .conftest import query_logger def test_jurisdictions_simplest(client):
20
64
205
11
8
johnseekins/api-v3
api/tests/test_jurisdictions.py
Python
test_jurisdictions_simplest
test_jurisdictions_simplest
4
20
4
4
933e6d12bbbdd07f59709fad5d38ad430a7b3ee0
bigcode/the-stack
train
e94b3f409a0832b1dbc622fe
train
function
def test_jurisdiction_include_latest_runs(client): response = client.get("/jurisdictions/ne?include=latest_runs").json() assert len(response["latest_runs"]) == 20 assert query_logger.count == 2
def test_jurisdiction_include_latest_runs(client):
response = client.get("/jurisdictions/ne?include=latest_runs").json() assert len(response["latest_runs"]) == 20 assert query_logger.count == 2
"No such Jurisdiction."} def test_jurisdiction_include_orgs(client): response = client.get("/jurisdictions/ne?include=organizations").json() assert len(response["organizations"]) == 2 assert query_logger.count == 3 def test_jurisdiction_include_latest_runs(client):
64
64
49
10
53
johnseekins/api-v3
api/tests/test_jurisdictions.py
Python
test_jurisdiction_include_latest_runs
test_jurisdiction_include_latest_runs
156
159
156
156
c30a37731749cf3e4818258ad37e7ab71d6e2ae6
bigcode/the-stack
train
b7d30cb9b362e3f291154496
train
function
def test_jurisdictions_include_runs(client): response = client.get( "/jurisdictions?classification=state&per_page=5&include=latest_runs" ) response = response.json() # is included, but the field is empty assert len(response["results"][0]["latest_runs"]) == 20 # this necessarily does N+1 ...
def test_jurisdictions_include_runs(client):
response = client.get( "/jurisdictions?classification=state&per_page=5&include=latest_runs" ) response = response.json() # is included, but the field is empty assert len(response["results"][0]["latest_runs"]) == 20 # this necessarily does N+1 queries, might need to restrict assert qu...
ality&per_page=1&include=organizations" ) response = response.json() # is included, but the field is empty assert len(response["results"][0]["organizations"]) == 0 assert query_logger.count == 3 def test_jurisdictions_include_runs(client):
64
64
95
10
53
johnseekins/api-v3
api/tests/test_jurisdictions.py
Python
test_jurisdictions_include_runs
test_jurisdictions_include_runs
67
75
67
67
c001ebba8957a16970893bad27b0141f7eed0029
bigcode/the-stack
train
6dbbfaff4a03221fa9fa2fa6
train
function
def test_jurisdiction_include_orgs(client): response = client.get("/jurisdictions/ne?include=organizations").json() assert len(response["organizations"]) == 2 assert query_logger.count == 3
def test_jurisdiction_include_orgs(client):
response = client.get("/jurisdictions/ne?include=organizations").json() assert len(response["organizations"]) == 2 assert query_logger.count == 3
query_logger.count == 1 def test_jurisdiction_detail_404(client): response = client.get("/jurisdictions/xy") assert response.status_code == 404 assert response.json() == {"detail": "No such Jurisdiction."} def test_jurisdiction_include_orgs(client):
64
64
47
10
54
johnseekins/api-v3
api/tests/test_jurisdictions.py
Python
test_jurisdiction_include_orgs
test_jurisdiction_include_orgs
150
153
150
150
e524766dceac1a03e8a5d9c298e1a79395d319f1
bigcode/the-stack
train
1d1e6cca7771ed5f9a9e276b
train
function
def test_jurisdiction_detail_by_abbr(client): response = client.get("/jurisdictions/ne").json() assert response == NEBRASKA_RESPONSE assert query_logger.count == 1
def test_jurisdiction_detail_by_abbr(client):
response = client.get("/jurisdictions/ne").json() assert response == NEBRASKA_RESPONSE assert query_logger.count == 1
"url": "https://nebraska.gov", "latest_bill_update": "2021-08-01T00:00:00", "latest_people_update": "2021-08-02T00:00:00", } def test_jurisdiction_detail_by_abbr(client):
64
64
43
11
53
johnseekins/api-v3
api/tests/test_jurisdictions.py
Python
test_jurisdiction_detail_by_abbr
test_jurisdiction_detail_by_abbr
124
127
124
124
02fa84f6878a51a9d5a61fc11b965ae9fbb2a176
bigcode/the-stack
train
74fa3fe36afa57e6b30e4b69
train
function
def test_jurisdictions_include_runs_empty(client): response = client.get( "/jurisdictions?classification=municipality&per_page=1&include=latest_runs" ) response = response.json() # is included, but the field is empty assert len(response["results"][0]["latest_runs"]) == 0 assert query_log...
def test_jurisdictions_include_runs_empty(client):
response = client.get( "/jurisdictions?classification=municipality&per_page=1&include=latest_runs" ) response = response.json() # is included, but the field is empty assert len(response["results"][0]["latest_runs"]) == 0 assert query_logger.count == 3
.json() # is included, but the field is empty assert len(response["results"][0]["latest_runs"]) == 20 # this necessarily does N+1 queries, might need to restrict assert query_logger.count == 4 def test_jurisdictions_include_runs_empty(client):
64
64
82
11
52
johnseekins/api-v3
api/tests/test_jurisdictions.py
Python
test_jurisdictions_include_runs_empty
test_jurisdictions_include_runs_empty
78
85
78
78
1b0b8db0c3bc60f82b109f4d5e081c24881baccf
bigcode/the-stack
train
e8c60edf266a0fe08e5dfdce
train
function
def _process_zip_files(zip_files): out_dirs = [] for z in zip_files: out_path = '.'.join(z.split('.')[:-1]) make_dir(out_path) zhandle = ZipFile(z) zhandle.extractall(out_path) out_dirs.append(out_path) return out_dirs
def _process_zip_files(zip_files):
out_dirs = [] for z in zip_files: out_path = '.'.join(z.split('.')[:-1]) make_dir(out_path) zhandle = ZipFile(z) zhandle.extractall(out_path) out_dirs.append(out_path) return out_dirs
str(s.seq)) for s in seqs] ofile = os.path.basename(os.path.normpath(d)) + '.fasta' opath = os.path.join(output, ofile) open(opath, 'w').write('\n'.join(fastas)) def _process_zip_files(zip_files):
64
64
67
8
56
menis/abtools
abtools/utils/convert.py
Python
_process_zip_files
_process_zip_files
62
70
62
62
4a6cc6bc77a035a32fabff2802dc8bcdae3bc077
bigcode/the-stack
train
78349e8251a03e5299d1c1eb
train
function
def abi_to_fasta(input, output): ''' Converts ABI or AB1 files to FASTA format. Args: input (str): Path to a file or directory containing abi/ab1 files or zip archives of abi/ab1 files output (str): Path to a directory for the output FASTA files ''' direcs = [input, ]...
def abi_to_fasta(input, output):
''' Converts ABI or AB1 files to FASTA format. Args: input (str): Path to a file or directory containing abi/ab1 files or zip archives of abi/ab1 files output (str): Path to a directory for the output FASTA files ''' direcs = [input, ] # unzip any zip archives ...
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # from itertools import chain import os from zipfile import ZipFile from Bio import SeqIO from abtools.pipeline import list_files, make_dir def abi_to_fasta(input, output):...
73
73
245
9
63
menis/abtools
abtools/utils/convert.py
Python
abi_to_fasta
abi_to_fasta
35
59
35
35
2024235aea6fb0c04b48e8110e5fc684123f08df
bigcode/the-stack
train
6ff55f4437adc77c7c5fbf27
train
class
class H5FlowDatasetLoopGenerator(H5FlowGenerator): ''' Default dataset looping generator First copies input file to output file. Then slices up the dataset defined by ``dset_name`` into ``chunk_size`` chunks, separated by MPI rank. For some example use cases, the default configurat...
class H5FlowDatasetLoopGenerator(H5FlowGenerator):
''' Default dataset looping generator First copies input file to output file. Then slices up the dataset defined by ``dset_name`` into ``chunk_size`` chunks, separated by MPI rank. For some example use cases, the default configuration declaration:: flow: ...
import os import shutil import logging import h5py from h5flow import H5FLOW_MPI from h5flow.core import H5FlowGenerator from h5flow.data import H5FlowDataManager class H5FlowDatasetLoopGenerator(H5FlowGenerator):
59
194
647
12
46
peter-madigan/h5flow
h5flow/modules/h5_flow_dataset_loop_generator.py
Python
H5FlowDatasetLoopGenerator
H5FlowDatasetLoopGenerator
11
95
11
11
ca43bdd74cf28ccbd273be3a2fa2a2fcfc634aeb
bigcode/the-stack
train
61b163842b393550cc03ff9a
train
class
class OS(module.BaseModule): """ * {{os_name}} - get the pretty printed OS name """ HOSTNAME = "org.freedesktop.hostname1" def __init__(self): pass def hostname_props(self): bus = dbus.SystemBus() hostname1 = bus.get_object(OS.HOSTNAME, "/org/freedesktop/hostname1") ...
class OS(module.BaseModule):
""" * {{os_name}} - get the pretty printed OS name """ HOSTNAME = "org.freedesktop.hostname1" def __init__(self): pass def hostname_props(self): bus = dbus.SystemBus() hostname1 = bus.get_object(OS.HOSTNAME, "/org/freedesktop/hostname1") return dbus.Interface(h...
under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import dbus import module import logging class OS(module.BaseModule):
64
64
186
6
57
thingswise/tw-etcdstat
etcdstat/os_support.py
Python
OS
OS
19
46
19
20
74ebac642a195bc726a09355b50eb0b9d832c38b
bigcode/the-stack
train
d4d5be8f5ecb4a9662d7770e
train
class
@opresource(name='Tender Bids', collection_path='/tenders/{tender_id}/bids', path='/tenders/{tender_id}/bids/{bid_id}', procurementMethodType='belowThreshold', description="Tender bids") class TenderBidResource(object): def __init__(self, request, context): s...
@opresource(name='Tender Bids', collection_path='/tenders/{tender_id}/bids', path='/tenders/{tender_id}/bids/{bid_id}', procurementMethodType='belowThreshold', description="Tender bids") class TenderBidResource(object):
def __init__(self, request, context): self.request = request self.db = request.registry.db @json_view(content_type="application/json", permission='create_bid', validators=(validate_bid_data,)) def collection_post(self): """Registration of new bid proposal Creating new Bid p...
# -*- coding: utf-8 -*- from logging import getLogger from openprocurement.api.models import get_now from openprocurement.api.utils import ( save_tender, set_ownership, apply_patch, opresource, json_view, context_unpack, ) from openprocurement.api.validation import ( validate_bid_data, v...
145
256
2,326
59
86
Leits/openprocurement.api
src/openprocurement/api/views/bid.py
Python
TenderBidResource
TenderBidResource
21
309
21
27
14f82b8e3bcbdba92b3a23d14b8976bf8294e53a
bigcode/the-stack
train
5a1d5ef171166a2c9654a182
train
function
def motors_update(t, x, u, params={}): """ Motor dynamics for thrust control system Paramters --------- x: array System state: motors speed u: array System input: motors throttle (between 0 and 199999) Return ------ array [a1, a2, a3, a4] """ tm = params['mo...
def motors_update(t, x, u, params={}):
""" Motor dynamics for thrust control system Paramters --------- x: array System state: motors speed u: array System input: motors throttle (between 0 and 199999) Return ------ array [a1, a2, a3, a4] """ tm = params['motor']['tm'] # Motor torque consta...
import numpy as np import control as ct def motors_update(t, x, u, params={}):
22
64
170
12
9
tchamelot/drosix
model/motors.py
Python
motors_update
motors_update
5
27
5
5
0dbf9669693c9aa19c126eec3fb3316b449a443e
bigcode/the-stack
train
e8b806572fe7b782f85e7316
train
function
def motors_output(t, x, u, params={}): return x
def motors_output(t, x, u, params={}):
return x
['motor']['wb'] # Motor base speed u = np.clip(u, 0, 1) accel = [(cr * throttle + wb - speed) / tm for throttle, speed in zip(u, x)] return accel def motors_output(t, x, u, params={}):
64
64
16
12
51
tchamelot/drosix
model/motors.py
Python
motors_output
motors_output
30
31
30
30
b7ab07f2d07223bdb72a5c83824b10c8135965ed
bigcode/the-stack
train
588ef233320a2829a9d65261
train
function
def crop_images(preprocessing_output_path, resized_folder_path, crop_output_path): """ Function to extract the regions of interest from the camera trap images. Parameters ---------- preprocessing_output_path : string (filepath) path to folder containing the preprocessing output files r...
def crop_images(preprocessing_output_path, resized_folder_path, crop_output_path):
""" Function to extract the regions of interest from the camera trap images. Parameters ---------- preprocessing_output_path : string (filepath) path to folder containing the preprocessing output files resized_folder_path : string (filepath) path to folder with resized images cr...
import os from ast import literal_eval import pandas as pd from PIL import Image from preprocessing.def_functions import black_border def crop_images(preprocessing_output_path, resized_folder_path, crop_output_path):
44
84
281
17
26
inbo/MICA-beeldherkenning
src/preprocessing/crop_images.py
Python
crop_images
crop_images
8
40
8
9
cc8a9966d0fbb92da8936b46f75b07ec659f9130
bigcode/the-stack
train
bce30b1f5c65364934a6edfb
train
function
def _debugger_init(expr, stack): import pdb pdb.set_trace()
def _debugger_init(expr, stack):
import pdb pdb.set_trace()
License. # pylint: disable=wildcard-import, redefined-builtin, invalid-name """The Relay IR namespace containing the IR definition and compiler.""" from __future__ import absolute_import from ..api import register_func # pylint: disable=unused-argument def _debugger_init(expr, stack):
64
64
18
9
54
ravikumarvc/incubator-tvm
python/tvm/relay/debug.py
Python
_debugger_init
_debugger_init
24
26
24
24
12ba3369b6748fb3711eb225f9d128441e7cd25d
bigcode/the-stack
train
e7f99e81f603f1ffaf49ac45
train
function
@register_func("relay.debug") def _debug(*args): import pdb pdb.set_trace()
@register_func("relay.debug") def _debug(*args):
import pdb pdb.set_trace()
IR namespace containing the IR definition and compiler.""" from __future__ import absolute_import from ..api import register_func # pylint: disable=unused-argument def _debugger_init(expr, stack): import pdb pdb.set_trace() @register_func("relay.debug") def _debug(*args):
64
64
22
13
51
ravikumarvc/incubator-tvm
python/tvm/relay/debug.py
Python
_debug
_debug
28
31
28
29
803b12d6012eab55ea8456984d9f784ac49e4dca
bigcode/the-stack
train
486add1717f79e6798fc8ad8
train
function
@register_func("relay.debug_interp") def _debug_interp(*args): _, _, _, ist = args print("Relay Debugger") print(" You can manipulate the expression under evaluation with the name `expr`.") print(" You can manipulate the call stack with the name `stack`.") print("--------------") print("------...
@register_func("relay.debug_interp") def _debug_interp(*args):
_, _, _, ist = args print("Relay Debugger") print(" You can manipulate the expression under evaluation with the name `expr`.") print(" You can manipulate the call stack with the name `stack`.") print("--------------") print("--------------") _debugger_init(ist.current_expr, ist.stack)
def _debugger_init(expr, stack): import pdb pdb.set_trace() @register_func("relay.debug") def _debug(*args): import pdb pdb.set_trace() # pylint: disable=unused-argument @register_func("relay.debug_interp") def _debug_interp(*args):
64
64
88
15
48
ravikumarvc/incubator-tvm
python/tvm/relay/debug.py
Python
_debug_interp
_debug_interp
34
42
34
35
b857a421e33c08f8a0588a61ed965d9f3ad411e4
bigcode/the-stack
train
c6ab8ed8c1d14b8a0de3c3fd
train
function
def get_config(is_train): class General: log_frequency = 10 name = __name__.rsplit("/")[-1].rsplit(".")[-1] batch_image = 2 if is_train else 1 fp16 = False class KvstoreParam: kvstore = "nccl" batch_image = General.batch_image gpus = [0, 1, 2,...
def get_config(is_train):
class General: log_frequency = 10 name = __name__.rsplit("/")[-1].rsplit(".")[-1] batch_image = 2 if is_train else 1 fp16 = False class KvstoreParam: kvstore = "nccl" batch_image = General.batch_image gpus = [0, 1, 2, 3, 4, 5, 6, 7] fp...
from models.retinanet.builder import RetinaNet as Detector from models.retinanet.builder import MSRAResNet50V1FPN as Backbone from models.retinanet.builder import RetinaNetNeck as Neck from models.retinanet.builder import RetinaNetHead as RpnHead from mxnext.complicate import normalizer_factory def get_config(is_train)...
76
256
1,786
6
69
happywu/simpledet-1
config/retina_r50v1_fpn_1x.py
Python
get_config
get_config
8
258
8
8
65115538500088cc0a4fc764e9c758c01f7cda73
bigcode/the-stack
train
86c513c7f4c37d3e23253818
train
function
def cleanup_value(value): """Try and convert the given value to a float.""" value = value.strip() try: return float(value) except Exception: return value
def cleanup_value(value):
"""Try and convert the given value to a float.""" value = value.strip() try: return float(value) except Exception: return value
(sep='T') + "+00:00" url = "{}/{}/doc".format(self._host, index) headers = {"Cache-Control": "no-cache"} return requests.post(url, json=document, headers=headers) def close(self): self._zero() def cleanup_value(value):
64
64
39
5
59
martinslabber/opensp4000
scripts/parse_swift_bench.py
Python
cleanup_value
cleanup_value
85
91
85
85
237d17bf2864cc77d90a136d4506439c783e619d
bigcode/the-stack
train
a0601681f4a19ae50eb62575
train
function
def read_conf_file(filename): """Read the given config file and return the contents as a dict.""" info = {} filename = os.path.realpath(filename) if os.path.isfile(filename): _, ext = os.path.splitext(filename) if ext and ext.lower() == ".json": with open(filename) as fh: ...
def read_conf_file(filename):
"""Read the given config file and return the contents as a dict.""" info = {} filename = os.path.realpath(filename) if os.path.isfile(filename): _, ext = os.path.splitext(filename) if ext and ext.lower() == ".json": with open(filename) as fh: info = json.load(...
.post(url, json=document, headers=headers) def close(self): self._zero() def cleanup_value(value): """Try and convert the given value to a float.""" value = value.strip() try: return float(value) except Exception: return value def read_conf_file(filename):
64
64
132
6
57
martinslabber/opensp4000
scripts/parse_swift_bench.py
Python
read_conf_file
read_conf_file
94
109
94
94
6f2b2f096d7910b68e6ce4510ea0058a21f6326b
bigcode/the-stack
train
66c70efa72a9be07725b28f2
train
class
class SB2E: """Swift Bench to Elastic. This class processes lines from Ceph swift-bench command and inserts the metrics into an Elasticsearch instance. """ METHODS = ['GETS', 'PUTS', 'DEL'] def __init__(self, config, extra_info): self._host = config['url'] self._extra_info = ex...
class SB2E:
"""Swift Bench to Elastic. This class processes lines from Ceph swift-bench command and inserts the metrics into an Elasticsearch instance. """ METHODS = ['GETS', 'PUTS', 'DEL'] def __init__(self, config, extra_info): self._host = config['url'] self._extra_info = extra_info ...
#!/usr/bin/env python3 """This script parses the output of Ceph swift-bench and stores the results in Elasticsearch. Require a file ~/.config/elasticsearch.json with the config to connect to Elasticsearch. This file is JSON formatted and contains at least a URL field. Optional files can be given as command line argum...
134
145
486
5
128
martinslabber/opensp4000
scripts/parse_swift_bench.py
Python
SB2E
SB2E
21
82
21
21
1420facb5f38287a5fa4b00ffaa690c685a9b0cf
bigcode/the-stack
train
87e3258d35dbacee3a575775
train
function
def parse_args(): info = {} for filename in sys.argv[1:]: info.update(read_conf_file(filename)) return info
def parse_args():
info = {} for filename in sys.argv[1:]: info.update(read_conf_file(filename)) return info
json.load(fh) else: with open(filename) as fh: for line in fh.readlines(): if "=" in line and not line.startswith("#"): key, value = line.split("=", 1) info[key.strip()] = cleanup_value(value) return info def pa...
64
64
30
4
59
martinslabber/opensp4000
scripts/parse_swift_bench.py
Python
parse_args
parse_args
112
116
112
112
343046e3fd7adc50efbf9149013fa00486f17fbe
bigcode/the-stack
train
ab86ca9f295100d5069af4ff
train
function
def verySimpleNet(): if len(sys.argv) < 3: info( '*** Specify time [s] of simulation and lambda for poisson generators (requests/60s)! --> python very-simple-net-script.py <time> <lambda>...\n') return simulationTime = int(sys.argv[1]) lam = float(sys.argv[2]) info( '*** Star...
def verySimpleNet():
if len(sys.argv) < 3: info( '*** Specify time [s] of simulation and lambda for poisson generators (requests/60s)! --> python very-simple-net-script.py <time> <lambda>...\n') return simulationTime = int(sys.argv[1]) lam = float(sys.argv[2]) info( '*** Starting controller...\n') ...
#!/usr/bin/python from mininet.net import Mininet from mininet.node import Controller, RemoteController, OVSController from mininet.node import CPULimitedHost, Host, Node from mininet.node import OVSKernelSwitch, UserSwitch from mininet.node import IVSSwitch from mininet.cli import CLI from mininet.log import se...
145
256
1,407
6
138
sszwaczyk-phd/floodlight
scenarios/simple-net/mininet/simple-net-poisson-script-native.py
Python
verySimpleNet
verySimpleNet
25
129
25
26
d8f179622774d17a950fdfe180ee1c4cd91f8dc7
bigcode/the-stack
train
d4d8f4fb87898ffd0b06320b
train
function
def get_global_doc_build_files(index): data = _load_build_file_data(index.doc_builds) build_files = {} for k, v in data.items(): build_files[k] = DocBuildFile(k, v) return build_files
def get_global_doc_build_files(index):
data = _load_build_file_data(index.doc_builds) build_files = {} for k, v in data.items(): build_files[k] = DocBuildFile(k, v) return build_files
_files(index, dist_name): data = _get_build_file_data(index, dist_name, 'doc_builds') build_files = {} for k, v in data.items(): build_files[k] = DocBuildFile(k, v) return build_files def get_global_doc_build_files(index):
64
64
53
8
55
rhaschke/ros_buildfarm
ros_buildfarm/config/__init__.py
Python
get_global_doc_build_files
get_global_doc_build_files
73
78
73
73
a8a19a873d9fb8ec6bb8c4a7600a95210801c3df
bigcode/the-stack
train
267c1ea2d31258fd855307aa
train
function
def get_index(url): logger.debug("Load index from '%s'" % url) yaml_str = load_url(url) data = yaml.load(yaml_str) base_url = os.path.dirname(url) return Index(data, base_url)
def get_index(url):
logger.debug("Load index from '%s'" % url) yaml_str = load_url(url) data = yaml.load(yaml_str) base_url = os.path.dirname(url) return Index(data, base_url)
os import yaml from .doc_build_file import DocBuildFile from .index import Index from .loader import load_url from .release_build_file import ReleaseBuildFile from .source_build_file import SourceBuildFile logger = logging.getLogger('ros_buildfarm.config') def get_index(url):
64
64
52
5
59
rhaschke/ros_buildfarm
ros_buildfarm/config/__init__.py
Python
get_index
get_index
31
36
31
31
d2eef353dc9d753fd41954d2aebce8aec0ad45c3
bigcode/the-stack
train
1f799f71e43250ff394cbd6e
train
function
def get_doc_build_files(index, dist_name): data = _get_build_file_data(index, dist_name, 'doc_builds') build_files = {} for k, v in data.items(): build_files[k] = DocBuildFile(k, v) return build_files
def get_doc_build_files(index, dist_name):
data = _get_build_file_data(index, dist_name, 'doc_builds') build_files = {} for k, v in data.items(): build_files[k] = DocBuildFile(k, v) return build_files
, dist_name): data = _get_build_file_data(index, dist_name, 'source_builds') build_files = {} for k, v in data.items(): build_files[k] = SourceBuildFile(k, v) return build_files def get_doc_build_files(index, dist_name):
64
64
60
10
53
rhaschke/ros_buildfarm
ros_buildfarm/config/__init__.py
Python
get_doc_build_files
get_doc_build_files
65
70
65
65
522ff50edd02a0ceff7d054e9a8a9578185eeaf5
bigcode/the-stack
train
34e9edd7b4c1ba793bb4eb78
train
function
def get_distribution_file(index, rosdistro_name, build_file): from rosdistro import get_distribution_files dist_files = get_distribution_files(index, rosdistro_name) dist_files = build_file.filter_distribution_files_by_tags(dist_files) while len(dist_files) > 1: dist_files[0].merge(dist_files[1]...
def get_distribution_file(index, rosdistro_name, build_file):
from rosdistro import get_distribution_files dist_files = get_distribution_files(index, rosdistro_name) dist_files = build_file.filter_distribution_files_by_tags(dist_files) while len(dist_files) > 1: dist_files[0].merge(dist_files[1]) del dist_files[1] return dist_files[0] if dist_f...
_index(url): logger.debug("Load index from '%s'" % url) yaml_str = load_url(url) data = yaml.load(yaml_str) base_url = os.path.dirname(url) return Index(data, base_url) def get_distribution_file(index, rosdistro_name, build_file):
64
64
93
14
50
rhaschke/ros_buildfarm
ros_buildfarm/config/__init__.py
Python
get_distribution_file
get_distribution_file
39
46
39
39
ed33750ef61931f2fa88efcb3bb9eab222f94edd
bigcode/the-stack
train
11d10f49139cfb5f7d02d54d
train
function
def get_release_build_files(index, dist_name): data = _get_build_file_data(index, dist_name, 'release_builds') build_files = {} for k, v in data.items(): build_files[k] = ReleaseBuildFile(k, v) return build_files
def get_release_build_files(index, dist_name):
data = _get_build_file_data(index, dist_name, 'release_builds') build_files = {} for k, v in data.items(): build_files[k] = ReleaseBuildFile(k, v) return build_files
_files = build_file.filter_distribution_files_by_tags(dist_files) while len(dist_files) > 1: dist_files[0].merge(dist_files[1]) del dist_files[1] return dist_files[0] if dist_files else [] def get_release_build_files(index, dist_name):
63
64
60
10
53
rhaschke/ros_buildfarm
ros_buildfarm/config/__init__.py
Python
get_release_build_files
get_release_build_files
49
54
49
49
71ae1dbeb78ca0762f54cd2c82097fd2c414bcd7
bigcode/the-stack
train
85d418641364fb2e51bab94c
train
function
def _load_build_file_data(entries): def _load_yaml_data(url): logger.debug('Load file from "%s"' % url) yaml_str = load_url(url) return yaml.load(yaml_str) data = {} for k, v in entries.items(): data[k] = _load_yaml_data(v) return data
def _load_build_file_data(entries):
def _load_yaml_data(url): logger.debug('Load file from "%s"' % url) yaml_str = load_url(url) return yaml.load(yaml_str) data = {} for k, v in entries.items(): data[k] = _load_yaml_data(v) return data
', '.join(["'%s'" % d for d in index.distributions.keys()]))) dist = index.distributions[dist_name] if type_ not in dist.keys(): return {} entries = dist[type_] return _load_build_file_data(entries) def _load_build_file_data(entries):
64
64
73
8
56
rhaschke/ros_buildfarm
ros_buildfarm/config/__init__.py
Python
_load_build_file_data
_load_build_file_data
94
103
94
94
53975698e3afb57666543dc2dbb6e41bf1280bcf
bigcode/the-stack
train
cc17111239d04dc578e0c716
train
function
def _get_build_file_data(index, dist_name, type_): if dist_name not in index.distributions.keys(): raise RuntimeError( "Unknown release: '{0}'. Valid release names are: {1}".format( dist_name, ', '.join(["'%s'" % d for d in index.distributions.keys()]))) dist ...
def _get_build_file_data(index, dist_name, type_):
if dist_name not in index.distributions.keys(): raise RuntimeError( "Unknown release: '{0}'. Valid release names are: {1}".format( dist_name, ', '.join(["'%s'" % d for d in index.distributions.keys()]))) dist = index.distributions[dist_name] if type_ not i...
_doc_build_files(index): data = _load_build_file_data(index.doc_builds) build_files = {} for k, v in data.items(): build_files[k] = DocBuildFile(k, v) return build_files def _get_build_file_data(index, dist_name, type_):
64
64
109
14
49
rhaschke/ros_buildfarm
ros_buildfarm/config/__init__.py
Python
_get_build_file_data
_get_build_file_data
81
91
81
81
f5a03b2f71027768fa35a2554e9e91d3dd752600
bigcode/the-stack
train
e549064f41f1be62c57fca46
train
function
def get_source_build_files(index, dist_name): data = _get_build_file_data(index, dist_name, 'source_builds') build_files = {} for k, v in data.items(): build_files[k] = SourceBuildFile(k, v) return build_files
def get_source_build_files(index, dist_name):
data = _get_build_file_data(index, dist_name, 'source_builds') build_files = {} for k, v in data.items(): build_files[k] = SourceBuildFile(k, v) return build_files
, dist_name): data = _get_build_file_data(index, dist_name, 'release_builds') build_files = {} for k, v in data.items(): build_files[k] = ReleaseBuildFile(k, v) return build_files def get_source_build_files(index, dist_name):
64
64
60
10
53
rhaschke/ros_buildfarm
ros_buildfarm/config/__init__.py
Python
get_source_build_files
get_source_build_files
57
62
57
57
56bbd35a7055ec90b9ff808291f84fc33ae6b2c7
bigcode/the-stack
train
8110f46628e7b88f4fcadbbf
train
class
class PyIlluminaUtils(PythonPackage): """A library and collection of scripts to work with Illumina paired-end data (for CASAVA 1.8+).""" homepage = "https://github.com/meren/illumina-utils" pypi = "illumina-utils/illumina-utils-2.2.tar.gz" version('2.3', sha256='0e8407b91d530d9a53d8ec3c83e60f25e7f...
class PyIlluminaUtils(PythonPackage):
"""A library and collection of scripts to work with Illumina paired-end data (for CASAVA 1.8+).""" homepage = "https://github.com/meren/illumina-utils" pypi = "illumina-utils/illumina-utils-2.2.tar.gz" version('2.3', sha256='0e8407b91d530d9a53d8ec3c83e60f25e7f8f80d06ce17b8e4f57a02d3262441') ve...
# Copyright 2013-2020 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 PyIlluminaUtils(PythonPackage):
64
80
267
10
54
MiddelkoopT/spack
var/spack/repos/builtin/packages/py-illumina-utils/package.py
Python
PyIlluminaUtils
PyIlluminaUtils
9
24
9
9
817801dc6a015be97d65acfe60a42f2f67e9e313
bigcode/the-stack
train
20ae9c0e2a1c7e3407b5daa0
train
function
def convert_board(board, verbosity): for nb in board.all_notebooks(): convert_notebook(nb, verbosity)
def convert_board(board, verbosity):
for nb in board.all_notebooks(): convert_notebook(nb, verbosity)
nY'[pg.text is not None], len(pg.text_boxes))) def convert_notebook(nb, verbosity): pdf_filename = nb.name + '.pdf' if verbosity > 0: print('Creating', pdf_filename) notebook2pdf(nb, pdf_filename) def convert_board(board, verbosity):
64
64
24
7
57
tjol/lecturenotes2pdf
lecturenotes2pdf/__main__.py
Python
convert_board
convert_board
36
38
36
36
841a1eb76c288b09840fe434b15e82ead23af343
bigcode/the-stack
train
57a751de7486c254cb5337e2
train
function
def list_notebook(nb): print('NOTEBOOK', nb.root) for pg in nb.pages: print('"{}"<{}> - bitmaps: {} - text: {} - boxes: {}' .format(nb.name, pg.number, len(pg.image_layers), 'nY'[pg.text is not None], len(pg.text_boxes)))
def list_notebook(nb):
print('NOTEBOOK', nb.root) for pg in nb.pages: print('"{}"<{}> - bitmaps: {} - text: {} - boxes: {}' .format(nb.name, pg.number, len(pg.image_layers), 'nY'[pg.text is not None], len(pg.text_boxes)))
argparse import logging import sys from .notebook import Notebook, NotebooksBoard from .pdf import notebook2pdf def list_board(board): print('NOTEBOOKS BOARD', board.root) for nb in board.all_notebooks(): list_notebook(nb) def list_notebook(nb):
64
64
75
6
58
tjol/lecturenotes2pdf
lecturenotes2pdf/__main__.py
Python
list_notebook
list_notebook
20
27
20
20
b9dc374c14dd987116a7ad6c5a70aa84b1c9d228
bigcode/the-stack
train
34d9749d33e16f531e027bb9
train
function
def convert_notebook(nb, verbosity): pdf_filename = nb.name + '.pdf' if verbosity > 0: print('Creating', pdf_filename) notebook2pdf(nb, pdf_filename)
def convert_notebook(nb, verbosity):
pdf_filename = nb.name + '.pdf' if verbosity > 0: print('Creating', pdf_filename) notebook2pdf(nb, pdf_filename)
nb.pages: print('"{}"<{}> - bitmaps: {} - text: {} - boxes: {}' .format(nb.name, pg.number, len(pg.image_layers), 'nY'[pg.text is not None], len(pg.text_boxes))) def convert_notebook(nb, verbosity):
64
64
42
8
56
tjol/lecturenotes2pdf
lecturenotes2pdf/__main__.py
Python
convert_notebook
convert_notebook
29
33
29
29
60dd5b585a43936b5a557f903ca639616b7b945e
bigcode/the-stack
train
e49c76bc8b84abb5a7bdf4a4
train
function
def list_board(board): print('NOTEBOOKS BOARD', board.root) for nb in board.all_notebooks(): list_notebook(nb)
def list_board(board):
print('NOTEBOOKS BOARD', board.root) for nb in board.all_notebooks(): list_notebook(nb)
""" lecturenotes2pdf: Convert LectureNotes notebooks to PDF format """ from __future__ import absolute_import, print_function import argparse import logging import sys from .notebook import Notebook, NotebooksBoard from .pdf import notebook2pdf def list_board(board):
60
64
31
5
54
tjol/lecturenotes2pdf
lecturenotes2pdf/__main__.py
Python
list_board
list_board
15
18
15
15
6b26b6f47833732a134d21bc3fc548dea086c63b
bigcode/the-stack
train
a2f6fc6dc1f071c9f5c2f1e0
train
function
def main(): arg_parser = argparse.ArgumentParser('lecturenotes2pdf') arg_parser.add_argument('location', help='location of LectureNotes data') arg_parser.add_argument('-l', '--list', action='store_true', help='list all notebooks and pages') arg_parser.add_argument('-v', '--ve...
def main():
arg_parser = argparse.ArgumentParser('lecturenotes2pdf') arg_parser.add_argument('location', help='location of LectureNotes data') arg_parser.add_argument('-l', '--list', action='store_true', help='list all notebooks and pages') arg_parser.add_argument('-v', '--verbose', acti...
- boxes: {}' .format(nb.name, pg.number, len(pg.image_layers), 'nY'[pg.text is not None], len(pg.text_boxes))) def convert_notebook(nb, verbosity): pdf_filename = nb.name + '.pdf' if verbosity > 0: print('Creating', pdf_fi...
106
106
356
3
103
tjol/lecturenotes2pdf
lecturenotes2pdf/__main__.py
Python
main
main
41
89
41
41
c50df71eec207292bfe59095981d593894038705
bigcode/the-stack
train
2c2544e02978266c1534bab2
train
class
class Migration(migrations.Migration): dependencies = [ ('diseases', '0004_auto_20150516_0223'), ] operations = [ migrations.RenameField( model_name='disease', old_name='title', new_name='name', ), ]
class Migration(migrations.Migration):
dependencies = [ ('diseases', '0004_auto_20150516_0223'), ] operations = [ migrations.RenameField( model_name='disease', old_name='title', new_name='name', ), ]
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration):
31
64
64
7
23
Omrigan/diseases
diseases/migrations/0005_auto_20150516_0229.py
Python
Migration
Migration
7
19
7
8
c14f4bb0d8b7cda26a511d3734f735227a7afeec
bigcode/the-stack
train
f17b9182747ebf379ae2c198
train
function
def test_collector_attributes(testdir): testdir.makeconftest(""" import pytest def pytest_pycollect_makeitem(collector): assert collector.Function == pytest.Function assert collector.Class == pytest.Class assert collector.Instance == pytest.Instance as...
def test_collector_attributes(testdir):
testdir.makeconftest(""" import pytest def pytest_pycollect_makeitem(collector): assert collector.Function == pytest.Function assert collector.Class == pytest.Class assert collector.Instance == pytest.Instance assert collector.Module == pytest.Module ...
("--collect-only", "-s") result.stdout.fnmatch_lines([ "*_test_underscore*", ]) result = testdir.runpytest() assert result.ret == 0 result.stdout.fnmatch_lines([ "*1 passed*", ]) def test_collector_attributes(testdir):
63
64
107
8
55
miracle2k/pytest
testing/python/collect.py
Python
test_collector_attributes
test_collector_attributes
1,195
1,211
1,195
1,195
fe1da9b04d42fad013caaea9c2f38eb27071a2a2
bigcode/the-stack
train
49965cb80000ac1db433bfc3
train
function
def test_class_injection_does_not_break_collection(testdir): """Tests whether injection during collection time will terminate testing. In this case the error should not occur if the TestClass itself is modified during collection time, and the original method list is still used for collection. """ ...
def test_class_injection_does_not_break_collection(testdir):
"""Tests whether injection during collection time will terminate testing. In this case the error should not occur if the TestClass itself is modified during collection time, and the original method list is still used for collection. """ testdir.makeconftest(""" from test_inject import T...
.runpytest('-rw') result.stdout.fnmatch_lines([ '*collected 1 item*', "*cannot collect 'test_a' because it is not a function*", '*1 passed, 1 warnings in *', ]) def test_class_injection_does_not_break_collection(testdir):
63
64
174
13
50
miracle2k/pytest
testing/python/collect.py
Python
test_class_injection_does_not_break_collection
test_class_injection_does_not_break_collection
1,326
1,346
1,326
1,326
537a7d230a409c72c9e602da9986e2fa13673d4a
bigcode/the-stack
train
2d578e29e845bc7b7baf3be0
train
class
class TestConftestCustomization(object): def test_pytest_pycollect_module(self, testdir): testdir.makeconftest(""" import pytest class MyModule(pytest.Module): pass def pytest_pycollect_makemodule(path, parent): if path.basename == "test_xy...
class TestConftestCustomization(object):
def test_pytest_pycollect_module(self, testdir): testdir.makeconftest(""" import pytest class MyModule(pytest.Module): pass def pytest_pycollect_makemodule(path, parent): if path.basename == "test_xyz.py": return MyModul...
2) == 0 assert hash(fn1) == hash(fn2) fn3 = testdir.collect_by_name(modcol, "test_fail") assert isinstance(fn3, pytest.Function) assert not (fn1 == fn3) assert fn1 != fn3 for fn in fn1, fn2, fn3: assert fn != 3 assert fn != modcol ass...
256
256
906
8
248
miracle2k/pytest
testing/python/collect.py
Python
TestConftestCustomization
TestConftestCustomization
790
899
790
790
4c3b040bde5727cab57cf10106010f64d499fe49
bigcode/the-stack
train
bd546dd94643e5a90b09fa07
train
class
class TestReportInfo(object): def test_itemreport_reportinfo(self, testdir, linecomp): testdir.makeconftest(""" import pytest class MyFunction(pytest.Function): def reportinfo(self): return "ABCDE", 42, "custom" def pytest_pycollect_mak...
class TestReportInfo(object):
def test_itemreport_reportinfo(self, testdir, linecomp): testdir.makeconftest(""" import pytest class MyFunction(pytest.Function): def reportinfo(self): return "ABCDE", 42, "custom" def pytest_pycollect_makeitem(collector, name, obj): ...
_longer_valid(self, testdir): """test that filter_traceback() works with the fact that py.code.Code.path attribute might return an str object. In this case, one of the files in the traceback no longer exists. This fixes #1133. """ from _pytest.python import filter_traceba...
191
191
637
6
185
miracle2k/pytest
testing/python/collect.py
Python
TestReportInfo
TestReportInfo
1,062
1,140
1,062
1,062
c52af34451e936576f4f39b49c870826ddd37dea
bigcode/the-stack
train
ae7f6c80d7619ee413121657
train
class
class TestSorting(object): def test_check_equality(self, testdir): modcol = testdir.getmodulecol(""" def test_pass(): pass def test_fail(): assert 0 """) fn1 = testdir.collect_by_name(modcol, "test_pass") assert isinstance(fn1, pytest.Function) fn2 = t...
class TestSorting(object):
def test_check_equality(self, testdir): modcol = testdir.getmodulecol(""" def test_pass(): pass def test_fail(): assert 0 """) fn1 = testdir.collect_by_name(modcol, "test_pass") assert isinstance(fn1, pytest.Function) fn2 = testdir.collect_by_name(modc...
1, m(2)]) def test_passed(x): pass """) result = testdir.runpytest() result.stdout.fnmatch_lines('* 3 passed in *') def test_function_original_name(self, testdir): items = testdir.getitems(""" import pytest @pytest.mark.parametrize...
113
113
378
5
108
miracle2k/pytest
testing/python/collect.py
Python
TestSorting
TestSorting
740
787
740
740
6015618140f2a9d3258e38175ff6c9e1de76a9cd
bigcode/the-stack
train
752f7520575bf28d6c973ef6
train
class
class TestClass(object): def test_class_with_init_warning(self, testdir): testdir.makepyfile(""" class TestClass1(object): def __init__(self): pass """) result = testdir.runpytest("-rw") result.stdout.fnmatch_lines([ "*canno...
class TestClass(object):
def test_class_with_init_warning(self, testdir): testdir.makepyfile(""" class TestClass1(object): def __init__(self): pass """) result = testdir.runpytest("-rw") result.stdout.fnmatch_lines([ "*cannot collect test class 'Tes...
stdout = result.stdout.str() for name in ('_pytest', os.path.join('py', '_path')): if verbose == 2: assert name in stdout else: assert name not in stdout def test_show_traceback_import_error_unicode(self, testdir): """Check test module...
173
173
578
5
167
miracle2k/pytest
testing/python/collect.py
Python
TestClass
TestClass
123
215
123
123
f4eb647ad0fb9cbaac98e23b4920fed9834e21e9
bigcode/the-stack
train
5be5b04eb2aa4902b8fa1330
train
class
class TestFunction(object): def test_getmodulecollector(self, testdir): item = testdir.getitem("def test_func(): pass") modcol = item.getparent(pytest.Module) assert isinstance(modcol, pytest.Module) assert hasattr(modcol.obj, 'test_func') def test_function_as_object_instance_ig...
class TestFunction(object):
def test_getmodulecollector(self, testdir): item = testdir.getitem("def test_func(): pass") modcol = item.getparent(pytest.Module) assert isinstance(modcol, pytest.Module) assert hasattr(modcol.obj, 'test_func') def test_function_as_object_instance_ignored(self, testdir): ...
o = testdir.makepyfile(""" setuplist = [] class TestClass(object): def setup_method(self, func): #print "setup_method", self, func setuplist.append(self) self.init = 42 def teardown_method(self, func): ...
256
256
2,476
5
250
miracle2k/pytest
testing/python/collect.py
Python
TestFunction
TestFunction
413
737
413
413
91188824515377f3dcc3ee7dc9bb7ad8e9e1b928
bigcode/the-stack
train
065d280b98b7a9a1835c7534
train
class
class TestModule(object): def test_failing_import(self, testdir): modcol = testdir.getmodulecol("import alksdjalskdjalkjals") pytest.raises(Collector.CollectError, modcol.collect) def test_import_duplicate(self, testdir): a = testdir.mkdir("a") b = testdir.mkdir("b") p =...
class TestModule(object):
def test_failing_import(self, testdir): modcol = testdir.getmodulecol("import alksdjalskdjalkjals") pytest.raises(Collector.CollectError, modcol.collect) def test_import_duplicate(self, testdir): a = testdir.mkdir("a") b = testdir.mkdir("b") p = a.ensure("test_whatever.p...
# -*- coding: utf-8 -*- import os import sys from textwrap import dedent import _pytest._code import pytest from _pytest.main import EXIT_NOTESTSCOLLECTED from _pytest.nodes import Collector ignore_parametrized_marks = pytest.mark.filterwarnings('ignore:Applying marks directly to parameters') class TestModule(object)...
74
256
925
5
69
miracle2k/pytest
testing/python/collect.py
Python
TestModule
TestModule
14
120
14
14
12665da2486a73d4437f514f237df4b59ae169ec
bigcode/the-stack
train
e67e3d29f216323d8824d180
train
class
class TestGenerator(object): def test_generative_functions(self, testdir): modcol = testdir.getmodulecol(""" def func1(arg, arg2): assert arg == arg2 def test_gen(): yield func1, 17, 3*5 yield func1, 42, 6*7 """) colite...
class TestGenerator(object):
def test_generative_functions(self, testdir): modcol = testdir.getmodulecol(""" def func1(arg, arg2): assert arg == arg2 def test_gen(): yield func1, 17, 3*5 yield func1, 42, 6*7 """) colitems = modcol.collect() ...
(cls): pass """) result = testdir.runpytest() result.stdout.fnmatch_lines([ "*1 passed*", ]) def test_issue1035_obj_has_getattr(self, testdir): modcol = testdir.getmodulecol(""" class Chameleon(object): def __getatt...
256
256
1,716
5
250
miracle2k/pytest
testing/python/collect.py
Python
TestGenerator
TestGenerator
218
410
218
218
26f1cdd974331b37eb6cd72c18642d0e40c9bf21
bigcode/the-stack
train
b2dc770d01d50d3970e2a449
train
function
def test_syntax_error_with_non_ascii_chars(testdir): """Fix decoding issue while formatting SyntaxErrors during collection (#578) """ testdir.makepyfile(u""" # -*- coding: UTF-8 -*- ☃ """) result = testdir.runpytest() result.stdout.fnmatch_lines([ '*ERROR collecting*', '...
def test_syntax_error_with_non_ascii_chars(testdir):
"""Fix decoding issue while formatting SyntaxErrors during collection (#578) """ testdir.makepyfile(u""" # -*- coding: UTF-8 -*- ☃ """) result = testdir.runpytest() result.stdout.fnmatch_lines([ '*ERROR collecting*', '*SyntaxError*', '*1 error in*', ])
"""Test being parametrized.""" pass ''') result = testdir.runpytest() assert "RuntimeError: dictionary changed size during iteration" not in result.stdout.str() result.stdout.fnmatch_lines(['*1 passed*']) def test_syntax_error_with_non_ascii_chars(testdir):
63
64
88
12
51
miracle2k/pytest
testing/python/collect.py
Python
test_syntax_error_with_non_ascii_chars
test_syntax_error_with_non_ascii_chars
1,349
1,362
1,349
1,349
6f9158ad1447614283ad48444f7df74c30ba82ce
bigcode/the-stack
train
a48b9291578f263428e48db8
train
function
def test_keep_duplicates(testdir): """Test for issue https://github.com/pytest-dev/pytest/issues/1609 (#1609) Use --keep-duplicates to collect tests from duplicate directories. """ a = testdir.mkdir("a") fh = a.join("test_a.py") fh.write(_pytest._code.Source(""" import pytest de...
def test_keep_duplicates(testdir):
"""Test for issue https://github.com/pytest-dev/pytest/issues/1609 (#1609) Use --keep-duplicates to collect tests from duplicate directories. """ a = testdir.mkdir("a") fh = a.join("test_a.py") fh.write(_pytest._code.Source(""" import pytest def test_real(): pass ...
fh.write(_pytest._code.Source(""" import pytest def test_real(): pass """)) result = testdir.runpytest(a.strpath, a.strpath) result.stdout.fnmatch_lines([ '*collected 1 item*', ]) def test_keep_duplicates(testdir):
63
64
125
7
56
miracle2k/pytest
testing/python/collect.py
Python
test_keep_duplicates
test_keep_duplicates
1,383
1,398
1,383
1,383
bb49b0845c1563fd19228245e1a2de2777770a90
bigcode/the-stack
train
61bc9604db73bb08c416b0fd
train
function
def test_setup_only_available_in_subdir(testdir): sub1 = testdir.mkpydir("sub1") sub2 = testdir.mkpydir("sub2") sub1.join("conftest.py").write(_pytest._code.Source(""" import pytest def pytest_runtest_setup(item): assert item.fspath.purebasename == "test_in_sub1" def pyte...
def test_setup_only_available_in_subdir(testdir):
sub1 = testdir.mkpydir("sub1") sub2 = testdir.mkpydir("sub2") sub1.join("conftest.py").write(_pytest._code.Source(""" import pytest def pytest_runtest_setup(item): assert item.fspath.purebasename == "test_in_sub1" def pytest_runtest_call(item): assert item.fsp...
arf": return Module(path, parent)""") testdir.makefile(".narf", """ def test_something(): assert 1 + 1 == 2""") # Use runpytest_subprocess, since we're futzing with sys.meta_path. result = testdir.runpytest_subprocess() result.stdout.fnmatc...
88
88
296
11
77
miracle2k/pytest
testing/python/collect.py
Python
test_setup_only_available_in_subdir
test_setup_only_available_in_subdir
902
926
902
902
6f5dd61ff296cdd51e62f23cf7590ad2967daca7
bigcode/the-stack
train
600f17cf269ac69772fcdbf5
train
function
def test_customize_through_attributes(testdir): testdir.makeconftest(""" import pytest class MyFunction(pytest.Function): pass class MyInstance(pytest.Instance): Function = MyFunction class MyClass(pytest.Class): Instance = MyInstance def ...
def test_customize_through_attributes(testdir):
testdir.makeconftest(""" import pytest class MyFunction(pytest.Function): pass class MyInstance(pytest.Instance): Function = MyFunction class MyClass(pytest.Class): Instance = MyInstance def pytest_pycollect_makeitem(collector, name, obj):...
assert collector.Module == pytest.Module """) testdir.makepyfile(""" def test_hello(): pass """) result = testdir.runpytest() result.stdout.fnmatch_lines([ "*1 passed*", ]) def test_customize_through_attributes(testdir):
63
64
165
9
54
miracle2k/pytest
testing/python/collect.py
Python
test_customize_through_attributes
test_customize_through_attributes
1,214
1,238
1,214
1,214
4ced82432e3895a8405fb24b4c544c3ad4ba3546
bigcode/the-stack
train
f57f320ec5243eaf9b977bc6
train
function
def test_dont_collect_non_function_callable(testdir): """Test for issue https://github.com/pytest-dev/pytest/issues/331 In this case an INTERNALERROR occurred trying to report the failure of a test like this one because py test failed to get the source lines. """ testdir.makepyfile(""" clas...
def test_dont_collect_non_function_callable(testdir):
"""Test for issue https://github.com/pytest-dev/pytest/issues/331 In this case an INTERNALERROR occurred trying to report the failure of a test like this one because py test failed to get the source lines. """ testdir.makepyfile(""" class Oh(object): def __call__(self): ...
test_fail_1 = functools.partial(check2, 2) test_fail_2 = functools.partial(check3, 2) """) result = testdir.inline_run() result.assertoutcome(passed=6, failed=2) def test_dont_collect_non_function_callable(testdir):
64
64
156
11
53
miracle2k/pytest
testing/python/collect.py
Python
test_dont_collect_non_function_callable
test_dont_collect_non_function_callable
1,302
1,323
1,302
1,302
96b5abeae6fd9204705b1733f00da9f30e49dd9b
bigcode/the-stack
train
34ac185ed32fda2ec24c17a9
train
function
def test_skip_duplicates_by_default(testdir): """Test for issue https://github.com/pytest-dev/pytest/issues/1609 (#1609) Ignore duplicate directories. """ a = testdir.mkdir("a") fh = a.join("test_a.py") fh.write(_pytest._code.Source(""" import pytest def test_real(): ...
def test_skip_duplicates_by_default(testdir):
"""Test for issue https://github.com/pytest-dev/pytest/issues/1609 (#1609) Ignore duplicate directories. """ a = testdir.mkdir("a") fh = a.join("test_a.py") fh.write(_pytest._code.Source(""" import pytest def test_real(): pass """)) result = testdir.runpytest...
(u""" # -*- coding: UTF-8 -*- ☃ """) result = testdir.runpytest() result.stdout.fnmatch_lines([ '*ERROR collecting*', '*SyntaxError*', '*1 error in*', ]) def test_skip_duplicates_by_default(testdir):
63
64
114
9
54
miracle2k/pytest
testing/python/collect.py
Python
test_skip_duplicates_by_default
test_skip_duplicates_by_default
1,365
1,380
1,365
1,365
09fdef7295c86546cb1b20c230e1168d9f1170f5
bigcode/the-stack
train
710b8c128958193ec4a145d4
train
function
def test_modulecol_roundtrip(testdir): modcol = testdir.getmodulecol("pass", withinit=True) trail = modcol.nodeid newcol = modcol.session.perform_collect([trail], genitems=0)[0] assert modcol.name == newcol.name
def test_modulecol_roundtrip(testdir):
modcol = testdir.getmodulecol("pass", withinit=True) trail = modcol.nodeid newcol = modcol.session.perform_collect([trail], genitems=0)[0] assert modcol.name == newcol.name
1.py").write("def test_1(): pass") sub2.join("test_in_sub2.py").write("def test_2(): pass") result = testdir.runpytest("-v", "-s") result.assert_outcomes(passed=2) def test_modulecol_roundtrip(testdir):
64
64
62
9
55
miracle2k/pytest
testing/python/collect.py
Python
test_modulecol_roundtrip
test_modulecol_roundtrip
929
933
929
929
a95b0c517c579a9d4c18c343c708a8fa842c7f34
bigcode/the-stack
train
96bce3391c52a96501eb4206
train
function
def test_customized_python_discovery_functions(testdir): testdir.makeini(""" [pytest] python_functions=_test """) testdir.makepyfile(""" def _test_underscore(): pass """) result = testdir.runpytest("--collect-only", "-s") result.stdout.fnmatch_lines([ ...
def test_customized_python_discovery_functions(testdir):
testdir.makeini(""" [pytest] python_functions=_test """) testdir.makepyfile(""" def _test_underscore(): pass """) result = testdir.runpytest("--collect-only", "-s") result.stdout.fnmatch_lines([ "*_test_underscore*", ]) result = testdir.runpyt...
"*check_simple*", "*CheckMyApp*", "*check_meth*", ]) result = testdir.runpytest() assert result.ret == 0 result.stdout.fnmatch_lines([ "*2 passed*", ]) def test_customized_python_discovery_functions(testdir):
63
64
112
11
52
miracle2k/pytest
testing/python/collect.py
Python
test_customized_python_discovery_functions
test_customized_python_discovery_functions
1,174
1,192
1,174
1,174
fb43f391a761db75070e32cce47f57b7194404d5
bigcode/the-stack
train
d0163835fd824d17b0392b43
train
function
def test_customized_python_discovery(testdir): testdir.makeini(""" [pytest] python_files=check_*.py python_classes=Check python_functions=check """) p = testdir.makepyfile(""" def check_simple(): pass class CheckMyApp(object): def check...
def test_customized_python_discovery(testdir):
testdir.makeini(""" [pytest] python_files=check_*.py python_classes=Check python_functions=check """) p = testdir.makepyfile(""" def check_simple(): pass class CheckMyApp(object): def check_meth(self): pass """) ...
an int" def test_foo(self): pass """) classcol = testdir.collect_by_name(modcol, "TestClass") instance = classcol.collect()[0] fspath, lineno, msg = instance.reportinfo() def test_customized_python_discovery(testdir):
64
64
186
10
54
miracle2k/pytest
testing/python/collect.py
Python
test_customized_python_discovery
test_customized_python_discovery
1,143
1,171
1,143
1,143
c3b6fcff19bf3410c0a75f7bcf0f6bf64afc612a
bigcode/the-stack
train
bfa92c4af2a1b3c59f906037
train
function
def test_collect_functools_partial(testdir): """ Test that collection of functools.partial object works, and arguments to the wrapped functions are dealt correctly (see #811). """ testdir.makepyfile(""" import functools import pytest @pytest.fixture def fix1(): ...
def test_collect_functools_partial(testdir):
""" Test that collection of functools.partial object works, and arguments to the wrapped functions are dealt correctly (see #811). """ testdir.makepyfile(""" import functools import pytest @pytest.fixture def fix1(): return 'fix1' @pytest.fixture...
dir): testdir.makepyfile(""" class TestJoinEmpty(object): pass def make_test(): class Test(object): pass Test.__name__ = "TestFoo" return Test TestFoo = make_test() """) result = testdir.runpytest() assert "TypeErro...
99
99
330
10
88
miracle2k/pytest
testing/python/collect.py
Python
test_collect_functools_partial
test_collect_functools_partial
1,258
1,299
1,258
1,258
90fbcd60356f20db25d521ff2c16b749f0fe46a4
bigcode/the-stack
train
9beea2f40f31c8dc0d547e4d
train
class
class TestTracebackCutting(object): def test_skip_simple(self): excinfo = pytest.raises(pytest.skip.Exception, 'pytest.skip("xxx")') assert excinfo.traceback[-1].frame.code.name == "skip" assert excinfo.traceback[-1].ishidden() def test_traceback_argsetup(self, testdir): testdir...
class TestTracebackCutting(object):
def test_skip_simple(self): excinfo = pytest.raises(pytest.skip.Exception, 'pytest.skip("xxx")') assert excinfo.traceback[-1].frame.code.name == "skip" assert excinfo.traceback[-1].ishidden() def test_traceback_argsetup(self, testdir): testdir.makeconftest(""" import...
pytest_runtest_teardown(item): assert item.fspath.purebasename == "test_in_sub1" """)) sub2.join("conftest.py").write(_pytest._code.Source(""" import pytest def pytest_runtest_setup(item): assert item.fspath.purebasename == "test_in_sub2" def pytest_runtest_call(...
256
256
962
8
247
miracle2k/pytest
testing/python/collect.py
Python
TestTracebackCutting
TestTracebackCutting
936
1,059
936
936
f46cc73f9ff09d7df3b80f7ead7352f5a23c15a7
bigcode/the-stack
train
b68b5fef8dd6aaf7f708cf27
train
function
def test_unorderable_types(testdir): testdir.makepyfile(""" class TestJoinEmpty(object): pass def make_test(): class Test(object): pass Test.__name__ = "TestFoo" return Test TestFoo = make_test() """) result = testdir.r...
def test_unorderable_types(testdir):
testdir.makepyfile(""" class TestJoinEmpty(object): pass def make_test(): class Test(object): pass Test.__name__ = "TestFoo" return Test TestFoo = make_test() """) result = testdir.runpytest() assert "TypeError" not...
def test_hello(self): pass """) result = testdir.runpytest("--collect-only") result.stdout.fnmatch_lines([ "*MyClass*", "*MyInstance*", "*MyFunction*test_hello*", ]) def test_unorderable_types(testdir):
63
64
96
9
54
miracle2k/pytest
testing/python/collect.py
Python
test_unorderable_types
test_unorderable_types
1,241
1,255
1,241
1,241
5ac7edfb6d933003d646e604bd3951b2e8681e20
bigcode/the-stack
train
50e96ef56178bea703e77d53
train
function
def __group_indices_by_labels( labels_array: NDArray[Any, np.int32], ) -> Dict[np.int32, NDArray[Any, np.int32]]: """ :param labels_array: list of point cloud labels :return: dictionary with labels and an array of indices belonging to this label """ unique_labels = np.unique(labels_array) di...
def __group_indices_by_labels( labels_array: NDArray[Any, np.int32], ) -> Dict[np.int32, NDArray[Any, np.int32]]:
""" :param labels_array: list of point cloud labels :return: dictionary with labels and an array of indices belonging to this label """ unique_labels = np.unique(labels_array) dictionary = {} for label in unique_labels: label_indices = np.where(labels_array == label)[0] dict...
ops.utils.IoUOverlap import __is_overlapped_iou __statistics_functions = {"iou": __is_overlapped_iou} def __group_indices_by_labels( labels_array: NDArray[Any, np.int32], ) -> Dict[np.int32, NDArray[Any, np.int32]]:
64
64
112
34
30
pmokeev/plane-benchmark
src/evops/utils/MetricsUtils.py
Python
__group_indices_by_labels
__group_indices_by_labels
25
39
25
27
b11dc83abe2ffdd62cd2d12e47cd9e95fb329dc3
bigcode/the-stack
train
c27fda9aaa92d0dfb057d5a1
train
function
def __are_nearly_overlapped( plane_predicted: NDArray[Any, np.int32], plane_gt: NDArray[Any, np.int32], required_overlap: np.float64, ) -> (bool, bool): """ Calculate if planes are overlapped enough (required_overlap %) to be used for PP-PR metric :param required_overlap: overlap threshold which...
def __are_nearly_overlapped( plane_predicted: NDArray[Any, np.int32], plane_gt: NDArray[Any, np.int32], required_overlap: np.float64, ) -> (bool, bool):
""" Calculate if planes are overlapped enough (required_overlap %) to be used for PP-PR metric :param required_overlap: overlap threshold which will b checked to say that planes overlaps :param plane_predicted: predicted segmentation :param plane_gt: ground truth segmentation :return: true if pl...
)[0] dictionary[label] = label_indices return dictionary def __are_nearly_overlapped( plane_predicted: NDArray[Any, np.int32], plane_gt: NDArray[Any, np.int32], required_overlap: np.float64, ) -> (bool, bool):
64
64
183
49
14
pmokeev/plane-benchmark
src/evops/utils/MetricsUtils.py
Python
__are_nearly_overlapped
__are_nearly_overlapped
42
60
42
46
55c71127bf9f351e96ea37f08168c13834298dc2
bigcode/the-stack
train
3eb37e4d1b74d185e1ff88a6
train
function
def __filter_unsegmented( label_array: NDArray[Any, np.int32], ) -> NDArray[Any, np.int32]: label_array = np.delete( label_array, np.where(label_array == evops.metrics.constants.UNSEGMENTED_LABEL)[0], ) assert ( label_array.size != 0 ), "Incorrect label array values, most lik...
def __filter_unsegmented( label_array: NDArray[Any, np.int32], ) -> NDArray[Any, np.int32]:
label_array = np.delete( label_array, np.where(label_array == evops.metrics.constants.UNSEGMENTED_LABEL)[0], ) assert ( label_array.size != 0 ), "Incorrect label array values, most likely no labels other than UNSEGMENTED_LABEL" return label_array
_condition_function(pred_indices, gt_indices) if is_overlap: true_positive += 1 pred_used.add(pred_label) break return true_positive def __filter_unsegmented( label_array: NDArray[Any, np.int32], ) -> NDArray[Any, np.int32]:
64
64
96
29
34
pmokeev/plane-benchmark
src/evops/utils/MetricsUtils.py
Python
__filter_unsegmented
__filter_unsegmented
99
110
99
101
c6578d2226c6b052d76d0acc167e855e6061d5c5
bigcode/the-stack
train
5a8b9b44168e7c2aa5124fa2
train
function
def __get_tp( pred_labels: NDArray[Any, np.int32], gt_labels: NDArray[Any, np.int32], tp_condition: str, ) -> np.int32: """ :param pred_labels: labels of points corresponding to segmented planes :param gt_labels: labels of points corresponding to ground truth planes :param tp_condition: help...
def __get_tp( pred_labels: NDArray[Any, np.int32], gt_labels: NDArray[Any, np.int32], tp_condition: str, ) -> np.int32:
""" :param pred_labels: labels of points corresponding to segmented planes :param gt_labels: labels of points corresponding to ground truth planes :param tp_condition: helper function to calculate statistics :return: true positive received using pred_labels and gt_labels """ true_positive = ...
( intersection.size / plane_predicted.size >= required_overlap and intersection.size / plane_gt.size >= required_overlap, intersection.size > 0, ) def __get_tp( pred_labels: NDArray[Any, np.int32], gt_labels: NDArray[Any, np.int32], tp_condition: str, ) -> np.int32:
75
75
252
41
34
pmokeev/plane-benchmark
src/evops/utils/MetricsUtils.py
Python
__get_tp
__get_tp
63
96
63
67
999e8ec8e452a70a6ae74e79305284ca13090fcd
bigcode/the-stack
train
452034c3b35ed3bf1485ad1f
train
class
class Test: if __name__ == '__main__': fila = Queue() fila.push(22) fila.push(60) fila.push(True) fila.push('Juliano') fila.push('Queiroz') fila.push(100) print(fila) fila.pop() print(fila) fila.peek()
class Test:
if __name__ == '__main__': fila = Queue() fila.push(22) fila.push(60) fila.push(True) fila.push('Juliano') fila.push('Queiroz') fila.push(100) print(fila) fila.pop() print(fila) fila.peek()
from fila import Queue class Test:
8
64
73
3
4
JulianoRQueiroz/Lista_Encadeada_Fila
test.py
Python
Test
Test
3
16
3
3
c5ef30dc495f4f6739c925bd9f5964f7d8620e5a
bigcode/the-stack
train
bf4ffa25657537d508b7291f
train
class
class SerializerTOML(SerializerBase): def __init__(self): SerializerBase.__init__(self) def fancydumps(self, obj, secure=False): """ """ if not j.data.types.dict.check(obj): raise j.exceptions.Input("need to be dict") keys = [item for item in obj.keys()] ...
class SerializerTOML(SerializerBase):
def __init__(self): SerializerBase.__init__(self) def fancydumps(self, obj, secure=False): """ """ if not j.data.types.dict.check(obj): raise j.exceptions.Input("need to be dict") keys = [item for item in obj.keys()] keys.sort() out = "" ...
import j import pytoml # import toml from .SerializerBase import SerializerBase testtemplate = """ name = '' multiline = '' nr = 0 nr2 = 0 nr3 = 0 nr4 = 0.0 nr5 = 0.0 bbool = true bbool2 = true bbool3 = true list1 = [ ] list2 = [ ] list3 = [ ] list4 = [ ] list5 = [ ] """ testtoml = """ name = 'something' mul...
256
256
2,474
9
247
gneumann333/jumpscaleX_core
JumpscaleCore/data/serializers/SerializerTOML.py
Python
SerializerTOML
SerializerTOML
58
358
58
58
9311ef3d6252b4ec1ebc8ba7fb736d5729847cb9
bigcode/the-stack
train
c2982fabfad772b79282861b
train
function
def get_cramer_matrix(matrix, output_vect, index=0): """ The inputs matrix and output_vect should be Matrix mobjects """ new_matrix = np.array(matrix.mob_matrix) new_matrix[:, index] = output_vect.mob_matrix[:, 0] # Create a new Matrix mobject with copies of these entries result = Matrix(new...
def get_cramer_matrix(matrix, output_vect, index=0):
""" The inputs matrix and output_vect should be Matrix mobjects """ new_matrix = np.array(matrix.mob_matrix) new_matrix[:, index] = output_vect.mob_matrix[:, 0] # Create a new Matrix mobject with copies of these entries result = Matrix(new_matrix, element_to_mobject=lambda m: m.copy()) r...
from manimlib.imports import * X_COLOR = GREEN Y_COLOR = RED Z_COLOR = BLUE OUTPUT_COLOR = YELLOW INPUT_COLOR = MAROON_B OUTPUT_DIRECTORY = "eola2/cramer" def get_cramer_matrix(matrix, output_vect, index=0):
61
64
97
14
47
Tarang74/manim
from_3b1b/on_hold/eola2/cramer.py
Python
get_cramer_matrix
get_cramer_matrix
12
21
12
12
84e439b1da718d7a2293ea26f86d4675bc4cece8
bigcode/the-stack
train
3c76803a437301e94efd3464
train
class
class ShowDotProductChangingAwayFromZero(ShowDotProductChanging): CONFIG = { "matrix": [[2, 2], [0, -1]], "v": [1, 0], "w": [0, 1], "v_label": "x", "w_label": "y", "v_color": X_COLOR, "w_color": Y_COLOR, "rhs1": "= 0", "rhs2": "\\ne 0", }
class ShowDotProductChangingAwayFromZero(ShowDotProductChanging):
CONFIG = { "matrix": [[2, 2], [0, -1]], "v": [1, 0], "w": [0, 1], "v_label": "x", "w_label": "y", "v_color": X_COLOR, "w_color": Y_COLOR, "rhs1": "= 0", "rhs2": "\\ne 0", }
_label.copy(), TexMobject(rhs), ) equation.arrange(RIGHT, buff=SMALL_BUFF) equation.add_to_back(BackgroundRectangle(equation)) equation.scale(self.equation_scale_factor) return equation class ShowDotProductChangingAwayFromZero(ShowDotProductChanging):
64
64
107
14
49
Tarang74/manim
from_3b1b/on_hold/eola2/cramer.py
Python
ShowDotProductChangingAwayFromZero
ShowDotProductChangingAwayFromZero
1,172
1,183
1,172
1,172
0f34dd82fba8561a32800fd50c43381cddbf485b
bigcode/the-stack
train
c6c32929e61320ad575acf05
train
class
class InputParallelepipedAngledView(ExternallyAnimatedScene): pass
class InputParallelepipedAngledView(ExternallyAnimatedScene):
pass
, Z_COLOR) equation[4].elements.set_color(BLUE) equation.arrange(RIGHT, buff=MED_SMALL_BUFF) equation.to_edge(LEFT) self.play(Write(equation)) self.wait() class InputParallelepipedAngledView(ExternallyAnimatedScene):
64
64
18
15
49
Tarang74/manim
from_3b1b/on_hold/eola2/cramer.py
Python
InputParallelepipedAngledView
InputParallelepipedAngledView
2,019
2,020
2,019
2,019
7c4f8f1ba75754648da43f271a73f38f5e68f00a
bigcode/the-stack
train
72663892b6080ea96c8fcfe5
train
class
class SolvingASystemWithOrthonormalMatrix(LinearTransformationScene): CONFIG = { "array_scale_factor": 0.6, } def construct(self): # Setup system angle = TAU / 12 matrix = np.array([[np.cos(angle), -np.sin(angle)], [np.sin(angle), np.cos(angle)]]) ...
class SolvingASystemWithOrthonormalMatrix(LinearTransformationScene):
CONFIG = { "array_scale_factor": 0.6, } def construct(self): # Setup system angle = TAU / 12 matrix = np.array([[np.cos(angle), -np.sin(angle)], [np.sin(angle), np.cos(angle)]]) output_vect = [1, 2] symbolic_matrix = [ [...
", w_tex, ) top_words.set_color_by_tex_to_color_map({ v_tex: YELLOW, w_tex: MAROON_B, }) bottom_words = TextMobject("$T$", "is", "``Orthonormal''") bottom_words.set_color_by_tex("Orthonormal", BLUE) words = VGroup(top_words, bottom_word...
256
256
1,501
15
241
Tarang74/manim
from_3b1b/on_hold/eola2/cramer.py
Python
SolvingASystemWithOrthonormalMatrix
SolvingASystemWithOrthonormalMatrix
1,240
1,408
1,240
1,240
e5ed9dc319437e6cd2b63bf99440f828b0fc1b5b
bigcode/the-stack
train
91a0e9956c4add9b5965bff3
train
class
class WrongButHelpful(TeacherStudentsScene): def construct(self): self.teacher_says("What's next is wrong, \\\\ but helpful") self.change_student_modes("sassy", "sad", "angry") self.wait(3)
class WrongButHelpful(TeacherStudentsScene):
def construct(self): self.teacher_says("What's next is wrong, \\\\ but helpful") self.change_student_modes("sassy", "sad", "angry") self.wait(3)
StartMap(ShowCreation, dashed_lines, lag_ratio=0.7)) for basis in basis_vectors: self.play(MoveToTarget(basis, run_time=2), UpdateFromFunc(dashed_lines, update_dashed_lines)) self.wait() class WrongButHelpful(TeacherStudentsScene):
64
64
53
9
55
Tarang74/manim
from_3b1b/on_hold/eola2/cramer.py
Python
WrongButHelpful
WrongButHelpful
878
882
878
878
231243af7c90293190afed2d6c6c94fc65acd6f1
bigcode/the-stack
train
14530bb54a4be2c409fd05db
train
class
class FourPlusTwo(Scene): def construct(self): p1 = TexMobject("(4)(1)") p2 = TexMobject("-(-1)(2)") p2.next_to(p1, RIGHT, SMALL_BUFF) b1 = Brace(p1, UP) b2 = Brace(p2, UP) t1 = b1.get_tex("4", buff=SMALL_BUFF) t2 = b2.get_tex("+2", buff=SMALL_BUFF) f...
class FourPlusTwo(Scene):
def construct(self): p1 = TexMobject("(4)(1)") p2 = TexMobject("-(-1)(2)") p2.next_to(p1, RIGHT, SMALL_BUFF) b1 = Brace(p1, UP) b2 = Brace(p2, UP) t1 = b1.get_tex("4", buff=SMALL_BUFF) t2 = b2.get_tex("+2", buff=SMALL_BUFF) for b, t in (b1, t1), (b2, ...
Group(TexMobject("="), frac, TexMobject("= \\frac{6}{2}"), TexMobject("=3")) group.arrange(RIGHT) group.add_to_back(BackgroundRectangle(group)) self.add(group) self.wait(1) class FourPlusTwo(Scene):
64
64
154
6
58
Tarang74/manim
from_3b1b/on_hold/eola2/cramer.py
Python
FourPlusTwo
FourPlusTwo
2,134
2,147
2,134
2,134
78a720fe7eb70ea51ee29e076689b9166eca6287
bigcode/the-stack
train
21f9337c1f665158ceed9fb5
train
class
class NotAtAllTrue(NotTheMostComputationallyEfficient): CONFIG = { "words": "Not at all \\\\ True", "word_height": 4, }
class NotAtAllTrue(NotTheMostComputationallyEfficient):
CONFIG = { "words": "Not at all \\\\ True", "word_height": 4, }
.get_width() + MED_LARGE_BUFF + SMALL_BUFF) rect.stretch_to_fit_height(mobject.get_height() + MED_LARGE_BUFF + SMALL_BUFF) rect.to_corner(UL, buff=0) return rect class NotAtAllTrue(NotTheMostComputationallyEfficient):
64
64
41
14
49
Tarang74/manim
from_3b1b/on_hold/eola2/cramer.py
Python
NotAtAllTrue
NotAtAllTrue
1,098
1,102
1,098
1,098
89f9edbd3f88f9611f2efca17cd14548a046b903
bigcode/the-stack
train
88c2f5049e17cf429085571b
train
class
class Equals3(Scene): def construct(self): self.add(TexMobject("=3").add_background_rectangle()) self.wait()
class Equals3(Scene):
def construct(self): self.add(TexMobject("=3").add_background_rectangle()) self.wait()
t.set_stroke(BLACK, 3, background=True) self.play(GrowFromCenter(b), Write(t)) self.wait() class Equals2(Scene): def construct(self): self.add(TexMobject("=2").add_background_rectangle()) self.wait() class Equals3(Scene):
64
64
29
5
59
Tarang74/manim
from_3b1b/on_hold/eola2/cramer.py
Python
Equals3
Equals3
2,156
2,159
2,156
2,156
66624acc4d15f21e0e8d93ed0f4e880601fd36bb
bigcode/the-stack
train
78547977996f22f1e117ca54
train
class
class TransformParallelepipedWithGrid(ExternallyAnimatedScene): pass
class TransformParallelepipedWithGrid(ExternallyAnimatedScene):
pass
("Try thinking \\\\ it through!", target_mode="hooray") self.change_all_student_modes("pondering") self.wait(4) class TransformParallelepipedWithoutGrid(ExternallyAnimatedScene): pass class TransformParallelepipedWithGrid(ExternallyAnimatedScene):
64
64
17
14
49
Tarang74/manim
from_3b1b/on_hold/eola2/cramer.py
Python
TransformParallelepipedWithGrid
TransformParallelepipedWithGrid
2,196
2,197
2,196
2,196
ae4503726f9b3308f22510dda1535aeac510524a
bigcode/the-stack
train
635651af810d2a719f14cd11
train
class
class TransformingAreasXCoord(TransformingAreasYCoord): CONFIG = { "index": 0, }
class TransformingAreasXCoord(TransformingAreasYCoord):
CONFIG = { "index": 0, }
_vect_label def wiggle_vector(self, vector_mob): self.play( Rotate( vector_mob, 15 * DEGREES, about_point=ORIGIN, rate_func=wiggle, )) class TransformingAreasXCoord(TransformingAreasYCoord):
63
64
26
13
50
Tarang74/manim
from_3b1b/on_hold/eola2/cramer.py
Python
TransformingAreasXCoord
TransformingAreasXCoord
1,991
1,994
1,991
1,991
8d36d4f326643a11512287e101fcc154b5dd7388
bigcode/the-stack
train
908f4819571ded03ff698589
train
class
class CramersYEvaluation(Scene): def construct(self): frac = TexMobject("{(2)(2) - (4)(0) \\over (2)(1) - (-1)(0)}")[0] VGroup(frac[1], frac[11], frac[15], frac[26]).set_color(GREEN) VGroup(frac[4], frac[8]).set_color(MAROON_B) VGroup(frac[18], frac[22], frac[23]).set_color(RED) ...
class CramersYEvaluation(Scene):
def construct(self): frac = TexMobject("{(2)(2) - (4)(0) \\over (2)(1) - (-1)(0)}")[0] VGroup(frac[1], frac[11], frac[15], frac[26]).set_color(GREEN) VGroup(frac[4], frac[8]).set_color(MAROON_B) VGroup(frac[18], frac[22], frac[23]).set_color(RED) group = VGroup(TexMobject("=...
class WriteCramersRule(Scene): def construct(self): words = TextMobject("``Cramer's Rule''") words.set_width(FRAME_WIDTH - LARGE_BUFF) words.add_background_rectangle() self.play(Write(words)) self.wait() class CramersYEvaluation(Scene):
64
64
164
8
56
Tarang74/manim
from_3b1b/on_hold/eola2/cramer.py
Python
CramersYEvaluation
CramersYEvaluation
2,101
2,113
2,101
2,101
781c12d5ae87b21bbc5e4c8430b21e65519fd6c3
bigcode/the-stack
train
9a9ccb3f83b457024258e092
train
class
class ZEqualsVDotK(Scene): def construct(self): equation = VGroup( TexMobject("z"), TexMobject("="), Matrix(["x", "y", "z"]), TexMobject("\\cdot"), IntegerMatrix([0, 0, 1]), ) equation[2].elements.set_color_by_gradient(X_COLOR, Y_CO...
class ZEqualsVDotK(Scene):
def construct(self): equation = VGroup( TexMobject("z"), TexMobject("="), Matrix(["x", "y", "z"]), TexMobject("\\cdot"), IntegerMatrix([0, 0, 1]), ) equation[2].elements.set_color_by_gradient(X_COLOR, Y_COLOR, Z_COLOR) equat...
ORIGIN, rate_func=wiggle, )) class TransformingAreasXCoord(TransformingAreasYCoord): CONFIG = { "index": 0, } class ThreeDDotVectorWithKHat(ExternallyAnimatedScene): pass class ZEqualsVDotK(Scene):
64
64
129
8
55
Tarang74/manim
from_3b1b/on_hold/eola2/cramer.py
Python
ZEqualsVDotK
ZEqualsVDotK
2,001
2,016
2,001
2,001
6622e6ec9ad7d1bea2721cd58fd16d19f42b6c32
bigcode/the-stack
train
b7ac5aeb63623ff9870af677
train
class
class TransformingAreasYCoord(LinearTransformationScene): CONFIG = { # Determines whether x-coordinate or y-coordinate is computed "index": 1, "matrix": [[2, -1], [0, 1]], "input_vect": [3, 2], "array_scale_factor": 0.7, } def construct(self): self.init_matri...
class TransformingAreasYCoord(LinearTransformationScene):
CONFIG = { # Determines whether x-coordinate or y-coordinate is computed "index": 1, "matrix": [[2, -1], [0, 1]], "input_vect": [3, 2], "array_scale_factor": 0.7, } def construct(self): self.init_matrix() self.init_plane() self.show_coord_para...
FadeIn(cm[0], **get_kwargs(i)), ReplacementTransform(matrix_mobject.brackets.copy(), cm.brackets, **get_kwargs(i)), ReplacementTransform( VGroup(*matrix_mobject.mob_matrix[:, ...
256
256
4,381
11
245
Tarang74/manim
from_3b1b/on_hold/eola2/cramer.py
Python
TransformingAreasYCoord
TransformingAreasYCoord
1,432
1,988
1,432
1,432
c71fccdc1dc2824582f0bacf6b1995087e1b9f04
bigcode/the-stack
train
bf1137de3f0e02b49c530406
train
class
class Introduce3DSystem(SetupSimpleSystemOfEquations): CONFIG = { "matrix": [[3, 2, -7], [1, 2, -4], [4, 0, 1]], "output_vect": [4, 2, 5], "compare_to_big_system": False, "transition_to_geometric_view": False, } def construct(self): self.remove_grid() self.in...
class Introduce3DSystem(SetupSimpleSystemOfEquations):
CONFIG = { "matrix": [[3, 2, -7], [1, 2, -4], [4, 0, 1]], "output_vect": [4, 2, 5], "compare_to_big_system": False, "transition_to_geometric_view": False, } def construct(self): self.remove_grid() self.introduce_system() self.from_system_to_matrix()
(self): self.add(TexMobject("=2").add_background_rectangle()) self.wait() class Equals3(Scene): def construct(self): self.add(TexMobject("=3").add_background_rectangle()) self.wait() class Introduce3DSystem(SetupSimpleSystemOfEquations):
64
64
108
14
50
Tarang74/manim
from_3b1b/on_hold/eola2/cramer.py
Python
Introduce3DSystem
Introduce3DSystem
2,162
2,173
2,162
2,162
269268c72fed5ee32823a0776cb49c4c3597a0bf
bigcode/the-stack
train
d79c17cb03061c615ecfb5c0
train
class
class Equals2(Scene): def construct(self): self.add(TexMobject("=2").add_background_rectangle()) self.wait()
class Equals2(Scene):
def construct(self): self.add(TexMobject("=2").add_background_rectangle()) self.wait()
2", buff=SMALL_BUFF) for b, t in (b1, t1), (b2, t2): t.set_stroke(BLACK, 3, background=True) self.play(GrowFromCenter(b), Write(t)) self.wait() class Equals2(Scene):
64
64
29
5
59
Tarang74/manim
from_3b1b/on_hold/eola2/cramer.py
Python
Equals2
Equals2
2,150
2,153
2,150
2,150
72fe4a9313d6deb714211281016b420a07a4e74f
bigcode/the-stack
train
12c98734b383b330a9cf08ba
train
class
class ParallelepipedForXCoordinate(ExternallyAnimatedScene): pass
class ParallelepipedForXCoordinate(ExternallyAnimatedScene):
pass
self.play(Write(equation)) self.wait() class InputParallelepipedAngledView(ExternallyAnimatedScene): pass class InputParallelepipedTopViewToSideView(ExternallyAnimatedScene): pass class ParallelepipedForXCoordinate(ExternallyAnimatedScene):
64
64
17
14
49
Tarang74/manim
from_3b1b/on_hold/eola2/cramer.py
Python
ParallelepipedForXCoordinate
ParallelepipedForXCoordinate
2,027
2,028
2,027
2,027
184e342d26760ed886a3859f84e374825075c48b
bigcode/the-stack
train
cdc8215eecf97d9eec85269d
train
class
class ShowComputer(ThreeDScene): def construct(self): laptop = Laptop() laptop.add_updater(lambda m, dt: m.rotate(0.1 * dt, axis=UP)) self.play(DrawBorderThenFill(laptop, lag_ratio=0.1, rate_func=smooth)) self.wait(8) self.play(FadeOut(laptop))
class ShowComputer(ThreeDScene):
def construct(self): laptop = Laptop() laptop.add_updater(lambda m, dt: m.rotate(0.1 * dt, axis=UP)) self.play(DrawBorderThenFill(laptop, lag_ratio=0.1, rate_func=smooth)) self.wait(8) self.play(FadeOut(laptop))
``Cramer's rule''") self.play( GrowFromCenter(brace), Write(rule_text), self.get_student_changes( "pondering", "erm", "maybe", look_at_arg=brace, )) self.wait(3) class ShowComputer(ThreeDScene):
64
64
79
8
56
Tarang74/manim
from_3b1b/on_hold/eola2/cramer.py
Python
ShowComputer
ShowComputer
238
244
238
238
3e46d1f9f468f2eb2e2228853abba0fe4dece6c0
bigcode/the-stack
train
dc3c4a8243222fdcd67fc242
train
class
class Thumbnail(TransformingAreasYCoord, MovingCameraScene): CONFIG = { "background_plane_kwargs": { "y_max": 6, }, } def setup(self): TransformingAreasYCoord.setup(self) MovingCameraScene.setup(self) def construct(self): self.matrix = np.array(self....
class Thumbnail(TransformingAreasYCoord, MovingCameraScene):
CONFIG = { "background_plane_kwargs": { "y_max": 6, }, } def setup(self): TransformingAreasYCoord.setup(self) MovingCameraScene.setup(self) def construct(self): self.matrix = np.array(self.matrix) vect = self.add_vector([1, 1.5], color=MAROON...
uilty"])]) self.wait() self.change_all_student_modes("thinking", added_anims=[ RemovePiCreatureBubble( self.teacher, target_mode="ra...
68
68
227
13
55
Tarang74/manim
from_3b1b/on_hold/eola2/cramer.py
Python
Thumbnail
Thumbnail
2,217
2,243
2,217
2,217
3bc9bda3263f2ac20dd242f0a2fdcde97a9515f2
bigcode/the-stack
train
669963bde3ed083f4f948c67
train
class
class GaussTitle(Scene): def construct(self): title = TextMobject("Gaussian Elimination") title.scale(1.5) title.to_edge(UP) line = Line(LEFT, RIGHT).scale(7) line.next_to(title, DOWN) self.play( FadeIn(title, lag_ratio=0.2), ShowCreation(line)...
class GaussTitle(Scene):
def construct(self): title = TextMobject("Gaussian Elimination") title.scale(1.5) title.to_edge(UP) line = Line(LEFT, RIGHT).scale(7) line.next_to(title, DOWN) self.play( FadeIn(title, lag_ratio=0.2), ShowCreation(line), ) self....
(big_rect) words = TextMobject(self.words) words.set_color(RED) words.set_stroke(WHITE, 1) words.set_width(FRAME_WIDTH - 2 * MED_LARGE_BUFF) self.play(Write(words)) self.wait() class GaussTitle(Scene):
64
64
85
6
58
Tarang74/manim
from_3b1b/on_hold/eola2/cramer.py
Python
GaussTitle
GaussTitle
297
308
297
297
36094f70e44a97ade2ae85033840d5f426d415b6
bigcode/the-stack
train
dbcdaadd44db56c2b6a7abe9
train
class
class WhyLearnIt(TeacherStudentsScene): def construct(self): self.student_says( "What?!? Then why \\\\ learn it?", bubble_kwargs={"direction": LEFT}, student_index=2, target_mode="angry", ) self.change_all_student_modes("angry") self.w...
class WhyLearnIt(TeacherStudentsScene):
def construct(self): self.student_says( "What?!? Then why \\\\ learn it?", bubble_kwargs={"direction": LEFT}, student_index=2, target_mode="angry", ) self.change_all_student_modes("angry") self.wait() self.play( sel...
title.to_edge(UP) line = Line(LEFT, RIGHT).scale(7) line.next_to(title, DOWN) self.play( FadeIn(title, lag_ratio=0.2), ShowCreation(line), ) self.wait() class WhyLearnIt(TeacherStudentsScene):
64
64
133
9
55
Tarang74/manim
from_3b1b/on_hold/eola2/cramer.py
Python
WhyLearnIt
WhyLearnIt
311
329
311
311
2b39a9d30ff2de2f82a1bf21dadbc7ff12f7be77
bigcode/the-stack
train
fc1db3cc61148c6a5e5e8ed6
train
class
class LeaveItToComputers(TeacherStudentsScene): CONFIG = { "random_seed": 1, } def construct(self): system = LinearSystem(height=3) system.next_to(self.pi_creatures, UP) system.generate_target() system.target.scale(0.5) system.target.to_corner(UL) cr...
class LeaveItToComputers(TeacherStudentsScene):
CONFIG = { "random_seed": 1, } def construct(self): system = LinearSystem(height=3) system.next_to(self.pi_creatures, UP) system.generate_target() system.target.scale(0.5) system.target.to_corner(UL) cramer_groups = VGroup() for i in range(3)...
("Jerry: Ah, you're crazy!", **kw), TextMobject("Kramer:", "{} Am I? Or am I so sane that\\\\", "you just blew your mind?", **kw), TextMobject("Jerry: It's impossible!", **kw), TextMobject("Kramer:", "{} Is it?! Or is it so possible\\\\", ...
256
256
989
11
245
Tarang74/manim
from_3b1b/on_hold/eola2/cramer.py
Python
LeaveItToComputers
LeaveItToComputers
112
235
112
112
54d66c03ccefcbbdfcbea9c4002b3a0eefc099c6
bigcode/the-stack
train
6e072e9ce9ab733d271476d7
train
class
class PrerequisiteKnowledge(TeacherStudentsScene): CONFIG = {"camera_config": {"background_opacity": 1}} def construct(self): self.remove(*self.pi_creatures) randy = self.students[1] self.add(randy) title = TextMobject("Prerequisites") title.to_edge(UP) h_line ...
class PrerequisiteKnowledge(TeacherStudentsScene):
CONFIG = {"camera_config": {"background_opacity": 1}} def construct(self): self.remove(*self.pi_creatures) randy = self.students[1] self.add(randy) title = TextMobject("Prerequisites") title.to_edge(UP) h_line = Line(LEFT, RIGHT).scale(5) h_line.next_to...
laptop.add_updater(lambda m, dt: m.rotate(0.1 * dt, axis=UP)) self.play(DrawBorderThenFill(laptop, lag_ratio=0.1, rate_func=smooth)) self.wait(8) self.play(FadeOut(laptop)) class PrerequisiteKnowledge(TeacherStudentsScene):
71
71
237
10
61
Tarang74/manim
from_3b1b/on_hold/eola2/cramer.py
Python
PrerequisiteKnowledge
PrerequisiteKnowledge
247
275
247
247
f6438ef7d4881ec15c288bd01dfeaaabe44eae49
bigcode/the-stack
train
cb736982d7a70db06f1a164a
train
class
class LookAtDotProducts(SetupSimpleSystemOfEquations): CONFIG = { "quit_before_final_transformation": True, "equation_scale_factor": 0.7, } def construct(self): self.force_skipping() super(LookAtDotProducts, self).construct() self.revert_to_original_skipping_status()...
class LookAtDotProducts(SetupSimpleSystemOfEquations):
CONFIG = { "quit_before_final_transformation": True, "equation_scale_factor": 0.7, } def construct(self): self.force_skipping() super(LookAtDotProducts, self).construct() self.revert_to_original_skipping_status() self.remove_corner_system() self.show...
basis_coords basis.target.put_start_and_end_on( origin, self.plane.coords_to_point(*new_coords), ) dashed_lines = VGroup(*[DashedLine(LEFT, RIGHT) for x in range(2)]) def update_dashed_lines(lines): for i in 0, 1: lin...
256
256
1,818
13
243
Tarang74/manim
from_3b1b/on_hold/eola2/cramer.py
Python
LookAtDotProducts
LookAtDotProducts
885
1,095
885
885
8f8b1f83e090f4919d61839ffc53fd96ff298ab4
bigcode/the-stack
train
faa6b7be34d502164ce4d158
train
class
class ThinkOfPuzzleAsLinearCombination(SetupSimpleSystemOfEquations): CONFIG = { "output_vect": [-4, -2], } def construct(self): self.force_skipping() super(ThinkOfPuzzleAsLinearCombination, self).construct() self.revert_to_original_skipping_status() self.rearrange_...
class ThinkOfPuzzleAsLinearCombination(SetupSimpleSystemOfEquations):
CONFIG = { "output_vect": [-4, -2], } def construct(self): self.force_skipping() super(ThinkOfPuzzleAsLinearCombination, self).construct() self.revert_to_original_skipping_status() self.rearrange_equation_as_linear_combination() self.show_linear_combination_...
Output") output_vect_label.next_to(output_vect_mob.get_end(), DOWN, SMALL_BUFF) output_vect_label.match_color(output_vect_mob) for label in input_vect_label, output_vect_label: label.scale(1.25, about_edge=UP) label.add_background_rectangle() self.apply_matrix(ma...
250
250
835
15
235
Tarang74/manim
from_3b1b/on_hold/eola2/cramer.py
Python
ThinkOfPuzzleAsLinearCombination
ThinkOfPuzzleAsLinearCombination
780
875
780
780
3183a66043b7c9e6b51caf161b08af92aaf073b0
bigcode/the-stack
train
05847b53dc097788e4589ccc
train
class
class LinearSystem(VGroup): CONFIG = { "matrix_config": { "element_to_mobject": Integer, }, "dimensions": 3, "min_int": -9, "max_int": 10, "height": 4, } def __init__(self, matrix=None, output_vect=None, **kwargs): VGroup.__init__(self, **...
class LinearSystem(VGroup):
CONFIG = { "matrix_config": { "element_to_mobject": Integer, }, "dimensions": 3, "min_int": -9, "max_int": 10, "height": 4, } def __init__(self, matrix=None, output_vect=None, **kwargs): VGroup.__init__(self, **kwargs) if matrix is...
def get_cramer_matrix(matrix, output_vect, index=0): """ The inputs matrix and output_vect should be Matrix mobjects """ new_matrix = np.array(matrix.mob_matrix) new_matrix[:, index] = output_vect.mob_matrix[:, 0] # Create a new Matrix mobject with copies of these entries result = Matrix(new...
103
103
346
6
96
Tarang74/manim
from_3b1b/on_hold/eola2/cramer.py
Python
LinearSystem
LinearSystem
24
69
24
24
a1ddd80585efefee39c92dfa08f8846fbe1d111a
bigcode/the-stack
train
cf525b10ca4ab2e8b014f5b4
train
class
class CramerOpeningQuote(OpeningQuote): CONFIG = { "quote": ["Computers are useless. They \\\\ can only give you answers."], "author": "Pablo Picasso", }
class CramerOpeningQuote(OpeningQuote):
CONFIG = { "quote": ["Computers are useless. They \\\\ can only give you answers."], "author": "Pablo Picasso", }
1], lag_ratio=0.1, run_time=2)) self.play(FadeIn(parts[2], lag_ratio=0)) self.play(FadeIn(parts[3], lag_ratio=0.1, run_time=2)) self.wait() class CramerOpeningQuote(OpeningQuote):
64
64
46
9
55
Tarang74/manim
from_3b1b/on_hold/eola2/cramer.py
Python
CramerOpeningQuote
CramerOpeningQuote
104
109
104
104
0061fdbbcb9ca37bd278dae99ffe4b78361e7b86
bigcode/the-stack
train