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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
roxma/nvim-completion-manager | pythonx/cm_sources/cm_bufkeyword.py | 1 | 2552 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# For debugging
# NVIM_PYTHON_LOG_FILE=nvim.log NVIM_PYTHON_LOG_LEVEL=INFO nvim
from cm import register_source, getLogger, Base
register_source(name='cm-bufkeyword',
priority=5,
abbreviation='Key',
events=['InsertEn... | mit | cb023207f1a1d964347be4a473eec1ba | 30.506173 | 84 | 0.534875 | 3.872534 | false | false | false | false |
roxma/nvim-completion-manager | pythonx/cm_sources/cm_gocode.py | 1 | 4649 | # -*- coding: utf-8 -*-
# For debugging, use this command to start neovim:
#
# NVIM_PYTHON_LOG_FILE=nvim.log NVIM_PYTHON_LOG_LEVEL=INFO nvim
#
#
# Please register source before executing any other code, this allow cm_core to
# read basic information about the source without loading the whole module, and
# modules requ... | mit | b9617f908cb3946b6f5e21c232ab81d9 | 32.446043 | 119 | 0.473435 | 4.214869 | false | false | false | false |
openatx/uiautomator2 | uiautomator2/version.py | 1 | 4900 | # coding: utf-8
#
import pkg_resources
try:
__version__ = pkg_resources.get_distribution("uiautomator2").version
except pkg_resources.DistributionNotFound:
__version__ = "unknown"
# See ChangeLog for details
__apk_version__ = '2.3.3'
# 2.3.3 make float windows smaller
# 2.3.2 merge pull requests # require at... | mit | b94c4cccaf7169d71a210b54d38d39c8 | 49.895833 | 117 | 0.744781 | 2.955838 | false | false | false | false |
tilezen/tilequeue | tilequeue/metro_extract.py | 2 | 1509 | from json import load
class MetroExtractCity(object):
def __init__(self, region, city, bounds):
self.region = region
self.city = city
self.bounds = bounds
def __repr__(self):
return 'MetroExtractCity(%s, %s, %s)' % \
(self.region, self.city, self.bounds)
class M... | mit | 862a7ba0a4300ab95cd1257a325e5c15 | 30.4375 | 77 | 0.58383 | 3.584323 | false | false | false | false |
tilezen/tilequeue | tests/test_store.py | 1 | 8377 | """
Tests for `tilequeue.store`.
"""
import unittest
class TestTileDirectory(unittest.TestCase):
def setUp(self):
import tempfile
self.dir_path = tempfile.mkdtemp()
def tearDown(self):
import shutil
shutil.rmtree(self.dir_path)
def test_write_tile(self):
from Mod... | mit | d3e821c9706c915bf7ceb998c566c626 | 30.257463 | 79 | 0.584338 | 3.775124 | false | true | false | false |
fcurella/django-recommends | recommends/tasks.py | 2 | 2122 | from celery.task import task, periodic_task
from celery.schedules import crontab
from .utils import filelock
from .settings import RECOMMENDS_TASK_RUN, RECOMMENDS_TASK_CRONTAB, RECOMMENDS_TASK_EXPIRES
def recommends_precompute():
results = []
from .providers import recommendation_registry
# I know this ... | mit | 8836d78882245a77c067602a3b7508f7 | 34.366667 | 127 | 0.720547 | 3.837251 | false | false | false | false |
jsvine/pdfplumber | pdfplumber/utils.py | 1 | 28534 | import itertools
import re
import string
from collections.abc import Hashable, Sequence
from operator import itemgetter
from typing import (
TYPE_CHECKING,
Any,
Callable,
Dict,
Generator,
Iterable,
List,
Match,
Optional,
Pattern,
Tuple,
TypeVar,
Union,
)
from pdfmine... | mit | 9690bd688fed73282f622bd66c610227 | 31.165727 | 88 | 0.564298 | 3.435814 | false | false | false | false |
sqlalchemy/sqlalchemy | lib/sqlalchemy/pool/events.py | 2 | 13424 | # sqlalchemy/pool/events.py
# Copyright (C) 2005-2022 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
from __future__ import annotations
import typing
from typing import Any
f... | mit | 34547e39de894f9ef48f67be6a1a531f | 34.233596 | 82 | 0.657032 | 4.820108 | false | false | false | false |
sqlalchemy/sqlalchemy | lib/sqlalchemy/engine/events.py | 2 | 36475 | # sqlalchemy/engine/events.py
# Copyright (C) 2005-2022 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
from __future__ import annotations
import typing
from typing import A... | mit | c2fb7388f32ef720518a5f90e68b7d70 | 37.761955 | 93 | 0.633201 | 4.735783 | false | false | false | false |
sqlalchemy/sqlalchemy | examples/space_invaders/space_invaders.py | 2 | 19712 | import curses
import logging
import random
import re
import textwrap
import time
from sqlalchemy import Column
from sqlalchemy import create_engine
from sqlalchemy import ForeignKey
from sqlalchemy import func
from sqlalchemy import Integer
from sqlalchemy import String
from sqlalchemy.ext.declarative import declarati... | mit | d5d1e5fbe4dd34df4b8105e148391e8a | 23.983523 | 78 | 0.555956 | 3.589221 | false | false | false | false |
sqlalchemy/sqlalchemy | test/ext/mypy/plain_files/mapped_column.py | 2 | 3006 | from typing import Optional
from sqlalchemy import Integer
from sqlalchemy import String
from sqlalchemy.orm import DeclarativeBase
from sqlalchemy.orm import Mapped
from sqlalchemy.orm import mapped_column
class Base(DeclarativeBase):
pass
class X(Base):
__tablename__ = "x"
# these are fine - pk, col... | mit | 7ca5ef9a6d299748811195474f3cb142 | 32.4 | 79 | 0.670659 | 3.328904 | false | false | false | false |
sqlalchemy/sqlalchemy | lib/sqlalchemy/orm/identity.py | 2 | 9249 | # orm/identity.py
# Copyright (C) 2005-2022 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
from __future__ import annotations
from typing import Any
from typing import cast
... | mit | 89a19831a5bcbb7efc58cc7d7d558363 | 29.625828 | 79 | 0.56644 | 4.315912 | false | false | false | false |
sqlalchemy/sqlalchemy | test/ext/asyncio/test_scoping_py3k.py | 2 | 2258 | import sqlalchemy as sa
from sqlalchemy import func
from sqlalchemy import select
from sqlalchemy.ext.asyncio import async_scoped_session
from sqlalchemy.ext.asyncio import AsyncSession as _AsyncSession
from sqlalchemy.orm import sessionmaker
from sqlalchemy.testing import async_test
from sqlalchemy.testing import eq_
... | mit | 5aec6271268531bf630a27d8d536412a | 28.324675 | 76 | 0.605403 | 4.342308 | false | true | false | false |
datactive/bigbang | bigbang/visualisation/stackedareachart.py | 1 | 2061 | from typing import Dict, List, Optional, Tuple, Union
import numpy as np
import pylab
from colour import Color
from pylab import cm
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.lines as mlines
from matplotlib.pyplot import figure
from bigbang.visualisation import utils
def get_ylabels(... | mit | 9e4db30e7edd9a276bcdd3f6afdc2760 | 23.535714 | 82 | 0.609413 | 3.52911 | false | false | false | false |
ccxt/ccxt | examples/py/async-kucoin-rate-limit.py | 1 | 1252 | # -*- coding: utf-8 -*-
import os
import sys
from asyncio import run
root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(root + '/python')
import ccxt.async_support as ccxt # noqa: E402
print('CCXT Version:', ccxt.__version__)
async def main():
exchange = ccxt... | mit | 55ea00aa2e36315c160c14930c40b63c | 28.116279 | 84 | 0.563898 | 3.546742 | false | false | false | false |
ccxt/ccxt | python/ccxt/hitbtc.py | 1 | 61606 | # -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.base.exchange import Exchange
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import AuthenticationError
from cc... | mit | c2fc16da282f2eca802510c9e734b7b5 | 42.384507 | 189 | 0.524251 | 4.124665 | false | false | false | false |
ccxt/ccxt | python/ccxt/base/exchange.py | 1 | 148427 | # -*- coding: utf-8 -*-
"""Base exchange class"""
# -----------------------------------------------------------------------------
__version__ = '2.2.27'
# -----------------------------------------------------------------------------
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import NetworkErr... | mit | 1b4693ad56613f6f4afe9b65002a7a26 | 41.600459 | 249 | 0.571075 | 4.069312 | false | false | false | false |
opps/opps | opps/articles/models.py | 3 | 4855 | # -*- coding: utf-8 -*-
import warnings
from urlparse import urlparse
from django.db import models
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from django.core.exceptions import ValidationError
from django.core.cache import cache
from .signals import redirect_generate
fr... | mit | e402c2c692e62d720b29f272cca89594 | 27.063584 | 76 | 0.584758 | 4.146029 | false | false | false | false |
sqlalchemy/alembic | alembic/runtime/environment.py | 2 | 39148 | from __future__ import annotations
from typing import Any
from typing import Callable
from typing import ContextManager
from typing import Dict
from typing import List
from typing import Optional
from typing import overload
from typing import TextIO
from typing import Tuple
from typing import TYPE_CHECKING
from typing... | mit | 5e9f702822215ff7eafa7b413d53414a | 39.358763 | 79 | 0.627286 | 4.733736 | false | true | false | false |
marshmallow-code/marshmallow | performance/benchmark.py | 2 | 3928 | """Simple benchmark for Marshmallow serialization of a moderately complex object.
Uses the `timeit` module to benchmark serializing an object through Marshmallow.
"""
import argparse
import cProfile
import gc
import timeit
import datetime
from marshmallow import Schema, fields, ValidationError, post_dump
# Custom v... | mit | 94f03097f329c3ba2d14c3fd0766be44 | 24.341935 | 84 | 0.574084 | 3.892963 | false | false | false | false |
marshmallow-code/marshmallow | src/marshmallow/schema.py | 2 | 49206 | """The :class:`Schema` class, including its metaclass and options (class Meta)."""
from __future__ import annotations
from collections import defaultdict, OrderedDict
from collections.abc import Mapping
from functools import lru_cache
import datetime as dt
import uuid
import decimal
import copy
import inspect
import j... | mit | 775398daad2bdbc4e7aa577404a02bad | 39.037429 | 97 | 0.564951 | 4.473273 | false | false | false | false |
cupy/cupy | cupyx/scipy/ndimage/_spline_prefilter_core.py | 1 | 8827 | """
Spline poles and boundary handling implemented as in SciPy
https://github.com/scipy/scipy/blob/master/scipy/ndimage/src/ni_splines.c
"""
import functools
import math
import operator
import textwrap
import cupy
def get_poles(order):
if order == 2:
# sqrt(8.0) - 3.0
return (-0.1715728752538099... | mit | 281e56d742b6bb2453ea3a74748bf0cf | 32.819923 | 79 | 0.529852 | 3.238078 | false | false | false | false |
cupy/cupy | cupyx/_scatter.py | 1 | 5008 | def scatter_add(a, slices, value):
"""Adds given values to specified elements of an array.
It adds ``value`` to the specified elements of ``a``.
If all of the indices target different locations, the operation of
:func:`scatter_add` is equivalent to ``a[slices] = a[slices] + value``.
If there are mu... | mit | e075fe01c5015b8ab3feeedb1c1c5c75 | 37.229008 | 79 | 0.618011 | 3.834609 | false | false | false | false |
cupy/cupy | cupy/lib/stride_tricks.py | 1 | 1183 | import cupy as _cupy
def as_strided(x, shape=None, strides=None):
"""
Create a view into the array with the given shape and strides.
.. warning:: This function has to be used with extreme care, see notes.
Parameters
----------
x : ndarray
Array to create a new.
shape : sequence o... | mit | 72117e8dc906b22dfc1b4d5a50d6ef56 | 29.333333 | 75 | 0.641589 | 4.255396 | false | false | false | false |
cupy/cupy | cupy/array_api/_sorting_functions.py | 1 | 1844 | # mypy: ignore-errors
from __future__ import annotations
from ._array_object import Array
import cupy as np
# Note: the descending keyword argument is new in this function
def argsort(
x: Array, /, *, axis: int = -1, descending: bool = False, stable: bool = True
) -> Array:
"""
Array API compatible wra... | mit | d2d310f8dcc5707eb4beb7f1a246df03 | 33.792453 | 83 | 0.632863 | 3.725253 | false | false | false | false |
cupy/cupy | tests/cupy_tests/testing_tests/test_array.py | 1 | 3501 | import copy
import unittest
import numpy
import cupy
from cupy import testing
@testing.parameterize(
*testing.product({
'assertion': ['assert_allclose', 'assert_array_almost_equal',
'assert_array_almost_equal_nulp',
'assert_array_max_ulp', 'assert_array_equal'... | mit | badd7b1ce19423c1b6fa4dc9db52485c | 28.175 | 74 | 0.607541 | 3.315341 | false | true | false | false |
cupy/cupy | cupy/lib/_routines_poly.py | 1 | 12381 | import functools
import warnings
import numpy
import cupy
import cupyx.scipy.fft
def _wraps_polyroutine(func):
def _get_coeffs(x):
if isinstance(x, cupy.poly1d):
return x._coeffs
if cupy.isscalar(x):
return cupy.atleast_1d(x)
if isinstance(x, cupy.ndarray):
... | mit | 5e03d02d2acbae18dfbea4c0bb007a2d | 30.265152 | 79 | 0.579679 | 3.492525 | false | false | false | false |
cupy/cupy | tests/cupy_tests/linalg_tests/test_einsum.py | 1 | 19857 | import warnings
import numpy
import pytest
import cupy
from cupy import testing
rng = numpy.random.default_rng(seed=0)
def _dec_shape(shape, dec):
# Test smaller shape
return tuple(1 if s == 1 else max(0, s - dec) for s in shape)
def _rand1_shape(shape, prob):
# Test broadcast
# If diagonals are... | mit | ba52b4468e50397e3f4e94bdde4d7619 | 34.458929 | 79 | 0.522687 | 3.154909 | false | true | false | false |
marshmallow-code/marshmallow | src/marshmallow/fields.py | 1 | 73412 | """Field classes for various types of data."""
from __future__ import annotations
import collections
import copy
import datetime as dt
import numbers
import uuid
import ipaddress
import decimal
import math
import typing
import warnings
from enum import Enum as EnumType
from collections.abc import Mapping as _Mapping
... | mit | 4a3d10b43e5c5803d54b042d87dc3d35 | 33.61009 | 98 | 0.591421 | 4.237359 | false | false | false | false |
cupy/cupy | cupyx/scipy/interpolate/_polyint.py | 1 | 17500 | import cupy
from cupyx.scipy._lib._util import _asarray_validated, float_factorial
def _isscalar(x):
"""Check whether x is if a scalar type, or 0-dim"""
return cupy.isscalar(x) or hasattr(x, 'shape') and x.shape == ()
class _Interpolator1D:
"""Common features in univariate interpolation.
Deal with ... | mit | 5dade2fae5a133c8266d34dfae0a5ea2 | 32.206831 | 79 | 0.563886 | 3.862282 | false | false | false | false |
cupy/cupy | cupy/array_api/_dtypes.py | 1 | 3706 | import cupy as np
# Note: we use dtype objects instead of dtype classes. The spec does not
# require any behavior on dtypes other than equality.
int8 = np.dtype("int8")
int16 = np.dtype("int16")
int32 = np.dtype("int32")
int64 = np.dtype("int64")
uint8 = np.dtype("uint8")
uint16 = np.dtype("uint16")
uint32 = np.dtype(... | mit | 7b94be3d0360729b7843411608cc1ffb | 24.916084 | 77 | 0.623314 | 2.84639 | false | false | false | false |
cupy/cupy | cupy/random/_distributions.py | 1 | 32812 | from cupy.random import _generator
from cupy import _util
# TODO(beam2d): Implement many distributions
def beta(a, b, size=None, dtype=float):
"""Beta distribution.
Returns an array of samples drawn from the beta distribution. Its
probability density function is defined as
.. math::
f(x) = ... | mit | f61e584b8a71f45a996be04350da66ba | 33.466387 | 79 | 0.626356 | 3.880322 | false | false | false | false |
cupy/cupy | cupy/_math/trigonometric.py | 1 | 4308 | import numpy
import cupy
from cupy import _core
from cupy._math import sumprod
from cupy._math import ufunc
sin = ufunc.create_math_ufunc(
'sin', 1, 'cupy_sin',
'''Elementwise sine function.
.. seealso:: :data:`numpy.sin`
''')
cos = ufunc.create_math_ufunc(
'cos', 1, 'cupy_cos',
'''Elemen... | mit | 60116482bf6d2d0f0317923f142ff0c4 | 25.429448 | 79 | 0.611885 | 3.311299 | false | false | false | false |
cupy/cupy | cupy/array_api/_set_functions.py | 1 | 2947 | from __future__ import annotations
from ._array_object import Array
from typing import NamedTuple
import cupy as np
# Note: np.unique() is split into four functions in the array API:
# unique_all, unique_counts, unique_inverse, and unique_values (this is done
# to remove polymorphic return types).
# Note: The vari... | mit | 1ca59c197724511a52179404a9e353e9 | 26.801887 | 79 | 0.663047 | 3.842243 | false | false | false | false |
cupy/cupy | cupyx/scipy/sparse/_sputils.py | 1 | 5555 | import cupy
import operator
import numpy
from cupy._core._dtype import get_dtype
supported_dtypes = [get_dtype(x) for x in
('single', 'double', 'csingle', 'cdouble')]
_upcast_memo: dict = {}
def isdense(x):
return isinstance(x, cupy.ndarray)
def isscalarlike(x):
"""Is x either a scala... | mit | 701f768aba0095e33ec12ef56dda9b94 | 31.869822 | 79 | 0.563276 | 4.022448 | false | false | false | false |
landlab/landlab | landlab/components/flow_director/flow_director_steepest.py | 3 | 26741 | #! /usr/env/python
"""
flow_director_steepest.py: provides the component FlowDirectorSteepest.
This components finds the steepest single-path steepest descent flow
directions. It is equivalent to D4 method in the special case of a raster grid
in that it does not consider diagonal links between nodes. For that capabil... | mit | 67285fa0f20af718b3490a0f7cd6b812 | 35.136486 | 201 | 0.497513 | 3.338035 | false | false | false | false |
landlab/landlab | landlab/components/space/space_large_scale_eroder.py | 1 | 20191 | # -*- coding: utf-8 -*-
"""Grid-based simulation of lateral erosion by channels in a drainage network.
Benjamin Campforts
"""
import numpy as np
from landlab import Component, RasterModelGrid
from landlab.grid.nodestatus import NodeStatus
from landlab.utils.return_array import return_array_at_node
from ..depression... | mit | 36490f31b3af88e209387634fb42d01a | 34.927046 | 153 | 0.554802 | 3.38548 | false | false | false | false |
california-civic-data-coalition/django-calaccess-raw-data | calaccess_raw/management/commands/cleancalaccessrawfile.py | 1 | 9732 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Clean a source CAL-ACCESS TSV file and reformat it as a CSV.
"""
import time
# Files
import os
import csv
import csvkit
from django.core.files import File
# Django
from django.conf import settings
from django.utils.timezone import now
# Commands
from django.core.mana... | mit | 44938599c24aced433d733a83dfb3371 | 34.007194 | 118 | 0.554151 | 4.04657 | false | false | false | false |
california-civic-data-coalition/django-calaccess-raw-data | calaccess_raw/migrations/0004_auto_20160804_1758.py | 1 | 1227 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-08-04 17:58
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('calaccess_raw', '0003_auto_20160804_1443'),
]
operations = [
migrations.AddF... | mit | a4988614b104d5b46a8ee581e228bcd3 | 39.9 | 217 | 0.651182 | 4.397849 | false | false | false | false |
pdfminer/pdfminer.six | pdfminer/pdfparser.py | 1 | 5896 | import logging
from io import BytesIO
from typing import BinaryIO, TYPE_CHECKING, Optional, Union
from . import settings
from .pdftypes import PDFException
from .pdftypes import PDFObjRef
from .pdftypes import PDFStream
from .pdftypes import dict_value
from .pdftypes import int_value
from .psparser import KWD
from .ps... | mit | 0ebe22a91e015a2d8b3f89055961f496 | 32.5 | 87 | 0.544946 | 4.088766 | false | false | false | false |
pdfminer/pdfminer.six | pdfminer/ascii85.py | 1 | 2097 | """ Python implementation of ASCII85/ASCIIHex decoder (Adobe version).
This code is in the public domain.
"""
import re
import struct
# ascii85decode(data)
def ascii85decode(data: bytes) -> bytes:
"""
In ASCII85 encoding, every four bytes are encoded with five ASCII
letters, using 85 different types of... | mit | 7fc7675e70d7c4017b534e46e630f165 | 28.125 | 77 | 0.562709 | 3.530303 | false | false | false | false |
stopstalk/stopstalk-deployment | aws_lambda/spoj_aws_lambda_function/lambda_code/pip/_vendor/html5lib/filters/inject_meta_charset.py | 169 | 2945 | from __future__ import absolute_import, division, unicode_literals
from . import base
class Filter(base.Filter):
"""Injects ``<meta charset=ENCODING>`` tag into head of document"""
def __init__(self, source, encoding):
"""Creates a Filter
:arg source: the source token stream
:arg en... | mit | ad35f35f5bbe271fd8ab9327782c9970 | 39.342466 | 102 | 0.441766 | 5.017036 | false | false | false | false |
chainer/chainer | tests/chainermn_tests/links_tests/test_n_step_rnn.py | 4 | 4452 | import chainer
import chainer.backends
from chainer.backends.cuda import cupy
import chainer.functions as F
import chainer.links as L
import chainer.testing
import chainer.testing.attr
import chainermn
import numpy as np
import pytest
class Model(chainer.Chain):
def __init__(self, n_vocab, n_hid, communicator, ra... | mit | 71c50c7005dcd0f63ce30e25b9bb075e | 30.132867 | 78 | 0.59726 | 3.283186 | false | true | false | false |
chainer/chainer | chainermn/communicators/__init__.py | 4 | 5933 | import warnings
from chainer.utils import argument
from chainermn.communicators.communicator_base import CommunicatorBase # NOQA
def create_communicator(
communicator_name='pure_nccl', mpi_comm=None, **kwargs):
"""Create a ChainerMN communicator.
Different communicators provide different approache... | mit | b1e133af57ecadf90dddd443ddfe3fc8 | 43.94697 | 78 | 0.537839 | 4.464259 | false | false | false | false |
chainer/chainer | examples/word2vec/search.py | 8 | 1487 | #!/usr/bin/env python
import argparse
import os
import numpy
import six
n_result = 5 # number of search result to show
parser = argparse.ArgumentParser()
parser.add_argument('--result', default='result',
help='Directory of a training result')
args = parser.parse_args()
with open(os.path.join(... | mit | f6bf7792df873735159a7b0f588ab8ca | 25.553571 | 75 | 0.538668 | 3.402746 | false | false | false | false |
stopstalk/stopstalk-deployment | aws_lambda/spoj_aws_lambda_function/lambda_code/pip/_vendor/cachecontrol/caches/file_cache.py | 33 | 4177 | import hashlib
import os
from textwrap import dedent
from ..cache import BaseCache
from ..controller import CacheController
try:
FileNotFoundError
except NameError:
# py2.X
FileNotFoundError = (IOError, OSError)
def _secure_open_write(filename, fmode):
# We only want to write to this file, so open i... | mit | a7ccb53bccac9bcc426bd7412b7c8c8f | 27.609589 | 79 | 0.593967 | 4.075122 | false | false | false | false |
chainer/chainer | chainer/training/extension.py | 8 | 6662 | from chainer.utils import argument
PRIORITY_WRITER = 300
PRIORITY_EDITOR = 200
PRIORITY_READER = 100
class Extension(object):
"""Base class of trainer extensions.
Extension of :class:`Trainer` is a callable object that takes the trainer
object as the argument. It also provides some default configurati... | mit | b2510ab6fef319dd12fa6f51211a177f | 36.852273 | 79 | 0.669168 | 4.923873 | false | false | false | false |
chainer/chainer | chainer/training/triggers/minmax_value_trigger.py | 10 | 3888 | from chainer import reporter
from chainer.training import util
class BestValueTrigger(object):
"""Trigger invoked when specific value becomes best.
Args:
key (str): Key of value.
compare (callable): Compare function which takes current best value and
new value and returns whether... | mit | a67bfe6fc87606a5785381345a290ec5 | 34.345455 | 79 | 0.629115 | 4.684337 | false | false | false | false |
chainer/chainer | chainer/functions/activation/softmax.py | 8 | 3591 | import chainer
from chainer import backend
from chainer.backends import cuda
from chainer import function_node
import chainer.functions
from chainer.utils import type_check
if cuda.cudnn_enabled:
cudnn = cuda.cudnn
_algorithm = cuda.libcudnn.CUDNN_SOFTMAX_ACCURATE
class Softmax(function_node.FunctionNode):
... | mit | 308ae5a350f8d4953a8b76432cb63728 | 30.226087 | 77 | 0.557783 | 3.349813 | false | false | false | false |
chainer/chainer | onnx_chainer/functions/array.py | 3 | 23717 | import warnings
import chainer
import numpy as np
import onnx
from onnx.mapping import NP_TYPE_TO_TENSOR_TYPE
from onnx_chainer.functions.opset_version import support
from onnx_chainer import onnx_helper
TENSOR_TYPE_TO_NAME = {
0: 'UNDEFINED',
1: 'FLOAT',
2: 'UINT8',
3: 'INT8',
4: 'UINT16',
... | mit | bf2d7a9ca898e8fa44dff2ad1b58c664 | 34.136296 | 79 | 0.586626 | 3.513109 | false | false | false | false |
chainer/chainer | chainermn/functions/collective_communication.py | 5 | 12921 | import chainer
from chainer import backend
import numpy
class AllGather(chainer.Function):
"""Collective all-gather communication."""
def __init__(self, comm):
chainer.utils.experimental('chainermn.functions.AllGather')
self.comm = comm
def forward(self, inputs):
x, = inputs
... | mit | 392ed65632710da4a15f8ffdf0a6c39e | 31.3025 | 84 | 0.6152 | 4.101905 | false | false | false | false |
chainer/chainer | chainer/training/triggers/once_trigger.py | 5 | 1517 | import warnings
class OnceTrigger(object):
"""Trigger based on the starting point of the iteration.
This trigger accepts only once at starting point of the iteration. There
are two ways to specify the starting point: only starting point in whole
iteration or called again when training resumed.
... | mit | c0d99a911ff2188fc445a1c3be56155c | 31.978261 | 77 | 0.624918 | 4.610942 | false | false | false | false |
chainer/chainer | chainer/iterators/multiprocess_iterator.py | 6 | 22878 | from __future__ import division
import datetime
import multiprocessing
from multiprocessing import sharedctypes # type: ignore
import signal
import sys
import threading
import warnings
import numpy
import six
from chainer.dataset import iterator
from chainer.iterators import _statemachine
from chainer.iterators.orde... | mit | 8fedb525802568e8b47ae84a61d7100b | 34.035222 | 79 | 0.584623 | 4.346125 | false | false | false | false |
stopstalk/stopstalk-deployment | aws_lambda/spoj_aws_lambda_function/lambda_code/lxml/html/builder.py | 150 | 4310 | # --------------------------------------------------------------------
# The ElementTree toolkit is
# Copyright (c) 1999-2004 by Fredrik Lundh
# --------------------------------------------------------------------
"""
A set of HTML generator tags for building HTML documents.
Usage::
>>> from lxml.html.builder im... | mit | 3d3e9363d235c26d828f908cf6792fc7 | 31.406015 | 82 | 0.662645 | 3.359314 | false | false | false | false |
chainer/chainer | chainer/functions/math/logsumexp.py | 6 | 3116 | import six
import chainer
from chainer import backend
from chainer import function_node
from chainer import utils
from chainer.utils import type_check
import chainerx
class LogSumExp(function_node.FunctionNode):
def __init__(self, axis=None):
if axis is None:
self.axis = None
elif is... | mit | 3134242878e0fb775499e185fa4d7c31 | 30.795918 | 79 | 0.544288 | 3.80464 | false | false | false | false |
chainer/chainer | chainer/dataset/download.py | 12 | 5087 | import hashlib
import os
import shutil
import sys
import filelock
from six.moves.urllib import request
from chainer import utils
_dataset_root = os.environ.get(
'CHAINER_DATASET_ROOT',
os.path.join(os.path.expanduser('~'), '.chainer', 'dataset'))
def get_dataset_root():
"""Gets the path to the root di... | mit | bde72939d56aa58fcbb412408ce10e99 | 30.993711 | 79 | 0.660704 | 4.145884 | false | false | false | false |
stopstalk/stopstalk-deployment | aws_lambda/spoj_aws_lambda_function/lambda_code/requests/packages/urllib3/util/timeout.py | 707 | 9596 | 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 | 8f99e9edecb44f06b966d3212970c5c7 | 38.652893 | 82 | 0.63516 | 4.606817 | false | false | false | false |
botify-labs/simpleflow | simpleflow/process/supervisor.py | 1 | 9275 | import functools
import multiprocessing
import os
import signal
import time
import types
import psutil
from simpleflow import logger
from .named_mixin import NamedMixin, with_state
def reset_signal_handlers(func):
"""
Decorator that resets signal handlers from the decorated function. Useful
for workers... | mit | d48fd5b884c9e8b6ae7076c72d3c888f | 37.168724 | 90 | 0.605822 | 4.502427 | false | false | false | false |
frappe/frappe | frappe/sessions.py | 2 | 13214 | # Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
"""
Boot session from cache or build
Session bootstraps info needed by common client side activities including
permission, homepage, default variables, system defaults etc
"""
import json
from urllib.parse import unquote
... | mit | 2e356f2870ede5908bd2d0801429ba1a | 25.912424 | 99 | 0.684804 | 3.056674 | false | false | false | false |
frappe/frappe | frappe/utils/password.py | 3 | 6765 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
import string
from cryptography.fernet import Fernet, InvalidToken
from passlib.context import CryptContext
from passlib.hash import mysql41, pbkdf2_sha256
from passlib.registry import register_crypt_handler
from pypika.t... | mit | 8c9d05af3451b7b936e9677316cdb57c | 27.910256 | 116 | 0.720325 | 3.192544 | false | false | false | false |
frappe/frappe | frappe/utils/caching.py | 3 | 4184 | # Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. Check LICENSE
import json
from collections import defaultdict
from datetime import datetime, timedelta
from functools import wraps
from typing import Callable
import frappe
_SITE_CACHE = defaultdict(lambda: defaultdict(dict))
def ... | mit | c2502a3ebc75fd5efef1ba6f78eddf33 | 31.184615 | 98 | 0.680927 | 3.563884 | false | false | false | false |
frappe/frappe | frappe/core/doctype/file/file.py | 1 | 21692 | # Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
import io
import mimetypes
import os
import re
import shutil
import zipfile
from urllib.parse import quote, unquote
from PIL import Image, ImageFile, ImageOps
from requests.exceptions import HTTPError, SSLError
import fr... | mit | 514c4e214c84ffb4358b8ac65707bb49 | 28.392954 | 104 | 0.687535 | 3.073827 | false | false | false | false |
frappe/frappe | frappe/search/full_text_search.py | 3 | 4437 | # Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
from whoosh.fields import ID, TEXT, Schema
from whoosh.index import EmptyIndexError, create_in, open_dir
from whoosh.qparser import FieldsPlugin, MultifieldParser, WildcardPlugin
from whoosh.query import FuzzyTerm, Prefix
... | mit | 851b496c8416d32ea3b639e0317ee5cf | 25.890909 | 95 | 0.697318 | 3.260103 | false | false | false | false |
frappe/frappe | frappe/patches/v11_0/replicate_old_user_permissions.py | 3 | 2831 | import json
import frappe
from frappe.permissions import get_valid_perms
from frappe.utils import cint
def execute():
frappe.reload_doctype("User Permission")
user_permissions = frappe.get_all("User Permission", fields=["allow", "name", "user"])
doctype_to_skip_map = {}
for permission in user_permissions:
if... | mit | 3ea95a94772d4cc999fc71a5fbdc38f4 | 27.31 | 92 | 0.722713 | 3.188063 | false | false | false | false |
frappe/frappe | frappe/tests/test_exporter_fixtures.py | 2 | 8705 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
import os
import frappe
import frappe.defaults
from frappe.core.doctype.data_import.data_import import export_csv
from frappe.tests.utils import FrappeTestCase
class TestDataImportFixtures(FrappeTestCase):
def setUp(sel... | mit | 7e3fb3fc9755d7c9f1e864a82f921b65 | 29.437063 | 85 | 0.674785 | 2.826299 | false | true | false | false |
simpeg/discretize | discretize/utils/curvilinear_utils.py | 1 | 18626 | import numpy as np
from discretize.utils.matrix_utils import mkvc, ndgrid, sub2ind
from discretize.utils.code_utils import deprecate_function
import warnings
def example_curvilinear_grid(nC, exType):
"""Creates and returns the gridded node locations for a curvilinear mesh.
Parameters
----------
nC : ... | mit | c288eb3f8e200f0166b28afd1757b2cf | 34.077213 | 103 | 0.538172 | 3.351205 | false | false | false | false |
richardkiss/pycoin | pycoin/crack/ecdsa.py | 1 | 1028 |
def crack_secret_exponent_from_k(generator, signed_value, sig, k):
"""
Given a signature of a signed_value and a known k, return the secret exponent.
"""
r, s = sig
return ((s * k - signed_value) * generator.inverse(r)) % generator.order()
def crack_k_from_sigs(generator, sig1, val1, sig2, val2):... | mit | 185d4f29d87308b998dc55c3f08efef3 | 29.235294 | 88 | 0.508755 | 2.53202 | false | false | false | false |
frappe/frappe | frappe/core/doctype/server_script/server_script_utils.py | 3 | 2283 | import frappe
# this is a separate file since it is imported in frappe.model.document
# to avoid circular imports
EVENT_MAP = {
"before_insert": "Before Insert",
"after_insert": "After Insert",
"before_validate": "Before Validate",
"validate": "Before Save",
"on_update": "After Save",
"before_submit": "Before S... | mit | 64007fc1bfb821628ec9d310e77a93f9 | 28.269231 | 86 | 0.674113 | 3.080972 | false | false | false | false |
frappe/frappe | frappe/patches/v11_0/make_all_prepared_report_attachments_private.py | 3 | 1044 | import frappe
def execute():
if (
frappe.db.count("File", filters={"attached_to_doctype": "Prepared Report", "is_private": 0})
> 10000
):
frappe.db.auto_commit_on_many_writes = True
files = frappe.get_all(
"File",
fields=["name", "attached_to_name"],
filters={"attached_to_doctype": "Prepared Report", ... | mit | 60cb745428223f98f459755cc9a599f1 | 32.677419 | 99 | 0.694444 | 3.135135 | false | false | false | false |
frappe/frappe | frappe/website/doctype/help_article/help_article.py | 3 | 3237 | # Copyright (c) 2013, Frappe and contributors
# License: MIT. See LICENSE
import frappe
from frappe import _
from frappe.utils import cint, is_markdown, markdown
from frappe.website.utils import get_comment_list
from frappe.website.website_generator import WebsiteGenerator
class HelpArticle(WebsiteGenerator):
def v... | mit | 93da5d772fca4714b60906c7651f5812 | 26.201681 | 88 | 0.707136 | 3.130561 | false | false | false | false |
frappe/frappe | frappe/deferred_insert.py | 3 | 1493 | import json
from typing import TYPE_CHECKING, Union
import redis
import frappe
from frappe.utils import cstr
if TYPE_CHECKING:
from frappe.model.document import Document
queue_prefix = "insert_queue_for_"
def deferred_insert(doctype: str, records: list[Union[dict, "Document"]] | str):
if isinstance(records, (di... | mit | 16150148f94554d2585555ced9023bfb | 24.305085 | 80 | 0.701942 | 3.110417 | false | false | false | false |
frappe/frappe | frappe/query_builder/custom.py | 3 | 3433 | from typing import Any
from pypika.functions import DistinctOptionFunction
from pypika.terms import Term
from pypika.utils import builder, format_alias_sql, format_quotes
import frappe
class GROUP_CONCAT(DistinctOptionFunction):
def __init__(self, column: str, alias: str | None = None):
"""[ Implements the group... | mit | 986d9382657b4aab902ec7a7aacb9e53 | 32.009615 | 166 | 0.669094 | 3.208411 | false | false | false | false |
frappe/frappe | frappe/integrations/doctype/webhook/__init__.py | 2 | 2323 | # Copyright (c) 2017, Frappe Technologies and contributors
# License: MIT. See LICENSE
import frappe
def run_webhooks(doc, method):
"""Run webhooks for this method"""
if (
frappe.flags.in_import
or frappe.flags.in_patch
or frappe.flags.in_install
or frappe.flags.in_migrate
):
return
if frappe.flags.we... | mit | 7ea03fb3538319f23ddb9d3b23752258 | 28.405063 | 81 | 0.717176 | 3.258065 | false | false | false | false |
frappe/frappe | frappe/utils/__init__.py | 2 | 26864 | # Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
import functools
import hashlib
import io
import json
import os
import re
import sys
import traceback
from collections.abc import (
Container,
Generator,
Iterable,
MutableMapping,
MutableSequence,
Sequence,
)
from em... | mit | 513a78ad8f6e1f88e777c235f18fe6bd | 24.584762 | 248 | 0.665873 | 2.9829 | false | false | false | false |
richardkiss/pycoin | tests/btc/bip32_test.py | 1 | 12737 | import unittest
from pycoin.encoding.hexbytes import h2b
from pycoin.symbols.btc import network as BTC
from pycoin.symbols.xtn import network as XTN
class Bip0032TestCase(unittest.TestCase):
def test_vector_1(self):
master = BTC.keys.bip32_seed(h2b("000102030405060708090a0b0c0d0e0f"))
self.asser... | mit | 9bac660ff20715e5e6c7d89d878f8549 | 48.560311 | 118 | 0.663971 | 2.281799 | false | false | false | false |
richardkiss/pycoin | tests/script/stackops_test.py | 1 | 3267 |
import binascii
import unittest
from pycoin.satoshi import stackops
def b2h(b):
return binascii.hexlify(b).decode("utf8")
class StackOpsTest(unittest.TestCase):
def test_do_OP_2DROP(self):
s = [1, 2, 3]
stackops.do_OP_2DROP(s)
self.assertEqual(s, [1])
def test_do_OP_2DUP(self)... | mit | eca2b1e3cd7602a98489834c060c5b91 | 25.560976 | 103 | 0.541475 | 2.497706 | false | true | false | false |
simpeg/discretize | discretize/operators/inner_products.py | 1 | 28521 | from scipy import sparse as sp
from discretize.utils import (
sub2ind,
sdiag,
inverse_property_tensor,
TensorType,
make_property_tensor,
ndgrid,
inverse_2x2_block_diagonal,
get_subarray,
inverse_3x3_block_diagonal,
spzeros,
sdinv,
)
import numpy as np
from discretize.utils.co... | mit | 225a837e29797a5eded827843246abf8 | 34.830402 | 124 | 0.436205 | 3.316395 | false | false | false | false |
richardkiss/pycoin | pycoin/services/blockchain_info.py | 1 | 2769 | import io
import json
import warnings
from .agent import request, urlencode, urlopen
from pycoin.coins.bitcoin.Tx import Tx
from pycoin.encoding.hexbytes import b2h, h2b, b2h_rev
class BlockchainInfoProvider(object):
def __init__(self, netcode):
if netcode == "BTC":
self.api_domain = "https:... | mit | 70f457ab021204d7f41bcc676e09f026 | 33.6125 | 94 | 0.555796 | 3.653034 | false | false | false | false |
richardkiss/pycoin | pycoin/ecdsa/intstream.py | 1 | 1243 |
from pycoin.intbytes import iterbytes, byte2int
def _to_bytes(v, length, byteorder="big"):
"""This is the same functionality as ``int.to_bytes`` in python 3"""
return v.to_bytes(length, byteorder=byteorder)
def _from_bytes(bytes, byteorder="big", signed=False):
"""This is the same functionality as ``in... | mit | 49e0ea47ed45ad02cd10ce0e4bbc84c6 | 30.075 | 78 | 0.568785 | 3.666667 | false | false | false | false |
frappe/frappe | frappe/app.py | 1 | 10706 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
import logging
import os
from werkzeug.exceptions import HTTPException, NotFound
from werkzeug.local import LocalManager
from werkzeug.middleware.profiler import ProfilerMiddleware
from werkzeug.middleware.shared_data imp... | mit | 0e583cb568f992dfbd3eec2bbdfcfc9c | 27.248021 | 103 | 0.723052 | 3.26502 | false | false | false | false |
frappe/frappe | frappe/automation/doctype/milestone_tracker/test_milestone_tracker.py | 2 | 1371 | # Copyright (c) 2019, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import frappe
import frappe.cache_manager
from frappe.tests.utils import FrappeTestCase
class TestMilestoneTracker(FrappeTestCase):
def test_milestone(self):
frappe.db.delete("Milestone Tracker")
frappe.cache().delete_key("mi... | mit | c3b1e408576962b2f8c0b184dd0649ae | 28.804348 | 99 | 0.723559 | 3.272076 | false | true | false | false |
sqlalchemy/mako | doc/build/conf.py | 2 | 9571 | #
# Mako documentation build configuration file
#
# 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 configuration values have a default; values that are commented out
# serve to show the ... | mit | cd7239d22d53994078092d70a6a34895 | 29.77492 | 80 | 0.693867 | 3.664242 | false | true | false | false |
sqlalchemy/mako | test/test_inheritance.py | 9 | 10782 | from mako import lookup
from mako.testing.helpers import result_lines
class InheritanceTest:
def test_basic(self):
collection = lookup.TemplateLookup()
collection.put_string(
"main",
"""
<%inherit file="base"/>
<%def name="header()">
main header.
</%def>
this is the ... | mit | 0e3094435a252ce56ff62b8ace98bab2 | 24.191589 | 81 | 0.433779 | 4.135788 | false | false | false | false |
frappe/frappe | frappe/permissions.py | 2 | 21422 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
import copy
import frappe
import frappe.share
from frappe import _, msgprint
from frappe.query_builder import DocType
from frappe.utils import cint, cstr
rights = (
"select",
"read",
"write",
"create",
"delete",
"su... | mit | 64070fde3c0134f0645c7e9fdaffc165 | 28.185286 | 103 | 0.698954 | 3.29063 | false | false | false | false |
frappe/frappe | frappe/database/postgres/setup_db.py | 2 | 3317 | import os
import frappe
def setup_database(force, source_sql=None, verbose=False):
root_conn = get_root_connection(frappe.flags.root_login, frappe.flags.root_password)
root_conn.commit()
root_conn.sql("end")
root_conn.sql(f"DROP DATABASE IF EXISTS `{frappe.conf.db_name}`")
root_conn.sql(f"DROP USER IF EXISTS {f... | mit | 64d5e2ecbb20d0d2dc9886c60007545d | 28.616071 | 113 | 0.714501 | 2.966905 | false | false | false | false |
frappe/frappe | frappe/website/doctype/web_form/web_form.py | 1 | 17704 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
# License: MIT. See LICENSE
import json
import os
import frappe
from frappe import _, scrub
from frappe.core.api.file import get_max_file_size
from frappe.core.doctype.file import remove_file_by_url
from frappe.desk.form.meta import get_code_files_v... | mit | b150c3e48989ae48f24790afdf72ffee | 27.833876 | 99 | 0.689392 | 3.034625 | false | false | false | false |
simpeg/discretize | discretize/curvilinear_mesh.py | 1 | 27594 | import numpy as np
from discretize.utils import (
mkvc,
index_cube,
face_info,
volume_tetrahedron,
make_boundary_bool,
)
from discretize.base import BaseRectangularMesh
from discretize.operators import DiffOperators, InnerProducts
from discretize.mixins import InterfaceMixins
# Some helper functio... | mit | d4dbb637295a4c3a506e5e16771c0cc2 | 36.903846 | 120 | 0.501776 | 3.484091 | false | false | false | false |
frappe/frappe | frappe/database/utils.py | 2 | 1564 | # Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
import typing
from functools import cached_property
from types import NoneType
import frappe
from frappe.query_builder.builder import MariaDB, Postgres
from frappe.query_builder.functions import Function
if typing.TYPE_C... | mit | 5aef9e4bb3b4deaa8ca6aababccc4d70 | 21.342857 | 95 | 0.703964 | 3.153226 | false | false | false | false |
frappe/frappe | frappe/desk/link_preview.py | 3 | 1421 | import frappe
from frappe.model import no_value_fields, table_fields
@frappe.whitelist()
def get_preview_data(doctype, docname):
preview_fields = []
meta = frappe.get_meta(doctype)
if not meta.show_preview_popup:
return
preview_fields = [
field.fieldname
for field in meta.fields
if field.in_preview
and... | mit | 207367f0ef10c915c79881384c0e2aad | 25.314815 | 99 | 0.724842 | 3.123077 | false | false | false | false |
frappe/frappe | frappe/tests/test_query_builder.py | 2 | 13097 | import unittest
from collections.abc import Callable
from datetime import time
import frappe
from frappe.query_builder import Case
from frappe.query_builder.builder import Function
from frappe.query_builder.custom import ConstantColumn
from frappe.query_builder.functions import Cast_, Coalesce, CombineDatetime, GroupC... | mit | 33e8284c1ad88c357086e9e505f43fb9 | 33.925333 | 118 | 0.690234 | 2.976591 | false | true | false | false |
frappe/frappe | frappe/core/doctype/submission_queue/submission_queue.py | 1 | 5727 | # Copyright (c) 2022, Frappe Technologies and contributors
# For license information, please see license.txt
from urllib.parse import quote
from rq import get_current_job
from rq.exceptions import NoSuchJobError
from rq.job import Job
import frappe
from frappe import _
from frappe.desk.doctype.notification_log.notif... | mit | 728e0fdfa35ecc0462b135393584b367 | 28.673575 | 111 | 0.696176 | 3.126092 | false | false | false | false |
frappe/frappe | frappe/build.py | 1 | 11637 | # Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
import os
import re
import shutil
import subprocess
from subprocess import getoutput
from tempfile import mkdtemp, mktemp
from urllib.parse import urlparse
import click
import psutil
from requests import head
from requests... | mit | 8c71c7d3542e8de75cc5e51f60be3fe0 | 26.552133 | 99 | 0.698977 | 3.007501 | false | false | false | false |
frappe/frappe | frappe/patches/v12_0/move_timeline_links_to_dynamic_links.py | 3 | 1949 | import frappe
def execute():
communications = frappe.db.sql(
"""
SELECT
`tabCommunication`.name, `tabCommunication`.creation, `tabCommunication`.modified,
`tabCommunication`.modified_by,`tabCommunication`.timeline_doctype, `tabCommunication`.timeline_name,
`tabCommunication`.link_doctype, `tabCommunicat... | mit | 07cd21b454de37ed0ba335cbbf40fca4 | 28.530303 | 104 | 0.640328 | 3.41331 | false | false | false | false |
frappe/frappe | frappe/utils/dashboard.py | 2 | 3585 | # Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
import os
from functools import wraps
from os.path import join
import frappe
from frappe import _
from frappe.modules.import_file import import_file_by_path
from frappe.utils import cint, get_link_to_form
def cache_sourc... | mit | f86822a5d580e12ef1d86fe9508a8ba0 | 30.173913 | 98 | 0.70265 | 3.150264 | false | false | false | false |
simpeg/discretize | tests/base/test_tensor_omf.py | 1 | 3923 | import numpy as np
import unittest
import discretize
try:
import omf
except ImportError:
has_omf = False
else:
has_omf = True
if has_omf:
from discretize.mixins.omf_mod import unravel_data_array, ravel_data_array
class TestTensorMeshOMF(unittest.TestCase):
def setUp(self):
h ... | mit | a764968bb81433f0abe8f1ced87c3d76 | 36.721154 | 78 | 0.520265 | 3.750478 | false | true | false | false |
frappe/frappe | frappe/core/report/database_storage_usage_by_tables/database_storage_usage_by_tables.py | 2 | 1323 | # Copyright (c) 2022, Frappe Technologies and contributors
# For license information, please see license.txt
import frappe
COLUMNS = [
{"label": "Table", "fieldname": "table", "fieldtype": "Data", "width": 200},
{"label": "Size (MB)", "fieldname": "size", "fieldtype": "Float"},
{"label": "Data (MB)", "fieldname": ... | mit | 0204ee8c4cc8530af6ec742fc243cf85 | 32.075 | 88 | 0.624339 | 3.055427 | false | false | false | false |
richardkiss/pycoin | pycoin/services/chain_so.py | 1 | 1577 | import io
import json
from .agent import urlopen
from pycoin.coins.bitcoin.Tx import Tx
from pycoin.encoding.hexbytes import b2h_rev, h2b, h2b_rev
from pycoin.networks.default import get_current_netcode
class ChainSoProvider(object):
def __init__(self, netcode=None):
NETWORK_PATHS = {
"BTC":... | mit | 0d1b001f07a590438c2f022e17c99f37 | 31.854167 | 95 | 0.579581 | 3.292276 | false | false | false | false |
richardkiss/pycoin | pycoin/solve/constraints.py | 1 | 4845 | import functools
import pdb
@functools.total_ordering
class Atom(object):
def __init__(self, name):
self.name = name
def dependencies(self):
return frozenset([self])
def __len__(self):
# HACK to allow MAX_BLOB_LENGTH comparison to succeed
return 0
def __eq__(self, ot... | mit | 12905749f5da05984070d5be6ab681b1 | 27.333333 | 101 | 0.579154 | 3.409571 | false | false | false | false |
frappe/frappe | frappe/desk/doctype/note/test_note.py | 2 | 2314 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and Contributors
# License: MIT. See LICENSE
import frappe
from frappe.tests.utils import FrappeTestCase
test_records = frappe.get_test_records("Note")
class TestNote(FrappeTestCase):
def insert_note(self):
frappe.db.delete("Version")
frappe.... | mit | 1d95f00c6345b77c57e303bcca912cab | 29.051948 | 85 | 0.674589 | 3.073041 | false | true | false | false |
frappe/frappe | frappe/printing/doctype/letter_head/letter_head.py | 2 | 3081 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
import frappe
from frappe import _
from frappe.model.document import Document
from frappe.utils import flt, is_image
class LetterHead(Document):
def before_insert(self):
# for better UX, let user set from attachment
... | mit | 99ec1eb3cba982ab491732944cd3a903 | 30.438776 | 91 | 0.694255 | 3.25 | false | false | false | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.