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
conan-io/conan
conans/client/cmd/create.py
1
4951
import os from conans.client.cmd.test import install_build_and_test from conans.client.manager import deps_install from conans.errors import ConanException from conans.model.ref import ConanFileReference def _get_test_conanfile_path(tf, conanfile_path): """Searches in the declared test_folder or in the standard ...
mit
0ce8e1962ae6d2247bbbb4a9dee3881d
49.010101
100
0.534034
4.648826
false
true
false
false
aliyun/aliyun-oss-python-sdk
oss2/models.py
1
91498
# -*- coding: utf-8 -*- """ oss2.models ~~~~~~~~~~ 该模块包含Python SDK API接口所需要的输入参数以及返回值类型。 """ from . import utils from .utils import http_to_unixtime, make_progress_adapter, make_crc_adapter, b64encode_as_string, b64decode_from_string from .exceptions import ClientError, InconsistentError from .compat import urlunquot...
mit
ba379b65c6252a16ef033b8ff8d02aff
31.53754
168
0.641898
2.942787
false
false
false
false
aleju/imgaug
checks/check_visually.py
2
8145
""" Tests to visually inspect the results of the library's functionality. Run checks via python check_visually.py """ from __future__ import print_function, division import argparse import numpy as np from skimage import data import imgaug as ia from imgaug import augmenters as iaa def main(): parser = arg...
mit
9bf9f587d52240a4cb5f3c12b59d168c
38.926471
126
0.552855
3.025632
false
false
false
false
aliyun/aliyun-oss-python-sdk
oss2/iterators.py
1
12793
# -*- coding: utf-8 -*- """ oss2.iterators ~~~~~~~~~~~~~~ 该模块包含了一些易于使用的迭代器,可以用来遍历Bucket、文件、分片上传等。 """ from .models import MultipartUploadInfo, SimplifiedObjectInfo from .exceptions import ServerError from . import defaults, http class _BaseIterator(object): def __init__(self, marker, max_retries): sel...
mit
3d4da6832647dcc2621a1ff9ab0a1c47
36.569079
185
0.590316
3.182223
false
false
false
false
aliyun/aliyun-oss-python-sdk
oss2/resumable.py
1
37191
# -*- coding: utf-8 -*- """ oss2.resumable ~~~~~~~~~~~~~~ 该模块包含了断点续传相关的函数和类。 """ import os from . import utils from .utils import b64encode_as_string, b64decode_from_string from . import iterators from . import exceptions from . import defaults from . import http from . import models from .crypto_bucket import Cryp...
mit
3271c3de96693d6b527390630fc0bd40
37.082965
131
0.582798
3.338538
false
false
false
false
aleju/imgaug
imgaug/augmenters/geometric.py
2
255295
"""Augmenters that apply affine or similar transformations. List of augmenters: * :class:`Affine` * :class:`ScaleX` * :class:`ScaleY` * :class:`TranslateX` * :class:`TranslateY` * :class:`Rotate` * :class:`ShearX` * :class:`ShearY` * :class:`AffineCv2` * :class:`PiecewiseAffine...
mit
c5365d51972857806abd9aba6bc1f6ea
40.196547
223
0.567285
3.890269
false
false
false
false
aleju/imgaug
checks/check_affinecv2.py
2
3686
from __future__ import print_function, division import imgaug as ia from imgaug import augmenters as iaa import imageio import numpy as np from skimage import data import cv2 NB_ROWS = 10 NB_COLS = 10 HEIGHT = 200 WIDTH = 256 BB_X1 = 64 BB_X2 = WIDTH - 64 BB_Y1 = 64 BB_Y2 = HEIGHT - 64 def main(): image = data.as...
mit
1ed7d5ba9740cac996c934abecb0ee26
39.065217
122
0.620998
2.519481
false
false
false
false
aliyun/aliyun-oss-python-sdk
examples/object_post.py
1
7112
# -*- coding: utf-8 -*- import time import datetime import json import base64 import hmac import hashlib import os import crcmod import requests # 以下代码展示了PostObject的用法。PostObject不依赖于OSS Python SDK。 # POST表单域的详细说明请参RFC2388 https://tools.ietf.org/html/rfc2388 # PostObject的官网 https://help.aliyun.com/document_detail/31...
mit
08b305dcbff09ffbab7ece8ae2a99a38
30.695431
135
0.6664
2.593023
false
false
false
false
aleju/imgaug
checks/check_segmentation_maps.py
2
5521
from __future__ import print_function import numpy as np import imgaug as ia from imgaug import augmenters as iaa def main(): quokka = ia.data.quokka(size=0.5) h, w = quokka.shape[0:2] c = 1 segmap = np.zeros((h, w, c), dtype=np.int32) segmap[70:120, 90:150, 0] = 1 segmap[30:70, 50:65, 0] = ...
mit
05a87b5a97b6818462e26e4644af1eb3
29.502762
82
0.620178
2.8154
false
false
false
false
aliyun/aliyun-oss-python-sdk
examples/bucket_tagging.py
1
1809
import os import oss2 from oss2.models import Tagging, TaggingRule # Specify access information, such as AccessKeyId, AccessKeySecret, and Endpoint. # You can obtain access information from evironment variables or replace sample values in the code, such as <your AccessKeyId> with actual values. # # For example, if yo...
mit
4dcfb1be9a4c9ed751c8d4a1f8065866
35.16
146
0.746541
3.297445
false
true
false
false
aleju/imgaug
imgaug/data.py
2
17570
"""Functions to generate example data, e.g. example images or segmaps. Added in 0.5.0. """ from __future__ import print_function, division, absolute_import import os import json import imageio import numpy as np # filepath to the quokka image, its annotations and depth map # Added in 0.5.0. _FILE_DIR = os.path.dir...
mit
1e9d2e656daf350271c1e3ebc0105650
35.452282
136
0.614741
3.453223
false
false
false
false
aleju/imgaug
imgaug/augmenters/segmentation.py
2
77929
""" Augmenters that apply changes to images based on segmentation methods. List of augmenters: * :class:`Superpixels` * :class:`Voronoi` * :class:`UniformVoronoi` * :class:`RegularGridVoronoi` * :class:`RelativeRegularGridVoronoi` """ from __future__ import print_function, division, absolute_impo...
mit
fd6123614ad8cf74f311c918e2863f34
42.173961
173
0.617947
4.020897
false
false
false
false
aleju/imgaug
imgaug/augmenters/blend.py
2
170224
""" Augmenters that blend two images with each other. List of augmenters: * :class:`BlendAlpha` * :class:`BlendAlphaMask` * :class:`BlendAlphaElementwise` * :class:`BlendAlphaSimplexNoise` * :class:`BlendAlphaFrequencyNoise` * :class:`BlendAlphaSomeColors` * :class:`BlendAlphaHorizontalLin...
mit
aca59c448570cb2ca8f61bc07964236a
41.051383
177
0.613685
4.055366
false
false
false
false
aleju/imgaug
checks/check_multiply_hue_and_saturation.py
2
1078
from __future__ import print_function, division import numpy as np import imgaug as ia from imgaug import augmenters as iaa def main(): image = ia.quokka_square((128, 128)) images_aug = [] for mul in np.linspace(0.0, 2.0, 10): aug = iaa.MultiplyHueAndSaturation(mul) image_aug = aug.augm...
mit
0bdc6d5d9e271733a040f8be2f087319
28.135135
76
0.650278
2.913514
false
false
false
false
aliyun/aliyun-oss-python-sdk
tests/test_select_csv_object.py
1
23204
# -*- coding: utf-8 -*- import requests import filecmp import calendar import csv import re import sys from oss2.exceptions import (ClientError, RequestError, NoSuchBucket, NotFound, NoSuchKey, Conflict, PositionNotEqualToLength, ObjectNotAppendable, SelectOperationFailed, SelectOperationC...
mit
cbde21e96c78b34b5f320769c61e9afb
43.030361
334
0.555809
3.892635
false
true
false
false
simpeg/simpeg
tutorials/02-linear_inversion/plot_inv_1_inversion_lsq.py
1
6268
""" Linear Least-Squares Inversion ============================== Here we demonstrate the basics of inverting data with SimPEG by considering a linear inverse problem. We formulate the inverse problem as a least-squares optimization problem. For this tutorial, we focus on the following: - Defining the forward pro...
mit
784894a46b5cdbf5839536a4d92effc6
28.706161
91
0.638003
3.652681
false
false
false
false
simpeg/simpeg
SimPEG/electromagnetics/frequency_domain/survey.py
1
2730
from scipy.constants import mu_0 from ...survey import BaseSurvey from .sources import BaseFDEMSrc from ...utils import validate_list_of_types class Survey(BaseSurvey): """Frequency domain electromagnetic survey Parameters ---------- source_list : list of SimPEG.electromagnetic.frequency_domain.sourc...
mit
52c49fcb2c76baf698b8e6549e2a2a94
26.029703
85
0.568132
4.519868
false
false
false
false
santoshphilip/eppy
tests/sample_html.py
3
3292
"""sample html for pytesting""" # ======================================================================= # Distributed under the MIT License. # (See accompanying file LICENSE or copy at # http://opensource.org/licenses/MIT) # ======================================================================= from __future__ im...
mit
f91e979e3195434b1da9ca304c3711b3
28.927273
118
0.60723
2.665587
false
false
false
false
simpeg/simpeg
SimPEG/seismic/straight_ray_tomography/survey.py
1
1622
import numpy as np from ...survey import BaseSurvey class StraightRaySurvey(BaseSurvey): """Straight ray tomography survey""" @property def nD(self): """Number of data Returns ------- int Number of data """ n = 0 for tx in self.source_l...
mit
47d88212e59e42a7ba159a78733672aa
23.575758
87
0.447596
4.302387
false
false
false
false
simpeg/simpeg
SimPEG/dask/simulation.py
1
1641
from ..simulation import BaseSimulation as Sim from ..utils import validate_string, validate_integer @property def chunk_format(self): "Apply memory chunks along rows of G, either 'equal', 'row', or 'auto'" return self._chunk_format @chunk_format.setter def chunk_format(self, other): self._chunk_format ...
mit
667ddd9e3d4a616dd2c3e4ace983df32
19.012195
79
0.634979
3.230315
false
false
false
false
simpeg/simpeg
tutorials/07-fdem/plot_fwd_2_fem_cyl.py
1
7972
""" 3D Forward Simulation on a Cylindrical Mesh =========================================== Here we use the module *SimPEG.electromagnetics.frequency_domain* to simulate the FDEM response for a borehole survey using a cylindrical mesh and radially symmetric conductivity model. For this tutorial, we focus on the follow...
mit
fdf974434204c52ebf92c1b1c8364236
33.214592
96
0.664325
3.309257
false
false
false
false
simpeg/simpeg
tutorials/06-ip/plot_inv_3_dcip3d.py
1
23601
# -*- coding: utf-8 -*- """ 3D Least-Squares Inversion of DC and IP Data ============================================ Here we invert 5 lines of DC and IP data to recover both an electrical conductivity and a chargeability model. We formulate the corresponding inverse problems as least-squares optimization problems. Fo...
mit
6efcb29477a094ca2705cb24f8d00b0e
29.026718
91
0.641837
3.326427
false
false
false
false
santoshphilip/eppy
tests/test_walk_hvac.py
1
15400
"""py.test for walk_hvac.py""" # Copyright (c) 2016 Santosh Philip # ======================================================================= # Distributed under the MIT License. # (See accompanying file LICENSE or copy at # http://opensource.org/licenses/MIT) # ======================================================...
mit
90236965b7f0d11f3560db181eab2e2c
50.162791
86
0.596234
2.98855
false
false
false
false
santoshphilip/eppy
tests/test_bunch_subclass.py
1
43953
# Copyright (c) 2012, 2020 Santosh Philip # ======================================================================= # Distributed under the MIT License. # (See accompanying file LICENSE or copy at # http://opensource.org/licenses/MIT) # ======================================================================= """py.t...
mit
6c84de70206c8578e9e8fbc959b0a4b3
38.597297
157
0.484768
3.582736
false
true
false
false
simpeg/simpeg
examples/04-dcip/plot_inv_dcip_dipoledipole_parametric_inversion.py
1
6893
""" Parametric DC inversion with Dipole Dipole array ================================================ This is an example for a parametric inversion with a DC survey. Resistivity structure of the subsurface is parameterized as following parameters: - sigma_background: background conductivity - sigma_block: blo...
mit
25c341588c9a7f0c57a36dc29df55834
28.969565
84
0.608588
3.131758
false
false
false
false
simpeg/simpeg
SimPEG/utils/__init__.py
1
6093
""" ======================================================== Utility Classes and Functions (:mod:`SimPEG.utils`) ======================================================== .. currentmodule:: SimPEG.utils The ``utils`` package contains utilities for helping with common operations involving SimPEG. Many of the utilities ...
mit
6c3a5bb187efd76aa773fb741ccac6bc
18.977049
88
0.688003
3.579906
false
false
false
false
simpeg/simpeg
tutorials/08-tdem/plot_fwd_1_em1dtm_waveforms.py
1
7865
""" 1D Forward Simulation with User-Defined Waveforms ================================================= For time-domain electromagnetic problems, the response depends strongly on the souce waveforms. In this tutorial, we construct a set of waveforms of different types and simulate the response for a halfspace. Many ty...
mit
5c42e2e12c8e65955c762092b49c6f82
29.019084
93
0.638271
3.163717
false
false
false
false
santoshphilip/eppy
eppy/EPlusInterfaceFunctions/parse_idd.py
1
12869
#!/usr/bin/env python ## EPlusInterface (EPI) - An interface for EnergyPlus ## Copyright (C) 2004 Santosh Philip # ======================================================================= # Distributed under the MIT License. # (See accompanying file LICENSE or copy at # http://opensource.org/licenses/MIT) # ========...
mit
5fffb4663905122ec8ce55f244f7f8e2
31.012438
97
0.550936
3.590681
false
false
false
false
simpeg/simpeg
examples/05-fdem/plot_inv_fdem_loop_loop_2Dinversion.py
1
11463
""" 2D inversion of Loop-Loop EM Data ================================= In this example, we consider a single line of loop-loop EM data at 30kHz with 3 different coil separations [0.32m, 0.71m, 1.18m]. We will use only Horizontal co-planar orientations (vertical magnetic dipole), and look at the real and imaginary par...
mit
7d3bac37231c54c04341d9606a4854a2
29.649733
202
0.591555
3.29586
false
false
false
false
santoshphilip/eppy
tests/conftest.py
1
1528
import os import pytest from io import StringIO from importlib import reload from eppy.modeleditor import IDF from eppy.iddcurrent import iddcurrent from eppy import modeleditor from .test_runner import versiontuple THIS_DIR = os.path.dirname(os.path.abspath(__file__)) RESOURCES_DIR = os.path.join(THIS_DIR, os.pard...
mit
625d01ba6f282e576d38492f572e78b6
28.384615
78
0.693063
2.850746
false
true
false
false
simpeg/simpeg
SimPEG/flow/richards/__init__.py
1
1088
""" ======================================================================= Richards Flow (:mod:`SimPEG.flow.richards`) ======================================================================= .. currentmodule:: SimPEG.flow.richards About ``Richards flow`` Simulations =========== .. autosummary:: :toctree: generated...
mit
a87fa4701af452b3f9c70dbd17790e20
21.666667
71
0.64614
3.638796
false
false
true
false
simpeg/simpeg
SimPEG/electromagnetics/static/spectral_induced_polarization/run.py
1
4837
import numpy as np from SimPEG import ( maps, optimization, inversion, inverse_problem, directives, data_misfit, regularization, ) def spectral_ip_mappings( mesh, indActive=None, inactive_eta=1e-4, inactive_tau=1e-4, inactive_c=1e-4, is_log_eta=True, is_log_tau=...
mit
edc3e29598e53af4719ddd89ef5c75f2
24.324607
88
0.615878
2.905105
false
false
false
false
santoshphilip/eppy
eppy/snippet.py
1
5331
# Copyright (c) 2012 Santosh Philip """just a snippet that is used in tests""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals idfsnippet = """ Building, Building, !- Name 30., ...
mit
2585d3de573fd6828922ecb2c5b981d1
36.542254
78
0.397486
3.611789
false
false
true
false
simpeg/simpeg
SimPEG/regularization/pgi.py
1
31445
from __future__ import annotations import copy import warnings import numpy as np import scipy.sparse as sp from ..maps import IdentityMap, Wires from ..objective_function import ComboObjectiveFunction from ..utils import ( Identity, deprecate_property, mkvc, sdiag, timeIt, validate_float, ...
mit
cf5460932ca29793b3c5b1267b3f6af1
35.777778
120
0.430784
4.278231
false
false
false
false
simpeg/simpeg
tutorials/03-gravity/plot_inv_1a_gravity_anomaly.py
1
13756
""" Least-Squares Inversion of Gravity Anomaly Data =============================================== Here we invert gravity anomaly data to recover a density contrast model. We formulate the inverse problem as a least-squares optimization problem. For this tutorial, we focus on the following: - Defining the survey...
mit
918819417f06315a0b769778d9d65ed0
30.916473
91
0.650262
3.366618
false
false
false
false
simpeg/simpeg
examples/_archived/plot_inv_mag_linear.py
1
9286
""" PF: Magnetic: Inversion Linear =============================== Create a synthetic block model and invert with a compact norm """ import matplotlib.pyplot as plt import numpy as np from discretize import TensorMesh from SimPEG.potential_fields import magnetics from SimPEG import utils from SimPEG import ( data...
mit
444ef0c6469e6bb330d0e019b7686e7f
28.762821
84
0.548029
3.260534
false
false
false
false
willmcgugan/rich
rich/constrain.py
10
1288
from typing import Optional, TYPE_CHECKING from .jupyter import JupyterMixin from .measure import Measurement if TYPE_CHECKING: from .console import Console, ConsoleOptions, RenderableType, RenderResult class Constrain(JupyterMixin): """Constrain the width of a renderable to a given number of characters. ...
mit
fd231a88af75e95206acb21c2b6dca45
33.810811
91
0.663043
3.938838
false
false
false
false
willmcgugan/rich
tests/test_panel.py
1
3666
import io from rich.console import Console from rich.measure import Measurement from rich.panel import Panel import pytest tests = [ Panel("Hello, World", padding=0), Panel("Hello, World", expand=False, padding=0), Panel.fit("Hello, World", padding=0), Panel("Hello, World", width=8, padding=0), Pa...
mit
e421d086efe7414f164057511207ddd5
38.15625
267
0.455706
2.691729
false
true
false
false
willmcgugan/rich
rich/prompt.py
1
11295
from typing import Any, Generic, List, Optional, TextIO, TypeVar, Union, overload from . import get_console from .console import Console from .text import Text, TextType PromptType = TypeVar("PromptType") DefaultType = TypeVar("DefaultType") class PromptError(Exception): """Exception base class for prompt relat...
mit
8d21394191891997156c50bd4f82cce9
29.039894
110
0.574945
4.332566
false
false
false
false
willmcgugan/rich
rich/progress_bar.py
6
7762
import math from functools import lru_cache from time import monotonic from typing import Iterable, List, Optional from .color import Color, blend_rgb from .color_triplet import ColorTriplet from .console import Console, ConsoleOptions, RenderResult from .jupyter import JupyterMixin from .measure import Measurement fr...
mit
e3ae1947d130c7b7a165f214e10626b2
34.898148
117
0.59479
4.036439
false
false
false
false
willmcgugan/rich
rich/align.py
1
10377
import sys from itertools import chain from typing import TYPE_CHECKING, Iterable, Optional if sys.version_info >= (3, 8): from typing import Literal else: from typing_extensions import Literal # pragma: no cover from .constrain import Constrain from .jupyter import JupyterMixin from .measure import Measurem...
mit
3f0dd2c91641fa93b794a83144b395c0
32.259615
139
0.548714
4.302239
false
false
false
false
willmcgugan/rich
examples/downloader.py
1
2274
""" A rudimentary URL downloader (like wget or curl) to demonstrate Rich progress bars. """ import os.path import sys from concurrent.futures import as_completed, ThreadPoolExecutor import signal from functools import partial from threading import Event from typing import Iterable from urllib.request import urlopen f...
mit
3711e138f9d91707dfba100e063cdb0b
27.35
87
0.645062
3.611465
false
false
false
false
chainer/chainercv
examples/ssd/train_multi.py
3
5849
import argparse import multiprocessing import numpy as np import chainer from chainer.optimizer_hooks import WeightDecay from chainer import serializers from chainer import training from chainer.training import extensions from chainer.training import triggers import chainermn from chainercv.chainer_experimental.data...
mit
fc5f1fe6c215a7bfaad5f367ba5b34bc
33.815476
109
0.65071
3.699557
false
false
false
false
chainer/chainercv
chainercv/links/model/ssd/normalize.py
3
1597
import numpy as np import chainer import chainer.functions as F from chainer import initializers from chainer import variable class Normalize(chainer.Link): """Learnable L2 normalization [#]_. This link normalizes input along the channel axis and scales it. The scale factors are trained channel-wise. ...
mit
6c6fd44da83c9e0154b5b244b5bd5c67
30.94
78
0.615529
4.032828
false
false
false
false
chainer/chainercv
chainercv/links/model/yolo/yolo_v2.py
3
8111
from __future__ import division import itertools import numpy as np import chainer from chainer.backends import cuda import chainer.functions as F from chainer.links import Convolution2D from chainercv.links import Conv2DBNActiv from chainercv import utils from chainercv.links.model.yolo.yolo_base import YOLOBase ...
mit
ea9c7ea524cddf77ae9391c88806605d
31.314741
87
0.538775
3.397989
false
false
false
false
chainer/chainercv
chainercv/utils/testing/generate_random_bbox.py
3
1261
import numpy as np def generate_random_bbox(n, img_size, min_length, max_length): """Generate valid bounding boxes with random position and shape. Args: n (int): The number of bounding boxes. img_size (tuple): A tuple of length 2. The height and the width of the image on which bou...
mit
3c4509b7ed77c35db636196d8828ed23
39.677419
76
0.598731
3.292428
false
false
false
false
lorien/grab
tests/spider_queue.py
1
6464
from unittest import TestCase import time from typing import Any import six from test_server import Response from grab.spider.queue_backend.base import QueueInterface from grab.spider import Spider, Task from grab.spider.error import SpiderMisuseError from tests.util import BaseGrabTestCase, build_spider from test_s...
mit
3d51b82f1b1319680743ffa2b4a8ded9
33.566845
82
0.610458
3.775701
false
true
false
false
chainer/chainercv
chainercv/datasets/coco/coco_semantic_segmentation_dataset.py
3
3175
import json import numpy as np import os from chainercv.chainer_experimental.datasets.sliceable import GetterDataset from chainercv.datasets.coco.coco_utils import get_coco from chainercv import utils def _rgb2id(color): return color[0] + 256 * color[1] + 256 * 256 * color[2] class COCOSemanticSegmentationData...
mit
3b7e2e8451b34e82aae46f5c4f098dc2
33.139785
76
0.590551
3.413978
false
false
false
false
chainer/chainercv
chainercv/links/model/senet/se_resnet.py
3
7004
from __future__ import division import numpy as np import chainer import chainer.functions as F from chainer import initializers import chainer.links as L from chainercv.links import Conv2DBNActiv from chainercv.links.model.resnet import ResBlock from chainercv.links import PickableSequentialChain from chainercv imp...
mit
43fa874a51ffc39f74ceb7acc932d604
34.734694
76
0.590234
3.745455
false
false
false
false
lorien/grab
tests/spider_task.py
1
15560
from weblib.error import ResponseNotValid from test_server import Response from grab import Grab from grab.spider import base from grab.spider import Spider, Task, SpiderMisuseError, NoTaskHandler from grab.spider.error import SpiderError from tests.util import BaseGrabTestCase, build_grab, build_spider class Simpl...
mit
a87bb75b47c74fd20a771bce6a4247ca
33.732143
87
0.578535
3.713604
false
true
false
false
chainer/chainercv
chainercv/links/model/light_head_rcnn/global_context_module.py
2
1136
from __future__ import division import chainer import chainer.functions as F import chainer.links as L class GlobalContextModule(chainer.Chain): def __init__( self, in_channels, mid_channels, out_channels, ksize, initialW=None ): super(GlobalContextModule, self).__init__() ...
mit
6739a3d0a8d0e6e315e9c0e012e59df1
33.424242
72
0.543134
3.561129
false
false
false
false
chainer/chainercv
tests/links_tests/model_tests/yolo_tests/test_yolo_v2.py
3
1959
import numpy as np import unittest import chainer from chainer import testing from chainer.testing import attr from chainercv.links import YOLOv2 @testing.parameterize(*testing.product({ 'n_fg_class': [1, 5, 20], })) class TestYOLOv2(unittest.TestCase): def setUp(self): self.link = YOLOv2(n_fg_clas...
mit
a7216279a908f77c8943f6024298ce82
25.472973
76
0.611536
3.29798
false
true
false
false
chainer/chainercv
chainercv/datasets/sbd/sbd_utils.py
3
2071
import filelock import os import six from chainer.dataset import download from chainercv.datasets.voc.voc_utils \ import voc_instance_segmentation_label_names from chainercv import utils root = 'pfnet/chainercv/sbd' url = 'http://www.eecs.berkeley.edu/Research/Projects/CS/vision/grouping/semantic_contours/benchm...
mit
417b77956191f58e8284957a94d22078
36.654545
113
0.66055
2.971306
false
false
false
false
chainer/chainercv
tests/functions_tests/test_ps_roi_max_pooling.py
3
6321
import chainer from chainer.backends import cuda import chainer.functions as F from chainer import gradient_check from chainer import testing from chainer.testing import attr from chainer.testing import condition import numpy as np import unittest from chainercv import functions def _outsize(x): if isinstance(x,...
mit
f1cb208736ef78a1e5b268ba4b2a2be8
34.116667
77
0.570321
3.083415
false
true
false
false
chainer/chainercv
examples/deeplab/tf2npz.py
3
8351
import argparse import chainer from chainercv.datasets import ade20k_semantic_segmentation_label_names from chainercv.datasets import cityscapes_semantic_segmentation_label_names from chainercv.datasets import voc_semantic_segmentation_label_names from chainercv.links import DeepLabV3plusXception65 import tensorflow...
mit
9301f5f379c09fe7f4681b9b7a179a4f
35.308696
77
0.558137
3.608902
false
false
false
false
chainer/chainercv
chainercv/transforms/image/random_sized_crop.py
3
5002
from __future__ import division import math import numpy as np import random def random_sized_crop(img, scale_ratio_range=(0.08, 1), aspect_ratio_range=(3 / 4, 4 / 3), return_param=False, copy=False): """Crop an image to random size and aspect rat...
mit
352f7b69de61a34831b716c264dfd51b
38.698413
79
0.577169
3.537482
false
false
false
false
chainer/chainercv
examples/faster_rcnn/train.py
3
5174
from __future__ import division import argparse import numpy as np import chainer from chainer.datasets import ConcatenatedDataset from chainer.datasets import TransformDataset from chainer import training from chainer.training import extensions from chainer.training.triggers import ManualScheduleTrigger from chaine...
mit
38e6297aa002ff445f71d3c0f1662bb4
34.930556
109
0.642636
3.563361
false
false
false
false
chainer/chainercv
chainercv/links/model/pixelwise_softmax_classifier.py
3
2173
import chainer from chainer.backends import cuda import chainer.functions as F from chainer import reporter import numpy as np class PixelwiseSoftmaxClassifier(chainer.Chain): """A pixel-wise classifier. It computes the loss based on a given input/label pair for semantic segmentation. Args: ...
mit
4e951ab15da7d03889c178883f8033bf
32.430769
75
0.630925
4.131179
false
false
false
false
chainer/chainercv
tests/evaluations_tests/test_eval_instance_segmentation_voc.py
3
6121
from __future__ import division import numpy as np import os from six.moves.urllib import request import unittest from chainer import testing from chainercv.evaluations import calc_instance_segmentation_voc_prec_rec from chainercv.evaluations import eval_instance_segmentation_voc @testing.parameterize(*( testi...
mit
460971b12fe25841d7c2187b1bd41d9e
28.147619
74
0.419539
3.869153
false
true
false
false
chainer/chainercv
tests/datasets_tests/test_siamese_dataset.py
3
4023
import unittest import numpy as np from chainer import testing from chainer.datasets import TupleDataset from chainercv.datasets import SiameseDataset from chainercv.utils.testing.assertions.assert_is_image import assert_is_image N = 15 @testing.parameterize( # Positive and negative samples {'labels_0': ...
mit
1aa7c56676f9ec6efa9c620cd5349453
34.60177
78
0.578921
3.547619
false
true
false
false
chainer/chainercv
chainercv/links/model/fpn/rpn.py
3
9962
from __future__ import division import numpy as np import chainer from chainer.backends import cuda import chainer.functions as F from chainer import initializers import chainer.links as L from chainercv.links.model.fpn.misc import argsort from chainercv.links.model.fpn.misc import choice from chainercv.links.model....
mit
a98293de04cec0395104489df56cf451
33.832168
79
0.4999
3.350824
false
false
false
false
chainer/chainercv
chainercv/links/model/vgg/vgg16.py
3
6078
from __future__ import division import numpy as np import chainer from chainer.functions import dropout from chainer.functions import max_pooling_2d from chainer.functions import relu from chainer.functions import softmax from chainer.initializers import constant from chainer.initializers import normal from chainer....
mit
0aed8515d8d4ac5ebdd8c537e4e81a21
39.251656
76
0.611056
3.641702
false
false
false
false
chainer/chainercv
chainercv/experimental/links/model/fcis/fcis_resnet101.py
3
16131
from __future__ import division import chainer import chainer.functions as F import chainer.links as L import numpy as np from chainercv.experimental.links.model.fcis import FCIS from chainercv.functions import ps_roi_average_pooling_2d from chainercv.links import Conv2DBNActiv from chainercv.links.model.faster_rcnn....
mit
d02274aa36074ba64d5af1236bf20aea
39.126866
79
0.591966
3.580688
false
false
false
false
chainer/chainercv
examples/fcis/train_coco_multi.py
3
7657
from __future__ import division import argparse import multiprocessing import numpy as np import chainer from chainer.training import extensions from chainer.training.triggers import ManualScheduleTrigger import chainermn from chainercv.chainer_experimental.datasets.sliceable \ import ConcatenatedDataset from ch...
mit
327700ce2cae9420ce1a60b2b9072c09
34.123853
109
0.648557
3.751592
false
false
false
false
chainer/chainercv
chainercv/experimental/links/model/fcis/utils/proposal_target_creator.py
3
7790
import numpy as np from chainer import cuda from chainercv.links.model.faster_rcnn.utils.bbox2loc import bbox2loc from chainercv.transforms.image.resize import resize from chainercv.utils.bbox.bbox_iou import bbox_iou class ProposalTargetCreator(object): """Assign ground truth classes, bounding boxes and masks ...
mit
1c167298b03a1066aa335a471833fb4c
40.216931
79
0.573813
3.47148
false
false
false
false
chainer/chainercv
chainercv/transforms/point/resize_point.py
3
1246
import numpy as np def resize_point(point, in_size, out_size): """Adapt point coordinates to the rescaled image space. Args: point (~numpy.ndarray or list of arrays): See the table below. in_size (tuple): A tuple of length 2. The height and the width of the image before resized. ...
mit
3b69fa46024b147d60abe1a9a9b7fbf1
31.789474
71
0.540128
3.441989
false
false
false
false
chainer/chainercv
chainercv/links/model/ssd/ssd.py
3
8502
from __future__ import division import numpy as np import chainer from chainercv.links.model.ssd import MultiboxCoder from chainercv import transforms class SSD(chainer.Chain): """Base class of Single Shot Multibox Detector. This is a base class of Single Shot Multibox Detector [#]_. .. [#] Wei Liu, ...
mit
fb22d3daa16824ebb0b01eeba70a194d
37.645455
79
0.579746
4.079655
false
false
false
false
chainer/chainercv
tests/links_tests/model_tests/ssd_tests/test_multibox_loss.py
3
7059
from __future__ import division import numpy as np import six import unittest import chainer from chainer.backends import cuda import chainer.functions as F from chainer import testing from chainermn import create_communicator from chainercv.links.model.ssd import multibox_loss from chainercv.utils.testing import at...
mit
54949b339a6989d07a58713e0a43194e
34.651515
79
0.567927
3.255996
false
true
false
false
chainer/chainercv
style_checker.py
3
4011
"""Coding style checker for ChainerCV This is a coding style checker used in ChainerCV. Usage: $ python style_checker.py [--exclude <file> [<file> ...]] <directory> This script checks the following coding rules. - Arguments of `ndarray.reshape`. If the target shape is 1-d array, it should be passed as an in...
mit
85581ad4dfd2e958e41e5dbd6b40ea9f
24.226415
75
0.551483
3.445876
false
false
false
false
sixty-north/cosmic-ray
src/cosmic_ray/operators/boolean_replacer.py
1
2657
"""Implementation of the boolean replacement operators. """ import parso.python.tree from .keyword_replacer import KeywordReplacementOperator from .operator import Example, Operator class ReplaceTrueWithFalse(KeywordReplacementOperator): """An that replaces True with False.""" from_keyword = "True" to_...
mit
12a78ef29707a6ff6e61b7986c423ffb
28.197802
102
0.619496
3.86754
false
false
false
false
spesmilo/electrum
electrum/plugins/safe_t/safe_t.py
1
19450
from binascii import hexlify, unhexlify import traceback import sys from typing import NamedTuple, Any, Optional, Dict, Union, List, Tuple, TYPE_CHECKING from electrum.util import bfh, bh2u, versiontuple, UserCancelled, UserFacingException from electrum.bip32 import BIP32Node from electrum import constants from electr...
mit
2a83dd7ebfaa408b3a65a8fdbd0f2e48
41.282609
122
0.593008
3.900923
false
false
false
false
spesmilo/electrum
electrum/gui/kivy/nfc_scanner/scanner_android.py
1
8392
'''This is the Android implementation of NFC Scanning using the built in NFC adapter of some android phones. ''' from kivy.app import App from kivy.clock import Clock #Detect which platform we are on from kivy.utils import platform if platform != 'android': raise ImportError import threading from . import NFCBase...
mit
0d42be0159e2f80040797f9bfdbe34b4
33.677686
101
0.613799
4.040443
false
false
false
false
spesmilo/electrum
electrum/gui/kivy/uix/gridview.py
41
6337
from kivy.uix.boxlayout import BoxLayout from kivy.adapters.dictadapter import DictAdapter from kivy.adapters.listadapter import ListAdapter from kivy.properties import ObjectProperty, ListProperty, AliasProperty from kivy.uix.listview import (ListItemButton, ListItemLabel, CompositeListItem, ...
mit
388c8429d94db5cbfade1ee5e9981a20
29.912195
97
0.492978
4.412953
false
false
false
false
spesmilo/electrum
electrum/gui/qt/paytoedit.py
1
12596
#!/usr/bin/env python # # Electrum - lightweight Bitcoin client # Copyright (C) 2012 thomasv@gitorious # # 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 witho...
mit
c7ad9cdb06bf305d2a1f21ee08527aea
34.184358
96
0.601302
4.010188
false
false
false
false
spesmilo/electrum
electrum/gui/qml/qetypes.py
1
3809
from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject from electrum.logging import get_logger from electrum.i18n import _ # container for satoshi amounts that can be passed around more # easily between python, QML-property and QML-javascript contexts # QML 'int' is 32 bit signed, so overflows on satosh...
mit
08b258c8035d0c0de02b042c2ef33bbd
35.27619
134
0.62116
3.6625
false
false
false
false
spesmilo/electrum
electrum/gui/kivy/uix/dialogs/lightning_tx_dialog.py
1
4064
import copy from datetime import datetime from decimal import Decimal from typing import NamedTuple, Callable, TYPE_CHECKING from kivy.app import App from kivy.factory import Factory from kivy.properties import ObjectProperty from kivy.lang import Builder from kivy.clock import Clock from kivy.uix.label import Label f...
mit
90daed892c1a402e413484e955fe9c38
31.253968
88
0.517224
4.369892
false
false
false
false
spesmilo/electrum
electrum/tests/test_blockchain.py
1
29212
import shutil import tempfile import os from electrum import constants, blockchain from electrum.simple_config import SimpleConfig from electrum.blockchain import Blockchain, deserialize_header, hash_header from electrum.util import bh2u, bfh, make_dir from . import ElectrumTestCase class TestBlockchain(ElectrumTes...
mit
21ba496e2bcddd1afbbfdcc99dc0caa1
62.504348
219
0.700466
2.981729
false
false
false
false
spesmilo/electrum
electrum/gui/qt/installwizard.py
1
32943
# Copyright (C) 2018 The Electrum developers # Distributed under the MIT software license, see the accompanying # file LICENCE or http://www.opensource.org/licenses/mit-license.php import os import json import sys import threading import traceback from typing import Tuple, List, Callable, NamedTuple, Optional, TYPE_CH...
mit
c6e60827a307366f1a39d5fca5b10d52
40.333752
151
0.564429
4.062523
false
false
false
false
spesmilo/electrum
electrum/gui/qt/qrcodewidget.py
1
5413
from typing import Optional import qrcode from PyQt5.QtGui import QColor, QPen import PyQt5.QtGui as QtGui from PyQt5.QtCore import Qt, QRect from PyQt5.QtWidgets import ( QApplication, QVBoxLayout, QTextEdit, QHBoxLayout, QPushButton, QWidget, QFileDialog, ) from electrum.i18n import _ from electrum.simple_...
mit
d342b1eac5fa6ec16837ed3873540c54
28.418478
104
0.535193
3.803935
false
false
false
false
kivy/pyjnius
jnius/env.py
1
11443
''' This module determine and expose various information about the java environment. ''' import sys from os.path import join, exists, dirname, realpath from os import getenv from platform import machine from subprocess import Popen, check_output, PIPE from shlex import split from logging import getLogger from textwrap...
mit
c09b3f8b0d7019b84631049766cf9950
29.272487
99
0.575548
3.799137
false
false
false
false
kivy/pyjnius
jnius_config.py
1
2470
__all__ = ('set_options', 'add_options', 'get_options', 'set_classpath', 'add_classpath', 'get_classpath', 'expand_classpath') import platform if platform.system() == 'Windows': split_char = ';' else: split_char = ':' vm_running = False vm_started_at = None options = [] classpath = None ...
mit
9c1b57a91ba43d64226ff7e08e9cda54
24.729167
122
0.650607
3.977456
false
false
false
false
webcomics/dosage
dosagelib/plugins/petitesymphony.py
1
1910
# SPDX-License-Identifier: MIT # Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam # Copyright (C) 2015-2020 Tobias Gruetzmacher # Copyright (C) 2019-2020 Daniel Ring from .common import WordPressScraper, WordPressNavi class PetiteSymphony(WordPressNavi): m...
mit
0c06734fc0c8611a61168fe004b39095
33.727273
70
0.58377
3.570093
false
false
false
false
kivy/pyjnius
jnius/reflect.py
1
17438
from __future__ import absolute_import from __future__ import unicode_literals from __future__ import division from collections import defaultdict from logging import getLogger, DEBUG from .jnius import ( JavaClass, MetaJavaClass, JavaMethod, JavaStaticMethod, JavaField, JavaStaticField, JavaMultipleMethod, f...
mit
3171b6f85af36a7340822b32c5093310
39.648019
124
0.621344
3.832527
false
false
false
false
webcomics/dosage
dosagelib/plugins/rhjunior.py
1
1469
# SPDX-License-Identifier: MIT # Copyright (C) 2019-2022 Tobias Gruetzmacher # Copyright (C) 2019-2020 Daniel Ring from ..scraper import ParserScraper class RHJunior(ParserScraper): stripUrl = 'https://www.rhjunior.com/%s/' imageSearch = '//div[contains(@class, "entry-content")]//img' multipleImagesPerStr...
mit
4cb12503caeb865f2e3f7a2a30b33fdc
38.702703
83
0.559564
3.286353
false
false
false
false
webcomics/dosage
dosagelib/util.py
1
14832
# SPDX-License-Identifier: MIT # Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam # Copyright (C) 2015-2020 Tobias Gruetzmacher import html import os import re import subprocess import sys import time import traceback from functools import lru_cache from urllib...
mit
f0c4e37a30820379a21d13e5f47a6b4c
29.581443
79
0.618325
3.665843
false
false
false
false
kivy/pyjnius
docs/source/conf.py
2
7806
# -*- coding: utf-8 -*- # # Pyjnius documentation build configuration file, created by # sphinx-quickstart on Thu Aug 16 11:38:14 2012. # # 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
690b5cadc1ce995aea33b5ce21e10258
31.256198
96
0.705483
3.760116
false
true
false
false
kivy/pyjnius
tests/test_dir.py
1
2774
from __future__ import print_function from __future__ import division from __future__ import absolute_import import unittest from jnius.reflect import autoclass class DirTest(unittest.TestCase): def test_varargs_signatures(self): # >>> from jnius import autoclass # >>> cls = autoclass('java.lang.S...
mit
9c72e7687801251b6f4f4cbb494a053e
38.070423
113
0.549387
3.718499
false
true
false
false
sendgrid/sendgrid-python
sendgrid/helpers/mail/exceptions.py
2
1831
################################################################ # Various types of extensible Twilio SendGrid related exceptions ################################################################ class SendGridException(Exception): """Wrapper/default SendGrid-related exception""" pass class ApiKeyIncludedExc...
mit
349bafddd44ab6a012c9fa1da8079b6e
27.169231
88
0.568542
5.41716
false
false
false
false
sendgrid/sendgrid-python
sendgrid/helpers/mail/bypass_list_management.py
2
1401
class BypassListManagement(object): """Setting for Bypass List Management Allows you to bypass all unsubscribe groups and suppressions to ensure that the email is delivered to every single recipient. This should only be used in emergencies when it is absolutely necessary that every recipient receiv...
mit
e3d786f3460ff42256414bf63e497667
28.1875
79
0.624554
4.765306
false
false
false
false
sendgrid/sendgrid-python
examples/subusers/subusers.py
1
5310
import sendgrid import os sg = sendgrid.SendGridAPIClient(os.environ.get('SENDGRID_API_KEY')) ################################################## # Create Subuser # # POST /subusers # data = { "email": "John@example.com", "ips": [ "1.1.1.1", "2.2.2.2" ], "password": "johns_password", ...
mit
c64c6d9f9feabb2f92de1079aa379608
27.095238
77
0.596045
3.425806
false
true
false
false
sendgrid/sendgrid-python
sendgrid/helpers/mail/bcc_settings.py
2
1929
class BccSettings(object): """Settings object for automatic BCC. This allows you to have a blind carbon copy automatically sent to the specified email address for every email that is sent. """ def __init__(self, enable=None, email=None): """Create a BCCSettings. :param enable: Whe...
mit
39e0a1f510cb07c959ef3d51ded409f3
25.791667
79
0.582685
4.424312
false
false
false
false
mrkipling/maraschino
lib/sqlalchemy/dialects/postgresql/pg8000.py
22
3801
# postgresql/pg8000.py # Copyright (C) 2005-2011 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 """Support for the PostgreSQL database via the pg8000 driver. Connecting -------...
mit
e4eeabd27c5e55eed41b474c555fda97
30.413223
98
0.646672
4.2
false
false
false
false
california-civic-data-coalition/django-calaccess-campaign-browser
calaccess_campaign_browser/management/commands/loadcalaccesscampaignsummaries.py
3
4738
import os import csv import MySQLdb import warnings from django.db import connection from calaccess_raw import get_download_directory from django.utils.datastructures import SortedDict from calaccess_campaign_browser.models import Summary from calaccess_campaign_browser.management.commands import CalAccessCommand cla...
mit
148e7bf44237d5e628018b69cd92b946
36.603175
75
0.527649
3.836437
false
false
false
false
mrkipling/maraschino
lib/werkzeug/debug/__init__.py
81
7867
# -*- coding: utf-8 -*- """ werkzeug.debug ~~~~~~~~~~~~~~ WSGI application traceback debugger. :copyright: (c) 2011 by the Werkzeug Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ import mimetypes from os.path import join, dirname, basename, isfile from werkzeu...
mit
e21b3c82bb069fb8758bbd04782601b0
41.524324
78
0.581797
4.565873
false
false
false
false
mrkipling/maraschino
lib/sqlalchemy/orm/sync.py
22
4874
# orm/sync.py # Copyright (C) 2005-2011 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 """private module containing functions used for copying data between instances based on j...
mit
8b6532c6ffebb13200f00a98f4d55b26
44.551402
97
0.57858
4.134012
false
false
false
false
california-civic-data-coalition/django-calaccess-campaign-browser
calaccess_campaign_browser/models/elections.py
3
5064
from django.db import models from calaccess_campaign_browser.utils.models import BaseModel class Election(BaseModel): """ A grouping of election contests administered by the state. """ ELECTION_TYPE_CHOICES = ( ("GENERAL", "General"), ("PRIMARY", "Primary"), ("RECALL", "Recall"...
mit
166599063c43789acddc1e675ae75373
27.290503
76
0.597749
3.848024
false
false
false
false
mrkipling/maraschino
lib/werkzeug/contrib/sessions.py
77
12307
# -*- coding: utf-8 -*- r""" werkzeug.contrib.sessions ~~~~~~~~~~~~~~~~~~~~~~~~~ This module contains some helper classes that help one to add session support to a python WSGI application. For full client-side session storage see :mod:`~werkzeug.contrib.securecookie` which implements a secure,...
mit
dcf93d74742d912e909bac35ca2cd85f
34.776163
78
0.603153
4.434955
false
false
false
false
california-civic-data-coalition/django-calaccess-campaign-browser
calaccess_campaign_browser/urls.py
3
2844
from django.conf.urls import patterns, include, url from tastypie.api import Api from django.views.generic.base import RedirectView from calaccess_campaign_browser.api import FilerResource, FilingResource from calaccess_campaign_browser import views from calaccess_campaign_browser.views import search from django.views....
mit
7ba7e8bb8da4f6257cc1a8e717f1afcb
26.882353
72
0.577004
3.334115
false
false
false
false
mrkipling/maraschino
lib/jinja2/exceptions.py
398
4530
# -*- coding: utf-8 -*- """ jinja2.exceptions ~~~~~~~~~~~~~~~~~ Jinja exceptions. :copyright: (c) 2010 by the Jinja Team. :license: BSD, see LICENSE for more details. """ class TemplateError(Exception): """Baseclass for all template errors.""" def __init__(self, message=None): i...
mit
73acc73e1d51ce721005d815a99e14b7
30.678322
77
0.625386
4.476285
false
false
false
false
mrkipling/maraschino
lib/weatherfeed/weatherfeed.py
3
9652
#!/usr/bin/env python # $HeadURL: http://opensource.hld.ca/svn/trunk/ctw/weatherfeed.py $ # $Id: weatherfeed.py 315 2009-07-14 12:17:40Z dan $ # vim: ft=python ts=2 sw=2 et: # Copyright Dan Cardamore <dan@hld.ca> # Licensed under the GNU GPL version 2.0 # See GPL.gz in source distribution for more information # Reads...
mit
1124b04cd51edafc810667dafa8b241b
33.348754
133
0.586718
3.931568
false
false
false
false