max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 7 115 | max_stars_count int64 101 368k | id stringlengths 2 8 | content stringlengths 6 1.03M |
|---|---|---|---|---|
tests/multimodel/test_aln.py | Ronjaa95/neurolib | 258 | 11080556 | <reponame>Ronjaa95/neurolib
"""
Set of tests for adaptive exponential integrate-and-fire mean-field model.
"""
import unittest
import numba
import numpy as np
import pytest
import xarray as xr
from jitcdde import jitcdde_input
from neurolib.models.aln import ALNModel
from neurolib.models.multimodel.builder.aln import... |
venv/Lib/site-packages/nipype/interfaces/niftyfit/tests/test_dwi.py | richung99/digitizePlots | 585 | 11080567 | <reponame>richung99/digitizePlots
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
import pytest
from ....testing import example_data
from ...niftyreg import get_custom_path
from ..dwi import FitDwi, DwiTool
from ...niftyreg.tests.test_regutils import ... |
torch/_sources.py | xiaohanhuang/pytorch | 183 | 11080594 | import ast
import functools
import inspect
from textwrap import dedent
from typing import Any, Optional, Tuple, List, NamedTuple
from torch._C import ErrorReport
from torch._C._jit_tree_views import SourceRangeFactory
def get_source_lines_and_file(
obj: Any,
error_msg: Optional[str] = None,
) -> Tuple[List[str... |
Imagr/main.py | rogerhu/imagr | 355 | 11080609 | # -*- coding: utf-8 -*-
#
# main.py
# Imagr
#
# Created by <NAME> on 04/04/2015.
# Copyright (c) 2015 <NAME>. All rights reserved.
#
# import modules required by application
import objc
import Foundation
import AppKit
from PyObjCTools import AppHelper
# import modules containing classes required to start applica... |
utils/global_step_functions_test.py | slowy07/tensor2robot | 456 | 11080637 | <reponame>slowy07/tensor2robot<filename>utils/global_step_functions_test.py
# coding=utf-8
# Copyright 2021 The Tensor2Robot 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
#
# h... |
controle_estoque/movconta.py | jucimar1/controleEstoque | 134 | 11080645 | # -*- codind: utf-8 -*-
from PyQt5.QtCore import QDate, QUrl
from PyQt5.QtWebEngineWidgets import QWebEngineView
import re
from Views.movConta import Ui_ct_movimento
from Crud.CrudContaAReceber import CrudContaAReceber
from Crud.CrudContaAPagar import CrudContaAPagar
class MainMovimentoConta(Ui_ct_movimento):
... |
tests/tmp.py | d6t/d6tflow | 1,004 | 11080659 | import d6tflow, luigi
import pandas as pd
# define 2 tasks that load raw data
class Task1(d6tflow.tasks.TaskPickle):
def run(self):
df = pd.DataFrame({'a':range(3)})
self.save(df) # quickly save dataframe
self.saveMeta({1:1})
Task1(path='data/data2').run()
Task1(path='data/data2').outputL... |
tests/components/qnap_qsw/test_button.py | liangleslie/core | 30,023 | 11080687 | <reponame>liangleslie/core
"""The sensor tests for the QNAP QSW platform."""
from unittest.mock import patch
from homeassistant.components.button.const import DOMAIN as BUTTON_DOMAIN, SERVICE_PRESS
from homeassistant.const import ATTR_ENTITY_ID, STATE_UNKNOWN
from homeassistant.core import HomeAssistant
from .util i... |
modules/dbnd-airflow/src/dbnd_airflow/airflow_extensions/airflow_config.py | ipattarapong/dbnd | 224 | 11080707 | import logging
import os
logger = logging.getLogger(__name__)
def reinit_airflow_sql_conn():
from airflow.settings import configure_vars, configure_orm
from dbnd._core.configuration.dbnd_config import config as dbnd_config
configure_vars()
# The webservers import this file from models.py with the d... |
Getting_Started_With_Raspberry_Pi_Pico/conditional_loop/code.py | gamblor21/Adafruit_Learning_System_Guides | 665 | 11080726 | """Example of assigning a variable, and comparing it to a value in a loop."""
user_name = input ("What is your name? ")
while user_name != "<NAME>":
print("You are not Superman - try again!")
user_name = input ("What is your name? ")
print("You are Superman!")
|
greykite/tests/framework/templates/test_forecaster.py | kenzie-q/greykite | 1,503 | 11080762 | <gh_stars>1000+
import sys
import warnings
from enum import Enum
import numpy as np
import pytest
from testfixtures import LogCapture
from greykite.common.constants import LOGGER_NAME
from greykite.common.constants import TIME_COL
from greykite.common.constants import VALUE_COL
from greykite.common.data_loader import... |
model/alignment.py | aflorithmic/DurIAN | 158 | 11080821 | import torch
from .base import BaseModule
class AlignmentModule(BaseModule):
"""
Special module in DurIAN, which duplicates encoder hidden states
with the correspodence to the outputs of duration model.
"""
def __init__(self):
super(AlignmentModule, self).__init__()
def forwa... |
base/site-packages/captchas/urls.py | edisonlz/fastor | 285 | 11080822 | from django.conf.urls.defaults import *
from captchas.views import captcha_image
urlpatterns = patterns('',
url(r'^(?P<id>\w+)/$', captcha_image,
name='captcha_image')
)
|
coreference/train.py | shinoyuki222/torch-light | 310 | 11080827 | import os
import json
import argparse
import torch
from tqdm import tqdm
import torch.optim as optim
import numpy as np
from torch.nn.functional import binary_cross_entropy
import data_loader
import const
import model
import utils
parser = argparse.ArgumentParser()
parser.add_argument('--data', type=str,
... |
ext/libigl/external/cgal/src/CGAL_Project/auxiliary/gdb/python/CGAL/printers.py | liminchen/OptCuts | 187 | 11080831 | # Copyright (c) 2011 GeometryFactory Sarl (France)
#
# This file is part of CGAL (www.cgal.org); you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 3 of the License,
# or (at your option) any later version.
... |
GeneratorInterface/RivetInterface/python/particleLevel_cfi.py | Purva-Chaudhari/cmssw | 852 | 11080840 | import FWCore.ParameterSet.Config as cms
particleLevel = cms.EDProducer("ParticleLevelProducer",
src = cms.InputTag("genParticles2HepMC:unsmeared"),
usePromptFinalStates = cms.bool(True), # for leptons, photons, neutrinos
excludePromptLeptonsFromJetClustering = cms.bool(True),
excludeNeutrinosFrom... |
vnpy/api/lts/vnltstd/test/lts_data_type.py | black0144/vnpy | 101 | 11080843 | <filename>vnpy/api/lts/vnltstd/test/lts_data_type.py
# encoding: UTF-8
defineDict = {}
typedefDict = {}
#//////////////////////////////////////////////////////////////////////
#@company shanghai liber information Technology Co.,Ltd
#@file SecurityFtdcUserApiDataType.h
#@brief 定义业务数据类型
#///////////////////////////////... |
salt/ext/vsan/vsanmgmtObjects.py | tomdoherty/salt | 9,425 | 11080846 | # pylint: skip-file
from pyVmomi.VmomiSupport import (
CreateDataType,
CreateManagedType,
CreateEnumType,
AddVersion,
AddVersionParent,
F_LINK,
F_LINKABLE,
F_OPTIONAL,
)
CreateManagedType(
"vim.cluster.VsanPerformanceManager",
"VsanPerformanceManager",
"vmodl.ManagedObject",... |
python/10-tables.py | EzzEddin/amazon-textract-code-samples | 291 | 11080868 | <gh_stars>100-1000
import boto3
from trp import Document
# Document
documentName = "employmentapp.png"
# Amazon Textract client
textract = boto3.client('textract')
# Call Amazon Textract
with open(documentName, "rb") as document:
response = textract.analyze_document(
Document={
'Bytes': docum... |
setup.py | al1p-R/pandas-log | 186 | 11080883 | <reponame>al1p-R/pandas-log
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""The setup script."""
from setuptools import setup, find_packages
with open('README.rst') as readme_file:
readme = readme_file.read()
requirements = ["humanize>=0.5.0", "pandas>=0.25.1", "pandas_flavor>=0.1.2"]
setup_requirements = ['p... |
iSH/tools/fakefsify.py | bzxy/cydia | 678 | 11080887 | #!/usr/bin/env python3
import os
import sys
from pathlib import Path
import struct
import urllib.request
import tarfile
import sqlite3
SCHEMA = """
create table meta (id integer unique default 0, db_inode integer);
insert into meta (db_inode) values (0);
create table stats (inode integer primary key, stat blob);
creat... |
release/stubs.min/System/Windows/Forms/__init___parts/DataGridViewBand.py | htlcnn/ironpython-stubs | 182 | 11080892 | <reponame>htlcnn/ironpython-stubs
class DataGridViewBand(DataGridViewElement,ICloneable,IDisposable):
""" Represents a linear collection of elements in a System.Windows.Forms.DataGridView control. """
def Clone(self):
"""
Clone(self: DataGridViewBand) -> object
Creates an exact copy of this band.
... |
openbook_communities/migrations/0030_communitynotificationssubscription_new_posts_notifications.py | TamaraAbells/okuna-api | 164 | 11080907 | # Generated by Django 2.2.5 on 2019-12-06 13:41
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('openbook_communities', '0029_communitynotificationssubscription'),
]
operations = [
migrations.AddField(
model_name='communityno... |
hooks/post_gen_project.py | devalexanderdaza/amazing-github-template | 146 | 11080955 | <filename>hooks/post_gen_project.py
#!/usr/bin/env python
import os
import shutil
PROJECT_DIRECTORY = os.path.realpath(os.path.curdir)
def remove(filepath):
fullpath = os.path.join(PROJECT_DIRECTORY, filepath)
if os.path.isfile(fullpath):
os.remove(fullpath)
else:
shutil.rmtree(fullpath, ... |
Anaconda-files/Program_01c.py | arvidl/dynamical-systems-with-applications-using-python | 106 | 11080959 | <filename>Anaconda-files/Program_01c.py
# Program 01c: Two curves on one plot.
# See Figure 1.14.
import matplotlib.pyplot as plt
import numpy as np
t = np.arange(0.0, 2.0, 0.01)
c = 1 + np.cos(2*np.pi*t)
s = 1 + np.sin(2*np.pi*t)
plt.plot(t, s, 'r--', t, c, 'b-.')
plt.xlabel('time (s)')
plt.ylabel('voltage (mV)')
p... |
backpack/hessianfree/hvp.py | jabader97/backpack | 395 | 11080970 | <filename>backpack/hessianfree/hvp.py
import torch
from .rop import R_op
def hessian_vector_product(f, params, v, grad_params=None, detach=True):
"""
Multiplies the vector `v` with the Hessian,
`v = H @ v`
where `H` is the Hessian of `f` w.r.t. `params`.
Example usage:
```
X, Y = data()... |
mayan/apps/duplicates/icons.py | nattangwiwat/Mayan-EDMS-recitation | 343 | 11080976 | from mayan.apps.appearance.classes import Icon
icon_duplicated_document_list = Icon(
driver_name='fontawesome', symbol='clone'
)
icon_duplicated_document_scan = Icon(
driver_name='fontawesome-dual-classes', primary_class='fas fa-clone',
secondary_class='far fa-eye'
)
|
client/verta/verta/_swagger/_public/modeldb/api/DatasetServiceApi.py | CaptEmulation/modeldb | 835 | 11081009 | # THIS FILE IS AUTO-GENERATED. DO NOT EDIT
class DatasetServiceApi:
def __init__(self, client, base_path = "/v1"):
self.client = client
self.base_path = base_path
def addDatasetAttributes(self, body=None):
__query = {
}
if body is None:
raise Exception("Missing required parameter \"body\... |
model/ldam_drw_resnets/ea_resnet_cifar.py | frank-xwang/RIDE-LongTailRecognition | 175 | 11081030 | <gh_stars>100-1000
# From https://github.com/kaidic/LDAM-DRW/blob/master/models/resnet_cifar.py
'''
Properly implemented ResNet for CIFAR10 as described in paper [1].
The implementation and structure of this file is hugely influenced by [2]
which is implemented for ImageNet and doesn't have option A for identity.
Moreo... |
policy/openbot/server/zeroconf.py | januxnet/OpenBot | 1,971 | 11081072 | <reponame>januxnet/OpenBot<gh_stars>1000+
""" Example of announcing a service (in this case, a fake HTTP server) """
import asyncio
import logging
import os
import socket
import sys
from aiohttp import web
from aiozeroconf import ServiceInfo, Zeroconf
from netifaces import interfaces, ifaddresses, AF_INET
SERVICE_TY... |
tests/patterns/test_SequencePattern.py | josiah-wolf-oberholtzer/supriya | 191 | 11081089 | import pytest
from supriya.patterns import SequencePattern
from supriya.patterns.testutils import run_pattern_test
@pytest.mark.parametrize(
"stop_at, sequence, iterations, expected, is_infinite",
[
(None, [1, 2, 3], None, [1, 2, 3], True),
(None, [1, 2, 3], 1, [1, 2, 3], False),
(Non... |
models/se_resnet.py | calmisential/Basic_CNNs_TensorFlow2.0 | 497 | 11081104 | <gh_stars>100-1000
import tensorflow as tf
from configuration import NUM_CLASSES
class SEBlock(tf.keras.layers.Layer):
def __init__(self, input_channels, r=16):
super(SEBlock, self).__init__()
self.pool = tf.keras.layers.GlobalAveragePooling2D()
self.fc1 = tf.keras.layers.Dense(units=input... |
accounting/apps/connect/middlewares.py | Abdur-rahmaanJ/django-accounting | 127 | 11081107 | class ForceGettingStartedMiddleware(object):
def process_request(self, request):
pass
|
security/pwntools/ex03/soluce.py | Franco227/Workshops | 333 | 11081112 | #!/usr/bin/env python3
from pwn import *
PATH = './challenge'
def get_offset():
p = process(PATH)
c = cyclic(50000)
p.sendline(c)
p.recvuntil('[check] 0x')
check = p.recvline().strip()
sequence = unhex(check) # extract cyclic from hex ptr
little_endian = u32(sequen... |
sshtest.py | VCStardust/K8tools | 4,611 | 11081123 | <reponame>VCStardust/K8tools
# C:\Users\null\Desktop\ssh>python ssh.py 172.16.58.3 22 root k8gege
# 172.16.58.3 22 root k8gege LoginOK
import paramiko
import sys
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
def checkSSH():
try:
ssh.connect(sys.argv[1], sys.argv[2... |
rdkit/ML/Cluster/ClusterVis.py | kazuyaujihara/rdkit | 1,609 | 11081125 | # $Id$
#
# Copyright (C) 2001-2006 <NAME> and Rational Discovery LLC
#
# @@ All Rights Reserved @@
# This file is part of the RDKit.
# The contents are covered by the terms of the BSD license
# which is included in the file license.txt, found at the root
# of the RDKit source tree.
#
"""Cluster tree visualizatio... |
djstripe/migrations/0008_2_5.py | ExtraE113/dj-stripe | 937 | 11081140 | # Generated by Django 3.2.3 on 2021-05-30 23:47
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
import djstripe.enums
import djstripe.fields
class Migration(migrations.Migration):
dependencies = [
("djstripe", "0007_2_4"),
]
operations... |
talk/src/_4_magics_good.py | zangyuchen2008/Clean-Code-in-Python-Second-Edition | 133 | 11081162 | """
magic methods: __contains__
Reimplementation of the request function, but this time calling the magic method
implemented in the class, to make the code more readable.
"""
def request_product_for_customer(customer, product, current_stock):
if product in current_stock:
requested_product = current_stock.... |
ambari-server/src/test/python/TestSetupSso.py | samyzh/ambari | 1,664 | 11081165 | '''
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 use this ... |
trench/command/activate_mfa_method.py | eriol/django-trench | 190 | 11081170 | <reponame>eriol/django-trench<gh_stars>100-1000
from typing import Callable, Set, Type
from trench.backends.provider import get_mfa_handler
from trench.command.generate_backup_codes import generate_backup_codes_command
from trench.command.replace_mfa_method_backup_codes import (
regenerate_backup_codes_for_mfa_met... |
Chapter03/Chapter_3_decomposition.py | stciaischoolrnn/Practical-Time-Series-Analysis | 267 | 11081179 | <reponame>stciaischoolrnn/Practical-Time-Series-Analysis<gh_stars>100-1000
# Import modules
import requests
import statsmodels.api as sm
import io
import pandas as pd
# Load Dataset
DATA_URL="http://robjhyndman.com/tsdldata/data/nybirths.dat"
fopen = requests.get(DATA_URL).content
ds=pd.read_csv(io.StringIO(fopen.deco... |
sphinxtogithub/tests/filehandler.py | davvid/sphinx-to-github | 117 | 11081201 |
import unittest
import sphinxtogithub
class MockFileObject(object):
before = """
<title>Breathe's documentation — BreatheExample v0.0.1 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" ... |
tests/st/networks/models/deeplabv3/src/miou_precision.py | GuoSuiming/mindspore | 3,200 | 11081218 | # Copyright 2020 Huawei Technologies Co., Ltd
#
# 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... |
tests/toranj/test-018-child-supervision.py | AdityaHPatwardhan/openthread | 2,962 | 11081224 | #!/usr/bin/env python3
#
# Copyright (c) 2018, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# ... |
core/pyutil_test.py | Schweinepriester/oil | 2,209 | 11081236 | #!/usr/bin/env python2
"""
pyutil_test.py: Tests for pyutil.py
"""
from __future__ import print_function
import unittest
import pyutil # module under test
class PyUtilTest(unittest.TestCase):
def testBackslashEscape(self):
print(pyutil.BackslashEscape('foo', 'o'))
if __name__ == '__main__':
unittest.mai... |
backend_cmds.py | brandon-leapyear/SublimeHaskell | 452 | 11081303 | import threading
import sublime
import sublime_plugin
import SublimeHaskell.internals.backend_mgr as BackendManager
import SublimeHaskell.internals.utils as Utils
import SublimeHaskell.sublime_haskell_common as Common
import SublimeHaskell.internals.settings as Settings
class SublimeHaskellStartBackend(sublime_plug... |
env/lib/python3.8/site-packages/_plotly_future_/__init__.py | acrucetta/Chicago_COVI_WebApp | 11,750 | 11081308 | import warnings
import functools
# Initialize _future_flags with all future flags that are now always in
# effect.
_future_flags = {
"renderer_defaults",
"template_defaults",
"extract_chart_studio",
"remove_deprecations",
"v4_subplots",
"orca_defaults",
"timezones",
"trace_uids",
}
de... |
anomalib/models/components/freia/__init__.py | openvinotoolkit/anomalib | 689 | 11081309 | """Framework for Easily Invertible Architectures.
Module to construct invertible networks with pytorch, based on a graph
structure of operations.
Link to the original repo: https://github.com/VLL-HD/FrEIA
"""
# Copyright (c) 2018-2022 <NAME>, Visual Learning Lab Heidelberg.
# SPDX-License-Identifier: MIT
#
from .fr... |
recipes/Python/577257_slugify_make_string_usable_URL_or/recipe-577257.py | tdiprima/code | 2,023 | 11081395 | <gh_stars>1000+
_slugify_strip_re = re.compile(r'[^\w\s-]')
_slugify_hyphenate_re = re.compile(r'[-\s]+')
def _slugify(value):
"""
Normalizes string, converts to lowercase, removes non-alpha characters,
and converts spaces to hyphens.
From Django's "django/template/defaultfilters.py".
"""
i... |
tensornet/feature_column/category_column.py | ZhangYaoFu/tensornet | 273 | 11081398 | # Copyright (c) 2020, Qihoo, Inc. 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 applicable ... |
awesome_autodl/utils/yaml.py | yashsmehta/Awesome-AutoDL | 1,135 | 11081407 | #####################################################
# Copyright (c) <NAME> [GitHub D-X-Y], 2020.08 #
#####################################################
import yaml
from pathlib import Path
def load_yaml(file_path):
with open(str(file_path), "r") as cfile:
data = yaml.safe_load(cfile)
return data
... |
test_settings.py | simiotics/djangorestframework-queryfields | 195 | 11081414 | SECRET_KEY = "Something you tell everybody to tell nobody"
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'drf_queryfields',
)
ROOT_URLCONF = 'tests.app.urls'
|
src/bindings/python/tests_compatibility/test_ngraph/test_ops_scatter.py | pazamelin/openvino | 2,406 | 11081431 | <reponame>pazamelin/openvino<filename>src/bindings/python/tests_compatibility/test_ngraph/test_ops_scatter.py
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import ngraph as ng
from ngraph.impl import Type
def test_scatter_update_props():
dtype = np.int8
... |
python/cuxfilter/layouts/chart_views.py | ajschmidt8/cuxfilter | 201 | 11081458 | <reponame>ajschmidt8/cuxfilter<gh_stars>100-1000
import panel as pn
def chart_view(*charts, **params):
"""
Parameters:
-----------
- charts
- **params
Ouput:
------
layout view
"""
view = pn.layout.Card(**params, sizing_mode="stretch_both")
for chart in charts:
if ... |
src/templates/java_templating.py | jeff5/jython-whinchat | 577 | 11081504 | <filename>src/templates/java_templating.py
# copyright 2004-2005 <NAME>
import cStringIO
import java_parser
from java_parser import UnknownScheme, make as jast_make
from java_parser import make_id,make_literal
import java_nodes as jast
from java_pretty import JavaPretty, NodeVisitTracker
# templating JavaPretty
cla... |
pydal/helpers/regex.py | mbelletti/pydal | 408 | 11081578 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
import re
REGEX_TYPE = re.compile(r"^(?:list:)?\w+")
REGEX_DBNAME = re.compile(r"^(\w+)(:\w+)*")
REGEX_W = re.compile(r"^\w+$")
REGEX_TABLE_DOT_FIELD = re.compile(r"^(\w+)\.(\w+)$")
REGEX_TABLE_DOT_FIELD_OPTIONAL_QUOTES = r'^"?(\w+)"?\."?(\w+)"?$'
REGEX_UPLOAD_PATTERN = (
... |
iclass/data.py | WuZifeng/ademxapp | 379 | 11081586 | # pylint: skip-file
"""
file iterator for image classification
"""
import os
import time
from PIL import Image
import numpy as np
from mxnet.io import DataBatch, DataIter
from mxnet.ndarray import array
from util.io import BatchFetcherGroup
#from util.sampler import BalancedSampler_OneClassPerImage as BalancedSample... |
learntools/deep_learning/exercise_7.py | roannav/learntools | 359 | 11081590 | import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
from learntools.core import *
from tensorflow import keras
import tensorflow as tf
print("Using TensorFlow version {}".format(tf.__version__))
class StartSequentialModel(CodingProblem):
_vars = ['fashion_model']
def check(self, fashion... |
DEQ-Sequence/utils/adaptive_embedding.py | ashwinipokle/deq | 548 | 11081624 | import torch
from torch import nn
import torch.nn.functional as F
class AdaptiveEmbedding(nn.Module):
def __init__(self, n_token, d_embed, d_proj, cutoffs, div_val=1,
sample_softmax=False):
super(AdaptiveEmbedding, self).__init__()
self.n_token = n_token
self.d_embed = d_... |
src/nsupdate/utils/_tests/test_ddns_client.py | mirzazulfan/nsupdate.info | 774 | 11081627 | <reponame>mirzazulfan/nsupdate.info
"""
Tests for ddns_client module.
"""
import pytest
from ..ddns_client import dyndns2_update, Timeout, ConnectionError
# see also conftest.py
BASEDOMAIN = 'nsupdate.info'
HOSTNAME = 'nsupdate-ddns-client-unittest.' + BASEDOMAIN
INVALID_HOSTNAME = 'nsupdate-ddns-client-nohost.' + B... |
tests/spot/market/test_ticker_price.py | Banging12/binance-connector-python | 512 | 11081635 | from binance.spot import Spot as Client
import responses
from tests.util import mock_http_response
mock_item = {"key_1": "value_1", "key_2": "value_2"}
@mock_http_response(responses.GET, "/api/v3/ticker/price", mock_item, 200)
def test_ticker_price_without_pair():
"""Tests the API endpoint to get price ticker f... |
lib/loss/lovasz_loss.py | littleSunlxy/contrastive-seg-lin | 398 | 11081671 | from itertools import filterfalse as ifilterfalse
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from torch.nn import BCELoss
from lib.loss.aaf import losses as lossx
from lib.utils.tools.logger import Logger as Log
# weights
# ATR training
# [0.85978634, 1.1... |
pyjswidgets/pyjamas/ui/DecoratorPanel.py | takipsizad/pyjs | 739 | 11081691 | <reponame>takipsizad/pyjs<filename>pyjswidgets/pyjamas/ui/DecoratorPanel.py
# Copyright (C) 2006-2008 Google Inc.
# Copyright (C) 2009 <NAME> <<EMAIL>>
from pyjamas import DOM
from pyjamas.ui.SimplePanel import SimplePanel
from pyjamas import Factory
from pyjamas.ui.TabPanel import TabPanel
from pyjamas.ui.TabBar impo... |
tests/blessclient/user_ip_test.py | mwpeterson/python-blessclient | 115 | 11081705 | <reponame>mwpeterson/python-blessclient
import time
import pytest
from blessclient.user_ip import UserIP
from blessclient.bless_cache import BlessCache
IP_URLS = ['http://checkip.amazonaws.com', 'http://api.ipify.org']
def test_getIP_fresh():
user_ip = UserIP(None, 10, IP_URLS)
user_ip.fresh = True
user_i... |
test_arena_rllib_env.py | YuhangSong/Arena-Baselines | 135 | 11081733 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
"""Simple example of using ArenaRllibEnv, which is a interface that
convert a arena environment to a MultiAgentEnv
(see: https://ray.readthedocs.io/en/latest/rllib-env.html#multi-agent-and-hierarchical)
interfac... |
fuzz_lightyear/supplements/include.py | bbhunter/fuzz-lightyear | 169 | 11081760 | <gh_stars>100-1000
from typing import Callable
from typing import Iterable
from fuzz_lightyear.datastore import get_included_tags
def tags(func: Callable[[], Iterable[str]]) -> Callable:
"""Allows developers to specify Swagger tags which
should be fuzzed.
Example:
Only fuzz operations with the '... |
phobos/io/entities/__init__.py | hawkina/phobos | 323 | 11081813 | #!/usr/bin/python3
# coding=utf-8
# -------------------------------------------------------------------------------
# This file is part of Phobos, a Blender Add-On to edit robot models.
# Copyright (C) 2020 University of Bremen & DFKI GmbH Robotics Innovation Center
#
# You should have received a copy of the 3-Clause ... |
Alignment/TrackerAlignment/test/mcMisalignmentScaler_cfg.py | ckamtsikis/cmssw | 852 | 11081817 | <filename>Alignment/TrackerAlignment/test/mcMisalignmentScaler_cfg.py
from __future__ import print_function
import FWCore.ParameterSet.Config as cms
process = cms.Process("MCMisalignmentScaler")
process.load("Configuration.StandardSequences.MagneticField_cff") # B-field map
process.load("Configuration.Geometry.Geometr... |
bcbio/structural/titancna.py | lbeltrame/bcbio-nextgen | 418 | 11081826 | """TitanCNA: Subclonal CNV calling and loss of heterogeneity in cancer.
https://github.com/gavinha/TitanCNA
"""
import csv
import glob
import os
import shutil
import pandas as pd
from bcbio import utils
from bcbio.bam import ref
from bcbio.distributed.transaction import file_transaction, tx_tmpdir
from bcbio.heterog... |
pytorch/ocnn/octree_conv.py | enpelonio/O-CNN | 299 | 11081827 | import torch
from torch import nn
from torch.autograd import Function
import ocnn
def resize_with_last_val(list_in, num=3):
assert (type(list_in) is list and len(list_in) < num + 1)
for i in range(len(list_in), num):
list_in.append(list_in[-1])
return list_in
class OctreeConvFunction(Function):
@static... |
tests/test_stress_sorteddict.py | hinamimi/python-sortedcontainers | 1,510 | 11081846 | # -*- coding: utf-8 -*-
from __future__ import print_function
from sys import hexversion
import random
from .context import sortedcontainers
from sortedcontainers import SortedDict
from functools import wraps
if hexversion < 0x03000000:
from itertools import izip as zip
range = xrange
random.seed(0)
actions... |
raiden/tests/integration/network/proxies/test_service_registry.py | tirkarthi/raiden | 2,101 | 11081849 | from unittest.mock import Mock, patch
import pytest
from eth_utils import to_canonical_address
from raiden.blockchain.decode import update_service_addresses_from_event
from raiden.blockchain.events import decode_raiden_event_to_internal
from raiden.blockchain.filters import RaidenContractFilter
from raiden.constants ... |
modoboa/lib/migrations/0003_rename_parameters.py | HarshCasper/modoboa | 1,602 | 11081851 | from django.db import models, migrations
APPS = (
("modoboa_admin", "admin"),
("modoboa_admin_limits", "limits"),
("modoboa_admin_relaydomains", "relaydomains"),
)
def rename_parameters(apps, schema_editor):
"""Rename old parameters."""
Parameter = apps.get_model("lib", "Parameter")
UserParam... |
Alignment/OfflineValidation/python/runGCPTkAlMap.py | ckamtsikis/cmssw | 852 | 11081862 | <filename>Alignment/OfflineValidation/python/runGCPTkAlMap.py
import sys
import copy
import time
from Alignment.OfflineValidation.TkAlMap import TkAlMap
'''
Script for plotting TkAlMaps
How to run:
python runGCPTkAlMap.py -b inFile=<file_path> compAl=<c_alignment_name> refAl=<r_alignment_name> TkVersion=<phase> ou... |
gen_pb_graph.py | semaralawa/Maix_Toolbox | 140 | 11081864 | <reponame>semaralawa/Maix_Toolbox
#!/usr/bin/python3
import tensorflow as tf
import sys
import os
model = sys.argv[1]
graph = tf.get_default_graph()
graph_def = graph.as_graph_def()
graph_def.ParseFromString(tf.gfile.FastGFile(model, 'rb').read())
tf.import_graph_def(graph_def, name='graph')
os.system('rm -f log/*')
s... |
app/auth/forms.py | Joey-Wondersign/Staffjoy-suite-Joey | 890 | 11081875 | from flask.ext.wtf import Form, RecaptchaField
from wtforms import StringField, PasswordField, BooleanField, \
SubmitField, SelectField, HiddenField
from wtforms.fields.html5 import EmailField
from wtforms.validators import Required, Length, Email, Regexp, EqualTo
from wtforms import ValidationError
from app.mode... |
projects/data_generation/synthetic_multi_view_facial_image_generation/SyntheticDataGeneration.py | ESOGU-SRLAB/opendr | 217 | 11081878 | # Copyright 2020-2022 OpenDR European Project
#
# 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 agree... |
telegram_gcloner/utils/restricted.py | freepg0099/CloneBot_Heroku | 194 | 11081913 | <filename>telegram_gcloner/utils/restricted.py
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import logging
from functools import wraps
from utils.callback import callback_delete_message
from utils.config_loader import config
logger = logging.getLogger(__name__)
def restricted(func):
@wraps(func)
def wrapped(u... |
pygimli/frameworks/methodManager.py | JuliusHen/gimli | 224 | 11081921 | <filename>pygimli/frameworks/methodManager.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Method Manager
Provide the end user interface for method (geophysical) dependent
modelling and inversion as well as data and model visualization.
"""
import numpy as np
import pygimli as pg
from pygimli.utils import prett... |
build/lib/aiocoap/util/asyncio/recvmsg.py | DylanJPettij/CoapTemperatureSensor | 229 | 11081937 | # This file is part of the Python aiocoap library project.
#
# Copyright (c) 2012-2014 <NAME> <http://sixpinetrees.blogspot.com/>,
# 2013-2014 <NAME> <<EMAIL>>
#
# aiocoap is free software, this file is published under the MIT license as
# described in the accompanying LICENSE file.
from .. import socknu... |
rapidsms/utils/translation.py | catalpainternational/rapidsms | 330 | 11082009 | <filename>rapidsms/utils/translation.py
from collections import defaultdict
from django.db.models.query import QuerySet
def group_connections(connections):
"""
Return a list of (language code, respective connections) pairs, while
using Django's translation.override() to set each language.
"""
gro... |
caserec/utils/process_data.py | madrugado/CaseRecommender | 407 | 11082037 | <gh_stars>100-1000
# coding=utf-8
""""
These classes are responsible for read, write and process external files and information.
"""
# © 2019. Case Recommender (MIT License)
import pandas as pd
from caserec.utils.extra_functions import check_error_file
__author__ = '<NAME> <<EMAIL>>'
class ReadFile(object):
... |
tests/test_goea_statsmodels.py | flying-sheep/goatools | 477 | 11082050 | <filename>tests/test_goea_statsmodels.py
import sys
import os
from goatools.obo_parser import GODag
from goatools.go_enrichment import GOEnrichmentStudy
from goatools.associations import read_associations
"""Test Gene Ontology Enrichment Analysis using mutipletest methods in statsmodels."""
ROOT = os.path.dirname(os.... |
turbinia/lib/text_formatter.py | sa3eed3ed/turbinia | 559 | 11082067 | <filename>turbinia/lib/text_formatter.py<gh_stars>100-1000
#!/usr/bin/env python
#
# Copyright 2017 Google 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/... |
asdl/asdl_.py | Schweinepriester/oil | 2,209 | 11082074 | <reponame>Schweinepriester/oil
#-------------------------------------------------------------------------------
# Parser for ASDL [1] definition files. Reads in an ASDL description and parses
# it into an AST that describes it.
#
# The EBNF we're parsing here: Figure 1 of the paper [1]. Extended to support
# modules an... |
build/security/verify_build/verify_build_test.py | wwjiang007/fuchsia-1 | 210 | 11082077 | <reponame>wwjiang007/fuchsia-1
#!/usr/bin/env python3.8
# Copyright 2020 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
r"""Unit test for verify_build.py.
Need to have SCRUTINY and ZBI environmental variables set.
To manu... |
demo/run_pg_on_cartpole.py | simonoso/EasyRL | 125 | 11082085 | <gh_stars>100-1000
# Copyright (c) 2019 Alibaba Inc. 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 require... |
ebcli/containers/pathconfig.py | senstb/aws-elastic-beanstalk-cli | 110 | 11082086 | # Copyright 2015 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... |
pentest-tool/pentest/libs/password.py | Micr067/pentestdb | 686 | 11082105 | <gh_stars>100-1000
#!/usr/bin/env python
#-*- coding:utf-8 -*-
'''
Pentestdb, a database for penetration test.
Copyright (c) 2015 alpha1e0
================================================================
社工密码生成器.
'''
import time
import itertools
class PasswdGenerator(object):
'''
Password generator.
'... |
py_stringmatching/similarity_measure/levenshtein.py | kevalii/py_stringmatching | 115 | 11082114 | <reponame>kevalii/py_stringmatching
from __future__ import division
from py_stringmatching import utils
from py_stringmatching.similarity_measure.cython.cython_levenshtein import levenshtein
from py_stringmatching.similarity_measure.sequence_similarity_measure import \
SequenceSimilarityMeasure
class Levenshtein... |
colossalai/context/random/__init__.py | RichardoLuo/ColossalAI | 1,630 | 11082127 | from ._helper import (seed, set_mode, with_seed, add_seed, get_seeds, get_states, get_current_mode, set_seed_states,
sync_states, moe_set_seed, reset_seeds)
__all__ = [
'seed', 'set_mode', 'with_seed', 'add_seed', 'get_seeds', 'get_states', 'get_current_mode', 'set_seed_states',
'sync_sta... |
style_transfer/style_transfer/fritz_coreml_converter.py | Sofienne71/style_transfer_python | 277 | 11082133 | import coremltools
from coremltools.converters.keras._keras2_converter import *
from coremltools.converters.keras._keras2_converter import _KERAS_LAYER_REGISTRY
from coremltools.converters.keras import _topology2
from coremltools.converters.keras._topology2 import _KERAS_SKIP_LAYERS
from coremltools.models.neural_netw... |
tests/mixology/version_solver/test_dependency_cache.py | zEdS15B3GCwq/poetry | 7,258 | 11082141 | from __future__ import annotations
from copy import deepcopy
from typing import TYPE_CHECKING
from poetry.factory import Factory
from poetry.mixology.version_solver import DependencyCache
from tests.mixology.helpers import add_to_repo
if TYPE_CHECKING:
from poetry.core.packages.project_package import ProjectPac... |
scripts/artifacts/tileAppDisc.py | xperylabhub/iLEAPP | 325 | 11082165 | <gh_stars>100-1000
import glob
import os
import pathlib
import sqlite3
from scripts.artifact_report import ArtifactHtmlReport
from scripts.ilapfuncs import logfunc, tsv, timeline, is_platform_windows, open_sqlite_db_readonly
def get_tileAppDisc(files_found, report_folder, seeker):
for file_found in files_found:
... |
python/example_code/lookoutvision/inference.py | cfuerst/aws-doc-sdk-examples | 5,166 | 11082183 | <gh_stars>1000+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""
Uses a trained Amazon Lookout for Vision model to detect anomalies
in an image. The image can be local or in an S3 bucket.
"""
import argparse
import logging
import imghdr
import os
import bot... |
tools/write_tfrecords.py | hanyeonjee/CRNN_Tensorflow | 946 | 11082189 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time : 19-3-13 下午1:31
# @Author : MaybeShewill-CV
# @Site : https://github.com/MaybeShewill-CV/CRNN_Tensorflow
# @File : write_tfrecords.py
# @IDE: PyCharm
"""
Write tfrecords tools
"""
import argparse
import os
import os.path as ops
from data_provider import... |
python/examples/cuda-to-cv.py | imrisaac/jetson-utils | 372 | 11082199 | #!/usr/bin/python3
#
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# 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 r... |
installer/core/terraform/resources/aws/iam.py | jonico/pacbot | 1,165 | 11082205 | from core.terraform.resources import TerraformResource, TerraformData
from core.config import Settings
from core.providers.aws.boto3 import iam
class IAMRoleResource(TerraformResource):
"""
Base resource class for Terraform AWS IAM role resource
Attributes:
resource_instance_name (str): Type of r... |
Array/41_FirstMissingPositive.py | cls1991/leetcode | 180 | 11082225 | # coding: utf8
"""
题目链接: https://leetcode.com/problems/first-missing-positive/description.
题目描述:
Given an unsorted integer array, find the first missing positive integer.
For example,
Given [1,2,0] return 3,
and [3,4,-1,1] return 2.
Your algorithm should run in O(n) time and uses... |
lab001/solutions/s005.py | wuhanstudio/fpga_101 | 225 | 11082229 | #!/usr/bin/env python3
from migen import *
from litex.build.generic_platform import *
from litex.build.xilinx import XilinxPlatform
# IOs ----------------------------------------------------------------------------------------------
_io = [
("user_led", 0, Pins("H17"), IOStandard("LVCMOS33")),
("user_sw",... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.