code stringlengths 1 1.49M | file_id stringlengths 42 46 | node_count int64 0 7.38k | total_lines int64 1 20.9k | vector_dim int64 15 15 | vector_labels stringclasses 1
value | nodes stringlengths 2 3.75M | connections stringlengths 2 964k |
|---|---|---|---|---|---|---|---|
"""API module to simplify import of common names from pysph.base package"""
# fast utils
from fast_utils import arange_long
# carray
from carray import LongArray, DoubleArray, IntArray, FloatArray
from cell import Cell, CellManager, PeriodicDomain
from kernels import KernelBase, DummyKernel, CubicSplineKernel, \
... | ajibawa-2023/Python-Code-Large/train/row_76535 | 20 | 44 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76535:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0227, 0.0227, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
import linked_list_functions as ll
import numpy
# PySPH imports
from carray import LongArray
class OpenCLNeighborLocatorType:
AllPairNeighborLocator = 0
LinkedListSPHNeighborLocator = 1
class OpenCLNeighborLocator(object):
pass
class LinkedListSPHNeighborLocator(OpenCLNeighborLocator):
def __i... | ajibawa-2023/Python-Code-Large/train/row_76536 | 115 | 352 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76536:Import_L1_C0", "label": "linked_list_functions import ll", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0028, 0.0028, 0, 0.66, 0.0, 804, 0, 1, 0, 0, 804, 0, 0], "semantic": {"name": "linked_list_functions", "arg_names": [], "impo... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76536:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76536:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76536:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76536:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
#! python
'''
Module to collect and generate source files from template files
The template files have very similar syntax to php files.
* All text in input is copied straight to output except that within
`<?py` and `?>` tags.
* Text within `<?py=` and `?>` tags is evaluated and the result is written
into the out... | ajibawa-2023/Python-Code-Large/train/row_76538 | 81 | 146 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76538:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 33], "level": 0, "parent": null, "vector": [8, 0, 0.1199, 0.2192, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76538:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76538:Expr_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76538:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76538:Return_L42_C4"}, {"f": "ajibawa-2023/Python-Code... |
from cell import CellManager
from nnps import NNPSManager, NeighborLocatorType
from particle_array import ParticleArray
from particle_types import ParticleType
from domain_manager import DomainManagerType as CLDomain
from locator import OpenCLNeighborLocatorType as CLLocator
import locator
import domain_manager
from... | ajibawa-2023/Python-Code-Large/train/row_76539 | 139 | 499 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76539:ImportFrom_L1_C0", "label": "from cell import CellManager", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.002, 0.002, 0, 0.66, 0.0, 787, 0, 1, 0, 0, 787, 0, 0], "semantic": {"name": "cell", "arg_names": [], "import_names": ["CellM... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76539:If_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76539:Import_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76539:Try_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76539:ImportFrom_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/trai... |
"""
Tests for the particle array module.
"""
# standard imports
import unittest
import numpy
# local imports
import pysph
from pysph.base import particle_array
from pysph.base.carray import LongArray, IntArray, DoubleArray
from pysph.base import carray
import pickle
def check_array(x, y):
"""Check if two arrays... | ajibawa-2023/Python-Code-Large/train/row_76540 | 359 | 590 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76540:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0034, 0.0051, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76540:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76540:Expr_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76540:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76540:Return_L20_C4"}, {"f": "ajibawa-2023/Python-Code... |
# standard imports
import numpy
# local imports
from pysph.base.particle_array import *
def generate_sample_dataset_1():
"""
Generate test test data.
Look at image test_cell_case1.png for details.
"""
x = numpy.array([0.25, 0.8, 0.5, 0.8, 0.2, 0.5, 1.5, 1.5])
y = numpy.array([0.25, 0.1, 0.5,... | ajibawa-2023/Python-Code-Large/train/row_76541 | 23 | 44 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76541:Import_L2_C0", "label": "numpy import numpy", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0455, 0.0227, 0, 0.66, 0.0, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["numpy"], "rhs_ca... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76541:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76541:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76541:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76541:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
class ParticleType:
"""
An empty class to provide an enum for the different particle types
used in PySPH.
The types defined are:
Fluid -- The default particle type used to represent fluids.
Solid -- Use this to represent solids
DummyFluid --
Probe --
Boundary -- Boundary partic... | ajibawa-2023/Python-Code-Large/train/row_76542 | 9 | 37 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76542:ClassDef_L1_C0", "label": "ParticleType", "type": "class", "loc": [1, 33], "level": 0, "parent": null, "vector": [3, 0, 0.4595, 0.8919, 0, 0.66, 0.0, 894, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "ParticleType", "arg_names": [], "import_names": [], "rhs_call_nam... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76542:ClassDef_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76542:Expr_L2_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76542:ClassDef_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76542:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
""" Contains class to perform load balancing using METIS[1]/SCOTCH[2]
[1] METIS: http://glaros.dtc.umn.edu/gkhome/views/metis
[2] SCOTCH: http://www.labri.fr/perso/pelegrin/scotch/
Note: Either of METIS/SCOTCH is acceptable. Installing one of these is enough.
First METIS is attempted to load and if it fails SCOTCH is... | ajibawa-2023/Python-Code-Large/train/row_76543 | 98 | 196 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76543:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 10], "level": 0, "parent": null, "vector": [8, 0, 0.0281, 0.051, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76543:If_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76543:Try_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76543:Try_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_76543:Assign_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_7... |
""" Contains class to perform load balancing.
"""
#FIXME: usage documentation
# logging imports
import logging
logger = logging.getLogger()
# standard imports
import numpy
# local imports
from pysph.base.particle_array import ParticleArray, get_particle_array
from pysph.base.cell import CellManager, py_construct_im... | ajibawa-2023/Python-Code-Large/train/row_76544 | 830 | 1,497 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76544:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 2], "level": 0, "parent": null, "vector": [8, 0, 0.001, 0.0013, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76544:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76544:Expr_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76544:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76544:FunctionDef_L25_C4"}, {"f": "ajibawa-2023/Python-Code-... |
"""API module to simplify import of common names from pysph.parallel package"""
from parallel_cell import ParallelCellManager, ProcessorMap
| ajibawa-2023/Python-Code-Large/train/row_76545 | 2 | 5 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76545:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.2, 0.2, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ... | [] |
"""A parallel manager that uses blocks to partition the domain. At
every iteration, the particles are placed in large bins and these bins
are exchanged across processors.
"""
from parallel_controller import ParallelController
from parallel_manager import ParallelManager
from parallel_cell import share_data
from pys... | ajibawa-2023/Python-Code-Large/train/row_76546 | 256 | 534 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76546:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0056, 0.0094, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76546:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76546:Expr_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76546:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76546:FunctionDef_L42_C4"}, {"f": "ajibawa-2023/Python-Code-... |
"""
Contains class to perform load balancing using space filling curves.
"""
# logging imports
import logging
logger = logging.getLogger()
# standard imports
import numpy
# local imports
from pysph.base.particle_array import ParticleArray
from pysph.base.cell import py_construct_immediate_neighbor_list
from load_bal... | ajibawa-2023/Python-Code-Large/train/row_76547 | 60 | 94 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76547:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0213, 0.0319, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76547:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76547:FunctionDef_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76547:FunctionDef_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_76547:Expr_L24_C8"}, {"f": "ajibawa-2023/Python-Co... |
from parallel_manager import ParallelManager
from parallel_controller import ParallelController
from pysph.base.particle_array import get_local_real_tag, get_dummy_tag
from pysph.base.fast_utils import arange_long
# logger imports
import logging
logger = logging.getLogger()
# Constants
Dummy = get_dummy_tag()
LocalR... | ajibawa-2023/Python-Code-Large/train/row_76548 | 45 | 85 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76548:ImportFrom_L1_C0", "label": "from parallel_manager import ParallelManager", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0118, 0.0118, 0, 0.66, 0.0, 501, 0, 1, 0, 0, 501, 0, 0], "semantic": {"name": "parallel_manager", "arg_names... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76548:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76548:Expr_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76548:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76548:FunctionDef_L23_C4"}, {"f": "ajibawa-2023/Python-Code-... |
"""
Module to implement parallel decomposition of particles to assign to
different processes during parallel simulations. The method used is an
extension of k-means clustering algorithm
"""
# logging imports
import logging
logger = logging.getLogger()
# standard imports
import numpy
# local imports
from pysph.base.c... | ajibawa-2023/Python-Code-Large/train/row_76549 | 179 | 314 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76549:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0096, 0.0159, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76549:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76549:Expr_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76549:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76549:FunctionDef_L22_C4"}, {"f": "ajibawa-2023/Python-Code-... |
""" Tests for the parallel cell manager """
import nose.plugins.skip as skip
raise skip.SkipTest("Dont run this test via nose")
from pysph.parallel.simple_block_manager import SimpleBlockManager
from pysph.base.particles import Particles
from pysph.base.particle_array import get_particle_array
from pysph.base.point i... | ajibawa-2023/Python-Code-Large/train/row_76551 | 116 | 203 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76551:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0049, 0.0049, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76551:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76551:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76551:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76551:Expr_L23_C4"}, {"f": "ajibawa-2023/Python-Code... |
#!/bin/env python
"""
Simple test for checking if the control tree is setup properly.
Run this script with the following command
mpiexec -n [num_procs] python controller_check.py
"""
try:
import mpi4py.MPI as mpi
except ImportError:
import nose.plugins.skip as skip
reason = "mpi4py not installed"
rai... | ajibawa-2023/Python-Code-Large/train/row_76553 | 21 | 57 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76553:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 8], "level": 0, "parent": null, "vector": [8, 0, 0.0877, 0.1228, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76553:Try_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76553:Import_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76553:Try_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76553:Import_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
""" Some checks for the parallel cell manager.
Run this script only with less than 5 processors.
example : mpiexec -n 2 python parallel_cell_check.py
"""
import time
try:
import mpi4py.MPI as mpi
except ImportError:
import nose.plugins.skip as skip
reason = "mpi4py not installed"
raise skip.SkipTest(... | ajibawa-2023/Python-Code-Large/train/row_76554 | 69 | 123 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76554:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0244, 0.0407, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76554:Try_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76554:Import_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76554:Try_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76554:Import_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row... |
""" Tests for the parallel cell manager """
import nose.plugins.skip as skip
raise skip.SkipTest("Dont run this test via nose")
import pysph.base.api as base
import pysph.parallel.api as parallel
import numpy
import pylab
import time
# mpi imports
from mpi4py import MPI
comm = MPI.COMM_WORLD
num_procs = comm.Get_si... | ajibawa-2023/Python-Code-Large/train/row_76555 | 48 | 68 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76555:Import_L1_C0", "label": "nose.plugins.skip import skip", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0147, 0.0147, 0, 0.66, 0.0, 548, 0, 1, 0, 0, 548, 0, 0], "semantic": {"name": "nose.plugins.skip", "arg_names": [], "import_nam... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76555:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76555:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76555:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76555:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code... |
""" Tests for the parallel cell manager """
import pysph.base.api as base
import pysph.parallel.api as parallel
import numpy
import time
import pdb
# mpi imports
from mpi4py import MPI
comm = MPI.COMM_WORLD
num_procs = comm.Get_size()
pid = comm.Get_rank()
import logging
logger = logging.getLogger()
logger.setLevel... | ajibawa-2023/Python-Code-Large/train/row_76556 | 7 | 9 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76556:Import_L1_C0", "label": "pysph.base.api import base", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.1111, 0.1111, 0, 0.66, 0.0, 212, 0, 1, 0, 0, 212, 0, 0], "semantic": {"name": "pysph.base.api", "arg_names": [], "import_names": [... | [] |
""" Test the share_data function for various cases
cases to run are chosen based on the size of the MPI.COMM_wORLD
case 1: for 5 processes
Processors arrangement:
4
0 1 2 3
Nbr lists:
0: 1,4
1: 0,2,4
2: 1,3,4
3: 2
4: 0,1,2
case 2: for 2 processes
both neighbors of each other
case 3,4,5: n processes (n>1 for case... | ajibawa-2023/Python-Code-Large/train/row_76558 | 87 | 141 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76558:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 23], "level": 0, "parent": null, "vector": [8, 0, 0.0851, 0.1631, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76558:Try_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76558:Import_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76558:Try_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76558:Import_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
"""
Simple script to check if the load balancing works on 1-d data.
"""
try:
import mpi4py.MPI as mpi
except ImportError:
import nose.plugins.skip as skip
reason = "mpi4py not installed"
raise skip.SkipTest(reason)
# mpi imports
from mpi4py import MPI
comm = MPI.COMM_WORLD
num_procs = comm.Get_size()
... | ajibawa-2023/Python-Code-Large/train/row_76559 | 36 | 59 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76559:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0339, 0.0508, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76559:Try_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76559:Import_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76559:Try_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76559:Import_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_7... |
"""
Simple script to check if the load balancing works on 2-d data.
"""
try:
import mpi4py.MPI as mpi
except ImportError:
import nose.plugins.skip as skip
reason = "mpi4py not installed"
raise skip.SkipTest(reason)
# mpi imports
from mpi4py import MPI
comm = MPI.COMM_WORLD
num_procs = comm.Get_size()
... | ajibawa-2023/Python-Code-Large/train/row_76560 | 36 | 57 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76560:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0351, 0.0526, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76560:Try_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76560:Import_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76560:Try_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76560:Import_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_7... |
""" Module to implement various space filling curves for load balancing """
import numpy
from pysph.base.point import IntPoint
try:
from hilbert import Hilbert_to_int
have_hilbert = True
except ImportError:
# TODO: implement Hilbert's SFC
have_hilbert = False
def morton_sfc(cell_id, maxlen=20, dim=3):... | ajibawa-2023/Python-Code-Large/train/row_76561 | 35 | 46 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76561:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0217, 0.0217, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76561:Try_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76561:ImportFrom_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76561:Try_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76561:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
""" Helper functions to generate commonly used geometries.
PySPH used an axis convention as follows:
Y
|
|
|
|
|
| /Z
| /
| /
| /
| /
| /
|/_________________X
"""
import numpy
def create_2D_tank(x1,y1,x2,y2,dx):
""" Generate an open rectangular tank.
Parameters:
-----------
x1,y1... | ajibawa-2023/Python-Code-Large/train/row_76563 | 73 | 140 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76563:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 21], "level": 0, "parent": null, "vector": [8, 0, 0.0786, 0.15, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76563:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76563:Expr_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76563:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76563:Assign_L37_C4"}, {"f": "ajibawa-2023/Python-Code... |
""" Standard shock tube problem by Monaghan """
import numpy
import pysph.base.api as base
import pysph.solver.api as solver
import get_shock_tube_data as data
CLDomain = base.DomainManagerType
CLLocator = base.OpenCLNeighborLocatorType
Locator = base.NeighborLocatorType
kernel = base.CubicSplineKernel
hks=False
... | ajibawa-2023/Python-Code-Large/train/row_76565 | 46 | 85 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76565:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0118, 0.0118, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76565:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76565:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76565:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76565:If_L56_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
""" Functions to get the initial data for the shock tube problems """
import numpy
import pysph.base.api as base
def get_shock_tube_data(nl, nr, xl, xr,
pl, pr, rhol, rhor, ul, ur,
g1, g2, h0, gamma=1.4,
m0=None):
dxl = numpy.abs(xl)/nl
... | ajibawa-2023/Python-Code-Large/train/row_76566 | 58 | 101 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76566:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0099, 0.0099, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76566:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76566:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76566:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76566:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code... |
""" Shock tube problem with the ADKE procedure of Sigalotti """
import pysph.solver.api as solver
import pysph.base.api as base
import pysph.sph.api as sph
from pysph.base.kernels import CubicSplineKernel
import numpy
Fluid = base.ParticleType.Fluid
Boundary = base.ParticleType.Boundary
# Shock tube parameters
nl ... | ajibawa-2023/Python-Code-Large/train/row_76567 | 71 | 206 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76567:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0049, 0.0049, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76567:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76567:FunctionDef_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76567:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_76567:Assign_L33_C8"}, {"f": "ajibawa-2023/Python-... |
""" Robert's problem """
import numpy
import pysph.base.api as base
import pysph.solver.api as solver
import get_shock_tube_data as get_data
CLDomain = base.DomainManagerType
CLLocator = base.OpenCLNeighborLocatorType
Locator = base.NeighborLocatorType
# Roberts problem parameters
vc = 0.42
xl = -4.8; xr = 8.0
pl... | ajibawa-2023/Python-Code-Large/train/row_76568 | 50 | 96 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76568:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0104, 0.0104, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76568:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76568:Assign_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76568:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76568:Assign_L64_C4"}, {"f": "ajibawa-2023/Python-Co... |
""" Cylindrical Noh's implosion problem using the ADKE algorithm.
Particles are distributed on concentric circles about the origin with
increasing number of particles with increasing radius. The velocity is
initially uniform and directed towards the origin.
"""
import numpy
import pysph.sph.api as sp
import pysph.ba... | ajibawa-2023/Python-Code-Large/train/row_76569 | 64 | 108 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76569:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 7], "level": 0, "parent": null, "vector": [8, 0, 0.037, 0.0648, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76569:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76569:Assign_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76569:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76569:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Co... |
"""Sedov point explosion problem using the ADKE algorithm.
Particles are distributed on concentric circles about the origin with
increasing number of particles with increasing radius. A unit charge
is distributed about the center which gives the initial pressure
disturbance.
"""
import numpy
import pysph.sph.api as... | ajibawa-2023/Python-Code-Large/train/row_76570 | 64 | 114 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76570:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 8], "level": 0, "parent": null, "vector": [8, 0, 0.0395, 0.0702, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76570:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76570:Assign_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76570:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76570:Assign_L46_C4"}, {"f": "ajibawa-2023/Python-Co... |
""" Sjogreen's test case """
import numpy
import pysph.base.api as base
import pysph.solver.api as solver
import get_shock_tube_data as get_data
CLDomain = base.DomainManagerType
CLLocator = base.OpenCLNeighborLocatorType
Locator = base.NeighborLocatorType
# shock tube parameters
xl = -1.0; xr = 1.0
pl = 0.4; pr =... | ajibawa-2023/Python-Code-Large/train/row_76571 | 45 | 85 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76571:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0118, 0.0118, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76571:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76571:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76571:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76571:If_L56_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
""" Strong blaswave problem proposed by Sigalotti. Mach number = 771 """
import numpy
import pysph.base.api as base
import pysph.solver.api as solver
import get_shock_tube_data as data
Locator = base.NeighborLocatorType
kernel = base.CubicSplineKernel
hks=False
# shock tube parameters
xl = -1.5; xr = 1.5
pl = 1e4... | ajibawa-2023/Python-Code-Large/train/row_76572 | 46 | 82 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76572:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0122, 0.0122, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76572:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76572:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76572:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76572:If_L56_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
"""1D shock tube problem which simulates the collision of two strong
shocks. The test is described in 'An adaptive SPH method for strong
shocks' by Leonardo Di. G. Sigalotti and Henri Lopez and Leonardo
Trujillo, JCP, vol 228, pp (5888-5907)
"""
import pysph.solver.api as solver
import pysph.base.api as base
import p... | ajibawa-2023/Python-Code-Large/train/row_76573 | 43 | 85 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76573:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0412, 0.0706, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76573:FunctionDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76573:Assign_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76573:FunctionDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76573:Assign_L61_C4"}, {"f": "ajibawa-2023/Python-Co... |
""" Standard shock tube problem by Monaghan """
import numpy
import pysph.base.api as base
import pysph.solver.api as solver
import get_shock_tube_data as data
CLDomain = base.DomainManagerType
CLLocator = base.OpenCLNeighborLocatorType
Locator = base.NeighborLocatorType
kernel = base.CubicSplineKernel
hks=False
... | ajibawa-2023/Python-Code-Large/train/row_76574 | 46 | 85 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76574:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0118, 0.0118, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76574:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76574:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76574:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76574:If_L56_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
"""Woodward and COllela interacting blast wave."""
import numpy
import pysph.sph.api as sph
import pysph.base.api as base
import pysph.solver.api as solver
xl = 0
xr = 1.0
np = 5001
nbp = 100
dx = (xr-xl)/(np-1)
D = 1.5
h0 = D*dx
adke_eps = 0.5
adke_k = 1.0
g1 = 0.2
g2 = 0.4
alpha = 1.0
beta = 1.0
gamma = 1.4
t... | ajibawa-2023/Python-Code-Large/train/row_76575 | 96 | 157 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76575:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0064, 0.0064, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76575:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76575:FunctionDef_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76575:FunctionDef_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_76575:Assign_L34_C8"}, {"f": "ajibawa-2023/Python-... |
""" An example script for running the shock tube problem using Standard
SPH.
Global properties for the shock tube problem:
---------------------------------------------
x ~ [-.6,.6], dxl = 0.001875, dxr = dxl*4, m = dxl, h = 2*dxr
rhol = 1.0, rhor = 0.25, el = 2.5, er = 1.795, pl = 1.0, pr = 0.1795
These are obtaine... | ajibawa-2023/Python-Code-Large/train/row_76576 | 16 | 50 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76576:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 11], "level": 0, "parent": null, "vector": [8, 0, 0.12, 0.22, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation... | [] |
""" Shock tube problem with the ADKE procedure of Sigalotti """
import pysph.solver.api as solver
import pysph.base.api as base
import pysph.sph.api as sph
from pysph.base.kernels import CubicSplineKernel
import numpy
Fluid = base.ParticleType.Fluid
Boundary = base.ParticleType.Boundary
# Shock tube parameters
nl ... | ajibawa-2023/Python-Code-Large/train/row_76577 | 85 | 226 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76577:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0044, 0.0044, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76577:ClassDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76577:FunctionDef_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76577:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_76577:Assign_L35_C8"}, {"f": "ajibawa-2023/Python-... |
""" The moving square test case is part of the SPHERIC benchmark
tests. Refer to the document for the test details.
Numerical Parameters:
---------------------
dx = dy = 0.005
h = 0.0065 => h/dx = 1.3
Length of Box = 10
Height of Box = 5
Number of particles = 27639 + 1669 = 29308
ro = 1000.0
Vmax = 1.0
co = 15 (1... | ajibawa-2023/Python-Code-Large/train/row_76578 | 122 | 268 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76578:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 27], "level": 0, "parent": null, "vector": [8, 0, 0.0522, 0.1007, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76578:ClassDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76578:FunctionDef_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76578:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_76578:Assign_L60_C8"}, {"f": "ajibawa-2023/Python-... |
""" An example solving stress test case """
import numpy
import sys
import os
import pysph.base.api as base
import pysph.solver.api as solver
from pysph.solver.stress_solver import StressSolver, get_particle_array
from pysph.sph.funcs import stress_funcs, arithmetic_funcs
from pysph.sph.api import SPHFunction
app = ... | ajibawa-2023/Python-Code-Large/train/row_76579 | 111 | 168 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76579:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.006, 0.006, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotatio... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76579:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76579:Expr_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76579:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76579:FunctionDef_L25_C4"}, {"f": "ajibawa-2023/Python-Code-... |
""" An example solving stress test case """
import numpy
import sys
import pysph.base.api as base
import pysph.solver.api as solver
from pysph.solver.stress_solver import StressSolver, get_particle_array
from pysph.sph.funcs import stress_funcs, arithmetic_funcs
from pysph.sph.api import SPHFunction
app = solver.App... | ajibawa-2023/Python-Code-Large/train/row_76580 | 83 | 124 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76580:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0081, 0.0081, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76580:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76580:Expr_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76580:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76580:FunctionDef_L19_C4"}, {"f": "ajibawa-2023/Python-Code-... |
""" An example solving stress test case """
import sys
import numpy
from numpy import pi, sin, sinh, cos, cosh
import pysph.base.api as base
import pysph.sph.api as sph
import pysph.solver.api as solver
from pysph.solver.stress_solver import StressSolver, get_particle_array
from pysph.sph.funcs import stress_funcs
fr... | ajibawa-2023/Python-Code-Large/train/row_76581 | 118 | 172 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76581:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0058, 0.0058, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76581:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76581:FunctionDef_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76581:FunctionDef_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_76581:Assign_L23_C8"}, {"f": "ajibawa-2023/Python-... |
""" An example solving stress test case """
import sys
import numpy
from numpy import pi, sin, sinh, cos, cosh
import pysph.base.api as base
import pysph.sph.api as sph
import pysph.solver.api as solver
from pysph.solver.stress_solver import StressSolver
from pysph.sph.funcs import stress_funcs
from pysph.sph.api imp... | ajibawa-2023/Python-Code-Large/train/row_76582 | 119 | 195 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76582:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0051, 0.0051, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76582:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76582:FunctionDef_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76582:FunctionDef_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_76582:Assign_L22_C8"}, {"f": "ajibawa-2023/Python-... |
""" Balls colliding in 2D """
import numpy
import pysph.base.api as base
import pysph.sph.api as sph
import pysph.solver.api as solver
import pysph.sph.funcs.stress_funcs as stress_funcs
app = solver.Application()
Solid = base.ParticleType.Solid
E = 1e7
nu = 0.3975
G = E/(2.0*(1+nu))
K = sph.get_K(G, nu)
ro = 1.0... | ajibawa-2023/Python-Code-Large/train/row_76583 | 106 | 342 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76583:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0029, 0.0029, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76583:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76583:Assign_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76583:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76583:Assign_L30_C4"}, {"f": "ajibawa-2023/Python-Co... |
""" An example solving stress test case : colliding rubber balls """
import sys
import numpy
from numpy import pi, sin, sinh, cos, cosh
import pysph.base.api as base
import pysph.sph.api as sph
import pysph.solver.api as solver
from pysph.solver.stress_solver import StressSolver
from pysph.sph.funcs import stress_fun... | ajibawa-2023/Python-Code-Large/train/row_76584 | 82 | 141 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76584:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0071, 0.0071, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76584:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76584:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76584:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76584:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Co... |
""" NBody Example """
import pysph.base.api as base
import pysph.solver.api as solver
import pysph.sph.api as sph
import numpy
Fluid = base.ParticleType.Fluid
# number of particles, time step and final time
np = 1024
dt = 1e-2
tf = 10.0
nsteps = tf/dt
def get_particles(**kwargs):
x = numpy.random.random(... | ajibawa-2023/Python-Code-Large/train/row_76585 | 29 | 61 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76585:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0164, 0.0164, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76585:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76585:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76585:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76585:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Co... |
""" 2D Dam Break Over a dry bed. The case is described in "State of
the art classical SPH for free surface flows", Benedict D Rogers,
Robert A, Dalrymple and Alex J.C Crespo, Journal of Hydraulic
Research, Vol 48, Extra Issue (2010), pp 6-27
Setup:
------
x x !
x x !
x ... | ajibawa-2023/Python-Code-Large/train/row_76586 | 72 | 273 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76586:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 74], "level": 0, "parent": null, "vector": [8, 0, 0.1374, 0.2711, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76586:FunctionDef_L106_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76586:Expr_L107_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76586:FunctionDef_L106_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76586:Assign_L109_C4"}, {"f": "ajibawa-2023/Python-... |
""" A tiny dam break problem
Setup:
------
x x !
x x !
x x !
x x !
x o o o o o x !
x o o o o o x !3m
x o o o o o x !
x o o o o o x !
x o o o o o x !
x x !
xxxxxxxxxxxxxxxxxxxxx | ... | ajibawa-2023/Python-Code-Large/train/row_76587 | 61 | 204 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76587:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 63], "level": 0, "parent": null, "vector": [8, 0, 0.1569, 0.3088, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76587:FunctionDef_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76587:Expr_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76587:FunctionDef_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76587:Assign_L91_C4"}, {"f": "ajibawa-2023/Python-Code... |
""" 2D Dam Break Over a dry bed. The case is described in "State of
the art classical SPH for free surface flows", Benedict D Rogers,
Robert A, Dalrymple and Alex J.C Crespo, Journal of Hydraulic
Research, Vol 48, Extra Issue (2010), pp 6-27
Setup:
------
x x !
x x !
x ... | ajibawa-2023/Python-Code-Large/train/row_76588 | 75 | 262 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76588:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 74], "level": 0, "parent": null, "vector": [8, 0, 0.1431, 0.2824, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76588:FunctionDef_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76588:Expr_L108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76588:FunctionDef_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76588:Assign_L110_C4"}, {"f": "ajibawa-2023/Python-... |
""" Dam break simulation over a wet bed.
This is part of the SPHERIC validation test cases (case 5)
(http://wiki.manchester.ac.uk/spheric/index.php/SPHERIC_Home_Page)
The main reference for this test case is 'State-of-the-art classical SPH for free-surface flows' by Moncho Gomez-Gesteira and Benedict D. Rogers and Ro... | ajibawa-2023/Python-Code-Large/train/row_76589 | 88 | 261 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76589:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 10], "level": 0, "parent": null, "vector": [8, 0, 0.0211, 0.0383, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76589:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76589:Expr_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76589:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76589:Assign_L46_C4"}, {"f": "ajibawa-2023/Python-Code... |
""" 2D Dam Break Over a dry bed. The case is described in "State of
the art classical SPH for free surface flows", Benedict D Rogers,
Robert A, Dalrymple and Alex J.C Crespo, Journal of Hydraulic
Research, Vol 48, Extra Issue (2010), pp 6-27
Setup:
------
x x !
x x !
x ... | ajibawa-2023/Python-Code-Large/train/row_76590 | 120 | 338 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76590:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 74], "level": 0, "parent": null, "vector": [8, 0, 0.1109, 0.2189, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76590:FunctionDef_L103_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76590:Expr_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76590:FunctionDef_L103_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76590:Return_L118_C4"}, {"f": "ajibawa-2023/Python-... |
""" An example solving the Ellptical drop test case """
import pysph.base.api as base
import pysph.solver.api as solver
import warnings
dt = 1e-4
tf = 0.0076
app = solver.Application()
# set the integrator type
integrator_type = solver.RK2Integrator
s = solver.FluidSolver(dim=2, integrator_type=integrator_type)
... | ajibawa-2023/Python-Code-Large/train/row_76591 | 18 | 45 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76591:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0222, 0.0222, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76591:If_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76591:Assign_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76591:If_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76591:Expr_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_7... |
""" A simple example in which two drops collide """
import pysph.solver.api as solver
import pysph.base.api as base
import pysph.sph.api as sph
import numpy
def get_circular_patch(name="", type=0, dx=0.05):
x,y = numpy.mgrid[-1.05:1.05+1e-4:dx, -1.05:1.05+1e-4:dx]
x = x.ravel()
y = y.ravel()
m... | ajibawa-2023/Python-Code-Large/train/row_76592 | 41 | 75 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76592:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0133, 0.0133, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76592:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76592:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76592:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76592:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code... |
""" A script to demonstrate the simplest of calculations in parallel
Setup:
------
Two particle arrays are created on two separate processors with the
following procerties:
processor 0:
x ~ [0,1], dx = 0.1, h = 0.2, m = 0.1, fval = x*x
processor 1:
x ~ [1.1, 2], dx = 0.1, h = 0.2, m = 0.1, fval = x*x
"""
#... | ajibawa-2023/Python-Code-Large/train/row_76593 | 7 | 10 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76593:ImportFrom_L1_C0", "label": "from mpi4py import MPI", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.1, 0.1, 0, 0.66, 0.0, 985, 0, 1, 0, 0, 985, 0, 0], "semantic": {"name": "mpi4py", "arg_names": [], "import_names": ["MPI"], "rhs_c... | [] |
""" Simple motion. """
import numpy
import pysph.base.api as base
import pysph.solver.api as solver
import pysph.sph.api as sph
from random import randint
from numpy import random
nx = 1 << 5
dx = 0.5/nx
def create_particles_3d(**kwargs):
x, y, z = numpy.mgrid[0.25:0.75+1e-10:dx,
0.25... | ajibawa-2023/Python-Code-Large/train/row_76594 | 68 | 163 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76594:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0061, 0.0061, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76594:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76594:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76594:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76594:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Co... |
def exact_solution(tf=0.00076, dt=1e-4):
""" Exact solution for the the elliptical drop equations """
import numpy
A0 = 100
a0 = 1.0
t = 0.0
theta = numpy.linspace(0,2*numpy.pi, 101)
Anew = A0
anew = a0
while t <= tf:
t += dt
Aold = Anew
aold = anew
... | ajibawa-2023/Python-Code-Large/train/row_76595 | 17 | 30 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76595:FunctionDef_L1_C0", "label": "exact_solution", "type": "function", "loc": [1, 27], "level": 0, "parent": null, "vector": [2, 0, 0.4667, 0.9, 0, 0.66, 0.0, 167, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "exact_solution", "arg_names": ["tf", "dt"], "import_names": ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76595:FunctionDef_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76595:Expr_L2_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76595:FunctionDef_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76595:Import_L3_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
""" An example Script to study the behavior of Monaghan type repulsive
particles (Smoothed Particle Hydrodynamics, Reports on Progresses in
Physics)
The boundary particles are an improvement over the Lenard Jones type
repulsive boundary particles. One of the main features is that a
particle moving parallel to the wall... | ajibawa-2023/Python-Code-Large/train/row_76596 | 42 | 204 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76596:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 84], "level": 0, "parent": null, "vector": [8, 0, 0.2083, 0.4118, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [] |
""" An example solving the Elliptical drop test case with various interfaces """
import pysph.base.api as base
import pysph.solver.api as solver
app = solver.Application()
app.process_command_line(['-q', '--interactive',
'--xml-rpc=0.0.0.0:8900', '--multiproc=pysph@0.0.0.0:8800'])
s = solver.Flu... | ajibawa-2023/Python-Code-Large/train/row_76597 | 12 | 22 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76597:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0455, 0.0455, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76597:If_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76597:Expr_L21_C4"}] |
""" Example file showing the use of solver controller and various interfaces
Usage:
Run this file after running the `controller_elliptical_drop.py` example file
A matplotlib plot window will open showing the current position of all
the particles and colored according to their velocities. The plot is update... | ajibawa-2023/Python-Code-Large/train/row_76598 | 91 | 156 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76598:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 10], "level": 0, "parent": null, "vector": [8, 0, 0.0353, 0.0641, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76598:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76598:Expr_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76598:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76598:Expr_L28_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
"""
PySPH
=====
A general purpose Smoothed Particle Hydrodynamics framework.
This package provides a general purpose framework for SPH simulations
in Python. The framework emphasizes flexibility and efficiency while
allowing most of the user code to be written in pure Python. See here:
http://pysph.googlecode.... | ajibawa-2023/Python-Code-Large/train/row_76599 | 76 | 198 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76599:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 14], "level": 0, "parent": null, "vector": [8, 0, 0.0379, 0.0707, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76599:Try_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76599:ImportFrom_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76599:Try_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76599:ImportFrom_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
#! /usr/bin/env python
# Author: Stefan Behnel <scoder@users.berlios.de>
# http://hg.cython.org/cython-devel/file/tip/Tools/cython-epydoc.py
#
# --------------------------------------------------------------------
import re
from epydoc import docstringparser as dsp
CYTHON_SIGNATURE_RE = re.compile(
# Class name ... | ajibawa-2023/Python-Code-Large/train/row_76600 | 17 | 47 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76600:Import_L7_C0", "label": "re import re", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.1489, 0.0213, 0, 0.66, 0.0, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": ""... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76600:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76600:Assign_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76600:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76600:Try_L28_C4"}, {"f": "ajibawa-2023/Python-Code-... |
import re, textwrap
from docscrape import NumpyDocString, FunctionDoc, ClassDoc
class SphinxDocString(NumpyDocString):
# string conversion routines
def _str_header(self, name, symbol='`'):
return ['.. rubric:: ' + name, '']
def _str_field_list(self, name):
return [':' + name + ':']
de... | ajibawa-2023/Python-Code-Large/train/row_76601 | 59 | 108 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76601:Import_L1_C0", "label": "re import re, textwrap", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0093, 0.0093, 0, 0.66, 0.0, 540, 0, 2, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re", "textwrap"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76601:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76601:FunctionDef_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76601:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_76601:Return_L7_C8"}, {"f": "ajibawa-2023/Python-Code... |
""" Turn compiler.ast structures back into executable python code.
The unparse method takes a compiler.ast tree and transforms it back into
valid python code. It is incomplete and currently only works for
import statements, function calls, function definitions, assignments, and
basic expressions.
... | ajibawa-2023/Python-Code-Large/train/row_76602 | 386 | 860 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76602:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 12], "level": 0, "parent": null, "vector": [8, 0, 0.0076, 0.014, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76602:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76602:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76602:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76602:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code... |
from cStringIO import StringIO
import compiler
import inspect
import textwrap
import tokenize
from compiler_unparse import unparse
class Comment(object):
""" A comment block.
"""
is_comment = True
def __init__(self, start_lineno, end_lineno, text):
# int : The first line number in the block. ... | ajibawa-2023/Python-Code-Large/train/row_76603 | 97 | 158 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76603:ImportFrom_L1_C0", "label": "from cStringIO import StringIO", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0063, 0.0063, 0, 0.66, 0.0, 764, 0, 1, 0, 0, 764, 0, 0], "semantic": {"name": "cStringIO", "arg_names": [], "import_names"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76603:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76603:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76603:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76603:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
import inspect
import os
import pydoc
import docscrape
from docscrape_sphinx import SphinxClassDoc, SphinxFunctionDoc
import numpydoc
import comment_eater
class SphinxTraitsDoc(SphinxClassDoc):
def __init__(self, cls, modulename='', func_doc=SphinxFunctionDoc):
if not inspect.isclass(cls):
rai... | ajibawa-2023/Python-Code-Large/train/row_76605 | 78 | 141 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76605:Import_L1_C0", "label": "inspect import inspect", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0071, 0.0071, 0, 0.66, 0.0, 878, 0, 1, 0, 0, 878, 0, 0], "semantic": {"name": "inspect", "arg_names": [], "import_names": ["inspect"],... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76605:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76605:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76605:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_76605:If_L12_C8"}, {"f": "ajibawa-2023/Python-Code... |
import pysph.base.api as base
import pysph.solver.api as solver
import pysph.sph.api as sph
import numpy
import time
import pyopencl as cl
CLDomain = base.DomainManagerType
CLLocator = base.OpenCLNeighborLocatorType
Locator = base.NeighborLocatorType
# number of particles
np = 16384
# number of times a single calc ... | ajibawa-2023/Python-Code-Large/train/row_76608 | 74 | 130 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76608:Import_L1_C0", "label": "pysph.base.api import base", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0077, 0.0077, 0, 0.66, 0.0, 212, 0, 1, 0, 0, 212, 0, 0], "semantic": {"name": "pysph.base.api", "arg_names": [], "import_names": [... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76608:For_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76608:Expr_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76608:For_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76608:Expr_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_7... |
""" Benchmark for the PySPH neighbor search functions. """
import sys
import numpy
import time
#PySPH imports
import pysph.base.api as base
def get_points(np = 10000):
""" Get np particles in domain [1, -1] X [-1, 1] """
x = numpy.random.random(np)*2.0 - 1.0
y = numpy.random.random(np)*2.0 - 1.0
z =... | ajibawa-2023/Python-Code-Large/train/row_76609 | 67 | 109 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76609:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0092, 0.0092, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76609:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76609:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76609:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76609:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
from setuptools import find_packages, setup
from Cython.Distutils import build_ext
from numpy.distutils.extension import Extension
ext_modules = [Extension("cython_nnps", ["cython_nnps.pyx"],
language="c++",
extra_compile_args=["-O3", "-Wall"]
... | ajibawa-2023/Python-Code-Large/train/row_76610 | 5 | 22 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76610:ImportFrom_L1_C0", "label": "from setuptools import find_packages, setup", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0455, 0.0455, 0, 0.66, 0.0, 182, 0, 2, 0, 0, 182, 0, 0], "semantic": {"name": "setuptools", "arg_names": [], ... | [] |
''' Module to run bench modules which need to be run in mpi
This module imports the given module to run, and returns the result
of the bench functions of the modules. Also results are written to
mpirunner.log file
Usage:
1. Print the result in formatted form:
$ mpiexec -n <num_procs> python mpirunner.py <bench_name>
... | ajibawa-2023/Python-Code-Large/train/row_76611 | 46 | 73 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76611:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 13], "level": 0, "parent": null, "vector": [8, 0, 0.0959, 0.1781, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76611:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76611:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76611:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76611:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Co... |
import pysph.base.api as base
import pysph.solver.api as solver
import pysph.sph.api as sph
import numpy
import time
import pyopencl as cl
CLDomain = base.DomainManagerType
CLLocator = base.OpenCLNeighborLocatorType
# number of particles
np = 65536
# number of times a single calc is evaluated
neval = 5
x = numpy.l... | ajibawa-2023/Python-Code-Large/train/row_76612 | 73 | 124 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76612:Import_L1_C0", "label": "pysph.base.api import base", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0081, 0.0081, 0, 0.66, 0.0, 212, 0, 1, 0, 0, 212, 0, 0], "semantic": {"name": "pysph.base.api", "arg_names": [], "import_names": [... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76612:For_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76612:Expr_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76612:For_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76612:Expr_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_7... |
""" Time comparison for the Cython and OpenCL integrators.
We use the NBody integration example as the benchmark. Here, and all
neighbor locator is used. The setup consists of four points at the
vertices of the unit square in 2D.
"""
import numpy
from time import time
import pysph.solver.api as solver
import pysp... | ajibawa-2023/Python-Code-Large/train/row_76613 | 54 | 101 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76613:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 8], "level": 0, "parent": null, "vector": [8, 0, 0.0446, 0.0792, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
""" Benchmark example for binning particles in Cython and OpenCL """
import numpy
import numpy.random as random
from time import time
import pysph.base.api as base
import pysph.solver.api as solver
CLDomain = base.DomainManagerType
CLLocator = base.OpenCLNeighborLocatorType
# number of points
np = 2**20
# number o... | ajibawa-2023/Python-Code-Large/train/row_76614 | 36 | 61 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76614:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0164, 0.0164, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76614:For_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76614:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76614:For_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76614:Expr_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row... |
"""This module compiles the specified (all) the cython .pyx files
in the specified (current) directory into python extensions
"""
import sys
import os
from setuptools import setup
from Cython.Distutils import build_ext
from numpy.distutils.extension import Extension
import numpy
def get_spcl_extn(extn):
""" spe... | ajibawa-2023/Python-Code-Large/train/row_76615 | 35 | 61 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76615:Import_L1_C0", "label": "sys import sys", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0164, 0.0164, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76615:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76615:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76615:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76615:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code... |
""" some utility function for use in load_balance benchmark """
# MPI imports
from mpi4py import MPI
comm = MPI.COMM_WORLD
size = comm.Get_size()
rank = comm.Get_rank()
import sys
import os
from os.path import join, exists
import traceback
from optparse import OptionParser
# logging imports
import logging
# local ... | ajibawa-2023/Python-Code-Large/train/row_76616 | 185 | 330 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76616:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.003, 0.003, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotatio... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76616:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76616:Expr_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76616:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76616:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code... |
#!/usr/bin/python
# Copyright 2011 Google, Inc. All Rights Reserved.
# simple script to walk source tree looking for third-party licenses
# dumps resulting html page to stdout
import os, re, mimetypes, sys
# read source directories to scan from command line
SOURCE = sys.argv[1:]
# regex to find /* */ style commen... | ajibawa-2023/Python-Code-Large/train/row_76617 | 51 | 98 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76617:Import_L8_C0", "label": "os import os, re, mimetypes\u2026", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0816, 0.0102, 0, 0.66, 0.0, 688, 0, 4, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os",... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76617:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76617:FunctionDef_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76617:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_76617:Assign_L33_C8"}, {"f": "ajibawa-2023/Python-... |
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
from models import TaskModel, UserModel, GroupModel, MessageModel
class MainPage(webapp.RequestHandler):
def get(self):
# GQL is similar to SQL
tasks = TaskModel.all()
... | ajibawa-2023/Python-Code-Large/train/row_76618 | 14 | 41 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76618:ImportFrom_L1_C0", "label": "from google.appengine.ext import webapp", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0244, 0.0244, 0, 0.66, 0.0, 167, 0, 1, 0, 0, 167, 0, 0], "semantic": {"name": "google.appengine.ext", "arg_names"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76618:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76618:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76618:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_76618:Assign_L13_C8"}, {"f": "ajibawa-2023/Python-Cod... |
from google.appengine.api import users
from google.appengine.ext import db
import datetime
def str2date(string):
splitted = string.split("-")
return datetime.date(year=int(splitted[0]), month=int(splitted[1]), day=int(splitted[2]))
class UserModel(db.Model):
nick = db.StringProperty(req... | ajibawa-2023/Python-Code-Large/train/row_76619 | 96 | 136 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76619:ImportFrom_L1_C0", "label": "from google.appengine.api import users", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0074, 0.0074, 0, 0.66, 0.0, 279, 0, 1, 0, 0, 279, 0, 0], "semantic": {"name": "google.appengine.api", "arg_names":... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76619:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76619:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76619:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76619:Return_L9_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.ext import db
from google.appengine.ext.webapp import template
from google.appengine.api import mail
from django.utils import simplejson
import web
import ap... | ajibawa-2023/Python-Code-Large/train/row_76620 | 14 | 41 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76620:ImportFrom_L1_C0", "label": "from google.appengine.api import users", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0244, 0.0244, 0, 0.66, 0.0, 279, 0, 1, 0, 0, 279, 0, 0], "semantic": {"name": "google.appengine.api", "arg_names":... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76620:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76620:Expr_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76620:If_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76620:Expr_L41_C4"}] |
#!/usr/bin/env python
import sys
sys.path.append("gen-py")
from thrift.transport import TTransport
from thrift.transport import TSocket
from thrift.protocol import TBinaryProtocol
from risk import Rating
from risk.ttypes import *
transport = TTransport.TBufferedTransport(TSocket.TSocket("localhost", "9090"))
proto... | ajibawa-2023/Python-Code-Large/train/row_76622 | 13 | 21 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76622:Import_L3_C0", "label": "sys import sys", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.0476, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name"... | [] |
#!/usr/bin/python
# Copyright 2011 Google, Inc. All Rights Reserved.
# simple script to walk source tree looking for third-party licenses
# dumps resulting html page to stdout
import os, re, mimetypes, sys
# read source directories to scan from command line
SOURCE = sys.argv[1:]
# regex to find /* */ style commen... | ajibawa-2023/Python-Code-Large/train/row_76623 | 51 | 98 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76623:Import_L8_C0", "label": "os import os, re, mimetypes\u2026", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0816, 0.0102, 0, 0.66, 0.0, 688, 0, 4, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os",... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76623:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76623:FunctionDef_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76623:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_76623:Assign_L33_C8"}, {"f": "ajibawa-2023/Python-... |
#!/usr/bin/env python
import zlib
import os
from StringIO import StringIO
# Always returns a gzipped response body
print "Status: 200 Ok"
print ""
print(zlib.compress('This is a compressed string'))
| ajibawa-2023/Python-Code-Large/train/row_76624 | 6 | 12 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76624:Import_L2_C0", "label": "zlib import zlib", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1667, 0.0833, 0, 0.66, 0.0, 373, 0, 1, 0, 0, 373, 0, 0], "semantic": {"name": "zlib", "arg_names": [], "import_names": ["zlib"], "rhs_call_n... | [] |
#!/usr/bin/env python
import os
# Always returns an empty response body
# and adds in the X-Method: header with the
# method that was sent to the CGI
method = os.environ['REQUEST_METHOD']
if "GET" == method:
if "123456789" == os.environ.get('HTTP_IF_NONE_MATCH', ''):
print "Status: 304 Not Modified"
e... | ajibawa-2023/Python-Code-Large/train/row_76625 | 16 | 28 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76625:Import_L2_C0", "label": "os import os", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0714, 0.0357, 0, 0.66, 0.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": ""... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76625:If_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76625:If_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76625:If_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_76625:Expr_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76625:... |
#!/usr/bin/env python
import os
etag = os.environ.get("HTTP_IF_NONE_MATCH", None)
if etag:
print "Status: 304 Not Modified"
else:
print "Status: 200 Ok"
print 'ETag: "123456779"'
print "Content-Type: text/html"
print ""
print "<html></html>"
| ajibawa-2023/Python-Code-Large/train/row_76626 | 9 | 13 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76626:Import_L2_C0", "label": "os import os", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1538, 0.0769, 0, 0.66, 0.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": ""... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76626:If_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76626:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76626:If_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76626:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76626:I... |
#!/usr/bin/env python
import os
# Always returns an empty response body
# and adds in the X-Method: header with the
# method that was sent to the CGI
print "Status: 200 Ok"
print "Content-Type: text/plain"
print ""
print os.environ.get('HTTP_USER_AGENT', '')
| ajibawa-2023/Python-Code-Large/train/row_76627 | 5 | 12 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76627:Import_L2_C0", "label": "os import os", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1667, 0.0833, 0, 0.66, 0.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": ""... | [] |
#!/usr/bin/env python
import os
# Always returns an empty response body
# and adds in the X-Method: header with the
# method that was sent to the CGI
print "Status: 303 See Other"
print "Location: http://bitworking.org/projects/httplib2/test/303/final-destination.txt"
print "X-Method: %s" % os.environ['REQUEST_METHOD... | ajibawa-2023/Python-Code-Large/train/row_76628 | 5 | 13 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76628:Import_L2_C0", "label": "os import os", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1538, 0.0769, 0, 0.66, 0.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": ""... | [] |
#!/usr/bin/env python
import os
# Always returns an empty response body
# and adds in the X-Method: header with the
# method that was sent to the CGI
print "Status: 303 See Other"
print "Location: http://bitworking.org/projects/httplib2/test/methods/method_reflector.cgi"
print "X-Method: %s" % os.environ['REQUEST_MET... | ajibawa-2023/Python-Code-Large/train/row_76629 | 5 | 13 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76629:Import_L2_C0", "label": "os import os", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1538, 0.0769, 0, 0.66, 0.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": ""... | [] |
#!/usr/bin/env python
import os
# Always returns an empty response body
# and adds in the X-Method: header with the
# method that was sent to the CGI
print "Status: 200 Ok"
print "X-Method: %s" % os.environ['REQUEST_METHOD']
print ""
| ajibawa-2023/Python-Code-Large/train/row_76630 | 4 | 12 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76630:Import_L2_C0", "label": "os import os", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1667, 0.0833, 0, 0.66, 0.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": ""... | [] |
#!/usr/bin/env python
import os
# Always returns an empty response body
# and adds in the X-Method: header with the
# method that was sent to the CGI
print "Status: 200 Ok"
print "Content-type: text/plain"
print 'ETag: "alsjflaksjfasj"'
print ""
print "\n".join(["%s=%s" % (key, value) for key, value in os.environ.it... | ajibawa-2023/Python-Code-Large/train/row_76631 | 6 | 14 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76631:Import_L2_C0", "label": "os import os", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.0714, 0, 0.66, 0.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": ""... | [] |
"""
iri2uri
Converts an IRI to a URI.
"""
__author__ = "Joe Gregorio (joe@bitworking.org)"
__copyright__ = "Copyright 2006, Joe Gregorio"
__contributors__ = []
__version__ = "1.0.0"
__license__ = "MIT"
__history__ = """
"""
import urllib.parse
# Convert an IRI to a URI following the rules in RFC 3... | ajibawa-2023/Python-Code-Large/train/row_76632 | 43 | 110 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76632:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0318, 0.0545, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76632:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76632:Assign_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76632:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76632:Assign_L55_C4"}, {"f": "ajibawa-2023/Python-Co... |
"""
httplib2
A caching http interface that supports ETags and gzip
to conserve bandwidth.
Requires Python 3.0 or later
Changelog:
2009-05-28, Pilgrim: ported to Python 3
2007-08-18, Rick: Modified so it's able to use a socks proxy if needed.
"""
__author__ = "Joe Gregorio (joe@bitworking.org)"
__copyright__ = "C... | ajibawa-2023/Python-Code-Large/train/row_76633 | 705 | 1,276 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76633:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 14], "level": 0, "parent": null, "vector": [8, 0, 0.0063, 0.0102, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76633:Try_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76633:Import_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76633:Try_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76633:Assign_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
#!/usr/bin/env python3
"""
httplib2test
A set of unit tests for httplib2.py.
Requires Python 3.0 or later
"""
__author__ = "Joe Gregorio (joe@bitworking.org)"
__copyright__ = "Copyright 2006, Joe Gregorio"
__contributors__ = ["Mark Pilgrim"]
__license__ = "MIT"
__history__ = """ """
__version__ = "0.2 ... | ajibawa-2023/Python-Code-Large/train/row_76634 | 975 | 1,500 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76634:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 8], "level": 0, "parent": null, "vector": [8, 0, 0.0033, 0.0047, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76634:ClassDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76634:FunctionDef_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76634:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_76634:Assign_L37_C8"}, {"f": "ajibawa-2023/Python-... |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
import sys
pkgdir = {'': 'python%s' % sys.version_info[0]}
VERSION = '0.7.4'
setup(name='httplib2',
version=VERSION,
author='Joe Gregorio',
author_email='joe@bitworking.org',
url='http://cod... | ajibawa-2023/Python-Code-Large/train/row_76635 | 7 | 77 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76635:Try_L1_C0", "label": "try", "type": "try", "loc": [1, 4], "level": 0, "parent": null, "vector": [7, 0, 0.0325, 0.0519, 0, 0.66, 0.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "sni... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76635:Try_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76635:ImportFrom_L2_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76635:Try_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76635:ImportFrom_L4_C4"}] |
"""
httplib2test_appengine
A set of unit tests for httplib2.py on Google App Engine
"""
__author__ = "Joe Gregorio (joe@bitworking.org)"
__copyright__ = "Copyright 2011, Joe Gregorio"
import os
import sys
import unittest
# The test resources base uri
base = 'http://bitworking.org/projects/httplib2/test/'
#base = '... | ajibawa-2023/Python-Code-Large/train/row_76636 | 40 | 64 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76636:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0547, 0.0938, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76636:ClassDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76636:FunctionDef_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76636:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_76636:If_L35_C8"}, {"f": "ajibawa-2023/Python-Code... |
from realsocket import gaierror, error, getaddrinfo, SOCK_STREAM
| ajibawa-2023/Python-Code-Large/train/row_76637 | 1 | 1 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76637:ImportFrom_L1_C0", "label": "from realsocket import gaierror, error, getaddrinfo\u2026", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 1.0, 1.0, 0, 0.66, 0.0, 632, 0, 4, 0, 0, 632, 0, 0], "semantic": {"name": "realsocket", "arg_name... | [] |
import os
import unittest
import httplib2
from httplib2.test import miniserver
class HttpSmokeTest(unittest.TestCase):
def setUp(self):
self.httpd, self.port = miniserver.start_server(
miniserver.ThisDirHandler)
def tearDown(self):
self.httpd.shutdown()
def testGetFile(self... | ajibawa-2023/Python-Code-Large/train/row_76638 | 15 | 23 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76638:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0435, 0.0435, 0, 0.66, 0.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": ""... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76638:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76638:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76638:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_76638:Assign_L11_C8"}, {"f": "ajibawa-2023/Python-C... |
import logging
import os
import select
import SimpleHTTPServer
import SocketServer
import threading
HERE = os.path.dirname(__file__)
logger = logging.getLogger(__name__)
class ThisDirHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def translate_path(self, path):
path = path.split('?', 1)[0].split('#'... | ajibawa-2023/Python-Code-Large/train/row_76639 | 60 | 100 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76639:Import_L1_C0", "label": "logging import logging", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.01, 0.01, 0, 0.66, 0.0, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "logging", "arg_names": [], "import_names": ["logging"], "rh... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76639:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76639:FunctionDef_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76639:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_76639:Assign_L14_C8"}, {"f": "ajibawa-2023/Python-... |
"""
iri2uri
Converts an IRI to a URI.
"""
__author__ = "Joe Gregorio (joe@bitworking.org)"
__copyright__ = "Copyright 2006, Joe Gregorio"
__contributors__ = []
__version__ = "1.0.0"
__license__ = "MIT"
__history__ = """
"""
import urlparse
# Convert an IRI to a URI following the rules in RFC 3987
#
# The characte... | ajibawa-2023/Python-Code-Large/train/row_76640 | 43 | 110 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76640:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0318, 0.0545, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76640:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76640:Assign_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76640:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76640:Assign_L55_C4"}, {"f": "ajibawa-2023/Python-Co... |
"""SocksiPy - Python SOCKS module.
Version 1.00
Copyright 2006 Dan-Haim. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
... | ajibawa-2023/Python-Code-Large/train/row_76642 | 213 | 438 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76642:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 31], "level": 0, "parent": null, "vector": [8, 0, 0.0365, 0.0708, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76642:FunctionDef_L96_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76642:Expr_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76642:FunctionDef_L96_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76642:Assign_L102_C4"}, {"f": "ajibawa-2023/Python-Cod... |
# -*- coding: utf-8 -*-
#
# httplib2 documentation build configuration file, created by
# sphinx-quickstart on Thu Mar 27 16:07:14 2008.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren'... | ajibawa-2023/Python-Code-Large/train/row_76644 | 14 | 132 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76644:Import_L14_C0", "label": "sys import sys", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.1061, 0.0076, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_na... | [] |
from construct import RepeatUntil
from construct.core import Struct, Union
from construct.macros import *
from crypto.aes import AESdecryptCBC
from crypto.aeswrap import AESUnwrap
from zipfile import crc32
import struct
Dkey = 0x446B6579
EMF = 0x454D4621
BAG1 = 0x42414731
DONE = 0x444f4e45 #locker sentine... | ajibawa-2023/Python-Code-Large/train/row_76646 | 46 | 69 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76646:ImportFrom_L1_C0", "label": "from construct import RepeatUntil", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0145, 0.0145, 0, 0.66, 0.0, 235, 0, 1, 0, 0, 235, 0, 0], "semantic": {"name": "construct", "arg_names": [], "import_nam... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_76646:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76646:Assign_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76646:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76646:For_L30_C8"}, {"f": "ajibawa-2023/Python-Code-... |
#HAX
d=open("redsn0w_win_0.9.9b4/redsn0w.exe", "rb").read()
i = d.find("<key>IV</key>")
i = d.rfind("<?xml",0,i)
j = d.find("</plist>", i)
assert i != -1
assert j != -1
open("Keys.plist", "wb").write(d[i:j+8])
| ajibawa-2023/Python-Code-Large/train/row_76647 | 5 | 12 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_76647:Assign_L3_C0", "label": "d = read()", "type": "assigned_variable", "loc": [3, 3], "level": 0, "parent": null, "vector": [14, 0, 0.25, 0.0833, 0, 0.66, 0.0, 355, 3, 0, 0, 0, 453, 10, 2], "semantic": {"name": "d", "arg_names": [], "import_names": [], "rhs_call_name"... | [] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.