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 |
|---|---|---|---|---|
Katna/config.py | viddik13/katna | 125 | 36466 | <gh_stars>100-1000
"""
.. module:: Katna.config
:platform: Platfrom Independent
:synopsis: This module defines some helpful configuration variables
"""
import os
# # Configuration parameters for Image class
class Image:
# default value by which image size to be reduces for processing
down_sample_factor... |
plaso/formatters/manager.py | pyllyukko/plaso | 1,253 | 36474 | # -*- coding: utf-8 -*-
"""Manages custom event formatter helpers."""
class FormattersManager(object):
"""Custom event formatter helpers manager."""
_custom_formatter_helpers = {}
@classmethod
def GetEventFormatterHelper(cls, identifier):
"""Retrieves a custom event formatter helper.
Args:
id... |
custom_latex_cell_style/scenario2/ipython_nbconvert_config.py | isabella232/nbconvert-examples | 120 | 36492 | c = get_config()
#Export all the notebooks in the current directory to the sphinx_howto format.
c.NbConvertApp.notebooks = ['*.ipynb']
c.NbConvertApp.export_format = 'latex'
c.NbConvertApp.postprocessor_class = 'PDF'
c.Exporter.template_file = 'custom_article.tplx'
|
bin/terminology.py | cedzz/python-patterns | 631 | 36513 | #!/usr/bin/env python3
"""Count the frequency of various phrases, given the path to the Python PEPs.
In Python PEPs, the opposite of “subclass” is almost always “base class” — just remember that the builtin is named super(), not base()! Stats:
216 base class
0 child class
10 derived class
12 parent class
372 ... |
rotkehlchen/externalapis/bisq_market.py | rotkehlchenio/rotkehlchen | 137 | 36515 | import json
import requests
from rotkehlchen.assets.asset import Asset
from rotkehlchen.constants.timing import DEFAULT_TIMEOUT_TUPLE
from rotkehlchen.errors.misc import RemoteError
from rotkehlchen.errors.serialization import DeserializationError
from rotkehlchen.history.deserialization import deserialize_price
from... |
chapter4/chapter4_pydantic_types_01.py | GoodMonsters/Building-Data-Science-Applications-with-FastAPI | 107 | 36520 | <reponame>GoodMonsters/Building-Data-Science-Applications-with-FastAPI
from pydantic import BaseModel, EmailStr, HttpUrl, ValidationError
class User(BaseModel):
email: EmailStr
website: HttpUrl
# Invalid email
try:
User(email="jdoe", website="https://www.example.com")
except ValidationError as e:
pr... |
examples/shapes_from_glsl/cylinder_shape.py | szabolcsdombi/zengl | 116 | 36549 | import zengl
from defaults import defaults
from grid import grid_pipeline
from window import Window
window = Window(1280, 720)
ctx = zengl.context()
image = ctx.image(window.size, 'rgba8unorm', samples=4)
depth = ctx.image(window.size, 'depth24plus', samples=4)
image.clear_value = (0.2, 0.2, 0.2, 1.0)
ctx.includes[... |
prohmr/models/heads/__init__.py | akashsengupta1997/ProHMR | 120 | 36556 | <filename>prohmr/models/heads/__init__.py<gh_stars>100-1000
from .smpl_flow import SMPLFlow
from .skeleton_flow import SkeletonFlow
from .fc_head import FCHead |
examples/issues/issue345_docs2.py | tgolsson/appJar | 666 | 36566 | <reponame>tgolsson/appJar
import sys
sys.path.append("../../")
from appJar import gui
def press(btn):
if btn == "FIRST": app.firstFrame("Pages")
elif btn == "NEXT": app.nextFrame("Pages")
elif btn == "PREV": app.prevFrame("Pages")
elif btn == "LAST": app.lastFrame("Pages")
def changed():
msg = "... |
binary_tree_postorder_traversal/solution.py | mahimadubey/leetcode-python | 528 | 36582 | <filename>binary_tree_postorder_traversal/solution.py
"""
Given a binary tree, return the postorder traversal of its nodes' values.
For example:
Given binary tree {1,#,2,3},
1
\
2
/
3
return [3,2,1].
"""
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# ... |
figures/perception/randomwalk.py | patricknaughton01/RoboticSystemsBook | 116 | 36600 | <reponame>patricknaughton01/RoboticSystemsBook<filename>figures/perception/randomwalk.py<gh_stars>100-1000
import matplotlib.pyplot as plt
import numpy as np
from kalman import *
def kf_trace(F,g,P,H,j,Q,Xmean,Xvar,Z):
if not isinstance(F,np.ndarray): F = np.array([[F]])
if not isinstance(g,np.ndarray): g = np... |
CTFd/constants/themes.py | nox237/CTFd | 3,592 | 36609 | <filename>CTFd/constants/themes.py
ADMIN_THEME = "admin"
DEFAULT_THEME = "core"
|
tests/unit/model_selection/test_model_selection.py | ambader/hcrystalball | 139 | 36652 | import numpy as np
import pytest
from sklearn.dummy import DummyRegressor
from sklearn.model_selection import GridSearchCV
from sklearn.pipeline import Pipeline
from hcrystalball.metrics import get_scorer
from hcrystalball.model_selection import FinerTimeSplit
from hcrystalball.model_selection import get_best_not_fail... |
src/rust/iced-x86-py/src/iced_x86/CC_g.py | clayne/iced | 1,018 | 36668 | # SPDX-License-Identifier: MIT
# Copyright (C) 2018-present iced project and contributors
# ⚠️This file was generated by GENERATOR!🦹♂️
# pylint: disable=invalid-name
# pylint: disable=line-too-long
# pylint: disable=too-many-lines
"""
Mnemonic condition code selector (eg. ``JG`` / ``JNLE``)
"""
import typing
if t... |
LeetCode/python3/1025.py | ZintrulCre/LeetCode_Archiver | 279 | 36682 | class Solution:
def divisorGame(self, N: int) -> bool:
return True if N % 2 == 0 else False |
gabbi/exception.py | scottwallacesh/gabbi | 145 | 36683 | #
# 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, software
# distributed under... |
availability/__init__.py | Leader0721/ManyIP | 629 | 36694 | <gh_stars>100-1000
# -*- coding: UTF-8 -*-
import config
import gevent
import availability.check
from persistence import persister
import time
def crawl_worker(queue_verification, queue_persistence):
"""
爬取下来的代理检测可用性的进程
:param queue_verification: 待验证代理队列
:param queue_persistence: 已验证待保存代理队列
:retur... |
slack_sdk/scim/v1/user.py | priya1puresoftware/python-slack-sdk | 2,486 | 36700 | <filename>slack_sdk/scim/v1/user.py
from typing import Optional, Any, List, Dict, Union
from .default_arg import DefaultArg, NotGiven
from .internal_utils import _to_dict_without_not_given, _is_iterable
from .types import TypeAndValue
class UserAddress:
country: Union[Optional[str], DefaultArg]
locality: Uni... |
crowdsourcing/permissions/user.py | Kyeongan/crowdsource-platform | 138 | 36743 | <reponame>Kyeongan/crowdsource-platform
from rest_framework import permissions
from csp import settings
from rest_framework.exceptions import PermissionDenied
class IsWorker(permissions.BasePermission):
def has_permission(self, request, view):
return request.user.profile.is_worker
class IsRequester(perm... |
run_w2v.py | hugochan/K-Competitive-Autoencoder-for-Text-Analytics | 133 | 36768 | <reponame>hugochan/K-Competitive-Autoencoder-for-Text-Analytics<gh_stars>100-1000
'''
Created on Jan, 2017
@author: hugo
'''
from __future__ import absolute_import
import argparse
from os import path
import timeit
import numpy as np
from autoencoder.baseline.word2vec import Word2Vec, save_w2v, load_w2v
from autoenco... |
loaner/deployments/lib/password.py | gng-demo/travisfix | 175 | 36775 | # Copyright 2018 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
#
# Unless required by applicable law or a... |
openmdao/utils/tests/test_cs_safe.py | friedenhe/OpenMDAO | 451 | 36793 | <gh_stars>100-1000
import numpy as np
import unittest
from openmdao.utils import cs_safe
from openmdao.utils.assert_utils import assert_near_equal
class TestCSSafeFuctions(unittest.TestCase):
def test_abs(self):
test_data = np.array([1, -1, -2, 2, 5.675, -5.676], dtype='complex')
assert_near... |
main.py | tuzhucheng/sent-sim | 109 | 36797 | """
Driver program for training and evaluation.
"""
import argparse
import logging
import numpy as np
import random
import torch
import torch.optim as O
from datasets import get_dataset, get_dataset_configurations
from models import get_model
from runners import Runner
if __name__ == '__main__':
parser = argpar... |
amazon_main_xgboost.py | twankim/ensemble_amazon | 236 | 36814 | """ Amazon Access Challenge Code for ensemble
<NAME> script for Amazon .
xgboost on input data
based on <NAME>'s Script.
"""
from __future_
_ import division
import numpy as np
from sklearn import preprocessing
from sklearn.metrics import roc_auc_score
import XGBoostClassifier as xg
from sklearn.cross_validation i... |
notebooks/data_cleaning/track_meta.py | roannav/learntools | 359 | 36845 | track = dict(
author_username='alexisbcook',
course_name='Data Cleaning',
course_url='https://www.kaggle.com/learn/data-cleaning',
course_forum_url='https://www.kaggle.com/learn-forum/172650'
)
lessons = [ {'topic': topic_name} for topic_name in
['Handling missing values', #1
... |
bookwyrm/migrations/0145_sitesettings_version.py | mouse-reeve/fedireads | 270 | 36847 | <reponame>mouse-reeve/fedireads
# Generated by Django 3.2.12 on 2022-03-16 18:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("bookwyrm", "0144_alter_announcement_display_type"),
]
operations = [
migrations.AddField(
model... |
installation/templates/configuration/auth.py | piwaniuk/critic | 216 | 36927 | <gh_stars>100-1000
# -*- mode: python; encoding: utf-8 -*-
#
# Copyright 2013 <NAME>, 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.apache.org/licenses/... |
elliot/utils/read.py | gategill/elliot | 175 | 36960 | <reponame>gategill/elliot<filename>elliot/utils/read.py
"""
Module description:
"""
__version__ = '0.3.1'
__author__ = '<NAME>, <NAME>'
__email__ = '<EMAIL>, <EMAIL>'
import pandas as pd
import configparser
import pickle
import numpy as np
import os
from types import SimpleNamespace
def read_csv(filename):
"""... |
lib/python/batch_sim/gcloud_fakes.py | leozz37/makani | 1,178 | 36976 | # Copyright 2020 Makani Technologies LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
LeetCode/python3/136.py | ZintrulCre/LeetCode_Archiver | 279 | 36982 | class Solution:
def singleNumber(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
k = 0
for n in nums:
k ^= n
return k |
deps/libffi/generate-osx-source-and-headers.py | liuqsqq/node-ffi | 3,373 | 36995 | #!/usr/bin/env python
import subprocess
import re
import os
import errno
import collections
import sys
class Platform(object):
pass
sdk_re = re.compile(r'.*-sdk ([a-zA-Z0-9.]*)')
def sdkinfo(sdkname):
ret = {}
for line in subprocess.Popen(['xcodebuild', '-sdk', sdkname, '-version'], stdout=subprocess.PIP... |
src/pretix/base/templatetags/cache_large.py | Janfred/pretix | 1,248 | 36999 | <filename>src/pretix/base/templatetags/cache_large.py
#
# This file is part of pretix (Community Edition).
#
# Copyright (C) 2014-2020 <NAME> and contributors
# Copyright (C) 2020-2021 rami.io GmbH and contributors
#
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU Af... |
openbook_posts/migrations/0022_auto_20190311_1432.py | TamaraAbells/okuna-api | 164 | 37003 | <gh_stars>100-1000
# Generated by Django 2.2b1 on 2019-03-11 13:32
from django.db import migrations
import imagekit.models.fields
import openbook_posts.helpers
class Migration(migrations.Migration):
dependencies = [
('openbook_posts', '0021_auto_20190309_1532'),
]
operations = [
migrati... |
functions/include/serializer.py | xyclin/fluent | 1,164 | 37005 | # Copyright 2018 U.C. Berkeley RISE Lab
#
# 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 agree... |
tests/integration/test_breakpoint_step.py | benjamintemitope/SublimeTextXdebug | 344 | 37009 | import os
try:
from xdebug.unittesting import XdebugDeferrableTestCase
except:
from SublimeTextXdebug.xdebug.unittesting import XdebugDeferrableTestCase
class TestBreakpointStep(XdebugDeferrableTestCase):
breakpoint_step_file = 'breakpoint_step.php'
breakpoint_step_file_local_path = os.path.join(Xdebu... |
icevision/models/ultralytics/yolov5/fastai/learner.py | ai-fast-track/mantisshrimp | 580 | 37011 | <filename>icevision/models/ultralytics/yolov5/fastai/learner.py
__all__ = ["learner"]
from icevision.imports import *
from icevision.engines.fastai import *
from icevision.models.ultralytics.yolov5.fastai.callbacks import Yolov5Callback
from yolov5.utils.loss import ComputeLoss
def learner(
dls: List[Union[DataL... |
v0.5/training/image_classification/train.py | PhilippvK/tiny | 148 | 37012 | <gh_stars>100-1000
'''
MLCommons
group: TinyMLPerf (https://github.com/mlcommons/tiny)
image classification on cifar10
train.py desc: loads data, trains and saves model, plots training metrics
'''
import numpy as np
import matplotlib.pyplot as plt
import pickle
import tensorflow as tf
from keras.callbacks import Lea... |
src/tests/web/web_auth_utils_test.py | tomgilbertson/script-server-v1 | 833 | 37014 | from unittest import TestCase
from parameterized import parameterized
from tests.test_utils import mock_request_handler
from web.web_auth_utils import remove_webpack_suffixes, is_allowed_during_login
class WebpackSuffixesTest(TestCase):
def test_remove_webpack_suffixes_when_css(self):
normalized = remov... |
src/adafruit_blinka/microcontroller/amlogic/s905x3/pin.py | Jcc99/Adafruit_Blinka | 294 | 37117 | """AmLogic s905x3 pin names"""
# pylint: disable=wildcard-import,unused-wildcard-import
from adafruit_blinka.microcontroller.amlogic.meson_g12_common.pin import *
|
system-test/testnet-automation-json-parser.py | Flawm/solana | 7,843 | 37125 | #!/usr/bin/env python3
import sys, json, argparse
parser = argparse.ArgumentParser()
parser.add_argument("--empty_error", action="store_true", help="If present, do not print error message")
args = parser.parse_args()
data=json.load(sys.stdin)
if 'results' in data:
for result in data['results']:
if 'series' ... |
Hackerrank/sherlockAndCost.py | nandani99/Hacktoberfest-1 | 255 | 37166 | #!/bin/python3
import math
import os
import random
import re
import sys
# Complete the cost function below.
def cost(b):
n=len(b)
l, h = 0, 0
for i in range(1, n):
l, h = (max(l, h + b[i - 1] - 1),
max(l + b[i] - 1, h + abs(b[i] - b[i - 1])))
return max(l, h)
if __name__ == '_... |
test_python_toolbox/test_cheat_hashing.py | hboshnak/python_toolbox | 119 | 37187 | <reponame>hboshnak/python_toolbox
# Copyright 2009-2017 <NAME>.
# This program is distributed under the MIT license.
'''Testing module for `python_toolbox.abc_tools.AbstractStaticMethod`.'''
import copy
from python_toolbox.cheat_hashing import cheat_hash
def test_cheat_hash():
'''Test `cheat_hash` on various o... |
pysnmp/hlapi/v1arch/asyncore/ntforg.py | RKinsey/pysnmp | 492 | 37204 | <reponame>RKinsey/pysnmp
#
# This file is part of pysnmp software.
#
# Copyright (c) 2005-2019, <NAME> <<EMAIL>>
# License: http://snmplabs.com/pysnmp/license.html
#
from pysnmp.hlapi.v1arch.auth import *
from pysnmp.hlapi.v1arch.asyncore import *
from pysnmp.hlapi.varbinds import *
from pysnmp.smi.rfc1902 import *
fro... |
src/embedding/utilslib/baidu_spider_threads.py | mykiscool/DeepCamera | 914 | 37246 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
import os
import sys
import re
import urllib
import json
import socket
import time
import multiprocessing
from multiprocessing.dummy import Pool
from multiprocessing import Queue
import requests
timeout = 5
socket.setdefaulttimeout(timeout)
class Image(object):
"""图... |
libvis/scripts/LMOptimizer SE3Optimization Test Jacobian derivation.py | zimengjiang/badslam | 541 | 37266 | from sympy import *
# Implementation of QuaternionBase<Derived>::toRotationMatrix(void).
# The quaternion q is given as a list [qw, qx, qy, qz].
def QuaternionToRotationMatrix(q):
tx = 2 * q[1]
ty = 2 * q[2]
tz = 2 * q[3]
twx = tx * q[0]
twy = ty * q[0]
twz = tz * q[0]
txx = tx * q[1]
txy = ty * q[... |
tests/tests_basic.py | mehrdad-shokri/fluxcapacitor | 648 | 37323 | import os
import tests
from tests import at_most, compile, savefile
import subprocess
node_present = True
erlang_present = True
if os.system("node -v >/dev/null 2>/dev/null") != 0:
print " [!] ignoring nodejs tests"
node_present = False
if (os.system("erl -version >/dev/null 2>/dev/null") != 0 or
os.sys... |
examples/perf/rnn/simple_rnn.py | yuhonghong66/minpy | 1,271 | 37347 | <filename>examples/perf/rnn/simple_rnn.py
import sys
sys.path.insert(0, "../../python/")
import mxnet as mx
import numpy as np
from collections import namedtuple
import time
import math
RNNState = namedtuple("RNNState", ["h"])
RNNParam = namedtuple("RNNParam", ["i2h_weight", "i2h_bias",
... |
openfda/nsde/pipeline.py | FDA/openfda | 388 | 37368 | #!/usr/local/bin/python
'''
Pipeline for converting CSV nsde data to JSON and importing into Elasticsearch.
'''
import glob
import os
from os.path import join, dirname
import luigi
from openfda import common, config, parallel, index_util
from openfda.common import newest_file_timestamp
NSDE_DOWNLOAD = \
'https:/... |
examples/c/cdecl.py | rakati/ppci-mirror | 161 | 37406 | """ Implement alike logic as is done on www.cdecl.org
Try for example:
$ cdelc.py 'char **a;'
"""
import argparse
import io
from ppci.api import get_current_arch
from ppci.lang.c import CLexer, CParser, COptions, CContext, CSemantics
from ppci.lang.c.nodes import types, declarations
from ppci.lang.c.preprocessor im... |
src/curt/curt/modules/vision/vision_processor_service.py | sanyaade-teachings/cep | 108 | 37418 | """
Copyright (C) Cortic Technology Corp. - All Rights Reserved
Written by <NAME> <<EMAIL>>, 2021
"""
# need to advertise different processor type, eg CPU, GPU, TPU
import traceback
import logging
from curt.base_service import BaseService
class VisionProcessorService(BaseService):
def __init__(self):
... |
training/train_nav.py | catalina17/EmbodiedQA | 289 | 37429 | import time
import argparse
from datetime import datetime
import logging
import numpy as np
import os
import torch
import torch.nn.functional as F
import torch.multiprocessing as mp
from models import NavCnnModel, NavCnnRnnModel, NavCnnRnnMultModel, NavPlannerControllerModel
from data import EqaDataLoader
from metrics ... |
Chapter05/examine_tar_file_content.py | add54/ADMIN_SYS_PYTHON | 116 | 37442 | <filename>Chapter05/examine_tar_file_content.py
import tarfile
tar_file = tarfile.open("work.tar.gz", "r:gz")
print(tar_file.getnames())
|
src/hg/makeDb/scripts/cd8Escape/process_epitopes.py | andypohl/kent | 171 | 37447 | import os
import re
import gzip
import argparse
import pandas as pd
import numpy as np
from collections import defaultdict
def get_args():
"""
Parse command line arguments
"""
parser = argparse.ArgumentParser(description="Method to create track for escape mutations")
parser.add_argument("-xlsx",... |
rest_framework_social_oauth2/settings.py | hrahmadi71/django-rest-framework-social-oauth2 | 613 | 37452 | from django.conf import settings
DRFSO2_PROPRIETARY_BACKEND_NAME = getattr(settings, 'DRFSO2_PROPRIETARY_BACKEND_NAME', "Django")
DRFSO2_URL_NAMESPACE = getattr(settings, 'DRFSO2_URL_NAMESPACE', "")
|
src/mcedit2/widgets/propertylist.py | elcarrion06/mcedit2 | 673 | 37509 | """
propertylist
"""
from __future__ import absolute_import, division, print_function
from collections import namedtuple
import logging
from PySide.QtCore import Qt
from mceditlib import nbt
from PySide import QtGui, QtCore
from mcedit2.util.load_ui import registerCustomWidget
log = logging.getLogger(__name__)
cl... |
tests/torch_api/test_multi_models.py | mmathys/bagua | 635 | 37522 | <reponame>mmathys/bagua<gh_stars>100-1000
import torch
import torch.nn as nn
import torch.nn.functional as F
from tests.internal.common_utils import find_free_port
import unittest
import multiprocessing
import os
from bagua.torch_api.utils import flatten
import bagua.torch_api as bagua
from tests import skip_if_cuda_no... |
peregrinearb/utils/single_exchange.py | kecheon/peregrine | 954 | 37526 | import asyncio
import math
import networkx as nx
import ccxt.async_support as ccxt
import datetime
import logging
from .logging_utils import FormatForLogAdapter
__all__ = [
'FeesNotAvailable',
'create_exchange_graph',
'load_exchange_graph',
]
adapter = FormatForLogAdapter(logging.getLogger('peregrinearb.u... |
src/python/web/handler/status.py | AlekLT/seedsync | 255 | 37537 | # Copyright 2017, <NAME>, All rights reserved.
from bottle import HTTPResponse
from common import Status, overrides
from ..web_app import IHandler, WebApp
from ..serialize import SerializeStatusJson
class StatusHandler(IHandler):
def __init__(self, status: Status):
self.__status = status
@overrides... |
datasets/ett/ett.py | leondz/datasets | 3,395 | 37539 | # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# 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.... |
code/vendor/node_js2c.py | thorium-cfx/fivem | 5,411 | 37562 | <filename>code/vendor/node_js2c.py
import os
import subprocess
import sys
inputs = [
'lib/assert/strict.js',
'lib/assert.js',
'lib/async_hooks.js',
'lib/buffer.js',
'lib/child_process.js',
'lib/cluster.js',
'lib/console.js',
'lib/constants.js',
'lib/crypto.js',
'lib/dgram.js',
'lib/diagnostics_cha... |
ipython/attachments/Weave/iterators_example.py | cassiasamp/scipy-cookbook | 408 | 37569 | #!/usr/bin/env python
import sys
import numpy as npy
import pylab as P
from scipy.weave import inline, converters, blitz
from scipy.testing import measure
# Blitz conversion is terrific, but sometimes you don't have fixed array sizes
# in your problem. Fortunately numpy iterators still make writing inline
# weave code ... |
src/scenic/simulators/gta/img_modf.py | cahartsell/Scenic | 141 | 37596 | <gh_stars>100-1000
'''
This file has basic image modification functions
'''
from PIL import Image
import cv2
from scipy.spatial import Voronoi
from itertools import product
import numpy as np
def convert_black_white(img_data=None, img_file=None, threshold=100):
assert img_data is not None or img_file is not None... |
distributed.py | SagaFav/etlpy | 448 | 37607 | import sys;
from queue import Queue
from multiprocessing.managers import BaseManager
import etl;
import json
import extends;
import time;
authkey= "etlpy".encode('utf-8')
timeout=1;
rpc_port=8888
class ETLJob:
def __init__(self,project,jobname,config,id):
self.project= project;
self.jobname=jobnam... |
tests/r/test_labour.py | hajime9652/observations | 199 | 37675 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.labour import labour
def test_labour():
"""Test module labour.py by downloading
labour.csv and testing shape of
extracted data has 569 row... |
tests/test_layers/test_2p5d/checks_2p5d/common.py | RichardoLuo/ColossalAI | 1,630 | 37745 | <gh_stars>1000+
import torch
TESSERACT_DIM = 2
TESSERACT_DEP = 2
BATCH_SIZE = 8
SEQ_LENGTH = 8
HIDDEN_SIZE = 8
NUM_CLASSES = 8
VOCAB_SIZE = 16
IMG_SIZE = 16
def check_equal(A, B):
assert torch.allclose(A, B, rtol=1e-5, atol=1e-2) |
graphgallery/gallery/linkpred/pyg/__init__.py | EdisonLeeeee/GraphGallery | 300 | 37761 | <gh_stars>100-1000
from .gae import GAE
from .vgae import VGAE
|
self_paced_ensemble/canonical_resampling/__init__.py | thulio/self-paced-ensemble | 203 | 37766 | """
--------------------------------------------------------------------------
The `self_paced_ensemble.canonical_resampling` module implement a
resampling-based classifier for imbalanced classification.
15 resampling algorithms are included:
'RUS', 'CNN', 'ENN', 'NCR', 'Tomek', 'ALLKNN', 'OSS',
'NM', 'CC', 'SMOTE', ... |
emlearn/distance.py | Brax94/emlearn | 161 | 37772 |
import os.path
import os
import numpy
from . import common, cgen
"""
References
https://github.com/scikit-learn/scikit-learn/blob/15a949460dbf19e5e196b8ef48f9712b72a3b3c3/sklearn/covariance/_empirical_covariance.py#L297
https://github.com/scikit-learn/scikit-learn/blob/15a949460dbf19e5e196b8ef48f9712b72a3b3c3/skl... |
Packs/ShiftLeft/Integrations/shiftleft/shiftleft_test.py | diCagri/content | 799 | 37775 | <filename>Packs/ShiftLeft/Integrations/shiftleft/shiftleft_test.py
"""Base Integration for ShiftLeft CORE - Cortex XSOAR Extension
"""
import json
import io
from shiftleft import list_app_findings_command, ShiftLeftClient
def util_load_json(path):
with io.open(path, mode="r", encoding="utf-8") as f:
retu... |
src/richie/apps/courses/migrations/0017_auto_20200827_1011.py | leduong/richie | 174 | 37807 | <reponame>leduong/richie
# Generated by Django 2.2.15 on 2020-08-27 08:11
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("courses", "0016_auto_20200417_1237"),
]
operations = [
migrations.AlterField(
model_name="courserun",
... |
proxyclient/experiments/timer_test.py | EricRabil/m1n1 | 1,604 | 37808 | <filename>proxyclient/experiments/timer_test.py
#!/usr/bin/env python3
# SPDX-License-Identifier: MIT
import sys, pathlib
sys.path.append(str(pathlib.Path(__file__).resolve().parents[1]))
from m1n1.setup import *
HV_VTMR_CTL = (3, 5, 15, 1, 3)
HV_VTMR_CTL_VMASK = (1 << 0)
HV_VTMR_CTL_PMASK = (1 << 1)
HV_VTMR_LIST = ... |
tf_coder/value_search/search_space_from_weight.py | hstrohm/PyTorch-Coder-cheat | 245 | 37883 | <reponame>hstrohm/PyTorch-Coder-cheat<gh_stars>100-1000
# Copyright 2021 The TF-Coder Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2... |
tests.py | mkolar/maya-capture | 118 | 37930 | <filename>tests.py
"""Tests for capture.
Within Maya, setup a scene of moderate range (e.g. 10 frames)
and run the following.
Example:
>>> nose.run(argv=[sys.argv[0], "tests", "-v"])
"""
import capture
from maya import cmds
def test_capture():
"""Plain capture works"""
capture.capture()
def test_cam... |
pluribus/poker/evaluation/__init__.py | keithlee96/pluribus-poker-AI | 113 | 37983 | from .eval_card import EvaluationCard
from .evaluator import Evaluator
from .lookup import LookupTable
|
vnpy/gateway/sec/__init__.py | funrunskypalace/vnpy | 19,529 | 38018 | <filename>vnpy/gateway/sec/__init__.py
from .sec_gateway import SecGateway
|
test/unit/metrics/utils.py | alliesaizan/fairlearn | 1,142 | 38023 | <filename>test/unit/metrics/utils.py
# Copyright (c) Microsoft Corporation and Fairlearn contributors.
# Licensed under the MIT License.
import fairlearn.metrics as metrics
def _get_raw_MetricFrame():
# Gets an uninitialised MetricFrame for testing purposes
return metrics.MetricFrame.__new__(metrics.MetricFr... |
tests/client/test_get_balance.py | kanzure/eth-testrpc | 164 | 38027 | def test_deploying_contract(client, hex_accounts):
pre_balance = client.get_balance(hex_accounts[1])
client.send_transaction(
_from=hex_accounts[0],
to=hex_accounts[1],
value=1234,
)
post_balance = client.get_balance(hex_accounts[1])
assert post_balance - pre_balance == 12... |
math/tests/testcases.py | fuz-woo/gpython | 520 | 38067 | # Copyright 2018 The go-python Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
# Testcases for functions in math.
#
# Each line takes the form:
#
# <testid> <function> <input_value> -> <output_value> <flags>
#
# where:
#
# <testid> ... |
dlib/tools/python/test/test_vector.py | asm-jaime/facerec | 11,719 | 38077 | <reponame>asm-jaime/facerec
from dlib import vector, vectors, vectorss, dot
try:
import cPickle as pickle # Use cPickle on Python 2.7
except ImportError:
import pickle
from pytest import raises
def test_vector_empty_init():
v = vector()
assert len(v) == 0
assert v.shape == (0, 1)
assert str(v... |
DPGAnalysis/SiStripTools/python/poolSource_cff.py | ckamtsikis/cmssw | 852 | 38086 | <reponame>ckamtsikis/cmssw
import FWCore.ParameterSet.Config as cms
source = cms.Source("PoolSource",
fileNames = cms.untracked.vstring(),
# skipBadFiles = cms.untracked.bool(True),
inputCommands = cms.untracked.vstring("keep *", "drop *_MEtoEDMConverter_*_*")... |
server02.py | timgates42/csdesign | 116 | 38091 | <gh_stars>100-1000
###############################################################################
#
# Copyright (c) 2012 <NAME>
#
# 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 rest... |
run/gen-explicit-fee-schedules.py | three-Vs/hedera-services | 164 | 38098 | ###
# A script to convert the Services-consumable feeSchedules.json
# into the "typed" format used by the public pricing calculator.
###
import json
providers = ['nodedata', 'networkdata', 'servicedata']
typed_schedules = {}
with open('hedera-node/src/main/resources/feeSchedules.json', 'r') as fin:
cur_and_nex... |
cblue/data/__init__.py | dfhby0/CBLUE | 293 | 38102 | <gh_stars>100-1000
from .data_process import EEDataProcessor, REDataProcessor, ERDataProcessor, CTCDataProcessor, \
CDNDataProcessor, STSDataProcessor, QQRDataProcessor, QICDataProcessor, QTRDataProcessor
from .dataset import EEDataset, REDataset, ERDataset, CTCDataset, CDNDataset, STSDataset, \
QQRDataset, QIC... |
io_scene_vrm/editor/extension.py | 989onan/VRM_Addon_for_Blender | 344 | 38132 | <reponame>989onan/VRM_Addon_for_Blender
import bpy
from .vrm0.property_group import Vrm0PropertyGroup
class VrmAddonArmatureExtensionPropertyGroup(bpy.types.PropertyGroup): # type: ignore[misc]
addon_version: bpy.props.IntVectorProperty( # type: ignore[valid-type]
size=3 # noqa: F722
)
vrm0: ... |
tests/test_service_catalog/test_views/test_admin/test_settings/test_catalog/test_services/test_create.py | LaudateCorpus1/squest | 112 | 38149 | <gh_stars>100-1000
from copy import copy
from io import BytesIO
from PIL import Image
from django.core.files.uploadedfile import InMemoryUploadedFile
from django.urls import reverse
from service_catalog.models import Service
from tests.test_service_catalog.base import BaseTest
class ServiceCreateTestCase(BaseTest):... |
tests/test_spiral_spanning_tree_coverage_path_planner.py | duken72/PythonRobotics | 15,431 | 38157 | import conftest # Add root path to sys.path
import os
import matplotlib.pyplot as plt
from PathPlanning.SpiralSpanningTreeCPP \
import spiral_spanning_tree_coverage_path_planner
spiral_spanning_tree_coverage_path_planner.do_animation = True
def spiral_stc_cpp(img, start):
num_free = 0
for i in range(img... |
consumerui/grapher.py | AlexRogalskiy/kubeplus | 396 | 38186 | <filename>consumerui/grapher.py
import sys
import json
import subprocess
import sys
import os
from graphviz import Digraph
from graphviz import Graph
class ConnectionsGraph(object):
def draw(self, connections_json, output_folder, relsToHide):
#print(connections_json)
cmd = "ls -ltr /root/"
out = subprocess.Pop... |
kik_unofficial/datatypes/xmpp/history.py | TriSerpent/kik-bot-api-unofficial | 120 | 38213 | from bs4 import BeautifulSoup
import time
from kik_unofficial.datatypes.xmpp.base_elements import XMPPElement, XMPPResponse
class Struct:
def __init__(self, **entries):
self.__dict__.update(entries)
class OutgoingAcknowledgement(XMPPElement):
"""
Represents an outgoing acknowledgement ... |
mmrotate/models/detectors/oriented_rcnn.py | liuyanyi/mmrotate | 449 | 38227 | <gh_stars>100-1000
# Copyright (c) OpenMMLab. All rights reserved.
import torch
from ..builder import ROTATED_DETECTORS
from .two_stage import RotatedTwoStageDetector
@ROTATED_DETECTORS.register_module()
class OrientedRCNN(RotatedTwoStageDetector):
"""Implementation of `Oriented R-CNN for Object Detection.`__
... |
e2e_tests/tests/fixtures/pytorch_lightning_amp/model_def.py | gh-determined-ai/determined | 1,729 | 38312 | """
This example shows how to interact with the Determined PyTorch Lightning Adapter
interface to build a basic MNIST network. LightningAdapter utilizes the provided
LightningModule with Determined's PyTorch control loop.
"""
from determined.pytorch import PyTorchTrialContext, DataLoader
from determined.pytorch.lightn... |
AFLW/fddb_symbol_gen.py | kli-nlpr/FaceDetection-ConvNet-3D | 159 | 38329 | <filename>AFLW/fddb_symbol_gen.py
import mxnet as mx
def get_vgg16_gen():
relu_feature = mx.symbol.Variable(name="relu_feature")
box_predict = mx.symbol.Variable(name="box_predict")
ground_truth = mx.symbol.Variable(name="ground_truth")
bbox_label = mx.symbol.Variable(name="bbox_label")
ell_labe... |
runtime/module_resolution.py | cheery/lever | 136 | 38332 | <reponame>cheery/lever<filename>runtime/module_resolution.py
from space import *
import base
import bon
import evaluator
import core
import os
import pathobj
import stdlib
import sys
class ModuleScope(Object):
def __init__(self, local, parent=None, frozen=False):
self.cache = {} # maps absolute path -> mod... |
up/utils/model/optim/__init__.py | ModelTC/EOD | 196 | 38350 | <filename>up/utils/model/optim/__init__.py
from .lars import LARS # noqa
from .lamb import LAMB # noqa |
anchore_manager/version.py | Nordix/anchore-engine | 110 | 38392 | <filename>anchore_manager/version.py
version = "0.9.4"
|
faced/const.py | hseguro/faced | 575 | 38440 | <filename>faced/const.py
import os
MODELS_PATH = os.path.join(os.path.dirname(__file__), "models")
YOLO_SIZE = 288
YOLO_TARGET = 9
CORRECTOR_SIZE = 50
|
test/test_insert_documents.py | ShaneKilkelly/bedquilt | 288 | 38459 | <reponame>ShaneKilkelly/bedquilt
import testutils
import json
import string
import psycopg2
class TestInsertDocument(testutils.BedquiltTestCase):
def test_insert_into_non_existant_collection(self):
doc = {
"_id": "<EMAIL>",
"name": "<NAME>",
"age": 20
}
... |
src/Query/apifuzz.py | codexgigassys/codex-backend | 161 | 38481 | # Copyright (C) 2016 <NAME>.
# This file is part of CodexGigas - https://github.com/codexgigassys/
# See the file 'LICENSE' for copying permission.
import pathmagic
from pymongo import MongoClient
import ssdeep
from env import envget
def searchFuzzy(fuzz, limit, thresh):
client = MongoClient(envget('metadata.host... |
yasql/apps/sqlorders/urls.py | Fanduzi/YaSQL | 443 | 38483 | <reponame>Fanduzi/YaSQL
# -*- coding:utf-8 -*-
# edit by fuzongfei
from django.urls import path
from sqlorders import views
urlpatterns = [
# SQL工单
path('envs', views.GetDBEnvironment.as_view(), name='v1.sqlorders.db-environment'),
path('schemas', views.GetDbSchemas.as_view(), name='v1.sqlorders.db-schem... |
09WebFramework/day04/basic04.py | HaoZhang95/PythonAndMachineLearning | 937 | 38485 | <reponame>HaoZhang95/PythonAndMachineLearning
"""
ORM是django的核心思想, object-related-mapping对象-关系-映射
ORM核心就是操作数据库的时候不再直接操作sql语句,而是操作对象
定义一个类,类中有uid,username等类属型,sql语句insert修改的时候直接插入这个User对象
"""
# ORM映射实现原理,通过type修改类对象信息
# 定义这个元类metaclass
class ModelMetaclass(type):
def __new__(cls, name, bases, attrs):
... |
Text/TextQualityWatchdog/Watchdog/__init__.py | iii-PaulCridland/azure-search-power-skills | 128 | 38492 | # Standard libraries
import os
import json
import logging
from typing import Text
# Azure functions
import azure.functions as func
# Inference runtime
import onnxruntime as ort
from tokenizers import BertWordPieceTokenizer
# Helper scripts
from .PreprocessData import normalize_text, truncate_text
from .Predict impor... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.