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 |
|---|---|---|---|---|---|---|---|---|---|---|
aix360/datasets/__init__.py | floidgilbert/AIX360 | 609 | 1728473 | <reponame>floidgilbert/AIX360
from .mnist_dataset import MNISTDataset
from .meps_dataset import MEPSDataset
from .heloc_dataset import HELOCDataset
from .celeba_dataset import CelebADataset
from .cdc_dataset import CDCDataset
from .cifar_dataset import CIFARDataset
from .ted_dataset import TEDDataset
from .fashion_mnis... | 0 | 0 | 0 | 0 | 0 | 0 |
nntts/datasets/__init__.py | entn-at/efficient_tts | 111 | 1728486 | from .collate_fn import CommonDurationModelCollate, TTSCollate
from .taco2_data import TextMelLoader, TextMelCollate
| 0 | 0 | 0 | 0 | 0 | 0 |
chapter7/solutions/area_curves.py | hexu1985/Doing.Math.With.Python | 109 | 1728519 | '''
area_curves.py
Find the area enclosed by two curves between two points
'''
from sympy import Integral, Symbol, SympifyError, sympify
def find_area(f, g, var, a, b) -> object:
a = Integral(f-g, (var, a, b)).doit()
return a
if __name__ == '__main__':
f = input('Enter the upper function in one variable... | 0 | 1 | 0 | 0 | 1 | 0 |
contrib/tools/python/src/Lib/plat-mac/Carbon/AppleHelp.py | HeyLey/catboost | 6,989 | 1728538 | # Generated from 'AppleHelp.h'
kAHInternalErr = -10790
kAHInternetConfigPrefErr = -10791
kAHTOCTypeUser = 0
kAHTOCTypeDeveloper = 1
| 0 | 0 | 0 | 0 | 0 | 0 |
leetcode.com/python/953_Verifying_an_Alien_Dictionary.py | its-sushant/coding-interview-gym | 713 | 1728540 | class Solution(object):
def isAlienSorted(self, words, order) -> bool:
"""
:type words: List[str]
:type order: str
:rtype: bool
"""
sequences = []
left = 0
while left < len(words) - 1:
firstWord = words[left]
secondWord = words[... | 0 | 1 | 0 | 0 | 1 | 0 |
clevercsv/console/commands/_utils.py | backwardn/CleverCSV | 989 | 1728598 | <reponame>backwardn/CleverCSV
# -*- coding: utf-8 -*-
from clevercsv import __version__
def parse_int(val, name):
"""Parse a number to an integer if possible"""
if val is None:
return val
try:
return int(val)
except ValueError:
raise ValueError(
f"Please provide a ... | 0 | 0 | 0 | 0 | 0 | 0 |
django_filters/rest_framework/__init__.py | stephenfin/django-filter | 193 | 1728621 | # flake8: noqa
from .backends import DjangoFilterBackend
from .filterset import FilterSet
from .filters import *
| 0 | 0 | 0 | 0 | 0 | 0 |
vardbg/render.py | vishal2612200/vardbg | 946 | 1728627 | <gh_stars>100-1000
from . import ansi
def key_var(var, key):
return f"{var}[{repr(key)}]"
def val(value):
return ansi.bold(repr(value))
def duration_ns(t_ns) -> str:
t_ns = int(t_ns)
t_us = t_ns / 1000
t_ms = t_us / 1000
t_s = t_ms / 1000
t_m = t_s / 60
t_h = t_m / 60
t_d = t_... | 0 | 0 | 0 | 0 | 0 | 0 |
src/lib/ctypes/__init__.py | DTenore/skulpt | 2,671 | 1728726 | <reponame>DTenore/skulpt
import _sk_fail; _sk_fail._("ctypes")
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/commands/download/test_download_ensembl_cmd.py | mhkc/scout | 111 | 1728773 | <reponame>mhkc/scout
"""Tests for download commands"""
import pathlib
import tempfile
import pytest
from scout.commands.download.ensembl import ensembl as ensembl_cmd
from scout.commands.download.ensembl import print_ensembl
def test_download_ensembl_cmd(mocker, empty_mock_app):
"""Test download ensembl comman... | 0 | 0 | 0 | 0 | 0 | 0 |
src/api/migrations/0005_auto_20180514_1557.py | nixplay/bullet-train-api | 1,259 | 1728776 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2018-05-14 15:57
from __future__ import unicode_literals
from django.db import migrations, models
import app
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
('api', '0004_identity_uuid'),
]
operations: list[... | 0 | 0 | 2 | 0 | 2 | 0 |
backend/sprites/sprites.py | ljvmiranda921/sprites-as-a-service | 242 | 1728893 | """Application logic"""
# Import standard library
import random
import itertools
from typing import Tuple, List
# Import modules
import matplotlib as mpl
import matplotlib.cm as cm
import matplotlib.pyplot as plt
import numpy as np
import seagull as sg
import seagull.lifeforms as lf
from loguru import logger
from sci... | 15 | 8 | 0 | 0 | 23 | 0 |
test/test_events.py | rhansen/nginx-proxy | 12,930 | 1728915 | <reponame>rhansen/nginx-proxy
"""
Test that nginx-proxy detects new containers
"""
from time import sleep
import pytest
from docker.errors import NotFound
@pytest.fixture()
def web1(docker_compose):
"""
pytest fixture creating a web container with `VIRTUAL_HOST=web1.nginx-proxy` listening on port 81.
"""... | 0 | 0 | 0 | 0 | 0 | 0 |
misc/test_zlib_debug_compressor.py | bqqbarbhg/ufbx | 128 | 1728923 | <gh_stars>100-1000
import zlib_debug_compressor as zz
import zlib
import sys
import itertools
def test_dynamic():
"""Simple dynamic Huffman tree compressed block"""
opts = zz.Options(force_block_types=[2])
data = b"Hello Hello!"
return data, zz.deflate(data, opts)
def test_dynamic_no_match():
"""S... | 0 | 0 | 0 | 0 | 0 | 0 |
applications/popart/transformer_transducer/training/conftest.py | payoto/graphcore_examples | 260 | 1728961 | <filename>applications/popart/transformer_transducer/training/conftest.py
# Copyright (c) 2021 Graphcore Ltd. All rights reserved.
import os
import shutil
from subprocess import run
def rebuild_custom_ops():
"""The objective of this function is to:
1.) Delete the existing build dir for custom ops if it exist... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/embedded_scout/src/compile_scout.py | CheckPointSW/Scour | 152 | 1728966 | #!/usr/bin/python3
import os
import sys
from elementals import Prompter
from scout_debugger.scout_compiler import *
##############################
## Dynamic Configurations ##
##############################
SCOUT_DIR = '../../../src/scout'
SCOUT_LOADER_ELF = 'scout_loader.elf'
EMBEDDED_SCOUT_ELF = ... | 0 | 3 | 0 | 0 | 3 | 0 |
deprecated/base_model/lenet5.py | sysu-shey/ACNet | 767 | 1728969 | import torch.nn as nn
from builder import ConvBuilder
LENET5_DEPS = [20, 50, 500]
class LeNet5(nn.Module):
def __init__(self, builder:ConvBuilder, deps):
super(LeNet5, self).__init__()
self.bd = builder
stem = builder.Sequential()
stem.add_module('conv1', builder.Conv2d(in_channel... | 1 | 2 | 0 | 0 | 3 | 0 |
Python/Syntax/DoubleCondition.py | piovezan/SOpt | 148 | 1729018 | <reponame>piovezan/SOpt
idade = int(input('Qual sua idade? '))
preço = float(input('Informe o valor: '))
desconto = 7.0
if preço >= 23 and preço <= idade:
print('Você terá um desconto de: R${:.2f}'.format(desconto))
else:
print('sem desconto')
#https://pt.stackoverflow.com/q/446362/101
| 0 | 0 | 0 | 0 | 0 | 0 |
setup.py | tobigrimm/hb-downloader | 195 | 1729037 | from setuptools import setup
setup(name='hb_downloader',
version='0.5.0',
description='an unofficial api client for humblebundle',
url='https://github.com/MayeulC/hb-downloader/releases',
author='<NAME>',
license='MIT',
packages=[
'hb_downloader',
'hb_downloader.... | 0 | 0 | 0 | 0 | 0 | 0 |
Chapter 2/restful_python_chapter_02_03/gamesapi/games/tests.py | Mohamed2011-bit/Building-RESTful-Python-Web-Services | 116 | 1729044 | """
Book: Building RESTful Python Web Services
Chapter 2: Working with class based views and hyperlinked APIs in Django
Author: <NAME> - Twitter.com/gastonhillar
Publisher: Packt Publishing Ltd. - http://www.packtpub.com
"""
from django.test import TestCase
# Create your tests here.
| 0 | 0 | 0 | 0 | 0 | 0 |
Hackerrank_problems/Find_a_String/Solution.py | gbrls/CompetitiveCode | 165 | 1729053 | # -*- coding: utf-8 -*-
"""
Created on Mon Oct 12 12:45:34 2020
@author: Incognito
"""
def count_substring(string, sub_string) -> object:
end=len(sub_string)
c=0
for i in range(len(string)):
#if starting character of substring is found in i-th position of string
if(string[i]==sub_string[0]... | 0 | 1 | 0 | 0 | 1 | 0 |
Contributions/simpleCalculator.py | sattwik21/Hacktoberfest2021-1 | 215 | 1729070 | <reponame>sattwik21/Hacktoberfest2021-1
#github : https://github.com/arincantikam26
('=' * 25)
print('simple calculator')
print(' 1. addition\t\t[+]')
print(' 2. subtraction\t\t[-]')
print(' 3. multiplication\t[*]')
print(' 4. division\t\t[/]')
print('=' * 25)
data = input('Choice operation(1/2/3/4): ')
data_... | 0 | 0 | 0 | 0 | 0 | 0 |
i3pystatus/tlp.py | fkusei/i3pystatus | 413 | 1729103 | from i3pystatus import IntervalModule
class Tlp(IntervalModule):
"""
Shows the current mode of TLP (Linux power management tool), either
battery, AC or unknown.
.. rubric:: Available formatters
* `{output}` - one of the strings configured through the `*_text` settings
"""
last_pwr_file: ... | 0 | 0 | 9 | 0 | 9 | 0 |
week07_seq2seq/basic_model_theano.py | NicePit/Practical_RL | 5,304 | 1729116 | # code by https://github.com/deniskamazur
from __future__ import annotations
from lasagne.layers import *
import theano.tensor as T
import theano
from agentnet.memory import LSTMCell, GRUCell, AttentionLayer
from agentnet import Recurrence
from agentnet.learning.generic import get_mask_by_eos
from agentnet.resolver i... | 5 | 3 | 0 | 0 | 8 | 0 |
greedy/activity_selection/python/activity.py | CarbonDDR/al-go-rithms | 1,253 | 1729145 | <reponame>CarbonDDR/al-go-rithms
"""Prints a maximum set of activities that can be done by a
single person, one at a time"""
# n --> Total number of activities
# s[]--> An array that contains start time of all activities
# f[] --> An array that conatins finish time of all activities
def printMaxActivities(s , f ):
... | 0 | 0 | 0 | 0 | 0 | 0 |
h2o-docs/src/booklets/v2_2015/source/GLM_Vignette_code_examples/glm_recalculate_predict.py | ahmedengu/h2o-3 | 6,098 | 1729146 | <gh_stars>1000+
#manually define threshold for predictions to 0.3
import pandas as pd
pred = binomial_fit.predict(h2o_df)
pred['predict'] = pred['p1']>0.3
| 0 | 0 | 0 | 0 | 0 | 0 |
maya/Tests/loadWorldSpaceTranslateJob_test.py | ryu-sw/alembic | 921 | 1729151 | <reponame>ryu-sw/alembic<filename>maya/Tests/loadWorldSpaceTranslateJob_test.py
##-*****************************************************************************
##
## Copyright (c) 2009-2011,
## <NAME> Imageworks, Inc. and
## Industrial Light & Magic, a division of Lucasfilm Entertainment Company Ltd.
##
## All right... | 0 | 0 | 0 | 0 | 0 | 0 |
gym_extensions/continuous/box2d/__init__.py | nicofirst1/gym-extensions | 218 | 1729180 | <reponame>nicofirst1/gym-extensions
import gym
import os
custom_envs = {
# Contextual environments
"FalconLander-v0":
dict(path='gym_extensions.continuous.box2d.falcon_drone_ship_lander:FalconLander',
max_episode_steps=1000,
kwargs= dict())
... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/lint/lib/checks/nopadding.py | katemihalikova/test262 | 1,849 | 1729194 | from __future__ import annotations
from ..check import Check
import re
class CheckNoPadding(Check):
'''Ensure frontmatter string tags doesn't contain leading empty lines'''
ID: str = 'NOPADDING'
def __init__(self):
self.noPadding = re.compile(r"^(?![\r\n])[\s\S]*")
def run(self, name, meta, s... | 0 | 1 | 1 | 0 | 2 | 0 |
tests/expected/dict.py | div72/py2many | 345 | 1729238 | <gh_stars>100-1000
from typing import Callable, Dict, List, Set, Optional
from ctypes import c_int8 as i8, c_int16 as i16, c_int32 as i32, c_int64 as i64
from ctypes import c_uint8 as u8, c_uint16 as u16, c_uint32 as u32, c_uint64 as u64
import sys
def implicit_keys() -> bool:
CODES: Dict[str, int] = {"KEY": 1}
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/mmpm_test/consts.py | Spyna/mmpm | 106 | 1729242 | #!/usr/bin/env python3
import os
import mmpm.consts
from mmpm.models import MagicMirrorPackage
from typing import List
from socket import gethostname, gethostbyname
MMPM_TEST_ROOT: str = os.path.join("/", "tmp", "MMPM_TEST")
MMPM_CONFIG_DIR: str = os.path.normpath(os.path.join(MMPM_TEST_ROOT, '.config', 'mmpm'))
MAG... | 0 | 0 | 12 | 0 | 12 | 0 |
migration/tests/__init__.py | elihschiff/Submitty | 411 | 1729246 | """Test module for migrator."""
| 0 | 0 | 0 | 0 | 0 | 0 |
chainer/functions/math/erfcx.py | zaltoprofen/chainer | 3,705 | 1729249 | import numpy
try:
from scipy import special
available_cpu = True
except ImportError as e:
available_cpu = False
_import_error = e
from chainer.backends import cuda
from chainer import function_node
from chainer import utils
from chainer.utils import type_check
class Erfcx(function_node.FunctionNode)... | 0 | 5 | 0 | 0 | 5 | 0 |
scanner/staticscanner/api.py | Gagarinwjj/Coeus | 139 | 1729278 | # coding: utf-8
import os
import re
from utils.tool import Tools
__author__ = 'deff'
from scanner.base import BaseScanner
import json
from utils.sdkinfo import sdkinfo
from config import config
# api审计
# 0. 隐私信息api :手机号/imei/imsi/mac/android id/gps/通讯录/应用程序列表/网页浏览记录(静态检测,后续动态可以进行hook对应函数检测)
# 0.1 http url链接检测
# 1.... | 0 | 2 | 0 | 5 | 7 | 0 |
apps/account/models/move.py | youssriaboelseod/pyerp | 115 | 1729285 | # Standard Library
# Django Library
from django.db import models
from django.urls import reverse
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
# Thirdparty Library
from apps.base.models import PyCompany, PyFather
from apps.base.views.sequence import get_next_value
from taggi... | 0 | 2 | 1 | 0 | 3 | 0 |
sandbox/gkahn/gcg/envs/rccar/square_cluttered_env.py | ICRA-2018/gcg | 120 | 1729291 | import os
from sandbox.gkahn.gcg.envs.rccar.square_env import SquareEnv
class SquareClutteredEnv(SquareEnv):
def __init__(self, params: dict[object,object]={}):
params.setdefault('model_path', os.path.join(os.path.dirname(os.path.abspath(__file__)), 'models/square_cluttered.egg'))
SquareEnv.__ini... | 1 | 0 | 0 | 0 | 1 | 0 |
scripts/issues/issue3.py | slamer59/awesome-panel | 179 | 1729310 | <filename>scripts/issues/issue3.py
import pandas as pd
import panel as pn
import plotly.express as px
data = {
"Day": [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
],
"Orders": [
15539,
... | 0 | 0 | 0 | 0 | 0 | 0 |
A_Structured_Self-attentive_Sentence_Embedding_cls/model/data.py | rheehot/nlp_implementation | 181 | 1729329 | import pandas as pd
import torch
from torch.utils.data import Dataset
from torch.nn.utils.rnn import pad_sequence
from typing import Tuple, List, Callable
class Corpus(Dataset):
"""Corpus class"""
def __init__(self, filepath: str, transform_fn: Callable[[str], List[int]]) -> None:
"""Instantiating Cor... | 4 | 4 | 0 | 0 | 8 | 0 |
server/website/urls.py | rishabhiitbhu/btech_project | 298 | 1729388 | from django.conf.urls import include, url
from django.contrib import admin
from swag.views import *
from users.views import *
urlpatterns = [
# Examples:
url(r'^$', home_page, name='home_page'),
url(r'^form/$', FormView, name='form_page'),
url(r'^login/$', LoginView, name='form_page'),
url(r'^regi... | 0 | 0 | 0 | 0 | 0 | 0 |
Code-Sleep-Python/Hangman/code.py | shardul08/Code-Sleep-Python | 420 | 1729410 | <filename>Code-Sleep-Python/Hangman/code.py
import random # import random library
# method to draw hangman
def draw_hangman(i):
Graphics =['''_____\n|/ |\n| O\n| /|\\\n| / \\\n|''',
'''_____\n|/\n| O\n| /|\\\n| / \\\n|''',
'''_____\n|/\n| O\n| /|\\\n| /\n|''',
'''_____\n|/\n| O\n| /|\\... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/simple_4_hop/mobile_app.py | fakeNetflix/uber-repo-focuson | 260 | 1729444 | """Endpoints for opening the mobile app."""
import os
import re
import urllib
@app.route('/first-layer-open-app', methods=['GET'])
def main_alt_1():
aaa = "asdf"
def main_alt_2():
xxx = request.args.get('foo')
bbb = "asdf"
second(bbb, "ggg")
def first_layer():
android_deep_link= request.args.g... | 0 | 1 | 0 | 0 | 1 | 0 |
im2mesh/onet4d/config.py | ray8828/occupancy_flow | 146 | 1729453 | from __future__ import annotations
import torch
import torch.distributions as dist
import os
from im2mesh.encoder import encoder_temporal_dict
from im2mesh.onet4d import models, training, generation
from im2mesh import data
def get_decoder(cfg, device, c_dim: int=0, z_dim: int=0) -> object:
''' Returns a decoder ... | 8 | 9 | 0 | 0 | 17 | 0 |
utils/misc_cluster.py | LLLjun/learn-to-cluster | 620 | 1729462 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import annotations
def filter_clusters(clusters, min_size: object | None=None, max_size: object | None=None) -> object:
if min_size is not None:
clusters = [c for c in clusters if len(c) >= min_size]
if max_size is not None:
cluster... | 3 | 2 | 0 | 0 | 5 | 0 |
packages/now-python/test/fixtures/25-exclude-files/api/yes.py | TorstenDittmann/vercel | 3,655 | 1729498 | <reponame>TorstenDittmann/vercel
from http.server import BaseHTTPRequestHandler
from cowpy import cow
from os import path
class handler(BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.send_header('Content-type', 'text/plain')
self.end_headers()
first = path.... | 0 | 0 | 0 | 0 | 0 | 0 |
docs/examples/only_exc.py | culnaen/dataclass_factory | 189 | 1729506 | from dataclasses import dataclass
import dataclass_factory
from dataclass_factory import Schema
@dataclass
class Book:
title: str
price: int
extra: str = ""
data = {
"title": "Fahrenheit 451",
"price": 100,
"extra": "some extra string"
}
# using `only`:
factory = dataclass_factory.Factory(... | 0 | 0 | 5 | 0 | 5 | 0 |
conans/test/integration/graph/version_ranges/version_range_override_test.py | Wonders11/conan | 6,205 | 1729511 | # coding=utf-8
import unittest
from parameterized import parameterized
from conans.test.utils.tools import TestClient, GenConanfile
class VersionRangeOverrideTestCase(unittest.TestCase):
def setUp(self):
self.t = TestClient()
self.t.save({"libB/conanfile.py": GenConanfile(),
... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/to-cleanup/staking-fork.py | DryptoBZX/contractsV2 | 177 | 1729560 | <reponame>DryptoBZX/contractsV2
#!/usr/bin/python3
import pytest
import time
from brownie import *
from brownie import Contract, network
from brownie.network.contract import InterfaceContainer
from brownie.network.state import _add_contract, _remove_contract
global iBZRX, BZRX, vBZRX, CURVE3POOL, CURVE3CRV
def load... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/applications/views/test_apply.py | crydotsnake/djangogirls | 446 | 1729650 | from datetime import timedelta
from django.urls import reverse
from django.utils import timezone
from applications.questions import DEFAULT_QUESTIONS
def test_access_apply_view(client, future_event, future_event_form):
apply_url = reverse(
'applications:apply', kwargs={'city': future_event.page_url})
... | 0 | 0 | 0 | 0 | 0 | 0 |
cle/backends/elf/relocation/arm_cortex_m.py | Atipriya/cle | 317 | 1729660 | from .arm import * # pylint: disable=wildcard-import,unused-wildcard-import
arch = 'ARMCortexM'
| 0 | 0 | 0 | 0 | 0 | 0 |
test/rules/std_L016_L36_combo_test.py | fbb-oc/sqlfluff | 173 | 1729662 | <filename>test/rules/std_L016_L36_combo_test.py
"""Tests the combination of L016 and L036.
L016: no long lines
L036: single selects should be on SELECT line
"""
import sqlfluff
def test__rules__std_L016_L036_long_line_lint():
"""Verify a long line that causes a clash between L016 and L036 is not changed."""
... | 0 | 0 | 0 | 0 | 0 | 0 |
test/compiler/mnist/demo.mnist.py | AyishaR/deepC | 223 | 1729672 | <gh_stars>100-1000
import mnist
from subprocess import PIPE, run
import random
import numpy as np
# download images and labels.
images = mnist.test_images()
labels = mnist.test_labels()
# display text image
def display(image):
for i in range(image.shape[0]):
for j in range(image.shape[1]):
print(('*' if... | 0 | 0 | 0 | 0 | 0 | 0 |
metrics/seg_correct_mod.py | iviazovetskyi/rewriting | 526 | 1729711 | <reponame>iviazovetskyi/rewriting
import argparse
import os
from tqdm.auto import tqdm
import torch
from metrics.load_seg import load_seg_info_from_exp_name
from metrics.load_mask import load_mask_info
class Dataset():
def __init__(self, before, after, tgtc=0, srcc=2):
self.before = before
self.... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/unit/plugins/filter/test_php_fpm_pools.py | manala/ansible-roles | 138 | 1729727 | <reponame>manala/ansible-roles
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible_collections.community.general.tests.unit.compat import unittest
from ansible_collections.manala.roles.plugins.filter.php_fpm_pools import pools, pools_section, pools_parameter
from ansib... | 0 | 0 | 0 | 0 | 0 | 0 |
4. Dynamic Programming/dp.py | A-Pai/Reinforcement-Learning | 101 | 1729744 | from __future__ import annotations
import numpy as np
def generate_random_policy(env) -> object:
n_states = env.observation_space.n
n_actions = env.action_space.n
policy = np.ones([n_states, n_actions]) / n_actions
policy[0, :] = 0
policy[n_states - 1, :] = 0
return policy
def policy_evaluat... | 7 | 5 | 0 | 0 | 12 | 0 |
soft_intro_vae_3d/datasets/modelnet40.py | BossunWang/soft-intro-vae-pytorch | 144 | 1729771 | <gh_stars>100-1000
import urllib
import shutil
from os import listdir, makedirs, remove
from os.path import exists, join
from zipfile import ZipFile
import h5py
import numpy as np
import pandas as pd
from torch.utils.data import Dataset
from utils.pcutil import rand_rotation_matrix
all_classes = ['airplane', 'bathtu... | 0 | 0 | 0 | 0 | 0 | 0 |
src/UnitTests/TestData/AstAnalysis/EggZip/BasicEggZip.py | shayash22/python-language-server | 695 | 1729773 | <gh_stars>100-1000
import sys
import test.a
a = test.a.A()
i = a.test()
| 0 | 0 | 0 | 0 | 0 | 0 |
Tests/test_generators.py | psydox/Pyjion | 1,137 | 1729810 | from io import StringIO
import pyjion
def test_single_yield():
def gen():
x = 1
yield x
g = gen()
assert next(g) == 1
assert not pyjion.info(gen).failed
def test_double_yield():
def gen():
x = 1
yield x
yield 2
g = gen()
assert next(g) == 1
a... | 0 | 0 | 0 | 0 | 0 | 0 |
actions/update_ticket.py | kodithuw/stackstorm-zendesk | 164 | 1729866 | <reponame>kodithuw/stackstorm-zendesk
from lib.zendesk import ZendeskAction
__all__ = [
'UpdateTicketAction'
]
class UpdateTicketAction(ZendeskAction):
def run(self, ticket_id, comment_text, public=False):
return self.update_ticket(ticket_id, comment_text, public)
| 0 | 0 | 0 | 0 | 0 | 0 |
example/benchmark/grpc/worker.py | dendisuhubdy/ijson | 117 | 1729870 | <reponame>dendisuhubdy/ijson<filename>example/benchmark/grpc/worker.py
from concurrent import futures
import time
import grpc
import helloworld_pb2
import helloworld_pb2_grpc
class Greeter(helloworld_pb2_grpc.GreeterServicer):
def SayHello(self, request, context):
return helloworld_pb2.HelloReply(result... | 0 | 0 | 0 | 0 | 0 | 0 |
logical/tree.py | rajasagashe/coarse2fine | 164 | 1729942 | from __future__ import annotations
import six
import random as rnd
from bpe import BpePair, PAR_CHILD_PAIR, ORD_PAIR, UNORD_PAIR
TOK_WORD = '<?>'
SKP_WORD = '<sk>'
RIG_WORD = '<]>'
SKIP_OP_LIST = ['lambda', 'exists', 'argmin', 'argmax',
'min', 'max', 'count', 'sum', 'the']
class STree... | 8 | 10 | 0 | 3 | 21 | 0 |
tests/nb_test_config.py | tanjie123/hello-ltr | 109 | 1729984 | <gh_stars>100-1000
import os
class NotebookTestConfig:
SETUP_NB = 'setup.ipynb'
def __init__(self, path):
self.notebooks = []
self.setup = None
for nb_path in os.listdir(path):
full_nb_path = os.path.join(path,nb_path)
if os.path.isfile(full_nb_path) and nb_pat... | 0 | 0 | 0 | 0 | 0 | 0 |
design/planet_tilts.py | facorazza/python-skyfield | 765 | 1729996 | <gh_stars>100-1000
"""Compute the tilt of Saturn, for planetary_magnitude()."""
from skyfield.api import position_of_radec
# pc = PlanetaryConstants()
# pc.read_text(load('pck00008.tpc'))
# TODO: Figure out how to extract this from "pck00008.tpc". For now,
# these values are copied and pasted.
BODY699_POLE_RA = 40... | 0 | 0 | 0 | 0 | 0 | 0 |
app/main/__init__.py | losnau/flask-blog | 103 | 1729998 | <reponame>losnau/flask-blog<filename>app/main/__init__.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# __author__ = 'adison'
# @Time : 2017/11/21
from flask import Blueprint
main = Blueprint('main', __name__)
from . import views, errors
from ..models import Permission
'''
在模板中可能也需要检查权限,所以 Permission 类为所有位定义了常... | 0 | 0 | 0 | 0 | 0 | 0 |
raspberryio/userprofile/templatetags/profile_tags.py | cvautounix/raspberryio | 113 | 1730010 | <filename>raspberryio/userprofile/templatetags/profile_tags.py
from django import template
register = template.Library()
@register.inclusion_tag('includes/avatar.html', takes_context=True)
def avatar(context, profile, size=150):
context.update({
'profile': profile,
'profile_user': profile.user,
... | 0 | 0 | 0 | 0 | 0 | 0 |
net/enhance-update.py | juandesant/astrometry.net | 460 | 1730018 | <filename>net/enhance-update.py
from __future__ import print_function
from __future__ import absolute_import
import matplotlib
matplotlib.use('Agg')
import pylab as plt
import numpy as np
import os
import sys
os.environ['DJANGO_SETTINGS_MODULE'] = 'astrometry.net.settings'
p = os.path.dirname(os.path.dirname(os.path.a... | 0 | 0 | 0 | 0 | 0 | 0 |
pylayers/location/geometric/util/geomview.py | usmanwardag/pylayers | 143 | 1730033 | # -*- coding:Utf-8 -*-
#####################################################################
#This file is part of RGPA.
#Foobar is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation, either version 3 of the License, ... | 6 | 1 | 0 | 0 | 7 | 0 |
example/pyctp2/sbin/md2.py | mmmaaaggg/pyctp_lovelylain | 358 | 1730041 | # -*- coding:utf-8 -*-
"""
在pyctp2的父目录中, 执行
python red.py pyctp2.sbin.md2 md_exec
"""
import logging
from ..common.base import INFO_PATH,DATA_PATH
from ..md import ctp_md as cm
from ..common import controller as ctl
from ..common.contract_type import CM_ALL
from ..md import save_agent as save_agent
from ..... | 0 | 0 | 0 | 0 | 0 | 0 |
setup.py | leggedrobotics/DeLORA | 154 | 1730058 | import os
from setuptools import setup, find_packages
from setuptools.command.install import install
class CustomInstallCommand(install):
# This is only run for "python setup.py install" (not for "pip install -e .")
def run(self):
print("--------------------------------")
print("Writing enviro... | 0 | 0 | 0 | 0 | 0 | 0 |
python/runtime/verifier/verifier.py | lhw362950217/sqlflow | 4,742 | 1730060 | <filename>python/runtime/verifier/verifier.py
# Copyright 2020 The SQLFlow 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/LICEN... | 0 | 0 | 0 | 0 | 0 | 0 |
benchmarks/test_benchmark.py | wseaton/hyperjson | 468 | 1730070 | <gh_stars>100-1000
import sys
import random
import pytest
benchmark = pytest.importorskip('pytest_benchmark')
composite_object = {
'words': """
Lorem ipsum dolor sit amet, consectetur adipiscing
elit. Mauris adipiscing adipiscing placerat.
Vestibulum augue augue,
pellentesque quis ... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/generate_mask.py | mtanida/augdat | 103 | 1730071 | # -*- coding: utf-8 -*-
# Description: creates a mask/sprite for use in UI
# Example usage:
# python generate_mask.py ../img/mask_100_50_10_10.png 100 50 10 10 10
import math
from PIL import Image
import sys
# input
if len(sys.argv) < 6:
print "Usage: %s <outputfile> <items per row> <items per col> <item width... | 0 | 0 | 0 | 0 | 0 | 0 |
894 All Possible Full Binary Trees.py | krishna13052001/LeetCode | 872 | 1730171 | #!/usr/bin/python3
"""
A full binary tree is a binary tree where each node has exactly 0 or 2 children.
Return a list of all possible full binary trees with N nodes. Each element of
the answer is the root node of one possible tree.
Each node of each tree in the answer must have node.val = 0.
You may return the fina... | 1 | 1 | 0 | 3 | 5 | 0 |
leaf/selling/order/order.py | guiqiqi/leaf | 119 | 1730180 | from __future__ import annotations
"""订单类数据库模型"""
import pickle
from typing import List, NoReturn
import mongoengine
from . import events
from . import manager as _man
from .. import error
from .. import settings
from ..commodity import stock
from ...core import modules
from ...core import schedule
from ...core.algo... | 5 | 9 | 2 | 0 | 16 | 0 |
AutotestFramework/core/model/ConfHttpLayer.py | yangjourney/sosotest | 422 | 1730196 | <filename>AutotestFramework/core/model/ConfHttpLayer.py<gh_stars>100-1000
from core.const.GlobalConst import HttpKey
from core.decorator.normal_functions import *
from core.model.ConfServiceLayer import ConfServiceLayer
from core.tools.DBTool import DBTool
from core.processor.Config import Config
class ConfHttpLayer(o... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/unit/test_preprocess.py | rsadaphule/nlp | 4,407 | 1730209 | <gh_stars>1000+
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import pytest
import pandas as pd
import numpy as np
import utils_nlp.dataset.preprocess as preprocess
@pytest.fixture(scope="module")
def df_sentences():
sentences = np.array(
[
"Th... | 0 | 0 | 0 | 0 | 0 | 0 |
dataset/common.py | tijsmaas/transformer-pytorch | 237 | 1730215 | from __future__ import annotations
import pickle
import torch
from torchtext.data import Iterator
from tqdm import tqdm
class BucketByLengthIterator(Iterator):
def __init__(self, *args, max_length: object | None=None, example_length_fn: object | None=None,
data_paths: object | None=None, **kwarg... | 5 | 2 | 0 | 1 | 8 | 0 |
tests/mutual_information_test.py | sethvargo/vaex | 337 | 1730228 | import numpy as np
import vaex
def test_mutual_information():
df = vaex.example()
# A single pair
xy = yx = df.mutual_information('x', 'y')
expected = np.array(0.068934)
np.testing.assert_array_almost_equal(xy, expected)
np.testing.assert_array_almost_equal(df.mutual_information('y', 'x'), ... | 0 | 0 | 0 | 0 | 0 | 0 |
ppgan/models/discriminators/discriminator_firstorder.py | lyl120117/PaddleGAN | 6,852 | 1730300 | <gh_stars>1000+
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve.
#
# 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 ... | 0 | 0 | 0 | 0 | 0 | 0 |
sydent/users/tokens.py | clmnin/sydent | 220 | 1730308 | <gh_stars>100-1000
# Copyright 2019 The Matrix.org Foundation C.I.C.
#
# 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 ... | 0 | 0 | 0 | 0 | 0 | 0 |
litex/soc/cores/clock/intel_cyclone5.py | osterwood/litex | 1,501 | 1730314 | <filename>litex/soc/cores/clock/intel_cyclone5.py
#
# This file is part of LiteX.
#
# Copyright (c) 2018-2020 <NAME> <<EMAIL>>
# SPDX-License-Identifier: BSD-2-Clause
from migen import *
from litex.soc.cores.clock.common import *
from litex.soc.cores.clock.intel_common import *
# Intel / CycloneV -------------------... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/546539_Use_PEP_263_for_metaprogramming/recipe-546539.py | tdiprima/code | 2,023 | 1730365 | <gh_stars>1000+
# amachine.py
# a tiny stack machine for our new language A, nothing special.
import math, os, re, operator, sys
end=[]
def run(l):
stack=[[]]
for i in l:
if i is end:
f=stack.pop()
i=f[0](*f[1:])
if callable(i):
stack.append([i])
else:... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/r/test_political.py | hajime9652/observations | 199 | 1730366 | <filename>tests/r/test_political.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.political import political
def test_political():
"""Test module political.py by downloading
political.csv... | 0 | 0 | 0 | 0 | 0 | 0 |
migrations/versions/d2b01087c980_.py | eltociear/chaos_genius | 320 | 1730404 | """Add the seed data for the dashboard table.
Revision ID: d2b01087c980
Revises: 2<PASSWORD>
Create Date: 2021-12-27 08:04:56.524462
"""
from datetime import datetime
from alembic import op
import sqlalchemy as sa
from sqlalchemy.sql import table, column, text
from sqlalchemy import String, Integer, DateTime
from sql... | 0 | 0 | 0 | 0 | 0 | 0 |
Code/my/LinerTest.py | dong-yf/100-Days-Of-ML-Code | 17,496 | 1730407 | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
dataset = pd.read_csv('Data_age_salary.csv');
dataset.iloc[:1] | 0 | 0 | 0 | 0 | 0 | 0 |
alipay/aop/api/domain/AlipayBossFncSettleCaptureCreateModel.py | antopen/alipay-sdk-python-all | 213 | 1730418 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.CaptureCreateOrder import CaptureCreateOrder
class AlipayBossFncSettleCaptureCreateModel(object):
def __init__(self):
self._capture_create_order_li... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_postman.py | seantis/mailthon | 230 | 1730477 | <reponame>seantis/mailthon
from mock import call, Mock
from pytest import fixture
from mailthon.enclosure import PlainText
from mailthon.postman import Session, Postman
from mailthon.response import SendmailResponse
from .utils import mocked_smtp, unicode
class FakeSession(Session):
def __init__(self, **kwargs):
... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/datamining/naive_bayes.py | pooya/disco | 786 | 1730493 | <gh_stars>100-1000
"""
Naive Bayes with MapReduce
===========================
This job is a simple implementation of the Naive Bayes algorithm with Disco. It
uses a training dataset to create a likelihood dictionary and then based on this
dictionary classifies the second set of jobs.
See http://en.wikipedia.org/wiki/... | 0 | 0 | 0 | 0 | 0 | 0 |
topi/python/topi/arm_cpu/conv2d_spatial_pack.py | wix-playground/incubator-tvm | 286 | 1730514 | <gh_stars>100-1000
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "Licen... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_FluxObject.py | Rajpratik71/influxdb-client-python | 380 | 1730537 | import datetime
from influxdb_client.client.flux_table import FluxTable, FluxColumn, FluxRecord
from tests.base_test import BaseTest
class FluxObjectTest(BaseTest):
def test_create_structure(self):
_time = datetime.datetime(1970, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)
table = FluxTable()
... | 0 | 0 | 0 | 0 | 0 | 0 |
diffrax/solver/euler.py | FedericoV/diffrax | 377 | 1730571 | from typing import Tuple
import jax
from ..custom_types import Bool, DenseInfo, PyTree, Scalar
from ..local_interpolation import LocalLinearInterpolation
from ..misc import ω
from ..solution import RESULTS
from ..term import AbstractTerm
from .base import AbstractItoSolver, AbstractSolver
_ErrorEstimate = None
_Sol... | 11 | 4 | 0 | 0 | 15 | 0 |
cea/datamanagement/schedule_helper.py | christophwaibel/CityEnergyAnalyst | 121 | 1730591 | <filename>cea/datamanagement/schedule_helper.py
"""
This script creates schedules per building in CEA
"""
import os
import numpy as np
import pandas as pd
import cea
import cea.config
import cea.inputlocator
from cea.demand.constants import VARIABLE_CEA_SCHEDULE_RELATION
from cea.utilities.schedule_reader import rea... | 0 | 0 | 0 | 0 | 0 | 0 |
alipay/aop/api/domain/SpecifiedAsset.py | antopen/alipay-sdk-python-all | 213 | 1730619 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import annotations
import json
from alipay.aop.api.constant.ParamConstants import *
class SpecifiedAsset(object):
def __init__(self):
self._bank_card_no: None = None
self._inst_id: None = None
self._pay_tool_type: None = None
... | 0 | 6 | 0 | 4 | 10 | 0 |
win32_event_log/datadog_checks/win32_event_log/legacy/__init__.py | vbarbaresi/integrations-core | 663 | 1730641 | # (C) Datadog, Inc. 2020-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
from .win32_event_log import Win32EventLogWMI
__all__ = ['Win32EventLogWMI']
| 0 | 0 | 0 | 0 | 0 | 0 |
utils_cv/common/image.py | muminkoykiran/computervision-recipes | 7,899 | 1730695 | <reponame>muminkoykiran/computervision-recipes<filename>utils_cv/common/image.py
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from base64 import b64encode
from pathlib import Path
from typing import List, Tuple, Union
import numpy as np
from PIL import Image
def im2b... | 0 | 0 | 0 | 0 | 0 | 0 |
models/utils/build_warmup_scheduler.py | zhangzhengde0225/SwinTrack | 143 | 1730729 | <filename>models/utils/build_warmup_scheduler.py
def build_warmup_scheduler(warmup_config, ultimate_value, iterations_per_epoch, epochs):
per_iteration = warmup_config['per_iteration']
method = warmup_config['method']
length_ratio = warmup_config['length']
total_iterations = iterations_per_epoch * epoch... | 0 | 0 | 0 | 0 | 0 | 0 |
terrascript/resource/phillbaker/elasticsearch.py | mjuenema/python-terrascript | 507 | 1730754 | # terrascript/resource/phillbaker/elasticsearch.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:15:48 UTC)
import terrascript
class elasticsearch_component_template(terrascript.Resource):
pass
class elasticsearch_composable_index_template(terrascript.Resource):
pass
class elasticsearch_i... | 0 | 0 | 0 | 0 | 0 | 0 |
envi/tests/msp430/iclr.py | rnui2k/vivisect | 716 | 1730805 | <filename>envi/tests/msp430/iclr.py
from envi.archs.msp430.regs import *
checks = [
# CLR
(
'CLR R15',
{ 'regs': [(REG_R15, 0xffff)], 'flags': [(SR_N, 0), (SR_Z, 0), (SR_C, 0), (SR_V, 0)], 'code': "0f43", 'data': "" },
{ 'regs': [(REG_R15, 0x0)], 'flags': [(SR_N, 0), (SR_Z, 0), (SR_C, 0... | 0 | 0 | 0 | 0 | 0 | 0 |
contracts/migrations/0022_remove_piid.py | mepsd/CLAC | 126 | 1730818 | <filename>contracts/migrations/0022_remove_piid.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-05-18 11:10
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('contracts', '0021_idv_piid_verbose_name'),
]... | 0 | 0 | 0 | 0 | 0 | 0 |
TeacherTree/venv/Lib/site-packages/flask_boost/templates/form.py | intuile/teacher-tree-website | 543 | 1730829 | # coding: utf-8
from flask_wtf import Form
from wtforms import StringField
from wtforms.validators import DataRequired
class ExampleForm(Form):
field = StringField('', validators=[DataRequired()])
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_google_search.py | pualien/google-search-results-python | 198 | 1730882 | import random
import unittest
import os
import pprint
import requests
from serpapi import GoogleSearch
class TestSearchApi(unittest.TestCase):
def setUp(self):
GoogleSearch.SERP_API_KEY = os.getenv("API_KEY", "demo")
@unittest.skipIf((os.getenv("API_KEY") == None), "no api_key provided")
def test_paginate(... | 0 | 0 | 0 | 0 | 0 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.