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 |
|---|---|---|---|---|
main.py | impressive8/Practice | 197 | 44090 | # ===================================
# Import the libraries
# ===================================
import numpy as np
from matplotlib import pylab as plt
import imaging
import utility
import os,sys
# ===================================
# Which stages to run
# ===================================
do_add_noise = False
d... |
coldsweat/fetcher.py | jeroenh/coldsweat | 106 | 44091 | # -*- coding: utf-8 -*-
'''
Description: the feed fetcher
Copyright (c) 2013—2016 <NAME>
Portions are copyright (c) 2013 <NAME>
License: MIT (see LICENSE for details)
'''
import sys, os, re, time, urlparse
from datetime import datetime
from peewee import IntegrityError
import feedparser
import requests
from requests... |
leo/modes/velocity.py | ATikhonov2/leo-editor | 1,550 | 44096 | # Leo colorizer control file for velocity mode.
# This file is in the public domain.
# Properties for velocity mode.
properties = {
"commentEnd": "*#",
"commentStart": "#*",
"lineComment": "##",
}
# Attributes dict for velocity_main ruleset.
velocity_main_attributes_dict = {
"default": "nu... |
phasing/utils/tag_bam_post_phasing.py | ArthurDondi/cDNA_Cupcake | 205 | 44099 | <reponame>ArthurDondi/cDNA_Cupcake
__author__ = "<EMAIL>"
"""
Tagging BAM files with phasing info
"""
import pysam
from csv import DictReader
def main(read_bam, hap_info, output_bam, celltype_file=None):
d = {}
celltype_info = {}
#for r in DictReader(open('phased.partial.cleaned.hap_info.txt'),delimiter... |
pudzu/sandbox/tinytim.py | Udzu/pudzu | 119 | 44144 | from collections import namedtuple
from turtle import fd, heading, lt, pd, position, pu, rt, setheading, setposition # pylint: disable=no-name-in-module
from pudzu.utils import weighted_choice
class LSystem:
Rule = namedtuple("Rule", "predecessor successor weight", defaults=(1.0,))
def __init__(self, axio... |
examples/pytorch/diffpool/model/tensorized_layers/assignment.py | ketyi/dgl | 9,516 | 44156 | import torch
from torch import nn as nn
from torch.nn import functional as F
from torch.autograd import Variable
from model.tensorized_layers.graphsage import BatchedGraphSAGE
class DiffPoolAssignment(nn.Module):
def __init__(self, nfeat, nnext):
super().__init__()
self.assign_mat = BatchedGraph... |
Algo and DSA/LeetCode-Solutions-master/Python/insert-delete-getrandom-o1.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 44171 | # Time: O(1)
# Space: O(n)
from random import randint
class RandomizedSet(object):
def __init__(self):
"""
Initialize your data structure here.
"""
self.__set = []
self.__used = {}
def insert(self, val):
"""
Inserts a value to the set. Returns true i... |
examples/pubsub_broadcaster_server_example.py | sondrelg/fastapi_websocket_pubsub | 125 | 44192 | """
Multiple Servers linked via broadcaster example.
To run this example.
- 0. Setup a broadcast medium and pass its configuration to the endpoint (e.g. postgres on 'postgres://localhost:5432/' )
- 1. run this script for the servers (as many instances as you'd like) - use the PORT env-variable to run them on differ... |
Chapter03/plot_convolution.py | arifmudi/Advanced-Deep-Learning-with-Python | 107 | 44209 | import matplotlib.pyplot as plt
import numpy as np
def plot_convolution(f, g):
fig, (ax1, ax2, ax3) = plt.subplots(3, 1)
ax1.set_yticklabels([])
ax1.set_xticklabels([])
ax1.plot(f, color='blue', label='f')
ax1.legend()
ax2.set_yticklabels([])
ax2.set_xticklabels([])
ax2.plot(g, color=... |
rocAL/rocAL_pybind/example/tf_mnistTrainingExample/tf_mnist_classification_rali.py | asalmanp/MIVisionX | 153 | 44215 |
from __future__ import print_function
from amd.rali.plugin.tf import RALIIterator
from amd.rali.pipeline import Pipeline
import amd.rali.ops as ops
import amd.rali.types as types
import sys
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
import numpy as np
############################### HYPER PARAMETERS F... |
tests/test_casefold_migration.py | clmnin/sydent | 220 | 44234 | <gh_stars>100-1000
import json
import os.path
from unittest.mock import patch
from twisted.trial import unittest
from scripts.casefold_db import (
calculate_lookup_hash,
update_global_associations,
update_local_associations,
)
from sydent.util import json_decoder
from sydent.util.emailutils import sendEma... |
test_soundcard.py | bastibe/pysound | 490 | 44236 | import sys
import soundcard
import numpy
import pytest
skip_if_not_linux = pytest.mark.skipif(sys.platform != 'linux', reason='Only implemented for PulseAudio so far')
ones = numpy.ones(1024)
signal = numpy.concatenate([[ones], [-ones]]).T
def test_speakers():
for speaker in soundcard.all_speakers():
ass... |
migrations/versions/c0e8d68e84fa_added_anomaly_config_to_kpi.py | eltociear/chaos_genius | 320 | 44237 | <gh_stars>100-1000
"""added anomaly config to kpi
Revision ID: c0e8d68e84fa
Revises: <PASSWORD>
Create Date: 2021-09-02 09:08:21.174195
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'c0e8d68e84fa'
down_revision = '<PASSWORD>0d4ab3bc9'
branch_labels = None
dep... |
chromecast/tools/build/package_test_deps.py | zealoussnow/chromium | 14,668 | 44251 | #!/usr/bin/env python
#
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Packages test dependencies as tar.gz file."""
import argparse
import json
import logging
import os
import sys
import tarfile
pa... |
hls4ml/backends/fpga/fpga_types.py | jaemyungkim/hls4ml | 380 | 44253 | <reponame>jaemyungkim/hls4ml
import numpy as np
from hls4ml.model.types import CompressedType, NamedType, ExponentType, FixedPrecisionType, IntegerPrecisionType, XnorPrecisionType, ExponentPrecisionType, TensorVariable, PackedType, WeightVariable
#region Precision types
class PrecisionDefinition(object):
def def... |
pycoin/symbols/mona.py | jaschadub/pycoin | 1,210 | 44280 | from pycoin.networks.bitcoinish import create_bitcoinish_network
network = create_bitcoinish_network(
network_name="Monacoin", symbol="MONA", subnet_name="mainnet",
wif_prefix_hex="b0", sec_prefix="MONASEC:", address_prefix_hex="32", pay_to_script_prefix_hex="37",
bip32_prv_prefix_hex="0488ade4", bip32_pu... |
PR_BCI_team/Team_StarLab/DKHan/examples/eeg_dg/train_eval.py | PatternRecognition/OpenBMI | 217 | 44309 | import torch
import torch.nn.functional as F
from torch.autograd import Variable
import numpy as np
class LabelSmoothingCrossEntropy(torch.nn.Module):
def __init__(self):
super(LabelSmoothingCrossEntropy, self).__init__()
def forward(self, x, target, smoothing=0.1):
confidence = 1. - smoothing... |
xbox/webapi/api/provider/titlehub/models.py | OpenXbox/xbox-webapi-python | 122 | 44315 | <reponame>OpenXbox/xbox-webapi-python
from datetime import datetime
from enum import Enum
from typing import Any, List, Optional
from xbox.webapi.common.models import CamelCaseModel, PascalCaseModel
class TitleFields(str, Enum):
SERVICE_CONFIG_ID = "scid"
ACHIEVEMENT = "achievement"
STATS = "stats"
G... |
examples/py/factorization/parse_netflix.py | pnijhara/h2o4gpu | 458 | 44325 | <reponame>pnijhara/h2o4gpu<gh_stars>100-1000
import numpy as np
import scipy
from sklearn.model_selection import train_test_split
files = [
'../data/combined_data_1.txt',
'../data/combined_data_2.txt',
'../data/combined_data_3.txt',
'../data/combined_data_4.txt',
]
if __name__ == '__main__':
coo_r... |
vkbottle/api/token_generator/__init__.py | homus32/vkbottle | 698 | 44332 | from .abc import ABCTokenGenerator, Token
from .consistent import ConsistentTokenGenerator
from .single import SingleTokenGenerator
from .util import get_token_generator
|
diff_between_dates.py | DazEB2/SimplePyScripts | 117 | 44353 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
from datetime import datetime
items = [
'23/03/2007',
'05/12/2007',
'22/08/2008',
'02/10/2009',
]
for i in range(len(items) - 1):
date_str_1, date_str_2 = items[i], items[i + 1]
date_1 = datetime.strptime(date_str_1, '... |
PyObjCTest/test_nsdocktile.py | Khan/pyobjc-framework-Cocoa | 132 | 44387 | <reponame>Khan/pyobjc-framework-Cocoa
from AppKit import *
from PyObjCTools.TestSupport import *
class TestNSDockTile (TestCase):
def testMethods(self):
self.assertResultIsBOOL(NSDockTile.showsApplicationBadge)
self.assertArgIsBOOL(NSDockTile.setShowsApplicationBadge_, 0)
def testConstants(sel... |
src/tests/ftest/pool/uuid_corner_case.py | fedepad/daos | 429 | 44388 | #!/usr/bin/python3
"""
(C) Copyright 2018-2021 Intel Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent
"""
from apricot import TestWithServers
class UUIDCornerCase(TestWithServers):
"""Create and destroy a pool with UUID.
This test covers some corner case and regression regarding UUID usage in
... |
maintenance/templates/nodeclass.py | JFlynnXYZ/pymel | 287 | 44394 | <gh_stars>100-1000
{% if not existing %}
class {{ classname }}({{ parents }}):
{% endif %}
{% if attrs %}
{% for attr in attrs %}
{% for line in attr.getLines() %}
{{line}}
{% endfor %}
{% endfor %}
{% endif %}
{% if methods %}
{% for method in methods %}
{% for line in method.getLines() %}
{{line}}
... |
yasql/apps/sqlquery/migrations/0001_initial.py | Fanduzi/YaSQL | 443 | 44398 | <reponame>Fanduzi/YaSQL<gh_stars>100-1000
# Generated by Django 2.2.16 on 2020-12-15 07:18
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('sqlorders', '0001_initial'),... |
Giveme5W1H/examples/datasets/news_cluster/data_fixer.py | bkrrr/Giveme5W | 410 | 44416 | <reponame>bkrrr/Giveme5W
import glob
"""
this script is fixing errors found in the data, after processing
"""
# final fixes for known errors
for filepath in glob.glob('output/*.json'):
# Read in the file
with open(filepath, 'r') as file:
filedata = file.read()
# AIDA has a wrong URL for the D... |
elliot/recommender/neural/NeuMF/tf_custom_sampler_2.py | gategill/elliot | 175 | 44446 | """
Module description:
"""
__version__ = '0.3.1'
__author__ = '<NAME>, <NAME>'
__email__ = '<EMAIL>, <EMAIL>'
import tensorflow as tf
import numpy as np
import random
class Sampler():
def __init__(self, indexed_ratings=None, m=None, num_users=None, num_items=None, transactions=None, batch_size=512, random_seed=... |
hottbox/utils/validation/__init__.py | adamurban98/hottbox | 167 | 44460 | <gh_stars>100-1000
from .checks import is_toeplitz_matrix, is_super_symmetric, is_toeplitz_tensor
__all__ = [
"is_toeplitz_matrix",
"is_super_symmetric",
"is_toeplitz_tensor",
]
|
google_or_tools/knapsack_cp_sat.py | tias/hakank | 279 | 44467 | <gh_stars>100-1000
# Copyright 2021 <NAME> <EMAIL>
#
# 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 ... |
L1TriggerConfig/L1ScalesProducers/python/L1CaloScalesConfig_cff.py | ckamtsikis/cmssw | 852 | 44471 | <reponame>ckamtsikis/cmssw<filename>L1TriggerConfig/L1ScalesProducers/python/L1CaloScalesConfig_cff.py
import FWCore.ParameterSet.Config as cms
from L1TriggerConfig.L1ScalesProducers.l1CaloScales_cfi import *
emrcdsrc = cms.ESSource("EmptyESSource",
recordName = cms.string('L1EmEtScaleRcd'),
iovIsRunNotTime = ... |
S2.Surface_Normal/unet/unet_model.py | leoshine/Spherical_Regression | 133 | 44477 | <reponame>leoshine/Spherical_Regression
"""
@Author : <NAME>
"""
# full assembly of the sub-parts to form the complete net
import numpy as np
from unet_parts import *
class UNet(nn.Module):
def __init__(self, n_channels, n_classes):
super(UNet, self).__init__()
self.inc = inconv(n_channels, 64)
... |
xnmt/simultaneous/simult_state.py | neulab/xnmt | 195 | 44505 | import numbers
import xnmt.tensor_tools as tt
import xnmt.modelparts.decoders as decoders
import xnmt.transducers.recurrent as recurrent
import xnmt.transducers.base as transducers_base
import xnmt.expression_seqs as expr_seq
import xnmt.vocabs as vocabs
class SimultaneousState(decoders.AutoRegressiveDecoderState):
... |
tests/components/luftdaten/__init__.py | domwillcode/home-assistant | 30,023 | 44537 | <filename>tests/components/luftdaten/__init__.py
"""Define tests for the Luftdaten component."""
|
tensorflow_federated/python/core/impl/bindings_utils/data_conversions.py | RyanMarten/federated | 1,918 | 44562 | # Copyright 2021, The TensorFlow Federated 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 o... |
pixiedust/display/streamingDisplay.py | elgalu/pixiedust | 598 | 44566 | # -------------------------------------------------------------------------------
# Copyright IBM Corp. 2017
#
# 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/licens... |
import_3dm/converters/curve.py | jesterKing/import_3dm | 167 | 44601 | # MIT License
# Copyright (c) 2018-2019 <NAME>, <NAME>, <NAME>, <NAME>
# 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... |
nailgun-client/py/__init__.py | h4l/nailgun | 362 | 44603 | <filename>nailgun-client/py/__init__.py<gh_stars>100-1000
# Copyright 2004-2015, <NAME>, Inc.
# Copyright 2017-Present Facebook, Inc.
from ng import NailgunConnection, NailgunException
|
Week15/2.py | bobsingh149/LeetCode | 101 | 44636 | <filename>Week15/2.py
### DO NOT REMOVE THIS
from typing import List
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
### DO NOT REMOVE THIS
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = va... |
lib/synthetic_data.py | ppmdatix/rtdl | 298 | 44644 | "Code used to generate data for experiments with synthetic data"
import math
import typing as ty
import numba
import numpy as np
import torch
import torch.nn as nn
from numba.experimental import jitclass
from tqdm.auto import tqdm
class MLP(nn.Module):
def __init__(
self,
*,
d_in: int,
... |
mitreattack/navlayers/generators/usage_generator.py | wetkind/mitreattack-python | 137 | 44653 | <filename>mitreattack/navlayers/generators/usage_generator.py<gh_stars>100-1000
from stix2 import Filter
from itertools import chain
import copy
from mitreattack.navlayers.exporters.matrix_gen import MatrixGen
from mitreattack.navlayers.core.exceptions import BadInput, typeChecker
from mitreattack.navlayers.core.layer... |
uefi_firmware/guids/efiguids_asrock.py | MikeSpreitzer/uefi-firmware-parser | 492 | 44666 |
GUIDs = {
"ASROCK_ACPIS4_DXE_GUID": [69196166, 45078, 18382, 175, 197, 34, 105, 237, 212, 173, 100],
"ASROCK_USBRT_GUID": [82487969, 10657, 4567, 136, 56, 0, 80, 4, 115, 212, 235],
"ASROCK_RAID_SETUP_GUID": [152494882, 14144, 12750, 173, 98, 189, 23, 44, 236, 202, 54],
"ASROCK_RAID_LOADER_GUID": [16450... |
tf3d/utils/projections_test.py | deepneuralmachine/google-research | 23,901 | 44671 | <reponame>deepneuralmachine/google-research
# coding=utf-8
# Copyright 2021 The Google Research 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... |
docs/core/examples/stdin.py | Khymeira/twisted | 4,612 | 44674 | # Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
An example of reading a line at a time from standard input
without blocking the reactor.
"""
from os import linesep
from twisted.internet import stdio
from twisted.protocols import basic
class Echo(basic.LineReceiver):
delimiter = lin... |
floweaver/hierarchy.py | fullflu/floweaver | 342 | 44675 | import networkx as nx
class Hierarchy:
def __init__(self, tree, column):
self.tree = tree
self.column = column
def _leaves_below(self, node):
leaves = sum(([vv for vv in v if self.tree.out_degree(vv) == 0]
for k, v in nx.dfs_successors(self.tree, node).items()),
... |
venv/Lib/site-packages/win32/Demos/win32gui_demo.py | ajayiagbebaku/NFL-Model | 150 | 44684 | <reponame>ajayiagbebaku/NFL-Model
# The start of a win32gui generic demo.
# Feel free to contribute more demos back ;-)
import win32gui, win32con, win32api
import time, math, random
def _MyCallback(hwnd, extra):
hwnds, classes = extra
hwnds.append(hwnd)
classes[win32gui.GetClassName(hwnd)] = 1
def Test... |
products/ui/llbuildui/graphalgorithms.py | uraimo/swift-llbuild | 1,034 | 44688 | import orderedset
def find_cycle(nodes, successors):
path = orderedset.orderedset()
visited = set()
def visit(node):
# If the node is already in the current path, we have found a cycle.
if not path.add(node):
return (path, node)
# If we have otherwise already visit... |
tests/python/kaolin/metrics/__init__.py | mlej8/kaolin | 3,747 | 44700 | from . import test_trianglemesh
from . import test_voxelgrid |
securityheaders/checkers/hsts/test_maxagezero.py | th3cyb3rc0p/securityheaders | 151 | 44722 | <reponame>th3cyb3rc0p/securityheaders
import unittest
from securityheaders.checkers.hsts import HSTSMaxAgeZeroChecker
class HSTSMaxAgeZeroCheckerTest(unittest.TestCase):
def setUp(self):
self.x = HSTSMaxAgeZeroChecker()
def test_checkNoHSTS(self):
nox = dict()
nox['test'] = 'value'
... |
merlion/models/anomaly/forecast_based/arima.py | ankitakashyap05/Merlion | 2,215 | 44753 | <reponame>ankitakashyap05/Merlion
#
# Copyright (c) 2021 salesforce.com, inc.
# All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause
# For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
#
"""
Classic ARIMA (AutoRegressive Integrated Moving Average) forec... |
tests/conftest.py | GoodMonsters/Building-Data-Science-Applications-with-FastAPI | 107 | 44757 | from typing import Callable, AsyncGenerator, Generator
import asyncio
import httpx
import pytest
from asgi_lifespan import LifespanManager
from fastapi import FastAPI
from fastapi.testclient import TestClient
TestClientGenerator = Callable[[FastAPI], AsyncGenerator[httpx.AsyncClient, None]]
@pytest.fixture(scope="s... |
examples/applications/restapi/example_ws_client/ws_client.py | electrumsv/electrumsv | 136 | 44814 | import aiohttp
import asyncio
import json
import logging
import requests
from typing import cast, Iterable, List, Optional
from electrumsv.constants import TxFlags
logging.basicConfig(level=logging.DEBUG)
class TxStateWSClient:
def __init__(self, host: str="127.0.0.1", port: int=9999, wallet_name: str="worker1... |
opendatatools/hedgefund/simu_agent.py | jjcc/OpenData | 1,179 | 44821 | from opendatatools.common import RestAgent, md5
from progressbar import ProgressBar
import json
import pandas as pd
import io
import hashlib
import time
index_map = {
'Barclay_Hedge_Fund_Index' : 'ghsndx',
'Convertible_Arbitrage_Index' : 'ghsca',
'Distressed_Securities_Index' : 'ghsds',
'Emerg... |
examples/geo/divvy.py | fding253/nxviz | 385 | 44826 | import networkx as nx
import matplotlib.pyplot as plt
from nxviz import GeoPlot
G = nx.read_gpickle("divvy.pkl")
print(list(G.nodes(data=True))[0])
G_new = G.copy()
for n1, n2, d in G.edges(data=True):
if d["count"] < 200:
G_new.remove_edge(n1, n2)
g = GeoPlot(
G_new,
node_lat="latitude",
nod... |
experiments/smal_shape.py | silviazuffi/smalst | 121 | 44842 | <filename>experiments/smal_shape.py
"""
Example usage:
python -m smalst.experiments.smal_shape --zebra_dir='smalst/zebra_no_toys_wtex_1000_0' --num_epochs=100000 --save_epoch_freq=20 --name=smal_net_600 --save_training_imgs=True --num_images=20000 --do_validation=True
"""
from __future__ import absolute_import
from... |
everbug/utils/manager.py | everhide/everbug | 182 | 44854 | <reponame>everhide/everbug
class _Manager(type):
""" Singletone for cProfile manager """
_inst = {}
def __call__(cls, *args, **kwargs):
if cls not in cls._inst:
cls._inst[cls] = super(_Manager, cls).__call__(*args, **kwargs)
return cls._inst[cls]
class ProfileManager(metaclass... |
examples/rl/train/play.py | ONLYA/RoboGrammar | 156 | 44902 | <reponame>ONLYA/RoboGrammar
import sys
import os
base_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), '../../')
sys.path.append(base_dir)
sys.path.append(os.path.join(base_dir, 'rl'))
import numpy as np
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim... |
learning_python/lesson7/exercise4.py | fallenfuzz/pynet | 528 | 44905 | <filename>learning_python/lesson7/exercise4.py
#!/usr/bin/env python
"""
Take the YAML file and corresponding data structure that you defined in exercise3b:
{'interfaces': {
'Ethernet1': {'mode': 'access', 'vlan': 10},
'Ethernet2': {'mode': 'access', 'vlan': 20},
'Ethernet3': {'mode': 'trunk',
... |
finance_ml/model_selection/__init__.py | BTETON/finance_ml | 446 | 44906 | from .kfold import PurgedKFold, CPKFold, generate_signals
from .score import cv_score
from .pipeline import Pipeline
from .hyper import clf_hyper_fit
from .distribution import LogUniformGen, log_uniform
from .utils import evaluate |
alipay/aop/api/domain/MiniAppDeployResponse.py | antopen/alipay-sdk-python-all | 213 | 44913 | <filename>alipay/aop/api/domain/MiniAppDeployResponse.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class MiniAppDeployResponse(object):
def __init__(self):
self._android_client_max = None
self._android_client_min = None
... |
test/util_test.py | sbienkow/eg | 1,389 | 44966 | import json
import os
from eg import config
from eg import substitute
from eg import util
from mock import Mock
from mock import patch
PATH_UNSQUEEZED_FILE = os.path.join(
'test',
'assets',
'pwd_unsqueezed.md'
)
PATH_SQUEEZED_FILE = os.path.join(
'test',
'assets',
'pwd_squeezed.md'
)
def _cr... |
src/sage/symbolic/constant.py | UCD4IDS/sage | 1,742 | 44969 | <reponame>UCD4IDS/sage<filename>src/sage/symbolic/constant.py<gh_stars>1000+
from sage.misc.lazy_import import lazy_import
lazy_import('sage.symbolic.expression', 'PynacConstant', deprecation=32386)
|
tools/bin/pythonSrc/pychecker-0.8.18/test_input/test23.py | YangHao666666/hawq | 450 | 44991 | 'doc'
class X:
'doc'
def __init__(self):
self.fff = 0
def x(self):
pass
def y(self):
'should generate a warning'
if self.x:
pass
if self.x and globals():
pass
if globals() and self.x:
pass
def z(self):
's... |
deepy/layers/prelu.py | uaca/deepy | 260 | 44993 | <reponame>uaca/deepy<gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from . import NeuralLayer
from conv import Convolution
class PRelu(NeuralLayer):
"""
Probabilistic ReLU.
- http://arxiv.org/pdf/1502.01852v1.pdf
"""
def __init__(self, input_tensor=2):
super(PRelu, self).... |
tools/hippydebug.py | jweinraub/hippyvm | 289 | 45016 | #!/usr/bin/env python
"""Hippy debugger.
Usage: hippydebug.py [debugger_options] ../hippy-c args...
(There are no debugger_options so far.)
"""
import sys, os, signal
import getopt
import subprocess
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from hippy.debugger import Connection,... |
RecoBTag/PerformanceDB/python/measure/Btag_btagTtbarWp0612.py | ckamtsikis/cmssw | 852 | 45039 | import FWCore.ParameterSet.Config as cms
BtagPerformanceESProducer_TTBARWPBTAGCSVL = cms.ESProducer("BtagPerformanceESProducer",
# this is what it makes available
ComponentName = cms.string('TTBARWPBTAGCSVL'),
# this is where it gets the payload from
PayloadName =... |
pycg/machinery/imports.py | WenJinfeng/PyCG | 121 | 45068 | #
# Copyright (c) 2020 <NAME>.
#
# 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... |
src/products/migrations/0006_ShippableFullName.py | denkasyanov/education-backend | 151 | 45086 | <gh_stars>100-1000
# Generated by Django 2.2.7 on 2019-11-15 21:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('products', '0005_ClickMeeetingRoomURL'),
]
operations = [
migrations.AddField(
model_name='course',
... |
samsungctl/upnp/UPNP_Device/upnp_class.py | p3g4asus/samsungctl | 135 | 45093 | # -*- coding: utf-8 -*-
import requests
import os
from lxml import etree
try:
from urlparse import urlparse
except ImportError:
from urllib.parse import urlparse
try:
from .xmlns import strip_xmlns
from .service import Service
from .embedded_device import EmbeddedDevice
from .instance_singlet... |
src/condor_tests/ornithology/io.py | sridish123/htcondor | 217 | 45102 | <reponame>sridish123/htcondor
# Copyright 2019 HTCondor Team, Computer Sciences Department,
# University of Wisconsin-Madison, WI.
#
# 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:... |
magma/t.py | leonardt/magma | 167 | 45201 | <filename>magma/t.py
import abc
import enum
from magma.common import deprecated
from magma.compatibility import IntegerTypes, StringTypes
from magma.ref import AnonRef, NamedRef, TempNamedRef, DefnRef, InstRef
from magma.protocol_type import magma_value
from magma.wire import wire
class Direction(enum.Enum):
In =... |
tests/fixtures/script-files/sample_script.py | avoltz/poetry-core | 205 | 45209 | <gh_stars>100-1000
#!/usr/bin/env python
hello = "Hello World!"
|
hvplot/tests/testgridplots.py | lhoupert/hvplot | 338 | 45224 | <reponame>lhoupert/hvplot
from unittest import SkipTest
from collections import OrderedDict
import numpy as np
from holoviews import Store
from holoviews.element import RGB, Image
from holoviews.element.comparison import ComparisonTestCase
try:
import xarray as xr
except:
raise SkipTest('XArray not available'... |
src/karta_manual_anchor.py | CrackerCat/Karta | 716 | 45233 | #!/usr/bin/python
from config.utils import *
from elementals import Prompter
from function_context import SourceContext, BinaryContext, IslandContext
import os
import sys
import argparse
import logging
from collections import defaultdict
def recordManualAnchors(library_config, knowledge_conf... |
test/com/facebook/buck/parser/testdata/python_user_defined_rules/errors/invalid_attr_name/bad_attrs.bzl | Unknoob/buck | 8,027 | 45276 | <reponame>Unknoob/buck
def _impl(_ctx):
pass
bad_attrs = rule(implementation = _impl, attrs = {"1234isntvalid": attr.int()})
|
scripts/misc/redis_test.py | cclauss/archai | 344 | 45288 | import redis
redis_client = redis.StrictRedis(host="127.0.0.1", port=6379)
input("") |
tests/test_analytics.py | lakshyaag/csgo | 118 | 45292 | import pytest
import numpy as np
from csgo.analytics.distance import (
bombsite_distance,
point_distance,
polygon_area,
area_distance,
)
from csgo.analytics.coords import Encoder
class TestCSGOAnalytics:
"""Class to test CSGO analytics"""
def test_bombsite_distance(self):
"""Test bo... |
text/src/autogluon/text/text_prediction/infer_types.py | zhiqiangdon/autogluon | 4,462 | 45305 | <gh_stars>1000+
import collections
import pandas as pd
import warnings
from typing import Union, Optional, List, Dict, Tuple
from autogluon.core.constants import MULTICLASS, BINARY, REGRESSION
from .constants import NULL, CATEGORICAL, NUMERICAL, TEXT
#TODO, This file may later be merged with the infer type logic in ta... |
code/tools/prepare_instance.py | santomon/taskonomy | 789 | 45333 | import subprocess
import os
def download_task_model(task):
m_path = os.path.join('/home/ubuntu/s3', "model_log_final", task,
"logs/model.permanent-ckpt")
dirs, fname = os.path.split(m_path)
dst_dir = dirs.replace('/home/ubuntu/s3', "s3://taskonomy-unpacked-oregon")
... |
resotocore/resotocore/db/jobdb.py | someengineering/resoto | 126 | 45393 | <filename>resotocore/resotocore/db/jobdb.py
from resotocore.db.async_arangodb import AsyncArangoDB
from resotocore.db.entitydb import EntityDb, EventEntityDb, ArangoEntityDb
from resotocore.task.task_description import Job
JobDb = EntityDb[Job]
EventJobDb = EventEntityDb[Job]
def job_db(db: AsyncArangoDB, collection... |
todo/migrations/0004_rename_list_tasklist.py | Sowmya-1998/https-github.com-shacker-django-todo | 567 | 45401 | <gh_stars>100-1000
# Generated by Django 2.0.2 on 2018-02-09 23:15
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("auth", "0009_alter_user_last_name_max_length"),
("todo", "0003_assignee_optional"),
]
op... |
app/apiv2/internal/tasking/mobius_task.py | Joey-Wondersign/Staffjoy-suite-Joey | 890 | 45459 | from flask_restful import marshal, abort, Resource
from app.models import Schedule2
from app.apiv2.decorators import permission_sudo
from app.apiv2.marshal import tasking_schedule_fields
class MobiusTaskApi(Resource):
method_decorators = [permission_sudo]
def get(self, schedule_id):
""" Peek at a sc... |
genpac/template.py | kaixinguo360/genpac | 2,331 | 45516 | <gh_stars>1000+
# -*- coding: utf-8 -*-
from __future__ import (unicode_literals, absolute_import,
division, print_function)
from ._compat import string_types
from .util import get_resource_path, read_file
# 模板文件
# is_buildin == True时为内建模板文件,在脚本源码目录下寻找
class TemplateFile(object):
def __in... |
tests/ut/datavisual/data_transform/test_data_loader.py | fapbatista/mindinsight | 216 | 45542 | # Copyright 2019 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... |
app/tests/teams_tests/test_views.py | njmhendrix/grand-challenge.org | 101 | 45554 | <reponame>njmhendrix/grand-challenge.org
import pytest
from django.conf import settings
from django.test import Client
from tests.factories import TeamFactory, TeamMemberFactory
from tests.utils import (
assert_viewname_redirect,
assert_viewname_status,
get_view_for_user,
validate_admin_or_participant_... |
test/programytest/config/brain/test_dynamic.py | cdoebler1/AIML2 | 345 | 45561 | import unittest
from programy.clients.events.console.config import ConsoleConfiguration
from programy.config.brain.dynamic import BrainDynamicsConfiguration
from programy.config.file.yaml_file import YamlConfigurationFile
class BrainDynamicsConfigurationTests(unittest.TestCase):
def test_with_data(self):
... |
api/organisations/managers.py | mevinbabuc/flagsmith | 1,259 | 45575 | <reponame>mevinbabuc/flagsmith
from django.db.models import Manager
from permissions.models import ORGANISATION_PERMISSION_TYPE
class OrganisationPermissionManager(Manager):
def get_queryset(self):
return super().get_queryset().filter(type=ORGANISATION_PERMISSION_TYPE)
|
nuplan/planning/metrics/evaluation_metrics/common/clearance_from_static_agents.py | motional/nuplan-devkit | 128 | 45595 | from collections import defaultdict
from dataclasses import dataclass
from typing import Dict, List, Optional
import numpy as np
import numpy.typing as npt
from nuplan.common.actor_state.agent import Agent
from nuplan.common.actor_state.ego_state import EgoState
from nuplan.common.actor_state.vehicle_parameters impor... |
dotnet/private/copy_files.bzl | TamsilAmani/selenium | 25,151 | 45630 | <filename>dotnet/private/copy_files.bzl
def _copy_cmd(ctx, file_list, target_dir):
dest_list = []
if file_list == None or len(file_list) == 0:
return dest_list
shell_content = ""
batch_file_name = "%s-copy-files.bat" % (ctx.label.name)
bat = ctx.actions.declare_file(batch_file_name)
sr... |
Trakttv.bundle/Contents/Libraries/Shared/trakt_sync/cache/enums.py | disrupted/Trakttv.bundle | 1,346 | 45632 | class Enum(object):
@classmethod
def parse(cls, value):
options = cls.options()
result = []
for k, v in options.items():
if type(v) is not int or v == 0:
continue
if value == 0 or (value & v) == v:
result.append(v)
retur... |
Tools/resourceCompiler/mayaExporter/workers/skinclusterExporter.py | giordi91/SirEngineThe3rd | 114 | 45650 | import sys
sys.path.append( "E:\\WORK_IN_PROGRESS\\C\\platfoorm\\engine\\misc\\exporters")
from maya import cmds
from maya import OpenMaya
from maya import OpenMayaAnim
import skeletonExporter
reload(skeletonExporter)
import json
MAX_INFLUENCE = 6;
def map_shadow_to_skeleton(root):
data,joints = skeletonExport... |
gluon/gluoncv2/models/res2net.py | naviocean/imgclsmob | 2,649 | 45661 | """
Res2Net for ImageNet-1K, implemented in Gluon.
Original paper: 'Res2Net: A New Multi-scale Backbone Architecture,' https://arxiv.org/abs/1904.01169.
"""
__all__ = ['Res2Net', 'res2net50_w14_s8', 'res2net50_w26_s8']
import os
from mxnet import cpu
from mxnet.gluon import nn, HybridBlock
from mxnet.gluon.co... |
rls/common/decorator.py | StepNeverStop/RLs | 371 | 45695 | <reponame>StepNeverStop/RLs
#!/usr/bin/env python3
# encoding: utf-8
import functools
import torch as th
from rls.utils.converter import to_numpy, to_tensor
def lazy_property(func):
attribute = '_lazy_' + func.__name__
@property
# 将原函数对象(func)的指定属性复制给包装函数对象(wrapper), 默认有 module、name、doc,或者通过参数选择
@... |
detectors/__init__.py | bc-jcarlson/secret-bridge | 152 | 45717 | from detectors.detectsecrets import DetectSecrets
from detectors.gitsecrets import GitSecrets
from detectors.trufflehog import TruffleHog
# TODO: Turn this into a registry to match the notifiers pattern?
AvailableDetectors = {
'detect-secrets': DetectSecrets,
'git-secrets': GitSecrets,
'trufflehog': Truffle... |
fhir/resources/tests/test_specimendefinition.py | cstoltze/fhir.resources | 144 | 45732 | <reponame>cstoltze/fhir.resources
# -*- coding: utf-8 -*-
"""
Profile: http://hl7.org/fhir/StructureDefinition/SpecimenDefinition
Release: R4
Version: 4.0.1
Build ID: 9346c8cc45
Last updated: 2019-11-01T09:29:23.356+11:00
"""
from pydantic.validators import bytes_validator # noqa: F401
from .. import fhirtypes # noq... |
mindinsight/datavisual/data_transform/graph/optimized_graph.py | mindspore-ai/mindinsight | 216 | 45757 | <reponame>mindspore-ai/mindinsight<gh_stars>100-1000
# Copyright 2021 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... |
Athos/RandomForests/parse_graphviz_to_ezpc_input.py | kanav99/EzPC | 221 | 45761 | """
Authors: <NAME>, <NAME>.
Copyright:
Copyright (c) 2021 Microsoft Research
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, ... |
lib/sundials_6.0.0/benchmarks/advection_reaction_3D/scripts/pickle_solution_output.py | detcitty/math | 256 | 45799 | <gh_stars>100-1000
#!/usr/bin/env python
# -----------------------------------------------------------------------------
# SUNDIALS Copyright Start
# Copyright (c) 2002-2021, Lawrence Livermore National Security
# and Southern Methodist University.
# All rights reserved.
#
# See the top-level LICENSE and NOTICE files f... |
BubbleChart/BubbleChart.py | O-Aiden/Danim | 218 | 45808 | <reponame>O-Aiden/Danim
from manimlib.imports import *
from Danim.BubbleChart.BCutils import *
from Danim.BubbleChart.bubble_constants import *
class BubbleChart(VGroup):
# A class to quickly create the bubble chart animation
# may not have the freedom to change things
CONFIG = {
"show_axes_lable":... |
inversefed/utils.py | hyunjoors/invertinggradients | 119 | 45813 | <reponame>hyunjoors/invertinggradients
"""Various utilities."""
import os
import csv
import torch
import random
import numpy as np
import socket
import datetime
def system_startup(args=None, defs=None):
"""Print useful system information."""
# Choose GPU device and print status information:
device = to... |
tests/python/cuda/test_features.py | jakeKonrad/torch-quiver | 196 | 45846 | import torch
import torch_quiver as torch_qv
import random
import numpy as np
import time
from typing import List
from quiver.shard_tensor import ShardTensor, ShardTensorConfig, Topo
from quiver.utils import reindex_feature
import torch.multiprocessing as mp
from torch.multiprocessing import Process
import os
import sy... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.