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 |
|---|---|---|---|---|---|---|---|---|---|---|
RPModule/rpmodule.py | zhenpeiyang/RelativePose | 144 | 3304026 | import glob
import numpy as np
import cv2
import sys
from utils import torch_op
import scipy.sparse as sparse
from scipy.sparse import csc_matrix
from scipy.sparse.linalg import svds, eigs
from .rputil import *
from open3d import *
import torch
import util
import copy
import logging
logger=logging.getLogger(__name__)
... | 0 | 0 | 0 | 0 | 0 | 0 |
packages/python/test/fixtures/00-request-path/api/wsgi.py | cetinibs/vercel | 3,655 | 3304032 | <reponame>cetinibs/vercel
from flask import Flask, Response, request
app = Flask(__name__)
@app.route('/', defaults={'path': ''})
@app.route('/<path:path>')
def catch_all(path):
return Response(request.full_path, mimetype="text/plain")
if __name__ == '__main__':
app.run(debug=True, port=8002)
| 0 | 0 | 0 | 0 | 0 | 0 |
epitran/download.py | JakubBrojacz/epitran | 422 | 3304045 | <filename>epitran/download.py
import os
import requests
import gzip
CEDICT_URL='https://www.mdbg.net/chinese/export/cedict/cedict_1_0_ts_utf-8_mdbg.txt.gz'
def get_dir():
data_dir = os.path.expanduser('~/epitran_data/')
os.makedirs(data_dir, exist_ok=True)
return data_dir
def get_cedict_file():
retur... | 0 | 0 | 0 | 0 | 0 | 0 |
python/custom_transformer/model.py | ittus/kserve | 1,146 | 3304054 | <gh_stars>1000+
# Copyright 2021 The KServe Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | 0 | 0 | 0 | 0 | 0 | 0 |
metrics/sample.py | iviazovetskyi/rewriting | 526 | 3304059 | import os
import shutil
import argparse
from tqdm import tqdm
import torch
from utils.stylegan2 import load_seq_stylegan
from utils.pidfile import reserve_dir
from utils import zdataset
from torchvision.transforms import ToPILImage
from utils.imgsave import SaveImagePool
parser = argparse.ArgumentParser('Sample clean... | 0 | 0 | 0 | 0 | 0 | 0 |
rollingpin/log.py | pi4alina/rollingpin | 157 | 3304062 | <reponame>pi4alina/rollingpin
import datetime
import logging
import os
import time
class LogFormatter(logging.Formatter):
converter = time.gmtime
def format(self, record):
formatted = logging.Formatter.format(self, record).decode("utf8")
if hasattr(record, "host"):
formatted = ("... | 0 | 0 | 0 | 0 | 0 | 0 |
jaxfg/solvers/_gauss_newton_solver.py | AvanDavad/jaxfg | 120 | 3304077 | <gh_stars>100-1000
from typing import TYPE_CHECKING
import jax_dataclasses
from jax import numpy as jnp
from overrides import overrides
from .. import sparse
from ..core._variable_assignments import VariableAssignments
from ._mixins import _TerminationCriteriaMixin
from ._nonlinear_solver_base import NonlinearSolverB... | 0 | 0 | 0 | 0 | 0 | 0 |
satori-rules/plugin/libs/gevent/_fileobjectcommon.py | cnof/satori | 2,557 | 3304093 |
try:
from errno import EBADF
except ImportError:
EBADF = 9
cancel_wait_ex = IOError(EBADF, 'File descriptor was closed in another greenlet')
FileObjectClosed = IOError(EBADF, 'Bad file descriptor (FileObject was closed)')
| 0 | 0 | 0 | 0 | 0 | 0 |
raccoon_src/utils/logger.py | KOPACb/Raccoon | 2,453 | 3304102 | <filename>raccoon_src/utils/logger.py
import logging
from os import path
from sys import stdout
from raccoon_src.utils.singleton import Singleton
class SystemOutLogger(metaclass=Singleton):
"""
Single instance stdout logger to be shared among modules
Logging level is set by verbosity/quiet arguments from ... | 0 | 0 | 0 | 0 | 0 | 0 |
src/ml/plt.py | STU-BLUESKY/machine-learning | 239 | 3304103 |
# coding: utf-8
# In[1]:
import pandas as pd
tweets = pd.read_csv("tweets.csv")
tweets.head()
# In[3]:
def get_candidate(row) -> object:
candidates = []
text = row["text"].lower()
if "clinton" in text or "hillary" in text:
candidates.append("clinton")
if "trump" in te... | 0 | 1 | 0 | 0 | 1 | 0 |
youtube_dl/extractor/tvp.py | hackarada/youtube-dl | 66,635 | 3304112 | <reponame>hackarada/youtube-dl
# coding: utf-8
from __future__ import unicode_literals
import itertools
import re
from .common import InfoExtractor
from ..utils import (
clean_html,
determine_ext,
ExtractorError,
get_element_by_attribute,
orderedSet,
)
class TVPIE(InfoExtractor):
IE_NAME = '... | 0 | 0 | 0 | 0 | 0 | 0 |
src/replit/database/default_db.py | 1nd0m1nu3v01d3/Master | 114 | 3304119 | """A module containing the default database."""
from os import environ
from typing import Optional
from .database import Database
db: Optional[Database]
db_url = environ.get("REPLIT_DB_URL")
if db_url:
db = Database(db_url)
else:
# The user will see errors if they try to use the database.
db = None
| 0 | 0 | 1 | 0 | 1 | 0 |
tests/test_utils.py | gxdai/solt | 263 | 3304137 | <reponame>gxdai/solt<filename>tests/test_utils.py
import solt.utils as slu
import solt.transforms as slt
import solt.core as slc
import pytest
import json
import pathlib
import yaml
def test_parameter_validation_range_default_value_not_tuple():
with pytest.raises(TypeError):
slu.validate_numeric_range_par... | 0 | 0 | 0 | 0 | 0 | 0 |
text/detector/utils/setup_cpu_win.py | kingemma/invoice | 1,017 | 3304142 | from Cython.Build import cythonize
import os
from os.path import join as pjoin
import numpy as np
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
try:
numpy_include = np.get_include()
except AttributeError:
numpy_include = np.get_numpy_include()... | 0 | 0 | 0 | 0 | 0 | 0 |
server/database/migration/test/navigation-building-id/compare.py | Paschalis/anyplace | 684 | 3304163 | <gh_stars>100-1000
import json
import sys
def defineKey(key):
if key == "buildings":
return 'buid'
if key == "floorplans":
return 'fuid'
def compareJsonArray(cObj, mObj, uKey, keys):
if len(cObj) != len(mObj):
print(uKey, "= couch:", len(cObj), "mongo:", len(mObj))
return... | 0 | 0 | 0 | 0 | 0 | 0 |
openunreid/apis/test.py | teamwong111/OpenUnReID | 344 | 3304172 | # Written by <NAME>
from __future__ import annotations
import os
import os.path as osp
import time
import warnings
from datetime import timedelta
import numpy as np
import torch
import torchvision
from ..core.metrics.rank import evaluate_rank
from ..core.utils.compute_dist import build_dist
from ..models.utils.dsbn_... | 10 | 3 | 0 | 0 | 13 | 0 |
gpumon/file/__init__.py | msalvaris/gpu_monitor | 145 | 3304204 | from gpumon.file.gpu_logger import log_context
| 0 | 0 | 0 | 0 | 0 | 0 |
mayan/apps/documents/tests/test_file_formats.py | nattangwiwat/Mayan-EDMS-recitation | 343 | 3304211 | <filename>mayan/apps/documents/tests/test_file_formats.py
from .base import GenericDocumentTestCase
from .literals import TEST_MULTI_PAGE_TIFF, TEST_OFFICE_DOCUMENT
class OfficeTextDocumentTestCase(GenericDocumentTestCase):
test_document_filename = TEST_OFFICE_DOCUMENT
def test_document_creation(self):
... | 0 | 0 | 0 | 0 | 0 | 0 |
Python/hello_hackfest18.py | PushpneetSingh/Hello-world | 1,428 | 3304218 | print("Hello hacktoberfest 2018!")
| 0 | 0 | 0 | 0 | 0 | 0 |
dockerfiles/settings/web.py | mforbes/readthedocs.org | 4,054 | 3304223 | from .docker_compose import DockerBaseSettings
class WebDevSettings(DockerBaseSettings):
# Router is useful from webs only because they have access to the database.
# Builders will use the same queue that was assigned the first time on retry
CELERY_ROUTES: tuple[str] = (
'readthedocs.builds.tasks... | 0 | 0 | 1 | 0 | 1 | 0 |
intern_practice/ArticutAPI/Demos/PrimarySchoolMath/intentFunction.py | howardsukuan/LokiHub | 375 | 3304231 | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
import json
import os
import re
import requests
try:
infoPath = "{}/account.info".format(os.path.dirname(os.path.abspath(__file__)))
infoDICT = json.load(open(infoPath, "r"))
USERNAME = infoDICT["username"]
API_KEY = infoDICT["api_key"]
LOKI_KEY = info... | 0 | 8 | 0 | 0 | 8 | 0 |
stanza/server/parser_eval.py | asears/stanza | 3,633 | 3304234 | <gh_stars>1000+
import stanza
from stanza.protobuf import EvaluateParserRequest, EvaluateParserResponse
from stanza.server.java_protobuf_requests import send_request, build_tree, JavaProtobufContext
EVALUATE_JAVA = "edu.stanford.nlp.parser.metrics.EvaluateExternalParser"
def build_request(treebank):
"""
t... | 0 | 0 | 0 | 0 | 0 | 0 |
lldb/test/API/functionalities/thread/thread_specific_break_plus_condition/TestThreadSpecificBpPlusCondition.py | Machiry/checkedc-clang | 250 | 3304274 | <reponame>Machiry/checkedc-clang
"""
Test that we obey thread conditioned breakpoints and expression
conditioned breakpoints simultaneously
"""
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class ThreadSpecificBreakPlusConditionTestCas... | 0 | 0 | 0 | 0 | 0 | 0 |
chatette/parsing/lexing/rule_content_rule_and_choice.py | SimGus/Chatette | 263 | 3304280 | # coding: utf-8
"""
Module `chatette.parsing.lexing.rule_content_rule_and_choice`
Contains the definition of the class that represents the lexing rule
to tokenize a line that is the contents of a rule inside a unit definition,
and the definition of the class that represents the lexing rule
to tokenize a choice (inside ... | 0 | 2 | 0 | 0 | 2 | 0 |
specs/matchers/built_in/be_callable_spec.py | danibaena/expects | 189 | 3304284 | <filename>specs/matchers/built_in/be_callable_spec.py
# -*- coding: utf-8 -*
from expects import *
from expects.testing import failure
with describe('be_callable'):
with it('passes if subject is callable'):
expect(lambda: None).to(be_callable)
with it('fails if subject is not callable'):
wit... | 0 | 0 | 0 | 0 | 0 | 0 |
projects/DensePose/densepose/evaluation/mesh_alignment_evaluator.py | mmabrouk/detectron2 | 21,274 | 3304302 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import json
import logging
from typing import List, Optional
import torch
from torch import nn
from detectron2.utils.file_io import PathManager
from densepose.structures.mesh import create_mesh
class MeshAlignmentEvaluator:
"""
Class fo... | 2 | 1 | 0 | 0 | 3 | 0 |
src/base/bbox.py | grischard/OSMDeepOD | 156 | 3304303 | <filename>src/base/bbox.py
from src.base.node import Node
class Bbox:
def __init__(self, left=None, bottom=None, right=None, top=None):
self.left = left
self.bottom = bottom
self.right = right
self.top = top
@classmethod
def from_nodes(cls, node_left_down=None, node_right_... | 0 | 0 | 0 | 0 | 0 | 0 |
sendgrid_backend/util.py | josephabrahams/django-sendgrid-v5 | 249 | 3304304 | <filename>sendgrid_backend/util.py
from typing import Any, Dict
import sendgrid
from django.conf import settings
from sendgrid.helpers.mail import Personalization
SENDGRID_VERSION = sendgrid.__version__
SENDGRID_5 = SENDGRID_VERSION < "6"
SENDGRID_6 = SENDGRID_VERSION >= "6"
def get_django_setting(setting_str, def... | 0 | 0 | 0 | 0 | 0 | 0 |
release/scripts/presets/tracking_camera/Samsung_Galaxy_S4.py | SBCV/blender | 365 | 3304320 | <filename>release/scripts/presets/tracking_camera/Samsung_Galaxy_S4.py
import bpy
camera = bpy.context.edit_movieclip.tracking.camera
camera.sensor_width = 4.8
camera.units = 'MILLIMETERS'
camera.focal_length = 4.2
camera.pixel_aspect = 1
camera.k1 = 0.0
camera.k2 = 0.0
camera.k3 = 0.0
| 0 | 0 | 0 | 0 | 0 | 0 |
tools/android/dependency_analysis/subprocess_utils.py | zealoussnow/chromium | 14,668 | 3304339 | #!/usr/bin/env python3
# Copyright 2020 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.
"""Utils to run subprocesses."""
import subprocess
import sys
from typing import List
def run_command(command: List[str]) -> str:
... | 1 | 1 | 0 | 0 | 2 | 0 |
examples/autoencoder/autoencoder-TF.py | ojmakhura/DIGITS | 4,552 | 3304381 | # Tensorflow MNIST autoencoder model using TensorFlow-Slim
from model import Tower
from utils import model_property
import tensorflow as tf
import tensorflow.contrib.slim as slim
import utils as digits
class UserModel(Tower):
@model_property
def inference(self) -> object:
with slim.arg_scope([slim.f... | 0 | 2 | 0 | 0 | 2 | 0 |
tests/assets/pipelines/producer-script.py | lresende/elyra | 1,312 | 3304394 | <reponame>lresende/elyra<gh_stars>1000+
import os
import pandas as pd
from datetime import datetime
# Update input csv files
files = ['input-1.csv', 'input-2.csv']
n=2
for file in files:
n=n+1
print(file)
input = pd.read_csv(file, header=0)
input['lastupdated'] = datetime.now()
input.to_csv('outpu... | 0 | 0 | 0 | 0 | 0 | 0 |
napari/layers/vectors/__init__.py | marshuang80/napari | 1,345 | 3304402 | <gh_stars>1000+
from .vectors import Vectors
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/scripts/thread-cert/Cert_7_1_08_BorderRouterAsFED.py | AdityaHPatwardhan/openthread | 2,962 | 3304430 | #!/usr/bin/env python3
#
# Copyright (c) 2020, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# ... | 0 | 0 | 2 | 0 | 2 | 0 |
readme/tests/test_train_via_code.py | howl-anderson/MicroTokenizer | 136 | 3304438 | # There is no case for this, because the API we want to tested already tested by UnitTest of the API
| 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/102114_ThreadedContext/recipe-102114.py | tdiprima/code | 2,023 | 3304453 | <filename>recipes/Python/102114_ThreadedContext/recipe-102114.py
ThreadedContext is like a dictionary, but stores its data in a private namespace for every thread.
A thread can't access to the data from other thread.
USAGE:
In Thread 1:
d = ThreadedContext()
d[1]=1
In Thread 2:
d[1] #raises KeyError exception
d[1]= 2
... | 0 | 0 | 0 | 0 | 0 | 0 |
JobSpiders/pipelines.py | Genesis-m/JobSpiders | 188 | 3304455 | # -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html
import random
import MySQLdb
from twisted.enterprise import adbapi
import MySQLdb.cursors
import re
class JobspidersPipeline... | 0 | 2 | 0 | 0 | 2 | 0 |
uberduck_ml_dev/data/parse.py | justinjohn0306/uberduck-ml-dev | 167 | 3304476 | # AUTOGENERATED! DO NOT EDIT! File to edit: nbs/data.parse.ipynb (unless otherwise specified).
from __future__ import annotations
__all__ = ['STANDARD_MULTISPEAKER', 'STANDARD_SINGLESPEAKER', 'VCTK']
# Cell
import os
import numpy as np
import sqlite3
import uuid
from pathlib import PosixPath
from tqdm import tqdm
fro... | 16 | 0 | 0 | 0 | 16 | 0 |
kitsune/announcements/templatetags/jinja_helpers.py | navgurukul-shivani18/kitsune | 929 | 3304479 | <reponame>navgurukul-shivani18/kitsune
from django_jinja import library
from kitsune.announcements.models import Announcement
@library.global_function
def get_announcements():
return Announcement.get_site_wide()
| 0 | 0 | 0 | 0 | 0 | 0 |
recipes/LibriParty/generate_dataset/local/create_mixtures_from_metadata.py | JasonSWFu/speechbrain | 3,913 | 3304482 | <reponame>JasonSWFu/speechbrain<filename>recipes/LibriParty/generate_dataset/local/create_mixtures_from_metadata.py
"""
This file contains functions to create mixtures given json metadata.
The mixtures simulate a multi-party conversation in a noisy scenario.
Author
------
<NAME>, 2020
"""
import os
import torch
impo... | 0 | 0 | 0 | 0 | 0 | 0 |
Scripts/DefinitionExtract.py | cobalt2727/FEX | 628 | 3304491 | <gh_stars>100-1000
#!/usr/bin/python3
import clang.cindex
from clang.cindex import CursorKind
from clang.cindex import TypeKind
from clang.cindex import TranslationUnit
import sys
from dataclasses import dataclass, field
import subprocess
import logging
logger = logging.getLogger()
logger.setLevel(logging.WARNING)
@da... | 0 | 0 | 0 | 0 | 0 | 0 |
env/Lib/site-packages/OpenGL/GL/__init__.py | 5gconnectedbike/Navio2 | 210 | 3304502 | <gh_stars>100-1000
"""OpenGL.GL, the core GL library and extensions to it"""
# early import of our modules to prevent import loops...
from OpenGL import error as _error
from OpenGL.GL.VERSION.GL_1_1 import *
from OpenGL.GL.pointers import *
from OpenGL.GL.images import *
from OpenGL.GL.exceptional import *
from OpenG... | 0 | 0 | 0 | 0 | 0 | 0 |
cornac/models/cvae/recom_cvae.py | carmanzhang/cornac | 597 | 3304521 | # Copyright 2018 The Cornac 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 applicable ... | 21 | 2 | 0 | 0 | 23 | 0 |
tests/integration/stateless_job_test/test_placement.py | bopopescu/peloton | 617 | 3304528 | <gh_stars>100-1000
import pytest
import time
from tests.integration.job import (
Job,
kill_jobs,
with_constraint,
with_instance_count,
with_job_name,
with_labels,
)
from tests.integration.common import IntegrationTestConfig
from tests.integration.stateless_job import StatelessJob
from peloton_c... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/constraints/test_multi.py | wyfo/typical | 157 | 3304552 | from __future__ import annotations
import pytest
from typic.constraints import (
MultiConstraints,
StrConstraints,
IntContraints,
)
@pytest.mark.parametrize(
argnames=("constraints", "types"),
argvalues=[
(MultiConstraints(constraints=(StrConstraints(), IntContraints())), {str, int}),
... | 0 | 0 | 0 | 0 | 0 | 0 |
docker/tensorflow-aarch64/examples/py-api/utils/common.py | nSircombe/Tool-Solutions | 172 | 3304565 | <filename>docker/tensorflow-aarch64/examples/py-api/utils/common.py<gh_stars>100-1000
# *******************************************************************************
# Copyright 2021 Arm Limited and affiliates.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
#... | 0 | 0 | 0 | 0 | 0 | 0 |
doc/views.py | arronlacey/markup | 115 | 3304578 | <reponame>arronlacey/markup
from django.shortcuts import render
def doc(request):
return render(request, 'doc.html', {}) | 0 | 0 | 0 | 0 | 0 | 0 |
pydy/viz/tests/test_shapes.py | pydy/pydy | 298 | 3304599 | <gh_stars>100-1000
#!/usr/bin/env python
# external
import numpy as np
from sympy import symbols
from numpy.testing import assert_allclose
from nose.tools import assert_raises
try:
import pythreejs as p3js
except ImportError:
print('pythreejs not installed, skipping related tests.')
p3js = None
# local
fr... | 0 | 0 | 0 | 0 | 0 | 0 |
bindings/python/htcondor/_lock.py | sridish123/htcondor | 217 | 3304605 | # Copyright 2019 HTCondor Team, Computer Sciences Department,
# University of Wisconsin-Madison, WI.
#
# 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/LICE... | 1 | 7 | 0 | 0 | 8 | 0 |
tests/test_variant_algebra.py | h-vetinari/conda-smithy | 122 | 3304611 | import pytest
from textwrap import dedent
from conda_smithy.variant_algebra import parse_variant, variant_add
tv1 = parse_variant(
"""\
foo:
- 1.10
bar:
- 2
"""
)
tv2 = parse_variant(
"""\
foo:
- 1.2
bar:
- 3
"""
)
tv3 = parse_variant(
"""\
baz:
- 1
bar:
- 3
"""
)
tv4 = parse_v... | 0 | 0 | 0 | 0 | 0 | 0 |
Animatronic_Hand/touch/code.py | gamblor21/Adafruit_Learning_System_Guides | 665 | 3304656 | # Animatronic Hand
# CPX with CRICKIT and four servos
# touch four cap pads to close the fingers
import board
from digitalio import DigitalInOut, Direction, Pull
from adafruit_crickit import crickit
#################### CPX switch
# use the CPX onboard switch to turn on/off (helps calibrate)
switch = DigitalInOut(... | 0 | 0 | 0 | 0 | 0 | 0 |
tensorflow_ranking/research/dasalc.py | sarvex/tensorflow-ranking | 2,482 | 3304669 | # Copyright 2021 The TensorFlow Ranking Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | 2 | 7 | 0 | 0 | 9 | 0 |
applications/tapkee/samples/mds.py | ShankarNara/shogun | 2,753 | 3304675 | <gh_stars>1000+
import shogun as sg
import data
import numpy as np
# load data
feature_matrix = data.swissroll()
# create features instance
features = sg.RealFeatures(feature_matrix)
# create Multidimensional Scaling converter instance
converter = sg.MultidimensionalScaling()
# set target dimensionality
converter.se... | 0 | 0 | 0 | 0 | 0 | 0 |
aw_nas/objective/hardware.py | Harald-R/aw_nas | 195 | 3304687 | from __future__ import annotations
from aw_nas.objective.base import BaseObjective
from aw_nas.hardware.base import BaseHardwarePerformanceModel
class HardwareObjective(BaseObjective):
NAME: str = "hardware"
def __init__(self,
search_space,
hardware_perfmodel_type,
... | 7 | 5 | 1 | 0 | 13 | 0 |
raiwidgets/tests/test_cohort.py | ms-kashyap/responsible-ai-widgets | 119 | 3304720 | <gh_stars>100-1000
# Copyright (c) Microsoft Corporation
# Licensed under the MIT License.
import json
import pandas as pd
import pytest
from raiwidgets.cohort import (ClassificationOutcomes, Cohort, CohortFilter,
CohortFilterMethods,
cohort_filter_json_c... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/licensechecker.py | MatthewCroughan/scion | 211 | 3304729 | #!/usr/bin/env python3
import sys
import subprocess
license_texts = {
"#":"""
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | 1 | 1 | 0 | 0 | 2 | 0 |
docs/examples/e06_simple_bot_structure/modules/meta.py | Multiface24111/hata | 173 | 3304752 | <filename>docs/examples/e06_simple_bot_structure/modules/meta.py<gh_stars>100-1000
from hata import Client
from hata.ext.commands_v2 import checks
Sakuya : Client
@Sakuya.commands
@checks.owner_only()
async def ping():
"""Pongs."""
return 'pong'
| 0 | 0 | 0 | 0 | 0 | 0 |
problem/migrations/0008_auto_20170923_1318.py | lizehongss/oj_backend | 5,237 | 3304754 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-09-23 13:18
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
('contest', '0005_auto_20170823_0918')... | 0 | 0 | 2 | 0 | 2 | 0 |
contrib/python/django_cubrid/introspection.py | eido5/cubrid | 253 | 3304755 | from django.db.backends import BaseDatabaseIntrospection
from CUBRIDdb import FIELD_TYPE
class DatabaseIntrospection(BaseDatabaseIntrospection):
data_types_reverse: dict[object,str] = {
FIELD_TYPE.CHAR : 'CharField',
FIELD_TYPE.VARCHAR : 'CharField',
FIELD_TYPE.NCHAR : 'CharField',
... | 0 | 3 | 1 | 0 | 4 | 0 |
tests/python/test_logging.py | lgov/tensorboard | 402 | 3304762 | import os
import shutil
from tensorboard.summary import scalar
from tensorboard import FileWriter
def test_event_logging():
logdir = './experiment/'
summary_writer = FileWriter(logdir)
scalar_value = 1.0
s = scalar('test_scalar', scalar_value)
summary_writer.add_summary(s, global_step=1)
summa... | 0 | 0 | 0 | 0 | 0 | 0 |
pytype/tools/merge_pyi/test_data/py36/__init__.py | ashwinprasadme/pytype | 3,882 | 3304770 | <filename>pytype/tools/merge_pyi/test_data/py36/__init__.py<gh_stars>1000+
# Dummy file to mark a package
| 0 | 0 | 0 | 0 | 0 | 0 |
flownmt/modules/posteriors/transformer.py | DeNeutoy/flowseq | 256 | 3304811 | from __future__ import annotations
from overrides import overrides
from typing import Tuple, Dict
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from flownmt.nnet.weightnorm import LinearWeightNorm
from flownmt.nnet.transformer import TransformerDecoderLayer
from flownmt.nnet.positional... | 20 | 7 | 0 | 0 | 27 | 0 |
DetailedRouter/DR_COLLATERAL_Generator/strawman2a/gen.py | mabrains/ALIGN-public | 119 | 3304821 | <filename>DetailedRouter/DR_COLLATERAL_Generator/strawman2a/gen.py
import json
import argparse
hMetals = {"metal%d" % i for i in range(2,6,2)}
vMetals = {"metal%d" % i for i in range(1,6,2)}
metals = ["metal%d" % i for i in range(1,6)]
vias = ["via%d" % i for i in range(1,5)]
def generateVia( tech, v, l, u, l_... | 0 | 0 | 0 | 0 | 0 | 0 |
sdk/containerregistry/azure-containerregistry/azure/containerregistry/_authentication_policy.py | rsdoherty/azure-sdk-for-python | 2,728 | 3304823 | # coding=utf-8
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
from typing import TYPE_CHECKING, Any
from azure.core.pipeline.policies import HTTPPolicy
from ._anonymous_exchange_client import AnonymousACRExchangeC... | 0 | 3 | 0 | 0 | 3 | 0 |
liualgotrader/common/assets.py | ksilo/LiuAlgoTrader | 369 | 3304832 | <reponame>ksilo/LiuAlgoTrader<filename>liualgotrader/common/assets.py
from typing import Dict
from liualgotrader.common.types import AssetType
assets_details: Dict[str, Dict] = {
"btcusd": {
"type": AssetType.CRYPTO,
"min_order_size": 0.00001,
"tick_precision": 8,
},
"ethusd": {
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/r/test_pima_tr.py | hajime9652/observations | 199 | 3304834 | <reponame>hajime9652/observations<gh_stars>100-1000
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.pima_tr import pima_tr
def test_pima_tr():
"""Test module pima_tr.py by downloading
pima_... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_linkify.py | tadeu/markdown-it-py | 285 | 3304869 | from markdown_it import MarkdownIt
def test_token_levels():
mdit = MarkdownIt(options_update={"linkify": True}).enable("linkify")
tokens = mdit.parse("www.python.org")
inline = tokens[1]
assert inline.type == "inline"
link_open = inline.children[0]
assert link_open.type == "link_open"
link... | 0 | 0 | 0 | 0 | 0 | 0 |
dbaas/physical/migrations/0001_initial.py | didindinn/database-as-a-service | 303 | 3304875 | <filename>dbaas/physical/migrations/0001_initial.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Environment'
db.create... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/telemetry/telemetry/page/page_filter_unittest.py | iplo/Chain | 231 | 3304882 | <reponame>iplo/Chain
# 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.
import unittest
from telemetry.page import page as page_module
from telemetry.page import page_filter as page_filter_module
from telemet... | 0 | 0 | 0 | 0 | 0 | 0 |
ambari-agent/src/main/python/ambari_agent/ClusterAlertDefinitionsCache.py | likenamehaojie/Apache-Ambari-ZH | 1,664 | 3304883 | <gh_stars>1000+
#!/usr/bin/env python
"""
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... | 0 | 0 | 0 | 0 | 0 | 0 |
muddery/server/elements/world_object.py | dongwudanci/muddery | 127 | 3304889 | <reponame>dongwudanci/muddery
"""
This is adapt from evennia/evennia/objects/objects.py.
The licence of Evennia can be found in evennia/LICENSE.txt.
MudderyObject is an object which can load it's data automatically.
"""
from muddery.server.mappings.element_set import ELEMENT
from muddery.server.utils.localized_strin... | 0 | 0 | 0 | 0 | 0 | 0 |
semi-supervised/utils.py | engdorm/semi-supervised-pytorch | 700 | 3304895 | import torch
from torch.autograd import Variable
def enumerate_discrete(x, y_dim) -> object:
"""
Generates a `torch.Tensor` of size batch_size x n_labels of
the given label.
Example: generate_label(2, 1, 3) #=> torch.Tensor([[0, 1, 0],
[0, 1, 0]]... | 0 | 5 | 0 | 0 | 5 | 0 |
i18n/loaders/loader.py | kampikd/python-i18n | 104 | 3304934 | <reponame>kampikd/python-i18n
from .. import config
import io
class I18nFileLoadError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return str(self.value)
class Loader(object):
"""Base class to load resources"""
def __init__(self):
super(Loader... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/query/bugs/remove_unreasonable_error_message_pr1983.py | tom-chensf/nebula-graph | 816 | 3304935 | <reponame>tom-chensf/nebula-graph
# --coding:utf-8--
#
# Copyright (c) 2020 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License,
# attached with Common Clause Condition 1.0, found in the LICENSES directory.
import time
from tests.common.nebula_test_suite import NebulaTestSuite
... | 0 | 0 | 0 | 0 | 0 | 0 |
dynamo/estimation/tsc/utils_kinetic.py | xing-lab-pitt/dynamo-release | 236 | 3304949 | from __future__ import annotations
import numpy as np
from scipy.integrate import odeint
from ..csc.utils_velocity import sol_u, sol_s
from ...dynamo_logger import main_debug, main_info
class LinearODE:
def __init__(self, n_species, x0: object | None=None):
"""A general class for linear odes"""
se... | 46 | 47 | 0 | 39 | 132 | 0 |
torchbench/datasets/pascalcontext.py | xperience-ai/torchbench | 143 | 3304961 | <filename>torchbench/datasets/pascalcontext.py
import os
import copy
import json
import torch
from PIL import Image
from torchvision.datasets.vision import VisionDataset
from torchbench.datasets.utils import (
download_url,
download_and_extract_archive,
)
ARCHIVE_DICT = {
"trainval_annot": {
"url... | 0 | 0 | 0 | 0 | 0 | 0 |
dataflows/processors/dumpers/to_zip.py | cschloer/dataflows | 160 | 3304977 | <gh_stars>100-1000
import zipfile
from .file_dumper import FileDumper
class ZipDumper(FileDumper):
def __init__(self, out_file, **options):
super(ZipDumper, self).__init__(options)
self.out_file = open(out_file, 'wb')
self.zip_file = zipfile.ZipFile(self.out_file, 'w')
def write_fil... | 0 | 0 | 0 | 0 | 0 | 0 |
profiling/profile_env.py | Caffa/sequential_social_dilemma_games | 284 | 3304981 | import numpy as np
from social_dilemmas.envs.env_creator import get_env_creator
cleanup_env = get_env_creator("cleanup", 5, {})(0)
agent_ids = ["agent-" + str(agent_number) for agent_number in range(5)]
actions = {}
def profile_cleanup():
"""
Profiles environments steps by executing random actions in a cle... | 0 | 0 | 0 | 0 | 0 | 0 |
onenote.py | CzBiX/WizNote-to-OneNote | 105 | 3304997 | #!/usr/bin/env python3
from __future__ import annotations
import mimetypes
import os
import re
import sqlite3
from collections import namedtuple, OrderedDict
from datetime import datetime, timedelta, timezone
from sys import platform
from urllib.parse import urlencode, parse_qs
from zipfile import ZipFile
import requ... | 0 | 9 | 0 | 0 | 9 | 0 |
examples/http_and_ssh/http_and_ssh/__init__.py | Ovvovy/API-Hour | 571 | 3305007 | <reponame>Ovvovy/API-Hour<filename>examples/http_and_ssh/http_and_ssh/__init__.py
import logging
import aiohttp.web
from asyncssh import import_private_key
from asyncssh.connection import SSHServerConnection
import api_hour
from . import endpoints
from .servers.ssh import InternalSSHServer
LOG = logging.getLogger(... | 0 | 0 | 0 | 0 | 0 | 0 |
currencyrate/currencyrate.py | bit0fun/plugins | 173 | 3305014 | #!/usr/bin/env python3
from __future__ import annotations
from pyln.client import Plugin
from collections import namedtuple
from pyln.client import Millisatoshi
from cachetools import cached, TTLCache
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
import requests
import... | 4 | 5 | 0 | 0 | 9 | 0 |
src/fastapi_quickcrud/misc/abstract_parser.py | aebrahim/FastAPIQuickCRUD | 123 | 3305028 | <reponame>aebrahim/FastAPIQuickCRUD
import copy
from http import HTTPStatus
from urllib.parse import urlencode
from pydantic import parse_obj_as
from starlette.responses import Response, RedirectResponse
from .utils import group_find_many_join
from .exceptions import FindOneApiNotRegister
class SQLAlchemyGeneralSQLe... | 0 | 0 | 0 | 0 | 0 | 0 |
spafe/fbanks/linear_fbanks.py | SuperKogito/cautious-palm-tree | 205 | 3305046 | ##############################################################################################
# linear-filter-banks implementation
##############################################################################################
from __future__ import annotations
import numpy as np
from ..utils.... | 6 | 1 | 0 | 0 | 7 | 0 |
tests/integration/local/start_lambda/test_start_lambda_cdk.py | zhuhaow/aws-sam-cli | 2,959 | 3305075 | import boto3
import pytest
from botocore import UNSIGNED
from botocore.config import Config
from botocore.exceptions import ClientError
from tests.integration.local.start_lambda.start_lambda_api_integ_base import StartLambdaIntegBaseClass
class TestCDKLambdaService(StartLambdaIntegBaseClass):
template_path: str ... | 0 | 0 | 2 | 0 | 2 | 0 |
contrib/tools/python/src/Lib/plat-os2emx/IN.py | HeyLey/catboost | 6,989 | 3305082 | # Generated by h2py from f:/emx/include/netinet/in.h
# Included from sys/param.h
PAGE_SIZE = 0x1000
HZ = 100
MAXNAMLEN = 260
MAXPATHLEN = 260
def htonl(X) -> object: return _swapl(X)
def ntohl(X) -> object: return _swapl(X)
def htons(X) -> object: return _swaps(X)
def ntohs(X) -> object: return _swaps(X)
IPPROTO_I... | 0 | 11 | 0 | 0 | 11 | 0 |
tools/mo/openvino/tools/mo/front/tf/argmin_ext.py | ryanloney/openvino-1 | 1,127 | 3305099 | # Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from openvino.tools.mo.ops.argmin import ArgMinOp
from openvino.tools.mo.front.extractor import FrontExtractorOp
from openvino.tools.mo.front.tf.extractors.utils import tf_dtype_extractor
class ArgMinFrontExtractor(... | 0 | 1 | 2 | 0 | 3 | 0 |
Algorithms/Python/powerExpo.py | Shaswat-2203/HacktoberfestForBeginners | 115 | 3305126 | def power(x,y) -> object:
res=1
while y>0:
if y&1:
res=(res*x)
y=y>>1
x=(x*x)
return res
a,b=map(int,input().split())
print("a^b = ",power(a,b))
| 0 | 1 | 0 | 0 | 1 | 0 |
kopf/_core/reactor/inventory.py | tavaresrodrigo/kopf | 855 | 3305131 | <filename>kopf/_core/reactor/inventory.py
"""
An internal in-memory storage of structured records about resource objects.
Each object gets at most one record in the inventory of an operator's memories.
The information is stored strictly in-memory and is not persistent.
On the operator restart, all the memories are los... | 0 | 0 | 0 | 0 | 0 | 0 |
Multicore-TSNE-master/MulticoreTSNE/examples/test_sklearn.py | WesleyClode/mtvis | 1,754 | 3305150 | from sklearn.manifold import TSNE
import gzip
import pickle
import numpy as np
import matplotlib
from cycler import cycler
import urllib
import os
import sys
import time
matplotlib.use('Agg')
import matplotlib.pyplot as plt
def get_mnist():
if not os.path.exists('mnist.pkl.gz'):
print('downloading MNIS... | 0 | 0 | 0 | 0 | 0 | 0 |
helios/management/__init__.py | nti-ufop/helios-server | 525 | 3305152 | <reponame>nti-ufop/helios-server
"""
Management commands for Helios
many of these should be run out of cron
"""
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_charrnn.py | muxgt/pycadl | 398 | 3305187 | <reponame>muxgt/pycadl
import tensorflow as tf
from cadl import charrnn
from cadl.utils import stdout_redirect
from numpy.testing import run_module_suite
import io
class TestCharRNN:
def test_alice_char_rnn_model(self):
with tf.Graph().as_default():
charrnn.test_alice()
def test_trump_cha... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/click/10_table_styles.py | ewels/rich-click | 185 | 3305188 | <filename>examples/click/10_table_styles.py
import rich_click as click
click.rich_click.STYLE_OPTIONS_TABLE_LEADING = 1
click.rich_click.STYLE_OPTIONS_TABLE_BOX = "SIMPLE"
click.rich_click.STYLE_OPTIONS_TABLE_ROW_STYLES = ["bold", ""]
click.rich_click.STYLE_COMMANDS_TABLE_SHOW_LINES = True
click.rich_click.STYLE_COMMA... | 0 | 0 | 0 | 0 | 0 | 0 |
docs/core/util/StoryLexer.py | jeanveau/rasa_core | 2,433 | 3305207 | <gh_stars>1000+
from pygments.lexer import RegexLexer, bygroups, using, default, include
from pygments.lexers.data import JsonLexer
from pygments.token import *
class StoryLexer(RegexLexer):
"""Lexer for the Rasa Core story file format.
Used for syntax highlighting of story snippets in the docs."""
name... | 0 | 0 | 0 | 0 | 0 | 0 |
setup.py | bts/hydrachain | 406 | 3305208 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
from setuptools.command.test import test as TestCommand
class PyTest(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test... | 0 | 0 | 0 | 0 | 0 | 0 |
phobos/io/entities/submechanisms.py | hawkina/phobos | 323 | 3305221 | #!/usr/bin/python3
# coding=utf-8
# -------------------------------------------------------------------------------
# This file is part of Phobos, a Blender Add-On to edit robot models.
# Copyright (C) 2020 University of Bremen & DFKI GmbH Robotics Innovation Center
#
# You should have received a copy of the 3-Clause ... | 0 | 0 | 0 | 0 | 0 | 0 |
setup.py | byjg/redis-dump-load | 158 | 3305238 | #!/usr/bin/env python
import os.path
from distutils.core import setup
package_name = 'redis-dump-load'
package_version = '1.1'
doc_dir = os.path.join('share', 'doc', package_name)
data_files = ['LICENSE', 'README.rst']
setup(name=package_name,
version=package_version,
description='Dump and load redis datab... | 0 | 0 | 0 | 0 | 0 | 0 |
securetea/lib/antivirus/monitor/monitor_engine.py | pwned-17/SecureTea-Project | 257 | 3305241 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
u"""Monitor Engine module for SecureTea AntiVirus.
Project:
╔═╗┌─┐┌─┐┬ ┬┬─┐┌─┐╔╦╗┌─┐┌─┐
╚═╗├┤ │ │ │├┬┘├┤ ║ ├┤ ├─┤
╚═╝└─┘└─┘└─┘┴└─└─┘ ╩ └─┘┴ ┴
Author: <NAME> <<EMAIL>> , Jul 4 2019
Version: 1.4
Module: SecureTea
"""
from securetea.lib.antivirus.moni... | 0 | 0 | 0 | 0 | 0 | 0 |
test/hummingbot/core/gateway/test_gateway_http_client.py | cardosofede/hummingbot | 542 | 3305247 | <reponame>cardosofede/hummingbot<gh_stars>100-1000
from aiounittest import async_test
from aiohttp import ClientSession
import asyncio
from contextlib import ExitStack
from decimal import Decimal
from os.path import join, realpath
from typing import List, Dict, Any
import unittest
from unittest.mock import patch
from ... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/roi_data/fast_rcnn.py | wjbKimberly/DetectAndTrack-wjb | 1,007 | 3305264 | ##############################################################
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
##############################################################
fro... | 1 | 5 | 0 | 0 | 6 | 0 |
alipay/aop/api/response/AlipayMerchantIotDeviceQueryResponse.py | antopen/alipay-sdk-python-all | 213 | 3305272 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AlipayMerchantIotDeviceQueryResponse(AlipayResponse):
def __init__(self):
super(AlipayMerchantIotDeviceQueryResponse, self).__init__()
self._merchant_type: None = Non... | 0 | 4 | 0 | 4 | 8 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.