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 |
|---|---|---|---|---|
src/winforms/toga_winforms/widgets/tree.py | luizoti/toga | 1,261 | 77964 | from toga_winforms.libs import WinForms
from .base import Widget
class Tree(Widget):
def create(self):
self.native = WinForms.TreeView()
def row_data(self, item):
self.interface.factory.not_implemented('Tree.row_data()')
def on_select(self, selection):
self.interface.factory.not... |
qt4i/driver/host.py | beijixing0202/QT4i | 209 | 77967 | <gh_stars>100-1000
# -*- coding:utf-8 -*-
#
# Tencent is pleased to support the open source community by making QTA available.
# Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved.
# Licensed under the BSD 3-Clause License (the "License"); you may not use this
# file except in compliance with the... |
scripts/templates/a_verify.py | eBay/accelerator | 143 | 77972 | <filename>scripts/templates/a_verify.py
from math import isnan
from datetime import datetime
import sys
import accelerator
from accelerator.test_methods import test_data
options = dict(n=int, now=datetime)
jobs = ('source',)
nanmarker = object()
def nanfix(values):
def fix(v):
if isinstance(v, float) and isnan(v)... |
biostar/utils/spamlib.py | tangibleai/biostar-central | 477 | 77981 | <reponame>tangibleai/biostar-central
'''
Spam predictor
pip install -U scikit-learn
X are the data features
y are the labels [ 0, 0, 1 ...]
Download the enron database for testing
http://www2.aueb.gr/users/ion/data/enron-spam/
Should work on any of the datasets:
seq 1 6 | parallel -j 1 wget -q -nc http://www.aue... |
libs/webargs/falconparser.py | Sparklingx/nzbhydra | 674 | 77986 | # -*- coding: utf-8 -*-
"""Falcon request argument parsing module.
"""
import falcon
from webargs import core
HTTP_422 = '422 Unprocessable entity'
def parse_json_body(req):
if req.content_length in (None, 0):
# Nothing to do
return {}
content_type = req.get_header('Content-Type')
if cont... |
airbyte-integrations/bases/airbyte-protocol/airbyte_protocol/models/__init__.py | rajatariya21/airbyte | 6,215 | 78020 | # generated by generate-protocol-files
from .airbyte_protocol import *
|
examples/all_refs.py | wyfo/apimodel | 118 | 78063 | from dataclasses import dataclass
from apischema.json_schema import deserialization_schema
@dataclass
class Bar:
baz: str
@dataclass
class Foo:
bar1: Bar
bar2: Bar
assert deserialization_schema(Foo, all_refs=False) == {
"$schema": "http://json-schema.org/draft/2020-12/schema#",
"$defs": {
... |
ctc_decoder/prefix_search.py | TenaciousC22/CTCDecoder | 705 | 78070 | import numpy as np
def prefix_search(mat: np.ndarray, chars: str) -> str:
"""Prefix search decoding.
See dissertation of Graves, p63-66.
Args:
mat: Output of neural network of shape TxC.
chars: The set of characters the neural network can recognize, excluding the CTC-blank.
Returns:... |
prompt_tuning/spot/data/nli.py | dumpmemory/prompt-tuning | 108 | 78087 | # Copyright 2022 Google.
#
# 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, soft... |
appengine/reddit.py | bharati-software/blockly-games-Kannada | 1,184 | 78088 | """Blockly Games: Legacy Reddit to Turtle/Movie router.
Copyright 2014 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 a... |
temboardui/plugins/pgconf/__init__.py | missmoiselle/temboard | 294 | 78124 | <filename>temboardui/plugins/pgconf/__init__.py
import logging
from os import path
import tornado.web
from tornado.escape import url_escape, url_unescape
from temboardui.web import (
Blueprint,
HTTPError,
Redirect,
TemplateRenderer,
)
PLUGIN_NAME = 'pgconf'
logger = logging.getLogger(__name__)
bluepr... |
src/tensorrt/tensorrt-3.0.4/tf_to_trt.py | aimuch/AIEnvConfig | 250 | 78153 | #
# Copyright 1993-2017 NVIDIA Corporation. All rights reserved.
#
# NOTICE TO LICENSEE:
#
# This source code and/or documentation ("Licensed Deliverables") are
# subject to NVIDIA intellectual property rights under U.S. and
# international Copyright laws.
#
# These Licensed Deliverables contained herein is PROPRIETAR... |
official/modeling/multitask/base_trainer.py | 62theories/tf-flask | 82,518 | 78161 | # Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
querybook/server/lib/metastore/loaders/sqlalchemy_metastore_loader.py | shivammmmm/querybook | 1,144 | 78173 | <filename>querybook/server/lib/metastore/loaders/sqlalchemy_metastore_loader.py
from typing import Dict, List, Tuple
from lib.metastore.base_metastore_loader import (
BaseMetastoreLoader,
DataTable,
DataColumn,
)
from lib.query_executor.executor_template.templates import sqlalchemy_template
from lib.query_... |
examples/classification/plot_time_series_forest.py | jmrichardson/pyts | 1,217 | 78177 | <filename>examples/classification/plot_time_series_forest.py
"""
==================
Time Series Forest
==================
This example illustrates which information is considered important
by the algorithm in order to classify time series. The index of
the most important window is retrieved via the ``feature_importanc... |
tests/components/coinbase/common.py | MrDelik/core | 30,023 | 78188 | """Collection of helpers."""
from homeassistant.components.coinbase.const import (
CONF_CURRENCIES,
CONF_EXCHANGE_RATES,
DOMAIN,
)
from homeassistant.const import CONF_API_KEY, CONF_API_TOKEN
from .const import GOOD_EXCHANGE_RATE, GOOD_EXCHANGE_RATE_2, MOCK_ACCOUNTS_RESPONSE
from tests.common import MockC... |
tutel/parted/backend/torch/executor.py | microsoft/tutel | 156 | 78193 | <gh_stars>100-1000
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import os, sys
import time
import json
import torch
import torch.distributed as dist
from tutel import system
from tutel import net as C
def warp_bwd_allreduce(data, is_param):
if is_param:
fusable_params.add(id(d... |
PyOpenGLExample/turtle.py | DazEB2/SimplePyScripts | 117 | 78194 | import math
from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
"""
Turtle drawings
Once the functions reset(), turn(), turnTo() and forw() there is a possibility to
program a path. In essence this is very similar to using polar coordinates relative
to the last set point. Meaning you define t... |
tests/test_model_interface/test_base_model.py | sumugit/DiCE | 527 | 78210 | <gh_stars>100-1000
import pytest
import numpy as np
import dice_ml
from sklearn.ensemble import RandomForestClassifier, RandomForestRegressor
from dice_ml.utils.exception import SystemException
class TestModelClassification:
def create_sklearn_random_forest_classifier(self, X, y):
rfc = RandomForestClas... |
desktop/core/ext-py/python-ldap-2.3.13/Tests/slapd.py | kokosing/hue | 5,079 | 78211 |
"""
Utilities for starting up a test slapd server
and talking to it with ldapsearch/ldapadd.
"""
import sys, os, socket, time, subprocess, logging
_log = logging.getLogger("slapd")
def quote(s):
'''Quotes the '"' and '\' characters in a string and surrounds with "..."'''
return '"' + s.replace('\\','\\\\')... |
joerd/source/gmted.py | Hivemapper/HM-colony-joerd | 207 | 78223 | from joerd.util import BoundingBox
import joerd.download as download
import joerd.check as check
import joerd.srs as srs
import joerd.mask as mask
from joerd.mkdir_p import mkdir_p
from shutil import copyfileobj
import os.path
import os
import requests
import logging
import re
import tempfile
import sys
import tracebac... |
bin/rational.py | Dragon-hxl/LARC | 290 | 78237 | <gh_stars>100-1000
import datetime
import os
import random
try:
import binutil # required to import from dreamcoder modules
except ModuleNotFoundError:
import bin.binutil # alt import if called as module
from dreamcoder.dreamcoder import explorationCompression, commandlineArguments
from dreamcoder.domains.a... |
autoregressive_diffusion/experiments/audio/arch/diff_wave.py | xxdreck/google-research | 23,901 | 78267 | <filename>autoregressive_diffusion/experiments/audio/arch/diff_wave.py
# 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
#
# htt... |
lyrebird/checker/decoder.py | DuXiao1997/lyrebird | 737 | 78309 | from lyrebird import application
from .. import checker
class CustomDecoder:
def __call__(self, rules=None, *args, **kw):
def func(origin_func):
func_type = checker.TYPE_DECODER
if not checker.scripts_tmp_storage.get(func_type):
checker.scripts_tmp_storage[func_typ... |
client/labml/internal/monitor/__init__.py | elgalu/labml | 463 | 78325 | <filename>client/labml/internal/monitor/__init__.py
import typing
from typing import Optional, List, Union, Tuple
from labml.internal.util.colors import StyleCode
from .iterator import Iterator
from .loop import Loop
from .mix import Mix
from .sections import Section, OuterSection
from ..logger import logger_singleton... |
esphome/components/mqtt_subscribe/sensor/__init__.py | OttoWinter/esphomeyaml | 249 | 78353 | <reponame>OttoWinter/esphomeyaml
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import mqtt, sensor
from esphome.const import (
CONF_QOS,
CONF_TOPIC,
)
from .. import mqtt_subscribe_ns
DEPENDENCIES = ["mqtt"]
CONF_MQTT_PARENT_ID = "mqtt_parent_id"
MQTTSubscribeSens... |
python/federatedml/feature/imputer.py | hubert-he/FATE | 3,787 | 78373 | <gh_stars>1000+
import copy
import functools
import numpy as np
from federatedml.statistic.data_overview import get_header
from federatedml.statistic.statics import MultivariateStatisticalSummary
from federatedml.util import consts
from federatedml.util import LOGGER
from federatedml.statistic import data_overview
c... |
components/isceobj/StripmapProc/runGeo2rdr.py | vincentschut/isce2 | 1,133 | 78448 | <reponame>vincentschut/isce2<gh_stars>1000+
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Copyright 2012 California Institute of Technology. ALL RIGHTS RESERVED.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance wit... |
awx/main/migrations/0129_unifiedjob_installed_collections.py | bhyunki/awx | 11,396 | 78452 | <reponame>bhyunki/awx<filename>awx/main/migrations/0129_unifiedjob_installed_collections.py
# Generated by Django 2.2.16 on 2021-02-16 20:27
import awx.main.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('main', '0128_organiaztion_read_roles_ee_admin'),
... |
utils/losses/__init__.py | ozcell/pytorch-auto-drive | 292 | 78465 | # Implementation based on pytorch 1.6.0
from .lane_seg_loss import *
from .hungarian_loss import *
|
compiler/pgates/pinvbuf.py | im-world/OpenRAM | 335 | 78501 | <reponame>im-world/OpenRAM<filename>compiler/pgates/pinvbuf.py
# See LICENSE for licensing information.
#
# Copyright (c) 2016-2021 Regents of the University of California and The Board
# of Regents for the Oklahoma Agricultural and Mechanical College
# (acting for and on behalf of Oklahoma State University)
# All righ... |
discovery-provider/src/utils/indexing_errors.py | Tenderize/audius-protocol | 429 | 78509 | class IndexingError(Exception):
"""Exception raised for errors in the indexing flow.
Attributes:
type -- One of 'user', 'user_replica_set', 'user_library', 'tracks', 'social_features', 'playlists'
blocknumber -- block number of error
blockhash -- block hash of error
txhash -- tr... |
cherche/retrieve/test_retrieve.py | raphaelsty/cherche | 193 | 78510 | <reponame>raphaelsty/cherche
import pytest
from .. import rank, retrieve
def cherche_retrievers(on: str, k: int = None):
"""List of retrievers available in cherche."""
yield from [
retrieve.TfIdf(key="title", on=on, documents=documents(), k=k),
retrieve.BM25Okapi(key="title", on=on, documents... |
src/mcedit2/synth/l_system_plugin.py | elcarrion06/mcedit2 | 673 | 78549 | """
l_system_plugin
"""
from __future__ import absolute_import, division, print_function
import logging
from mcedit2.editortools.generate import GeneratePlugin
from mcedit2.synth.l_system import renderBlocks, renderSceneNodes, applyReplacementsIterated
from mcedit2.util.showprogress import showProgress
from mcedit... |
runners/cromwell_on_google/wdl_runner/cromwell_driver.py | ffinfo/wdl | 185 | 78551 | #!/usr/bin/python
# Copyright 2017 Google Inc.
#
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd
# cromwell_driver.py
#
# This script provides a library interface to Cromwell, namely:
# * Start the Cro... |
ch2/lineards/bit_manipulation.py | lyskevin/cpbook-code | 1,441 | 78553 | <reponame>lyskevin/cpbook-code
import math
def isOn(S, j):
return (S & (1<<j))
def setBit(S, j):
return (S | (1<<j))
def clearBit(S, j):
return (S & (~(1<<j)))
def toggleBit(S, j):
return (S ^ (1<<j))
def lowBit(S):
return (S&(-S))
def setAll(n):
return ((1<<n)-1)
def modulo(S, N): # retu... |
zella-graphics/arc-chord-pie/example-2.py | whitmans-max/python-examples | 140 | 78581 | <filename>zella-graphics/arc-chord-pie/example-2.py
from graphics import *
# --- constants ---
WIDTH = 300
HEIGHT = 300
# --- functions ---
def moves():
# move figure 1
s = win.itemcget(fig1, 'start')
win.itemconfig(fig1, start=float(s)+5)
# move figure 2
s = win.itemcget(fig2, 'start')
wi... |
tests/test_solution_op_3optstar.py | juicetinliu/VeRyPy | 156 | 78588 | <filename>tests/test_solution_op_3optstar.py
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 05 19:00:19 2018
@author: juherask
"""
# Written in Python 2.7, but try to maintain Python 3+ compatibility
from __future__ import print_function
from __future__ import division
import sys
import unittest
from time import ti... |
code_video/autoscale.py | mrdon/code-video-generator | 196 | 78604 | from dataclasses import dataclass
from typing import Tuple
from manim import config
from manim import DEFAULT_MOBJECT_TO_EDGE_BUFFER
from manim import DEFAULT_MOBJECT_TO_MOBJECT_BUFFER
from manim import DOWN
from manim import LEFT
from manim import Mobject
from manim import np
from manim import ORIGIN
from manim impor... |
tests/test_mp3_compression.py | jeongyoonlee/audiomentations | 930 | 78612 | import unittest
import numpy as np
from audiomentations.augmentations.transforms import Mp3Compression
from audiomentations.core.composition import Compose
class TestMp3Compression(unittest.TestCase):
def test_apply_mp3_compression_pydub(self):
sample_len = 44100
samples_in = np.random.normal(0,... |
dbaas/drivers/mysqlpercona.py | didindinn/database-as-a-service | 303 | 78614 | from . import mysqldb
from physical.models import Instance
class MySQLPercona(mysqldb.MySQL):
def get_default_instance_type(self):
return Instance.MYSQL_PERCONA
@classmethod
def topology_name(cls):
return ['mysql_percona_single']
class MySQLPerconaFOXHA(mysqldb.MySQLFOXHA):
def ge... |
Python3/982.py | rakhi2001/ecom7 | 854 | 78659 | <reponame>rakhi2001/ecom7
__________________________________________________________________________________________________
sample 476 ms submission
class Solution:
def countTriplets(self, A: List[int]) -> int:
n=len(A)
tmp=[bin(a)[2:].zfill(16) for a in A]
one={}
for i,a in enumera... |
kmip/services/results.py | ondrap/PyKMIP | 179 | 78665 | # Copyright (c) 2014 The Johns Hopkins University/Applied Physics Laboratory
# 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/LICEN... |
Alignment/CommonAlignmentProducer/python/ALCARECOTkAlCosmicsInCollisions_cff.py | ckamtsikis/cmssw | 852 | 78687 | # Author : <NAME>
# Date : July 1st, 2010
# last update: $Date: 2010/03/17 18:17:34 $ by $Author: mussgill $
import FWCore.ParameterSet.Config as cms
#_________________________________HLT bits___________________________________________
import HLTrigger.HLTfilters.hltHighLevel_cfi
ALCARECOTkAlCosmicsInCollis... |
explorer/views/export.py | Patil2099/django-sql-explorer | 1,729 | 78712 | # -*- coding: utf-8 -*-
from django.db import DatabaseError
from django.http import HttpResponse
from explorer.exporters import get_exporter_class
from explorer.utils import url_get_params
def _export(request, query, download=True):
_fmt = request.GET.get('format', 'csv')
exporter_class = get_exporter_class... |
rpython/jit/backend/llgraph/symbolic.py | nanjekyejoannah/pypy | 381 | 78713 | <reponame>nanjekyejoannah/pypy
from rpython.rtyper.lltypesystem import lltype, rffi
from rpython.rtyper import rclass
Size2Type = [None] * 100
Type2Size = {}
def get_size(TYPE):
try:
return Type2Size[TYPE]
except KeyError:
size = len(Size2Type)
Size2Type.append(TYPE)
Type2Size... |
backend-services/prefixtree/core/prefixtree.py | cytechmobile/artemis | 237 | 78719 | <filename>backend-services/prefixtree/core/prefixtree.py
import multiprocessing as mp
from typing import Dict
from typing import List
from typing import NoReturn
import pytricia
import redis
import requests
import ujson as json
from artemis_utils import flatten
from artemis_utils import get_ip_version
from artemis_uti... |
verification/tutorial_barotropic_gyre/input/gendata.py | mitgcm/mitgcm | 247 | 78740 | <reponame>mitgcm/mitgcm
import numpy as np
from numpy import cos, sin, pi
Ho = 5000 # ocean depth in meters
nx = 62 # number of gridpoints in x-direction
ny = 62 # number of gridpoints in y-direction
xo = 0 # origin in x,y for ocean domain
yo = 0 # (i.e. southwestern corner of ocean domain)
dx = 20 #... |
ide/tasks/git.py | Ramonrlb/cloudpebble | 147 | 78756 | import base64
import urllib2
import json
import os
import logging
from celery import task
from django.conf import settings
from django.utils.timezone import now
from github.GithubObject import NotSet
from github import Github, GithubException, InputGitTreeElement
from ide.git import git_auth_check, get_github
from id... |
lra_benchmarks/models/longformer/longformer_attention.py | guyd1995/long-range-arena | 416 | 78779 | <filename>lra_benchmarks/models/longformer/longformer_attention.py<gh_stars>100-1000
# 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
# https://www.apache.org/l... |
src/sims4communitylib/events/build_buy/common_build_buy_event_dispatcher.py | velocist/TS4CheatsInfo | 118 | 78796 | """
The Sims 4 Community Library is licensed under the Creative Commons Attribution 4.0 International public license (CC BY 4.0).
https://creativecommons.org/licenses/by/4.0/
https://creativecommons.org/licenses/by/4.0/legalcode
Copyright (c) COLONOLNUTTY
"""
from typing import Any
from sims4communitylib.events.build... |
RMQ/rmq.py | saneravi/ML_Stuff | 209 | 78843 | #!/usr/bin/env python
"""Solve the range minimum query problem."""
def read_numbers(number_file, query_file):
"""
Parameters
----------
number_file : str
query_file : str
Returns
-------
tuple
(numbers, queries) - both are lists
"""
with open(number_file) as f:
... |
shadowsocks/dns_forward/socket.py | dogfight360/PySocket | 121 | 78853 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2017 Falseen
#
# 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 a... |
holidays/countries/mexico.py | m-ganko/python-holidays | 654 | 78861 | # -*- coding: utf-8 -*-
# python-holidays
# ---------------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Author: ryanss <<EMAIL>> (c) ... |
tests/units/transformers/test_per_column_imputer.py | shubhada-2019/tsfresh | 6,596 | 78870 | <reponame>shubhada-2019/tsfresh
# -*- coding: utf-8 -*-
# This file as well as the whole tsfresh package are licenced under the MIT licence (see the LICENCE.txt)
# <NAME> (<EMAIL>), Blue Yonder Gmbh, 2016
import warnings
from builtins import range
from unittest import TestCase
import numpy as np
import numpy.testing ... |
bigflow_python/python/bigflow/core/entity.py | advancedxy/bigflow_python | 1,236 | 78877 | <gh_stars>1000+
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015 Baidu, 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.... |
dolphinscheduler-python/pydolphinscheduler/examples/task_dependent_example.py | swg-liuge/dolphinscheduler | 2,086 | 78892 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
leo/modes/bbj.py | ATikhonov2/leo-editor | 1,550 | 78916 | <gh_stars>1000+
# Leo colorizer control file for bbj mode.
# This file is in the public domain.
# Properties for bbj mode.
properties = {
"commentEnd": "*/",
"commentStart": "/*",
"wordBreakChars": ",+-=<>/?^&*",
}
# Attributes dict for bbj_main ruleset.
bbj_main_attributes_dict = {
"defau... |
tests/test_network/test_net_2.py | amih90/bacpypes | 240 | 78929 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Test Network Discovery
----------------------
The TD is on network 1 with sniffer1, network 2 has sniffer2, network 3 has
sniffer3. Network 1 and 2 are connected with a router, network 2 and 3
are connected by a different router.
"""
import unitte... |
tests/types/test_photo.py | andrew-ld/aiogram | 2,744 | 78935 | from aiogram import types
from .dataset import PHOTO
photo = types.PhotoSize(**PHOTO)
def test_export():
exported = photo.to_python()
assert isinstance(exported, dict)
assert exported == PHOTO
def test_file_id():
assert isinstance(photo.file_id, str)
assert photo.file_id == PHOTO['file_id']
d... |
doc/workshop/advancedReliability/inputs/goalFunction.py | rinelson456/raven | 159 | 78937 | <reponame>rinelson456/raven
def __residuumSign(self):
if self.outcome == 0:
return -1
else: return 1
|
seahub/organizations/views.py | samuelduann/seahub | 420 | 78980 | # Copyright (c) 2012-2016 Seafile Ltd.
# encoding: utf-8
import logging
import json
from urllib.parse import urlparse
from django.conf import settings
from django.contrib import messages
from django.urls import reverse
from django.core.cache import cache
from django.utils.translation import ugettext_lazy as _
from dj... |
core/migrations/0012_auto_20200813_0238.py | Gitoffomalawn/babybuddy | 922 | 79020 | # Generated by Django 3.1 on 2020-08-13 02:38
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
("core", "0011_auto_20200214_1939"),
]
operations = [
migrations.AlterField(
model_name="note",
... |
third_party/blink/tools/blinkpy/web_tests/layout_package/json_results_generator_unittest.py | zealoussnow/chromium | 14,668 | 79021 | <filename>third_party/blink/tools/blinkpy/web_tests/layout_package/json_results_generator_unittest.py
# Copyright (C) 2010 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Red... |
pymoo/core/survival.py | jarreguit/pymoo | 762 | 79025 | from abc import abstractmethod
import numpy as np
from pymoo.core.population import Population
# ---------------------------------------------------------------------------------------------------------
# Survival
# ----------------------------------------------------------------------------------------------------... |
datar/dplyr/mutate.py | stjordanis/datar | 110 | 79028 | <filename>datar/dplyr/mutate.py
"""Create, modify, and delete columns
See source https://github.com/tidyverse/dplyr/blob/master/R/mutate.R
"""
from typing import Any, Tuple, List, Union
from pandas import DataFrame, Series
from pipda import register_verb, evaluate_expr, ContextBase
from pipda.utils import CallingEnvs... |
src/HyperDenseNet/Modules/IO/loadData.py | jiajunhua/josedolz-HyperDenseNet | 147 | 79029 | """
Copyright (c) 2016, <NAME> .All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the foll... |
tests/test_accept.py | alanjcastonguay/flask-restplus | 2,885 | 79035 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import flask_restplus as restplus
class Foo(restplus.Resource):
def get(self):
return "data"
class ErrorsTest(object):
def test_accept_default_application_json(self, app, client):
api = restplus.Api(app)
api.add_resourc... |
tools/optimize/nanodet_m-opt.py | zhouzy-creator/Tengine | 4,697 | 79059 | <gh_stars>1000+
# -*- coding: utf-8 -*-
# OPEN AI LAB is pleased to support the open source community by supporting Tengine available.
#
# Copyright (C) 2021 OPEN AI LAB. All rights reserved.
#
# Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
# in compliance with the License.... |
sandbox/grist/migrations.py | gristlabs/grist-core | 2,667 | 79126 | <filename>sandbox/grist/migrations.py
import json
import re
import six
from six.moves import xrange
import actions
import identifiers
import schema
import summary
import table_data_set
import logger
log = logger.Logger(__name__, logger.INFO)
# PHILOSOPHY OF MIGRATIONS.
#
# We should probably never remove, modify, or... |
middileware/iis/ms15_034.py | xin053/PocCollect | 340 | 79132 | <filename>middileware/iis/ms15_034.py<gh_stars>100-1000
#!/usr/bin/env python
# encoding: utf-8
from t import T
import re
import urllib2,requests,urllib2,json,urlparse
class P(T):
def __init__(self):
T.__init__(self)
def verify(self,head='',context='',ip='',port='',productname={},keywords='',hackinf... |
rhn/lstm_ln.py | Neovairis/deep-models | 155 | 79146 | from keras import backend as K
from keras.layers import LSTM, time_distributed_dense
from keras import initializations, activations, regularizers
from keras.engine import InputSpec
# LSTM with Layer Normalization as described in:
# https://arxiv.org/pdf/1607.06450v1.pdf
# page 13, equation (20), (21), and (22)
class... |
tools/accuracy_checker/tests/test_mxnet_launcher.py | APrigarina/open_model_zoo | 1,031 | 79149 | <gh_stars>1000+
"""
Copyright (c) 2018-2021 Intel Corporation
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 ... |
scripts/mw2html_audacity/htmldata.py | joshrose/audacity | 7,892 | 79150 | <filename>scripts/mw2html_audacity/htmldata.py
"""
Manipulate HTML or XHTML documents.
Version 1.1.1. This source code has been placed in the
public domain by <NAME>.
Features:
- Translate HTML back and forth to data structures.
This allows you to read and write HTML documents
programmably, with much flexib... |
src/alias/azext_alias/_validators.py | Mannan2812/azure-cli-extensions | 207 | 79151 | <gh_stars>100-1000
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# -------------------------------------------------... |
sunshinectf2020/speedrun/exploit_00.py | nhtri2003gmail/ctf-write-ups | 101 | 79209 | #!/usr/bin/env python3
from pwn import *
binary = context.binary = ELF('./chall_00')
if not args.REMOTE:
p = process(binary.path)
else:
p = remote('chal.2020.sunshinectf.org', 30000)
payload = b''
payload += (0x48 - 0xc) * b'A'
payload += p32(0xfacade)
p.sendlineafter('This is the only one\n',payload)
p.interac... |
tg/jsonify.py | sergiobrr/tg2 | 812 | 79244 | """JSON encoding functions."""
import datetime
import decimal
import types
from json import JSONEncoder as _JSONEncoder
from tg.support.converters import asbool
from webob.multidict import MultiDict
from tg._compat import string_type
from tg.configuration.utils import GlobalConfigurable
from tg.util.sqlalchemy impor... |
supervised/tuner/optuna/knn.py | stjordanis/mljar-supervised | 1,882 | 79298 | import numpy as np
from supervised.algorithms.knn import KNeighborsAlgorithm, KNeighborsRegressorAlgorithm
import optuna
from supervised.utils.metric import Metric
from supervised.algorithms.registry import BINARY_CLASSIFICATION
from supervised.algorithms.registry import MULTICLASS_CLASSIFICATION
from supervised.algor... |
L1Trigger/TrackFindingTMTT/python/TMTrackProducer_Defaults_cfi.py | ckamtsikis/cmssw | 852 | 79308 | <filename>L1Trigger/TrackFindingTMTT/python/TMTrackProducer_Defaults_cfi.py<gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
#---------------------------------------------------------------------------------------------------------
# This describes the full TMTT track reconstruction chain with 3 GeV threshol... |
py_cui/dialogs/__init__.py | ne-msft/py_cui | 654 | 79311 | """A collection of modules containing dialog-style widgets and popups.
"""
import py_cui.dialogs.form
import py_cui.dialogs.filedialog |
tests/features/replace_test.py | nacleric/babi | 223 | 79327 | from __future__ import annotations
import pytest
from testing.runner import and_exit
@pytest.mark.parametrize('key', ('^C', 'Enter'))
def test_replace_cancel(run, key):
with run() as h, and_exit(h):
h.press('^\\')
h.await_text('search (to replace):')
h.press(key)
h.await_text('ca... |
logger.py | dididixu/ShuffleNetV2-pytorch | 176 | 79341 | <reponame>dididixu/ShuffleNetV2-pytorch<filename>logger.py
import csv
import os.path
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot as plt
import numpy as np
plt.switch_backend('agg')
class CsvLogger:
def __init__(self, filepath='./', filename='results.csv', data=None):
self.log... |
open_spiel/python/algorithms/jpsro_test.py | ajain-23/open_spiel | 3,167 | 79342 | <filename>open_spiel/python/algorithms/jpsro_test.py
# Copyright 2019 DeepMind Technologies Ltd. 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... |
ttp/match/mac_eui.py | showipintbri/ttp | 254 | 79349 | """
Function to convert MAC address onti EUI style format.
Creds to https://stackoverflow.com/a/29446103 unswers on stackoeverflow
and NAPALM base helpers module
"""
from re import sub
def mac_eui(data):
mac = str(data)
# remove delimiters and convert to lower case
mac = sub("[.:-]", "", mac).lower()
... |
scripts/automation/regression/stateless_tests/stl_ns_test.py | timgates42/trex-core | 956 | 79361 | #!/usr/bin/python
from .stl_general_test import CStlGeneral_Test, CTRexScenario
from trex_stl_lib.api import *
from trex.common.stats.trex_ns import CNsStats
from trex.common.services.trex_service_icmp import ServiceICMP
import pprint
class STLNS_Test(CStlGeneral_Test):
"""Tests for NS function """
def setU... |
tests/const.py | ppstacy/Kaggler | 743 | 79373 | <reponame>ppstacy/Kaggler<gh_stars>100-1000
RANDOM_SEED = 42
TARGET_COL = 'target'
|
nurses_2/app.py | salt-die/nurses_2 | 171 | 79377 | import asyncio
from abc import ABC, abstractmethod
from .colors import BLACK_ON_BLACK
from .io import KeyPressEvent, MouseEvent, PasteEvent, io
from .widgets._root import _Root
RESIZE_POLL_INTERVAL = 0.5 # Seconds between polling for resize events.
RENDER_INTERVAL = 0 # Seconds between screen renders.
cl... |
destiny/errors.py | glryanon/Trusty-cogs | 148 | 79393 | <reponame>glryanon/Trusty-cogs
class Destiny2APIError(Exception):
pass
class Destiny2InvalidParameters(Destiny2APIError):
pass
class Destiny2APICooldown(Destiny2APIError):
pass
class Destiny2RefreshTokenError(Destiny2APIError):
pass
class Destiny2MissingAPITokens(Destiny2APIError):
pass
cl... |
tools/grit/grit/gather/admin_template_unittest.py | zealoussnow/chromium | 14,668 | 79412 | #!/usr/bin/env python3
# Copyright (c) 2012 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.
'''Unit tests for the admin template gatherer.'''
from __future__ import print_function
import os
import sys
if __name__ == '__m... |
cortex_DIM/functions/gradient_penalty.py | Soapy-Salted-Fish-King/DIM | 749 | 79440 | '''Gradient penalty functions.
'''
import torch
from torch import autograd
def contrastive_gradient_penalty(network, input, penalty_amount=1.):
"""Contrastive gradient penalty.
This is essentially the loss introduced by Mescheder et al 2018.
Args:
network: Network to apply penalty through.
... |
rasa/cli/data.py | jeanveau/rasa_core | 2,433 | 79461 | <filename>rasa/cli/data.py
import argparse
from typing import List
from rasa import data
from rasa.cli.default_arguments import add_nlu_data_param
from rasa.cli.utils import get_validated_path
from rasa.constants import DEFAULT_DATA_PATH
# noinspection PyProtectedMember
def add_subparser(subparsers: argparse._SubPar... |
python/tests/episode_time_test.py | xuyanbo03/lab | 7,407 | 79479 | # Copyright 2017-2018 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in t... |
ss_baselines/savi/ppo/slurm_utils.py | tynguyen/sound-spaces | 171 | 79488 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import os
import shlex
import signal
import subprocess
import threading
from os import path as osp
f... |
WebMirror/management/rss_parser_funcs/feed_parse_extractMichilunWordpressCom.py | fake-name/ReadableWebProxy | 193 | 79489 | def extractMichilunWordpressCom(item):
'''
Parser for 'michilun.wordpress.com'
'''
bad = [
'Recommendations and Reviews',
]
if any([tmp in item['tags'] for tmp in bad]):
return None
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title... |
caffe-tensorflow/examples/imagenet/models/googlenet.py | petercheng00/PSPNet-Keras-tensorflow | 3,209 | 79503 | from kaffe.tensorflow import Network
class GoogleNet(Network):
def setup(self):
(self.feed('data')
.conv(7, 7, 64, 2, 2, name='conv1_7x7_s2')
.max_pool(3, 3, 2, 2, name='pool1_3x3_s2')
.lrn(2, 2e-05, 0.75, name='pool1_norm1')
.conv(1, 1, 64, 1, 1, name='c... |
tools/draw_success_rate.py | CAVED123/-navbot | 154 | 79527 | #!/usr/bin/python
# -*- coding: UTF-8 -*-
import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif'] = ['Times New Roman'] # 如果要显示中文字体,则在此处设为:SimHei
plt.rcParams['axes.unicode_minus'] = False # 显示负号
plt.figure(figsize=(10, 6))
plt.grid(linestyle="--") # 设置背景网格线为虚线
ax = plt.gca()
ax.spines['top'].set_visible(F... |
src/ansys/mapdl/core/_commands/solution/analysis_options.py | Miiicah/pymapdl | 194 | 79528 | <gh_stars>100-1000
from typing import Optional
from ansys.mapdl.core.mapdl_types import MapdlInt
class AnalysisOptions:
def abextract(self, mode1="", mode2="", **kwargs):
"""Extracts the alpha-beta damping multipliers for Rayleigh damping.
APDL Command: ABEXTRACT
Parameters
----... |
dataprofiler/tests/profilers/test_datatype_column_profiler.py | gautomdas/DataProfiler | 690 | 79549 | from __future__ import print_function
import os
import unittest
from .test_base_column_profilers import AbstractTestColumnProfiler
from dataprofiler.profilers.column_profile_compilers import \
ColumnPrimitiveTypeProfileCompiler
test_root_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
cla... |
adaptnlp/callback.py | chsafouane/adaptnlp | 410 | 79550 | <filename>adaptnlp/callback.py<gh_stars>100-1000
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/01_callback.ipynb (unless otherwise specified).
__all__ = ['GatherInputsCallback', 'SetInputsCallback', 'GeneratorCallback']
# Cell
from fastcore.basics import store_attr
from fastcore.meta import delegates
from fastai.c... |
backend/data_export/tests/test_dataset.py | arcada-uas/doccano | 2,082 | 79570 | import unittest
from unittest.mock import MagicMock
import pandas as pd
from pandas.testing import assert_frame_equal
from data_export.pipeline.dataset import Dataset
class TestDataset(unittest.TestCase):
def setUp(self):
example = MagicMock()
example.to_dict.return_value = {"data": "example"}
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.