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 |
|---|---|---|---|---|
love/src/jni/detect_love.py | MikuAuahDark/love2d-android | 116 | 12655553 | <gh_stars>100-1000
import sys
from os import path
def main(argv):
if len(argv) > 0:
if path.isdir(argv[0] + "/love") and path.isfile(argv[0] + "/love/Android.mk"):
print("yes")
else:
print("no")
else:
print("no")
if __name__ == "__main__":
main(sys.argv[1:])... |
intro/matplotlib/examples/plot_gridspec.py | junghun73/Learning | 419 | 12655562 | """
GridSpec
=========
An example demoing gridspec
"""
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
plt.figure(figsize=(6, 4))
G = gridspec.GridSpec(3, 3)
axes_1 = plt.subplot(G[0, :])
plt.xticks(())
plt.yticks(())
plt.text(0.5, 0.5, 'Axes 1', ha='center', va='center', size=24, alpha=.5)
... |
supersqlite/third_party/_apsw/example-code.py | plasticity-admin/supersqlite | 1,520 | 12655644 | from __future__ import print_function
# some python 2 and 3 comnpatibility tweaks
import sys
py3=sys.version_info >= (3, 0)
def inext(v): # next value from iterator
return next(v) if py3 else v.next()
import os
import time
import apsw
###
### Check we have the expected version of apsw and sqlite
###
#@@CAPTUR... |
tests/docker_autostop_test.py | AnjanaSuraj/docker-custodian | 377 | 12655659 | try:
from unittest import mock
except ImportError:
import mock
from docker_custodian.docker_autostop import (
build_container_matcher,
get_opts,
has_been_running_since,
main,
stop_container,
stop_containers,
)
def test_stop_containers(mock_client, container, now):
matcher = mock.M... |
ranger/plugins/patch/shutil_generatorized.py | bechampion/rnvimr | 495 | 12655667 | <filename>ranger/plugins/patch/shutil_generatorized.py
"""
Patch ranger.ext.shutil_generatorized
"""
import os
from shutil import _basename
from ranger.ext import shutil_generatorized
from ranger.ext.safe_path import get_safe_path
def wrap_move(client):
"""
CopyLoader with do_cut parameter will invoke this me... |
OpenDataCatalog/api/rest.py | runonthespot/Open-Data-Catalog | 105 | 12655687 | from django.http import HttpResponse
from django.contrib.auth import authenticate
import re
import base64
def http_unauth():
res = HttpResponse("Unauthorized")
res.status_code = 401
res['WWW-Authenticate'] = 'Basic realm="Secure Area"'
return res
def match_first(regx, strg):
m = re.match(regx, str... |
source/models/dssm.py | richardbaihe/conversation | 299 | 12655714 | <reponame>richardbaihe/conversation<filename>source/models/dssm.py
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
################################################################################
#
# Copyright (c) 2019 Baidu.com, Inc. All Rights Reserved
#
#################################################################... |
lib/mirror/retrieval/compute_overlap_benchmark.py | Yzhbuaa/DAGSfM | 255 | 12655726 | <filename>lib/mirror/retrieval/compute_overlap_benchmark.py
#!/usr/bin/env python
# Copyright 2017, <NAME>, HKUST.
# compute mAP score for overlap benchmark
import sys, os
sys.path.append('..')
from tools.common import read_list
def compute_overlap_ap(gt_list, res_list, d):
gt_size = len(gt_list)
old_recall ... |
recipes/Python/546526_Page_through_iterable_N_items_at/recipe-546526.py | tdiprima/code | 2,023 | 12655728 | class groupcount(object):
"""Accept a (possibly infinite) iterable and yield a succession
of sub-iterators from it, each of which will yield N values.
>>> gc = groupcount('abcdefghij', 3)
>>> for subgroup in gc:
... for item in subgroup:
... print item,
... print
...... |
inselect/tests/gui/test_app.py | NaturalHistoryMuseum/inselect | 128 | 12655730 | <reponame>NaturalHistoryMuseum/inselect<filename>inselect/tests/gui/test_app.py
import locale
import unittest
from mock import patch
from pathlib import Path
from PyQt5.QtCore import QLocale
from PyQt5.QtWidgets import QApplication
from inselect.gui.app import main
from inselect.gui.main_window import MainWindow
TE... |
selim_sef/tools/config.py | ktncktnc/SpaceNet_Off_Nadir_Solutions | 164 | 12655738 | import json
DEFAULTS = {
"arch": "fpn_resnext",
"segnetwork": {
"backbone_arch": "resnext101",
"seg_classes": 2,
"ignore_index": 255,
},
"network": {
},
"optimizer": {
"batch_size": 256,
"freeze_first_epoch": False,
"type": "SGD", # supported: ... |
web/py-collaborator/Logger.py | H1d3r/Penetration-Testing-Tools-1 | 1,139 | 12655764 | <reponame>H1d3r/Penetration-Testing-Tools-1
import sys
class Logger:
@staticmethod
def _out(x):
sys.stderr.write(str(x) + u'\n')
@staticmethod
def dbg(x):
sys.stderr.write(u'[dbg] ' + str(x) + u'\n')
@staticmethod
def out(x):
Logger._out(u'[.] ' + str(x))
@staticm... |
sanic/application/logo.py | Varriount/sanic | 1,883 | 12655791 | import re
import sys
from os import environ
BASE_LOGO = """
Sanic
Build Fast. Run Fast.
"""
COFFEE_LOGO = """\033[48;2;255;13;104m \033[0m
\033[38;2;255;255;255;48;2;255;13;104m ββββββββββ \033[0m
\033[38;2;255;255;255;48;2;255;13;104m ββ βββββ \033... |
Stephanie/Modules/evernote_module.py | JeremyARussell/stephanie-va | 866 | 12655792 | <gh_stars>100-1000
import evernote.edam.type.ttypes as NoteType
from evernote.api.client import EvernoteClient
from Stephanie.Modules.base_module import BaseModule
# Written by <NAME> - <EMAIL>
class EvernoteModule(BaseModule):
def __init__(self, *args):
super(EvernoteModule, self).__init__(*args)
... |
settings_screenbird.py | annevandalfsen/screenbird | 121 | 12655794 | # Django settings for pastevid project.
import datetime
import os.path
import profanity_list
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
# Use to determine what robots.txt to serve. To allow all crawlers set this to True.
PRODUCTION = False
ADMINS = (
('adam', '... |
Vecihi/Backend/vecihi/posts/migrations/0003_viewedposttracking.py | developertqw2017/migrationDjango | 220 | 12655806 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2018-02-24 18:46
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_depende... |
pysnmp/entity/rfc3413/cmdrsp.py | RKinsey/pysnmp | 492 | 12655834 | #
# This file is part of pysnmp software.
#
# Copyright (c) 2005-2019, <NAME> <<EMAIL>>
# License: http://snmplabs.com/pysnmp/license.html
#
import pysnmp.smi.error
from pysnmp import debug
from pysnmp.proto import errind
from pysnmp.proto import error
from pysnmp.proto import rfc1902
from pysnmp.proto import rfc1905
f... |
common/ops/loss_ops.py | vahidk/TensorflowFramework | 129 | 12655876 | """Loss ops."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from common.ops import activation_ops
def softmax_entropy(logits, dims=-1):
"""Softmax entropy from logits."""
plogp = activation_ops.softmax(logits, dims) * acti... |
apps/yolo/detect_api_yolov3.py | yarenty/ml-suite | 334 | 12655916 | <reponame>yarenty/ml-suite<filename>apps/yolo/detect_api_yolov3.py
import numpy as np
import nms
import time
from yolo_utils import process_all_yolo_layers, apply_nms
from xfdnn.rt import xdnn_io
def correct_region_boxes(boxes_array, x_idx, y_idx, w_idx, h_idx, w, h, net_w, net_h):
new_w = 0;
new_h =... |
DIE/Plugins/DataParsers/StringParser/StringParser.py | requizm/DIE | 496 | 12655935 |
from DIE.Lib.DataPluginBase import DataPluginBase
import idc
import idaapi
# TODO: Add more string types.
ASCII_STR = 0 # ASCII String
UNICODE_STR = 1 # Unicode String
class StringParser(DataPluginBase):
"""
A generic string value parser
"""
def __init__(self):
sup... |
src/fingerflow/extractor/__init__.py | jakubarendac/fingerflow | 327 | 12655950 | <filename>src/fingerflow/extractor/__init__.py
from .extractor import Extractor
|
devices/tests/test_models.py | ggidofalvy-tc/peering-manager | 173 | 12655959 | <filename>devices/tests/test_models.py<gh_stars>100-1000
from django.conf import settings
from django.test import TestCase
from devices.enums import PasswordAlgorithm
from devices.models import Platform
class PlatformTest(TestCase):
@classmethod
def setUpTestData(cls):
cls.platforms = [
P... |
deep-rl/lib/python2.7/site-packages/OpenGL/raw/GLES2/OES/texture_storage_multisample_2d_array.py | ShujaKhalid/deep-rl | 210 | 12655966 | <gh_stars>100-1000
'''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.GLES2 import _types as _cs
# End users want this...
from OpenGL.raw.GLES2._types import *
from OpenGL.raw.GLES2 import _errors
from OpenGL.constant import Con... |
h2o-py/tests/testdir_munging/pyunit_whichmaxmin.py | ahmedengu/h2o-3 | 6,098 | 12655972 | from __future__ import print_function
import sys
sys.path.insert(1,"../../")
import h2o
from tests import pyunit_utils
import pandas as pd
def whichmaxmin():
#Make H2O frame
f1 = h2o.create_frame(rows = 10000, cols = 100, categorical_fraction = 0, missing_fraction = 0,seed=1234)
#Make comparable pandas ... |
Tests/test_execfile.py | cwensley/ironpython2 | 1,078 | 12655984 | # Licensed to the .NET Foundation under one or more agreements.
# The .NET Foundation licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information.
import os
import unittest
from iptest import IronPythonTestCase, run_test
class ExecFileTest(IronPythonTestC... |
Python/Swap-two-numbers.py | Nikhil-Sharma-1/DS-Algo-Point | 1,148 | 12655993 | <filename>Python/Swap-two-numbers.py
# Problem statement
# write a program to swap two numbers without using third variable
x = input()
y = input()
print ("Before swapping: ")
print("Value of x : ", x, " and y : ", y)
x, y = y, x
print ("After swapping: ")
print("Value of x : ", x, " and y : ", y)
# samp... |
test/unit/test_interface.py | Zhiyuan-w/DeepReg | 379 | 12656023 | <gh_stars>100-1000
# coding=utf-8
"""
Tests for deepreg/dataset/loader/interface.py
"""
from test.unit.util import is_equal_np
from typing import Optional, Tuple
import numpy as np
import pytest
from deepreg.dataset.loader.interface import (
AbstractPairedDataLoader,
AbstractUnpairedDataLoader,
DataLoade... |
3rdParty/iresearch/scripts/Prometheus/PythonBenchmark.py | rajeev02101987/arangodb | 12,278 | 12656027 | #!/usr/bin/env python
import re
from prometheus_client import CollectorRegistry, Gauge, push_to_gateway
import subprocess
import platform
import os
import subprocess
import shutil
import sys
import csv
#Base dictionary labels
baseLabels = ["repeat", "threads", "random", "scorer", "scorer-arg"]
class MetricValue:
""... |
examples/Legacy_Rest/modify_ilo_user_account.py | andreaslangnevyjel/python-ilorest-library | 214 | 12656071 | # Copyright 2020 Hewlett Packard Enterprise Development, LP.
#
# 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 b... |
benchmarks/fast.py | ktanishqk/py-earth | 360 | 12656097 | import numpy as np
from pyearth import Earth
from timeit import Timer
# The robot arm example, as defined in:
# Fast MARS, <NAME>, Technical Report No.110, May 1993, section 6.2.
np.random.seed(2)
nb_examples = 400
theta1 = np.random.uniform(0, 2 * np.pi, size=nb_examples)
theta2 = np.random.uniform(0, 2 * np.pi, siz... |
code/models/unsupervised_part.py | ricklentz/2dimageto3dmodel | 150 | 12656143 | <reponame>ricklentz/2dimageto3dmodel
# author: <NAME>
import torch
import torch.nn as nn
from encoder import Encoder
from decoder import Decoder
from pose_decoder import PoseDecoder
from ..utils.dropout import PointCloudDropOut
from ..utils.effective_loss_function import EffectiveLossFunction
from ..utils.batch_repeti... |
insights/parsers/tests/test_rhn_charsets.py | lhuett/insights-core | 121 | 12656152 | from insights.tests import context_wrap
from insights.parsers.rhn_charsets import RHNCharSets
emb_charsets_content = """
server_encoding
-----------------
UTF~
(1 row)
client_encoding
-----------------
UTF8
(1 row)
"""
ora_charsets_content = """
PARAMETER VALUE
---------------------------------... |
cctbx/omz/cod_refine.py | dperl-sol/cctbx_project | 155 | 12656194 | from __future__ import absolute_import, division, print_function
from cctbx import omz
import cctbx.omz.dev
from cctbx.array_family import flex
from libtbx.test_utils import approx_equal
from libtbx import easy_run
from libtbx import easy_pickle
from libtbx.utils import date_and_time, user_plus_sys_time
import libtbx.l... |
mozillians/groups/managers.py | divyamoncy/mozillians | 202 | 12656201 | from django.db.models import Case, Count, IntegerField, Manager, Sum, When
from django.db.models.query import QuerySet
class GroupBaseManager(Manager):
use_for_related_fields = True
def get_queryset(self):
"""Annotate count of group members."""
qs = super(GroupBaseManager, self).get_queryset(... |
tests/clpy_tests/opencl_tests/ultima_tests/test_cindexer.py | fixstars/clpy | 142 | 12656202 | # flake8: noqa
# TODO(vorj): When we will meet flake8 3.7.0+,
# we should ignore only W291 for whole file
# using --per-file-ignores .
import clpy
import unittest
class TestUltimaCIndexer(unittest.TestCase):
def test_cindexer_argument_mutation(self):
x = clpy.backend.ultima.e... |
server/intrinsic/algorithm/gehler2011/lib/mpi_kmeans-1.6/mpi_kmeans.py | paulu/opensurfaces | 137 | 12656270 | #!/usr/bin/python
# Wrapper for the MPI-Kmeans library by <NAME>
from ctypes import c_int, c_double, c_uint
from numpy.ctypeslib import ndpointer
import numpy as N
from numpy import empty,array,reshape,arange
def kmeans(X, nclst, maxiter=0, numruns=1):
"""Wrapper for <NAME>ers accelerated MPI-Kmeans routine."""
... |
onnxruntime/python/tools/quantization/__init__.py | dennyac/onnxruntime | 6,036 | 12656290 | from .quantize import quantize, quantize_static, quantize_dynamic, quantize_qat
from .quantize import QuantizationMode
from .calibrate import CalibrationDataReader, CalibraterBase, MinMaxCalibrater, create_calibrator, CalibrationMethod
from .quant_utils import QuantType, QuantFormat, write_calibration_table
|
Acceleration/memcached/regressionSims/testgen/memtest_txt_extended_regressions.py | pooyaww/Vivado_HLS_Samples | 326 | 12656329 | #!/usr/bin/python
import memlib
## EDIT HERE ###################################################################
keySizes = range(1,28)
#keySizes.append(128)
valueSizes = keySizes[:]
#valueSizes.append(1015)
keyChars = map(chr, range(97, 126))
valueChars = map(chr, range(65, 94))
asciiVals = [1, 12, 123, 1234, 123... |
tests/Unit/Evolution/Systems/GrMhd/ValenciaDivClean/Fluxes.py | nilsvu/spectre | 117 | 12656353 | <gh_stars>100-1000
# Distributed under the MIT License.
# See LICENSE.txt for details.
import numpy as np
def b_dot_v(magnetic_field, spatial_velocity, spatial_metric):
return np.einsum("ab, ab", spatial_metric,
np.outer(magnetic_field, spatial_velocity))
def b_squared(magnetic_field, spat... |
fastrunner/migrations/0018_auto_20210410_1950.py | FuxiongYang/faster | 227 | 12656372 | # Generated by Django 2.2 on 2021-04-10 19:50
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fastrunner', '0017_visit_project'),
]
operations = [
migrations.AddField(
model_name='api',
name='yapi_catid',
... |
scss/tests/from_ruby/test_extend.py | kochelmonster/pyScss | 152 | 12656393 | from __future__ import absolute_import
from __future__ import unicode_literals
from scss import Scss
import pytest
# py.test bug: unicode literals not allowed here, so cast to native str type
pytestmark = pytest.mark.skipif(str("not config.getoption('include_ruby')"))
# TODO undupe
def assert_rendering(input, expec... |
lettersmith/doc.py | ericmjl/lettersmith_py | 103 | 12656398 | """
Tools for working with Doc type.
Docs are namedtuples that represent a file to be transformed.
The `content` field of a doc contains the file contents, read as a
Python string with UTF-8 encoding.
Most lettersmith plugins transform Docs or iterables of Docs.
For working with non-text files, images, binary files,... |
Algo and DSA/LeetCode-Solutions-master/Python/play-with-chips.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 12656467 | <filename>Algo and DSA/LeetCode-Solutions-master/Python/play-with-chips.py<gh_stars>1000+
# Time: O(n)
# Space: O(1)
class Solution(object):
def minCostToMoveChips(self, chips):
"""
:type chips: List[int]
:rtype: int
"""
count = [0]*2
for p in chips:
cou... |
src/beanmachine/ppl/compiler/fix_vectorized_models.py | facebookresearch/beanmachine | 177 | 12656480 | <filename>src/beanmachine/ppl/compiler/fix_vectorized_models.py<gh_stars>100-1000
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import Callable, Dict, List, Type
import bean... |
lib/evaluation.py | pichetzh/jama16-retina-replication | 108 | 12656494 | <reponame>pichetzh/jama16-retina-replication
import tensorflow as tf
import numpy as np
def _get_operations_by_names(graph, names):
return [graph.get_operation_by_name(name) for name in names]
def _get_tensors_by_names(graph, names):
return [graph.get_tensor_by_name(name) for name in names]
def perform_tes... |
istio/tests/cases/11_zipkin_spec.py | pxzero/nginmesh | 402 | 12656538 | <gh_stars>100-1000
import requests
import time
import configuration
from mamba import description, context, it
from expects import expect, be_true, have_length, equal, be_a, have_property, be_none
headers = {'content-type': 'application/json','accept': 'application/json'}
with description('Zipkin tracing functionality... |
mono/datasets/splits/kitti_shot_sequence/gen_split.py | Jenaer/FeatDepth | 179 | 12656565 | <filename>mono/datasets/splits/kitti_shot_sequence/gen_split.py
if __name__ == "__main__":
f = open('val_files.txt', 'w')
for i in range(108):
f.writelines(['2011_09_26/2011_09_26_drive_0001_sync ', str(i).zfill(10), ' l\n'])
f.close()
print('done') |
igibson/examples/behavior/behavior_robot_related_states_demo.py | suresh-guttikonda/iGibson | 360 | 12656576 | import os
import bddl
import igibson
from igibson import object_states
from igibson.examples.behavior import behavior_demo_replay
bddl.set_backend("iGibson")
def robot_states_callback(igbhvr_act_inst, _):
window1 = (igbhvr_act_inst.object_scope["window.n.01_1"], "kitchen")
window2 = (igbhvr_act_inst.object... |
pkgs/conda-env-2.5.2-py27_0/lib/python2.7/site-packages/conda_env/yaml.py | wangyum/anaconda | 107 | 12656585 | <filename>pkgs/conda-env-2.5.2-py27_0/lib/python2.7/site-packages/conda_env/yaml.py
"""
Wrapper around yaml to ensure that everything is ordered correctly.
This is based on the answer at http://stackoverflow.com/a/16782282
"""
from __future__ import absolute_import, print_function
from collections import OrderedDict
i... |
citeomatic/tasks.py | IntheGrass/citeomatic_learning | 162 | 12656614 | #!/usr/bin/env python
"""
Luigi pipeline for Citeomatic.
This includes tasks for fetching the dataset, building a vocabulary and
training features and training/evaluating the model.
"""
import logging
import os
import zipfile
from os import path
import luigi
from citeomatic import file_util, features, training, corpu... |
tests/test_hyper.py | Vermeille/Torchelie | 117 | 12656625 | import os
from contextlib import suppress
from torchelie.hyper import HyperparamSearch, UniformSampler
def beale(x, y):
return (1.5 - x + x * y)**2 + (2.25 - x + x * y**2)**2 + (2.625 - x +
x * y**3)**2
def sphere(x, y):
return x**2 + y**2
def... |
rllib/utils/schedules/linear_schedule.py | firebolt55439/ray | 21,382 | 12656626 | <reponame>firebolt55439/ray
from ray.rllib.utils.schedules.polynomial_schedule import PolynomialSchedule
class LinearSchedule(PolynomialSchedule):
"""
Linear interpolation between `initial_p` and `final_p`. Simply
uses Polynomial with power=1.0.
final_p + (initial_p - final_p) * (1 - `t`/t_max)
"... |
connectorx-python/connectorx/tests/benchmarks.py | ives9638/connector-x | 565 | 12656634 | """
This file is skipped during normal test because the file name is not started with benchmarks
"""
import os
from .. import read_sql
def read_sql_impl(conn: str, table: str):
read_sql(
conn,
f"""SELECT * FROM {table}""",
partition_on="L_ORDERKEY",
partition_num=10,
)
def b... |
homeassistant/components/horizon/__init__.py | domwillcode/home-assistant | 30,023 | 12656666 | """The horizon component."""
|
DeepCpG_DNA/template/prepare_model_yaml.py | Luma-1994/lama | 137 | 12656688 | import yaml
import keras
import json
import shutil
import os
from deepcpg.utils import make_dir, to_list
from deepcpg.models.utils import decode_replicate_names, encode_replicate_names, get_sample_weights
##### This function is needed to extract info on model architecture so that the output can be generated correctly... |
terrascript/provider/dme.py | hugovk/python-terrascript | 507 | 12656706 | <filename>terrascript/provider/dme.py
# terrascript/provider/dme.py
import terrascript
class dme(terrascript.Provider):
pass
__all__ = ["dme"]
|
tests/test_fetch.py | aldslvda/django-echarts | 181 | 12656715 | # coding=utf8
import unittest
from django_echarts.datasets.fetch import fetch, fetch_single, ifetch_multiple
DICT_LIST_DATA = [
{'id': 282, 'name': 'Alice', 'age': 30, 'sex': 'female'},
{'id': 217, 'name': 'Bob', 'age': 56},
{'id': 328, 'name': 'Charlie', 'age': 56, 'sex': 'male'},
]
class FetchTestCa... |
recipe_scrapers/kingarthur.py | mathiazom/recipe-scrapers | 811 | 12656735 | from bs4 import BeautifulSoup
from ._abstract import AbstractScraper
from ._utils import normalize_string
class KingArthur(AbstractScraper):
@classmethod
def host(cls):
return "kingarthurbaking.com"
def title(self):
return self.schema.title()
def total_time(self):
return sel... |
code/final_face_slider_tool.py | waterjump/alignedCelebFaces | 190 | 12656762 | <reponame>waterjump/alignedCelebFaces
import html
import math
import pygame
import numpy as np
import tensorflow as tf
from pygame.locals import *
from scipy import misc
eigenvalues = np.load("eigenvalues.npy")
eigenvectors = np.load("eigenvectors.npy")
eigenvectorInverses = np.linalg.pinv(eigenvectors)
def weight_... |
examples/srl_example_setup.py | david-abel/mdps | 230 | 12656769 | ''' Setup example scripts run (even without simple_rl fully installed).'''
import os
import sys
parent_dir = os.path.abspath(os.path.join(os.getcwd(), os.pardir))
sys.path.insert(0, parent_dir) |
lightnlp/utils/score_func.py | CNLPT/lightNLP | 889 | 12656802 | <filename>lightnlp/utils/score_func.py
import torch
import torch.nn as nn
import torch.nn.functional as F
p1 = torch.nn.PairwiseDistance(p=1)
p2 = torch.nn.PairwiseDistance(p=2)
def l1_score(vec1, vec2):
return p1(vec1, vec2)
def l2_score(vec1, vec2):
return p2(vec1, vec2)
def cos_score(vec1, vec2):
... |
ddos/child.py | security-geeks/hacking-tools | 198 | 12656842 | import asyncio
import aiohttp
import asyncio_redis
from config import LOG_INTERVAL,REQ_KEY,KILL_KEY
class Child(object):
"""
wrapping all the child process feature in this class
"""
def __init__(self,id,url):
self.id = id+"-"+REQ_KEY
# print(self.id)
# self.connection = redis... |
tests/test_visitors/test_tokenize/test_primitives/test_numbers/test_wrong_hex_case.py | cdhiraj40/wemake-python-styleguide | 1,931 | 12656858 | <reponame>cdhiraj40/wemake-python-styleguide<gh_stars>1000+
import pytest
from wemake_python_styleguide.violations.consistency import (
BadNumberSuffixViolation,
WrongHexNumberCaseViolation,
)
from wemake_python_styleguide.visitors.tokenize.primitives import (
WrongNumberTokenVisitor,
)
hex_number_templat... |
src/vendor/github.com/docker/notary/buildscripts/dockertest.py | shaneutt/harbor | 1,729 | 12656874 | <gh_stars>1000+
"""
Script that automates trusted pull/pushes on different docker versions.
Usage: python buildscripts/dockertest.py
- assumes that this is run from the root notary directory
- assumes that bin/client already exists
- assumes you are logged in with docker
- environment variables to provide:
- DEB... |
pysph/examples/spheric/moving_square.py | nauaneed/pysph | 293 | 12656876 | """SPHERIC benchmark case 6. (2 hours)
See http://spheric-sph.org/tests/test-6 for more details.
"""
# math
from math import exp
# PySPH imports
from pysph.base.utils import get_particle_array
from pysph.base.kernels import QuinticSpline
from pysph.solver.solver import Solver
from pysph.solver.application import App... |
warp/__init__.py | NVIDIA/warp | 306 | 12656877 | # Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... |
tests/components/luftdaten/conftest.py | MrDelik/core | 30,023 | 12656898 | """Fixtures for Luftdaten tests."""
from __future__ import annotations
from collections.abc import Generator
from unittest.mock import MagicMock, patch
import pytest
from homeassistant.components.luftdaten.const import CONF_SENSOR_ID, DOMAIN
from homeassistant.const import CONF_SHOW_ON_MAP
from homeassistant.core im... |
backend/MaskFormer/mask_former/data/datasets/__init__.py | rune-l/coco-annotator | 143 | 12656902 | <filename>backend/MaskFormer/mask_former/data/datasets/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates.
from . import (
register_ade20k_full,
register_ade20k_panoptic,
register_coco_stuff_10k,
register_mapillary_vistas,
)
|
data_structures/binary_trees/check_full_binary_tree.py | ruler30cm/python-ds | 1,723 | 12656906 | """
A full binary tree is a tree which has either 0 children or 2 children
"""
class Node:
def __init__(self, val):
self.val = val
self.left = None
self.right = None
def check(root):
if not root:
return True
if not root.left and not root.right:
return True
i... |
tests/serializers.py | MojixCoder/django-jalali | 191 | 12656928 | <reponame>MojixCoder/django-jalali<filename>tests/serializers.py
from rest_framework.serializers import ModelSerializer
from django_jalali.serializers.serializerfield import (
JDateField, JDateTimeField,
)
from .models import Bar, BarTime
class JDateFieldSerializer(ModelSerializer):
date = JDateField()
... |
test/conftest.py | oss-transfer/neomodel | 242 | 12656950 | <filename>test/conftest.py
from __future__ import print_function
import warnings
import os
import sys
import pytest
from neomodel import config, db, clear_neo4j_database, change_neo4j_password
from neo4j.exceptions import ClientError as CypherError
from neobolt.exceptions import ClientError
def pytest_addoption(par... |
tools/lock_labs.py | WenzelArifiandi/applied-machine-learning-intensive | 126 | 12656956 | <gh_stars>100-1000
"""lock_labs.py zips and password-protects labs.
$ tools/lock_labs.py
"""
from absl import app
from pathlib import Path
import getpass
import os
import pyminizip
def main(argv):
password = None
home = str(Path.home())
password_file = os.path.join(home, '.amli')
if os.path.exists(passw... |
orator/utils/command_formatter.py | wjzero/orator | 1,484 | 12656978 | <reponame>wjzero/orator
# -*- coding: utf-8 -*-
from pygments.formatter import Formatter
from pygments.token import (
Keyword,
Name,
Comment,
String,
Error,
Number,
Operator,
Generic,
Token,
Whitespace,
)
from pygments.util import get_choice_opt
COMMAND_COLORS = {
Token: (... |
fpn/test.py | chi3x10/RepMet | 103 | 12657010 | # --------------------------------------------------------
# Deformable Convolutional Networks
# Copyright (c) 2016 by Contributors
# Copyright (c) 2017 Microsoft
# Licensed under The Apache-2.0 License [see LICENSE for details]
# Modified by <NAME>
# --------------------------------------------------------
import _... |
examples/tutorials/advanced/configuration.py | jbusecke/pygmt | 326 | 12657044 | <reponame>jbusecke/pygmt
"""
Configuring PyGMT defaults
==========================
Default GMT parameters can be set globally or locally using
:class:`pygmt.config`.
"""
# sphinx_gallery_thumbnail_number = 3
import pygmt
###############################################################################
# Configuring de... |
recipes/Python/425044_Splitting_up_a_sequence/recipe-425044.py | tdiprima/code | 2,023 | 12657081 | <filename>recipes/Python/425044_Splitting_up_a_sequence/recipe-425044.py<gh_stars>1000+
# <NAME>
# http://gumuz.looze.net/
def split_seq(seq,size):
""" Split up seq in pieces of size """
return [seq[i:i+size] for i in range(0, len(seq), size)]
|
reconstruction-scripts/triangulation_pipeline.py | kudo1026/local-feature-refinement | 180 | 12657083 | <filename>reconstruction-scripts/triangulation_pipeline.py
import argparse
import os
import shutil
import types
from colmap_utils import generate_empty_reconstruction, import_features, triangulate
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument(
'--dataset_path', type=str... |
vimfiles/bundle/vim-python/submodules/pylint/tests/functional/i/implicit/implicit_str_concat.py | ciskoinch8/vimrc | 463 | 12657099 | #pylint: disable=invalid-name,missing-docstring
# Basic test with a list
TEST_LIST1 = ['a' 'b'] # [implicit-str-concat]
# Testing with unicode strings in a tuple, with a comma AFTER concatenation
TEST_LIST2 = (u"a" u"b", u"c") # [implicit-str-concat]
# Testing with raw strings in a set, with a comma BEFORE concatena... |
fuxictr/datasets/data_utils.py | xue-pai/FuxiCTR | 144 | 12657102 | <filename>fuxictr/datasets/data_utils.py
# =========================================================================
# Copyright (C) 2021. Huawei Technologies Co., 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... |
tests/test_code_generation_options.py | patrick-gxg/mashumaro | 394 | 12657122 | <reponame>patrick-gxg/mashumaro
from dataclasses import dataclass, field
from typing import Optional
from mashumaro import DataClassDictMixin, field_options
from mashumaro.config import (
TO_DICT_ADD_BY_ALIAS_FLAG,
TO_DICT_ADD_OMIT_NONE_FLAG,
BaseConfig,
)
@dataclass
class A(DataClassDictMixin):
x: O... |
cvnets/models/classification/config/mobilevit.py | apple/ml-cvnets | 209 | 12657139 | <filename>cvnets/models/classification/config/mobilevit.py
#
# For licensing see accompanying LICENSE file.
# Copyright (C) 2022 Apple Inc. All Rights Reserved.
#
from typing import Dict
from utils import logger
def get_configuration(opts) -> Dict:
mode = getattr(opts, "model.classification.mit.mode", "small")
... |
libraries/botbuilder-dialogs/tests/test_prompt_validator_context.py | Fl4v/botbuilder-python | 388 | 12657194 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import aiounittest
from botbuilder.dialogs import DialogSet
from botbuilder.core import MemoryStorage, ConversationState
class PromptValidatorContextTests(aiounittest.AsyncTestCase):
async def test_prompt_validator_cont... |
conftest.py | kratz00/irc | 362 | 12657221 | <filename>conftest.py
import sys
import fnmatch
import os
collect_ignore = ["setup.py"]
if sys.version_info < (3, 5):
for root, dirnames, filenames in os.walk('.'):
for filename in fnmatch.filter(filenames, '*aio.py'):
collect_ignore.append(os.path.join(root, filename))
|
evennia/contrib/menu_login.py | Jaykingamez/evennia | 1,544 | 12657225 | <reponame>Jaykingamez/evennia
"""
A login menu using EvMenu.
Contribution - Vincent-lg 2016, Griatch 2019 (rework for modern EvMenu)
This changes the Evennia login to ask for the account name and password in
sequence instead of requiring you to enter both at once.
To install, add this line to the settings file (`my... |
hummingbot/core/web_assistant/connections/data_types.py | BGTCapital/hummingbot | 3,027 | 12657227 | from abc import abstractmethod, ABC
from dataclasses import dataclass
from enum import Enum
from typing import Any, Mapping, Optional
import aiohttp
import ujson
class RESTMethod(Enum):
GET = "GET"
POST = "POST"
PUT = "PUT"
DELETE = "DELETE"
def __str__(self):
obj_str = repr(self)
... |
OpenCLGA/utils.py | czarnobylu/OpenCLGA | 112 | 12657238 | #!/usr/bin/python3
import random
from math import pi, sqrt, asin, cos, sin, pow
def get_local_IP():
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(('8.8.8.8', 1))
ip = s.getsockname()[0]
s.close()
return ip
def get_testing_params():
return 20, 200, 5000
def i... |
recipes/Python/577882_Convert_nested_Pythdatstructure/recipe-577882.py | tdiprima/code | 2,023 | 12657297 | <reponame>tdiprima/code
import lxml.etree as et
def data2xml(d, name='data'):
r = et.Element(name)
return et.tostring(buildxml(r, d))
def buildxml(r, d):
if isinstance(d, dict):
for k, v in d.iteritems():
s = et.SubElement(r, k)
buildxml(s, v)
elif isinstance(d, tuple) ... |
src/ralph/operations/migrations/0008_auto_20170331_0952.py | DoNnMyTh/ralph | 1,668 | 12657319 | <reponame>DoNnMyTh/ralph
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('operations', '0007_auto_20170328_1728'),
]
... |
lldb/test/API/lang/objc/conflicting-class-list-function-from-user/TestObjCClassListFunctionFromUser.py | mkinsner/llvm | 2,338 | 12657324 | <gh_stars>1000+
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@skipUnlessDarwin
# LLDB ends up calling the user-defined function (but at least doesn't
# c... |
linkedrw/linkedw/__init__.py | CypherAk007/LinkedRW | 114 | 12657380 | <gh_stars>100-1000
from .website import make_website_files
|
tests/test_colors_config.py | rohankumardubey/chartify | 3,111 | 12657388 | <reponame>rohankumardubey/chartify<gh_stars>1000+
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017-2020 Spotify AB
#
# 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/lice... |
reddit2telegram/channels/r_indiaa/app.py | mainyordle/reddit2telegram | 187 | 12657399 | #encoding:utf-8
subreddit = 'india'
t_channel = '@r_indiaa'
def send_post(submission, r2t):
return r2t.send_simple(submission)
|
packages/engine/src/worker/runner/python/fbs/Package.py | mschrader15/hash | 219 | 12657404 | <gh_stars>100-1000
# automatically generated by the FlatBuffers compiler, do not modify
# namespace:
import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()
class Package(object):
__slots__ = ['_tab']
@classmethod
def GetRootAs(cls, buf, offset=0):
n = flatbuffers.enc... |
chapter14/write_mindrecord.py | mindspore-ai/book | 165 | 12657431 | <reponame>mindspore-ai/book<gh_stars>100-1000
# Copyright 2019 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# ... |
examples/05_utc_and_timezone.py | Saketh-Chandra/blynk-library-python | 219 | 12657446 | <reponame>Saketh-Chandra/blynk-library-python<filename>examples/05_utc_and_timezone.py
"""
Blynk is a platform with iOS and Android apps to control
Arduino, Raspberry Pi and the likes over the Internet.
You can easily build graphic interfaces for all your
projects by simply dragging and dropping widgets.
Downloads, ... |
Python/Tests/fullanalysistest.py | techkey/PTVS | 404 | 12657449 | <filename>Python/Tests/fullanalysistest.py
from __future__ import print_function
import os
import re
import subprocess
import sys
SCRIPT_NAME = 'script{sys.version_info[0]}{sys.version_info[1]}.rsp'
TEMPLATE = r'''python {sys.version_info[0]}.{sys.version_info[1]} {sys.executable}
logs logs
module * {sys.prefix}\Lib... |
xfel/merging/application/statistics/experiment_resolution_statistics.py | dperl-sol/cctbx_project | 155 | 12657467 | <gh_stars>100-1000
from __future__ import absolute_import, division, print_function
from six.moves import range
from dials.array_family import flex
from libtbx import table_utils
from xfel.merging.application.worker import worker
from xfel.merging.application.reflection_table_utils import reflection_table_utils
class ... |
venv/Lib/site-packages/IPython/lib/__init__.py | ajayiagbebaku/NFL-Model | 6,989 | 12657486 | <filename>venv/Lib/site-packages/IPython/lib/__init__.py
# encoding: utf-8
"""
Extra capabilities for IPython
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2008-2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full licens... |
webui/main.py | hydgladiator/Themis | 356 | 12657503 | <gh_stars>100-1000
# -*-coding:utf-8-*-
import os
import tornado.ioloop
import tornado.autoreload
from webui import view
def run_server(config, host=None, port=7000):
handlers = [
(r"/", view.SqlReRuleSetIndex),
(r"/sqlreview/rule/simple/addition", view.RuleSimpleAdditoin),
(r"/sqlreview... |
packages/syft/tests/syft/core/common/serde/deserialize_test.py | vishalbelsare/PySyft | 8,428 | 12657530 | <gh_stars>1000+
# third party
from pytest import raises
# syft absolute
from syft.core.common.serde.deserialize import _deserialize
def test_fail_deserialize_no_format() -> None:
with raises(TypeError):
_deserialize(blob="to deserialize", from_proto=False)
def test_fail_deserialize_wrong_format() -> No... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.