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 |
|---|---|---|---|---|
PyObjCTest/test_cfattributedstring.py | Khan/pyobjc-framework-Cocoa | 132 | 11025717 | from PyObjCTools.TestSupport import *
from CoreFoundation import *
from Foundation import NSCFAttributedString
try:
long
except NameError:
long = int
class TestAttributedString (TestCase):
def testTypes(self):
try:
NSCFAttributedString = objc.lookUpClass('__NSCFAttributedString')
... |
jax_cfd/ml/diffusions.py | rainwangphy/jax-cfd | 244 | 11025727 | <filename>jax_cfd/ml/diffusions.py
"""Models for diffusion components.
All modules are functions that return `DiffuseFn` or `DiffusionSolveFn` method.
The two types of diffusion modules should be used with corresponding explicit
and implicit navier-stokes solvers.
An example explicit diffusion module:
```python
def ... |
src/h3/api/__init__.py | SaveTheRbtz/h3-py | 498 | 11025745 | <reponame>SaveTheRbtz/h3-py<filename>src/h3/api/__init__.py
# flake8: noqa
from . import basic_int
from . import basic_str
from . import memview_int
|
notebooks/Ch03_Processing_Wrangling_and_Visualizing_Data/wrangle_data.py | baoqt2/practical-machine-learning-with-python | 1,989 | 11025759 | <reponame>baoqt2/practical-machine-learning-with-python
# -*- coding: utf-8 -*-
"""
Created on Wed May 10 19:51:47 2017
@author: <NAME>
"""
"""
This script showcases data wrangling tasks
``Execute``
$ python wrangle_data.py
"""
import random
import datetime
import numpy as np
import pandas as pd
from ra... |
src/genie/libs/parser/iosxe/tests/ShowTelemetryIETFSubscriptionReceiver/cli/equal/golden_output_expected.py | balmasea/genieparser | 204 | 11025784 | <filename>src/genie/libs/parser/iosxe/tests/ShowTelemetryIETFSubscriptionReceiver/cli/equal/golden_output_expected.py
expected_output = {
'id':{
2147483659: {
'address': '10.69.35.35',
'connection': 11,
'port': 45128,
'protocol': 'netconf',
'state': 'Connected'
}
}
} |
yawast/scanner/plugins/http/servers/apache_httpd.py | Prodject/yawast | 200 | 11025792 | # Copyright (c) 2013 - 2020 <NAME> and Contributors.
# This file is part of YAWAST which is released under the MIT license.
# See the LICENSE file or go to https://yawast.org/license/ for full license details.
from typing import List, cast
from urllib.parse import urljoin
from packaging import version
from yawast... |
plaidml2/bridge/keras/__init__.py | redoclag/plaidml | 4,535 | 11025797 | # Copyright 2019 Intel Corporation.
import functools
import inspect
import logging
import math
import os
from collections import defaultdict
from contextlib import contextmanager
import six
import numpy as np
import scipy.stats
import plaidml2 as plaidml
import plaidml2.edsl as edsl
import plaidml2.exec as plaidml_e... |
deploy/scripts/aphros/plot.py | cselab/aphros | 252 | 11025809 | #!/usr/bin/env python3
import glob
import os
import re
import sys
from argparse import Namespace
# https://github.com/OrdnanceSurvey/GeoDataViz-Toolkit/tree/master/Colours
g_geodata_qualitative = [
"#FF1F5B", "#00CD6C", "#009ADE", "#AF58BA", "#FFC61E", "#F28522",
"#A0B1BA", "#A6761D", "#E9002D", "#FFAA00", "#... |
opcode/_tool_make_op_tables.py | MaxTurchin/pycopy-lib | 126 | 11025810 | # This file is part of the standard library of Pycopy project, minimalist
# and resource-efficient Python3 implementation.
#
# https://github.com/pfalcon/pycopy
# https://github.com/pfalcon/pycopy-lib
#
# The MIT License (MIT)
#
# Copyright (c) 2018-2019 <NAME>
#
# Permission is hereby granted, free of charge, to any p... |
funboost/consumers/mqtt_consumer.py | DJMIN/funboost | 120 | 11025811 | <reponame>DJMIN/funboost
# -*- coding: utf-8 -*-
# @Author : ydf
# @Time : 2019/8/8 0008 13:32
import json
# import time
from funboost.consumers.base_consumer import AbstractConsumer
from funboost import funboost_config_deafult
import paho.mqtt.client as mqtt
class MqttConsumer(AbstractConsumer):
"""
emq... |
neurvps/datasets.py | keatonkraiger/neurvps | 133 | 11025817 | import os
import json
import math
import random
import os.path as osp
from glob import glob
import numpy as np
import torch
import skimage.io
import numpy.linalg as LA
import matplotlib.pyplot as plt
import skimage.transform
from torch.utils.data import Dataset
from torch.utils.data.dataloader import default_collate
... |
tests/test_history.py | bsmith76s/irrigation_unlimited | 114 | 11025827 | <reponame>bsmith76s/irrigation_unlimited<gh_stars>100-1000
"""Test irrigation_unlimited history."""
from unittest.mock import patch
from datetime import datetime
import pytest
import homeassistant.core as ha
from homeassistant.config import load_yaml_config_file
from homeassistant.setup import async_setup_component
fr... |
motpy/model.py | brdg-ai/motpy | 337 | 11025865 | <gh_stars>100-1000
from enum import Enum
import numpy as np
from filterpy.common import Q_discrete_white_noise
from scipy.linalg import block_diag
from motpy.core import Box, Vector
""" The list of model presets below is not complete, more reasonable
options will be added in the future """
class ModelPreset(Enum):... |
g2pk/__init__.py | elbum/g2pK | 136 | 11025871 | # -*- coding: utf-8 -*-
r"""g2pK
"""
from __future__ import absolute_import
from .g2pk import G2p |
QSTK/qstkfeat/__init__.py | paulopatto/QuantSoftwareToolkit | 339 | 11025911 | from classes import *
from featutil import *
from features import *
|
tests/test_ols.py | youngminju-phd/Causalinference | 392 | 11025921 | <reponame>youngminju-phd/Causalinference
from nose.tools import *
import numpy as np
import causalinference.estimators.ols as o
import causalinference.core.data as d
def test_form_matrix():
D = np.array([0, 1, 0, 1])
X = np.array([[1], [2], [3], [4]])
adj1 = 0
ans1 = np.array([[1, 0], [1, 1], [1, 0], [1, 1]])
... |
tests/test_application.py | klen/muffin | 704 | 11025925 | """Base Tests."""
from pathlib import Path
from unittest import mock
def test_imports():
import muffin
assert muffin.Request
assert muffin.Response
assert muffin.ResponseError
assert muffin.ResponseFile
assert muffin.ResponseHTML
assert muffin.ResponseJSON
assert muffin.ResponseRedir... |
software/glasgow/arch/mips/instr.py | electroniceel/Glasgow | 1,014 | 11025938 | <filename>software/glasgow/arch/mips/instr.py<gh_stars>1000+
# Ref: MIPS® Architecture for Programmers Volume II-A: The MIPS32® Instruction Set Manual
# Document Number: MD00086 Revision 6.05
# Accession: G00021
__all__ = [
# R-format
"SLL", "SRL", "SRA", "JR", "JALR", "MFHI", "MTHI", "MFLO", "MTLO", "DIV", "D... |
chaos_genius/core/rca/rca_utils/string_helpers.py | eltociear/chaos_genius | 320 | 11025950 | <reponame>eltociear/chaos_genius
"""Provides helper functions for string manipulations related to RCA."""
import re
import numpy as np
import pandas as pd
# TODO: Update docstrings to sphinx format
def _parse_single_col_for_query_string(col: str, value: str) -> str:
return f'`{col}`=="{value}"'
def convert_d... |
src/richie/plugins/section/defaults.py | leduong/richie | 174 | 11025952 | <filename>src/richie/plugins/section/defaults.py
"""
Section plugin default settings
"""
from django.conf import settings
from django.utils.translation import gettext_lazy as _
SECTION_TEMPLATES = getattr(
settings,
"RICHIE_SECTION_TEMPLATES",
[
("richie/section/section.html", _("Default")),
... |
Python/find-peak-element.py | xenron/sandbox-dev-lintcode | 695 | 11025955 | # Time: O(logn)
# Space: O(1)
#
# There is an integer array which has the following features:
#
# * The numbers in adjacent positions are different.
#
# * A[0] < A[1] && A[A.length - 2] > A[A.length - 1].
#
# We define a position P is a peek if A[P] > A[P-1] && A[P] > A[P+1].
#
# Find a peak element in this array. ... |
tensorlayer/decorators/deprecated_alias.py | Howdy-Personally/tensorlayer-master | 4,484 | 11025961 | #! /usr/bin/python
# -*- coding: utf-8 -*-
import functools
import warnings
from tensorlayer import logging
def deprecated_alias(end_support_version, **aliases):
def deco(f):
@functools.wraps(f)
def wrapper(*args, **kwargs):
try:
func_name = "{}.{}".format(args[0].... |
policy_sentry/querying/actions.py | agilgur5/policy_sentry | 1,577 | 11025964 | """
Methods that execute specific queries against the database for the ACTIONS table.
This supports the Policy Sentry query functionality
"""
import logging
import functools
from policy_sentry.shared.iam_data import iam_definition, get_service_prefix_data
from policy_sentry.querying.all import get_all_service_prefixes,... |
domain/estimators/logistic.py | rcap107/holoclean | 468 | 11025974 | from abc import ABCMeta, abstractmethod
import logging
import time
import torch
from torch.optim import Adam, SGD
from torch.utils.data import TensorDataset, DataLoader
from tqdm import tqdm
from ..estimator import Estimator
from utils import NULL_REPR, NA_COOCCUR_FV
class Logistic(Estimator, torch.nn.Module):
... |
.buildkite/get_changed_code_files.py | Infi-zc/horovod | 7,676 | 11025980 | import json
import logging
import os
import sys
import re
import requests
# this script outputs all code files that have changed between commit and master
# environment variable BUILDKITE_COMMIT provides the commit SHA
# environment variable BUILDKITE_PIPELINE_DEFAULT_BRANCH provides the default branch (master)
# fi... |
Temitope_Rekeying/vanity_generator.py | MoonX-Hub/Voting | 764 | 11025994 | from algosdk import account
from algosdk import mnemonic
from algosdk import account, mnemonic
from algosdk import transaction
from algosdk import algod
vanity_private_key, vanity_address = account.generate_account()
print("Private key:", vanity_private_key)
print("Address:", vanity_address)
prefix = "GREEN_REX"
whi... |
ST_DM/KDD2021-MSTPAC/code/MST-PAC/utils/model_eval/log_vdl.py | zhangyimi/Research | 1,319 | 11026005 | <gh_stars>1000+
import os
import sys
from visualdl import LogWriter
global_step = int(sys.argv[2])
print(global_step)
print('VDL_PATH', os.getenv("VDL_LOG_PATH"))
with open(sys.argv[1]) as f, \
LogWriter("{}/log_{}".format(os.getenv("VDL_LOG_PATH"), "METRICS"), file_name='vdlrecords.metrics.log') as writer:
fo... |
couchbase/transcoder.py | couchbase/couchbase-python-client | 189 | 11026037 | import json
import pickle
from typing import Any, Tuple, Union
from abc import ABC, abstractmethod
from couchbase.exceptions import ValueFormatException
from couchbase_core._libcouchbase import (Transcoder, FMT_JSON,
FMT_BYTES, FMT_UTF8, FMT_PICKLE,
... |
befh/__init__.py | joshua-jd-lee/BitcoinExchangeFH | 310 | 11026043 | # -*- coding: utf-8 -*-
"""Top-level package for Bitcoin exchange feedhandler."""
__author__ = """<NAME>"""
__email__ = '<EMAIL>'
from pkg_resources import get_distribution, DistributionNotFound
try:
__version__ = get_distribution(__name__).version
except DistributionNotFound:
# package is not installed
... |
src/biotite/sequence/search.py | danijoo/biotite | 208 | 11026049 | # This source code is part of the Biotite package and is distributed
# under the 3-Clause BSD License. Please see 'LICENSE.rst' for further
# information.
__name__ = "biotite.sequence"
__author__ = "<NAME>"
__all__ = ["find_subsequence", "find_symbol", "find_symbol_first",
"find_symbol_last"]
import numpy ... |
corehq/apps/linked_domain/migrations/0002_migrate_linked_apps.py | dimagilg/commcare-hq | 471 | 11026099 | # Generated by Django 1.11.9 on 2018-02-01 15:00
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('linked_domain', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='domainlink',
... |
build/find_isolated_tests.py | knopp/buildroot | 2,151 | 11026108 | #!/usr/bin/env python
# Copyright 2014 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.
"""Scans build output directory for .isolated files, calculates their SHA1
hashes, stores final list in JSON document and then removes ... |
ibc/train/get_cloning_network.py | google-research/ibc | 180 | 11026109 | <filename>ibc/train/get_cloning_network.py
# coding=utf-8
# Copyright 2022 The Reach ML 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... |
tests/test_api.py | modoupi/git-webhook | 1,617 | 11026119 | # -*- coding: utf-8 -*-
import json
import pytest
from app.database import model
from . import WEBHOOKDATA, success, load_data
def test_server_new(tester, create_server):
resp = tester.post('/api/server/new', data={})
assert not success(resp)
server = create_server()
assert server['ip'] == '127.0.0.1'... |
docs/scripts/flexxdocsgen.py | tbnorth/flexx | 1,662 | 11026184 | """ Run scripts to generate docs for Flexx
"""
#import examplesgenerator
import genuiclasses
import genexamples
import gencommonast
def init():
print('GENERATING DOCS ...')
print(' Generating docs for UI classes.')
genuiclasses.main()
print(' Generating examples.')
genexamples.main()
def... |
component/openssl/__init__.py | xin053/PocCollect | 340 | 11026192 | <filename>component/openssl/__init__.py
KEYWORDS = ['heartblede', ]
def rules(head='',context='',ip='',port='',productname={},keywords='',hackinfo=''):
if int(port) in [443,587,465,995,8443] or productname.get('protocol','') in ['https','smtp','pop','imap','https-alt']:
return True
else:
... |
tests/unit/sagemaker/cli/compatibility/v2/test_file_updaters.py | LastRemote/sagemaker-python-sdk | 1,690 | 11026197 | # Copyright 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 accompan... |
src/pretix/base/migrations/0090_auto_20180509_0917_squashed_0095_auto_20180604_1129.py | pajowu/pretix | 1,248 | 11026198 | <reponame>pajowu/pretix<gh_stars>1000+
# Generated by Django 2.0.8 on 2018-09-11 14:54
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
from django.utils.crypto import get_random_string
def set_pids(apps, schema_editor):
OrderPosition = apps.get_model('pr... |
goatools/godag/relationship_combos.py | flying-sheep/goatools | 477 | 11026239 | <reponame>flying-sheep/goatools
"""Work with combinations of relationships, like *part_of* and *regulates*"""
from __future__ import print_function
__copyright__ = "Copyright (C) 2017-present, <NAME>, <NAME> et al. All rights reserved."
from goatools.godag.consts import RELATIONSHIP_SET
class RelationshipCombos:
... |
mango/simplemarketmaking/simplemarketmaker.py | nhatminhbeo/mango-explorer | 131 | 11026292 | <gh_stars>100-1000
# # ⚠ Warning
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
# LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, D... |
claf/tokens/cove.py | GMDennis/claf | 225 | 11026381 | """
This code is from salesforce/cove
(https://github.com/salesforce/cove/blob/master/cove/encoder.py)
"""
import torch
from torch import nn
from claf.data.data_handler import CachePath, DataHandler
class MTLSTM(nn.Module):
def __init__(
self, word_embedding, pretrained_path=None, requires_grad=False, r... |
plenum/test/consensus/test_consensus_shared_data.py | IDunion/indy-plenum | 148 | 11026397 | from plenum.server.consensus.consensus_shared_data import ConsensusSharedData
def test_initial_consensus_state(some_item, other_item, validators):
name = some_item(validators)
primary = other_item(validators)
data = ConsensusSharedData(name, validators, 0)
data.primary_name = primary
data.set_vali... |
numerics/swig/tests/test_mcp.py | BuildJet/siconos | 137 | 11026403 | # Copyright 2021 INRIA
#!/usr/bin/env python
import numpy as np
import siconos.numerics as sn
def mcp_function(z):
M = np.array([[2., 1.],
[1., 2.]])
q = np.array([-5., -6.])
return np.dot(M,z) + q
def mcp_Nablafunction(z):
M = np.array([[2., 1.],
[1., 2.]])
... |
src/backend/web/handlers/error.py | guineawheek/ftc-data-take-2 | 266 | 11026417 | <reponame>guineawheek/ftc-data-take-2
from typing import Tuple, Union
from flask import render_template
def handle_404(_e: Union[int, Exception]) -> Tuple[str, int]:
return render_template("404.html"), 404
def handle_500(_e: Union[int, Exception]) -> Tuple[str, int]:
return render_template("500.html"), 500... |
nbt/region.py | alex4200/NBT | 241 | 11026430 | """
Handle a region file, containing 32x32 chunks.
For more information about the region file format:
https://minecraft.gamepedia.com/Region_file_format
"""
from .nbt import NBTFile, MalformedFileError
from struct import pack, unpack
try:
from collections.abc import Mapping
except ImportError: # for Python 2.7
... |
scripts/irods/test/test_stacktrace.py | JustinKyleJames/irods | 333 | 11026469 | import sys
if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest
from . import session
from .. import test
from .. import lib
from ..configuration import IrodsConfig
class Test_Stacktrace(session.make_sessions_mixin([('otherrods', 'rods')], []), unittest.TestCase):
plugin_name... |
analysis_engine/get_data_from_redis_key.py | virdesai/stock-analysis-engine | 819 | 11026478 | <reponame>virdesai/stock-analysis-engine<gh_stars>100-1000
"""
Helper for getting data from redis
Debug redis calls with:
::
export DEBUG_REDIS=1
# to show debug, trace logging please export ``SHARED_LOG_CFG``
# to a debug logger json file. To turn on debugging for this
# library, you can export thi... |
examples/basic/mesh_merge_vs_assembly.py | hadivafaii/vedo | 836 | 11026492 | <gh_stars>100-1000
'''
Mesh objects can be combined with
(1) `mesh.merge` - creates a new mesh object; this new mesh inherits properties (color, etc.) of the first mesh.
(2) `assembly.Assembly` - groups meshes (or other actors); preserves properties
(3) `+` - equivalent to `Assembly`
'''
# credits: https://github.com/i... |
docs/source/plots/graphics_functional_rainbowplot.py | CCHiggins/statsmodels | 6,931 | 11026523 | # -*- coding: utf-8 -*-
"""
Created on Fri May 04 11:08:56 2012
Author: <NAME>
"""
#Load the El Nino dataset. Consists of 60 years worth of Pacific Ocean sea
#surface temperature data.
import matplotlib.pyplot as plt
import numpy as np
import statsmodels.api as sm
data = sm.datasets.elnino.load()
#Create a rai... |
mcsema/OS/Linux/generate_abi_wrapper.py | trailofbits/mcsema | 1,301 | 11026551 | <filename>mcsema/OS/Linux/generate_abi_wrapper.py
# Copyright (c) 2020 Trail of Bits, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your... |
technical_analysis/coppock.py | everythingnew/LSTM-Crypto-Price-Prediction | 227 | 11026554 | import numpy as np
class Coppock(object):
def __init__(self, data, wma_pd=10, roc_long=14, roc_short=11):
self.wma_pd = wma_pd
self.long_pd = roc_long
self.short_pd = roc_short
self.past_data = None
self.values = self.calc_copp(data)
def calc_copp(self, da... |
rest_registration/utils/email.py | psibean/django-rest-registration | 329 | 11026565 | from collections import namedtuple
from typing import Any, Callable, Dict
from django.core.exceptions import ImproperlyConfigured
from django.template import TemplateDoesNotExist
from django.template.loader import get_template
from django.utils.translation import gettext as _
from rest_registration.settings import re... |
highway_env/vehicle/objects.py | vrmusketeers/highway-env | 1,236 | 11026577 | <filename>highway_env/vehicle/objects.py
from abc import ABC
from typing import Sequence, Tuple, TYPE_CHECKING, Optional
import numpy as np
from highway_env import utils
if TYPE_CHECKING:
from highway_env.road.lane import AbstractLane
from highway_env.road.road import Road
LaneIndex = Tuple[str, str, int]
... |
dataset_preprocessing/preprocess_3dpw.py | akashsengupta1997/ProHMR | 120 | 11026581 | import os
from prohmr.utils.geometry import batch_rodrigues
import cv2
import torch
import numpy as np
import pickle
from tqdm import tqdm
from prohmr.models import SMPL
from prohmr.configs import prohmr_config, dataset_config
def preprocess_3dpw(dataset_path: str, out_file: str):
'''
Generate 3DPW dataset fi... |
vilya/views/hub/pytrello.py | mubashshirjamal/code | 1,582 | 11026598 | # -*- coding: utf-8 -*-
from httplib2 import Http
from urllib import urlencode
from datetime import datetime
import json
import oauth2 as oauth
class ResourceUnavailable(Exception):
"""Exception representing a failed request to a resource"""
def __init__(self, msg):
Exception.__init__(self)
... |
datafeeds/usfirst_event_list_parser.py | tervay/the-blue-alliance | 266 | 11026640 | from datetime import datetime
import urlparse
import logging
from bs4 import BeautifulSoup
from consts.district_type import DistrictType
from consts.event_type import EventType
from datafeeds.parser_base import ParserBase
from helpers.event_helper import EventHelper
class UsfirstEventListParser(ParserBase):
@cl... |
tests/threaded_test_wrapper.py | konstantin-Sk/pika | 2,479 | 11026646 | <reponame>konstantin-Sk/pika
"""
Implements run_in_thread_with_timeout decorator for running tests that might
deadlock.
"""
from __future__ import print_function
import functools
import os
import sys
import threading
import traceback
import unittest
MODULE_PID = os.getpid()
DEFAULT_TEST_TIMEOUT = 15
def create_... |
src/std/rfc2198.py | ojimary/titus | 108 | 11026651 | <filename>src/std/rfc2198.py<gh_stars>100-1000
# Copyright (c) 2007, <NAME>. All rights reserved. See LICENSING for details.
# @implements RFC2198 (Redundant RTP payload)
'''
Implements RTP payload for redundant audio data as per RFC 2198.
'''
import struct
def createRedundant(packets):
'''Create redun... |
Game11/modules/misc.py | ttkaixin1998/pikachupythongames | 4,013 | 11026675 | <gh_stars>1000+
'''
Function:
其他工具函数
Author:
Charles
公众号:
Charles的皮卡丘
'''
from PyQt5.QtGui import *
'''给板块的一个Cell填色'''
def drawCell(painter, x, y, shape, grid_size):
colors = [0x000000, 0xCC6666, 0x66CC66, 0x6666CC, 0xCCCC66, 0xCC66CC, 0x66CCCC, 0xDAAA00]
if shape == 0:
return
color = ... |
modelchimp/serializers/experiment_label.py | samzer/modelchimp-server | 134 | 11026700 | <reponame>samzer/modelchimp-server
from rest_framework import serializers
from modelchimp.models.experiment import Experiment
class ExperimentLabelSerializer(serializers.ModelSerializer):
class Meta:
model = Experiment
fields = ('labels', )
|
tests/example_experiments_test.py | richarajpal/deep_qa | 459 | 11026703 | # pylint: disable=invalid-name,no-self-use
import pyhocon
from deep_qa.common.params import Params, replace_none
from deep_qa.models import concrete_models
from deep_qa.testing.test_case import DeepQaTestCase
class TestExampleExperiments(DeepQaTestCase):
def setUp(self):
super(TestExampleExperiments, se... |
etl/parsers/etw/Microsoft_Windows_TerminalServices_PnPDevices.py | IMULMUL/etl-parser | 104 | 11026708 | # -*- coding: utf-8 -*-
"""
Microsoft-Windows-TerminalServices-PnPDevices
GUID : 27a8c1e2-eb19-463e-8424-b399df27a216
"""
from construct import Int8sl, Int8ul, Int16ul, Int16sl, Int32sl, Int32ul, Int64sl, Int64ul, Bytes, Double, Float32l, Struct
from etl.utils import WString, CString, SystemTime, Guid
from etl.dtyp imp... |
lm_human_preferences/language/sample.py | badrinath-newzera/openai-summary-training | 207 | 11026721 | import tensorflow as tf
from lm_human_preferences.language import model
from lm_human_preferences.utils import core as utils
def sample_sequence(*, step, model_hparams, length, batch_size=None, context=None,
temperature=1, top_k=0, top_p=1.0, extra_outputs={}, cond=None):
"""
Sampling fro... |
venv/Lib/site-packages/two1/wallet/exceptions.py | RafaelHMachado/Cioffis_Automation | 415 | 11026737 | <reponame>RafaelHMachado/Cioffis_Automation
class WalletError(Exception):
pass
class WalletSigningError(WalletError):
pass
class WalletBalanceError(WalletError):
pass
class UnknownDataProviderError(WalletError):
pass
class TransactionSendError(WalletError):
pass
class TxidMismatchError(Wal... |
examples/basics/data_iter.py | yuhonghong66/minpy | 1,271 | 11026738 | <filename>examples/basics/data_iter.py
""" Simple multi-layer perception neural network using Minpy """
from __future__ import print_function
import sys
import argparse
import minpy
from examples.utils.data_utils import get_CIFAR10_data
from minpy.nn.io import NDArrayIter
# Can also use MXNet IO here
# from mxnet.io ... |
Algo and DSA/LeetCode-Solutions-master/Python/subtree-of-another-tree.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 11026739 | # Time: O(m * n), m is the number of nodes of s, n is the number of nodes of t
# Space: O(h), h is the height of s
class Solution(object):
def isSubtree(self, s, t):
"""
:type s: TreeNode
:type t: TreeNode
:rtype: bool
"""
def isSame(x, y):
if not x and ... |
handlers/base.py | dodomorandi/plugin-common-python | 166 | 11026775 | <filename>handlers/base.py<gh_stars>100-1000
import time
try:
from ... import editor
except ValueError:
from floo import editor
from .. import msg, event_emitter, shared as G, utils
class BaseHandler(event_emitter.EventEmitter):
PROTOCOL = None
def __init__(self):
super(BaseHandler, self).__... |
tests/test_path_helper.py | jfcherng-sublime/ST-FileManager | 101 | 11026780 | <reponame>jfcherng-sublime/ST-FileManager
# -*- encoding: utf-8 -*-
import os
import sys
import unittest
from FileManager.libs.pathhelper import computer_friendly, user_friendly
class PathHelperTest(unittest.TestCase):
def test_computer_friendly(self):
home = os.path.expanduser("~")
tests = [
... |
modules/radarr.py | scambra/HTPC-Manager | 422 | 11026811 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime as DT
from json import loads, dumps
import logging
import urllib
import cherrypy
from cherrypy.lib.auth2 import require, member_of
import requests
import htpc
from htpc.helpers import fix_basepath, get_image, striphttp
class Radarr(ob... |
var/spack/repos/builtin/packages/py-cx-oracle/package.py | BenWibking/spack | 2,360 | 11026815 | <reponame>BenWibking/spack<gh_stars>1000+
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyCxOracle(PythonPackage):
"""Python interface t... |
python/akg/utils/dynamic_shape.py | KnowingNothing/akg-test | 286 | 11026828 | #!/usr/bin/env python3
# coding: utf-8
# 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 ... |
virtual/lib/python3.6/site-packages/pylint/test/functional/consider_using_get.py | drewheathens/The-Moringa-Tribune | 463 | 11026834 | # pylint: disable=missing-docstring,invalid-name,using-constant-test,invalid-sequence-index,undefined-variable
dictionary = dict()
key = 'key'
if 'key' in dictionary: # [consider-using-get]
variable = dictionary['key']
if 'key' in dictionary: # [consider-using-get]
variable = dictionary['key']
else:
var... |
webapp/graphite/finders/__init__.py | parrotpock/graphite-web | 4,281 | 11026861 | import fnmatch
import os.path
import re
EXPAND_BRACES_RE = re.compile(r'(\{([^\{\}]*)\})')
def get_real_metric_path(absolute_path, metric_path):
# Support symbolic links (real_metric_path ensures proper cache queries)
real_absolute_path = os.path.realpath(absolute_path)
if absolute_path != real_absolute_... |
train.py | MilesQLi/Theano-Lights | 313 | 11026929 | <gh_stars>100-1000
import numpy as np
import time
from operator import add
from toolbox import *
from models import *
if __name__ == "__main__":
# Hyper-parameters
#--------------------------------------------------------------------------------------------------
hp = Parameters()
with hp:
batch_si... |
a01_FastText/p6_fastTextB_model_multilabel.py | sunshinenum/text_classification | 7,723 | 11026938 | <reponame>sunshinenum/text_classification
# autor:xul
# fast text. using: very simple model;n-gram to captrue location information;h-softmax to speed up training/inference
# for the n-gram you can use data_util to generate. see method process_one_sentence_to_get_ui_bi_tri_gram under aa1_data_util/data_util_zhihu.py
imp... |
atlas/foundations_rest_api/src/foundations_rest_api/v2beta/controllers/tensorboard_controller.py | DeepLearnI/atlas | 296 | 11026941 | <reponame>DeepLearnI/atlas<filename>atlas/foundations_rest_api/src/foundations_rest_api/v2beta/controllers/tensorboard_controller.py
import subprocess as sp
from flask_restful import reqparse, inputs
from foundations_rest_api.utils.api_resource import api_resource
from foundations_core_rest_api_components.response im... |
DEPENDENCIES/seash/pyreadline/modes/__init__.py | kevinkenzhao/Repy2 | 550 | 11026948 | __all__=["emacs","notemacs","vi"]
import emacs,notemacs,vi
editingmodes=[emacs.EmacsMode,notemacs.NotEmacsMode,vi.ViMode]
#add check to ensure all modes have unique mode names |
macropy/core/test/macros/not_imported.py | CyberFlameGO/macropy | 2,061 | 11026973 | from macropy.core.test.macros.not_imported_macro import macros, g
from macropy.core.test.macros.not_imported_macro import f
def run1():
f = [1, 2, 3, 4, 5]
g = 1
return f[g[3]]
def run2():
return f[g[3]] |
saleor/wishlist/migrations/0001_initial.py | fairhopeweb/saleor | 15,337 | 11026978 | # Generated by Django 2.2.6 on 2019-10-11 10:36
import uuid
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
("product", "0109_auto_20191006_1433"),
migrations.s... |
skgstat/plotting/stvariogram_marginal.py | rhugonnet/scikit-gstat | 141 | 11026984 | import numpy as np
import matplotlib.pyplot as plt
try:
import plotly.graph_objects as go
from plotly.subplots import make_subplots
except ImportError:
pass
def __calc_plot_data(stvariogram, **kwargs):
# get the marginal experimental variograms
vx = stvariogram.XMarginal.experimental
vy = stv... |
backend/tests/baserow/contrib/database/field/test_field_converters.py | cjh0613/baserow | 839 | 11026987 | import pytest
from baserow.contrib.database.fields.models import LinkRowField
from baserow.contrib.database.fields.field_converters import LinkRowFieldConverter
@pytest.mark.django_db
def test_link_row_field_converter_applicable(data_fixture):
table = data_fixture.create_database_table()
table_2 = data_fixtu... |
neo/Network/api/decorators.py | volekerb/neo-python | 387 | 11026996 | <filename>neo/Network/api/decorators.py
import json
from functools import wraps
# don't change this to log_manager, only used in the rest server example that also relies on logging to a file
from logzero import logger
def json_response(func):
"""
@json_response decorator adds response header for content type... |
cross3d/abstract/mixer/clipportion.py | vedantirb/cross3d | 129 | 11026998 | <gh_stars>100-1000
##
# \namespace cross3d.abstract.clipportion
#
# \remarks The AbstractClipPortion class provides a base implementation of
# a cross-application interface to a portion of a clip.
#
# \author willc
# \author Blur Studio
# \date 10/15/15
#
import cross3d
from cross3d import abstractme... |
esphome/components/nextion/binary_sensor/__init__.py | OttoWinter/esphomeyaml | 249 | 11027002 | <filename>esphome/components/nextion/binary_sensor/__init__.py
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import binary_sensor
from esphome.const import CONF_COMPONENT_ID, CONF_PAGE_ID, CONF_ID
from .. import nextion_ns, CONF_NEXTION_ID
from ..base_component import (
... |
app_kbqa/BAMnet/src/core/utils/utils.py | kiendt07/foodkg.github.io | 170 | 11027006 | '''
Created on Sep, 2017
@author: hugo
'''
import os
import re
import yaml
import gzip
import json
import string
import numpy as np
from nltk.tokenize import wordpunct_tokenize#, word_tokenize
# tokenize = lambda s: word_tokenize(re.sub(r'[%s]' % punc_wo_dot, ' ', re.sub(r'(?<!\d)[%s](?!\d)' % string.punctuation, '... |
ib/ext/cfg/ContractDetails.py | LewisW/IbPy | 1,260 | 11027020 | <filename>ib/ext/cfg/ContractDetails.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" ib.ext.cfg.ContractDetails -> config module for ContratDetails.java.
"""
from java2python.config.default import modulePrologueHandlers
from cfg import outputSubs
modulePrologueHandlers += [
'from ib.lib.overloading import ov... |
tinderbotz/helpers/match.py | cr4zy8/TinderBotz | 202 | 11027032 | from tinderbotz.helpers.geomatch import Geomatch
# A match has the same information as a geomatch, except that you have a chatroom with an id
class Match(Geomatch):
def __init__(self, name, chatid, age, work, study, home, gender, bio, distance, passions, image_urls):
self.chatid = chatid
# invoki... |
Python/klampt/control/system_id.py | joaomcm/Klampt | 238 | 11027041 | <filename>Python/klampt/control/system_id.py
import numpy as np
import math
def check_symmetry(A,tol=1e-7):
err = np.amax(np.abs(A - A.T))
if err >= tol:
print("Error in matrix symmetry? error %f"%(err,))
return False
return True
def sherman_woodbury_inplace(Ainv,v,w,c=1.0):
"""Compute... |
sample/sample_update.py | thombashi/SimpleSQLite | 126 | 11027051 | #!/usr/bin/env python3
from simplesqlite import SimpleSQLite
from simplesqlite.query import Where
def main():
table_name = "sample_table"
con = SimpleSQLite("sample.sqlite", "w")
data_matrix = [[1, "aaa"], [2, "bbb"]]
con.create_table_from_data_matrix(table_name, ["key", "value"], data_matrix)
... |
Chapter04/critic_network.py | jvstinian/Python-Reinforcement-Learning-Projects | 114 | 11027057 | <filename>Chapter04/critic_network.py
'''
Created on Apr 10, 2018
@author: ywz
'''
import tensorflow as tf
from layers import dense
class CriticNetwork:
def __init__(self, input_state, input_action, hidden_layers):
assert len(hidden_layers) >= 2
self.input_state = input_state
... |
torchrecipes/rec/tests/test_dlrm_main.py | colin2328/recipes | 161 | 11027095 | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import os
import tempfile
import unittest
import uuid
from torch.distributed.launcher.api import elastic_launch, LaunchConfig
from t... |
src/gui/screens/__init__.py | mflaxman/specter-diy | 279 | 11027100 | from .screen import Screen
from .menu import Menu
from .alert import Alert
from .prompt import Prompt
from .qralert import QRAlert
from .progress import Progress
from .input import PinScreen, InputScreen, DerivationScreen, NumericScreen
from .mnemonic import MnemonicScreen, NewMnemonicScreen, RecoverMnemonicScreen
from... |
app/api_1_0/report_manage.py | wuqundong520/ApiTestManage | 318 | 11027121 | <reponame>wuqundong520/ApiTestManage
import json
import copy
from flask import jsonify, request
from . import api, login_required
from app.models import *
from ..util.http_run import RunCase
from ..util.global_variable import *
from ..util.report.report import render_html_report
from flask_login import current_user
@... |
doomFiles/action_space.py | acenturyandabit/noreward-rl | 1,369 | 11027137 | '''
Place this file in:
/home/pathak/projects/unsup-rl/unsuprl/local/lib/python2.7/site-packages/ppaquette_gym_doom/wrappers/action_space.py
'''
import gym
# Constants
NUM_ACTIONS = 43
ALLOWED_ACTIONS = [
[0, 10, 11], # 0 - Basic
[0, 10, 11, 13, 14, 15], # 1 -... |
inside/DB/Table_Class/Project.py | kangzai228/learning-power | 318 | 11027180 | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
# @Author : lisztomania
# @Date : 2021/2/6
# @Software : Pycharm
# @Version : Python 3.8.5
# @File : Project.py
# @Function : 专项答题类
__all__ = ['PROJECT']
class PROJECT(object):
def __init__(self, pid: int):
"""
PROJECT(pid: int)
初始化... |
tests/integration/video/sources/test_ImageSource.py | scherroman/mugen | 119 | 11027204 | <reponame>scherroman/mugen
import pytest
from mugen.video.sources.ImageSource import ImageSource
from tests import DATA_PATH
@pytest.fixture
def tatami_source() -> ImageSource:
return ImageSource(f'{DATA_PATH}/image/tatami.jpg')
def test_sample():
image_source = tatami_source()
assert image_source.sam... |
tests/test_curry.py | bofm/fn.py | 120 | 11027276 | import unittest
from fn.func import curried, _has_type_hint_support
class Curriedtest(unittest.TestCase):
def _assert_instance(self, expected, acutal):
self.assertEqual(expected.__module__, acutal.__module__)
self.assertEqual(expected.__name__, acutal.__name__)
if _has_type_hint_support... |
tests/test_general_socket_methods.py | HRI-EU/HRI-nanomsg-python | 334 | 11027291 | import unittest
import os
from nanomsg_wrappers import set_wrapper_choice, get_default_for_platform
set_wrapper_choice(os.environ.get('NANOMSG_PY_TEST_WRAPPER',
get_default_for_platform()))
from nanomsg import (
PAIR,
Socket,
SNDBUF,
SOL_SOCKET
)
SOCKET_ADDRESS = os.... |
nmslib/nms/__init__.py | doanthuyennt/DRRG | 227 | 11027308 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = '古溪'
# from . import gpu_nms
# from . import cython_nms |
unified_message_relay/Core/UMRAdmin.py | 1715173329/UnifiedMessageRelay | 293 | 11027316 | from typing import Dict, List
from . import UMRConfig
from . import UMRLogging
from .UMRDriver import api_call
from .UMRType import ChatType
# Stateless
logger = UMRLogging.get_logger('Admin')
async def is_bot_admin(platform: str, user_id: int) -> bool:
"""
check if user is in bot admin list
:param plat... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.