hexsha stringlengths 40 40 | size int64 2 1.02M | ext stringclasses 10
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 6 130 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 245 | max_issues_repo_name stringlengths 6 130 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 245 | max_forks_repo_name stringlengths 6 130 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 2 1.02M | avg_line_length float64 1 958k | max_line_length int64 1 987k | alphanum_fraction float64 0 1 | content_no_comment stringlengths 0 1.01M | is_comment_constant_removed bool 2
classes | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f7770d926367a9dbe75ca2b60048889df8b24e2d | 4,371 | py | Python | object_branch/benchmark/suncg/evaluate_detection.py | JasonQSY/Associative3D | c50818b593ec48c38ed7ee3e109c23531089da32 | [
"MIT"
] | 25 | 2020-08-26T02:41:12.000Z | 2021-09-30T21:50:36.000Z | object_branch/benchmark/suncg/evaluate_detection.py | JasonQSY/Associative3D | c50818b593ec48c38ed7ee3e109c23531089da32 | [
"MIT"
] | null | null | null | object_branch/benchmark/suncg/evaluate_detection.py | JasonQSY/Associative3D | c50818b593ec48c38ed7ee3e109c23531089da32 | [
"MIT"
] | 1 | 2020-11-17T15:25:26.000Z | 2020-11-17T15:25:26.000Z | # ---------------------------------------------------------
# Copyright (c) 2015, Saurabh Gupta
#
# Licensed under The MIT License [see LICENSE for details]
# ---------------------------------------------------------
from ...utils import bbox_utils
import numpy as np
def inst_bench_image(dt, gt, bOpts, overlap = None)... | 35.827869 | 107 | 0.5779 | from ...utils import bbox_utils
import numpy as np
def inst_bench_image(dt, gt, bOpts, overlap = None):
nDt = len(dt['sc'])
nGt = len(gt['diff'])
numInst = np.sum(gt['diff'] == False)
if overlap is None:
overlap = bbox_utils.bbox_overlaps(dt['boxInfo'].astype(np.float), gt['boxInfo'].astype(np.float))
... | true | true |
f7770dc06e1bbd755400507967abdfed0f5d790d | 373 | py | Python | pyprobml-master/examples/betaCredibleInt.py | storopoli/Machine-Learning-Probalistic | f8617e7b81f4d6c71e72edc40ba11ac746794a95 | [
"MIT"
] | 1 | 2019-03-04T05:43:10.000Z | 2019-03-04T05:43:10.000Z | examples/betaCredibleInt.py | tungk/pyprobml | fb939b92a61f7d3a7e6c28d0b14f58d99a0b07f1 | [
"MIT"
] | null | null | null | examples/betaCredibleInt.py | tungk/pyprobml | fb939b92a61f7d3a7e6c28d0b14f58d99a0b07f1 | [
"MIT"
] | null | null | null | from scipy.stats import beta
import numpy as np
S = 47
N = 100
a = S+1
b = (N-S)+1
alpha = 0.05;
CI1 = beta.interval(1-alpha, a, b)
l = beta.ppf(alpha/2, a, b)
u = beta.ppf(1-alpha/2, a, b)
CI2 = (l,u)
samples = beta.rvs(a, b, size=1000)
samples = np.sort(samples)
CI3 = np.percentile(samples, 100*np.array([alph... | 16.217391 | 65 | 0.630027 | from scipy.stats import beta
import numpy as np
S = 47
N = 100
a = S+1
b = (N-S)+1
alpha = 0.05;
CI1 = beta.interval(1-alpha, a, b)
l = beta.ppf(alpha/2, a, b)
u = beta.ppf(1-alpha/2, a, b)
CI2 = (l,u)
samples = beta.rvs(a, b, size=1000)
samples = np.sort(samples)
CI3 = np.percentile(samples, 100*np.array([alph... | true | true |
f7770e33d3675a81d953dbb7b61c1d766ea0de66 | 3,031 | py | Python | src/toil/test/src/jobWrapperTest.py | adamnovak/toil | 3a81f1114ec7f347e6e7bfd861073d897a9188ec | [
"Apache-2.0"
] | null | null | null | src/toil/test/src/jobWrapperTest.py | adamnovak/toil | 3a81f1114ec7f347e6e7bfd861073d897a9188ec | [
"Apache-2.0"
] | null | null | null | src/toil/test/src/jobWrapperTest.py | adamnovak/toil | 3a81f1114ec7f347e6e7bfd861073d897a9188ec | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# Copyright (C) 2015 UCSC Computational Genomics Lab
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | 34.83908 | 86 | 0.670736 |
from __future__ import absolute_import
import unittest
import os
from toil.lib.bioio import system
from argparse import ArgumentParser
from toil.common import setupToil
from toil.job import Job
from toil.test import ToilTest
from toil.jobWrapper import JobWrapper
class JobWrapperTest(ToilTest):
def setUp(se... | true | true |
f7770e4a22fabc7cf4c66986031bc796f3783716 | 4,626 | py | Python | students/k3343/laboratory_works/Suzdaltseva_Margarita/laboratory_work_2/marketing/luchapp/views.py | TonikX/ITMO_ICT_-WebProgramming_2020 | ba566c1b3ab04585665c69860b713741906935a0 | [
"MIT"
] | 10 | 2020-03-20T09:06:12.000Z | 2021-07-27T13:06:02.000Z | students/k3343/laboratory_works/Suzdaltseva_Margarita/laboratory_work_2/marketing/luchapp/views.py | TonikX/ITMO_ICT_-WebProgramming_2020 | ba566c1b3ab04585665c69860b713741906935a0 | [
"MIT"
] | 134 | 2020-03-23T09:47:48.000Z | 2022-03-12T01:05:19.000Z | students/k3343/laboratory_works/Suzdaltseva_Margarita/laboratory_work_2/marketing/luchapp/views.py | TonikX/ITMO_ICT_-WebProgramming_2020 | ba566c1b3ab04585665c69860b713741906935a0 | [
"MIT"
] | 71 | 2020-03-20T12:45:56.000Z | 2021-10-31T19:22:25.000Z | from django.shortcuts import render
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework import generics
from django.db.models import Q
from django.contrib.auth import get_user_model
from .serializers import *
from .models import *
# Requests
class CreateRequestVie... | 28.732919 | 105 | 0.699524 | from django.shortcuts import render
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework import generics
from django.db.models import Q
from django.contrib.auth import get_user_model
from .serializers import *
from .models import *
class CreateRequestView(generics.... | true | true |
f7770e7f3e425a74a82eab5369cd9b55f1bfab7b | 3,559 | py | Python | initial.py | YasuShimizu/1D-Free-Water-Surface | 38a86e167b43ebe46187aa6e781a93414136235f | [
"MIT"
] | null | null | null | initial.py | YasuShimizu/1D-Free-Water-Surface | 38a86e167b43ebe46187aa6e781a93414136235f | [
"MIT"
] | null | null | null | initial.py | YasuShimizu/1D-Free-Water-Surface | 38a86e167b43ebe46187aa6e781a93414136235f | [
"MIT"
] | null | null | null | import numpy as np
def eta_init(eta,eta0,eta_up,eta_up0,nx,dx, \
slope,xl,xb1,xb2,xb3,dbed):
zb0=xl*slope
for i in np.arange(0,nx+2):
xx=dx*float(i)
eta_up[i]=zb0-xx*slope
eta_up0[i]=eta_up[i]
# print(i,nx,eta_up[i])
if xx>xb1 and xx<xb2:
ss=xx-... | 26.962121 | 56 | 0.514751 | import numpy as np
def eta_init(eta,eta0,eta_up,eta_up0,nx,dx, \
slope,xl,xb1,xb2,xb3,dbed):
zb0=xl*slope
for i in np.arange(0,nx+2):
xx=dx*float(i)
eta_up[i]=zb0-xx*slope
eta_up0[i]=eta_up[i]
if xx>xb1 and xx<xb2:
ss=xx-xb1
deta=dbed*ss/(x... | true | true |
f7770ee1550a41e7863844e6343b675f6aec166a | 5,917 | py | Python | karp/tests/unit/test_resource_handlers.py | spraakbanken/karp-backend-v6-tmp | e5b78157bd999df18c188973ae2a337015b6f35d | [
"MIT"
] | 1 | 2021-12-08T15:33:42.000Z | 2021-12-08T15:33:42.000Z | karp/tests/unit/test_resource_handlers.py | spraakbanken/karp-backend-v6-tmp | e5b78157bd999df18c188973ae2a337015b6f35d | [
"MIT"
] | null | null | null | karp/tests/unit/test_resource_handlers.py | spraakbanken/karp-backend-v6-tmp | e5b78157bd999df18c188973ae2a337015b6f35d | [
"MIT"
] | null | null | null | import pytest
from .adapters import bootstrap_test_app
from karp.services import messagebus
from karp.domain import events, errors, commands
from karp.utility.unique_id import make_unique_id
class TestCreateResource:
def test_create_resource(self):
bus = bootstrap_test_app()
id_ = make_unique_id(... | 33.055866 | 79 | 0.5687 | import pytest
from .adapters import bootstrap_test_app
from karp.services import messagebus
from karp.domain import events, errors, commands
from karp.utility.unique_id import make_unique_id
class TestCreateResource:
def test_create_resource(self):
bus = bootstrap_test_app()
id_ = make_unique_id(... | true | true |
f7770f175a80af4e8118bd6692523fb8d85db3c5 | 163 | py | Python | tests/model_control/detailed/transf_None/model_control_one_enabled_None_Lag1Trend_Seasonal_WeekOfYear_NoAR.py | jmabry/pyaf | afbc15a851a2445a7824bf255af612dc429265af | [
"BSD-3-Clause"
] | null | null | null | tests/model_control/detailed/transf_None/model_control_one_enabled_None_Lag1Trend_Seasonal_WeekOfYear_NoAR.py | jmabry/pyaf | afbc15a851a2445a7824bf255af612dc429265af | [
"BSD-3-Clause"
] | 1 | 2019-11-30T23:39:38.000Z | 2019-12-01T04:34:35.000Z | tests/model_control/detailed/transf_None/model_control_one_enabled_None_Lag1Trend_Seasonal_WeekOfYear_NoAR.py | jmabry/pyaf | afbc15a851a2445a7824bf255af612dc429265af | [
"BSD-3-Clause"
] | null | null | null | import pyaf.tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['None'] , ['Lag1Trend'] , ['Seasonal_WeekOfYear'] , ['NoAR'] ); | 40.75 | 85 | 0.754601 | import pyaf.tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['None'] , ['Lag1Trend'] , ['Seasonal_WeekOfYear'] , ['NoAR'] ); | true | true |
f777105743815ca2bffc1b5b01cfb3eb49de4b1c | 4,582 | py | Python | app/http/controllers/Component.py | josephmancuso/wire | 0167d854c7acf62c3c19f350d53b7f30dad0170c | [
"MIT"
] | 1 | 2020-09-15T15:29:48.000Z | 2020-09-15T15:29:48.000Z | app/http/controllers/Component.py | josephmancuso/wire | 0167d854c7acf62c3c19f350d53b7f30dad0170c | [
"MIT"
] | null | null | null | app/http/controllers/Component.py | josephmancuso/wire | 0167d854c7acf62c3c19f350d53b7f30dad0170c | [
"MIT"
] | null | null | null | from masonite.request import Request
from masonite.view import View
from masonite.controllers import Controller
from jinja2 import Markup
import json
import copy
class Component:
def __init__(self, request: Request, view: View):
"""LivewireController Initializer
Arguments:
request {m... | 38.183333 | 106 | 0.520079 | from masonite.request import Request
from masonite.view import View
from masonite.controllers import Controller
from jinja2 import Markup
import json
import copy
class Component:
def __init__(self, request: Request, view: View):
self.request = request
self.view = view
self.props = self.re... | true | true |
f777118d837849219af594bbf1d5002b92d3bcaf | 2,251 | py | Python | Lib/site-packages/Cryptodome/Hash/__init__.py | Kronos3/pyexec | c9e76a0302dee047ed137bc38aa669cec04c24cd | [
"bzip2-1.0.6"
] | 2,557 | 2016-07-19T22:20:45.000Z | 2022-01-25T10:53:35.000Z | Lib/site-packages/Cryptodome/Hash/__init__.py | Kronos3/pyexec | c9e76a0302dee047ed137bc38aa669cec04c24cd | [
"bzip2-1.0.6"
] | 1,360 | 2016-07-20T02:06:42.000Z | 2021-07-27T12:46:40.000Z | Lib/site-packages/Cryptodome/Hash/__init__.py | Kronos3/pyexec | c9e76a0302dee047ed137bc38aa669cec04c24cd | [
"bzip2-1.0.6"
] | 607 | 2016-07-20T03:34:04.000Z | 2022-01-05T14:57:09.000Z | # -*- coding: utf-8 -*-
#
# ===================================================================
# The contents of this file are dedicated to the public domain. To
# the extent that dedication to the public domain is not available,
# everyone is granted a worldwide, perpetual, royalty-free,
# non-exclusive license to e... | 45.938776 | 87 | 0.713461 |
__all__ = ['HMAC', 'MD2', 'MD4', 'MD5', 'RIPEMD160', 'SHA1',
'SHA224', 'SHA256', 'SHA384', 'SHA512', 'CMAC']
| true | true |
f77711d41ebbd9a24fefca6eef061b3cedeaf9c5 | 4,797 | py | Python | docs/conf.py | CarveSystems/usbq | 2accfa010b785721c0ba0199dae8e02d982114be | [
"MIT"
] | 63 | 2019-08-14T13:16:30.000Z | 2022-02-25T01:56:23.000Z | docs/conf.py | CarveSystems/usbq | 2accfa010b785721c0ba0199dae8e02d982114be | [
"MIT"
] | 4 | 2019-12-03T20:01:44.000Z | 2022-01-01T08:56:35.000Z | docs/conf.py | CarveSystems/usbq | 2accfa010b785721c0ba0199dae8e02d982114be | [
"MIT"
] | 7 | 2020-01-09T11:10:14.000Z | 2021-12-21T13:58:43.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# usbq documentation build configuration file, created by
# sphinx-quickstart on Fri Jun 9 13:47:02 2017.
#
# 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
# autoge... | 30.75 | 83 | 0.681259 |
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
import usbq
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode']
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = u'USBiquitous'
copyright = u"2018, Brad Dixon"
author = u"Brad Dixon"
# for |version| and... | true | true |
f777132f21a53bf1da52a4b9a7b45ec68207e7ba | 12,698 | py | Python | hummingbot/client/hummingbot_application.py | withshubh/hummingbot | 8af7b6b6a4d482c8418f293f1ebd4d0d6a86eff5 | [
"Apache-2.0"
] | 4 | 2021-11-04T19:57:24.000Z | 2022-02-27T02:31:50.000Z | hummingbot/client/hummingbot_application.py | svamol/hummingbot | 03c6ab488cca620f622c432a5a09a40cd854e475 | [
"Apache-2.0"
] | 1 | 2021-04-10T05:57:09.000Z | 2021-04-10T05:57:09.000Z | hummingbot/client/hummingbot_application.py | svamol/hummingbot | 03c6ab488cca620f622c432a5a09a40cd854e475 | [
"Apache-2.0"
] | 17 | 2021-04-07T21:29:46.000Z | 2022-02-03T02:01:04.000Z | #!/usr/bin/env python
import asyncio
from collections import deque
import logging
import time
from typing import List, Dict, Optional, Tuple, Set, Deque
from hummingbot.client.command import __all__ as commands
from hummingbot.core.clock import Clock
from hummingbot.logger import HummingbotLogger
from hummingbot.logg... | 45.841155 | 154 | 0.679477 |
import asyncio
from collections import deque
import logging
import time
from typing import List, Dict, Optional, Tuple, Set, Deque
from hummingbot.client.command import __all__ as commands
from hummingbot.core.clock import Clock
from hummingbot.logger import HummingbotLogger
from hummingbot.logger.application_warning... | true | true |
f77713e284413b2891165ddd90edc60b67cf725b | 66,167 | py | Python | src/sage/homology/delta_complex.py | bopopescu/classic_diff_geom | 2b1d88becbc8cb30962e0995cc78e429e0f5589f | [
"BSL-1.0"
] | null | null | null | src/sage/homology/delta_complex.py | bopopescu/classic_diff_geom | 2b1d88becbc8cb30962e0995cc78e429e0f5589f | [
"BSL-1.0"
] | null | null | null | src/sage/homology/delta_complex.py | bopopescu/classic_diff_geom | 2b1d88becbc8cb30962e0995cc78e429e0f5589f | [
"BSL-1.0"
] | 1 | 2020-07-24T12:08:30.000Z | 2020-07-24T12:08:30.000Z | r"""
Finite Delta-complexes
AUTHORS:
- John H. Palmieri (2009-08)
This module implements the basic structure of finite
`\Delta`-complexes. For full mathematical details, see Hatcher [Hat]_,
especially Section 2.1 and the Appendix on "Simplicial CW Structures".
As Hatcher points out, `\Delta`-complexes were first in... | 41.328545 | 168 | 0.541826 |
from copy import copy
from sage.homology.cell_complex import GenericCellComplex
from sage.rings.integer_ring import ZZ
from sage.rings.integer import Integer
from sage.matrix.constructor import matrix
from sage.homology.simplicial_complex import Simplex, lattice_paths, SimplicialComplex
from sage.homology.chain_comple... | true | true |
f777143f32f6a47a4c42934a405170097f866567 | 1,003 | py | Python | toolchain/riscv/MSYS/python/Lib/idlelib/zzdummy.py | zhiqiang-hu/bl_iot_sdk | 154ee677a8cc6a73e6a42a5ff12a8edc71e6d15d | [
"Apache-2.0"
] | 207 | 2018-10-01T08:53:01.000Z | 2022-03-14T12:15:54.000Z | Thonny/Lib/idlelib/zzdummy.py | Pydiderot/pydiderotIDE | a42fcde3ea837ae40c957469f5d87427e8ce46d3 | [
"MIT"
] | 30 | 2019-01-04T10:14:56.000Z | 2020-10-12T14:00:31.000Z | Thonny/Lib/idlelib/zzdummy.py | Pydiderot/pydiderotIDE | a42fcde3ea837ae40c957469f5d87427e8ce46d3 | [
"MIT"
] | 76 | 2020-03-16T01:47:46.000Z | 2022-03-21T16:37:07.000Z | "Example extension, also used for testing."
from idlelib.config import idleConf
ztext = idleConf.GetOption('extensions', 'ZzDummy', 'z-text')
class ZzDummy:
## menudefs = [
## ('format', [
## ('Z in', '<<z-in>>'),
## ('Z out', '<<z-out>>'),
## ] )
## ]
... | 23.325581 | 74 | 0.526421 |
from idlelib.config import idleConf
ztext = idleConf.GetOption('extensions', 'ZzDummy', 'z-text')
class ZzDummy:
def __init__(self, editwin):
self.text = editwin.text
z_in = False
@classmethod
def reload(cls):
cls.ztext = idleConf.GetOption('extensions', 'ZzDumm... | true | true |
f77716c8c2b3c7be7acc944045b8d1d58ae30148 | 13,481 | py | Python | tests/unit/local/lambdafn/test_runtime.py | langn/aws-sam-cli | 160d87ff3c07f092315e1ac71ddc00257fde011b | [
"Apache-2.0"
] | null | null | null | tests/unit/local/lambdafn/test_runtime.py | langn/aws-sam-cli | 160d87ff3c07f092315e1ac71ddc00257fde011b | [
"Apache-2.0"
] | 1 | 2018-05-23T19:51:18.000Z | 2018-05-23T19:51:18.000Z | tests/unit/local/lambdafn/test_runtime.py | langn/aws-sam-cli | 160d87ff3c07f092315e1ac71ddc00257fde011b | [
"Apache-2.0"
] | null | null | null | """
Unit tests for Lambda runtime
"""
from unittest import TestCase
from mock import Mock, patch, MagicMock, ANY
from parameterized import parameterized
from samcli.local.lambdafn.runtime import LambdaRuntime, _unzip_file
from samcli.local.lambdafn.config import FunctionConfig
class LambdaRuntime_invoke(TestCase):
... | 37.551532 | 110 | 0.661153 |
from unittest import TestCase
from mock import Mock, patch, MagicMock, ANY
from parameterized import parameterized
from samcli.local.lambdafn.runtime import LambdaRuntime, _unzip_file
from samcli.local.lambdafn.config import FunctionConfig
class LambdaRuntime_invoke(TestCase):
DEFAULT_MEMORY = 128
DEFAULT_... | true | true |
f777181331537c10fcc4ae7ea0718d756fe069d8 | 7,937 | py | Python | test/functional/rpc_getblockstats.py | barrystyle/nyc3 | 43a15d192e23602d2d5d97d458efbc1cb7a4da7d | [
"MIT"
] | 1 | 2019-06-06T22:44:39.000Z | 2019-06-06T22:44:39.000Z | test/functional/rpc_getblockstats.py | barrystyle/nyc3 | 43a15d192e23602d2d5d97d458efbc1cb7a4da7d | [
"MIT"
] | null | null | null | test/functional/rpc_getblockstats.py | barrystyle/nyc3 | 43a15d192e23602d2d5d97d458efbc1cb7a4da7d | [
"MIT"
] | 3 | 2019-06-05T22:50:07.000Z | 2021-04-19T22:59:55.000Z | #!/usr/bin/env python3
# Copyright (c) 2017-2018 The NYC3 Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test getblockstats rpc call
#
from test_framework.test_framework import NYC3TestFramework
from test_fram... | 42.218085 | 130 | 0.622905 |
from test_framework.test_framework import NYC3TestFramework
from test_framework.util import (
assert_equal,
assert_raises_rpc_error,
)
import json
import os
import time
TESTSDIR = os.path.dirname(os.path.realpath(__file__))
class GetblockstatsTest(NYC3TestFramework):
start_height = 101
max_stat_pos ... | true | true |
f777196adbe2a9b9db19199ef7ff0860bbbce949 | 4,386 | py | Python | neutron/tests/unit/mlnx/test_mlnx_security_group.py | petrutlucian94/neutron | 44976d12bbe72331e536d92bb46e35a8835a75ce | [
"Apache-2.0"
] | null | null | null | neutron/tests/unit/mlnx/test_mlnx_security_group.py | petrutlucian94/neutron | 44976d12bbe72331e536d92bb46e35a8835a75ce | [
"Apache-2.0"
] | null | null | null | neutron/tests/unit/mlnx/test_mlnx_security_group.py | petrutlucian94/neutron | 44976d12bbe72331e536d92bb46e35a8835a75ce | [
"Apache-2.0"
] | null | null | null | # Copyright (c) 2013 OpenStack, LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | 42.173077 | 77 | 0.617647 |
import mock
import webob.exc
from neutron.api.v2 import attributes
from neutron.extensions import securitygroup as ext_sg
from neutron.plugins.mlnx.db import mlnx_db_v2 as mlnx_db
from neutron.tests.unit import test_extension_security_group as test_sg
from neutron.tests.unit import test_security_groups_rpc as test_sg... | true | true |
f7771bcb2d6519f2c5642f6adfe032ade7ef69c0 | 2,515 | py | Python | wflow-py/UnitTests/Testwflow_sbm_dynveg.py | edwinkost/wflow | ee9291d4b556d7b61f7f13bcb972774be9a16cec | [
"MIT"
] | null | null | null | wflow-py/UnitTests/Testwflow_sbm_dynveg.py | edwinkost/wflow | ee9291d4b556d7b61f7f13bcb972774be9a16cec | [
"MIT"
] | null | null | null | wflow-py/UnitTests/Testwflow_sbm_dynveg.py | edwinkost/wflow | ee9291d4b556d7b61f7f13bcb972774be9a16cec | [
"MIT"
] | null | null | null | __author__ = 'schelle'
import unittest
import wflow.wflow_sbm as wf
import os
"""
Run sceleton for 10 steps and checks if the outcome is approx that of the reference run
"""
class MyTest(unittest.TestCase):
def testapirun_netcfd(self):
startTime = 1
stopTime = 30
currentTime = 1
... | 37.537313 | 103 | 0.638171 | __author__ = 'schelle'
import unittest
import wflow.wflow_sbm as wf
import os
class MyTest(unittest.TestCase):
def testapirun_netcfd(self):
startTime = 1
stopTime = 30
currentTime = 1
runId = "unittest"
configfile="wflow_sbm_dynveg.ini"
wflow_cloneMap = ... | true | true |
f7771d72fbd5aeaf975bafdec485e095c9585231 | 47,117 | py | Python | tolteca/simu/toltec/models.py | dennis-l/tolteca | 1dffaffb585eb7027e26b34ae01e8632bef134cb | [
"BSD-3-Clause"
] | null | null | null | tolteca/simu/toltec/models.py | dennis-l/tolteca | 1dffaffb585eb7027e26b34ae01e8632bef134cb | [
"BSD-3-Clause"
] | null | null | null | tolteca/simu/toltec/models.py | dennis-l/tolteca | 1dffaffb585eb7027e26b34ae01e8632bef134cb | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
from gwcs import coordinate_frames as cf
import astropy.units as u
from astropy.time import Time
from astropy.modeling import models, Parameter, Model
from astropy.coordinates import SkyCoord, Angle
from astropy.table import Table
from astropy.cosmology import default_cosmology
from astropy impo... | 36.327679 | 79 | 0.580788 |
from gwcs import coordinate_frames as cf
import astropy.units as u
from astropy.time import Time
from astropy.modeling import models, Parameter, Model
from astropy.coordinates import SkyCoord, Angle
from astropy.table import Table
from astropy.cosmology import default_cosmology
from astropy import constants as const
... | true | true |
f7771de9db6993554e528689df5f057db48de0ce | 2,877 | py | Python | ledgerUpdateApi.py | takeratta/ledger-update-python-api | e9ff58475b4e6fcfc4dcaa2b6680216de49dba9d | [
"MIT"
] | null | null | null | ledgerUpdateApi.py | takeratta/ledger-update-python-api | e9ff58475b4e6fcfc4dcaa2b6680216de49dba9d | [
"MIT"
] | null | null | null | ledgerUpdateApi.py | takeratta/ledger-update-python-api | e9ff58475b4e6fcfc4dcaa2b6680216de49dba9d | [
"MIT"
] | null | null | null | import yaml
import hashlib
def loadNotes(lang, filename):
result = None
try:
f = open("assets/notes/" + lang + "/" + filename, "r")
result = f.read()
f.close()
except:
print "WARNING: Unable to load notes for " + lang + "/" + filename
if (result == None and lang != "en"):
return loadNotes("en", filename)... | 29.659794 | 90 | 0.665276 | import yaml
import hashlib
def loadNotes(lang, filename):
result = None
try:
f = open("assets/notes/" + lang + "/" + filename, "r")
result = f.read()
f.close()
except:
print "WARNING: Unable to load notes for " + lang + "/" + filename
if (result == None and lang != "en"):
return loadNotes("en", filename)... | false | true |
f7771e65cb312c35bd94233c010f8ca9c33058a3 | 276 | py | Python | tulius/forum/read_marks/__init__.py | kozzztik/tulius | 81b8f6484eefdc453047f62173a08f5e6f640cd6 | [
"MIT"
] | 1 | 2020-04-21T15:09:18.000Z | 2020-04-21T15:09:18.000Z | tulius/forum/read_marks/__init__.py | kozzztik/tulius | 81b8f6484eefdc453047f62173a08f5e6f640cd6 | [
"MIT"
] | 70 | 2019-04-10T22:32:32.000Z | 2022-03-11T23:12:54.000Z | tulius/forum/read_marks/__init__.py | kozzztik/tulius | 81b8f6484eefdc453047f62173a08f5e6f640cd6 | [
"MIT"
] | 1 | 2019-04-12T14:55:39.000Z | 2019-04-12T14:55:39.000Z | from django.apps import AppConfig
class ForumReadMarksConfig(AppConfig):
name = 'tulius.forum.read_marks'
label = 'forum_read_marks'
def ready(self):
# pylint: disable=C0415
from tulius.forum.read_marks import mutations
mutations.init()
| 23 | 53 | 0.695652 | from django.apps import AppConfig
class ForumReadMarksConfig(AppConfig):
name = 'tulius.forum.read_marks'
label = 'forum_read_marks'
def ready(self):
from tulius.forum.read_marks import mutations
mutations.init()
| true | true |
f7771f191c1de0a4e0f46d0e2bfa7dd0749073f4 | 12,708 | py | Python | python_modules/dagster-airflow/dagster_airflow/factory.py | vatervonacht/dagster | 595d78c883ef20618052ac1575fe46cde51fd541 | [
"Apache-2.0"
] | 3 | 2020-04-28T16:27:33.000Z | 2020-07-22T07:43:30.000Z | python_modules/dagster-airflow/dagster_airflow/factory.py | vatervonacht/dagster | 595d78c883ef20618052ac1575fe46cde51fd541 | [
"Apache-2.0"
] | null | null | null | python_modules/dagster-airflow/dagster_airflow/factory.py | vatervonacht/dagster | 595d78c883ef20618052ac1575fe46cde51fd541 | [
"Apache-2.0"
] | 1 | 2021-02-21T12:16:47.000Z | 2021-02-21T12:16:47.000Z | import datetime
import re
from airflow import DAG
from airflow.operators import BaseOperator
from dagster import ExecutionTargetHandle, RunConfig, check, seven
from dagster.core.execution.api import create_execution_plan
from dagster.core.instance import DagsterInstance
from .compile import coalesce_execution_steps
... | 36.308571 | 100 | 0.694995 | import datetime
import re
from airflow import DAG
from airflow.operators import BaseOperator
from dagster import ExecutionTargetHandle, RunConfig, check, seven
from dagster.core.execution.api import create_execution_plan
from dagster.core.instance import DagsterInstance
from .compile import coalesce_execution_steps
... | true | true |
f7771f1a46e622294aece8e890372609458cf978 | 4,959 | py | Python | moonv4/moon_manager/moon_manager/api/rules.py | hashnfv/hashnfv-moon | daaba34fa2ed4426bc0fde359e54a5e1b872208c | [
"Apache-2.0"
] | null | null | null | moonv4/moon_manager/moon_manager/api/rules.py | hashnfv/hashnfv-moon | daaba34fa2ed4426bc0fde359e54a5e1b872208c | [
"Apache-2.0"
] | null | null | null | moonv4/moon_manager/moon_manager/api/rules.py | hashnfv/hashnfv-moon | daaba34fa2ed4426bc0fde359e54a5e1b872208c | [
"Apache-2.0"
] | null | null | null | # Copyright 2015 Open Platform for NFV Project, Inc. and its contributors
# This software is distributed under the terms and conditions of the 'Apache-2.0'
# license which can be found in the file 'LICENSE' in this package distribution
# or at 'http://www.apache.org/licenses/LICENSE-2.0'.
"""
Rules (TODO)
"""
from fla... | 35.170213 | 81 | 0.472474 |
from flask import request
from flask_restful import Resource
from oslo_log import log as logging
from moon_utilities.security_functions import check_auth
from moon_db.core import PolicyManager
__version__ = "0.1.0"
LOG = logging.getLogger("moon.manager.api." + __name__)
class Rules(Resource):
__urls__ = ("/po... | true | true |
f7771ffc2fc491e5faeb5c24765278f844749675 | 2,942 | py | Python | models/tokenization_sas.py | alibaba/self-augmentation-strategy | 351197b0431de2ce3e0bb15e8a39226aff8c14b9 | [
"MIT"
] | 2 | 2022-01-26T05:09:41.000Z | 2022-01-26T05:24:39.000Z | models/tokenization_sas.py | alibaba/self-augmentation-strategy | 351197b0431de2ce3e0bb15e8a39226aff8c14b9 | [
"MIT"
] | null | null | null | models/tokenization_sas.py | alibaba/self-augmentation-strategy | 351197b0431de2ce3e0bb15e8a39226aff8c14b9 | [
"MIT"
] | null | null | null | # coding=utf-8
# Copyright 2020 The Google AI Team, Stanford University and The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/L... | 43.910448 | 129 | 0.753569 |
from transformers.models.bert.tokenization_bert import BertTokenizer
VOCAB_FILES_NAMES = {"vocab_file": "vocab.txt"}
PRETRAINED_VOCAB_FILES_MAP = {
"vocab_file": {
"google/electra-small-generator": "https://huggingface.co/google/electra-small-generator/resolve/main/vocab.txt",
"google/electra-ba... | true | true |
f7772003305fb93bebc90b6e08a01a0a42f97ec6 | 10 | py | Python | python/testData/postfix/par/number_after.py | truthiswill/intellij-community | fff88cfb0dc168eea18ecb745d3e5b93f57b0b95 | [
"Apache-2.0"
] | 2 | 2019-04-28T07:48:50.000Z | 2020-12-11T14:18:08.000Z | python/testData/postfix/par/number_after.py | truthiswill/intellij-community | fff88cfb0dc168eea18ecb745d3e5b93f57b0b95 | [
"Apache-2.0"
] | 173 | 2018-07-05T13:59:39.000Z | 2018-08-09T01:12:03.000Z | python/testData/postfix/par/number_after.py | truthiswill/intellij-community | fff88cfb0dc168eea18ecb745d3e5b93f57b0b95 | [
"Apache-2.0"
] | 2 | 2020-03-15T08:57:37.000Z | 2020-04-07T04:48:14.000Z | (1)<caret> | 10 | 10 | 0.6 | (1)<caret> | false | true |
f77720a5345110e8ba0f17efea73021544af3cf1 | 212 | py | Python | versions.py | atpuxiner/xrpa | 52322936d569267bbae70d81853b8aa30ce24438 | [
"MIT"
] | null | null | null | versions.py | atpuxiner/xrpa | 52322936d569267bbae70d81853b8aa30ce24438 | [
"MIT"
] | null | null | null | versions.py | atpuxiner/xrpa | 52322936d569267bbae70d81853b8aa30ce24438 | [
"MIT"
] | null | null | null | """
@author axiner
@version v1.0.0
@created 2021/12/12 13:14
@abstract
@description
@history
"""
class Versions(object):
ALL = [
("2022.03.14", "add@simple"),
("2022.01.23", "init@"),
]
| 13.25 | 37 | 0.561321 |
class Versions(object):
ALL = [
("2022.03.14", "add@simple"),
("2022.01.23", "init@"),
]
| true | true |
f77720a5e37c246862b26dbbc40841f5a68b74f9 | 3,919 | py | Python | custom_components/hubitat/entities.py | clboles/hacs-hubitat | 6da3733bb697ac0e999417c3002bbe7d65a7623b | [
"MIT"
] | null | null | null | custom_components/hubitat/entities.py | clboles/hacs-hubitat | 6da3733bb697ac0e999417c3002bbe7d65a7623b | [
"MIT"
] | null | null | null | custom_components/hubitat/entities.py | clboles/hacs-hubitat | 6da3733bb697ac0e999417c3002bbe7d65a7623b | [
"MIT"
] | null | null | null | from logging import getLogger
from typing import Callable, Dict, List, Optional, Type, TypeVar, cast
from custom_components.hubitat.util import get_device_overrides
from hubitatmaker import Device
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.help... | 35.306306 | 83 | 0.711661 | from logging import getLogger
from typing import Callable, Dict, List, Optional, Type, TypeVar, cast
from custom_components.hubitat.util import get_device_overrides
from hubitatmaker import Device
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.help... | true | true |
f77720c8bc70a5b573f9629db03e22b3144c463f | 5,818 | py | Python | molecule/test/unit/command/init/test_scenario.py | dj-wasabi/molecule | 97a7b60fc47b2b83f3f772aafbf044294be168a6 | [
"MIT"
] | null | null | null | molecule/test/unit/command/init/test_scenario.py | dj-wasabi/molecule | 97a7b60fc47b2b83f3f772aafbf044294be168a6 | [
"MIT"
] | null | null | null | molecule/test/unit/command/init/test_scenario.py | dj-wasabi/molecule | 97a7b60fc47b2b83f3f772aafbf044294be168a6 | [
"MIT"
] | null | null | null | # Copyright (c) 2015-2018 Cisco Systems, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge... | 32.502793 | 87 | 0.743898 |
import os
import pytest
from molecule.command.init import scenario
@pytest.fixture
def _command_args():
return {
'driver_name': 'docker',
'role_name': 'test-role',
'scenario_name': 'test-scenario',
'subcommand': __name__,
'verifier_name': 'testinfra',
}
@pytest.fix... | true | true |
f77721f14b51544cb2a04d5efc24e8d031604dbb | 9,232 | py | Python | model/ihda_list_model.py | seongcheoljeon/IndividualHDA | fc5218f3248c40a6de0a221a4762b6e644acfbf4 | [
"MIT"
] | 7 | 2020-08-11T16:30:04.000Z | 2022-03-25T08:50:19.000Z | model/ihda_list_model.py | seongcheoljeon/IndividualHDA | fc5218f3248c40a6de0a221a4762b6e644acfbf4 | [
"MIT"
] | 1 | 2020-06-24T04:50:29.000Z | 2020-06-24T17:40:02.000Z | model/ihda_list_model.py | seongcheoljeon/IndividualHDA | fc5218f3248c40a6de0a221a4762b6e644acfbf4 | [
"MIT"
] | 1 | 2021-09-15T16:28:46.000Z | 2021-09-15T16:28:46.000Z | #!/usr/bin/env python
# encoding=utf-8
# author : SeongCheol Jeon
# email addr : saelly55@gmail.com
# create date : 2020.01.28 01:34
# modify date :
# description :
from imp import reload
from PySide2 import QtGui, QtCore
try:
import hou
except ImportError as err:
pass
i... | 39.118644 | 112 | 0.610377 |
from imp import reload
from PySide2 import QtGui, QtCore
try:
import hou
except ImportError as err:
pass
import public
reload(public)
class ListModel(QtCore.QAbstractListModel):
data_role = QtCore.Qt.UserRole
row_role = QtCore.Qt.UserRole + 1
id_role = QtCore.Qt.UserRole + 2
filepath_rol... | true | true |
f777228d264ef5f196819422dd41cd537f3af378 | 2,375 | py | Python | app/libs/thompson_bayesian_linear.py | kagemusha/streamingbandit | f5228611a0ac9432e958761dd6d68d972d7d163b | [
"MIT"
] | 64 | 2017-05-21T06:08:57.000Z | 2022-01-25T14:44:54.000Z | app/libs/thompson_bayesian_linear.py | kagemusha/streamingbandit | f5228611a0ac9432e958761dd6d68d972d7d163b | [
"MIT"
] | 76 | 2017-05-04T10:30:59.000Z | 2020-05-07T06:43:03.000Z | app/libs/thompson_bayesian_linear.py | kagemusha/streamingbandit | f5228611a0ac9432e958761dd6d68d972d7d163b | [
"MIT"
] | 12 | 2017-05-04T13:10:23.000Z | 2020-02-22T17:12:49.000Z | # -*- coding: utf-8 -*-
import numpy as np
from libs.base import *
import ast
global numpy
class ThompsonBayesianLinear():
""" Class for Thompson sampling for Bayesian Linear Regression
:var dict default: The value of the model, consisting of a 1*p \
list of J, p*p list of P and an error rate.
""... | 37.698413 | 87 | 0.565053 | import numpy as np
from libs.base import *
import ast
global numpy
class ThompsonBayesianLinear():
def __init__(self, default):
if default == {}:
self.value = {'J' : [0, 0], 'P' : [[1, 0],[0, 1]], 'err' : 1}
else:
self.value = default.copy()
if isinstance(self.value... | true | true |
f77722a0ab5be21bdd14990caafb81f38203662f | 29,750 | py | Python | chernosim/acquisition/acquisition.py | sdss/chernosim | 734f349c82d85dd6a1fe00013d21025ef0e9b845 | [
"BSD-3-Clause"
] | null | null | null | chernosim/acquisition/acquisition.py | sdss/chernosim | 734f349c82d85dd6a1fe00013d21025ef0e9b845 | [
"BSD-3-Clause"
] | null | null | null | chernosim/acquisition/acquisition.py | sdss/chernosim | 734f349c82d85dd6a1fe00013d21025ef0e9b845 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# @Author: José Sánchez-Gallego (gallegoj@uw.edu)
# @Date: 2020-09-13
# @Filename: acquisition.py
# @License: BSD 3-clause (http://www.opensource.org/licenses/BSD-3-Clause)
import collections
import functools
import multiprocessing
import pathlib
import shutil
import war... | 35.501193 | 81 | 0.580034 |
import collections
import functools
import multiprocessing
import pathlib
import shutil
import warnings
import astropy.table
import astropy.wcs
import matplotlib.patches
import matplotlib.pyplot
import numpy
import pandas
import tqdm
import yaml
from cherno.astrometry import AstrometryNet
from sdsstools import read_... | true | true |
f77722c42af3fd9b375df5687101e32c87f4da86 | 1,753 | py | Python | deo/exceptions.py | bsnacks000/deo | e8921f37012859aacb6dac35c0556d7198536456 | [
"MIT"
] | null | null | null | deo/exceptions.py | bsnacks000/deo | e8921f37012859aacb6dac35c0556d7198536456 | [
"MIT"
] | null | null | null | deo/exceptions.py | bsnacks000/deo | e8921f37012859aacb6dac35c0556d7198536456 | [
"MIT"
] | null | null | null | """ Exceptions mapped to error codes the JSON-rpc 2 spec.
-32768 to -32000 are reserved for pre-defined errors
code: -32700 message: Parse Error -> invalid json received by the server. Error occurred while parsing the json text
code: -32600 message: Invalid Request -> Json sent is not a valid Request object
code... | 31.303571 | 118 | 0.706218 |
class DeoException(Exception):
error_code = None
message = ''
def __init__(self, *args, **kwargs):
if not (args or kwargs):
args = (self.message,)
super().__init__(*args, **kwargs)
class ParseError(DeoException):
error_code = -32700
message = 'An error occured while... | true | true |
f777249fdedc57b8dc6a3ff503e96ec7b9a81769 | 111,494 | py | Python | pymatgen/analysis/graphs.py | anjlip/pymatgen | 62ecae1c7382a41861e3a5d9b9c8dd1207472409 | [
"MIT"
] | 2 | 2017-10-02T03:11:47.000Z | 2018-12-02T12:56:12.000Z | pymatgen/analysis/graphs.py | darnoceloc/pymatgen | 5cc42912a12a265a603df7e34c856561f76edc1f | [
"MIT"
] | 3 | 2017-07-18T01:13:41.000Z | 2019-04-29T18:17:30.000Z | pymatgen/analysis/graphs.py | darnoceloc/pymatgen | 5cc42912a12a265a603df7e34c856561f76edc1f | [
"MIT"
] | 2 | 2016-06-15T00:12:59.000Z | 2018-12-02T12:56:47.000Z | # coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
import warnings
import subprocess
import numpy as np
import os.path
import copy
from itertools import combinations
from pymatgen.core import Structure, Lattice, PeriodicSite, Molecule
from pymatgen.core.struc... | 40.091334 | 104 | 0.565977 |
import warnings
import subprocess
import numpy as np
import os.path
import copy
from itertools import combinations
from pymatgen.core import Structure, Lattice, PeriodicSite, Molecule
from pymatgen.core.structure import FunctionalGroups
from pymatgen.util.coord import lattice_points_in_supercell
from pymatgen.vis.st... | true | true |
f777253278c0cf229ef2020b4301c88c332d3153 | 3,341 | py | Python | src/compas/numerical/pca/pca_numpy.py | mpopescu/compas | 55f259607deea501f862cbaea79bd97d7e56ead6 | [
"MIT"
] | null | null | null | src/compas/numerical/pca/pca_numpy.py | mpopescu/compas | 55f259607deea501f862cbaea79bd97d7e56ead6 | [
"MIT"
] | null | null | null | src/compas/numerical/pca/pca_numpy.py | mpopescu/compas | 55f259607deea501f862cbaea79bd97d7e56ead6 | [
"MIT"
] | null | null | null | from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from numpy import asarray
from scipy.linalg import svd
__all__ = ['pca_numpy']
def pca_numpy(data):
"""Compute the principle components of a set of data points.
Parameters
----------
data :... | 33.079208 | 122 | 0.636037 | from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from numpy import asarray
from scipy.linalg import svd
__all__ = ['pca_numpy']
def pca_numpy(data):
X = asarray(data)
n, dim = X.shape
assert n >= dim, "The number of observations (n) should be... | true | true |
f77726501cfc3fe5a8b20f416b3eb964149789ef | 3,394 | py | Python | jira/komand_jira/actions/get_comments/schema.py | OSSSP/insightconnect-plugins | 846758dab745170cf1a8c146211a8bea9592e8ff | [
"MIT"
] | 1 | 2020-03-18T09:14:55.000Z | 2020-03-18T09:14:55.000Z | jira/komand_jira/actions/get_comments/schema.py | OSSSP/insightconnect-plugins | 846758dab745170cf1a8c146211a8bea9592e8ff | [
"MIT"
] | null | null | null | jira/komand_jira/actions/get_comments/schema.py | OSSSP/insightconnect-plugins | 846758dab745170cf1a8c146211a8bea9592e8ff | [
"MIT"
] | null | null | null | # GENERATED BY KOMAND SDK - DO NOT EDIT
import komand
import json
class Component:
DESCRIPTION = "Retrieve all comments on an issue"
class Input:
ID = "id"
class Output:
COMMENTS = "comments"
COUNT = "count"
class GetCommentsInput(komand.Input):
schema = json.loads("""
{
"type":... | 21.617834 | 58 | 0.422216 | import komand
import json
class Component:
DESCRIPTION = "Retrieve all comments on an issue"
class Input:
ID = "id"
class Output:
COMMENTS = "comments"
COUNT = "count"
class GetCommentsInput(komand.Input):
schema = json.loads("""
{
"type": "object",
"title": "Variables",
"pr... | true | true |
f7772661a94f2ed27c1f7fd7bc12b88021993e6c | 967 | py | Python | brax/io/model.py | bharadwaj1098/brax | 3108a0535b9b59725c97ef35732ed0378c0fd5cc | [
"Apache-2.0"
] | 1,162 | 2021-06-03T20:15:05.000Z | 2022-03-31T19:53:06.000Z | brax/io/model.py | bharadwaj1098/brax | 3108a0535b9b59725c97ef35732ed0378c0fd5cc | [
"Apache-2.0"
] | 160 | 2021-06-05T02:32:39.000Z | 2022-03-31T11:39:58.000Z | brax/io/model.py | bharadwaj1098/brax | 3108a0535b9b59725c97ef35732ed0378c0fd5cc | [
"Apache-2.0"
] | 117 | 2021-06-04T17:18:21.000Z | 2022-03-30T18:04:48.000Z | # Copyright 2021 The Brax Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | 29.30303 | 74 | 0.731127 |
import pickle
from typing import Any
from brax.io.file import File
def load_params(path: str) -> Any:
with File(path, 'rb') as fin:
buf = fin.read()
return pickle.loads(buf)
def save_params(path: str, params: Any):
with File(path, 'wb') as fout:
fout.write(pickle.dumps(params))
| true | true |
f77726fb6b9ef2a0663bba32306e3c2d85b740ec | 6,541 | py | Python | securesystemslib/gpg/rsa.py | SolidifiedRay/securesystemslib | d285d7df2f34947a1f4a0fd8fcfd97945a81d81e | [
"MIT"
] | 29 | 2018-01-26T12:01:28.000Z | 2022-02-25T01:52:19.000Z | securesystemslib/gpg/rsa.py | SolidifiedRay/securesystemslib | d285d7df2f34947a1f4a0fd8fcfd97945a81d81e | [
"MIT"
] | 295 | 2017-01-04T22:07:07.000Z | 2022-03-30T07:21:46.000Z | securesystemslib/gpg/rsa.py | SolidifiedRay/securesystemslib | d285d7df2f34947a1f4a0fd8fcfd97945a81d81e | [
"MIT"
] | 25 | 2016-12-06T21:26:57.000Z | 2022-02-25T01:52:20.000Z | """
<Module Name>
rsa.py
<Author>
Santiago Torres-Arias <santiago@nyu.edu>
<Started>
Nov 15, 2017
<Copyright>
See LICENSE for licensing information.
<Purpose>
RSA-specific handling routines for signature verification and key parsing
"""
import binascii
CRYPTO = True
NO_CRYPTO_MSG = 'RSA key support for G... | 29.331839 | 79 | 0.73261 | import binascii
CRYPTO = True
NO_CRYPTO_MSG = 'RSA key support for GPG requires the cryptography library'
try:
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.hazmat import backends
from cryptography.hazmat.primitives.asymmetric import padding
from cryptography.hazmat.primitives.asy... | true | true |
f77727357048daf7cf80a463330497445c14076c | 1,001 | py | Python | docker_containers/demo_conts/dos_checker/sendAlert.py | slab14/IoT_Sec_Gateway | 89e9f5b16a0e3a9557c353dc844289eed2464c02 | [
"MIT"
] | 8 | 2018-08-08T14:42:01.000Z | 2020-09-24T15:53:32.000Z | docker_containers/demo_conts/dos_checker/sendAlert.py | slab14/IoT_Sec_Gateway | 89e9f5b16a0e3a9557c353dc844289eed2464c02 | [
"MIT"
] | 1 | 2020-06-02T19:01:21.000Z | 2020-06-02T19:01:21.000Z | docker_containers/demo_conts/dos_checker/sendAlert.py | slab14/IoT_Sec_Gateway | 89e9f5b16a0e3a9557c353dc844289eed2464c02 | [
"MIT"
] | 9 | 2018-01-29T00:54:33.000Z | 2020-05-31T20:32:51.000Z | import time
import socket
import re
import ctypes
import argparse
sender = ctypes.CDLL("/send.so")
sender.sendEncryptedAlert.argtype=[ctypes.POINTER(ctypes.c_char), ctypes.c_int]
sender.sendEncryptedAlert.restype=ctypes.c_int
#fileName='/var/log/nmap.log'
def getData(fileName):
data=''
with open(fileName, '... | 27.054054 | 79 | 0.652348 | import time
import socket
import re
import ctypes
import argparse
sender = ctypes.CDLL("/send.so")
sender.sendEncryptedAlert.argtype=[ctypes.POINTER(ctypes.c_char), ctypes.c_int]
sender.sendEncryptedAlert.restype=ctypes.c_int
def getData(fileName):
data=''
with open(fileName, 'r') as f:
data=f.read(... | true | true |
f77728232cfd66e7c93650fd7557c987b0ab7703 | 5,773 | py | Python | syd/syd_helpers.py | OpenSyd/syd | 0f7478c7dedb623ab955e906c103cb64a7abb4b3 | [
"Apache-2.0"
] | 4 | 2015-07-29T19:10:35.000Z | 2020-11-17T07:48:41.000Z | syd/syd_helpers.py | OpenSyd/syd | 0f7478c7dedb623ab955e906c103cb64a7abb4b3 | [
"Apache-2.0"
] | 9 | 2015-05-14T09:07:37.000Z | 2022-03-15T10:13:59.000Z | syd/syd_helpers.py | OpenSyd/syd | 0f7478c7dedb623ab955e906c103cb64a7abb4b3 | [
"Apache-2.0"
] | 3 | 2016-09-07T06:26:52.000Z | 2016-10-04T12:29:03.000Z | #!/usr/bin/env python3
import datetime
import colored
import os
import syd
import re
from tokenize import tokenize, NUMBER
from io import BytesIO
from box import Box, BoxKeyError
from difflib import SequenceMatcher
# -----------------------------------------------------------------------------
def replace_key_with_id... | 27.103286 | 103 | 0.469427 |
import datetime
import colored
import os
import syd
import re
from tokenize import tokenize, NUMBER
from io import BytesIO
from box import Box, BoxKeyError
from difflib import SequenceMatcher
def replace_key_with_id(element, key_name, table, table_key_name):
statement = 'SELECT id FROM '+table.name+' WHERE '+... | true | true |
f77728e5a76673782eacdb853729554901be6583 | 1,521 | py | Python | extra/unused/combineColumns.py | whyjz/CARST | 875c915e835b0e09a7eccb58833719bbfc85b635 | [
"MIT"
] | 10 | 2018-01-02T18:03:07.000Z | 2022-01-25T05:36:21.000Z | extra/unused/combineColumns.py | whyjz/CARST | 875c915e835b0e09a7eccb58833719bbfc85b635 | [
"MIT"
] | 1 | 2020-04-14T16:57:15.000Z | 2020-05-15T16:10:17.000Z | extra/unused/combineColumns.py | whyjz/CARST | 875c915e835b0e09a7eccb58833719bbfc85b635 | [
"MIT"
] | 4 | 2016-08-12T15:06:48.000Z | 2019-11-27T05:33:50.000Z | #!/usr/bin/python
# combineColumns.py
# Author: Andrew Kenneth Melkonian
# All rights reserved
def combineColumns(xyz1_path, xyz2_path, id_col_num_1, id_col_num_2):
assert os.path.exists(xyz1_path), "\n***** ERROR: " + xyz1_path + " does not exist\n";
assert os.path.exists(xyz2_path), "\n***** ERROR: " + xyz2_pa... | 22.701493 | 132 | 0.656147 |
def combineColumns(xyz1_path, xyz2_path, id_col_num_1, id_col_num_2):
assert os.path.exists(xyz1_path), "\n***** ERROR: " + xyz1_path + " does not exist\n";
assert os.path.exists(xyz2_path), "\n***** ERROR: " + xyz2_path + " does not exist\n";
combined = {};
infile = open(xyz1_path, "r");
for line in infil... | true | true |
f77729732df6a06d411301152271ae829fa006f4 | 3,349 | py | Python | scripts/generators/beats.py | ngohoa211/ecs | ff4885d0dc87daba4588eec795d9957d1004845f | [
"Apache-2.0"
] | 1 | 2020-01-16T14:43:24.000Z | 2020-01-16T14:43:24.000Z | scripts/generators/beats.py | webmat/ecs | ff4885d0dc87daba4588eec795d9957d1004845f | [
"Apache-2.0"
] | null | null | null | scripts/generators/beats.py | webmat/ecs | ff4885d0dc87daba4588eec795d9957d1004845f | [
"Apache-2.0"
] | null | null | null | from os.path import join
from collections import OrderedDict
from generators import ecs_helpers
def generate(ecs_nested, ecs_version, out_dir):
# Load temporary whitelist for default_fields workaround.
df_whitelist = ecs_helpers.yaml_load('scripts/generators/beats_default_fields_whitelist.yml')
# base fi... | 38.494253 | 113 | 0.677217 | from os.path import join
from collections import OrderedDict
from generators import ecs_helpers
def generate(ecs_nested, ecs_version, out_dir):
df_whitelist = ecs_helpers.yaml_load('scripts/generators/beats_default_fields_whitelist.yml')
beats_fields = fieldset_field_array(ecs_nested['base']['fields'... | true | true |
f77729cf01918def9b6331c7102745f71667880a | 280 | py | Python | crawler/packages/oxford_api/settings.py | softmarshmallow/robbin | 87fa2b77a2f02cb482be320c70b2e3e5462a4875 | [
"MIT"
] | 6 | 2020-07-22T03:12:02.000Z | 2021-08-16T13:29:01.000Z | crawler/packages/oxford_api/settings.py | softmarshmallow/wor.io | 87fa2b77a2f02cb482be320c70b2e3e5462a4875 | [
"MIT"
] | 5 | 2020-11-27T16:34:11.000Z | 2022-01-22T13:57:57.000Z | crawler/packages/oxford_api/settings.py | softmarshmallow/wor.io | 87fa2b77a2f02cb482be320c70b2e3e5462a4875 | [
"MIT"
] | null | null | null | # settings.py
from dotenv import load_dotenv
import os
# explicitly providing path to '.env'
from pathlib import Path # Python 3.6+ only
env_path = Path('.') / '.env'
load_dotenv(dotenv_path=env_path)
# settings.py
APP_ID = os.getenv("APP_ID")
APP_KEY = os.getenv("APP_KEY")
| 18.666667 | 44 | 0.725 | from dotenv import load_dotenv
import os
from pathlib import Path
env_path = Path('.') / '.env'
load_dotenv(dotenv_path=env_path)
APP_ID = os.getenv("APP_ID")
APP_KEY = os.getenv("APP_KEY")
| true | true |
f7772b1e020ecd29adb98f09adbd110e76424e97 | 625 | py | Python | os_v4_hek/defs/obje.py | holy-crust/reclaimer | 0aa693da3866ce7999c68d5f71f31a9c932cdb2c | [
"MIT"
] | null | null | null | os_v4_hek/defs/obje.py | holy-crust/reclaimer | 0aa693da3866ce7999c68d5f71f31a9c932cdb2c | [
"MIT"
] | null | null | null | os_v4_hek/defs/obje.py | holy-crust/reclaimer | 0aa693da3866ce7999c68d5f71f31a9c932cdb2c | [
"MIT"
] | null | null | null | from ...os_v3_hek.defs.obje import *
obje_attrs = dict(obje_attrs)
obje_attrs[1] = Bool16('flags',
'does_not_cast_shadow',
'transparent_self_occlusion',
'brighter_than_it_should_be',
'not_a_pathfinding_obstacle',
'cast_shadow_by_default',
{NAME: 'xbox_unknown_bit_8', VALUE: 1<<8, VISIB... | 23.148148 | 65 | 0.64 | from ...os_v3_hek.defs.obje import *
obje_attrs = dict(obje_attrs)
obje_attrs[1] = Bool16('flags',
'does_not_cast_shadow',
'transparent_self_occlusion',
'brighter_than_it_should_be',
'not_a_pathfinding_obstacle',
'cast_shadow_by_default',
{NAME: 'xbox_unknown_bit_8', VALUE: 1<<8, VISIB... | true | true |
f7772c97d355339e3924159ddbd64ffde20f53b9 | 1,609 | py | Python | nba_api/stats/endpoints/commonplayerinfo.py | Ryan-Johnson-1315/nba-stats | 7e1d4639c3b2eaba087ebaa4740325721a985102 | [
"MIT"
] | null | null | null | nba_api/stats/endpoints/commonplayerinfo.py | Ryan-Johnson-1315/nba-stats | 7e1d4639c3b2eaba087ebaa4740325721a985102 | [
"MIT"
] | null | null | null | nba_api/stats/endpoints/commonplayerinfo.py | Ryan-Johnson-1315/nba-stats | 7e1d4639c3b2eaba087ebaa4740325721a985102 | [
"MIT"
] | 1 | 2018-10-07T07:07:28.000Z | 2018-10-07T07:07:28.000Z | from nba_api.stats.endpoints._base import Endpoint
from nba_api.stats.library.http import NBAStatsHTTP
from nba_api.stats.library.parameters import LeagueIDNullable
class CommonPlayerInfo(Endpoint):
endpoint = 'commonplayerinfo'
expected_data = {'AvailableSeasons': ['SEASON_ID'], 'CommonPlayerInfo': ['PERSON_... | 64.36 | 597 | 0.698571 | from nba_api.stats.endpoints._base import Endpoint
from nba_api.stats.library.http import NBAStatsHTTP
from nba_api.stats.library.parameters import LeagueIDNullable
class CommonPlayerInfo(Endpoint):
endpoint = 'commonplayerinfo'
expected_data = {'AvailableSeasons': ['SEASON_ID'], 'CommonPlayerInfo': ['PERSON_... | true | true |
f7772ceea5a05d3cd634e50303ef28682cabdba0 | 156 | py | Python | macOS/Paste.py | bliles/autokey-macos | c8d44b83f6d4117b9430ede0c0aec81f72d9feab | [
"MIT"
] | 38 | 2019-04-06T01:20:26.000Z | 2022-02-22T03:02:40.000Z | macOS/Paste.py | bliles/autokey-macos | c8d44b83f6d4117b9430ede0c0aec81f72d9feab | [
"MIT"
] | null | null | null | macOS/Paste.py | bliles/autokey-macos | c8d44b83f6d4117b9430ede0c0aec81f72d9feab | [
"MIT"
] | 8 | 2019-04-06T01:20:34.000Z | 2022-03-31T14:10:04.000Z | if window.get_active_class() != 'gnome-terminal-server.Gnome-terminal':
keyboard.send_keys("<ctrl>+v")
else:
keyboard.send_keys("<ctrl>+<shift>+v")
| 31.2 | 71 | 0.698718 | if window.get_active_class() != 'gnome-terminal-server.Gnome-terminal':
keyboard.send_keys("<ctrl>+v")
else:
keyboard.send_keys("<ctrl>+<shift>+v")
| true | true |
f7772d04832c1489bf4bbb3fee88054717b81a1d | 9,804 | py | Python | mobilenet_v2.py | dasolhwang/tf-mobilenet-v2 | e0e8f936e63e14561d9d25b77256d1cadb85172a | [
"MIT"
] | null | null | null | mobilenet_v2.py | dasolhwang/tf-mobilenet-v2 | e0e8f936e63e14561d9d25b77256d1cadb85172a | [
"MIT"
] | null | null | null | mobilenet_v2.py | dasolhwang/tf-mobilenet-v2 | e0e8f936e63e14561d9d25b77256d1cadb85172a | [
"MIT"
] | null | null | null | """
MobileNet v2.
As described in https://arxiv.org/abs/1801.04381
Inverted Residuals and Linear Bottlenecks: Mobile Networks for Classification, Detection and Segmentation
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from collections import nam... | 46.464455 | 119 | 0.555896 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from collections import namedtuple, OrderedDict
import functools
import tensorflow as tf
slim = tf.contrib.slim
Conv = namedtuple('Conv', ['kernel', 'stride', 'channel'])
InvertedBottleneck = namedtuple('In... | true | true |
f7772d125aa94114e38713c63b9638d23554e949 | 1,333 | py | Python | aliyun-python-sdk-qualitycheck/aliyunsdkqualitycheck/request/v20190115/ValidateRoleSetRequest.py | sdk-team/aliyun-openapi-python-sdk | 384730d707e6720d1676ccb8f552e6a7b330ec86 | [
"Apache-2.0"
] | null | null | null | aliyun-python-sdk-qualitycheck/aliyunsdkqualitycheck/request/v20190115/ValidateRoleSetRequest.py | sdk-team/aliyun-openapi-python-sdk | 384730d707e6720d1676ccb8f552e6a7b330ec86 | [
"Apache-2.0"
] | null | null | null | aliyun-python-sdk-qualitycheck/aliyunsdkqualitycheck/request/v20190115/ValidateRoleSetRequest.py | sdk-team/aliyun-openapi-python-sdk | 384730d707e6720d1676ccb8f552e6a7b330ec86 | [
"Apache-2.0"
] | null | null | null | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 37.027778 | 77 | 0.771193 |
from aliyunsdkcore.request import RpcRequest
class ValidateRoleSetRequest(RpcRequest):
def __init__(self):
RpcRequest.__init__(self, 'Qualitycheck', '2019-01-15', 'ValidateRoleSet')
def get_ResourceOwnerId(self):
return self.get_query_params().get('ResourceOwnerId')
def set_ResourceOwnerId(self,Resource... | true | true |
f7772d2eb15e2de766d2c63272b4c4c8b96d3de8 | 5,774 | py | Python | app_hotornot/migrations/0001_initial.py | Audiotuete/backend_hotornot_api | 0ef7025e0beed60420b2fcc048321e24cd2fb10a | [
"MIT"
] | null | null | null | app_hotornot/migrations/0001_initial.py | Audiotuete/backend_hotornot_api | 0ef7025e0beed60420b2fcc048321e24cd2fb10a | [
"MIT"
] | null | null | null | app_hotornot/migrations/0001_initial.py | Audiotuete/backend_hotornot_api | 0ef7025e0beed60420b2fcc048321e24cd2fb10a | [
"MIT"
] | null | null | null | # Generated by Django 2.0.8 on 2018-09-10 17:52
from django.conf import settings
import django.contrib.postgres.fields
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migra... | 47.327869 | 200 | 0.608417 |
from django.conf import settings
import django.contrib.postgres.fields
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MO... | true | true |
f7772d8a9eb81af374bbf92d20730fcd9deeefc2 | 3,395 | py | Python | spikeinterface/widgets/unitlocalization.py | JuliaSprenger/spikeinterface | d5d3d3992a6d430d7008e16db4ee030734e685e5 | [
"MIT"
] | 116 | 2019-07-12T14:33:43.000Z | 2022-03-29T01:10:00.000Z | spikeinterface/widgets/unitlocalization.py | JuliaSprenger/spikeinterface | d5d3d3992a6d430d7008e16db4ee030734e685e5 | [
"MIT"
] | 424 | 2019-07-15T13:29:34.000Z | 2022-03-30T13:30:45.000Z | spikeinterface/widgets/unitlocalization.py | JuliaSprenger/spikeinterface | d5d3d3992a6d430d7008e16db4ee030734e685e5 | [
"MIT"
] | 60 | 2019-08-26T11:59:07.000Z | 2022-03-24T20:05:38.000Z | import numpy as np
import matplotlib.pylab as plt
from .basewidget import BaseWidget
from probeinterface.plotting import plot_probe
from spikeinterface.toolkit import compute_unit_centers_of_mass
from .utils import get_unit_colors
class UnitLocalizationWidget(BaseWidget):
"""
Plot unit localization on prob... | 35 | 101 | 0.652135 | import numpy as np
import matplotlib.pylab as plt
from .basewidget import BaseWidget
from probeinterface.plotting import plot_probe
from spikeinterface.toolkit import compute_unit_centers_of_mass
from .utils import get_unit_colors
class UnitLocalizationWidget(BaseWidget):
def __init__(self, waveform_extractor... | true | true |
f7772d933b6af5df5a9e87828cbf0353c8446d69 | 5,505 | py | Python | drop/multilabel_classification/loss.py | MRD-Git/Huggingface-course | 7c0440584e630cb8885c2a237bc6e8213cfd5572 | [
"MIT"
] | null | null | null | drop/multilabel_classification/loss.py | MRD-Git/Huggingface-course | 7c0440584e630cb8885c2a237bc6e8213cfd5572 | [
"MIT"
] | null | null | null | drop/multilabel_classification/loss.py | MRD-Git/Huggingface-course | 7c0440584e630cb8885c2a237bc6e8213cfd5572 | [
"MIT"
] | null | null | null | # https://pytorch.org/docs/stable/_modules/torch/nn/modules/loss.ht
from torch.nn.modules.loss import _Loss
from typing import Optional
from torch import Tensor
import torch.nn.functional as F
class BCEWithLogitsLoss(_Loss):
r"""This loss combines a `Sigmoid` layer and the `BCELoss` in one single
class. This v... | 51.933962 | 112 | 0.62743 | from torch.nn.modules.loss import _Loss
from typing import Optional
from torch import Tensor
import torch.nn.functional as F
class BCEWithLogitsLoss(_Loss):
def __init__(self, weight: Optional[Tensor] = None, size_average=None, reduce=None, reduction: str = 'mean',
pos_weight: Optional[Tensor] = N... | true | true |
f7772e09bcf0338f8d884a5d3596d0913221bad9 | 870 | py | Python | test/test_pipeline_build.py | go-vela/sdk-python | ca4425995bee43cb517e78fcd6702fec6f758222 | [
"Apache-2.0"
] | 1 | 2020-11-18T13:31:05.000Z | 2020-11-18T13:31:05.000Z | test/test_pipeline_build.py | go-vela/sdk-python | ca4425995bee43cb517e78fcd6702fec6f758222 | [
"Apache-2.0"
] | 57 | 2020-04-30T19:02:47.000Z | 2022-03-28T07:39:58.000Z | test/test_pipeline_build.py | go-vela/sdk-python | 304b2c8645dc6332fd69398c8c849a3961619c29 | [
"Apache-2.0"
] | null | null | null | # coding: utf-8
#
# Copyright (c) 2021 Target Brands, Inc. All rights reserved.
"""
Vela server
API for the Vela server # noqa: E501
OpenAPI spec version: 0.6.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import ... | 20.714286 | 79 | 0.682759 |
from __future__ import absolute_import
import unittest
import vela
from vela.models.pipeline_build import PipelineBuild from vela.rest import ApiException
class TestPipelineBuild(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def testPipelineBuild(self):
... | true | true |
f7772ec24e254f4ef26826fc204302748f03a5aa | 3,470 | py | Python | electrum_blk/gui/qt/watchtower_dialog.py | nedcloud-blackchain/electrum-blk | bf1992ecac9fffcc52e229e249da400b8751324e | [
"MIT"
] | 2 | 2022-03-09T18:21:02.000Z | 2022-03-13T13:27:07.000Z | electrum_blk/gui/qt/watchtower_dialog.py | nedcloud-blackchain/electrum-blk | bf1992ecac9fffcc52e229e249da400b8751324e | [
"MIT"
] | null | null | null | electrum_blk/gui/qt/watchtower_dialog.py | nedcloud-blackchain/electrum-blk | bf1992ecac9fffcc52e229e249da400b8751324e | [
"MIT"
] | 1 | 2022-02-21T07:38:29.000Z | 2022-02-21T07:38:29.000Z | #!/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... | 35.408163 | 82 | 0.685014 |
from PyQt5.QtGui import QStandardItemModel, QStandardItem
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import (QDialog, QVBoxLayout, QPushButton, QLabel)
from electrum_blk.i18n import _
from .util import MyTreeView, Buttons
class WatcherList(MyTreeView):
def __init__(self, parent):
super().__init__(... | true | true |
f7772ef5e045b6b4770a086203e79a88f692b6e6 | 1,524 | py | Python | setup.py | CONABIO-audio/irekua-autocomplete | fc8b31f86d8b51f172d25e7987af4d70cdf22e2c | [
"BSD-4-Clause"
] | null | null | null | setup.py | CONABIO-audio/irekua-autocomplete | fc8b31f86d8b51f172d25e7987af4d70cdf22e2c | [
"BSD-4-Clause"
] | 11 | 2020-04-26T23:56:07.000Z | 2022-03-12T00:03:40.000Z | setup.py | CONABIO-audio/irekua-autocomplete | fc8b31f86d8b51f172d25e7987af4d70cdf22e2c | [
"BSD-4-Clause"
] | null | null | null | import os
from setuptools import find_packages, setup
with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:
README = readme.read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
version = {}
with open("irekua_autocompl... | 32.425532 | 89 | 0.654199 | import os
from setuptools import find_packages, setup
with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:
README = readme.read()
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
version = {}
with open("irekua_autocomplete/version.py") as fp:
exec(fp.read(... | true | true |
f7772f889497ab9fa650c27735fee9912c9c2a44 | 505 | py | Python | Cracking the Coding Interview/ctci-solutions-master/ch-01-arrays-and-strings/02-is-permutation.py | nikku1234/Code-Practise | 94eb6680ea36efd10856c377000219285f77e5a4 | [
"Apache-2.0"
] | 9 | 2020-07-02T06:06:17.000Z | 2022-02-26T11:08:09.000Z | Cracking the Coding Interview/ctci-solutions-master/ch-01-arrays-and-strings/02-is-permutation.py | nikku1234/Code-Practise | 94eb6680ea36efd10856c377000219285f77e5a4 | [
"Apache-2.0"
] | 1 | 2021-11-04T17:26:36.000Z | 2021-11-04T17:26:36.000Z | Cracking the Coding Interview/ctci-solutions-master/ch-01-arrays-and-strings/02-is-permutation.py | nikku1234/Code-Practise | 94eb6680ea36efd10856c377000219285f77e5a4 | [
"Apache-2.0"
] | 8 | 2021-01-31T10:31:12.000Z | 2022-03-13T09:15:55.000Z | # Determine whether or not one string is a permutation of another.
def is_permutation(str1, str2):
counter = Counter()
for letter in str1:
counter[letter] += 1
for letter in str2:
if not letter in counter:
return False
counter[letter] -= 1
if counter[letter] == 0:
del counter[letter]
... | 22.954545 | 66 | 0.665347 |
def is_permutation(str1, str2):
counter = Counter()
for letter in str1:
counter[letter] += 1
for letter in str2:
if not letter in counter:
return False
counter[letter] -= 1
if counter[letter] == 0:
del counter[letter]
return len(counter) == 0
class Counter(dict):
def __missing__(... | true | true |
f77730f193386d39213e3bb035d55ee70f999a68 | 925 | py | Python | learning_logs/migrations/0005_auto_20210726_1909.py | davidbezerra405/learning_log | e540fcc843d387f3484fab1db0a3b2e198ebf167 | [
"MIT"
] | null | null | null | learning_logs/migrations/0005_auto_20210726_1909.py | davidbezerra405/learning_log | e540fcc843d387f3484fab1db0a3b2e198ebf167 | [
"MIT"
] | null | null | null | learning_logs/migrations/0005_auto_20210726_1909.py | davidbezerra405/learning_log | e540fcc843d387f3484fab1db0a3b2e198ebf167 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('learning_logs', '0004_auto_20210726_1906'),
]
operations = [
migrations.CreateModel(
name='Entry',
f... | 27.205882 | 114 | 0.538378 | from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('learning_logs', '0004_auto_20210726_1906'),
]
operations = [
migrations.CreateModel(
name='Entry',
fields=[
... | true | true |
f7773130c058eca9f0c93079a3e7c06efda9b20a | 3,418 | py | Python | multinet/api/tests/conftest.py | multinet-app/multinet-api | a658d787f0fb9ba415ed85a1e37c29953486287f | [
"Apache-2.0"
] | null | null | null | multinet/api/tests/conftest.py | multinet-app/multinet-api | a658d787f0fb9ba415ed85a1e37c29953486287f | [
"Apache-2.0"
] | 91 | 2021-03-15T19:00:15.000Z | 2022-03-11T00:04:05.000Z | multinet/api/tests/conftest.py | multinet-app/multinet-api | a658d787f0fb9ba415ed85a1e37c29953486287f | [
"Apache-2.0"
] | 1 | 2022-02-05T15:53:04.000Z | 2022-02-05T15:53:04.000Z | import itertools
from typing import Optional
from django.contrib.auth.models import User
from faker import Faker
import pytest
from pytest_factoryboy import register
from rest_framework.test import APIClient
from s3_file_field.testing import S3FileFieldTestClient
from multinet.api.models import Network, Table, Worksp... | 32.245283 | 99 | 0.738151 | import itertools
from typing import Optional
from django.contrib.auth.models import User
from faker import Faker
import pytest
from pytest_factoryboy import register
from rest_framework.test import APIClient
from s3_file_field.testing import S3FileFieldTestClient
from multinet.api.models import Network, Table, Worksp... | true | true |
f77732ac86d8e2bb4a4ad556c415b8120ee5b761 | 43,526 | py | Python | strawberryfields/backends/states.py | egbQuantum/strawberryfields | 674e4fe2de5e5dd791a77f1cd219009120dcbbbf | [
"Apache-2.0"
] | null | null | null | strawberryfields/backends/states.py | egbQuantum/strawberryfields | 674e4fe2de5e5dd791a77f1cd219009120dcbbbf | [
"Apache-2.0"
] | 5 | 2020-09-26T01:27:24.000Z | 2022-02-10T02:13:49.000Z | strawberryfields/backends/states.py | egbQuantum/strawberryfields | 674e4fe2de5e5dd791a77f1cd219009120dcbbbf | [
"Apache-2.0"
] | null | null | null | # Copyright 2019 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 36.607233 | 138 | 0.598447 |
import abc
import string
from itertools import chain
from copy import copy
import numpy as np
from scipy.linalg import block_diag
from scipy.stats import multivariate_normal
from scipy.special import factorial
import strawberryfields as sf
from .shared_ops import rotation_matrix as _R
from .shared_ops import chan... | true | true |
f77732de9b7bfb1e98fd8fb47410d0ce21b7739c | 4,725 | py | Python | tests/examples/ex_rolling_chart.py | KyleKing/dash_charts | 8e3644505047fa85f3175f5bc55a2421cb0a19ea | [
"Unlicense"
] | 16 | 2020-02-22T00:51:54.000Z | 2022-03-03T21:45:51.000Z | tests/examples/ex_rolling_chart.py | KyleKing/dash_charts | 8e3644505047fa85f3175f5bc55a2421cb0a19ea | [
"Unlicense"
] | 29 | 2020-06-29T22:14:00.000Z | 2022-03-22T02:10:00.000Z | tests/examples/ex_rolling_chart.py | KyleKing/dash_charts | 8e3644505047fa85f3175f5bc55a2421cb0a19ea | [
"Unlicense"
] | 1 | 2022-02-03T09:07:07.000Z | 2022-02-03T09:07:07.000Z | """Example Rolling Mean and Filled Standard Deviation Chart."""
import dash_core_components as dcc
import dash_html_components as html
import numpy as np
import pandas as pd
import plotly.graph_objects as go
from implements import implements
from dash_charts.scatter_line_charts import RollingChart
from dash_charts.ut... | 36.346154 | 111 | 0.593439 |
import dash_core_components as dcc
import dash_html_components as html
import numpy as np
import pandas as pd
import plotly.graph_objects as go
from implements import implements
from dash_charts.scatter_line_charts import RollingChart
from dash_charts.utils_app import AppBase, AppInterface
from dash_charts.utils_call... | true | true |
f7773311211e1025cbad4937c8f36e2fedcbdcc2 | 4,343 | py | Python | scripts/models/densenet.py | hluedemann/inplace_abn | 5210ec0b38ba7c6c9deb08927aa18806ac3380f3 | [
"BSD-3-Clause"
] | 1,288 | 2017-12-08T02:49:52.000Z | 2022-03-29T23:16:21.000Z | scripts/models/densenet.py | hluedemann/inplace_abn | 5210ec0b38ba7c6c9deb08927aa18806ac3380f3 | [
"BSD-3-Clause"
] | 217 | 2017-12-11T09:53:34.000Z | 2022-03-29T03:11:23.000Z | scripts/models/densenet.py | hluedemann/inplace_abn | 5210ec0b38ba7c6c9deb08927aa18806ac3380f3 | [
"BSD-3-Clause"
] | 198 | 2017-12-07T17:32:28.000Z | 2022-03-20T10:55:09.000Z | import sys
from collections import OrderedDict
from functools import partial
import torch.nn as nn
from inplace_abn import ABN
from modules import GlobalAvgPool2d, DenseModule
from .util import try_index
class DenseNet(nn.Module):
def __init__(self,
structure,
norm_act=ABN,
... | 35.598361 | 120 | 0.537647 | import sys
from collections import OrderedDict
from functools import partial
import torch.nn as nn
from inplace_abn import ABN
from modules import GlobalAvgPool2d, DenseModule
from .util import try_index
class DenseNet(nn.Module):
def __init__(self,
structure,
norm_act=ABN,
... | true | true |
f777335c4444d2844f1f8503b61d02efe8a02bd9 | 2,713 | py | Python | data-collection/main.py | lipinoelbreve/topicos-streamlit | 849d34ee4c8f1dbd700c50a2069e87dbb6c93663 | [
"MIT"
] | null | null | null | data-collection/main.py | lipinoelbreve/topicos-streamlit | 849d34ee4c8f1dbd700c50a2069e87dbb6c93663 | [
"MIT"
] | null | null | null | data-collection/main.py | lipinoelbreve/topicos-streamlit | 849d34ee4c8f1dbd700c50a2069e87dbb6c93663 | [
"MIT"
] | null | null | null | # %%
# Recorre las 1000 paginas de articulos que podemos ver
# De cada artículo guarda:
# Url
# Id de Pubmed
# Título
# Keywords
# Lista de autores con nombres y afiliaciones y país
# El código no para hasta que lo frenes o que llegue a la página 1.000, pero cada vez que carga un artículo lo guarda, así que ... | 36.662162 | 209 | 0.734243 |
from bs4 import BeautifulSoup
import requests
import re
import numpy as np
from tqdm import tqdm
from time import sleep
import os
from Article import ArticleCollection
base_url = 'https://pubmed.ncbi.nlm.nih.gov'
filter_url = '/?term=(((%222016%22%5BDate%20-%20Publication%5D%20%3A%20%223000%22%5BDate%20-%20Publicati... | true | true |
f777335d530a089a2d72e1ef5865036d3090cb3c | 178 | py | Python | setup.py | astronouth7303/aioevents | 6efab13a828bc8d96c07b0aec29239f13d062c6e | [
"MIT"
] | 2 | 2016-09-13T05:41:37.000Z | 2017-08-02T10:46:08.000Z | setup.py | astronouth7303/aioevents | 6efab13a828bc8d96c07b0aec29239f13d062c6e | [
"MIT"
] | 1 | 2015-04-06T14:08:23.000Z | 2015-04-06T14:44:23.000Z | setup.py | astronouth7303/aioevents | 6efab13a828bc8d96c07b0aec29239f13d062c6e | [
"MIT"
] | null | null | null | from setuptools import setup, find_packages
setup(
name='aioevents',
version='0.2',
packages=['aioevents',],
license='MIT License',
# long_description=...,
)
| 17.8 | 43 | 0.646067 | from setuptools import setup, find_packages
setup(
name='aioevents',
version='0.2',
packages=['aioevents',],
license='MIT License',
)
| true | true |
f777339f82ad76c6e85ae12de60a35c63dcd3985 | 508 | py | Python | network_policy_redis/app.py | tomdee/kube-demos | 755ab136f7bde523da9e075206d99451beac290e | [
"Apache-2.0"
] | 11 | 2016-05-10T10:39:38.000Z | 2021-11-17T10:57:50.000Z | network_policy_redis/app.py | tomdee/kube-demos | 755ab136f7bde523da9e075206d99451beac290e | [
"Apache-2.0"
] | null | null | null | network_policy_redis/app.py | tomdee/kube-demos | 755ab136f7bde523da9e075206d99451beac290e | [
"Apache-2.0"
] | 6 | 2016-09-23T20:44:27.000Z | 2018-04-12T20:40:58.000Z | from flask import Flask
from redis import Redis
import os
import socket
app = Flask(__name__)
host = socket.gethostname()
@app.route('/')
def hello():
try:
redis = Redis(host='redis.demos.svc.cluster.local', port=6379, socket_connect_timeout=1)
redis.incr('hits')
except:
return "Failed ... | 26.736842 | 101 | 0.659449 | from flask import Flask
from redis import Redis
import os
import socket
app = Flask(__name__)
host = socket.gethostname()
@app.route('/')
def hello():
try:
redis = Redis(host='redis.demos.svc.cluster.local', port=6379, socket_connect_timeout=1)
redis.incr('hits')
except:
return "Failed ... | true | true |
f7773437d0fec5f5e2464c6c6f0738cb3d286ff1 | 1,412 | py | Python | GUI/code/GUI_load_config.py | jlhitt1993/pytentiostat | 8cc4364a625144ce4d73bae6407d4a0c5d1e20cd | [
"BSD-3-Clause"
] | 5 | 2019-02-08T23:39:20.000Z | 2021-07-13T19:25:11.000Z | GUI/code/GUI_load_config.py | jlhitt1993/pytentiostat | 8cc4364a625144ce4d73bae6407d4a0c5d1e20cd | [
"BSD-3-Clause"
] | 150 | 2019-02-14T18:49:56.000Z | 2021-08-25T10:31:36.000Z | GUI/code/GUI_load_config.py | jlhitt1993/pytentiostat | 8cc4364a625144ce4d73bae6407d4a0c5d1e20cd | [
"BSD-3-Clause"
] | 12 | 2019-02-07T14:21:23.000Z | 2021-11-01T16:00:30.000Z | import sys
from PySide2 import QtGui
from PySide2.QtWidgets import QApplication, QWidget, QFileDialog
class Ui_Load(QWidget):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(640, 480)
file = self.openFileNameDialog()
icon = QtGui.QIcon()
... | 33.619048 | 136 | 0.661473 | import sys
from PySide2 import QtGui
from PySide2.QtWidgets import QApplication, QWidget, QFileDialog
class Ui_Load(QWidget):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(640, 480)
file = self.openFileNameDialog()
icon = QtGui.QIcon()
... | true | true |
f7773463c2e60a3ba8f52853b93b653f86c72fcb | 7,963 | py | Python | argus_shapes/tests/test_argus_shapes.py | VisCog/ArgusShapes | ba361e28b8d30097c41314bbfe68341cc8ac0c01 | [
"BSD-3-Clause"
] | 2 | 2018-10-26T23:58:10.000Z | 2019-07-11T17:20:24.000Z | argus_shapes/tests/test_argus_shapes.py | VisCog/ArgusShapes | ba361e28b8d30097c41314bbfe68341cc8ac0c01 | [
"BSD-3-Clause"
] | 4 | 2019-04-04T18:28:41.000Z | 2019-08-31T20:28:06.000Z | argus_shapes/tests/test_argus_shapes.py | VisCog/ArgusShapes | ba361e28b8d30097c41314bbfe68341cc8ac0c01 | [
"BSD-3-Clause"
] | 3 | 2019-01-08T20:05:15.000Z | 2019-07-11T17:20:16.000Z | from __future__ import absolute_import, division, print_function
import os
import numpy as np
import pandas as pd
import shutil
import requests
import numpy.testing as npt
import pytest
import skimage.io as skio
from .. import argus_shapes as shapes
import pulse2percept.implants as p2pi
try:
FileNotFoundError
e... | 35.391111 | 79 | 0.574155 | from __future__ import absolute_import, division, print_function
import os
import numpy as np
import pandas as pd
import shutil
import requests
import numpy.testing as npt
import pytest
import skimage.io as skio
from .. import argus_shapes as shapes
import pulse2percept.implants as p2pi
try:
FileNotFoundError
e... | true | true |
f77735664e7445f85e694331db4abe641897156a | 163 | py | Python | main.py | zzxzzk115/AutoHosts | 12f05ec1c931e6c2e5c62390deea62fadadfe952 | [
"MIT"
] | null | null | null | main.py | zzxzzk115/AutoHosts | 12f05ec1c931e6c2e5c62390deea62fadadfe952 | [
"MIT"
] | null | null | null | main.py | zzxzzk115/AutoHosts | 12f05ec1c931e6c2e5c62390deea62fadadfe952 | [
"MIT"
] | null | null | null | import os
from plugins import base
system = base.get_platform()
base.init_hosts(system)
base.handle_plugins()
base.copy_host(system)
base.flush_dns(system) | 20.375 | 29 | 0.779141 | import os
from plugins import base
system = base.get_platform()
base.init_hosts(system)
base.handle_plugins()
base.copy_host(system)
base.flush_dns(system) | true | true |
f77735feb5c0d020c251dc88a6630c87a8a2e3b7 | 4,893 | py | Python | apps/core/cache/memory.py | zjjott/html | 68429832d8b022602915a267a62051f4869f430f | [
"MIT"
] | null | null | null | apps/core/cache/memory.py | zjjott/html | 68429832d8b022602915a267a62051f4869f430f | [
"MIT"
] | null | null | null | apps/core/cache/memory.py | zjjott/html | 68429832d8b022602915a267a62051f4869f430f | [
"MIT"
] | null | null | null | # coding=utf-8
from __future__ import unicode_literals
from apps.core.cache.base import CacheBase, DEFAULT_TIMEOUT
from tornado.concurrent import Future
from tornado import stack_context
from collections import deque
from tornado.ioloop import IOLoop
class LRUCache(dict):
# TODO:协程安全?
def __init__(self, maxs... | 30.773585 | 77 | 0.582669 | from __future__ import unicode_literals
from apps.core.cache.base import CacheBase, DEFAULT_TIMEOUT
from tornado.concurrent import Future
from tornado import stack_context
from collections import deque
from tornado.ioloop import IOLoop
class LRUCache(dict):
def __init__(self, maxsize, *args, **kwargs):
... | true | true |
f777364efb57c8ea685f06de7c7c7d049f18659f | 928 | py | Python | Day2/pandas-exercises-python/python-exercises-02-questions/utils/transformation_functions.py | klimpie94/Python-training | 7af210126cfe2e9386a8f22075ea0d7eff80daac | [
"RSA-MD"
] | null | null | null | Day2/pandas-exercises-python/python-exercises-02-questions/utils/transformation_functions.py | klimpie94/Python-training | 7af210126cfe2e9386a8f22075ea0d7eff80daac | [
"RSA-MD"
] | 1 | 2021-12-13T20:33:28.000Z | 2021-12-13T20:33:28.000Z | Day2/pandas-exercises-python/python-exercises-02-questions/utils/transformation_functions.py | klimpie94/Python-training | 7af210126cfe2e9386a8f22075ea0d7eff80daac | [
"RSA-MD"
] | 9 | 2020-02-05T10:24:12.000Z | 2020-02-10T13:08:50.000Z |
import pandas as pd
def read_csv_files(file_path):
return pd.read_csv(file_path)
def filter_films(dataframe):
pass
def join_categories_with_metadata(facts_df, categories_df):
# Hint: You can use lambda functions to change the id column in order to
# use join method in pandas.
pass
def categ... | 22.095238 | 76 | 0.743534 |
import pandas as pd
def read_csv_files(file_path):
return pd.read_csv(file_path)
def filter_films(dataframe):
pass
def join_categories_with_metadata(facts_df, categories_df):
pass
def categories_into_one_single_column(categories_df):
pass
def take_year_from_movie_title_string(... | true | true |
f77736f94b3e48ae05ef07fee09d8d86947077bb | 409 | py | Python | blockchain/t/t2.py | lijingmt/cherryhillcoin | 46755a719b44a5537b3cf0fe604f9f86749f1c04 | [
"MIT"
] | 1 | 2018-06-05T04:29:57.000Z | 2018-06-05T04:29:57.000Z | blockchain/t/t2.py | lijingmt/cherryhillcoin | 46755a719b44a5537b3cf0fe604f9f86749f1c04 | [
"MIT"
] | null | null | null | blockchain/t/t2.py | lijingmt/cherryhillcoin | 46755a719b44a5537b3cf0fe604f9f86749f1c04 | [
"MIT"
] | null | null | null | import shelve
if __name__ == '__main__':
s = shelve.open("22901.db")
s["name"] = "www.itdiffer.com"
s["lang"] = "python"
s["pages"] = 1000
s["contents"] = {"first":"base knowledge","second":"day day up"}
s.close()
s = shelve.open("22901.db")
name = s["name"]
print (name)
contents... | 25.5625 | 68 | 0.518337 | import shelve
if __name__ == '__main__':
s = shelve.open("22901.db")
s["name"] = "www.itdiffer.com"
s["lang"] = "python"
s["pages"] = 1000
s["contents"] = {"first":"base knowledge","second":"day day up"}
s.close()
s = shelve.open("22901.db")
name = s["name"]
print (name)
contents... | true | true |
f777392390663f6827484a0f04d713c71c8e7ce2 | 10,712 | py | Python | src/python/gem5/components/boards/x86_board.py | yclin99/CS251A_final_gem5 | 391ca1d7c9484f4d58fce9a4424821dcbb2463ac | [
"BSD-3-Clause"
] | 1 | 2022-03-25T13:18:26.000Z | 2022-03-25T13:18:26.000Z | src/python/gem5/components/boards/x86_board.py | yclin99/CS251A_final_gem5 | 391ca1d7c9484f4d58fce9a4424821dcbb2463ac | [
"BSD-3-Clause"
] | 1 | 2022-03-25T14:15:30.000Z | 2022-03-25T14:15:30.000Z | src/python/gem5/components/boards/x86_board.py | ksco/gem5-xiangshan | 0baf1b5229885d81d689a677102f0665aaac5514 | [
"BSD-3-Clause"
] | null | null | null | # Copyright (c) 2021 The Regents of the University of California
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this lis... | 33.579937 | 79 | 0.634615 |
from .kernel_disk_workload import KernelDiskWorkload
from ...resources.resource import AbstractResource
from ...utils.override import overrides
from .abstract_board import AbstractBoard
from ...isas import ISA
from m5.objects import (
Pc,
AddrRange,
X86FsLinux,
Addr,
X86SMBiosBiosInformation,
... | true | true |
f77739623bffe950db4a6c96a2bafcf200c58b89 | 8,764 | py | Python | miracle/third_party/imputation_gain.py | vanderschaarlab/MIRACLE | ec28f5051d604a3134f9379b9a63a6cc379f2bc5 | [
"BSD-3-Clause"
] | 3 | 2021-11-10T10:00:18.000Z | 2021-12-31T08:28:03.000Z | miracle/third_party/imputation_gain.py | vanderschaarlab/MIRACLE | ec28f5051d604a3134f9379b9a63a6cc379f2bc5 | [
"BSD-3-Clause"
] | null | null | null | miracle/third_party/imputation_gain.py | vanderschaarlab/MIRACLE | ec28f5051d604a3134f9379b9a63a6cc379f2bc5 | [
"BSD-3-Clause"
] | null | null | null | # stdlib
from typing import Tuple, Union
# third party
import numpy as np
from sklearn.base import TransformerMixin
# Necessary packages
import torch
from torch import nn
EPS = 1e-8
DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cpu")
def sample_Z(m: int, n: int) -> np.ndarray:
"""Random samp... | 28.36246 | 139 | 0.560018 | from typing import Tuple, Union
import numpy as np
from sklearn.base import TransformerMixin
import torch
from torch import nn
EPS = 1e-8
DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cpu")
def sample_Z(m: int, n: int) -> np.ndarray:
res = np.random.uniform(0.0, 0.01, size=[m, n])
return... | true | true |
f77739c0fcee7a3706072d69f0025ae9598a65a8 | 1,420 | py | Python | src/test/resources/docker/initialize/xld_initialize.py | xebialabs-community/xld-duckcreek-plugin | f71372fb657a752a64139a6263e77b3fbb428439 | [
"MIT"
] | 1 | 2017-08-06T11:31:27.000Z | 2017-08-06T11:31:27.000Z | src/test/resources/docker/initialize/xld_initialize.py | xebialabs-community/xld-duckcreek-plugin | f71372fb657a752a64139a6263e77b3fbb428439 | [
"MIT"
] | null | null | null | src/test/resources/docker/initialize/xld_initialize.py | xebialabs-community/xld-duckcreek-plugin | f71372fb657a752a64139a6263e77b3fbb428439 | [
"MIT"
] | null | null | null | #
# THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS
# FOR A PARTICULAR PURPOSE. THIS CODE AND INFORMATION ARE NOT SUPPORTED BY XEBIALABS.
#
import os
from java.io import Fi... | 33.023256 | 98 | 0.715493 |
import os
from java.io import File, FileInputStream, FileOutputStream
from java.util.zip import ZipEntry, ZipOutputStream
from jarray import zeros
def zipdir(basedir, archivename):
assert os.path.isdir(basedir)
fos = FileOutputStream(archivename)
zos = ZipOutputStream(fos)
add_folder(zos, basedir, ba... | true | true |
f7773aff4fff97b6437b2c9c31925a35a1e6766c | 16,136 | py | Python | tensorflow/contrib/distribute/python/metrics_v1_test.py | zpreisler/tensorflow | f2b17b22e12bd743b66945070f338f70b5fa3332 | [
"Apache-2.0"
] | 1 | 2020-10-06T14:53:32.000Z | 2020-10-06T14:53:32.000Z | tensorflow/contrib/distribute/python/metrics_v1_test.py | zpreisler/tensorflow | f2b17b22e12bd743b66945070f338f70b5fa3332 | [
"Apache-2.0"
] | null | null | null | tensorflow/contrib/distribute/python/metrics_v1_test.py | zpreisler/tensorflow | f2b17b22e12bd743b66945070f338f70b5fa3332 | [
"Apache-2.0"
] | null | null | null | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 36.589569 | 80 | 0.656606 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl.testing import parameterized
from tensorflow.contrib.distribute.python import combinations
from tensorflow.python.data.ops import dataset_ops
from tensorflow.python.eager import test
from tensorflow.... | true | true |
f7773b45c0e2df46002da1bcfcb27e91568b389a | 15,250 | py | Python | sedfitter/models.py | keflavich/sedfitter | ec8722ec423ac684e4930fe23a98cd7b2d5b9f50 | [
"BSD-2-Clause"
] | null | null | null | sedfitter/models.py | keflavich/sedfitter | ec8722ec423ac684e4930fe23a98cd7b2d5b9f50 | [
"BSD-2-Clause"
] | null | null | null | sedfitter/models.py | keflavich/sedfitter | ec8722ec423ac684e4930fe23a98cd7b2d5b9f50 | [
"BSD-2-Clause"
] | 1 | 2017-09-16T18:38:13.000Z | 2017-09-16T18:38:13.000Z | from __future__ import print_function, division
import os
import numpy as np
from astropy.table import Table
from astropy import units as u
from .convolved_fluxes import ConvolvedFluxes, MonochromaticFluxes
from . import fitting_routines as f
from .utils import parfile
from .utils.validator import validate_array
fro... | 35.798122 | 135 | 0.541049 | from __future__ import print_function, division
import os
import numpy as np
from astropy.table import Table
from astropy import units as u
from .convolved_fluxes import ConvolvedFluxes, MonochromaticFluxes
from . import fitting_routines as f
from .utils import parfile
from .utils.validator import validate_array
fro... | true | true |
f7773c67e85b2e4bc8be5cdddf63276f3c69592f | 6,209 | py | Python | dhound.py | vishwaraj/droidhound | 18d297b4b539b1d96068594341440a327bc8a004 | [
"MIT"
] | null | null | null | dhound.py | vishwaraj/droidhound | 18d297b4b539b1d96068594341440a327bc8a004 | [
"MIT"
] | null | null | null | dhound.py | vishwaraj/droidhound | 18d297b4b539b1d96068594341440a327bc8a004 | [
"MIT"
] | null | null | null | import os
import requests
import argparse
import time
import schedule
from bs4 import BeautifulSoup
import sys
from sys import platform
from config import push_msg
print """
___ __ __
/ _ \ / / ___ __ _____ ___/ /
/ // / / _ \/ _ \/ // / _ \/ _ /
/____/ /_//_/\___/\_,_... | 25.137652 | 125 | 0.69206 | import os
import requests
import argparse
import time
import schedule
from bs4 import BeautifulSoup
import sys
from sys import platform
from config import push_msg
print """
___ __ __
/ _ \ / / ___ __ _____ ___/ /
/ // / / _ \/ _ \/ // / _ \/ _ /
/____/ /_//_/\___/\_,_... | false | true |
f7773cc1a1b0d350353c7c560ab2eb7d2eedb566 | 10,319 | py | Python | rasa/nlu/featurizers/sparse_featurizer/regex_featurizer.py | Next-Trends/rasa | c06dc26b3a57dd1114b60aebcc9ccd3bbb8308d7 | [
"Apache-2.0"
] | 1 | 2022-01-29T09:09:54.000Z | 2022-01-29T09:09:54.000Z | rasa/nlu/featurizers/sparse_featurizer/regex_featurizer.py | Next-Trends/rasa | c06dc26b3a57dd1114b60aebcc9ccd3bbb8308d7 | [
"Apache-2.0"
] | 30 | 2022-02-07T01:20:20.000Z | 2022-03-28T12:20:50.000Z | rasa/nlu/featurizers/sparse_featurizer/regex_featurizer.py | Next-Trends/rasa | c06dc26b3a57dd1114b60aebcc9ccd3bbb8308d7 | [
"Apache-2.0"
] | 1 | 2022-03-12T09:24:53.000Z | 2022-03-12T09:24:53.000Z | from __future__ import annotations
import logging
import re
from typing import Any, Dict, List, Optional, Text, Tuple, Type
import numpy as np
import scipy.sparse
from rasa.nlu.tokenizers.tokenizer import Tokenizer
import rasa.shared.utils.io
import rasa.utils.io
import rasa.nlu.utils.pattern_utils as pattern_utils
fr... | 38.077491 | 88 | 0.642407 | from __future__ import annotations
import logging
import re
from typing import Any, Dict, List, Optional, Text, Tuple, Type
import numpy as np
import scipy.sparse
from rasa.nlu.tokenizers.tokenizer import Tokenizer
import rasa.shared.utils.io
import rasa.utils.io
import rasa.nlu.utils.pattern_utils as pattern_utils
fr... | true | true |
f7773e04f43320ad2e006f265cb354bd7f8f705e | 352 | py | Python | __init__.py | wamsachel/skill-playground-skill | 8af378d5f8553770d2b8f50d8614a1ae5443b921 | [
"MIT"
] | null | null | null | __init__.py | wamsachel/skill-playground-skill | 8af378d5f8553770d2b8f50d8614a1ae5443b921 | [
"MIT"
] | null | null | null | __init__.py | wamsachel/skill-playground-skill | 8af378d5f8553770d2b8f50d8614a1ae5443b921 | [
"MIT"
] | null | null | null | from mycroft import MycroftSkill, intent_file_handler
class SkillPlayground(MycroftSkill):
def __init__(self):
MycroftSkill.__init__(self)
@intent_file_handler('playground.skill.intent')
def handle_playground_skill(self, message):
self.speak_dialog('playground.skill')
def create_skill()... | 22 | 53 | 0.747159 | from mycroft import MycroftSkill, intent_file_handler
class SkillPlayground(MycroftSkill):
def __init__(self):
MycroftSkill.__init__(self)
@intent_file_handler('playground.skill.intent')
def handle_playground_skill(self, message):
self.speak_dialog('playground.skill')
def create_skill()... | true | true |
f7773e379ca72dd3fec2dba17051bec4bae860cc | 991 | py | Python | tests/formatters/appusage.py | berggren/plaso | 2658c80c5076f97a9a27272e73997bde8c39e875 | [
"Apache-2.0"
] | 27 | 2019-04-05T12:01:49.000Z | 2022-02-08T02:26:25.000Z | tests/formatters/appusage.py | berggren/plaso | 2658c80c5076f97a9a27272e73997bde8c39e875 | [
"Apache-2.0"
] | null | null | null | tests/formatters/appusage.py | berggren/plaso | 2658c80c5076f97a9a27272e73997bde8c39e875 | [
"Apache-2.0"
] | 8 | 2019-11-28T08:06:34.000Z | 2020-08-29T13:53:30.000Z | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for the MacOS application usage event formatter."""
from __future__ import unicode_literals
import unittest
from plaso.formatters import appusage
from tests.formatters import test_lib
class ApplicationUsageFormatterTest(test_lib.EventFormatterTestCase):
""... | 26.783784 | 69 | 0.758829 |
from __future__ import unicode_literals
import unittest
from plaso.formatters import appusage
from tests.formatters import test_lib
class ApplicationUsageFormatterTest(test_lib.EventFormatterTestCase):
def testInitialization(self):
event_formatter = appusage.ApplicationUsageFormatter()
self.assertIsNot... | true | true |
f7773e4186f5cb3cef6d85f6319339b5970e5d95 | 477 | py | Python | Common/Core/Testing/Python/TestIgnoreBTX.py | michaelchanwahyan/vtk-7.0.0 | 770166bbe1f28a99d776b47624c6f6955b9aaaec | [
"BSD-3-Clause"
] | 1 | 2019-04-22T09:09:17.000Z | 2019-04-22T09:09:17.000Z | Common/Core/Testing/Python/TestIgnoreBTX.py | michaelchanwahyan/vtk-7.0.0 | 770166bbe1f28a99d776b47624c6f6955b9aaaec | [
"BSD-3-Clause"
] | null | null | null | Common/Core/Testing/Python/TestIgnoreBTX.py | michaelchanwahyan/vtk-7.0.0 | 770166bbe1f28a99d776b47624c6f6955b9aaaec | [
"BSD-3-Clause"
] | 1 | 2020-06-23T09:33:24.000Z | 2020-06-23T09:33:24.000Z | """Test VTK_IGNORE_BTX setting to ensure that it is ON
"""
import sys
import vtk
from vtk.test import Testing
class TestIgnoreBTX(Testing.vtkTest):
def testIgnoreBTX(self):
"""Try to call a method that is BTX'd, to ensure VTK_IGNORE_BTX=ON
"""
stringArray = vtk.vtkStringArray()
in... | 25.105263 | 74 | 0.685535 |
import sys
import vtk
from vtk.test import Testing
class TestIgnoreBTX(Testing.vtkTest):
def testIgnoreBTX(self):
stringArray = vtk.vtkStringArray()
information = vtk.vtkInformation()
stringArray.CopyInformation(information, 0)
if __name__ == "__main__":
Testing.main([(TestIgnoreBTX,... | true | true |
f7773e7dcc890e5b46e1d9c1911abd8c14902682 | 2,980 | py | Python | venv/Lib/site-packages/github/tests/Issue134.py | adamlkl/GithubDataVisualisation | 94dbdb3411fd41e325b03f17e171509fb64c8696 | [
"MIT"
] | 2 | 2018-10-04T06:12:38.000Z | 2021-08-02T16:39:12.000Z | venv/Lib/site-packages/github/tests/Issue134.py | adamlkl/GithubDataVisualisation | 94dbdb3411fd41e325b03f17e171509fb64c8696 | [
"MIT"
] | null | null | null | venv/Lib/site-packages/github/tests/Issue134.py | adamlkl/GithubDataVisualisation | 94dbdb3411fd41e325b03f17e171509fb64c8696 | [
"MIT"
] | 1 | 2021-11-05T22:16:58.000Z | 2021-11-05T22:16:58.000Z | # -*- coding: utf-8 -*-
############################ Copyrights and license ############################
# #
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
# Copyright 2014 Vincent Jacques <vincent@vincent-ja... | 60.816327 | 141 | 0.495973 |
from . import Framework
import github
class Issue134(Framework.BasicTestCase): def testGetAuthorizationsFailsWhenAutenticatedThroughOAuth(self):
g = github.Github(self.oauth_token)
with self.assertRaises(github.GithubException) as raisedexp:
list(g.get_user().get_authorizations())
... | true | true |
f7773f63aa8c20a6fd134bacd9174ac5314ff259 | 19,582 | py | Python | tests/models/test_restore.py | arnaudgelas/pytorch-lightning | cc624358c8e396e966f9c51b3010f6a986047fc6 | [
"Apache-2.0"
] | null | null | null | tests/models/test_restore.py | arnaudgelas/pytorch-lightning | cc624358c8e396e966f9c51b3010f6a986047fc6 | [
"Apache-2.0"
] | null | null | null | tests/models/test_restore.py | arnaudgelas/pytorch-lightning | cc624358c8e396e966f9c51b3010f6a986047fc6 | [
"Apache-2.0"
] | null | null | null | # Copyright The PyTorch Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | 35.030411 | 116 | 0.714432 | import glob
import logging as log
import os
import pickle
from copy import deepcopy
import cloudpickle
import pytest
import torch
from torch.nn import functional as F
from torch.utils.data import DataLoader
import tests.base.develop_pipelines as tpipes
import tests.base.develop_utils as tutils
from pytorch_lightning ... | true | true |
f7773ffc36e5e0d966a703e6e7424d58cafbcd86 | 296 | py | Python | Repositories/Raspbian/start05.py | Dong-gi/Dong-gi.github.io | 2c3d083db72e06032a1daf528ee9b175219aa554 | [
"MIT"
] | 5 | 2018-02-27T16:19:35.000Z | 2020-08-25T13:09:49.000Z | Repositories/Raspbian/start05.py | Dong-gi/Dong-gi.github.io | 2c3d083db72e06032a1daf528ee9b175219aa554 | [
"MIT"
] | 25 | 2019-03-28T00:36:04.000Z | 2021-08-12T01:42:41.000Z | Repositories/Raspbian/start05.py | Dong-gi/Dong-gi.github.io | 2c3d083db72e06032a1daf528ee9b175219aa554 | [
"MIT"
] | 1 | 2021-11-28T11:28:29.000Z | 2021-11-28T11:28:29.000Z | import time
import picamera
with picamera.PiCamera() as cam:
cam.resolution = (2592, 1944)
cam.start_preview()
time.sleep(1)
cam.exif_tags['IFD0.Artist'] = 'Me!'
cam.exif_tags['IFD0.Copyright'] = 'Copyright (c) 2013 Me!'
cam.capture('start05.jpg')
cam.stop_preview()
| 24.666667 | 62 | 0.662162 | import time
import picamera
with picamera.PiCamera() as cam:
cam.resolution = (2592, 1944)
cam.start_preview()
time.sleep(1)
cam.exif_tags['IFD0.Artist'] = 'Me!'
cam.exif_tags['IFD0.Copyright'] = 'Copyright (c) 2013 Me!'
cam.capture('start05.jpg')
cam.stop_preview()
| true | true |
f7774055cf46ad87e27727416c288c0e37244488 | 750 | py | Python | tests/basics/async_with.py | sebastien-riou/micropython | 116c15842fd48ddb77b0bc016341d936a0756573 | [
"MIT"
] | 13,648 | 2015-01-01T01:34:51.000Z | 2022-03-31T16:19:53.000Z | tests/basics/async_with.py | sebastien-riou/micropython | 116c15842fd48ddb77b0bc016341d936a0756573 | [
"MIT"
] | 7,092 | 2015-01-01T07:59:11.000Z | 2022-03-31T23:52:18.000Z | tests/basics/async_with.py | sebastien-riou/micropython | 116c15842fd48ddb77b0bc016341d936a0756573 | [
"MIT"
] | 4,942 | 2015-01-02T11:48:50.000Z | 2022-03-31T19:57:10.000Z | # test simple async with execution
class AContext:
async def __aenter__(self):
print('enter')
return 1
async def __aexit__(self, exc_type, exc, tb):
print('exit', exc_type, exc)
async def f():
async with AContext():
print('body')
o = f()
try:
o.send(None)
except StopIt... | 18.75 | 73 | 0.628 |
class AContext:
async def __aenter__(self):
print('enter')
return 1
async def __aexit__(self, exc_type, exc, tb):
print('exit', exc_type, exc)
async def f():
async with AContext():
print('body')
o = f()
try:
o.send(None)
except StopIteration:
print('finished')
asy... | true | true |
f7774123722cf6a3c58850f3acdcd3a86633ed7d | 2,275 | py | Python | openstack_dashboard/urls.py | KUoslab/Stella_Horizon | b8b4308cee2c755398c4ac67d8b3bad9dfbe1b46 | [
"Apache-2.0"
] | 37 | 2018-10-30T02:47:24.000Z | 2021-12-04T10:29:40.000Z | openstack_dashboard/urls.py | yeonhooy/Stella_Horizon | b8b4308cee2c755398c4ac67d8b3bad9dfbe1b46 | [
"Apache-2.0"
] | null | null | null | openstack_dashboard/urls.py | yeonhooy/Stella_Horizon | b8b4308cee2c755398c4ac67d8b3bad9dfbe1b46 | [
"Apache-2.0"
] | 35 | 2018-11-26T03:36:31.000Z | 2021-12-04T10:29:41.000Z | # Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the... | 35.546875 | 78 | 0.756923 |
from django.conf import settings
from django.conf.urls import include
from django.conf.urls.static import static
from django.conf.urls import url
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.views import defaults
import horizon
import horizon.base
from horizon.browsers import views... | true | true |
f777412a4c0316c0c5fb4b095edf75f7928cc745 | 2,248 | py | Python | magenta/common/nade_test.py | fanzhiyan/magenta | 622c47c19bb84c6f57b286ed03b738516b2f27d6 | [
"Apache-2.0"
] | 16 | 2016-09-02T04:59:30.000Z | 2022-01-11T10:38:29.000Z | magenta/common/nade_test.py | fanzhiyan/magenta | 622c47c19bb84c6f57b286ed03b738516b2f27d6 | [
"Apache-2.0"
] | 2 | 2016-09-25T16:39:59.000Z | 2016-11-18T17:43:41.000Z | magenta/common/nade_test.py | fanzhiyan/magenta | 622c47c19bb84c6f57b286ed03b738516b2f27d6 | [
"Apache-2.0"
] | 10 | 2016-09-02T04:59:32.000Z | 2021-09-29T06:57:24.000Z | # Copyright 2019 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | 38.101695 | 77 | 0.726868 |
from magenta.common.nade import Nade
import tensorflow as tf
class NadeTest(tf.test.TestCase):
def testInternalBias(self):
batch_size = 4
num_hidden = 6
num_dims = 8
test_inputs = tf.random_normal(shape=(batch_size, num_dims))
nade = Nade(num_dims, num_hidden, internal_bias=True)
log_prob... | true | true |
f777415cdc7f6a067fc12a34d17bdff236a11374 | 1,059 | py | Python | sensor/src/get_metrics_test.py | tubone24/raspi_plant_checker | e80ccd61c50cbba883f4af8fafafc0404bdf8978 | [
"MIT"
] | null | null | null | sensor/src/get_metrics_test.py | tubone24/raspi_plant_checker | e80ccd61c50cbba883f4af8fafafc0404bdf8978 | [
"MIT"
] | null | null | null | sensor/src/get_metrics_test.py | tubone24/raspi_plant_checker | e80ccd61c50cbba883f4af8fafafc0404bdf8978 | [
"MIT"
] | 1 | 2021-12-03T05:28:20.000Z | 2021-12-03T05:28:20.000Z | from gql import gql, Client
from gql.transport.requests import RequestsHTTPTransport
import requests
from datetime import datetime, timedelta, timezone
import os
from os.path import join, dirname
from dotenv import load_dotenv
dotenv_path = join(dirname(__file__), "../../", '.env')
load_dotenv(dotenv_path)
RASPI_URL ... | 21.18 | 56 | 0.585458 | from gql import gql, Client
from gql.transport.requests import RequestsHTTPTransport
import requests
from datetime import datetime, timedelta, timezone
import os
from os.path import join, dirname
from dotenv import load_dotenv
dotenv_path = join(dirname(__file__), "../../", '.env')
load_dotenv(dotenv_path)
RASPI_URL ... | true | true |
f77741f0ba57e9c40ace330415e60603215a32d4 | 4,411 | py | Python | test/functional/p2p_invalid_block.py | minerscore/Ritocoin | cf4e1570b2bab487b9a70f2e8cf6f98fb42fd4b7 | [
"MIT"
] | 18 | 2018-11-30T19:07:06.000Z | 2021-05-17T11:06:12.000Z | test/functional/p2p_invalid_block.py | minerscore/Ritocoin | cf4e1570b2bab487b9a70f2e8cf6f98fb42fd4b7 | [
"MIT"
] | 1 | 2018-12-08T19:41:43.000Z | 2018-12-08T19:41:43.000Z | test/functional/p2p_invalid_block.py | minerscore/Ritocoin | cf4e1570b2bab487b9a70f2e8cf6f98fb42fd4b7 | [
"MIT"
] | 17 | 2018-11-30T17:16:21.000Z | 2021-10-30T17:33:14.000Z | #!/usr/bin/env python3
# Copyright (c) 2018 The Bitcoin Core developers
# Copyright (c) 2017 The Raven Core developers
# Copyright (c) 2018 The Rito Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test node respo... | 37.067227 | 100 | 0.657221 |
from test_framework.test_framework import ComparisonTestFramework
from test_framework.util import *
from test_framework.comptool import TestManager, TestInstance, RejectResult
from test_framework.blocktools import *
import copy
import time
class InvalidBlockRequestTest(ComparisonTestFramework):
def set_test_para... | true | true |
f77742286660ee50c7a44e240537db61ad9ec694 | 4,105 | py | Python | src/trainers/lstm_attn_trainer.py | paxtonedgar/MisInfo | 81b32fa3e7d0d204feb83e10169093f45727a2ea | [
"MIT"
] | null | null | null | src/trainers/lstm_attn_trainer.py | paxtonedgar/MisInfo | 81b32fa3e7d0d204feb83e10169093f45727a2ea | [
"MIT"
] | null | null | null | src/trainers/lstm_attn_trainer.py | paxtonedgar/MisInfo | 81b32fa3e7d0d204feb83e10169093f45727a2ea | [
"MIT"
] | null | null | null |
import torch
import numpy as np
from src.trainers.base_trainer import BaseTrainer
from src.evaluation.metrics import Metrics
class LSTMAttnTrainer(BaseTrainer):
"""
Trainer class. Optimizer is by default handled by BaseTrainer.
"""
def __init__(self, model, config):
super(LSTMAttnTrainer, s... | 34.208333 | 80 | 0.555664 |
import torch
import numpy as np
from src.trainers.base_trainer import BaseTrainer
from src.evaluation.metrics import Metrics
class LSTMAttnTrainer(BaseTrainer):
def __init__(self, model, config):
super(LSTMAttnTrainer, self).__init__(model, config)
self._log_interval = config['log_interval']
... | true | true |
f77742587b1a3561875584f3c16b8b6fd103a42f | 24,600 | py | Python | HPCrunScripts/PS_DeterministicNowcast_parallel_advection_24h.py | RubenImhoff/Large_Sample_Nowcasting_Evaluation | b2d8500261881a749a8f20815b7e2b0b9b69c4f7 | [
"BSD-3-Clause",
"MIT"
] | null | null | null | HPCrunScripts/PS_DeterministicNowcast_parallel_advection_24h.py | RubenImhoff/Large_Sample_Nowcasting_Evaluation | b2d8500261881a749a8f20815b7e2b0b9b69c4f7 | [
"BSD-3-Clause",
"MIT"
] | null | null | null | HPCrunScripts/PS_DeterministicNowcast_parallel_advection_24h.py | RubenImhoff/Large_Sample_Nowcasting_Evaluation | b2d8500261881a749a8f20815b7e2b0b9b69c4f7 | [
"BSD-3-Clause",
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Created on Thu Jan 17 07:41:32 2019
Deterministic nowcast with pySTEPS, with extraction of results per catchment.
Based on the input data for the Ensemble nowcast, but without any ensembles.
Make sure to change the initial part to your case.
Note that this script assumes that the catchm... | 45.555556 | 717 | 0.515285 |
from osgeo import gdal
from osgeo import gdal_array
from osgeo import ogr, osr
import os
os.environ['PROJ_LIB'] = r'/u/imhof_rn/anaconda3/pkgs/proj4-5.2.0-h470a237_1/share/proj'
import mkl
mkl.set_num_threads(1)
import datetime
import netCDF4
import numpy as np
import pprint
import sys
import time
import pysteps a... | true | true |
f777425c4e09bb72612f75213be61832efdea537 | 98 | py | Python | tests/test_ti4_map_generator.py | HelianLiadon/ti4-map-generator | aa8de65beae5db3d70509dbba3020a50c2394b19 | [
"MIT"
] | null | null | null | tests/test_ti4_map_generator.py | HelianLiadon/ti4-map-generator | aa8de65beae5db3d70509dbba3020a50c2394b19 | [
"MIT"
] | null | null | null | tests/test_ti4_map_generator.py | HelianLiadon/ti4-map-generator | aa8de65beae5db3d70509dbba3020a50c2394b19 | [
"MIT"
] | null | null | null | from ti4_map_generator import __version__
def test_version():
assert __version__ == '0.1.0'
| 16.333333 | 41 | 0.744898 | from ti4_map_generator import __version__
def test_version():
assert __version__ == '0.1.0'
| true | true |
f77742b1eb86f4be8120436f9142175da380d2d0 | 144 | py | Python | Curso Python Completo - Udemy/py/MeusModulos/ContaCorrente.py | Cauenumo/Python | 6414ee2013c651e9d45cd328a381a476c6c9073b | [
"Apache-2.0"
] | null | null | null | Curso Python Completo - Udemy/py/MeusModulos/ContaCorrente.py | Cauenumo/Python | 6414ee2013c651e9d45cd328a381a476c6c9073b | [
"Apache-2.0"
] | null | null | null | Curso Python Completo - Udemy/py/MeusModulos/ContaCorrente.py | Cauenumo/Python | 6414ee2013c651e9d45cd328a381a476c6c9073b | [
"Apache-2.0"
] | null | null | null | def credit(valor):
return ('Valor créditado R${:.2f}'.format(valor))
def debit(valor):
return('Valor debitado R${:.2f}'.format(valor))
| 24 | 53 | 0.652778 | def credit(valor):
return ('Valor créditado R${:.2f}'.format(valor))
def debit(valor):
return('Valor debitado R${:.2f}'.format(valor))
| true | true |
f77742b76944e5596edcc4a82f371f19961a4c54 | 19,180 | py | Python | gensrc/script/gen_vector_functions.py | bingzxy/incubator-doris | 1ba20b1dbb4310c72f55f7834938e6ca40b21026 | [
"Apache-2.0"
] | 3 | 2022-02-10T02:54:42.000Z | 2022-02-16T04:13:25.000Z | gensrc/script/gen_vector_functions.py | bingzxy/incubator-doris | 1ba20b1dbb4310c72f55f7834938e6ca40b21026 | [
"Apache-2.0"
] | 2 | 2018-08-27T07:42:21.000Z | 2018-08-29T06:37:41.000Z | gensrc/script/gen_vector_functions.py | bingzxy/incubator-doris | 1ba20b1dbb4310c72f55f7834938e6ca40b21026 | [
"Apache-2.0"
] | 1 | 2022-02-28T09:53:30.000Z | 2022-02-28T09:53:30.000Z | #!/usr/bin/env python
# encoding: utf-8
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Ver... | 33.70826 | 131 | 0.526277 |
import string
import os
import errno
filter_binary_op = string.Template("\
bool VectorComputeFunctions::${fn_signature}(\n\
Expr* expr, VectorizedRowBatch* batch) {\n\
int n = batch->size();\n\
if (0 == n) {\n\
return false;\n\
}\n\
int* sel = batch->selected();\n\
Expr* op1 = ex... | true | true |
f77742d2da9189d2e2a9edea395cbbafdb074e70 | 304 | py | Python | experiments/priv_fair/aux/create_offset_sizes.py | lxuechen/swissknife | 43dbd36f1e998ebe29c0b85fafd0de765dfb5de8 | [
"MIT"
] | 1 | 2022-02-25T00:00:30.000Z | 2022-02-25T00:00:30.000Z | experiments/priv_fair/aux/create_offset_sizes.py | lxuechen/swissknife | 43dbd36f1e998ebe29c0b85fafd0de765dfb5de8 | [
"MIT"
] | null | null | null | experiments/priv_fair/aux/create_offset_sizes.py | lxuechen/swissknife | 43dbd36f1e998ebe29c0b85fafd0de765dfb5de8 | [
"MIT"
] | null | null | null | """Create json files for offsets."""
from swissknife import utils
# Only give the majority some advantage.
for size in (10, 20, 50, 100, 200, 500, 1000, 2000,):
size_str = utils.int2str(size)
path = utils.join(".", f'offset_sizes_{size_str}.json')
utils.jdump(
{0: size}, path
)
| 27.636364 | 59 | 0.644737 | from swissknife import utils
for size in (10, 20, 50, 100, 200, 500, 1000, 2000,):
size_str = utils.int2str(size)
path = utils.join(".", f'offset_sizes_{size_str}.json')
utils.jdump(
{0: size}, path
)
| true | true |
f777442443050c6982d8a641cbcd8bfa31ecb23a | 558 | py | Python | output/models/nist_data/atomic/date/schema_instance/nistschema_sv_iv_atomic_date_min_inclusive_4_xsd/nistschema_sv_iv_atomic_date_min_inclusive_4.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | 1 | 2021-08-14T17:59:21.000Z | 2021-08-14T17:59:21.000Z | output/models/nist_data/atomic/date/schema_instance/nistschema_sv_iv_atomic_date_min_inclusive_4_xsd/nistschema_sv_iv_atomic_date_min_inclusive_4.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | 4 | 2020-02-12T21:30:44.000Z | 2020-04-15T20:06:46.000Z | output/models/nist_data/atomic/date/schema_instance/nistschema_sv_iv_atomic_date_min_inclusive_4_xsd/nistschema_sv_iv_atomic_date_min_inclusive_4.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | null | null | null | from dataclasses import dataclass, field
from typing import Optional
from xsdata.models.datatype import XmlDate
__NAMESPACE__ = "NISTSchema-SV-IV-atomic-date-minInclusive-4-NS"
@dataclass
class NistschemaSvIvAtomicDateMinInclusive4:
class Meta:
name = "NISTSchema-SV-IV-atomic-date-minInclusive-4"
... | 26.571429 | 68 | 0.679211 | from dataclasses import dataclass, field
from typing import Optional
from xsdata.models.datatype import XmlDate
__NAMESPACE__ = "NISTSchema-SV-IV-atomic-date-minInclusive-4-NS"
@dataclass
class NistschemaSvIvAtomicDateMinInclusive4:
class Meta:
name = "NISTSchema-SV-IV-atomic-date-minInclusive-4"
... | true | true |
f77745aacb969dfad28b2b4ef20bef631bfae07c | 1,696 | py | Python | lfp_atn_simuran/batch_params/CSR6-openfield.py | cafalchio/lfp_atn | ae2166f9d0356adc7f5eb3726b39af2a129c89f1 | [
"MIT"
] | 1 | 2021-09-14T11:22:29.000Z | 2021-09-14T11:22:29.000Z | lfp_atn_simuran/batch_params/CSR6-openfield.py | cafalchio/lfp_atn | ae2166f9d0356adc7f5eb3726b39af2a129c89f1 | [
"MIT"
] | null | null | null | lfp_atn_simuran/batch_params/CSR6-openfield.py | cafalchio/lfp_atn | ae2166f9d0356adc7f5eb3726b39af2a129c89f1 | [
"MIT"
] | 1 | 2021-03-11T17:07:52.000Z | 2021-03-11T17:07:52.000Z | """simuran_batch_params.py describes behaviour for recursing through directories."""
import os
# Where to start running batch analysis from
start_dir = os.path.abspath(os.path.join("__dirname__", "CSR6"))
# regex_filters should be a list of regex patterns to match against.
regex_filters = ["(^small.*/.*[1-9]/S1.*)|(... | 33.92 | 84 | 0.748231 |
import os
start_dir = os.path.abspath(os.path.join("__dirname__", "CSR6"))
regex_filters = ["(^small.*/.*[1-9]/S1.*)|(^screen.*/.*[1-9])"]
overwrite = True
only_check = False
interactive = False
mapping = {}
directory = "__thisdirname__"
mapping_file = os.path.abspath(
os.path.join(directory, "..", "record... | true | true |
f777461e42d8b7434726f8bf7db4b375247b21e0 | 14,126 | py | Python | test/ao/sparsity/test_pruner.py | xiaohanhuang/pytorch | a31aea8eaa99a5ff72b5d002c206cd68d5467a5e | [
"Intel"
] | 183 | 2018-04-06T21:10:36.000Z | 2022-03-30T15:05:24.000Z | test/ao/sparsity/test_pruner.py | xiaohanhuang/pytorch | a31aea8eaa99a5ff72b5d002c206cd68d5467a5e | [
"Intel"
] | 818 | 2020-02-07T02:36:44.000Z | 2022-03-31T23:49:44.000Z | test/ao/sparsity/test_pruner.py | xiaohanhuang/pytorch | a31aea8eaa99a5ff72b5d002c206cd68d5467a5e | [
"Intel"
] | 58 | 2018-06-05T16:40:18.000Z | 2022-03-16T15:37:29.000Z | # -*- coding: utf-8 -*-
# Owner(s): ["module: unknown"]
import copy
import logging
import torch
from torch import nn
from torch.ao.sparsity import BasePruner, PruningParametrization, ZeroesParametrization
from torch.nn.utils import parametrize
from torch.testing._internal.common_utils import TestCase
logging.basic... | 35.852792 | 115 | 0.595852 |
import copy
import logging
import torch
from torch import nn
from torch.ao.sparsity import BasePruner, PruningParametrization, ZeroesParametrization
from torch.nn.utils import parametrize
from torch.testing._internal.common_utils import TestCase
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - ... | true | true |
f7774625002539f0d3a9dfe1c73b97b4493f7131 | 668 | py | Python | src/adafruit-circuitpython-bundle-4.x-mpy-20190713/examples/simpleio_map_range_demo.py | mbaaba/solar_panel | 42059d8c61320494ad1298065dbc50cd9b3bd51e | [
"MIT"
] | 1 | 2020-04-13T16:10:53.000Z | 2020-04-13T16:10:53.000Z | infra/libs-400rc2-20190512/examples/simpleio_map_range_demo.py | jadudm/feather-isa | b7419e6698c3f64be4d8122656eb8124631ca859 | [
"MIT"
] | null | null | null | infra/libs-400rc2-20190512/examples/simpleio_map_range_demo.py | jadudm/feather-isa | b7419e6698c3f64be4d8122656eb8124631ca859 | [
"MIT"
] | null | null | null | """
'map_range_demo.py'.
=================================================
maps a number from one range to another
"""
import time
import simpleio
while True:
sensor_value = 150
# Map the sensor's range from 0<=sensor_value<=255 to 0<=sensor_value<=1023
print('original sensor value: ', senso... | 29.043478 | 80 | 0.625749 | import time
import simpleio
while True:
sensor_value = 150
print('original sensor value: ', sensor_value)
mapped_value = simpleio.map_range(sensor_value, 0, 255, 0, 1023)
print('mapped sensor value: ', mapped_value)
time.sleep(2)
# Map the new sensor value back to the old range... | true | true |
f777465a8cf386aadbc0faf012831f2c40055299 | 20,474 | py | Python | src/biokbase/narrative/common/log_proxy.py | jmchandonia/narrative | 13895904956b31f2d51440d94473cd05ecca1e60 | [
"MIT"
] | null | null | null | src/biokbase/narrative/common/log_proxy.py | jmchandonia/narrative | 13895904956b31f2d51440d94473cd05ecca1e60 | [
"MIT"
] | null | null | null | src/biokbase/narrative/common/log_proxy.py | jmchandonia/narrative | 13895904956b31f2d51440d94473cd05ecca1e60 | [
"MIT"
] | null | null | null | """
Code to proxy logs from the narrative, over a socket, to a DB.
The proxy will tend to have root permissions so it can read protected
configuration files.
"""
__author__ = 'Dan Gunter <dkgunter@lbl.gov>'
__date__ = '8/22/14'
import asyncore
from datetime import datetime
from dateutil.tz import tzlocal
import loggin... | 35.731239 | 84 | 0.578246 | __author__ = 'Dan Gunter <dkgunter@lbl.gov>'
__date__ = '8/22/14'
import asyncore
from datetime import datetime
from dateutil.tz import tzlocal
import logging
from logging import handlers
import pymongo
import pickle
import re
import socket
import struct
import time
import yaml
from biokbase import narrative
from biok... | true | true |
f77746ed0f5ac7dfe7d323ead43032667f85593f | 1,101 | py | Python | PYTHON-SALA DE AULA/Exercicios condicionais/exe-27.py | JaumVitor/HOMEWORK-PYTHON | aff564ac61802c7417d7280a73c1ed4a98978ed3 | [
"Apache-2.0"
] | null | null | null | PYTHON-SALA DE AULA/Exercicios condicionais/exe-27.py | JaumVitor/HOMEWORK-PYTHON | aff564ac61802c7417d7280a73c1ed4a98978ed3 | [
"Apache-2.0"
] | null | null | null | PYTHON-SALA DE AULA/Exercicios condicionais/exe-27.py | JaumVitor/HOMEWORK-PYTHON | aff564ac61802c7417d7280a73c1ed4a98978ed3 | [
"Apache-2.0"
] | null | null | null | print ('----------Até 5 Kg----------\n[1] File > R$ 4,90 por Kg')
print ('[2] Alcatra > R$ 5,90 por Kg')
print ('[3] Picanha > R$ 5,90 por Kg\n')
print ('-------Acima de 5 Kg-------\n[1] File > R$ 5,80 por Kg')
print ('[2] Alcatra > R$ R$ 6,80 por Kg')
print ('[3] Picanha > R$ 7,80 por Kg\n')
print ('ACEI... | 36.7 | 73 | 0.497729 | print ('----------Até 5 Kg----------\n[1] File > R$ 4,90 por Kg')
print ('[2] Alcatra > R$ 5,90 por Kg')
print ('[3] Picanha > R$ 5,90 por Kg\n')
print ('-------Acima de 5 Kg-------\n[1] File > R$ 5,80 por Kg')
print ('[2] Alcatra > R$ R$ 6,80 por Kg')
print ('[3] Picanha > R$ 7,80 por Kg\n')
print ('ACEI... | true | true |
f777486d06497a44bdeae897ea4f3078a9c030e3 | 1,163 | py | Python | exercicio_py/ex0000_boas_vindas/main_v3.py | danielle8farias/Exercicios-Python-3 | f2fe9b6ca63536df1d83fd10162cfc04de36b830 | [
"MIT"
] | null | null | null | exercicio_py/ex0000_boas_vindas/main_v3.py | danielle8farias/Exercicios-Python-3 | f2fe9b6ca63536df1d83fd10162cfc04de36b830 | [
"MIT"
] | null | null | null | exercicio_py/ex0000_boas_vindas/main_v3.py | danielle8farias/Exercicios-Python-3 | f2fe9b6ca63536df1d83fd10162cfc04de36b830 | [
"MIT"
] | null | null | null | ########
# autora: danielle8farias@gmail.com
# repositório: https://github.com/danielle8farias
# Descrição:Captura o nome da pessoa e retorna uma mensagem de boas-vindas na tela.
########
#importando módulo criando em outro diretório:
# módulo sys fornece acesso a algumas variáveis usadas ou mantidas pelo interpre... | 40.103448 | 117 | 0.774721 |
import sys
sys.path.append('/home/danielle8farias/hello-world-python3/meus_modulos')
from mensagem import ler_cabecalho
ler_cabecalho('programa de boas-vindas')
nome = input('Digite seu nome: ').strip().capitalize()
print(f'Bem-vinda, {nome}!')
| true | true |
f7774888c8a5ccb8a64186476d6e78b999e527ba | 16,570 | py | Python | tensorflow/python/autograph/impl/api.py | computerwala/tensorflow | 97164413d009aa6506f269eff7fb78411419146d | [
"Apache-2.0"
] | 2 | 2018-12-12T23:33:05.000Z | 2019-02-26T07:20:22.000Z | tensorflow/python/autograph/impl/api.py | JoyTerence/tensorflow | 766eb63f2f3e43cd8b23c1cbb05fe63dd918ffa3 | [
"Apache-2.0"
] | null | null | null | tensorflow/python/autograph/impl/api.py | JoyTerence/tensorflow | 766eb63f2f3e43cd8b23c1cbb05fe63dd918ffa3 | [
"Apache-2.0"
] | 2 | 2019-10-11T00:17:03.000Z | 2020-05-23T18:59:45.000Z | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 36.337719 | 80 | 0.709415 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import functools
import sys
from enum import Enum
import numpy as np
from tensorflow.python.autograph.core import config
from tensorflow.python.autograph.core import converter
from tensorflow.python.autogr... | true | true |
f77749cf033d5260ae9cf14676cf0e1e8cf40f2e | 5,956 | py | Python | tests/reg_tests/jensen_jimenez_regression_test.py | paulf81/FLORIS | ef4934ec7feb7afd2615772d364a1eaa28db93e9 | [
"Apache-2.0"
] | 91 | 2019-06-04T08:56:29.000Z | 2022-03-13T17:39:22.000Z | tests/reg_tests/jensen_jimenez_regression_test.py | paulf81/FLORIS | ef4934ec7feb7afd2615772d364a1eaa28db93e9 | [
"Apache-2.0"
] | 224 | 2019-04-08T22:03:45.000Z | 2022-03-31T17:56:09.000Z | tests/reg_tests/jensen_jimenez_regression_test.py | RHammond2/floris | f1bfee1f22834109e1f3478cdf2b468e19dc584f | [
"Apache-2.0"
] | 97 | 2019-04-23T20:48:20.000Z | 2022-03-29T08:17:02.000Z | # Copyright 2020 NREL
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distri... | 33.840909 | 88 | 0.694594 |
import copy
from pytest import approx
from tests.conftest import print_test_values, turbines_to_array
from floris.simulation import Floris, TurbineMap
DEBUG = False
VELOCITY_MODEL = "jensen"
DEFLECTION_MODEL = "jimenez"
baseline = [
(0.7655527, 1816305.2933644, 0.2579012, 7.9803783),
(0.8271015, 829746... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.