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/exchange2010/test_get_folder.py | tedeler/pyexchange | 128 | 12652204 | """
(c) 2013 LinkedIn Corp. 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 law or agreed to in writing... |
php_companion/commands/import_use_command.py | risingphoenix/SublimePHPCompanion | 979 | 12652206 | import sublime
import sublime_plugin
from ..settings import get_setting
class ImportUseCommand(sublime_plugin.TextCommand):
def run(self, edit, namespace):
self.namespace = namespace
if self.is_already_used():
return self.view.show_popup('Use already exist!',
... |
Validation/RecoVertex/test/demoProducePrimaryVertex_cfg.py | ckamtsikis/cmssw | 852 | 12652216 | import FWCore.ParameterSet.Config as cms
process = cms.Process("DempProduce")
#keep the logging output to a nice level
process.load("FWCore.MessageLogger.MessageLogger_cfi")
process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
process.load("Configuration.StandardSequences.MagneticField_38T... |
scripts/laser/laser2marian.py | delong-coder/marian-dev | 829 | 12652229 | import numpy as np
import sys
import yaml
import argparse
import torch
parser = argparse.ArgumentParser(description='Convert LASER model to Marian weight file.')
parser.add_argument('--laser', help='Path to LASER PyTorch model', required=True)
parser.add_argument('--marian', help='Output path for Marian weight file',... |
Flask/models.py | Zhgx/bili | 166 | 12652264 | # pip install flask-sqlalchemy
from flask_sqlalchemy import SQLAlchemy
from flask import Flask
app = Flask(__name__)
# app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+pymysql://root:123456@127.0.0.1:3306/test'
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + "/home/lmp/test.db"
app.config['SQLALCHEMY_TRACK_MOD... |
seq2seq/tools/__init__.py | eladhoffer/seq2seq.pytorch | 587 | 12652266 | <filename>seq2seq/tools/__init__.py
import torch
from random import randrange
from math import floor
from torch.nn.utils.rnn import pack_padded_sequence, PackedSequence
from .config import PAD
def _limit_lengths(seqs, max_length=None, max_tokens=None):
max_length = max_length or float('inf')
lengths = [min(s.... |
fooltrader/sched/sched_china_stock_quote.py | beaquant/fooltrader | 1,103 | 12652268 | # -*- coding: utf-8 -*-
import logging
from apscheduler.schedulers.background import BackgroundScheduler
from fooltrader.connector import es_connector
from fooltrader.datamanager.china_stock_manager import crawl_stock_quote, crawl_index_quote
from fooltrader.settings import STOCK_START_CODE, STOCK_END_CODE
from fool... |
src/mylib/sklearn/fe/pair_count_encoder.py | murez/mobile-semantic-segmentation | 713 | 12652323 | import pandas as pd
from sklearn.base import TransformerMixin
from sklearn.decomposition import TruncatedSVD
import numpy as np
# https://www.kaggle.com/matleonard/categorical-encodings
class PairCountEncoder(TransformerMixin):
def __init__(self, n_components=3, seed=123):
self.svd = TruncatedSVD(n_compon... |
search/utils.py | IAmPara0x/yuno | 349 | 12652337 | from typing import (Callable, Optional, List, TypeVar, Tuple, Dict, Union)
from cytoolz.curried import ( # type: ignore
curry, compose, flip, nth, concat, itemmap, groupby, filter)
from returns.maybe import Maybe, Nothing
import numpy as np
import torch
from .config import Config
from .base import Data
A = Type... |
model_search/metric_fns_test.py | dywsjtu/model_search | 3,315 | 12652355 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
dirscan/dirsearch/thirdparty/sqlmap/__init__.py | imfiver/Sec-Tools | 351 | 12652408 | <reponame>imfiver/Sec-Tools
from .DynamicContentParser import *
|
build/scripts/run_tool.py | HeyLey/catboost | 6,989 | 12652454 | import sys
import subprocess
import os
if __name__ == '__main__':
env = os.environ.copy()
env['ASAN_OPTIONS'] = 'detect_leaks=0'
subprocess.check_call(sys.argv[sys.argv.index('--') + 1:], env=env)
|
mask_rcnn_train_chain.py | mikito0011/Chainer_Mask_R-CNN | 153 | 12652463 | import numpy as np
import chainer
from chainer import cuda
import chainer.functions as F
from chainercv.links.model.faster_rcnn.utils.anchor_target_creator import AnchorTargetCreator
from utils.proposal_target_creator import ProposalTargetCreator
from chainer import computational_graph as c
from chainercv.li... |
src/gimelstudio/core/__init__.py | Correct-Syntax/GimelStudio | 134 | 12652503 | from .datatypes import RenderImage
from .eval_info import EvalInfo
from .output_eval import OutputNodeEval
from .renderer import Renderer
from .glsl_renderer import GLSLRenderer
from .registry import RegisterNode, UnregisterNode, NODE_REGISTRY
from .project_file import ProjectFileIO
|
trigger/contrib/xmlrpc/server.py | jccardonar/trigger | 380 | 12652539 | """
Trigger Twisted XMLRPC server with an SSH manhole. Supports SSL.
This provides a daemonized Twisted reactor loop, Trigger and client
applications do not have to co-habitate. Using the XMLRPC server model, all
Trigger compatibility tasks can be executed using simple XMLRPC clients that
call the appropriate method w... |
SimG4Core/PrintGeomInfo/python/testTotemGeometryXML_cfi.py | ckamtsikis/cmssw | 852 | 12652542 | <gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
XMLIdealGeometryESSource = cms.ESSource("XMLIdealGeometryESSource",
geomXMLFiles = cms.vstring('Geometry/CMSCommonData/data/materials.xml',
'Geometry/CMSCommonData/data/rotations.xml',
'Geometry/CMSCommonData/data/extend/cmsextent.xml',
... |
RST/ODSAextensions/odsa/chapnum/chapnum.py | dwgillies/OpenDSA | 200 | 12652563 | <filename>RST/ODSAextensions/odsa/chapnum/chapnum.py
# Copyright (C) 2012 <NAME>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the MIT License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ... |
python/pmtiles/reader.py | eddy-geek/PMTiles | 133 | 12652568 | import json
import mmap
from contextlib import contextmanager
@contextmanager
def read(fname):
r = Reader(fname)
try:
yield r
finally:
r.close()
class Reader:
def __init__(self,fname):
self.f = open(fname, "r+b")
self.mmap = mmap.mmap(self.f.fileno(), 0)
assert ... |
pipenv/vendor/passa/internals/traces.py | jrottenberg/pipenv | 6,263 | 12652581 | <reponame>jrottenberg/pipenv
# -*- coding=utf-8 -*-
from __future__ import absolute_import, unicode_literals
def _trace_visit_vertex(graph, current, target, visited, path, paths):
if current == target:
paths.append(path)
return
for v in graph.iter_children(current):
if v == current or... |
alipay/aop/api/domain/OrderStatusData.py | antopen/alipay-sdk-python-all | 213 | 12652592 | <reponame>antopen/alipay-sdk-python-all
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class OrderStatusData(object):
def __init__(self):
self._order_id = None
self._reject_reason = None
self._status = None
@property
... |
atest/logcheck.py | icankeep/jupyterlab-lsp | 1,117 | 12652689 | <filename>atest/logcheck.py<gh_stars>1000+
from bs4 import UnicodeDammit
def file_should_not_contain_phrases(filename, offset=0, *phrases):
"""don't fail _too_ hard if the file can't be read for some reason"""
with open(filename, "rb") as fp:
raw = fp.read()[offset:]
text = None
try:
... |
app/demo/periods/__init__.py | sesostris/django-material-admin | 270 | 12652690 | default_app_config = 'demo.periods.apps.PeriodsConfig'
|
symmetric_tree/solution.py | mahimadubey/leetcode-python | 528 | 12652695 | <filename>symmetric_tree/solution.py
"""
Given a binary tree, check whether it is a mirror of itself (ie, symmetric
around its center).
For example, this binary tree is symmetric:
1
/ \
2 2
/ \ / \
3 4 4 3
But the following is not:
1
/ \
2 2
\ \
3 3
"""
# Definition for a binary t... |
tests/test_client/auth_backends.py | jpmallarino/django | 61,676 | 12652704 | from django.contrib.auth.backends import ModelBackend
class TestClientBackend(ModelBackend):
pass
class BackendWithoutGetUserMethod:
pass
|
HLTriggerOffline/SUSYBSM/test/SUSYBSM_triggerValidation.py | ckamtsikis/cmssw | 852 | 12652707 | import FWCore.ParameterSet.Config as cms
process = cms.Process("DQM")
#
# DQM SERVICES
#
process.load("DQMServices.Core.DQM_cfg")
process.load("FWCore.MessageService.MessageLogger_cfi")
#
# DQM SOURCES
#
process.load("CondCore.DBCommon.CondDBSetup_cfi")
#process.load("Configuration.GlobalRuns.ForceZeroTeslaField_... |
deep-rl/lib/python2.7/site-packages/OpenGL/raw/GL/SUN/vertex.py | ShujaKhalid/deep-rl | 210 | 12652727 | <filename>deep-rl/lib/python2.7/site-packages/OpenGL/raw/GL/SUN/vertex.py
'''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.GL import _types as _cs
# End users want this...
from OpenGL.raw.GL._types import *
from OpenGL.raw.GL ... |
laed/dataset/__init__.py | jaywalnut310/NeuralDialog-LAED | 195 | 12652728 | <reponame>jaywalnut310/NeuralDialog-LAED
# @Time : 12/4/17 4:28 PM
# @Author : <NAME> |
polymetis/polymetis/python/polymetis/utils/data_dir.py | ali-senguel/fairo | 669 | 12652732 | # Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import polymetis
PKG_ROOT_DIR = polymetis.__path__[0]
DATA_DIR = os.path.join(PKG_ROOT_DIR, "data")
def get_full_path_to_urdf(pat... |
nxt_editor/pixmap_button.py | Mikfr83/nxt_editor | 131 | 12652755 | <filename>nxt_editor/pixmap_button.py<gh_stars>100-1000
# External
from Qt import QtWidgets
from Qt import QtGui
from Qt import QtCore
class PixmapButton(QtWidgets.QAbstractButton):
"""https://stackoverflow.com/questions/2711033/how-code-a-image-button-in-pyqt"""
def __init__(self, pixmap, pixmap_hover, pixma... |
language/totto/prepare_references_for_eval.py | naveenjafer/language | 1,199 | 12652767 | # coding=utf-8
# Copyright 2018 The Google AI Language Team 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 ... |
WebMirror/management/rss_parser_funcs/feed_parse_extractAlpenGlowTranslations.py | fake-name/ReadableWebProxy | 193 | 12652790 | def extractAlpenGlowTranslations(item):
"""
'Alpen Glow Translations'
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol or frag) or 'preview' in item['title'].lower():
return None
tagmap = {
'<NAME>' : 'The Legend of the Concu... |
pygears/lib/czip.py | bogdanvuk/pygears | 120 | 12652808 | <reponame>bogdanvuk/pygears
from pygears import module
from pygears.sim import delta
from pygears.typing import Queue, Tuple, typeof
from pygears import gear, alternative
from pygears.lib.shred import shred
from .ccat import ccat
from .permute import permuted_apply
from .cat_util import din_data_cat_value
from functool... |
pkgs/tools/yasm/src/tools/python-yasm/pyxelator/lexer.py | manggoguy/parsec-modified | 2,151 | 12652832 | #!/usr/bin/env python
""" cdecl.py - parse c declarations
(c) 2002, 2003, 2004, 2005 <NAME> <<EMAIL>>
Released under GNU LGPL license.
version 0.xx
"""
import sys
import string
import types
import copy
#from cparse import BasicType, Qualifier, StorageClass, Typedef, Ellipses, GCCBuiltin
#from cparse import *
impo... |
general/detect-fraudulent-transactions/transactions.py | caesarcc/python-code-tutorials | 1,059 | 12652838 | <filename>general/detect-fraudulent-transactions/transactions.py
from random import choices, randint
from string import ascii_letters, digits
account_chars: str = digits + ascii_letters
def _random_account_id() -> str:
"""Return a random account number made of 12 characters"""
return "".join(choices(account_c... |
table_base.py | akrabat/SublimeTableEditor | 313 | 12652854 | # table_base.py - Key classes and methods for pretty print text table.
# Copyright (C) 2012 Free Software Foundation, Inc.
# Author: <NAME>
# Package: SublimeTableEditor
# Homepage: https://github.com/vkocubinsky/SublimeTableEditor
# This file is part of SublimeTableEditor.
# SublimeTableEditor is free software: y... |
snimpy/manager.py | vincentbernat/snimpy | 129 | 12652874 | #
# snimpy -- Interactive SNMP tool
#
# Copyright (C) <NAME> <<EMAIL>>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "A... |
graph_kernel/test.py | rcmckee/BPT | 123 | 12652880 | import torch as th
from graphop import *
from torch.autograd import Function
from part_csr import partition_csr
chunk_size = 32
class SparseSoftmax(Function):
@staticmethod
def forward(ctx, row, indptr, eid, x):
y = sparse_softmax_forward(row, indptr, eid, x)
ctx.save_for_backward(row, indptr,... |
src/spaczz/pipeline/_spaczzruler.py | JonasHablitzel/spaczz | 153 | 12652918 | """Module for spaCy v3 compatible SpaczzRuler."""
from __future__ import annotations
from collections import defaultdict
from itertools import chain
from logging import exception
from pathlib import Path
from typing import (
Any,
Callable,
DefaultDict,
Dict,
Iterable,
List,
Optional,
Se... |
test/itest_close.py | tnakagawa/lit | 560 | 12652922 | <reponame>tnakagawa/lit
import testlib
import test_combinators
def forward(env):
lit1 = env.lits[0]
lit2 = env.lits[1]
test_combinators.run_close_test(env, lit1, lit2, lit1)
def reverse(env):
lit1 = env.lits[0]
lit2 = env.lits[1]
test_combinators.run_close_test(env, lit1, lit2, lit1)
|
examples/research_projects/movement-pruning/emmental/modules/__init__.py | liminghao1630/transformers | 50,404 | 12652923 | <gh_stars>1000+
# flake8: noqa
from .binarizer import MagnitudeBinarizer, ThresholdBinarizer, TopKBinarizer
from .masked_nn import MaskedLinear
|
fireant/dataset/data_blending.py | mikeengland/fireant | 122 | 12652928 | <gh_stars>100-1000
from fireant.dataset.fields import Field
from fireant.dataset.klass import DataSet
from fireant.queries.builder import (
DataSetBlenderQueryBuilder,
DimensionChoicesQueryBuilder,
)
from fireant.utils import (
deepcopy,
immutable,
ordered_distinct_list_by_attr,
)
def _wrap_datase... |
PythonLinearNonlinearControl/controllers/mpc.py | Geonhee-LEE/PythonLinearNonlinearControl | 425 | 12652946 | <reponame>Geonhee-LEE/PythonLinearNonlinearControl
from logging import getLogger
import numpy as np
from scipy.optimize import minimize
from scipy.optimize import LinearConstraint
from .controller import Controller
from ..envs.cost import calc_cost
logger = getLogger(__name__)
class LinearMPC(Controller):
""" ... |
exercises/ja/test_01_02_01.py | Jette16/spacy-course | 2,085 | 12652971 | def test():
import spacy.tokens
import spacy.lang.en
assert isinstance(
nlp, spacy.lang.en.English
), "nlpオブジェクトはEnglishクラスのインスタンスでなければなりません"
assert isinstance(doc, spacy.tokens.Doc), "テキストをnlpオブジェクトで処理してdocを作成しましたか?"
assert "print(doc.text)" in __solution__, "doc.textをプリントしましたか?"
... |
kaggle/RANZCR/4th_place_solution/configs/default_config.py | tommydino93/tutorials | 535 | 12652983 | import os
from types import SimpleNamespace
cfg = SimpleNamespace(**{})
# data path
cfg.data_dir = "/workspace/data/ranzcr/"
cfg.data_folder = cfg.data_dir + "train/"
cfg.train_df = cfg.data_dir + "train_folds.csv"
cfg.test_df = cfg.data_dir + "sample_submission.csv"
cfg.output_dir = "./output/weights/"
# dataset
cf... |
test/cut/test_masks.py | stachu86/lhotse | 353 | 12652994 | <filename>test/cut/test_masks.py<gh_stars>100-1000
from itertools import chain
from unittest.mock import Mock
import numpy as np
import pytest
from lhotse import MonoCut, SupervisionSegment
from lhotse.cut import PaddingCut
from lhotse.supervision import AlignmentItem
from lhotse.utils import LOG_EPSILON
class Test... |
tools/scripts/ChitChatUpdate.py | gamontal/botframework-solutions | 601 | 12653040 | import argparse
import os
import typing
import functools
parser = argparse.ArgumentParser(description='Convert tsv to lu')
parser.add_argument('file',type=str)
parser.add_argument('-s','--source',type=str,default='custom editorial')
parser.add_argument('-o','--out',type=str,default=None)
args = parser.parse_args()
wi... |
src/oncall/api/v0/team_admin.py | navoday-91/oncall | 857 | 12653107 | <reponame>navoday-91/oncall
# Copyright (c) LinkedIn Corporation. All rights reserved. Licensed under the BSD-2 Clause license.
# See LICENSE in the project root for license information.
from falcon import HTTPNotFound
from ...auth import login_required, check_team_auth
from ... import db
from ...utils import unsubsc... |
scripts/checks.py | SymbioticLab/Salus | 104 | 12653129 | #
# Copyright 2019 <NAME> <<EMAIL>>
#
# This file is part of Salus
# (see https://github.com/SymbioticLab/Salus).
#
# 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.o... |
deprecated/benchmark/collective/utils/timer.py | hutuxian/FleetX | 170 | 12653134 | <gh_stars>100-1000
#copyright (c) 2019 PaddlePaddle Authors. All Rights Reserve.
#
#Licensed under the Apache License, Version 2.0 (the "License");
#you may not use this file except in compliance with the License.
#You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#Unless requi... |
example/runtests.py | liskin/coveralls-python | 191 | 12653172 | from project import branch
from project import hello
if __name__ == '__main__':
hello()
branch(False, True)
branch(True, True)
|
src/unittest/python/python_utils_tests.py | klr8/pybuilder | 1,419 | 12653221 | <gh_stars>1000+
# -*- coding: utf-8 -*-
#
# This file is part of PyBuilder
#
# Copyright 2011-2020 PyBuilder Team
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://... |
ding/utils/tests/test_plot.py | sailxjx/DI-engine | 464 | 12653273 | import random
import numpy as np
import os
import pytest
from ding.utils.plot_helper import plot
@pytest.mark.unittest
def test_plot():
rewards1 = np.array([0, 0.1, 0, 0.2, 0.4, 0.5, 0.6, 0.9, 0.9, 0.9])
rewards2 = np.array([0, 0, 0.1, 0.4, 0.5, 0.5, 0.55, 0.8, 0.9, 1])
rewards = np.concatenate((rewards1... |
reddit2telegram/channels/~inactive/chessmemesenglish/app.py | CaringCat/reddit2telegram | 187 | 12653285 | #encoding:utf-8
subreddit = 'chessmemes'
t_channel = '@chessmemesenglish'
def send_post(submission, r2t):
return r2t.send_simple(submission)
|
python_uiautomator/device.py | maksonlee/android-uiconductor | 113 | 12653286 | #!/usr/bin/python
#
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... |
src/riotwatcher/_apis/league_of_legends/ClashApiV1.py | TheBoringBakery/Riot-Watcher | 489 | 12653306 | <filename>src/riotwatcher/_apis/league_of_legends/ClashApiV1.py<gh_stars>100-1000
from .. import BaseApi, NamedEndpoint
from .urls import ClashApiV1Urls
class ClashApiV1(NamedEndpoint):
"""
This class wraps the Clash-v1 endpoint calls provided by the Riot API.
See https://developer.riotgames.com/... |
Sources/Workflows/Comics/plugins/ctrl_alt_del/main.py | yagosys/AlfredWorkflow.com | 2,177 | 12653325 | def enabled():
return True
def title():
return "Ctrl+Alt+Del"
def subtitle():
return "View the latest Ctrl+Alt+Del strip"
def run():
import os
import re
content = os.popen("""curl -s http://www.cad-comic.com/cad/""").read().rstrip()
strip = re.match(r'.*?src="(http://v.cdn.cad-comic.com/comics/cad.*?)"' , con... |
office365/onedrive/internal/paths/resource_path_url.py | vgrem/Office365-REST-Python-Client | 544 | 12653342 | from office365.runtime.client_path import ClientPath
class ResourcePathUrl(ClientPath):
"""Resource path for OneDrive path-based addressing"""
def __init__(self, rel_url, parent):
"""
:param str rel_url: File or Folder relative url
:type parent: office365.runtime.client_path.ClientPat... |
cumulusci/tasks/preflight/settings.py | davisagli/CumulusCI | 163 | 12653351 | <filename>cumulusci/tasks/preflight/settings.py
from simple_salesforce.exceptions import SalesforceMalformedRequest
from cumulusci.core.tasks import BaseSalesforceTask
from cumulusci.core.utils import process_bool_arg
from cumulusci.tasks.salesforce.BaseSalesforceApiTask import BaseSalesforceApiTask
class CheckMyDom... |
fsf-server/modules/META_PE_SIGNATURE.py | akniffe1/fsf | 259 | 12653364 | <filename>fsf-server/modules/META_PE_SIGNATURE.py
#!/usr/bin/env python
#
# Author: <NAME>
# Description: Get metadata on the signature used to sign a PE file
# Date: 11/17/2015
#
# Good resources:
# * https://www.cs.auckland.ac.nz/~pgut001/pubs/authenticode.txt
# * http://erny-rev.blogspot.com/2013/10/parsing-x509v3-... |
tfne/populations/codeepneat/codeepneat_population.py | githealthy18/Tensorflow-Neuroevolution | 121 | 12653374 | import statistics
from ..base_population import BasePopulation
class CoDeepNEATPopulation(BasePopulation):
"""
Population class of the CoDeepNEAT algorithm that holds all relevant population information in a single place to
ease summary, serialization and deserialization.
"""
def __init__(self, ... |
mmt/loss/__init__.py | ChienHsuan/MMT | 425 | 12653381 | from __future__ import absolute_import
from .triplet import TripletLoss, SoftTripletLoss
from .crossentropy import CrossEntropyLabelSmooth, SoftEntropy
__all__ = [
'TripletLoss',
'CrossEntropyLabelSmooth',
'SoftTripletLoss',
'SoftEntropy'
]
|
tests/unit/pytorch/distributions/test_deterministic.py | chiragnagpal/probflow | 134 | 12653405 | import numpy as np
import pytest
import torch
from probflow.distributions import Deterministic
from probflow.utils.torch_distributions import get_TorchDeterministic
tod = torch.distributions
def is_close(a, b, tol=1e-3):
return np.abs(a - b) < tol
def test_TorchDeterministic():
"""Tests the TorchDetermini... |
tests/test_bitmap.py | sylencecc/spamscope | 252 | 12653407 | <filename>tests/test_bitmap.py<gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright 2016 <NAME> (https://www.linkedin.com/in/fmantuano/)
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 th... |
tests/test_blending_range.py | andrewvaliente/pytoshop | 106 | 12653412 | <filename>tests/test_blending_range.py
# -*- coding: utf-8 -*-
import pytest
from pytoshop import blending_range
def _test_default_blending_range(b):
assert b.black0 == 0
assert b.black1 == 0
assert b.white0 == 0
assert b.white1 == 0
def test_default_blending_range():
b = blending_range.Blen... |
api/base/graphql.py | RyanNoelk/OpenEats | 113 | 12653413 | #!/usr/bin/env python
# encoding: utf-8
from __future__ import unicode_literals
from django.conf import settings
from graphene import ObjectType, Field, Schema
from graphene_django.debug import DjangoDebug
from v1.recipe.schema import RecipeQuery, RecipeMutations
from v1.recipe_groups.schema import RecipeGroupQuery, R... |
lib/pymedphys/_streamlit/apps/metersetmap/_config.py | ethanio12345/pymedphys | 207 | 12653427 | <reponame>ethanio12345/pymedphys<filename>lib/pymedphys/_streamlit/apps/metersetmap/_config.py
# Copyright (C) 2020-2021 Cancer Care Associates
# 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
... |
rdkit/DataStructs/UnitTestTopNContainer.py | kazuyaujihara/rdkit | 1,609 | 12653432 | <filename>rdkit/DataStructs/UnitTestTopNContainer.py
# $Id$
#
# Copyright (C) 2003-2006 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 so... |
crates/tree/benchmarks/boston.py | OneToolsCollection/tangramdotdev-tangram | 957 | 12653441 | <reponame>OneToolsCollection/tangramdotdev-tangram
from pandas.api.types import CategoricalDtype
from sklearn.metrics import mean_squared_error
import argparse
import numpy as np
import pandas as pd
import json
parser = argparse.ArgumentParser()
parser.add_argument('--library', choices=['h2o', 'lightgbm', 'sklearn', '... |
Recycled/wechatservice/route.py | lifg2000/StockAnalysisSystem | 138 | 12653460 | <reponame>lifg2000/StockAnalysisSystem
import time
import hashlib
from flask import request
from .wechat import WeChat
from StockAnalysisSystem.core.config import Config
wechat: WeChat = None
SasUserWxUserDict = {
}
WxUserSasUserDict = {
}
# ---------------------------------------------------------------------... |
packages/python/pyfora/PureImplementationMappings.py | ufora/ufora | 571 | 12653466 | <reponame>ufora/ufora
# Copyright 2015 Ufora Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
api/views.py | annevandalfsen/screenbird | 121 | 12653478 | <filename>api/views.py
def config_record_on_account(request,account_id):
pass
def config_record_on_channel(request, channel_id):
pass
|
scripts/mesh/mesh_uploader.py | AlfiyaRF/cloud-pipeline | 126 | 12653490 | <gh_stars>100-1000
# Copyright 2017-2020 EPAM Systems, Inc. (https://www.epam.com/)
#
# 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
#
# Unles... |
loss/IQA/fsim.py | milesgray/CALAE | 203 | 12653495 | <reponame>milesgray/CALAE<gh_stars>100-1000
import numpy as np
import os
import sys
import torch
from torchvision import models,transforms
import torch.nn as nn
import torch.nn.functional as F
import inspect
from numpy.fft import fft2, ifft2, fftshift, ifftshift
import math
from .utils import abs, real, imag, downsampl... |
AudioOwl/analyze.py | davisnando/AudioOwl | 178 | 12653511 | import librosa
import madmom
from madmom.features.beats import *
from scipy import signal
import numpy as np
def peak_picking(beat_times, total_samples, kernel_size, offset):
# smoothing the beat function
cut_off_norm = len(beat_times)/total_samples*100/2
b, a = signal.butter(1, cut_off_norm)
beat_tim... |
contrib/performance/_event_change.py | backwardn/ccs-calendarserver | 462 | 12653525 | <gh_stars>100-1000
##
# Copyright (c) 2010-2017 Apple 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 r... |
taint_analysis/path_analysis.py | k-karakatsanis/BootStomp | 354 | 12653528 | from idc import *
from idaapi import *
from idautils import *
from re import *
class FuncInfo:
name = ''
addr = 0
size = 0
cond_stmt = 0
loop_stmt = 0
class PathAnalyze:
def __init__(self):
self.all_func_info = []
def write_function_info(self):
with open('function_info.txt', 'w') as finfo:
finfo.wr... |
Chapter11/c11_18_sort_pandas.py | John-ye666/Python-for-Finance-Second-Edition | 236 | 12653545 | # -*- coding: utf-8 -*-
"""
Name : c11_18_sort_pandas.py
Book : Python for Finance (2nd ed.)
Publisher: Packt Publishing Ltd.
Author : <NAME>
Date : 6/6/2017
email : <EMAIL>
<EMAIL>
"""
import pandas as pd
a = pd.DataFrame([[9,4],[9,2],[1,-1]],columns=['A','B'])
print(a)
# s... |
src/api-service/__app__/queue_updates/__init__.py | tonybaloney/onefuzz | 2,692 | 12653550 | <reponame>tonybaloney/onefuzz
#!/usr/bin/env python
#
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import json
import azure.functions as func
from ..onefuzzlib.updates import Update, execute_update
def main(msg: func.QueueMessage) -> None:
body = msg.get_body()
update = Update.p... |
petlib/bn.py | SignorMercurio/petlib | 112 | 12653587 | from .bindings import _FFI, _C, get_errors
from functools import wraps
from copy import copy, deepcopy
from binascii import hexlify, unhexlify # pylint: disable=unused-import
# Py2/3 compatibility
try:
from builtins import int # pylint: disable=redefined-builtin
from builtins import object # pylin... |
angrmanagement/plugins/log_reverse_engineering/log_reverse_engineering_plugin.py | DennyDai/angr-management | 474 | 12653596 | <reponame>DennyDai/angr-management
from angrmanagement.config import Conf
from ..base_plugin import BasePlugin
try:
from slacrs import Slacrs
from slacrs.model import VariableRename, FunctionRename, ReverseEngineeringProgress
except ImportError as ex:
Slacrs = None # type: Optional[type]
VariableRena... |
tools/utilities/pythonlibs/vision/add_image_preprocessing_metadata.py | awf/ELL | 2,094 | 12653598 | <reponame>awf/ELL<gh_stars>1000+
#!/usr/bin/env python3
###################################################################################################
#
# Project: Embedded Learning Library (ELL)
# File: add_image_preprocessing_metadata.py
# Authors: <NAME>
#
# Requires: Python 3.x
#
####################... |
src/pretix/base/migrations/0058_auto_20170429_1020.py | pajowu/pretix | 1,248 | 12653623 | <filename>src/pretix/base/migrations/0058_auto_20170429_1020.py
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-04-29 10:20
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('pretixbase', '0052_team_team... |
tests/test_util_xpub.py | rafa1239/specter-desktop | 683 | 12653631 | <gh_stars>100-1000
import pytest
from cryptoadvance.specter.util.xpub import (
convert_xpub_prefix,
get_xpub_fingerprint,
)
### Tests for xpub
def test_convert_to_ypub(ghost_machine_xpub_49, ghost_machine_ypub):
new_prefix = b"\x04\x9d\x7c\xb2"
assert convert_xpub_prefix(ghost_machine_xpub_49, new_p... |
tests/local/test_PacerNotificationEmailTest.py | mmantel/juriscraper | 228 | 12653640 | <filename>tests/local/test_PacerNotificationEmailTest.py
import os
from juriscraper.pacer.email import NotificationEmail, S3NotificationEmail
from tests import TESTS_ROOT_EXAMPLES_PACER
from tests.local.PacerParseTestCase import PacerParseTestCase
TESTS_ROOT_EXAMPLES_PACER_NEF = os.path.join(TESTS_ROOT_EXAMPLES_PACER... |
pantalaimon/thread_messages.py | arthurlutz/pantalaimon | 216 | 12653655 | <reponame>arthurlutz/pantalaimon
# Copyright 2019 The Matrix.org Foundation CIC
#
# 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 r... |
tests/test_utils.py | JARVIS-AI/EulerPy | 210 | 12653687 | <reponame>JARVIS-AI/EulerPy<gh_stars>100-1000
# -*- coding: utf-8 -*-
import os
import json
import textwrap
import unittest
from EulerPy.problem import Problem
from EulerPy.utils import human_time
EULER_DIR = os.path.dirname(os.path.dirname(__file__))
EULER_DATA = os.path.join(EULER_DIR, 'EulerPy', 'data')
class E... |
tests/modules/contrib/test_yubikey.py | spxtr/bumblebee-status | 1,089 | 12653729 | <filename>tests/modules/contrib/test_yubikey.py
import pytest
pytest.importorskip("yubico")
def test_load_module():
__import__("modules.contrib.yubikey")
|
lib/django-1.5/django/contrib/auth/tests/utils.py | MiCHiLU/google_appengine_sdk | 790 | 12653756 | <reponame>MiCHiLU/google_appengine_sdk
from django.conf import settings
from django.utils.unittest import skipIf
def skipIfCustomUser(test_func):
"""
Skip a test if a custom user model is in use.
"""
return skipIf(settings.AUTH_USER_MODEL != 'auth.User', 'Custom user model in use')(test_func)
|
rpython/jit/metainterp/test/test_pyjitpl.py | nanjekyejoannah/pypy | 381 | 12653771 |
# some unit tests for the bytecode decoding
import py
from rpython.jit.metainterp import pyjitpl
from rpython.jit.metainterp import jitprof
from rpython.jit.metainterp.history import ConstInt
from rpython.jit.metainterp.history import History, IntFrontendOp
from rpython.jit.metainterp.resoperation import ResOperation... |
backend/config/urls.py | FroggyTaipei/froggy-service | 174 | 12653775 | from django.conf.urls.static import static
from django.conf import settings
from django.urls import path
from django.contrib import admin
from django.conf.urls import include
from rest_framework import permissions
from drf_yasg.views import get_schema_view
from drf_yasg import openapi
from config.api import api
from ... |
nodes/0.7.x/python/Element.Host.py | jdehotin/Clockworkfordynamo | 147 | 12653788 | <reponame>jdehotin/Clockworkfordynamo<gh_stars>100-1000
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
... |
kansha/alembic/versions/1bd634091036_add_display_week_numbers.py | AnomalistDesignLLC/kansha | 161 | 12653796 | <filename>kansha/alembic/versions/1bd634091036_add_display_week_numbers.py<gh_stars>100-1000
"""add display week numbers
Revision ID: 1bd634091036
Revises: <PASSWORD>
Create Date: 2015-09-15 11:51:46.739150
"""
# revision identifiers, used by Alembic.
revision = '1bd634091036'
down_revision = '<PASSWORD>'
from alem... |
Patterns/MACD.py | yanding/Stock-Analysis | 357 | 12653803 | '''
Author: <NAME>
Date: 8/17/2018
Description: Creates a dataframe with moving averages and MACD oscillator
'''
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from datetime import datetime, timedelta
from iexfinance import get_historical_data
moving_avg1 = 10
moving_avg2 = 20
ticker = "BABA"
... |
client/python/tests/test_single_packet.py | TimeToogo/fire-and-forget-http | 747 | 12653826 | <reponame>TimeToogo/fire-and-forget-http<gh_stars>100-1000
from ff_client import FfClient, FfConfig, FfRequest
import unittest
import logging
import time
class TestFfClientSinglePacket(unittest.TestCase):
def test_create_request_packets_for_get_request(self):
client = FfClient(FfConfig(ip_address='127.0.0.... |
neo/Prompt/PromptPrinter.py | volekerb/neo-python | 387 | 12653833 | <gh_stars>100-1000
from prompt_toolkit import print_formatted_text
from prompt_toolkit.formatted_text import FormattedText
from prompt_toolkit.styles import Style
from neo.UserPreferences import preferences
import os
import sys
token_style = Style.from_dict({
"command": preferences.token_style['Command'],
"neo... |
iCTF/2018/fantasticiot/exploit.py | Per5ianCat/ctf-writeups | 476 | 12653842 | #!/usr/bin/env python2
# This code was written 10 hours before the competition, yikes
# Any bugs are your problem
import socks # pip install PySocks
import socket
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, '127.0.0.1', 4444)
socket.socket = socks.socksocket
from pwn import * # pip install pwntools
from swpag_cli... |
examples/scripts/example24.py | Alehud/QuSpin | 195 | 12653845 | <gh_stars>100-1000
from __future__ import print_function, division
#
import sys,os
os.environ['KMP_DUPLICATE_LIB_OK']='True' # uncomment this line if omp error occurs on OSX for python 3
os.environ['OMP_NUM_THREADS']='1' # set number of OpenMP threads to run in parallel
os.environ['MKL_NUM_THREADS']='1' # set number of... |
tests/Wrist_IK_loop_test.py | mdecourse/IKBT | 129 | 12653868 | <reponame>mdecourse/IKBT
#!/usr/bin/python
# Python inverse kinematic equations for Wrist
# This test performs the following:
#
# 1) Generate a reachable 4x4 pose
# 2) run the generated IK Python code for "Wrist" robot
# 3) take resulting list of joint-solutions and put them back into
# forward kinematic... |
legr.py | cmu-enyac/LeGR | 106 | 12653875 | import os
import time
import torch
import queue
import argparse
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from utils.drivers import train, test, get_dataloader
from model.MobileNetV2 import MobileNetV2, InvertedResidual
from pruner.fp_mbnetv2 import FilterPrun... |
challenge_7/python/wost/find_missing_number.py | rchicoli/2017-challenges | 271 | 12653880 | <filename>challenge_7/python/wost/find_missing_number.py
def find_missing_number(c):
b = max(c)
d = min(c + [0]) if min(c) == 1 else min(c)
v = set(range(d, b)) - set(c)
return list(v)[0] if v != set() else None
print(find_missing_number([1, 3, 2, 4]))
print(find_missing_number([0, 2, 3, 4, 5]))
print(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.