repo_name stringlengths 7 65 | path stringlengths 5 185 | copies stringlengths 1 4 | size stringlengths 4 6 | content stringlengths 977 990k | license stringclasses 14
values | hash stringlengths 32 32 | line_mean float64 7.18 99.4 | line_max int64 31 999 | alpha_frac float64 0.25 0.95 | ratio float64 1.5 7.84 | autogenerated bool 1
class | config_or_test bool 2
classes | has_no_keywords bool 2
classes | has_few_assignments bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
opencivicdata/scrapers-ca | tasks.py | 1 | 16797 | # coding: utf-8
import codecs
import csv
import importlib
import os
import re
from datetime import date, timedelta
from inspect import getsource
from io import StringIO
from urllib.parse import urlsplit
import lxml.html
import requests
from invoke import task
from opencivicdata.divisions import Division
from unidecod... | mit | 1f242fc1bd4df435c7848709f66c81cf | 39.921951 | 165 | 0.590774 | 3.760197 | false | false | false | false |
botify-labs/simpleflow | simpleflow/history.py | 1 | 28433 | import collections
from simpleflow import logger
# noinspection PyUnresolvedReferences
class History(object):
"""
History data.
:ivar _history: raw(ish) history events
:type _history: swf.models.history.History
:ivar _activities: activity events
:type _activities: collections.OrderedDict[str... | mit | e81315b2d0cced1a703d5d5ea4bb2cf7 | 37.5271 | 103 | 0.506805 | 4.687273 | false | false | false | false |
opencivicdata/scrapers-ca | ca_on_toronto_candidates/people.py | 1 | 1274 | from utils import CSVScraper
from datetime import date
class TorontoCandidatesPersonScraper(CSVScraper):
csv_url = 'https://docs.google.com/spreadsheets/d/e/2PACX-1vSBiU-M3w3hlEsdcnN_F6mYlYf5PmvsSpN73V3rbUVYK4JpI99acfZewhQ9EmZtG4niQRdy8EFDR53a/pub?gid=1564068820&single=true&output=csv'
updated_at = date(2018... | mit | ca0036c6d7c2b081dac51fd34dc6e11f | 43.571429 | 185 | 0.639423 | 2.689655 | false | false | false | false |
botify-labs/simpleflow | simpleflow/swf/process/poller.py | 1 | 6102 | import abc
import os
import signal
import swf.actors
import swf.exceptions
from simpleflow import logger, utils
from simpleflow.process import NamedMixin, with_state
from simpleflow.swf.helpers import swf_identity
__all__ = ["Poller"]
class Poller(swf.actors.Actor, NamedMixin):
"""Multi-processing implementatio... | mit | cda1fa8221e2fcbaac5dbf6a0cc763ec | 31.457447 | 131 | 0.602262 | 4.291139 | false | false | false | false |
botify-labs/simpleflow | tests/integration/test_markers.py | 1 | 1872 | from sure import expect
from tests.integration import VCRIntegrationTest, vcr
class TestMarkers(VCRIntegrationTest):
@vcr.use_cassette
def test_without_replays(self):
events = self.run_standalone("tests.integration.workflow.MarkerWorkflow", False)
marker_recorded = list(
filter(la... | mit | 613e244dd55b3d4b894900821491772a | 37.204082 | 88 | 0.596154 | 4.017167 | false | true | false | false |
opencivicdata/scrapers-ca | ca_qc_beaconsfield/people.py | 1 | 1232 | from utils import CanadianScraper, CanadianPerson as Person
COUNCIL_PAGE = 'http://www.beaconsfield.ca/fr/notre-ville/conseil-de-ville-et-districts-electoraux'
class BeaconsfieldPersonScraper(CanadianScraper):
def scrape(self):
page = self.lxmlize(COUNCIL_PAGE)
councillors = page.xpath('//div[co... | mit | 49c2c111609f7cc5fd94650a63d3c520 | 40.066667 | 99 | 0.583604 | 3.320755 | false | false | false | false |
sqlalchemy/alembic | alembic/testing/util.py | 2 | 3323 | # testing/util.py
# Copyright (C) 2005-2019 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
from __future__ import annotations
import re
import types
from typing import Union
... | mit | 470709a2eb030e671f8b4fcfc906318f | 25.165354 | 73 | 0.594643 | 4.057387 | false | true | false | false |
sqlalchemy/alembic | alembic/testing/schemacompare.py | 2 | 4373 | from itertools import zip_longest
from sqlalchemy import schema
class CompareTable:
def __init__(self, table):
self.table = table
def __eq__(self, other):
if self.table.name != other.name or self.table.schema != other.schema:
return False
for c1, c2 in zip_longest(self.t... | mit | dedff80403a2b9b5550c6712f026f6d9 | 27.032051 | 78 | 0.547679 | 4.233301 | false | false | false | false |
cupy/cupy | tests/cupyx_tests/scipy_tests/special_tests/test_zeta.py | 1 | 1605 | import unittest
from cupy import testing
import cupyx.scipy.special # NOQA
import numpy
@testing.gpu
@testing.with_requires('scipy')
class TestZeta(unittest.TestCase):
@testing.for_all_dtypes(no_complex=True)
@testing.numpy_cupy_allclose(atol=1e-5, scipy_name='scp')
def test_arange(self, xp, scp, dtype... | mit | 3841a2028155f879f9352237e4668136 | 31.755102 | 73 | 0.626168 | 2.93956 | false | true | false | false |
cupy/cupy | cupyx/jit/_builtin_funcs.py | 1 | 17512 | from typing import Any, Mapping
import warnings
import cupy
from cupy_backends.cuda.api import runtime
from cupy.cuda import device
from cupyx.jit import _cuda_types
from cupyx.jit import _cuda_typerules
from cupyx.jit._internal_types import BuiltinFunc
from cupyx.jit._internal_types import Data
from cupyx.jit._inter... | mit | 31d8ecf147db69ea107315f90d193a0f | 34.235412 | 115 | 0.551165 | 3.840351 | false | false | false | false |
cupy/cupy | tests/cupy_tests/core_tests/test_ndarray_get.py | 1 | 5172 | import unittest
import cupy
from cupy import cuda
from cupy import testing
import numpy
from numpy import testing as np_testing
@testing.gpu
class TestArrayGet(unittest.TestCase):
def setUp(self):
self.stream = cuda.Stream.null
def check_get(self, f, stream, order='C'):
a_gpu = f(cupy)
... | mit | 81a826a6498844e0814a6d99ef0d21b3 | 34.916667 | 79 | 0.607502 | 3.334623 | false | true | false | false |
cupy/cupy | cupy/_math/rounding.py | 1 | 1843 | from cupy import _core
from cupy._core import fusion
from cupy._math import ufunc
def around(a, decimals=0, out=None):
"""Rounds to the given number of decimals.
Args:
a (cupy.ndarray): The source array.
decimals (int): Number of decimal places to round to (default: 0).
If decimal... | mit | 8d5ef66206404446e8959fa354cd46b5 | 22.935065 | 76 | 0.60662 | 3.326715 | false | false | false | false |
cupy/cupy | tests/cupyx_tests/scipy_tests/special_tests/test_gamma.py | 1 | 2238 | import numpy
import pytest
import cupy
from cupy import testing
import cupyx.scipy.special # NOQA
@testing.gpu
@testing.with_requires('scipy')
class TestGamma:
@pytest.mark.parametrize('function', ['gamma', 'loggamma', 'rgamma'])
@testing.for_all_dtypes(no_complex=True)
@testing.numpy_cupy_allclose(ato... | mit | b5d116a7961f743207b9c42f29a7ca89 | 33.96875 | 77 | 0.618856 | 3.169972 | false | true | false | false |
cupy/cupy | cupyx/scipy/fft/_fftlog.py | 1 | 6367 | '''Fast Hankel transforms using the FFTLog algorithm.
The implementation closely follows the Fortran code of Hamilton (2000).
'''
import math
from warnings import warn
import cupy
from cupyx.scipy.fft import _fft
from cupyx.scipy.special import loggamma, poch
try:
# fht only exists in SciPy >= 1.7
from scipy... | mit | c11874fbedd31611cb420eb27f068ad1 | 27.297778 | 79 | 0.590859 | 3.260113 | false | false | false | false |
cupy/cupy | cupyx/scipy/fftpack/_fft.py | 1 | 19420 | from numpy import prod
import cupy
from cupy.cuda import cufft
from cupy.fft import config
from cupy.fft._fft import (_convert_fft_type, _default_fft_func, _fft,
_get_cufft_plan_nd, _get_fftn_out_size,
_output_dtype)
from cupy.fft._cache import get_plan_cache
def... | mit | c5b7754cba8aeed9813a8d8fc17f7524 | 38.391481 | 79 | 0.597168 | 3.667611 | false | false | false | false |
cupy/cupy | tests/cupy_tests/linalg_tests/test_decomposition.py | 1 | 13602 | import unittest
import numpy
import pytest
import cupy
from cupyx import cusolver
from cupy.cuda import driver
from cupy.cuda import runtime
from cupy.linalg import _util
from cupy import testing
from cupy.testing import _condition
import cupyx
def random_matrix(shape, dtype, scale, sym=False):
m, n = shape[-2:... | mit | dd8e76fc2a971e5c41adf7403f699381 | 35.762162 | 78 | 0.579988 | 3.037517 | false | true | false | false |
cupy/cupy | cupyx/scipy/sparse/_compressed.py | 1 | 30731 | import string
import warnings
import numpy
try:
import scipy.sparse
scipy_available = True
except ImportError:
scipy_available = False
import cupy
import cupyx
from cupy import _core
from cupy._core import _scalar
from cupy._creation import basic
from cupyx import cusparse
from cupyx.scipy.sparse import ... | mit | a03c168afb9fe7164f5f318ed707a32e | 34.692218 | 79 | 0.535127 | 3.957121 | false | false | false | false |
cupy/cupy | examples/cutensor/elementwise_binary.py | 1 | 1106 | #
# D_{x,y,z} = alpha * A_{z,y,x} + gamma * C_{x,y,z}
#
import numpy
import cupy
from cupyx import cutensor
import cupyx.time
dtype = numpy.float32
mode_a = ('z', 'y', 'x')
mode_c = ('x', 'y', 'z')
extent = {'x': 400, 'y': 200, 'z': 300}
a = cupy.random.random([extent[i] for i in mode_a])
c = cupy.random.random([e... | mit | f4c03ed9f0887f11cabf01e2a946ab6e | 23.043478 | 58 | 0.65009 | 2.496614 | false | false | false | false |
cupy/cupy | cupyx/scipy/special/_bessel.py | 1 | 11430 | # This source code contains SciPy's code.
# https://github.com/scipy/scipy/blob/master/scipy/special/cephes/k0.c
# https://github.com/scipy/scipy/blob/master/scipy/special/cephes/k1.c
#
#
# Cephes Math Library Release 2.8: June, 2000
# Copyright 1984, 1987, 1992, 2000 by Stephen L. Moshier
from cupy import _core
from... | mit | 7a2f904f4f7c822dc836e6414800e565 | 23.74026 | 78 | 0.62056 | 2.347023 | false | false | false | false |
cupy/cupy | cupyx/scipy/special/_gamma.py | 1 | 4718 | from cupy import _core
from cupyx.scipy.special._loggamma import loggamma_definition
_gamma_body = """
if (isinf(in0) && in0 < 0) {
out0 = -1.0 / 0.0;
} else if (in0 < 0. && in0 == floor(in0)) {
out0 = 1.0 / 0.0;
} else {
out0 = tgamma(in0);
}
"""
# Also define a standalone G... | mit | af2c988a2c85059bc7f0164d6d3de5bc | 20.445455 | 79 | 0.547054 | 2.82177 | false | false | false | false |
cupy/cupy | docs/source/conf.py | 1 | 17177 | # -*- coding: utf-8 -*-
#
# CuPy documentation build configuration file, created by
# sphinx-quickstart on Sun May 10 12:22:10 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All ... | mit | 6f902f6061c32b22976fa8ad564c6548 | 32.160232 | 102 | 0.671479 | 3.654681 | false | true | false | false |
cupy/cupy | tests/cupy_tests/core_tests/test_reduction.py | 1 | 6284 | import unittest
import numpy
import pytest
import cupy
from cupy import _core
from cupy import testing
_noncontiguous_params = [
# reduce at head axes
{'shape': (2, 4, 3), 'trans': (2, 1, 0), 'axis': (0, 1)},
# reduce at middle axes
{'shape': (2, 4, 5, 3), 'trans': (3, 2, 1, 0), 'axis': (1, 2)},
... | mit | 6d240677f105f4c33571eab89a6801ae | 30.263682 | 79 | 0.576384 | 3.168936 | false | true | false | false |
landlab/landlab | tests/data_record/test_data_record_time.py | 3 | 2055 | # -*- coding: utf-8 -*-
"""
Unit tests for landlab.data_record.data_record.DataRecord
Dimension = time
Last updated 8/24/2018
"""
import numpy as np
import pytest
from landlab import RasterModelGrid
grid = RasterModelGrid((3, 3))
shape = (3, 3)
time = [0.0]
data_vars = {"mean_elevation": (["time"], np.array([100])... | mit | 4eb51567aa03972fceb4f8fdfcb37e9a | 26.77027 | 81 | 0.659854 | 3.035451 | false | true | false | false |
landlab/landlab | landlab/io/netcdf/load.py | 3 | 3045 | import fnmatch
import xarray as xr
from ...grid.hex import HexModelGrid
from ...grid.radial import RadialModelGrid
from ...grid.raster import RasterModelGrid
def from_netcdf(filename_or_obj, include="*", exclude=None):
"""Create a :class:`~.ModelGrid` from a netcdf file.
Create a new :class:`~.ModelGrid` f... | mit | d9745d9d0d171488d110d26e678abcb6 | 36.134146 | 88 | 0.647947 | 4.092742 | false | false | false | false |
landlab/landlab | landlab/components/species_evolution/species_evolver.py | 3 | 25710 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Evolve life in a landscape.
Life evolves alongside landscapes by biotic and abiotic processes under complex
dynamics at Earth's surface. Researchers who wish to explore these dynamics can
use this component as a tool for them to build landscape-life evolution models.
La... | mit | 33f11e6ed6fe9c438c8e44790b47172b | 35.846485 | 93 | 0.608559 | 3.98294 | false | false | false | false |
landlab/landlab | notebooks/run_notebook_checks.py | 1 | 3325 | #! /usr/bin/env python
import pathlib
from dataclasses import dataclass
from functools import partial
import click
out = partial(click.secho, bold=True, err=True)
err = partial(click.secho, fg="red", err=True)
def collect_notebooks(src):
p = pathlib.Path(src)
if p.is_dir():
return {_p.absolute() fo... | mit | 8d0e14955812e94486118b59859a6df7 | 24.068182 | 86 | 0.60411 | 3.386899 | false | false | false | false |
landlab/landlab | landlab/components/discharge_diffuser/diffuse_by_discharge.py | 1 | 15273 | # -*- coding: utf-8 -*-
"""This is an implementation of Vaughan Voller's experimental boundary method
reduced complexity flow router. Credit: Voller, Hobley, Paola.
Created on Fri Feb 20 09:32:27 2015
@author: danhobley (SiccarPoint), after volle001@umn.edu
"""
import numpy as np
from landlab import Component, Rast... | mit | 0ae7100ab7a6511a993eded1ef904078 | 36.618227 | 100 | 0.523473 | 3.314453 | false | false | false | false |
landlab/landlab | landlab/grid/raster_gradients.py | 1 | 67463 | #! /usr/bin/env python
"""Calculate gradients on a raster grid.
Gradient calculators for raster grids
+++++++++++++++++++++++++++++++++++++
.. autosummary::
~landlab.grid.raster_gradients.calc_grad_at_link
~landlab.grid.raster_gradients.calc_grad_across_cell_faces
~landlab.grid.raster_gradients.calc_grad... | mit | 850a37982944aae04fb0faf388e5ac65 | 34.713605 | 87 | 0.57682 | 3.080784 | false | false | false | false |
landlab/landlab | landlab/_registry.py | 3 | 11135 | #! /usr/bin/env python
r"""Registry of landlab components being used.
The landlab registry keeps track of landlab components that have
be instantiated by a user. A user can then get a list of all
the components in use and then print a list of citations for
all of the components they have used.
Examples
--------
>>> f... | mit | 3514f113904167c39ffa8e66168d7881 | 30.905444 | 150 | 0.566322 | 3.84098 | false | false | false | false |
landlab/landlab | notebooks/test_notebooks.py | 1 | 2633 | import pathlib
import subprocess
from contextlib import suppress
from pkg_resources import evaluate_marker
import pytest
import yaml
from run_notebook_checks import _notebook_check_is_clean
_exclude_file = pathlib.Path(__file__).absolute().parent / "exclude.yml"
_EXCLUDE = {}
with open(_exclude_file, "r") as fp:
... | mit | 7109cf8248f04bdaaf53e5aa72527dcf | 23.155963 | 76 | 0.572351 | 4.352066 | false | true | false | false |
landlab/landlab | tests/grid/test_hex_grid/test_flux_divergence_hex_grid.py | 1 | 5820 | # -*- coding: utf-8 -*-
"""
Created on Wed Nov 4 08:10:22 2015
@author: gtucker
List of needs:
grid.link_at_face: IDs of links at each face
gradient functions:
- of a node value at faces
- of a node value at links
- of a node value at junctions
a consistent way to sort
- nodes: by y then x
- lin... | mit | 0b3268886374810d426a5ee935644237 | 29.631579 | 90 | 0.562715 | 2.731112 | false | false | false | false |
landlab/landlab | landlab/data_record/data_record.py | 1 | 53242 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import xarray as xr
class DataRecord(object):
"""Data structure to store variables in time and/or space dimensions.
This class uses a xarray Dataset to store variables. This datastructure is
located at the property ``dataset``. The DataRe... | mit | 00dc454cde08f3d13c02d75316db01ba | 37.777859 | 120 | 0.499474 | 4.388921 | false | false | false | false |
landlab/landlab | tests/grid/test_hex_mappers.py | 3 | 1664 | import numpy as np
import pytest
from landlab import HexModelGrid
from landlab.grid.mappers import map_link_vector_components_to_node
@pytest.mark.parametrize(
"angle",
(
0.0,
60.0,
120.0,
180.0,
240.0,
300.0,
),
)
@pytest.mark.parametrize("node_layout", ("... | mit | fdbd9ec248f0eb8b4072ee6e6b7df544 | 29.814815 | 87 | 0.623798 | 2.834753 | false | true | false | false |
landlab/landlab | tests/components/erosion_deposition/test_ero_dep_mass_conservation.py | 1 | 5495 | import pytest
from numpy.testing import assert_array_almost_equal
from landlab import RasterModelGrid
from landlab.components import ErosionDeposition, FlowAccumulator, Space
@pytest.fixture
def grid():
grid = RasterModelGrid((10, 10), xy_spacing=10.0)
grid.set_closed_boundaries_at_grid_edges(True, True, Tru... | mit | bdcbf419213f3a126f6887f6a1e90ba5 | 33.559748 | 86 | 0.670246 | 2.976706 | false | true | false | false |
landlab/landlab | landlab/components/species_evolution/zone.py | 3 | 10846 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Zone functions and class of SpeciesEvolver."""
from collections import OrderedDict
from enum import IntEnum, unique
import numpy as np
from pandas import Series
@unique
class Connection(IntEnum):
"""Zone connection type.
Connection type represents the connect... | mit | eac7109cd5f9df048f70b124005edd19 | 30.9 | 88 | 0.588327 | 3.869426 | false | false | false | false |
landlab/landlab | tests/components/network_sediment_transporter/test_filo.py | 3 | 3494 | import numpy as np
from numpy.testing import assert_array_equal
from landlab.components import FlowDirectorSteepest, NetworkSedimentTransporter
from landlab.data_record import DataRecord
from landlab.grid.network import NetworkModelGrid
def test_first_in_last_out():
y_of_node = (0, 0, 0, 0, 0, 0)
x_of_node =... | mit | 664574b335ce31c2fa7657ec427a5d33 | 32.27619 | 132 | 0.606182 | 2.838343 | false | false | false | false |
landlab/landlab | landlab/utils/decorators.py | 1 | 11457 | """General decorators for the landlab library.
General Landlab decorators
++++++++++++++++++++++++++
.. autosummary::
~landlab.utils.decorators.use_field_name_or_array
~landlab.utils.decorators.make_return_array_immutable
~landlab.utils.decorators.deprecated
"""
import inspect
import os
import textwrap
... | mit | 880f7dd2265b59bc98f14cd10be3ad56 | 26.409091 | 78 | 0.537924 | 4.007345 | false | false | false | false |
landlab/landlab | tests/components/diffusion/test_sniff_diffusion.py | 3 | 8042 | """Test the diffuser component.
This tester turns over the diffuser a couple of times to ensure basic
functionality is working.
"""
import os
import numpy as np
from numpy.testing import assert_array_almost_equal, assert_equal
from landlab import RasterModelGrid
from landlab.components.diffusion import LinearDiffuse... | mit | 8cd8eac3d04dac0d9cdea971629c6d12 | 27.619217 | 84 | 0.497389 | 2.834685 | false | false | false | false |
landlab/landlab | tests/components/erosion_deposition/test_erodep.py | 1 | 6370 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 27 14:23:25 2017
@author: gtucker
"""
import numpy as np
import pytest
from numpy import testing
from landlab import HexModelGrid, RasterModelGrid
from landlab.components import ErosionDeposition, FlowAccumulator
def test_route_to_multiple_error... | mit | d6c0235d5c73de789ef46a467f7ec512 | 27.954545 | 88 | 0.600628 | 3.036225 | false | true | false | false |
landlab/landlab | tests/components/network_sediment_transporter/test_abrasion.py | 1 | 2022 | import numpy as np
from numpy.testing import assert_array_almost_equal
from landlab.components import NetworkSedimentTransporter
from landlab.data_record import DataRecord
def test_abrasion(example_nmg, example_parcels, example_flow_director):
time = [0.0] # probably not the sensible way to do this...
item... | mit | 9f5fbbb9a3d6db749cf12709111661a3 | 31.095238 | 79 | 0.588032 | 3.105991 | false | false | false | false |
landlab/landlab | landlab/graph/hex/hex.py | 1 | 27218 | r"""
Examples
--------
::
* - *
/ \ / \
* - * - *
/ \ / \ / \
* - * - * - *
\ / \ / \ /
* - * - *
\ / \ /
* - *
>>> from landlab.graph import TriGraph
>>> graph = TriGraph((5, 2), node_layout="hex", sort=True)
>>> graph.number_of_nodes
14
>>> graph.x_of_node
ar... | mit | 5f3bd8ad1c78ca3584c973d5b4e40907 | 30.321059 | 120 | 0.505254 | 3.227941 | false | false | false | false |
landlab/landlab | landlab/grid/gradients.py | 1 | 18075 | #! /usr/bin/env python
"""Calculate gradients of quantities over links.
Gradient calculation functions
++++++++++++++++++++++++++++++
.. autosummary::
~landlab.grid.gradients.calc_grad_at_link
~landlab.grid.gradients.calc_diff_at_link
"""
import numpy as np
from landlab.core.utils import radians_to_degrees... | mit | cb08271c6236bb0df6ab7a75ce0e7470 | 32.848315 | 87 | 0.593472 | 3.229986 | false | false | false | false |
landlab/landlab | landlab/components/flow_director/flow_director_to_many.py | 3 | 5163 | #! /usr/env/python
"""flow_director_to_many.py provides a private class to help create
FlowDirectors.
Provides the _FlowDirectorToMany component which makes sure all model
grid fields are set up correctly.
"""
import numpy as np
from landlab.components.flow_director.flow_director import _FlowDirector
class _FlowDi... | mit | 46e4868aada7f95c05a2f38097a5c183 | 34.122449 | 164 | 0.584544 | 3.999225 | false | false | false | false |
landlab/landlab | landlab/graph/matrix/at_node.py | 3 | 1552 | import numpy as np
from ...core.utils import as_id_array
def get_links(nodes_at_link, sort=True):
"""Get links and their directions at each node.
Parameters
----------
nodes_at_link : ndarray of int, shape `(n_links, 2)`
Node identifier for each link tail and head.
Returns
-------
... | mit | 91278c7c7e8ceda9ea333d57ffaf4a0e | 27.740741 | 85 | 0.534794 | 2.996139 | false | false | false | false |
landlab/landlab | landlab/grid/linkstatus.py | 3 | 5169 | #! /usr/bin/env python
from enum import IntEnum, unique
import numpy as np
from .nodestatus import NodeStatus
@unique
class LinkStatus(IntEnum):
"""Define the link types"""
#: Indicate a link is *active*, and can carry flux
ACTIVE = 0
#: Indicate a link has a fixed (gradient) value, & behaves as a ... | mit | e25323576eeb40f6fe498a72b2479372 | 28.706897 | 87 | 0.609015 | 3.387287 | false | false | false | false |
landlab/landlab | tests/grid/test_raster_grid/test_save.py | 3 | 2561 | #! /usr/bin/env python
import os
import numpy as np
from landlab import RasterModelGrid
from landlab.io import read_esri_ascii
from landlab.io.netcdf import read_netcdf
def test_save_esri_ascii(tmpdir):
grid = RasterModelGrid((4, 5), xy_spacing=2.0)
grid.add_field("air__temperature", np.arange(20.0), at="no... | mit | 75c660490ba613007228a044e23db43f | 30.231707 | 84 | 0.627489 | 3.123171 | false | true | false | false |
landlab/landlab | landlab/components/lateral_erosion/node_finder.py | 1 | 10334 | import numpy as np
def angle_finder(grid, dn, cn, rn):
"""Find the interior angle between two vectors on a grid.
Parameters
----------
grid : ModelGrid
A landlab grid.
dn : int or array of int
Node or nodes at the end of the first vector.
cn : int or array of int
Node ... | mit | ca26a05890859c2212be8a73cebd0052 | 33.561873 | 94 | 0.558351 | 3.341093 | false | false | false | false |
landlab/landlab | tests/components/flow_accum/test_flow_routing.py | 3 | 7610 | import os
import numpy as np
import pytest
from numpy.testing import assert_array_equal
from landlab import RadialModelGrid
from landlab.components import FlowAccumulator
_THIS_DIR = os.path.abspath(os.path.dirname(__file__))
def test_check_fields(dans_grid1):
"""Check to make sure the right fields have been c... | mit | 9474a4f34e3ee486d6f46ae3a7007a50 | 35.763285 | 88 | 0.644152 | 2.732496 | false | true | false | false |
landlab/landlab | tests/layers/test_event_layers.py | 3 | 8234 | import numpy as np
import pytest
from numpy.testing import assert_array_equal
from landlab import RasterModelGrid
from landlab.layers import EventLayers
from landlab.layers.eventlayers import _BlockSlice, _valid_keywords_or_raise
def test_EventLayersMixIn():
grid = RasterModelGrid((4, 4))
assert hasattr(grid... | mit | a17c1c3e4466b155cd23ae8656adfe69 | 26.264901 | 87 | 0.58392 | 2.610653 | false | true | false | false |
landlab/landlab | tests/grid/test_raster_grid/test_fields.py | 3 | 2697 | import numpy as np
import pytest
from numpy.testing import assert_array_equal
from landlab import RasterModelGrid
def test_add_full(at):
grid = RasterModelGrid((4, 5))
grid.add_full("temperature", 3, at=at)
assert_array_equal(
getattr(grid, "at_{0}".format(at))["temperature"],
np.full(gri... | mit | befb6e195f6ab9f916c8274255f12a56 | 28.966667 | 84 | 0.628476 | 3.203088 | false | true | false | false |
california-civic-data-coalition/django-calaccess-raw-data | example/toolbox/management/commands/createverboseandhelptextissues.py | 1 | 3788 | import os
import time
from github import Github
from django.db import models
from calaccess_raw import get_model_list
from django.template.loader import render_to_string
from calaccess_raw.management.commands import CalAccessCommand
class Command(CalAccessCommand):
help = 'Create GitHub issues for fields missing ... | mit | 6270df3740a3691418f064d98ad72058 | 32.821429 | 90 | 0.481257 | 4.359033 | false | false | false | false |
california-civic-data-coalition/django-calaccess-raw-data | calaccess_raw/models/tracking.py | 1 | 12004 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Models for tracking CAL-ACCESS updates over time.
"""
# Files
from hurry.filesize import size as sizeformat
# Models
from .. import managers
from django.db import models
from calaccess_raw import get_model_list
from ia_storage.fields import InternetArchiveFileField
c... | mit | 6ba621177f17223452eb840d5e4bb469 | 32.437326 | 98 | 0.617211 | 4.33201 | false | false | false | false |
california-civic-data-coalition/django-calaccess-raw-data | calaccess_raw/migrations/0014_auto_20170421_1821.py | 1 | 1524 | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-04-21 18:21
from __future__ import unicode_literals
import calaccess_raw.annotations
import calaccess_raw.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('calaccess_raw', '0013_auto_20161123_2219'... | mit | eb200e1eddc0af4ec5b303bb5e807fe8 | 49.8 | 628 | 0.648294 | 3.645933 | false | false | false | false |
california-civic-data-coalition/django-calaccess-raw-data | calaccess_raw/admin/inactive.py | 1 | 6872 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Custom administration panels for inactive models.
"""
from django.contrib import admin
from calaccess_raw import models
from .base import BaseAdmin
@admin.register(models.BallotMeasuresCd)
class BallotMeasuresCdAdmin(BaseAdmin):
"""
Custom admin for the Ballot... | mit | 9c5bfe731eba3b548ae031c132be59b2 | 21.754967 | 68 | 0.625146 | 3.076097 | false | false | false | false |
pdfminer/pdfminer.six | tools/conv_afm.py | 1 | 1646 | #!/usr/bin/env python3
import sys
import fileinput
from warnings import warn
def main(argv):
fonts = {}
for line in fileinput.input():
f = line.strip().split(" ")
if not f:
continue
k = f[0]
if k == "FontName":
fontname = f[1]
props = {"Font... | mit | 58e0335ec0706c9339a12ccb49ff533d | 30.653846 | 83 | 0.496355 | 3.443515 | false | false | false | false |
pdfminer/pdfminer.six | tools/pdfdiff.py | 1 | 6266 | #!/usr/bin/env python3
"""
compares two pdf files.
"""
import io
import logging
import sys
from typing import Any, Iterable, List, Optional
from warnings import warn
import pdfminer.settings
from pdfminer import high_level, layout
warn(
"The file pdfdiff.py will be removed in 2023. It was probably introduced for... | mit | e9292036cd0c7a648ef560cb35ccd159 | 27.352941 | 86 | 0.560006 | 3.584668 | false | false | false | false |
pdfminer/pdfminer.six | tests/test_tools_pdf2txt.py | 1 | 5485 | import os
from shutil import rmtree
from tempfile import mkdtemp
import filecmp
import tools.pdf2txt as pdf2txt
from helpers import absolute_sample_path
from tempfilepath import TemporaryFilePath
def run(sample_path, options=None):
absolute_path = absolute_sample_path(sample_path)
with TemporaryFilePath() as... | mit | d4c13dea17e5ebd213abb1974ab41ce1 | 29.642458 | 87 | 0.603646 | 3.445352 | false | true | false | false |
stopstalk/stopstalk-deployment | aws_lambda/spoj_aws_lambda_function/lambda_code/pip/_vendor/lockfile/__init__.py | 525 | 9371 | # -*- coding: utf-8 -*-
"""
lockfile.py - Platform-independent advisory file locks.
Requires Python 2.5 unless you apply 2.4.diff
Locking is done on a per-thread basis instead of a per-process basis.
Usage:
>>> lock = LockFile('somefile')
>>> try:
... lock.acquire()
... except AlreadyLocked:
... print 'some... | mit | 35791c8a712743a2e41967e8950f5de9 | 26.005764 | 79 | 0.589692 | 4.196597 | false | false | false | false |
chainer/chainer | chainer/functions/connection/deconvolution_nd.py | 6 | 16246 | import numpy
from six import moves
import chainer
from chainer import backend
from chainer.backends import cuda
from chainer import configuration
from chainer import function_node
from chainer.functions.connection import convolution_2d
from chainer.functions.connection import convolution_nd
from chainer import utils
f... | mit | 657ac0fb87e41e0e9a956bb0072b3d8c | 35.507865 | 79 | 0.530777 | 3.253104 | false | false | false | false |
stopstalk/stopstalk-deployment | aws_lambda/spoj_aws_lambda_function/lambda_code/pip/_vendor/urllib3/contrib/_securetransport/bindings.py | 149 | 17560 | """
This module uses ctypes to bind a whole bunch of functions and constants from
SecureTransport. The goal here is to provide the low-level API to
SecureTransport. These are essentially the C-level functions and constants, and
they're pretty gross to work with.
This code is a bastardised version of the code found in ... | mit | 22619035ec69a5f12321efa056ba9a9a | 28.612142 | 99 | 0.709112 | 3.621365 | false | false | false | false |
stopstalk/stopstalk-deployment | aws_lambda/spoj_aws_lambda_function/lambda_code/setuptools/_vendor/packaging/requirements.py | 58 | 4343 | # This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
import string
import re
from setuptools.extern.pyparsing import stringSta... | mit | 5e9dd3626721026748a402cf47a08dc7 | 33.19685 | 95 | 0.665899 | 3.640402 | false | false | false | false |
stopstalk/stopstalk-deployment | aws_lambda/spoj_aws_lambda_function/lambda_code/setuptools/sandbox.py | 94 | 14276 | import os
import sys
import tempfile
import operator
import functools
import itertools
import re
import contextlib
import pickle
import textwrap
from setuptools.extern import six
from setuptools.extern.six.moves import builtins, map
import pkg_resources.py31compat
if sys.platform.startswith('java'):
import org.p... | mit | a6bd19b622f4f83ba4a6113fd82eb729 | 28.075356 | 79 | 0.585038 | 3.99217 | false | false | false | false |
chainer/chainer | chainer/links/rnn/gru.py | 4 | 9127 | from chainer.functions.activation import sigmoid
from chainer.functions.activation import tanh
from chainer.functions.math import linear_interpolate
from chainer import link
from chainer.links.connection import linear
from chainer import variable
class GRUBase(link.Chain):
def __init__(self, in_size, out_size, i... | mit | f9f3481b8f6f07c806fdaa53a708f041 | 34.513619 | 79 | 0.558453 | 3.401789 | false | false | false | false |
stopstalk/stopstalk-deployment | aws_lambda/spoj_aws_lambda_function/lambda_code/pip/_internal/commands/completion.py | 16 | 2924 | from __future__ import absolute_import
import sys
import textwrap
from pip._internal.basecommand import Command
from pip._internal.utils.misc import get_prog
BASE_COMPLETION = """
# pip %(shell)s completion start%(script)s# pip %(shell)s completion end
"""
COMPLETION_SCRIPTS = {
'bash': """
_pip_complet... | mit | 02358c81963afe0319765ac62f3f6222 | 30.106383 | 79 | 0.502736 | 3.972826 | false | false | false | false |
chainer/chainer | chainer/functions/math/cumprod.py | 6 | 3552 | import six
import chainer
from chainer import backend
from chainer import function_node
from chainer.functions.array import flip
from chainer.utils import type_check
class Cumprod(function_node.FunctionNode):
"""Cumulative prod of array elements over a given axis."""
def __init__(self, axis):
if isi... | mit | 864f241e00f4ade89b7ef930f4616af7 | 27.416 | 79 | 0.540259 | 3.48577 | false | false | false | false |
chainer/chainer | tests/chainer_tests/functions_tests/normalization_tests/test_batch_renormalization.py | 6 | 9263 | import numpy
import six
import chainer
from chainer.functions.normalization import batch_renormalization
from chainer import testing
import chainerx
# naive implementation of differentiable batch renormalization
def _naive_batch_renormalization(
x, gamma, beta, # variables
mean, var, # variables
... | mit | 5688620910001aa72400558d6947ba37 | 33.563433 | 76 | 0.590737 | 3.612715 | false | true | false | false |
stopstalk/stopstalk-deployment | aws_lambda/spoj_aws_lambda_function/lambda_code/bs4/builder/_htmlparser.py | 70 | 9102 | """Use the HTMLParser library to parse HTML files that aren't too bad."""
__all__ = [
'HTMLParserTreeBuilder',
]
from HTMLParser import HTMLParser
try:
from HTMLParser import HTMLParseError
except ImportError, e:
# HTMLParseError is removed in Python 3.5. Since it can never be
# thrown in 3.5, we... | mit | 96900717c5f48793231408e8104af9be | 33.740458 | 318 | 0.575368 | 3.943674 | false | false | false | false |
stopstalk/stopstalk-deployment | private/scripts/extras/uva-no-more-needed.py | 1 | 2556 | """
Copyright (c) 2015-2020 Raj Patel(raj454raj@gmail.com), StopStalk
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
... | mit | c28ffd4a436ddef476941a309ecd0a7a | 37.149254 | 82 | 0.638889 | 4.096154 | false | false | false | false |
stopstalk/stopstalk-deployment | aws_lambda/spoj_aws_lambda_function/lambda_code/pip/_vendor/html5lib/_utils.py | 49 | 4015 | from __future__ import absolute_import, division, unicode_literals
from types import ModuleType
from pip._vendor.six import text_type
try:
import xml.etree.cElementTree as default_etree
except ImportError:
import xml.etree.ElementTree as default_etree
__all__ = ["default_etree", "MethodDispatcher", "isSurr... | mit | cd7e8c6895bd9aac77f048c48008638e | 31.379032 | 78 | 0.619925 | 3.894277 | false | false | false | false |
stopstalk/stopstalk-deployment | aws_lambda/spoj_aws_lambda_function/lambda_code/setuptools/command/easy_install.py | 8 | 87050 | #!/usr/bin/env python
"""
Easy Install
------------
A tool for doing automatic download/extract/build of distutils-based Python
packages. For detailed documentation, see the accompanying EasyInstall.txt
file, or visit the `EasyInstall home page`__.
__ https://setuptools.readthedocs.io/en/latest/easy_install.html
""... | mit | 4d8d6cb0aab1869128273a8b33357c08 | 36.248609 | 101 | 0.577932 | 4.164872 | false | false | false | false |
chainer/chainer | chainer/_environment_check.py | 1 | 3590 | from __future__ import absolute_import
import os
import sys
import warnings
import numpy.distutils.system_info
import pkg_resources
import chainer
def _check_python_350():
if sys.version_info[:3] == (3, 5, 0):
if not int(os.getenv('CHAINER_PYTHON_350_FORCE', '0')):
msg = """
Chainer does... | mit | 7bd5259305268139ebafde68617a496c | 34.9 | 101 | 0.566295 | 4.415744 | false | false | false | false |
chainer/chainer | chainer/training/extensions/plot_report.py | 5 | 7114 | import json
from os import path
import warnings
import numpy
import six
from chainer import reporter
from chainer import serializer as serializer_module
from chainer.training import extension
from chainer.training import trigger as trigger_module
from chainer.utils import argument
_available = None
def _try_impor... | mit | a158ae54934d50eee432e31a73f3c799 | 34.044335 | 79 | 0.587433 | 4.404954 | false | false | false | false |
chainer/chainer | chainer/training/extensions/variable_unchain.py | 6 | 1139 | import six
from chainer import configuration
from chainer.training import extension
from chainer import variable
class unchain_variables(extension.Extension):
"""Trainer extension to unchain all comptational graphs.
This extenstion unchains all comptational graphs after all extensions are
run to release... | mit | 3031a6748f87c800c7dda72b0301567d | 31.542857 | 79 | 0.692713 | 4.380769 | false | true | false | false |
chainer/chainer | tests/chainer_tests/functions_tests/math_tests/test_linear_interpolate.py | 8 | 1685 | import numpy
from chainer import functions
from chainer import testing
from chainer import utils
@testing.parameterize(*testing.product({
'shape': [(3, 4), ()],
'dtype': [numpy.float16, numpy.float32, numpy.float64],
}))
@testing.fix_random()
@testing.inject_backend_tests(
None,
# CPU tests
[
... | mit | 170dd64bbbcfba0781f46367ce1f1960 | 27.083333 | 70 | 0.572107 | 3.41785 | false | true | false | false |
chainer/chainer | chainer/testing/training.py | 14 | 1956 | from __future__ import division
from chainer import training
try:
import mock
_error = None
except ImportError as e:
_error = e
def is_available():
return _error is None
def check_available():
if _error is not None:
raise RuntimeError('''\
{} is not available.
Reason: {}: {}'''.forma... | mit | 841a5f884630d1ef6a9e8cf2994eea0f | 26.942857 | 77 | 0.653374 | 3.888668 | false | false | false | false |
stopstalk/stopstalk-deployment | private/scripts/extras/feature-updates.py | 1 | 2716 | # -*- coding: utf-8 -*-
"""
Copyright (c) 2015-2020 Raj Patel(raj454raj@gmail.com), StopStalk
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without... | mit | d221b7200bb5d3eb4c1f18a01c8b1cf0 | 45.033898 | 156 | 0.714654 | 4.041667 | false | false | false | false |
stopstalk/stopstalk-deployment | aws_lambda/spoj_aws_lambda_function/lambda_code/pip/_internal/utils/outdated.py | 8 | 5276 | from __future__ import absolute_import
import datetime
import json
import logging
import os.path
import sys
from pip._vendor import lockfile, pkg_resources
from pip._vendor.packaging import version as packaging_version
from pip._internal.compat import WINDOWS
from pip._internal.index import PackageFinder
from pip._i... | mit | e5150eabad374467f5043741e197859c | 35.386207 | 78 | 0.603487 | 4.203984 | false | false | false | false |
chainer/chainer | chainer/utils/walker_alias.py | 8 | 3976 | import numpy
import chainer
from chainer.backends import cuda
from chainer import device_resident
class WalkerAlias(device_resident.DeviceResident):
"""Implementation of Walker's alias method.
This method generates a random sample from given probabilities
:math:`p_1, \\dots, p_n` in :math:`O(1)` time.
... | mit | ba831737703b492e03366b23f8cc542e | 32.982906 | 78 | 0.558099 | 4.012109 | false | false | false | false |
chainer/chainer | tests/chainer_tests/function_hooks_tests/test_cupy_memory_profile.py | 3 | 8189 | import unittest
import numpy
import six
import chainer
from chainer.backends import cuda
from chainer import function_hooks
from chainer import functions
from chainer.functions.math import basic_math
from chainer import testing
from chainer.testing import attr
def check_history(self, t, function_type, used_bytes_ty... | mit | 12211fa6e3be08a06b7925b741183a4e | 32.699588 | 79 | 0.592502 | 3.218947 | false | true | false | false |
chainer/chainer | tests/chainer_tests/links_tests/normalization_tests/test_batch_renormalization.py | 5 | 7033 | import unittest
import numpy
import six
import chainer
from chainer.backends import cuda
from chainer import links
from chainer import testing
from chainer.testing import attr
def _batch_renormalization(expander, gamma, beta, x, mean, std, test,
r, d):
mean = mean[expander]
std = ... | mit | 955ee5f3e0d7552a9ed819eda82882fe | 36.015789 | 79 | 0.582824 | 3.238029 | false | true | false | false |
chainer/chainer | chainermn/communicators/_communication_utility.py | 6 | 5957 | from chainermn import nccl
import collections
import numpy as np
import pickle
import mpi4py.MPI
def init_ranks(mpi_comm):
"""Returns rank information of the local process in `mpi_comm`.
Args:
mpi_comm (type:TODO)
MPI Communicator from mpi4py
Returns:
rank_info (list):
... | mit | b7acd6b77b085088dc1111b422398756 | 31.026882 | 76 | 0.607688 | 3.398175 | false | false | false | false |
stopstalk/stopstalk-deployment | aws_lambda/spoj_aws_lambda_function/lambda_code/pip/_vendor/distlib/scripts.py | 22 | 16585 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2013-2015 Vinay Sajip.
# Licensed to the Python Software Foundation under a contributor agreement.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
from io import BytesIO
import logging
import os
import re
import struct
import sys
from .compat import sysconfig, detect_encoding, ZipFi... | mit | 5b3ca0e1467d1d20f944a2ed41f3fb0d | 38.963855 | 87 | 0.548869 | 4.177582 | false | false | false | false |
chainer/chainer | chainer/testing/function_link.py | 3 | 46984 | import contextlib
import typing as tp # NOQA
import unittest
import numpy
import six
import chainer
from chainer import backend
from chainer import initializers
from chainer.testing import array as array_module
from chainer import utils
class _TestError(AssertionError):
"""Parent class to Chainer test errors.... | mit | 2b76216bf9902a62366ad6f8f035b8e3 | 36.890323 | 79 | 0.610931 | 4.472537 | false | true | false | false |
stopstalk/stopstalk-deployment | aws_lambda/spoj_aws_lambda_function/lambda_code/pip/_vendor/urllib3/__init__.py | 23 | 2853 | """
urllib3 - Thread-safe connection pooling and re-using.
"""
from __future__ import absolute_import
import warnings
from .connectionpool import (
HTTPConnectionPool,
HTTPSConnectionPool,
connection_from_url
)
from . import exceptions
from .filepost import encode_multipart_formdata
from .poolmanager imp... | mit | 9a3601769a9b65689375fbfbd76bb64b | 28.412371 | 84 | 0.718892 | 4.023977 | false | false | false | false |
chainer/chainer | chainer/datasets/_mnist_helper.py | 14 | 1614 | import gzip
import struct
import numpy
import six
from chainer.dataset import download
from chainer.datasets import tuple_dataset
def make_npz(path, urls):
x_url, y_url = urls
x_path = download.cached_download(x_url)
y_path = download.cached_download(y_url)
with gzip.open(x_path, 'rb') as fx, gzip.... | mit | 50b5ef3343252a5b89d2e088f173b1bc | 28.345455 | 76 | 0.565056 | 3.348548 | false | false | false | false |
chainer/chainer | tests/chainer_tests/testing_tests/test_matrix.py | 5 | 2480 | import unittest
import numpy
from chainer import testing
from chainer.testing import matrix
@testing.parameterize(*testing.product({
'dtype': [
numpy.float16, numpy.float32, numpy.float64,
numpy.complex64, numpy.complex128,
],
'x_s_shapes': [
((0, 0), (0,)),
((2, 2), (2,)... | mit | 9b65f897e2007ee2ac3f4aef179c462f | 28.879518 | 79 | 0.575 | 3.553009 | false | true | false | false |
stopstalk/stopstalk-deployment | aws_lambda/spoj_aws_lambda_function/lambda_code/requests/api.py | 150 | 5795 | # -*- coding: utf-8 -*-
"""
requests.api
~~~~~~~~~~~~
This module implements the Requests API.
:copyright: (c) 2012 by Kenneth Reitz.
:license: Apache2, see LICENSE for more details.
"""
from . import sessions
def request(method, url, **kwargs):
"""Constructs and sends a :class:`Request <Request>`.
:par... | mit | 1bdcafa7ef6f152f29c88f81d46a500b | 37.892617 | 133 | 0.666954 | 3.936821 | false | false | false | false |
chainer/chainer | tests/chainer_tests/training_tests/triggers_tests/test_minmax_trigger.py | 10 | 5906 | import tempfile
import unittest
from chainer import serializers
from chainer import testing
from chainer.training import triggers
class BestValueTriggerTester(object):
def _test_trigger(self, trigger, key, accuracies, expected,
resume=None, save=None):
trainer = testing.get_trainer_... | mit | 1780d6e5ca7f705479f8cbeca18a064d | 33.138728 | 78 | 0.544362 | 3.282935 | false | true | false | false |
chainer/chainer | tests/chainer_tests/functions_tests/loss_tests/test_crf1d.py | 12 | 5482 | import itertools
import unittest
import numpy
import chainer
from chainer.backends import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
@testing.parameterize(*testing.product_dict(
[
{'lengths': [3, 3], 'batches': [2, 2... | mit | 19b746268fc3f34cfd873f66b1c18bf3 | 33.917197 | 76 | 0.5529 | 3.377696 | false | true | false | false |
chainer/chainer | chainer/functions/activation/softplus.py | 10 | 3567 | import numpy
from chainer.backends import cuda
from chainer import function_node
import chainer.functions
from chainer import utils
from chainer.utils import type_check
class Softplus(function_node.FunctionNode):
"""Softplus function."""
def __init__(self, beta=1.0):
self.beta = float(beta)
... | mit | 970dfbb268a5f6bedeb2e3641cab0df3 | 29.228814 | 78 | 0.544715 | 3.137203 | false | false | false | false |
chainer/chainer | chainer/functions/activation/clipped_relu.py | 6 | 5519 | import numpy
import chainer
from chainer.backends import cuda
from chainer import function_node
from chainer import utils
from chainer.utils import type_check
import chainerx
if cuda.cudnn_enabled:
cudnn = cuda.cudnn
_mode = cuda.cuda.cudnn.CUDNN_ACTIVATION_CLIPPED_RELU # type: ignore
class ClippedReLU(fu... | mit | ff0e2e5c16eb97306411885fdb527bcf | 27.744792 | 78 | 0.54557 | 3.235053 | false | false | false | false |
stopstalk/stopstalk-deployment | deploy_scripts/update_js_timestamp.py | 1 | 5378 | # -*- coding: utf-8 -*-
"""
Copyright (c) 2015-2020 Raj Patel(raj454raj@gmail.com), StopStalk
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without... | mit | a10f18cf83a44c5d097fb66edb5fb70b | 40.053435 | 81 | 0.522871 | 4.114767 | false | false | false | false |
chainer/chainer | chainer/optimizers/msvag.py | 3 | 6356 | from __future__ import division
import numpy
import chainer
from chainer.backends import cuda
from chainer import optimizer
from chainer import types
if types.TYPE_CHECKING:
import typing_extensions as tpe
class MSVAGHyperparameter(tpe.Protocol):
"""Protocol class for hyperparameter of M-SVAG.
... | mit | 0025819280f51445f829413a2f1e021c | 31.594872 | 84 | 0.561359 | 3.669746 | false | false | false | false |
stopstalk/stopstalk-deployment | aws_lambda/spoj_aws_lambda_function/lambda_code/pip/_vendor/urllib3/util/timeout.py | 282 | 9757 | from __future__ import absolute_import
# The default socket timeout, used by httplib to indicate that no timeout was
# specified by the user
from socket import _GLOBAL_DEFAULT_TIMEOUT
import time
from ..exceptions import TimeoutStateError
# A sentinel value to indicate that no timeout was specified by the user in
# u... | mit | 786aec34c9cc8dc01aafccf6580aa377 | 39.318182 | 82 | 0.634416 | 4.598021 | false | false | false | false |
chainer/chainer | chainermn/datasets/scatter.py | 4 | 7316 | import warnings
import chainer.datasets
import numpy
class DataSizeError(RuntimeError):
pass
def scatter_dataset(dataset, comm, root=0, shuffle=False,
seed=None, max_buf_len=256 * 1024 * 1024,
*, force_equal_length=True):
"""Scatter the given dataset to the workers i... | mit | 37757a1147f5a30bf397a01cebb84dc2 | 34.514563 | 79 | 0.622061 | 4.326434 | false | false | false | false |
chainer/chainer | tests/chainer_tests/training_tests/triggers_tests/test_early_stopping_trigger.py | 8 | 3914 | import unittest
import numpy
import pytest
import chainer
from chainer import testing
from chainer.training import triggers
from chainer.training import util
def _test_trigger(self, trigger, key, accuracies, expected):
trainer = testing.training.get_trainer_with_mock_updater(
stop_trigger=None, iter_per... | mit | a7c629d126715c2b4d02bc8ad9dd81c1 | 35.924528 | 78 | 0.593255 | 3.841021 | false | true | false | false |
chainer/chainer | examples/text_classification/nets.py | 10 | 9165 | import numpy
import chainer
import chainer.functions as F
import chainer.links as L
from chainer import reporter
embed_init = chainer.initializers.Uniform(.25)
def sequence_embed(embed, xs, dropout=0.):
"""Efficient embedding function for variable-length sequences
This output is equally to
"return [F.d... | mit | 75d8248ca45ccaf353eeb0e6963e8e74 | 32.448905 | 79 | 0.593781 | 3.560606 | false | false | false | false |
stopstalk/stopstalk-deployment | aws_lambda/spoj_aws_lambda_function/lambda_code/pip/_vendor/html5lib/filters/optionaltags.py | 169 | 10588 | from __future__ import absolute_import, division, unicode_literals
from . import base
class Filter(base.Filter):
"""Removes optional tags from the token stream"""
def slider(self):
previous1 = previous2 = None
for token in self.source:
if previous1 is not None:
yie... | mit | 57d8b7017b41e064eb9423c970952ca8 | 50.149758 | 83 | 0.54354 | 4.836912 | false | false | false | false |
chainer/chainer | chainer/backends/_cpu.py | 6 | 1783 | import numpy
from chainer import _backend
# TODO(kmaehashi): `from chainer.backends import cuda` causes circular imports.
# Surprisingly, `import chianer.backends` works as a workaround to avoid, but
# we should fix circular dependencies themselves around `chainer.backends.*`.
import chainer.backends
import chainerx
... | mit | e78be2741b93873566c2c7cc6b0268e5 | 28.229508 | 79 | 0.658441 | 3.884532 | false | false | false | false |
chainer/chainer | onnx_chainer/export_testcase.py | 3 | 2741 | import os
import warnings
import chainer
from onnx_chainer.export import _available
if _available:
from onnx_chainer.export import export
from onnx_chainer.onnx_helper import cleanse_param_name
from onnx_chainer.onnx_helper import write_tensor_pb
def export_testcase(model, args, out_dir, output_grad=F... | mit | e04f50e8011f13c89eca922d84c6f270 | 39.308824 | 79 | 0.640642 | 3.664439 | false | true | false | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.