max_stars_repo_path string | max_stars_repo_name string | max_stars_count int64 | id string | content string | add_param_types int64 | add_return_types int64 | add_class_field_types int64 | add_instance_field_types int64 | add_total int64 | add_error int64 |
|---|---|---|---|---|---|---|---|---|---|---|
versions/settings.py | DocTocToc/cleanerversion | 121 | 1620254 | <gh_stars>100-1000
import importlib
from django import VERSION
from django.conf import settings as django_settings
_cache = {}
class VersionsSettings(object):
"""
Gets a setting from django.conf.settings if set, otherwise from the
defaults defined in this class.
A magic accessor is used instead of ... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/old/task_looping.py | nicolasiltis/prefect | 8,633 | 1620273 | <filename>examples/old/task_looping.py
"""
This Flow uses Prefect's Task Looping feature for computing
the largest Fibonacci number less than a given number M. Each
Fibonacci number is computed using a black-box external API.
"""
from datetime import timedelta
import requests
import prefect
from prefect import Flow, ... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/integration/upgrade/__init__.py | clohfink/python-driver | 1,163 | 1620294 | <filename>tests/integration/upgrade/__init__.py<gh_stars>1000+
# Copyright DataStax, 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
#
# Un... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/src/main/python/ml/dataframe_example.py | OlegPt/spark | 35,083 | 1620301 | <reponame>OlegPt/spark
#
# 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 "Li... | 0 | 0 | 0 | 0 | 0 | 0 |
addon_common/common/functools.py | Unnoen/retopoflow | 1,600 | 1620341 | <filename>addon_common/common/functools.py
'''
Copyright (C) 2021 CG Cookie
http://cgcookie.com
<EMAIL>
Created by <NAME>, <NAME>
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 v... | 0 | 0 | 0 | 0 | 0 | 0 |
tensorflow/python/summary/plugin_asset_test.py | abhaikollara/tensorflow | 848 | 1620359 | # Copyright 2015 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... | 0 | 1 | 3 | 0 | 4 | 0 |
networkit/workflows.py | kit-parco/networkit | 194 | 1620360 | from __future__ import annotations
""" This module provides convenient workflows constructed from NetworKit functions."""
__author__ = "<NAME>"
# internal imports
from .graphio import readGraph
from .components import ConnectedComponents
from . import stopwatch
# external imports
import operator
import logging
impo... | 1 | 1 | 0 | 0 | 2 | 0 |
tests/layer_tests/common/layer_test_class.py | opencv/dldt | 1,127 | 1620368 | <gh_stars>1000+
# Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import itertools
import numpy as np
import os
import re
import warnings
import xml.etree.ElementTree as ET
from openvino.tools.mo.utils.ir_engine.ir_engine import IREngine
from pathlib import Path
import numpy as np
from... | 0 | 0 | 0 | 0 | 0 | 0 |
src/riotwatcher/_apis/team_fight_tactics/urls/SummonerApiUrls.py | TheBoringBakery/Riot-Watcher | 489 | 1620371 | from .TftEndpoint import TftEndpoint
class SummonerEndpoint(TftEndpoint):
def __init__(self, url: str, **kwargs):
nurl = "/summoner/v1/summoners" + url
super().__init__(nurl, **kwargs)
class SummonerApiUrls:
by_account = SummonerEndpoint("/by-account/{encrypted_account_id}")
by_name = Su... | 1 | 0 | 0 | 0 | 1 | 0 |
advanced/image_processing/examples/plot_display_face.py | zmoon/scipy-lecture-notes | 2,538 | 1620397 | <reponame>zmoon/scipy-lecture-notes
"""
Display a Racoon Face
=====================
An example that displays a racoon face with matplotlib.
"""
import scipy.misc
import matplotlib.pyplot as plt
f = scipy.misc.face(gray=True)
plt.figure(figsize=(10, 3.6))
plt.subplot(131)
plt.imshow(f, cmap=plt.cm.gray)
plt.subplot... | 0 | 0 | 0 | 0 | 0 | 0 |
leonardo/module/web/signals.py | timgates42/django-leonardo | 102 | 1620398 | <filename>leonardo/module/web/signals.py
import django.dispatch
from dbtemplates.conf import settings
from dbtemplates.models import Template
try:
from django.utils.timezone import now
except ImportError:
from datetime import datetime
now = datetime.now
def dbtemplate_save(sender, instance, created, **k... | 0 | 0 | 0 | 0 | 0 | 0 |
GetDanmuAss/spview danmaku/main.py | Vespa314/bilibili-api | 1,460 | 1620432 | # -*- coding: utf-8 -*-
"""
@author: Vespa
"""
import sys
import os
from bilibili import *
from GetAssDanmaku import *
def main(argv):
appkey = '70472776da900153'
secretkey = '<KEY>'
SPList = biliZhuantiSearch(appkey,secretkey,argv)
if 0 == len(SPList):
print "【Error】SPview Not Found!!"
... | 0 | 0 | 0 | 0 | 0 | 0 |
mayan/apps/smart_settings/widgets.py | eshbeata/open-paperless | 2,743 | 1620434 | from __future__ import unicode_literals
from django.utils.safestring import mark_safe
def setting_widget(instance) -> object:
return mark_safe(
'''
<strong>{}</strong>
<p class="small">{}</p>
'''.format(instance, instance.help_text or '')
)
| 0 | 1 | 0 | 0 | 1 | 0 |
src/probnum/quad/kernel_embeddings/_expquad_gauss.py | christopheroates/probnum | 226 | 1620443 | <gh_stars>100-1000
"""Kernel embedding of exponentiated quadratic kernel with Gaussian integration
measure."""
import numpy as np
import scipy.linalg as slinalg
from probnum.kernels import ExpQuad
from probnum.quad._integration_measures import GaussianMeasure
def _kernel_mean_expquad_gauss(
x: np.ndarray, kern... | 0 | 0 | 0 | 0 | 0 | 0 |
uchan/filter/text_parser.py | alanbato/tchan | 120 | 1620463 | <reponame>alanbato/tchan
import re
from markupsafe import escape, Markup
from uchan.lib import roles
POST_REFNO_PATTERN = re.compile('>>(\\d{1,16})')
def parse_text(raw, linkify=False, bigheaders=False, maxlines=0, maxlinestext=None):
lines = []
was_empty_line = False
for rawline in raw.splitline... | 0 | 0 | 0 | 0 | 0 | 0 |
VirtualStage/BackgroundMatting/app_parser.py | nicolasdeory/ailab | 4,537 | 1620473 | import argparse
def get_parser() -> object:
"""Returns an arguments parser"""
parser = argparse.ArgumentParser(description="Background Matting on Videos.")
parser.add_argument(
"-n", "--name", type=str, required=True, help="Name of processing."
)
parser.add_argument(
"-i", "--input... | 0 | 1 | 0 | 0 | 1 | 0 |
ocr/paragraph_segmentation_dcnn.py | vee51/Hand | 435 | 1620482 | # Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import argparse
import multiprocessing
import time
import random
import os
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import mxnet as mx
import numpy as np
from skimage.draw impor... | 1 | 6 | 0 | 0 | 7 | 0 |
tools/perf/page_sets/web_worker_stories.py | zealoussnow/chromium | 14,668 | 1620491 | <reponame>zealoussnow/chromium
# Copyright 2018 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.
from telemetry.page import page as page
from telemetry.page import shared_page_state
from telemetry import story
class WebWo... | 0 | 0 | 0 | 0 | 0 | 0 |
ST_DM/KDD2021-MSTPAC/code/MST-PAC/utils/spatial/spatial_demo.py | zhangyimi/Research | 1,319 | 1620509 | <filename>ST_DM/KDD2021-MSTPAC/code/MST-PAC/utils/spatial/spatial_demo.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
########################################################################
#
# Copyright (c) 2018 Baidu.com, Inc. All Rights Reserved
#
################################################################... | 0 | 0 | 0 | 0 | 0 | 0 |
solutions/vijendra/assignment2/cs231n/layer_utils.py | kvn219/stanford-cs231 | 282 | 1620547 | from cs231n.layers import *
from cs231n.fast_layers import *
def affine_relu_forward(x, w, b) -> tuple[object, object]:
"""
Convenience layer that perorms an affine transform followed by a ReLU
Inputs:
- x: Input to the affine layer
- w, b: Weights for the affine layer
Returns a tuple of:
- out: Outpu... | 0 | 8 | 0 | 0 | 8 | 0 |
cleverhans_v3.1.0/tests_tf/test_mnist_tutorial_tf.py | xu-weizhen/cleverhans | 4,333 | 1620561 | # pylint: disable=missing-docstring
import unittest
import numpy as np
# pylint bug on next line
from tensorflow.python.client import device_lib # pylint: disable=no-name-in-module
from cleverhans.devtools.checks import CleverHansTest
HAS_GPU = "GPU" in {x.device_type for x in device_lib.list_local_devices()}
clas... | 0 | 0 | 0 | 0 | 0 | 0 |
django_codemod/visitors/template_tags.py | webstar-commit/django-boilerplate | 128 | 1620584 | from typing import Generator, Optional, Sequence, Union
from libcst import (
Assign,
AssignTarget,
Decorator,
FlattenSentinel,
ImportFrom,
ImportStar,
Module,
Name,
RemovalSentinel,
)
from libcst import matchers as m
from django_codemod.constants import DJANGO_1_9, DJANGO_2_0
from ... | 11 | 10 | 3 | 0 | 24 | 0 |
dnanexus/idr/src/idr.py | ENCODE-DCC/chip-seq-pipeline | 108 | 1620600 | #!/usr/bin/env python
# idr 0.0.1
# Generated by dx-app-wizard.
#
# Basic execution pattern: Your app will run on a single machine from
# beginning to end.
#
# See https://wiki.dnanexus.com/Developer-Portal for documentation and
# tutorials on how to modify this file.
#
# DNAnexus Python Bindings (dxpy) documentation:
... | 0 | 0 | 0 | 0 | 0 | 0 |
python/082 Remove Duplicates from Sorted List II.py | allandproust/leetcode-share | 156 | 1620612 | <reponame>allandproust/leetcode-share
'''
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.
For example,
Given 1->2->3->3->4->4->5, return 1->2->5.
Given 1->1->1->2->3, return 2->3.
'''
# Definition for singly-linked list.
class Li... | 0 | 0 | 0 | 0 | 0 | 0 |
backend/src/baserow/api/groups/errors.py | ashishdhngr/baserow | 839 | 1620654 | from rest_framework.status import HTTP_400_BAD_REQUEST
ERROR_GROUP_USER_IS_LAST_ADMIN = (
"ERROR_GROUP_USER_IS_LAST_ADMIN",
HTTP_400_BAD_REQUEST,
"The related user is the last admin in the group. He must delete the group or "
"give someone else admin permissions.",
)
| 0 | 0 | 0 | 0 | 0 | 0 |
dataviz/flagsaverage2.py | Udzu/pudzu | 119 | 1620682 | from pudzu.charts import *
from pudzu.sandbox.bamboo import *
import scipy.stats
flags = pd.read_csv("../dataviz/datasets/countries.csv").filter_rows("organisations >> un").split_columns('country', "|").explode('country').set_index('country').drop_duplicates(subset='flag', keep='first')
continents = flags.groupby("con... | 1 | 8 | 10 | 0 | 19 | 0 |
src/sage/symbolic/substitution_map.py | UCD4IDS/sage | 1,742 | 1620757 | <gh_stars>1000+
"""
Substitution Maps
This object wraps Pynac ``exmap`` objects. These encode substitutions
of symbolic expressions. The main use of this module is to hook into
Pynac's ``subs()`` methods and pass a wrapper for the substitution map
back to Python.
"""
#*************************************************... | 0 | 0 | 0 | 0 | 0 | 0 |
src/api/filediff.py | piwaniuk/critic | 216 | 1620759 | <gh_stars>100-1000
# -*- mode: python; encoding: utf-8 -*-
#
# Copyright 2017 the Critic contributors, Opera Software ASA
#
# 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.apa... | 0 | 0 | 0 | 0 | 0 | 0 |
kolibri/core/content/tasks.py | MBKayro/kolibri | 545 | 1620767 | """
The purpose of this module is to manually test & demonstrate the
entire task submission workflow.
Right now, I've imported the validator from the api module but we'll
shift those to their suitable directories in coming times.
"""
from django.core.management import call_command
from kolibri.core.content.permission... | 0 | 1 | 0 | 0 | 1 | 0 |
tests/testapp/settings.py | Lord-Elrond/django-tree-queries | 127 | 1620830 | import os
DATABASES = {
"default": {
"ENGINE": "django.db.backends.%s" % os.getenv("DB_BACKEND", "sqlite3"),
"NAME": os.getenv("DB_NAME", ":memory:"),
"USER": os.getenv("DB_USER"),
"PASSWORD": os.getenv("DB_PASSWORD"),
"HOST": os.getenv("DB_HOST", ""),
"PORT": os.ge... | 0 | 0 | 0 | 0 | 0 | 0 |
sknetwork/path/tests/test_metrics.py | altana-tech/scikit-network | 457 | 1620851 | <gh_stars>100-1000
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
""""tests for metrics.py"""
import unittest
from sknetwork.data import house
from sknetwork.path import diameter
class TestMetrics(unittest.TestCase):
def test_diameter(self):
adjacency = house()
with self.assertRaises(ValueError)... | 0 | 0 | 0 | 0 | 0 | 0 |
7.5/Add to plugins folder/Code editor/template/Plugin_temp.py | taotaoqqq/Python_editor | 237 | 1620892 | <filename>7.5/Add to plugins folder/Code editor/template/Plugin_temp.py
# Created by: St<NAME> http://www.techbliss.org
import os
import ida_idaapi, ida_kernwin
import idc
from idc import *
from idaapi import *
import sys
sys.path.insert(0 , idaapi.idadir("plugins\\Code editor\\icons"))
import ico
from ico import *
P... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/launch.py | justsor/vim | 699 | 1620895 | #! /usr/bin/env python2
import sys
import time
import os
#----------------------------------------------------------------------
# flow control
#----------------------------------------------------------------------
def flow_control(command, hz):
import subprocess
hz = (hz < 10) and 10 or hz
#sys.stdout.write('%d:... | 0 | 0 | 0 | 0 | 0 | 0 |
test/functional/mock_box/db_model/token_model.py | takeontom/box-python-sdk | 367 | 1620910 | <gh_stars>100-1000
# coding: utf-8
from __future__ import unicode_literals
import sqlalchemy
import uuid
from test.functional.mock_box.db_model import DbModel
class TokenModel(DbModel):
"""DB Model for Box tokens."""
__tablename__ = 'box_token'
id = sqlalchemy.Column(sqlalchemy.Integer, primary_key=True... | 0 | 0 | 0 | 0 | 0 | 0 |
New folder/New folder/pyray-master/pyray/shapes/oned/curve.py | JVuns/Driver-Log-Recorder---Final-Project | 715 | 1620920 | import numpy as np
from PIL import Image, ImageDraw, ImageFont, ImageMath
from scipy.stats import norm
def draw_curve(fn, draw,rgba: tuple[int, int, int]=(250,255,0)):
x = 0
eps=1.0
for _ in range(1000):
pt1 = np.array([x,fn(x)])
pt2 = np.array([x+eps,fn(x+eps)])
x=x+eps
dr... | 1 | 0 | 0 | 0 | 1 | 0 |
network/focal_loss.py | BoPang1996/TubeTK | 142 | 1620947 | import torch
from torch.autograd import Variable
import torch.nn.functional as F
def one_hot_embedding(labels, num_classes) -> object:
'''
Embedding labels to one-hot form.
Args:
labels: (LongTensor) class labels, sized [N,].
num_classes: (int) number of classes.
Returns:
(tensor) en... | 0 | 2 | 0 | 0 | 2 | 0 |
colab_ssh/utils/logger/__init__.py | mushonnip/colab-ssh | 623 | 1620960 | from .logger import get_logger | 0 | 0 | 0 | 0 | 0 | 0 |
optimizer/optimizer.py | NestLakerJasonLIN/pipedream | 273 | 1620968 | <reponame>NestLakerJasonLIN/pipedream
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import argparse
import csv
import math
import utils
def main(num_machines, profile_filename, network_bandwidth, memory_size,
num_machines_in_first_level=None, verbose=False):
if (num_machines_i... | 0 | 0 | 0 | 0 | 0 | 0 |
rssant_api/models/union_feed.py | nonomal/rssant | 1,176 | 1620978 | from __future__ import annotations
import typing
from collections import namedtuple
from django.utils import timezone
from django.db import transaction
from functools import cached_property
from rssant_common.validator import FeedUnionId
from rssant_common.detail import Detail
from rssant_config import MAX_FEED_COUNT... | 14 | 49 | 0 | 0 | 63 | 0 |
test/countries/test_france.py | m-ganko/python-holidays | 654 | 1621003 | <filename>test/countries/test_france.py<gh_stars>100-1000
# -*- 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... | 0 | 0 | 0 | 0 | 0 | 0 |
DQM/EcalMonitorClient/python/RawDataClient_cfi.py | ckamtsikis/cmssw | 852 | 1621006 | <filename>DQM/EcalMonitorClient/python/RawDataClient_cfi.py
import FWCore.ParameterSet.Config as cms
from DQM.EcalMonitorTasks.OccupancyTask_cfi import ecalOccupancyTask
from DQM.EcalMonitorTasks.RawDataTask_cfi import ecalRawDataTask
synchErrThresholdFactor = 1.
ecalRawDataClient = cms.untracked.PSet(
params = ... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/plugins/pgsql/test_pgsql.py | okutane/yandex-taxi-testsuite | 128 | 1621022 | import os.path
import pytest
from testsuite.databases.pgsql import discover
SQLDATA_PATH = os.path.join(
os.path.dirname(__file__), 'static/postgresql/schemas',
)
MIGRATIONS = os.path.join(
os.path.dirname(__file__), 'static/postgresql/migrations',
)
@pytest.fixture(scope='session')
def pgsql_local(pgsql_... | 0 | 1 | 0 | 0 | 1 | 0 |
src/dal/test/stories.py | epoiate/django-autocomplete-light | 1,368 | 1621032 | <gh_stars>1000+
"""User stories, functional tests for AutocompleteTestCase."""
from __future__ import unicode_literals
import time
from selenium.common.exceptions import (
StaleElementReferenceException,
)
import six
import tenacity
class BaseStory(object):
"""Base UserStory class."""
def __init__(se... | 0 | 0 | 0 | 0 | 0 | 0 |
descarteslabs/common/graft/interpreter/scopedchainmap.py | descarteslabs/descarteslabs-python | 167 | 1621073 | from __future__ import annotations
from collections import ChainMap
class ScopedChainMap(ChainMap):
def getlevel(self, k, default_value: object | None=None, default_level: object | None=None) -> tuple[object, object]:
"Look up a key and the level where it's stored, returning defaults if it doesn't exist"
... | 4 | 2 | 0 | 0 | 6 | 0 |
tests/test_opts_options.py | aerostone/vdebug | 568 | 1621095 | import unittest
from vdebug.opts import Options,OptionsError
class OptionsTest(unittest.TestCase):
def tearDown(self):
Options.instance = None
def test_has_instance(self):
Options.set({1:"hello", 2:"world"})
self.assertIsInstance(Options.inst(), Options)
def test_get_option(self)... | 0 | 0 | 0 | 0 | 0 | 0 |
bbcm/utils/evaluations.py | gitabtion/BertBasedCscModels | 158 | 1621103 | <gh_stars>100-1000
"""
@Time : 2021-01-21 12:01:32
@File : evaluations.py
@Author : Abtion
@Email : <EMAIL>
"""
def compute_corrector_prf(results, logger):
"""
copy from https://github.com/sunnyqiny/Confusionset-guided-Pointer-Networks-for-Chinese-Spelling-Check/blob/master/utils/evaluation_metri... | 0 | 0 | 0 | 0 | 0 | 0 |
sidechainnet/examples/models.py | THGLab/sidechainnet | 167 | 1621151 | <filename>sidechainnet/examples/models.py
"""Example models for training protein sequence to angle coordinates tasks."""
import numpy as np
import torch
from sidechainnet.structure.build_info import NUM_ANGLES
class BaseProteinAngleRNN(torch.nn.Module):
"""A simple RNN that consumes protein sequences and produce... | 0 | 0 | 0 | 0 | 0 | 0 |
src/overcooked_ai_py/agents/benchmarking.py | jkondic/overcooked_ai | 302 | 1621155 | <reponame>jkondic/overcooked_ai
import copy
import numpy as np
from overcooked_ai_py.utils import save_pickle, load_pickle, cumulative_rewards_from_rew_list, save_as_json, \
load_from_json, merge_dictionaries, rm_idx_from_dict, take_indexes_from_dict, is_iterable
from overcooked_ai_py.planning.planners import NO_C... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/win/new_analyze_warnings/warning_diff.py | google-ar/chromium | 2,151 | 1621172 | <filename>tools/win/new_analyze_warnings/warning_diff.py
# 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.
"""
This script takes two warning summary files and reports on the new warnings
and the fixed war... | 0 | 0 | 0 | 0 | 0 | 0 |
pytorch_toolbelt/modules/hypercolumn.py | valyukov/pytorch-toolbelt | 377 | 1621191 | <filename>pytorch_toolbelt/modules/hypercolumn.py
"""Implementation of hypercolumn module from "Hypercolumns for Object Segmentation and Fine-grained Localization"
Original paper: https://arxiv.org/abs/1411.5752
"""
import torch
from torch import nn
from torch.nn import functional as F
from .fpn import FPNFuse
__all... | 0 | 0 | 0 | 0 | 0 | 0 |
homeassistant/components/ihc/binary_sensor.py | MrDelik/core | 30,023 | 1621206 | <reponame>MrDelik/core<gh_stars>1000+
"""Support for IHC binary sensors."""
from __future__ import annotations
from ihcsdk.ihccontroller import IHCController
from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.const import CONF_TYPE
from homeassistant.core import HomeAssistant
fro... | 0 | 0 | 0 | 0 | 0 | 0 |
generating_queries/generate_test_sets.py | cwlroda/pointnetvlad | 299 | 1621208 | <gh_stars>100-1000
import pandas as pd
import numpy as np
import os
import pandas as pd
from sklearn.neighbors import KDTree
import pickle
import random
#####For training and test data split#####
x_width=150
y_width=150
#For Oxford
p1=[5735712.768124,620084.402381]
p2=[5735611.299219,620540.270327]
p3=[5735237.358209... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/regressiontests/signals_regress/tests.py | kix/django | 790 | 1621212 | from __future__ import absolute_import
from django.db import models
from django.test import TestCase
from .models import Author, Book
signal_output = []
def pre_save_test(signal, sender, instance, **kwargs):
signal_output.append('pre_save signal, %s' % instance)
if kwargs.get('raw'):
signal_output.... | 0 | 1 | 0 | 0 | 1 | 0 |
LRC/voting.py | houj04/AutoDL | 155 | 1621233 | <filename>LRC/voting.py
import numpy as np
try:
import cPickle as pickle
except ImportError:
import pickle
import sys, os
model_path = 'paddle_predict'
fl = os.listdir(model_path)
labels = np.load('labels.npz')['arr_0']
pred = np.zeros((10000, 10))
fl.sort()
i = 0
for f in fl:
if 'init' in f:
conti... | 0 | 0 | 0 | 0 | 0 | 0 |
api/src/opentrons/protocol_engine/resources/model_utils.py | knownmed/opentrons | 235 | 1621239 | <filename>api/src/opentrons/protocol_engine/resources/model_utils.py
"""Unique ID generation provider."""
from datetime import datetime, timezone
from uuid import uuid4
class ModelUtils:
"""Common resource model utilities provider."""
@staticmethod
def generate_id() -> str:
"""Generate a unique i... | 0 | 0 | 0 | 0 | 0 | 0 |
pyinfra/operations/init.py | blarghmatey/pyinfra | 1,532 | 1621254 | <reponame>blarghmatey/pyinfra<filename>pyinfra/operations/init.py
'''
.. warning::
This is a legacy module providing backwards compatibility. Please use the other modules:
+ :doc:`./systemd`
+ :doc:`./upstart`
+ :doc:`./launchd`
+ :doc:`./sysvinit`
+ :doc:`./bsdinit`
+ `server.service oper... | 0 | 0 | 0 | 0 | 0 | 0 |
apps/dash-global-living-standards/definitions.py | JeroenvdSande/dash-sample-apps | 2,332 | 1621282 | <reponame>JeroenvdSande/dash-sample-apps
import os
joinpath = os.path.join
BASE_PATH = os.path.dirname(os.path.realpath(__file__))
print(f"set base dir to {BASE_PATH}")
DATAMGR_PATH = joinpath(BASE_PATH, "datamanager/")
DATA_BASE_PATH = joinpath(BASE_PATH, "data/")
RAWDATA_PATH = joinpath(DATA_BASE_PATH, "raw_data/... | 0 | 0 | 0 | 0 | 0 | 0 |
doc/rst/getting_started/src/hello_world_python/hello_world_snd.py | SirArep/ecal | 493 | 1621293 | import sys
import time
import ecal.core.core as ecal_core
from ecal.core.publisher import StringPublisher
if __name__ == "__main__":
# initialize eCAL API. The name of our Process will be "Python Hello World Publisher"
ecal_core.initialize(sys.argv, "Python Hello World Publisher")
# Create a String Publisher t... | 0 | 0 | 0 | 0 | 0 | 0 |
Contributions/HeapSort.py | sattwik21/Hacktoberfest2021-1 | 215 | 1621320 | from heapq import heappush,heappop
#create function for heap
def heap_sort(array) -> object:
heap = []
for element in array:
heappush(heap, element)
ordered = []
# element left in the top heap
while heap:
ordered.append(heappop(heap))
return ordered
# array
array = [14,2... | 0 | 1 | 0 | 0 | 1 | 0 |
lib/meshrenderer/gl_utils/vertexbuffer.py | AlbertoRemus/GDR_Net | 132 | 1621321 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
import numpy as np
from OpenGL.GL import *
class Vertexbuffer(object):
def __init__(self, data, dynamic=False):
self.__id = np.empty(1, dtype=np.uint32)
glCreateBuffers(len(self.__id), self.__id)
code = 0 if not dynamic else GL_DYNAMIC_STORAGE_BI... | 0 | 0 | 0 | 0 | 0 | 0 |
glucosetracker/core/models.py | arhanair/glucose-tracker-monitor | 134 | 1621324 | <reponame>arhanair/glucose-tracker-monitor
from django.db import models
class TimeStampedModel(models.Model):
"""
Abstract base class that provides self-updating 'created' and 'modified'
fields.
"""
created = models.DateTimeField(auto_now_add=True)
modified = models.DateTimeField(auto_now=True... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/SampleApps/python/tweeter3/tweeter3/settings/production.py | samruddhikhandale/Oryx | 403 | 1621355 | <gh_stars>100-1000
from tweeter3.settings.base import *
import os
SECRET_KEY = os.environ['SECRET_KEY']
DEBUG = False
AZURE_APPSERVICE_HOSTNAME = os.environ['AZURE_APPSERVICE_HOSTNAME']
ALLOWED_HOSTS = [f"{AZURE_APPSERVICE_HOSTNAME}.azurewebsites.net"]
# Database
# https://docs.djangoproject.com/en/2.1/ref/setting... | 0 | 0 | 0 | 0 | 0 | 0 |
mmselfsup/models/necks/cae_neck.py | mitming/mmselfsup | 355 | 1621369 | # Copyright (c) OpenMMLab. All rights reserved.
from typing import Tuple
import torch
import torch.nn as nn
from mmcv.cnn import build_norm_layer
from mmcv.cnn.utils.weight_init import trunc_normal_
from mmcv.runner import BaseModule
from ..builder import NECKS
from ..utils import CAETransformerRegressorLayer, Transf... | 20 | 4 | 0 | 0 | 24 | 0 |
det3d/datasets/dataset_factory.py | PatrickChoDev/CSA-3D | 1,318 | 1621381 | from .kitti import KittiDataset
from .nuscenes import NuScenesDataset
from .lyft import LyftDataset
dataset_factory = {
"KITTI": KittiDataset,
"NUSC": NuScenesDataset,
"LYFT": LyftDataset,
}
def get_dataset(dataset_name) -> object:
return dataset_factory[dataset_name]
| 0 | 1 | 0 | 0 | 1 | 0 |
fias/migrations/0012_field_descriptions_and_more_fks.py | xiva-wgt/django-fias | 108 | 1621395 | <reponame>xiva-wgt/django-fias
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2016-08-25 08:19
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('fias', '0011_default_fks_valu... | 0 | 0 | 0 | 0 | 0 | 0 |
src/securityinsight/azext_sentinel/generated/action.py | Mannan2812/azure-cli-extensions | 207 | 1621397 | # --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incor... | 14 | 14 | 0 | 0 | 28 | 0 |
labs/09_triplet_loss/solutions/siamese.py | soufiomario/labs-Deep-learning | 1,398 | 1621405 | class Siamese(tf.keras.Model):
def __init__(self, shared_conv):
super().__init__(self, name="siamese")
self.conv = shared_conv
self.dot = Dot(axes=-1, normalize=True)
def call(self, inputs) -> object:
i1, i2 = inputs
x1 = self.conv(i1)
x2 = self.conv(i2)
... | 0 | 1 | 0 | 0 | 1 | 0 |
src/benchmarks/gc/src/exec/run_tests.py | BruceForstall/performance | 547 | 1621408 | # Licensed to the .NET Foundation under one or more agreements.
# The .NET Foundation licenses this file to you under the MIT license.
# See the LICENSE file in the project root for more information.
from dataclasses import dataclass
from datetime import datetime
from pathlib import Path
from sys import exc_info
from ... | 18 | 9 | 16 | 0 | 43 | 0 |
chrome/common/extensions/docs/server2/cache_chain_object_store.py | kjthegod/chromium | 2,151 | 1621412 | # Copyright 2013 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.
from future import All, Future
from object_store import ObjectStore
class CacheChainObjectStore(ObjectStore):
'''Maintains an in-memory cache along with ... | 1 | 3 | 0 | 1 | 5 | 0 |
browserup-proxy-core/src/main/resources/mitmproxy/additional_headers.py | BrianRossmajer/browserup-proxy | 158 | 1621430 | import json
import base64
import typing
import tempfile
import re
from datetime import datetime
from datetime import timezone
import falcon
from mitmproxy import ctx
from mitmproxy import connections
from mitmproxy import version
from mitmproxy.utils import strutils
from mitmproxy.net.http import cookies
from mitm... | 0 | 2 | 0 | 2 | 4 | 0 |
Algo and DSA/LeetCode-Solutions-master/Python/transform-to-chessboard.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 1621431 | <gh_stars>1000+
# Time: O(n^2)
# Space: O(n^2), used by Counter, this could be reduced to O(n) by skipping invalid input
import collections
import itertools
class Solution(object):
def movesToChessboard(self, board):
"""
:type board: List[List[int]]
:rtype: int
"""
N = le... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/hwsim/test_mbo.py | zhijianli88/hostap | 1,991 | 1621435 | <filename>tests/hwsim/test_mbo.py
# MBO tests
# Copyright (c) 2016, Intel Deutschland GmbH
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
from remotehost import remote_compatible
import logging
logger = logging.getLogger()
import hostapd
import os
import time
... | 0 | 0 | 0 | 0 | 0 | 0 |
Documentation/DataFormats/python/RecoBTau_dataformats.py | ckamtsikis/cmssw | 852 | 1621473 | <gh_stars>100-1000
'''
Created on Jun 26, 2013
@author: <NAME>
@contact: <EMAIL>
http://cmsdoxy.web.cern.ch/cmsdoxy/dataformats/
@responsible:
'''
json = {
"full": {
"title": "RecoBTau collections (in RECO and AOD)",
"data": [
]
},
"aod": {
"tit... | 0 | 0 | 0 | 0 | 0 | 0 |
AutoDL_sample_code_submission/at_speech/classifier/sklearn_lr.py | dianjixz/AutoDL | 1,044 | 1621517 | <reponame>dianjixz/AutoDL
from __future__ import absolute_import
import numpy as np
from sklearn.linear_model import logistic, SGDClassifier
from sklearn.multiclass import OneVsRestClassifier
from sklearn.pipeline import Pipeline
from sklearn.tree import DecisionTreeClassifier
from at_toolkit.interface.adl_classifier... | 0 | 0 | 0 | 0 | 0 | 0 |
mayan/apps/mime_types/backends/file_command.py | bonitobonita24/Mayan-EDMS | 343 | 1621526 | <filename>mayan/apps/mime_types/backends/file_command.py
from shutil import copyfileobj
import sh
from django.utils.translation import ugettext_lazy as _
from mayan.apps.dependencies.exceptions import DependenciesException
from mayan.apps.storage.utils import NamedTemporaryFile
from ..classes import MIMETypeBackend... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/basics/gen_yield_from_stopped.py | rxchen/micropython | 13,648 | 1621551 | # Yielding from stopped generator is ok and results in None
def gen() -> int:
return 1
# This yield is just to make this a generator
yield
f = gen()
def run():
print((yield from f))
print((yield from f))
print((yield from f))
try:
next(run())
except StopIteration:
print("StopIteratio... | 0 | 1 | 0 | 0 | 1 | 0 |
apps/dash-deck-explorer/demos/usage-hexagon-layer.py | JeroenvdSande/dash-sample-apps | 2,332 | 1621554 | <gh_stars>1000+
"""
Adapted from: https://pydeck.gl/gallery/hexagon_layer.html
Personal injury road accidents in GB from 1979.
The layer aggregates data within the boundary of each hexagon cell.
This example is adapted from the deck.gl documentation.
"""
import os
import dash
import dash_deck
import dash_html_compo... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/asisctffinals2015_fake/solve.py | Alex97/angr-doc | 833 | 1621591 | import angr
import binascii
def main() -> object:
p = angr.Project("fake", auto_load_libs=False)
state = p.factory.blank_state(addr=0x4004AC)
inp = state.solver.BVS('inp', 8*8)
state.regs.rax = inp
simgr= p.factory.simulation_manager(state)
simgr.explore(find=0x400684)
found = simgr.found... | 0 | 1 | 0 | 0 | 1 | 0 |
deepy/debug/debug_functions.py | uaca/deepy | 260 | 1621596 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import theano
def check_test_values():
theano.config.compute_test_value = 'warn'
def set_trace():
try:
from ipdb import set_trace as _set_trace
except ImportError as e:
from pdb import set_trace as _set_trace
_set_trace() | 0 | 0 | 0 | 0 | 0 | 0 |
tools/maf_stats/maf_stats.py | ic4f/tools-iuc | 142 | 1621600 | <gh_stars>100-1000
#!/usr/bin/env python
# <NAME>
"""
Reads a list of intervals and a maf. Outputs a new set of intervals with statistics appended.
"""
from __future__ import print_function
import sys
import bx.intervals.io
from bx.bitset import BitSet
from galaxy.tools.util import maf_utilities
def __main__():
... | 0 | 0 | 0 | 0 | 0 | 0 |
terrascript/cloudscale/__init__.py | hugovk/python-terrascript | 507 | 1621616 | # terrascript/cloudscale/__init__.py
import terrascript
class cloudscale(terrascript.Provider):
pass
| 0 | 0 | 0 | 0 | 0 | 0 |
wikisql_data/scripts/relevance.py | Bhaskers-Blu-Org2/PointerSQL | 102 | 1621617 | <gh_stars>100-1000
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn.pipeline import Pipeline
from sklearn import svm
import numpy as np
import random
import operator
np.random.seed(123)
def load_file(filename):
data = []
with op... | 0 | 0 | 0 | 0 | 0 | 0 |
corehq/apps/case_importer/tracking/exceptions.py | dimagilg/commcare-hq | 471 | 1621645 | <filename>corehq/apps/case_importer/tracking/exceptions.py<gh_stars>100-1000
class TimedOutWaitingForCaseUploadRecord(Exception):
pass
| 0 | 0 | 0 | 0 | 0 | 0 |
src/genie/libs/parser/iosxe/tests/ShowVfiName/cli/equal/golden_output_expected.py | balmasea/genieparser | 204 | 1621652 | expected_output = {'bridge-domain': 1000,
'peers': {1: {'peer-address': '192.168.255.3', 's': 'Y', 'vc-id': 1000},
2: {'peer-address': '192.168.255.1', 's': 'Y', 'vc-id': 1000}},
'signaling': 'LDP',
'state': 'up',
'type': 'multipoint',
'vfi-name': 'vpls',
'vpn-id': 1000}
| 0 | 0 | 0 | 0 | 0 | 0 |
open/core/tests/test_urls_configured.py | lawrendran/open | 105 | 1621655 | <reponame>lawrendran/open
from django.conf import settings
from django.contrib.auth import get_user_model
from django.test import TestCase
from django.urls import URLPattern, URLResolver
User = get_user_model()
"""
python manage.py test --pattern="*test_urls_configured.py"
"""
urlconf = __import__(settings.ROOT_URLC... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/create_regression_data.py | fkutsukos/scaper | 253 | 1621657 | import os
import scaper
import jams
os.chdir('..')
# FIXTURES
# Paths to files for testing
FG_PATH = 'tests/data/audio/foreground'
BG_PATH = 'tests/data/audio/background'
ALT_FG_PATH = 'tests/data/audio_alt_path/foreground'
ALT_BG_PATH = 'tests/data/audio_alt_path/background'
REG_NAME = 'soundscape_20200501'
# REG_... | 1 | 1 | 0 | 0 | 2 | 0 |
generate_static_site.py | susannahsoon/oldperth | 302 | 1621673 | #!/usr/bin/env python
'''Generate a static version of oldnyc.org consisting entirely of JSON.'''
import chardet
from collections import defaultdict, OrderedDict
import csv
import json
import record
import re
from distutils.dir_util import copy_tree
from shutil import copyfile
import subprocess
import sys
import time
i... | 0 | 6 | 0 | 0 | 6 | 0 |
pynes/tests/asl_test.py | timgates42/pyNES | 1,046 | 1621681 | <gh_stars>1000+
# -*- coding: utf-8 -*-
'''
ASL, Arithmetic Shift Left
This is a test for the bit manipulation instruction ASL.
'''
import unittest
from pynes.tests import MetaInstructionCase
class AslImmTest(unittest.TestCase):
# TODO see the accumulator type instruction, ASL A
__metaclass__ = MetaInstructi... | 0 | 0 | 0 | 0 | 0 | 0 |
my/codepoints.py | cibu/language-resources | 177 | 1621717 | <gh_stars>100-1000
#! /usr/bin/env python
#
# Copyright 2016 Google 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 | 0 | 0 | 0 | 0 | 0 |
h2o-py/tests/testdir_misc/pyunit_mojo_pipeline.py | ahmedengu/h2o-3 | 6,098 | 1621733 | <reponame>ahmedengu/h2o-3
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from __future__ import print_function
import sys
sys.path.insert(1,"../../")
import h2o
import os
from h2o.pipeline import H2OMojoPipeline
from tests import pyunit_utils
def mojo_pipeline():
test_dir = os.environ.get('MOJO_PIPELINE_TEST_DIR'... | 0 | 0 | 0 | 0 | 0 | 0 |
kipoi/utils.py | bfclarke/kipoi | 213 | 1621739 | from kipoi_utils.utils import * # backward compatibility | 0 | 0 | 0 | 0 | 0 | 0 |
examples/test_refs.py | ywchiu/flasgger | 1,696 | 1621748 | # -*- coding: utf-8 -*-
"""
Example to test cascading $refs and basePath
"""
from flask import Flask, jsonify, Blueprint
from flasgger import swag_from, Swagger
try:
import simplejson as json
except ImportError:
import json
try:
from http import HTTPStatus
except ImportError:
import httplib as HTTPSt... | 0 | 1 | 0 | 0 | 1 | 0 |
orc8r/gateway/python/magma/common/metrics_export.py | Aitend/magma | 849 | 1621752 | <gh_stars>100-1000
"""
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
W... | 0 | 0 | 0 | 0 | 0 | 0 |
xonsh/ptk_shell/history.py | ion201/xonsh | 4,716 | 1621757 | # -*- coding: utf-8 -*-
"""History object for use with prompt_toolkit."""
import prompt_toolkit.history
from xonsh.built_ins import XSH
class PromptToolkitHistory(prompt_toolkit.history.History):
"""History class that implements the prompt-toolkit history interface
with the xonsh backend.
"""
def _... | 1 | 5 | 0 | 0 | 6 | 0 |
bin/docutils/languages/pt_br.py | iilness2/bash-lambda-layer-custom | 445 | 1621782 | <reponame>iilness2/bash-lambda-layer-custom
# $Id: pt_br.py 5567 2008-06-03 01:11:03Z goodger $
# Author: <NAME> <<EMAIL>>
# Copyright: This module has been placed in the public domain.
# New language mappings are welcome. Before doing a new translation, please
# read <http://docutils.sf.net/docs/howto/i18n.html>. T... | 0 | 0 | 0 | 0 | 0 | 0 |
src/eeWishart.py | ethuee/earthengine | 126 | 1621792 | '''
Created on 09.01.2017
@author: mort
'''
import ee
from eeMad import chi2cdf
ENL = 4.4
def multbyenl(image) -> object:
return ee.Image(image).multiply(ENL)
def log_det_sum(imList,j) -> object:
'''return the log of the the determinant of the sum of the first j images in imList'''
imList = ee.List(imL... | 2 | 9 | 0 | 0 | 11 | 0 |
mailer.py | NFM-8/pyfiscan | 496 | 1621821 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Mailer utility for pyfiscan tool result CSV-files.
@author Henri 'fgeek' Salo <<EMAIL>>
@copyright Copyright (c) 2009-2020 <NAME>
@licence BSD
"""
try:
import sys
import csv
import os.path
import smtplib
import sqlite3
import traceback
im... | 0 | 0 | 0 | 0 | 0 | 0 |
speaker_change_detection_bic.py | hbredin/TristouNet | 144 | 1621825 | #!/usr/bin/env python
# encoding: utf-8
# The MIT License (MIT)
# Copyright (c) 2016 CNRS
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation ... | 0 | 0 | 0 | 0 | 0 | 0 |
log_collectors/regex_extractor/src/__init__.py | sboagibm/ffdl-model-metrics | 680 | 1621862 | <gh_stars>100-1000
from __future__ import absolute_import
from .extract_from_log import extract
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/expectations/python-expr/apply-mask-image-exp3.py | nipeone/histolab | 149 | 1621923 | [
[
[23, 153, 214, 226],
[82, 172, 200, 90],
[179, 178, 109, 250],
[178, 23, 132, 171],
[159, 104, 98, 179],
],
[[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]],
[
[172, 206, 47, 28],
[185, 136, 220, 130],
[183, 196, 1... | 0 | 0 | 0 | 0 | 0 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.