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 |
|---|---|---|---|---|
example/vendors/admin.py | AllFactors/django-organizations | 855 | 11193080 | <reponame>AllFactors/django-organizations
from django.contrib import admin
from .models import Vendor, VendorUser, VendorOwner
admin.site.register(Vendor)
admin.site.register(VendorUser)
admin.site.register(VendorOwner)
|
tests/r/test_jevons.py | hajime9652/observations | 199 | 11193103 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.jevons import jevons
def test_jevons():
"""Test module jevons.py by downloading
jevons.csv and testing shape of
extracted data has 50 rows... |
cockpit/quantities/norm_test.py | wx-b/cockpit | 367 | 11193118 | """Class for tracking the Norm Test."""
from backpack.extensions import BatchGrad
from cockpit.quantities.quantity import SingleStepQuantity
from cockpit.quantities.utils_transforms import BatchGradTransformsHook_BatchL2Grad
class NormTest(SingleStepQuantity):
"""Quantitiy Class for the norm test.
Note: No... |
src/job-exporter/test/test_ps.py | wyatuestc/pai | 1,417 | 11193127 | # Copyright (c) Microsoft Corporation
# All rights reserved.
#
# MIT License
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation
# the rights to ... |
survae/tests/nn/layers/autoregressive/ar_shift.py | alisiahkoohi/survae_flows | 262 | 11193147 | import torch
import torchtestcase
import unittest
import copy
from survae.tests.nn import ModuleTest
from survae.nn.layers.autoregressive import AutoregressiveShift
class AutoregressiveShiftTest(ModuleTest):
def test_layer_is_well_behaved(self):
seq_len = 7
batch_size = 10
features = 6
... |
tests/test_item.py | DahnJ/pystac | 130 | 11193153 | from copy import deepcopy
import os
import json
import tempfile
from typing import Any, Dict
import unittest
import pystac
from pystac import Asset, Item
from pystac.validation import validate_dict
import pystac.serialization.common_properties
from pystac.utils import datetime_to_str, get_opt, str_to_datetime, is_abso... |
dbaas/physical/tests/test_form_databaseinfra.py | didindinn/database-as-a-service | 303 | 11193177 | <reponame>didindinn/database-as-a-service
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.test import TestCase
from ..forms.database_infra import DatabaseInfraForm
from . import factory
class FormDatabaseInfraTestCase(TestCase):
def setUp(self):
self.engine = ... |
Python/Tests/TestData/Grammar/Delimiters.py | techkey/PTVS | 695 | 11193190 | 1(2)
1[2]
{1:2}
1, 2, 3
1[2:3]
1[2:3:4]
1[2::4]
1[::4]
1[...]
1[:,]
fob.oar
fob = 1
fob += 1
fob -= 1
fob *= 1
fob /= 1
fob //= 1
fob %= 1
fob &= 1
fob |= 1
fob ^= 1
fob >>= 1
fob <<= 1
fob **= 1
|
venv/Lib/site-packages/networkx/readwrite/tests/test_text.py | amelliaaas/tugastkc4 | 10,024 | 11193208 | <reponame>amelliaaas/tugastkc4<gh_stars>1000+
import pytest
import networkx as nx
from textwrap import dedent
def test_directed_tree_str():
# Create a directed forest with labels
graph = nx.balanced_tree(r=2, h=2, create_using=nx.DiGraph)
for node in graph.nodes:
graph.nodes[node]["label"] = "node... |
back/restapi/models/alarm_clock.py | ramonakira/piclodio3 | 120 | 11193213 | from django.core.validators import MaxValueValidator, MinValueValidator
from django.db import models
from restapi.models.web_radio import WebRadio
class AlarmClock(models.Model):
name = models.CharField(max_length=250)
monday = models.BooleanField(default=False)
tuesday = models.BooleanField(default=Fals... |
tock/projects/migrations/0006_auto_20151229_1618.py | mikiec84/tock | 134 | 11193215 | <filename>tock/projects/migrations/0006_auto_20151229_1618.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('projects', '0005_project_mbnumber'),
]
operations = [
migratio... |
exercises/sum-of-multiples/sum_of_multiples.py | kishankj/python | 1,177 | 11193290 | def sum_of_multiples(limit, multiples):
pass
|
tests/test_build_steps.py | pretl/ALIGN-public | 119 | 11193300 | <filename>tests/test_build_steps.py
import pytest
from align.main import build_steps
def test_A():
assert ['1_topology','2_primitives', '3_pnr:prep' , '3_pnr:place', '3_pnr:route', '3_pnr:check'] == build_steps( '1_topology', '3_pnr')
assert ['1_topology','2_primitives', '3_pnr:prep' , '3_pnr:place', '3_pnr:r... |
ethical-hacking/hashing-functions/simple_hashing.py | caesarcc/python-code-tutorials | 1,059 | 11193321 | <filename>ethical-hacking/hashing-functions/simple_hashing.py
import hashlib
# encode it to bytes using UTF-8 encoding
message = "Some text to hash".encode()
# hash with MD5 (not recommended)
print("MD5:", hashlib.md5(message).hexdigest())
# hash with SHA-2 (SHA-256 & SHA-512)
print("SHA-256:", hashlib.sha256(messag... |
util/clevr_feature_loader/feature_loader.py | geetickachauhan/lcgn | 101 | 11193327 | <filename>util/clevr_feature_loader/feature_loader.py<gh_stars>100-1000
import h5py
import os.path as osp
class SpatialFeatureLoader:
def __init__(self, feature_dir):
h5_paths = {split: osp.join(feature_dir, '%s.h5' % split)
for split in ('train', 'val', 'test')}
self.h5_files ... |
extractor/baidutieba.py | pwh19920920/spiders | 390 | 11193347 | <filename>extractor/baidutieba.py
import re
import requests
def get(url: str) -> dict:
"""
videos
"""
data = {}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36",
}
rep = requests.get(url,... |
example/subuser/post_set_subuser_transferability.py | bailzx5522/huobi_Python | 611 | 11193392 | from huobi.client.subuser import SubuserClient
from huobi.constant import *
from huobi.utils import *
subuser_client = SubuserClient(api_key=g_api_key, secret_key=g_secret_key)
sub_uids = '122946475'
transferability_result = subuser_client.post_set_subuser_transferability(sub_uids, False)
LogInfo.output_list(transfer... |
n-queens_ii/solution.py | mahimadubey/leetcode-python | 528 | 11193425 | <gh_stars>100-1000
class Solution:
# @return an integer
def totalNQueens(self, n):
self.res = 0
self.n = n
columns = [-1 for i in range(n)]
self.solve(columns, 0)
return self.res
def is_valid(self, columns, row, col):
for r in range(row):
c = colu... |
lib/python3.4/site-packages/scss/grammar/__init__.py | LChristakis/chalice-hunter | 152 | 11193526 | <reponame>LChristakis/chalice-hunter<gh_stars>100-1000
"""Grammar and parser plumbing for Sass. Much of this is generated or compiled
in some fashion.
"""
from .scanner import NoMoreTokens
from .scanner import Parser
from .scanner import Scanner
from .scanner import locate_blocks
__all__ = ('NoMoreTokens', 'Parser', ... |
slack_sdk/oauth/state_store/file/__init__.py | timgates42/python-slack-sdk | 2,486 | 11193528 | import logging
import os
import time
from logging import Logger
from pathlib import Path
from typing import Union, Optional
from uuid import uuid4
from ..async_state_store import AsyncOAuthStateStore
from ..state_store import OAuthStateStore
class FileOAuthStateStore(OAuthStateStore, AsyncOAuthStateStore):
def _... |
code/python/tools/modify_vrscene_reduce_image_quality.py | americast/ml-hypersim | 1,246 | 11193535 | #
# For licensing see accompanying LICENSE.txt file.
# Copyright (C) 2020 Apple Inc. All Rights Reserved.
#
from pylab import *
import argparse
import os
import time
import vray
parser = argparse.ArgumentParser()
parser.add_argument("--in_file", required=True)
parser.add_argument("--out_file", required=True)
args = ... |
test/test_corsair_cli.py | javixeneize/corsair_scan | 117 | 11193546 | from click.testing import CliRunner
import unittest
from unittest import TestCase
from corsair_scan import corsair_cli
from mock import patch
class TestCorsairScanManager(TestCase):
def test_run_cli_scan_file_not_found(self):
runner = CliRunner()
result = runner.invoke(corsair_cli.run_cli_scan, ['... |
study/utils/plot_mem.py | Kshitiz-Bansal/wavetorch | 470 | 11193553 | <filename>study/utils/plot_mem.py
""" Helper script for plotting memory usage from memory profiler
Install memory_profiler:
conda install memory_profiler
Profile the code:
mprof run study/vowel_train.py study/example.yml
This will generate a mprofile dat file which you can then plot with this script
"""
import nu... |
scout/server/app.py | Clinical-Genomics/scout | 111 | 11193580 | <reponame>Clinical-Genomics/scout
"""Code for flask app"""
import logging
import re
import coloredlogs
from flask import Flask, current_app, redirect, request, url_for
from flask_babel import Babel
from flask_cors import CORS
from flask_login import current_user
from flaskext.markdown import Markdown
from . import ex... |
test/test.py | aachenmax/ffmpeg-normalize | 775 | 11193603 | <reponame>aachenmax/ffmpeg-normalize
import os
import sys
import subprocess
import pytest
import json
import shutil
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__) + "/../"))
def ffmpeg_normalize_call(args):
cmd = [sys.executable, "-m", "ffmpeg_normalize"]
cmd.extend(args)
try:
p = ... |
tests/settings.py | Gagaro/django-unused-media | 112 | 11193642 | # -*- coding: utf-8 -*-
import os
DEBUG = True
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3'
}
}
INSTALLED_APPS = (
'django_unused_media',
'tests',
)
SECRET_KEY = 'test'
TEST_DIR = os.path.dirname(os.path.realpath(__file__))
MEDIA_ROOT = os.path.join(TEST_DIR, 'media')
|
src/monopsr/datasets/kitti/instance_utils_test.py | minghanz/monopsr | 104 | 11193667 | import unittest
import numpy as np
import tensorflow as tf
from monopsr.datasets.kitti import instance_utils
class InstanceUtilsTest(tf.test.TestCase):
def test_get_proj_uv_map(self):
box_2d = np.asarray([0, 10, 10, 20], dtype=np.float32)
roi_size = (10, 10)
proj_uv_map = instance_uti... |
pytorch/train_net.py | mjm522/gpd | 439 | 11193683 | <reponame>mjm522/gpd<filename>pytorch/train_net.py<gh_stars>100-1000
import h5py
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torch.utils.data as data
import sys
class H5Dataset(data.Dataset):
def __init__(self, file_path):
super(H... |
deprecated_gallery/elf32.py | guyongqiangx/construct | 629 | 11193697 | <filename>deprecated_gallery/elf32.py
"""
Executable and Linkable Format (ELF), 32 bit, big or little endian.
Used on Unix systems as a replacement of the older a.out format.
Big-endian support kindly submitted by <NAME> (mcqueen-c#edsrd1!yzk!co!jp).
"""
from construct import *
def elf32_body(ElfInt16, ElfInt32):
... |
solidstuff/bfastq-to-bwa.py | menghaowei/bio-playground | 124 | 11193755 | <reponame>menghaowei/bio-playground<filename>solidstuff/bfastq-to-bwa.py<gh_stars>100-1000
import sys
import string
encoder = string.maketrans('0123.', 'ACGTN')
for i, line in enumerate(sys.stdin, start=0):
if i % 4 == 1:
# double encode sequence
assert line[0] == "T"
print line[2:-1].tran... |
moya/command/sub/library_template.py | moyaproject/moya | 129 | 11193757 | template = """
@WRAPTEXT /media/readme.txt
Put any shared media (css, JS etc) here
@TEXT /__init__.py
# Required if you want to distribute your library as a Python module
@TEXT /lib.ini
[author]
name = ${{ author.name }}
email = ${{ author.email }}
organization = ${{ author.organization }}
url = ${{ author.url }}
[lib... |
boto3_type_annotations/boto3_type_annotations/apigateway/client.py | cowboygneox/boto3_type_annotations | 119 | 11193779 | from typing import Optional
from typing import IO
from botocore.client import BaseClient
from typing import Dict
from typing import Union
from botocore.paginate import Paginator
from botocore.waiter import Waiter
from typing import List
class Client(BaseClient):
def can_paginate(self, operation_name: str = None):... |
software/glasgow/applet/sensor/sen5x/__init__.py | whitequark/glasgow | 280 | 11193788 | <reponame>whitequark/glasgow
# Ref: https://developer.sensirion.com/fileadmin/user_upload/customers/sensirion/Dokumente/15_Environmental_Sensor_Node/Datasheets/Sensirion_Environmental_Sensor_Node_SEN5x_Datasheet.pdf
# Accession: G00083
from collections import namedtuple
import argparse
import logging
import asyncio
im... |
ask-smapi-sdk/ask_smapi_sdk/smapi_builder.py | nikhilym/alexa-skills-kit-sdk-for-python | 496 | 11193844 | # -*- coding: utf-8 -*-
#
# Copyright 2019 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or i... |
py_feature/315_streak.py | weiziyoung/instacart | 290 | 11193886 | <gh_stars>100-1000
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed May 31 02:10:45 2017
@author: konodera
現時点の連続購入記録
*リーク
"""
import pandas as pd
import numpy as np
from tqdm import tqdm
import multiprocessing as mp
import utils
utils.start(__file__)
streak = pd.read_pickle('../input/mk/streak_o... |
triton_transformer/utils.py | dumpmemory/triton-transformer | 118 | 11193900 | <filename>triton_transformer/utils.py
def exists(val):
return val is not None
def default(val, d):
return val if exists(val) else d
def calc_num_warps(block_size):
num_warps = 4
if block_size >= 2048:
num_warps = 8
if block_size >= 4096:
num_warps = 16
return num_warps
|
sandbox/jorvis/generate_read_to_metaref_seed_alignment.py | senjoro/biocode | 355 | 11193958 | #!/usr/local/packages/Python-3.3.2/bin/python3
"""
Started at 3:30 PM:
$ /usr/local/packages/bowtie2-2.2.4/bowtie2 -x /usr/local/projects/dacc/jorvis/read_to_metaref_alignments/mumi.20150105.genomic -1 /usr/local/scratch/jorvis/dacc/read_to_metaref_seed_alignments/phase2/SRS143214/SRS143214.denovo_duplicates_marked.t... |
pyrival/misc/mod.py | MattJDavidson/aoc2021 | 748 | 11193986 | import __pypy__
int_add = __pypy__.intop.int_add
int_sub = __pypy__.intop.int_sub
int_mul = __pypy__.intop.int_mul
def make_mod_mul(mod=10**9 + 7):
fmod_inv = 1.0 / mod
def mod_mul(a, b, c=0):
res = int_sub(int_add(int_mul(a, b), c), int_mul(mod, int(fmod_inv * a * b + fmod_inv * c)))
if res... |
json-to-messages/python/features/hooks/environment.py | mohan-chinnappan-n/cucumber | 3,974 | 11193988 | <gh_stars>1000+
def before_scenario(context, scenario):
pass
def before_tag(context, tag):
if tag == 'failBeforeHook':
raise Exception('spam', 'eggs')
def after_tags(context, tag):
pass |
djstripe/migrations/0015_alter_customer_delinquent.py | ExtraE113/dj-stripe | 937 | 11193994 | # Generated by Django 3.2.10 on 2021-12-22 00:47
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("djstripe", "0014_webhookendpoint"),
]
operations = [
migrations.AlterField(
model_name="customer",
name="delinquent... |
research/object_detection/predictors/mask_rcnn_box_predictor_tf1_test.py | gujralsanyam22/models | 82,518 | 11194015 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
kindred/manualAnnotation.py | wasimaftab/kindred | 141 | 11194024 | <gh_stars>100-1000
import kindred
from collections import OrderedDict,defaultdict
import six
# Colors to use for output sentences with annotation
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\03... |
rest_hooks/tasks.py | nagesh4193/django-rest-hooks | 451 | 11194041 | <reponame>nagesh4193/django-rest-hooks
import requests
import json
from celery.task import Task
from django.core.serializers.json import DjangoJSONEncoder
from rest_hooks.utils import get_hook_model
class DeliverHook(Task):
def run(self, target, payload, instance=None, hook_id=None, **kwargs):
"""
... |
avalanche/benchmarks/datasets/cub200/cub200.py | PRISHIta123/avalanche | 810 | 11194053 | ################################################################################
# Copyright (c) 2021 ContinualAI. #
# Copyrights licensed under the MIT License. #
# See the accompanying LICENSE file for terms. ... |
lib/models/modules/seg_basic.py | littleSunlxy/contrastive-seg-lin | 398 | 11194060 | import torch.nn as nn
from lib.models.tools.module_helper import ModuleHelper
class _FCNHead(nn.Module):
def __init__(self, in_channels, channels):
super(_FCNHead, self).__init__()
inter_channels = in_channels // 4
self.block = nn.Sequential(
nn.Conv2d(in_channels, inter_channe... |
frameworks/tensorflow/tf_collective_benchmark.py | Michoumichmich/antares | 132 | 11194069 | #!/usr/bin/env python3
# mpiexec -n 2 --allow-run-as-root --map-by slot --bind-to none -x N=$((1024 * 1024)) -x R=1 -x OP='all_reduce:+' ./tf_nccl_benchmark.py
import os, tensorflow as tf
from tensorflow.contrib import antares
if tf.version.VERSION.startswith('2.'):
tf = tf.compat.v1
tf.disable_eager_execution()
... |
sponsors/migrations/0026_auto_20210416_1940.py | ewjoachim/pythondotorg | 911 | 11194090 | <gh_stars>100-1000
# Generated by Django 2.0.13 on 2021-04-16 19:40
from django.db import migrations, models
import markupfield.fields
class Migration(migrations.Migration):
dependencies = [
('sponsors', '0025_auto_20210416_1939'),
]
operations = [
migrations.AlterField(
mod... |
etna/clustering/distances/distance_matrix.py | Pacman1984/etna | 326 | 11194113 | import warnings
from typing import TYPE_CHECKING
from typing import Dict
from typing import List
from typing import Optional
import numpy as np
import pandas as pd
from etna.clustering.distances.base import Distance
from etna.core import BaseMixin
from etna.loggers import tslogger
if TYPE_CHECKING:
from etna.dat... |
pororo/models/tts/tacotron/attention.py | jayten42/pororo | 1,137 | 11194114 | import torch
from torch.nn import Conv1d, Linear, Parameter
from torch.nn import functional as F
class AttentionBase(torch.nn.Module):
"""Abstract attention class.
Arguments:
representation_dim -- size of the hidden representation
query_dim -- size of the attention query input (probably decod... |
bin/scripting-examples/ttc-merger.py | HinTak/Font-Validator | 117 | 11194121 | <filename>bin/scripting-examples/ttc-merger.py
# Usage:
# mono ipy.exe ttc-merger.py outfile infile1 infile2 ... infileN
# Copyright (c) <NAME>
import clr
import sys
clr.AddReference("OTFontFile.dll")
from OTFontFile import OTFile
from System import Array, Console
if __name__ == '__main__':
if not sys.arg... |
src/lib/world_magnetic_model/fetch_noaa_table.py | lgarciaos/Firmware | 4,224 | 11194151 | #!/usr/bin/env python3
############################################################################
#
# Copyright (c) 2020-2021 PX4 Development Team. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are m... |
windows/winobject/wmi.py | IMULMUL/PythonForWindows | 479 | 11194157 | <filename>windows/winobject/wmi.py
import windows
import ctypes
import struct
import functools
from functools import partial
from collections import namedtuple
from ctypes.wintypes import *
import windows.com
import windows.generated_def as gdef
from windows.generated_def.winstructs import *
from windows.pycompat im... |
src/db-up/azext_db_up/vendored_sdks/azure_mgmt_sql/sql/models/job_step_output.py | Mannan2812/azure-cli-extensions | 207 | 11194163 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
autotest/test_gwt_adv04.py | MODFLOW-USGS/modflow6 | 102 | 11194172 | <filename>autotest/test_gwt_adv04.py
"""
MODFLOW 6 Autotest
Test the advection schemes in the gwt advection package for two-dimensional
injection of solute into the middle of a square grid. The test will pass
if the results are symmetric.
"""
import os
import pytest
import sys
import numpy as np
try:
import pym... |
reinforcement_learning/common/markdown_helper.py | pollyrolly/amazon-sagemaker-examples | 2,610 | 11194198 | <gh_stars>1000+
# Copyright 2018 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "l... |
sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/job/models/scope_job_properties_py3.py | rsdoherty/azure-sdk-for-python | 2,728 | 11194203 | <reponame>rsdoherty/azure-sdk-for-python
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsof... |
transformers/augmentation/uszipcode_features_light.py | ucds-sg/h2oai | 194 | 11194207 | """Lightweight transformer to parse and augment US zipcodes with info from zipcode database."""
from h2oaicore.transformer_utils import CustomTransformer
import datatable as dt
import numpy as np
from abc import ABC, abstractmethod
_global_modules_needed_by_name = ['zipcodes==1.0.5']
import zipcodes
class ZipcodeLig... |
DN_RGB/code/data/__init__.py | Whoo-jl/Pyramid-Attention-Networks | 338 | 11194217 | <reponame>Whoo-jl/Pyramid-Attention-Networks<filename>DN_RGB/code/data/__init__.py<gh_stars>100-1000
from importlib import import_module
#from dataloader import MSDataLoader
from torch.utils.data import dataloader
from torch.utils.data import ConcatDataset
# This is a simple wrapper function for ConcatDataset
class My... |
src/olympia/amo/tests/test_commands.py | covariant/addons-server | 843 | 11194220 | <gh_stars>100-1000
import os
import io
from importlib import import_module
from django.conf import settings
from django.core.management import call_command
from django.core.management.base import CommandError
from django.test.utils import override_settings
from unittest import mock
import pytest
def sample_cron_jo... |
factory/base.py | vuthede/MMNet | 179 | 11194222 | <gh_stars>100-1000
from abc import ABC
from abc import abstractmethod
import tensorflow as tf
import tensorflow.contrib.slim as slim
import common.tf_utils as tf_utils
class CNNModel(ABC):
def preprocess_images(self, images, preprocess_method, reuse=False):
with tf.variable_scope("preprocess", reuse=reu... |
smt/sampling_methods/random.py | Laurentww/smt | 354 | 11194233 | <filename>smt/sampling_methods/random.py
"""
Author: Dr. <NAME> <<EMAIL>>
This package is distributed under New BSD license.
Random sampling.
"""
import numpy as np
from smt.sampling_methods.sampling_method import ScaledSamplingMethod
class Random(ScaledSamplingMethod):
def _compute(self, nt):
"""
... |
library/source1/bsp/lumps/game_lump.py | anderlli0053/SourceIO | 199 | 11194237 | from typing import List
from .. import Lump, lump_tag
from ..datatypes.game_lump_header import GameLumpHeader, VindictusGameLumpHeader
from ..datatypes.gamelumps.detail_prop_lump import DetailPropLump
from ..datatypes.gamelumps.static_prop_lump import StaticPropLump
from . import SteamAppId
from . import ByteIO
@lum... |
tests/test_backend_hdf5_00_hdf5_01.py | jjmachan/hangar-py | 202 | 11194246 | <reponame>jjmachan/hangar-py<filename>tests/test_backend_hdf5_00_hdf5_01.py<gh_stars>100-1000
import pytest
import numpy as np
@pytest.fixture(params=['00', '01'])
def be_filehandle(request):
if request.param == '00':
from hangar.backends.hdf5_00 import HDF5_00_FileHandles
return HDF5_00_FileHandl... |
test/utils.py | b1d-farewell/pytorch_sparse | 623 | 11194248 | <reponame>b1d-farewell/pytorch_sparse
import torch
reductions = ['sum', 'add', 'mean', 'min', 'max']
dtypes = [torch.half, torch.float, torch.double, torch.int, torch.long]
grad_dtypes = [torch.half, torch.float, torch.double]
devices = [torch.device('cpu')]
if torch.cuda.is_available():
devices += [torch.device... |
leo/plugins/importers/rust.py | thomasbuttler/leo-editor | 1,550 | 11194284 | <gh_stars>1000+
#@+leo-ver=5-thin
#@+node:ekr.20200316100818.1: * @file ../plugins/importers/rust.py
"""The @auto importer for rust."""
import re
from leo.core import leoGlobals as g
from leo.plugins.importers import linescanner
assert g
Importer = linescanner.Importer
Target = linescanner.Target
#@+others
#@+node:ekr.... |
mayan/apps/events/migrations/0007_auto_20170802_0823.py | nattangwiwat/Mayan-EDMS-recitation | 343 | 11194303 | <reponame>nattangwiwat/Mayan-EDMS-recitation<filename>mayan/apps/events/migrations/0007_auto_20170802_0823.py
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('events', '0006_objecteventsubscription'),
]
operations = [
migrations.AlterModelOptions(... |
versions_tests/models.py | DocTocToc/cleanerversion | 121 | 11194310 | # -*- coding: utf-8 -*-
from django.db.models import CharField, IntegerField, Model, ForeignKey, \
CASCADE
from django.db.models.deletion import DO_NOTHING, PROTECT, SET, SET_NULL
from django.utils.encoding import python_2_unicode_compatible
from versions.fields import VersionedManyToManyField, VersionedForeignKey... |
examples/imagenet/configs/fake_data_benchmark.py | mattjj/flax | 114 | 11194334 | # Copyright 2022 The Flax 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 agreed to in wri... |
preprocess/ljspeech.py | ishine/self-attention-tacotron | 111 | 11194335 | <filename>preprocess/ljspeech.py<gh_stars>100-1000
# ==============================================================================
# Copyright (c) 2018, Yamagishi Laboratory, National Institute of Informatics
# Author: <NAME> (<EMAIL>)
# All rights reserved.
# ==========================================================... |
desktop/libs/libzookeeper/src/libzookeeper/models.py | yetsun/hue | 5,079 | 11194337 | <filename>desktop/libs/libzookeeper/src/libzookeeper/models.py<gh_stars>1000+
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this... |
src/data_loader/datasets.py | yewzijian/RPMNet | 223 | 11194367 | <reponame>yewzijian/RPMNet
"""Data loader
"""
import argparse
import logging
import os
from typing import List
import h5py
import numpy as np
import open3d as o3d
from torch.utils.data import Dataset
import torchvision
import data_loader.transforms as Transforms
import common.math.se3 as se3
_logger = logging.getLog... |
src/genie/libs/parser/iosxe/tests/ShowPlatform/cli/equal/golden_output_c9200_expected.py | balmasea/genieparser | 204 | 11194373 | expected_output = {
'main': {
'mac_persistency_wait_time': 'indefinite',
'switch_mac_address': 'dc8c.37ff.ad21',
'swstack': True,
},
'slot': {
'1': {
'rp': {
'C9200-24P': {
'hw_ver': 'V01',
'mac_address': 'dc... |
Machine Learning Projects/Xeno-Deep Learning library from scratch/xeno/utils/random.py | TeacherManoj0131/HacktoberFest2020-Contributions | 256 | 11194404 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
import numpy as np
_rng = np.random
_dtype = 'float32'
def get_rng():
return _rng
def set_rng(rng):
global _rng
_rng = rng
def set_seed(seed):
global _rng
_rng = np.random.RandomState(seed)
def get_dtype():
return _dtype
def set_dtype(dtype... |
fastai2/notebook/showdoc.py | Tato14/fastai2 | 380 | 11194405 | <filename>fastai2/notebook/showdoc.py
#AUTOGENERATED! DO NOT EDIT! File to edit: dev/92_notebook_showdoc.ipynb (unless otherwise specified).
__all__ = ['is_enum', 'add_pytorch_index', 'is_fastai_module', 'FASTAI_DOCS', 'doc_link', 'add_doc_links',
'get_source_link', 'SOURCE_URL', 'get_nb_source_link', 'FAST... |
glue/train_multitask.py | ziwei7437/bert_on_stilts | 105 | 11194408 | import argparse
import json
import os
import pandas as pd
import logging
from glue.tasks import get_task, MnliMismatchedProcessor
from glue.runners import GlueTaskRunner, RunnerParameters
from glue import model_setup as glue_model_setup
from shared import model_setup as shared_model_setup
from pytorch_pretrained_bert... |
tests/test_get_option.py | jacobwhall/panflute | 361 | 11194417 | import panflute as pf
def test_get_variable():
doc = pf.Doc(metadata={"a": pf.MetaString("x"),
"b": pf.MetaMap(c=pf.MetaString("y"))})
assert pf.get_option(default="a") == "a"
assert pf.get_option({"a": 1}, "a") == 1
assert pf.get_option({"a": None}, "a", default=2)... |
python/ua_gec/__init__.py | kaidisn/ua-gec | 181 | 11194446 | <reponame>kaidisn/ua-gec
from .corpus import Corpus, Document
from .annotated_text import AnnotatedText
|
apim-migration-testing-tool/Python/venv/lib/python3.6/site-packages/google/protobuf/descriptor.py | tharindu1st/apim-migration-resources | 4,071 | 11194447 | # Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redi... |
xadmin/models.py | A-tiantian/xadmin_bugfix | 120 | 11194474 | <reponame>A-tiantian/xadmin_bugfix
import json
import django
from django.db import models
from django.utils import timezone
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.utils.translation import ugettext_lazy as _, ugettext
from django.urls.base import reverse
f... |
accelerator/unixhttp.py | eBay/accelerator | 143 | 11194475 | ############################################################################
# #
# Copyright (c) 2017 eBay Inc. #
# Modifications copyright (c) 2019-2021 <NAME> #
# ... |
tensorflow/python/kernel_tests/io_ops/record_input_test.py | EricRemmerswaal/tensorflow | 190,993 | 11194495 | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
pushservices/gcm.py | nakanin/airnotifier | 558 | 11194508 | <reponame>nakanin/airnotifier
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2012, <NAME>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above cop... |
tests/resources/selenium/python/test_setup_exception.py | IamSaurabh1/taurus | 1,743 | 11194512 | import unittest
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException
class TestBlazemeterPass(unittest.TestCase):
@classmethod
def setUpClass(cls):
raise Exception("Catch that")
def test_pa... |
zerver/management/commands/export_single_user.py | TylerPham2000/zulip | 17,004 | 11194559 | <reponame>TylerPham2000/zulip<gh_stars>1000+
import os
import shutil
import subprocess
import tempfile
from argparse import ArgumentParser
from typing import Any
from zerver.lib.export import do_export_user
from zerver.lib.management import ZulipBaseCommand
class Command(ZulipBaseCommand):
help = """Exports mess... |
.github/workflows/check_entangled_specs.py | slowy07/CBL-Mariner | 3,337 | 11194566 | <reponame>slowy07/CBL-Mariner
from typing import FrozenSet, List, Set
from pyrpm.spec import Spec
import argparse
from collections import defaultdict
from pathlib import Path
import pprint
import sys
version_release_matching_groups = [
frozenset([
"SPECS-SIGNED/kernel-signed/kernel-signed.spec",
"... |
Doc/includes/sqlite3/complete_statement.py | cemeyer/tauthon | 473 | 11194588 | # A minimal SQLite shell for experiments
import sqlite3
con = sqlite3.connect(":memory:")
con.isolation_level = None
cur = con.cursor()
buffer = ""
print "Enter your SQL commands to execute in sqlite3."
print "Enter a blank line to exit."
while True:
line = raw_input()
if line == "":
break
buff... |
visualiser/facades/ociDbHome.py | flover4/oci-designer-toolkit | 186 | 11194591 | <reponame>flover4/oci-designer-toolkit<gh_stars>100-1000
#!/usr/bin/python
# Copyright (c) 2020, 2021, Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
"""Provide Module Description
"""
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~... |
Lib/test/test_dict2java.py | jeff5/jython-whinchat | 577 | 11194611 | <reponame>jeff5/jython-whinchat
from javatests import Dict2JavaTest
import unittest, test.test_support
# Test the java.util.Map interface of org.python.core.PyDictionary.
# This tests the functionality of being able to pass a dictionaries
# created in Jython to a java method, and the ability to manipulate
# the dictio... |
codigo/Live150/exemplo_05.py | cassiasamp/live-de-python | 572 | 11194615 | from typing import Dict
class Pessoa:
def __init__(self, nome: str, sobrenome: str, telefone: Dict[str, str], ddd: int):
self.nome = nome
self.sobrenome = sobrenome
self.telefone = telefone
self.ddd = ddd
eduardo_1 = Pessoa('Eduardo', 8, {'residencial': '1111-111', 'móvel': '999-... |
external/DCNv2/testcpu.py | RoadoneP/aloha | 1,136 | 11194634 | <filename>external/DCNv2/testcpu.py
#!/usr/bin/env python
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import time
import torch
import torch.nn as nn
from torch.autograd import gradcheck
from dcn_v2 import dcn_v2_conv, DCNv2, DCN
from dcn_v2 import dcn_v... |
22_itictactoe/typehints.py | kent13/tiny_python_projects | 742 | 11194647 | <gh_stars>100-1000
#!/usr/bin/env python3
""" Demonstrating type hints """
from typing import List, NamedTuple, Optional
class State(NamedTuple):
board: List[str] = list('.' * 9)
player: str = 'X'
quit: bool = False
draw: bool = False
error: Optional[str] = None
winner: Optional[str] = None
... |
venv/lib/python3.9/site-packages/configparser.py | almmello/frozen | 6,989 | 11194662 | <filename>venv/lib/python3.9/site-packages/configparser.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Convenience module importing everything from backports.configparser."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicod... |
FWCore/Integration/test/ref_merge_cfg.py | ckamtsikis/cmssw | 852 | 11194667 | import FWCore.ParameterSet.Config as cms
process = cms.Process("MERGE")
process.source = cms.Source("PoolSource",
fileNames = cms.untracked.vstring("file:ref_merge_prod1.root",
"file:ref_merge_prod2.root")
... |
src/ntlmrecon/__init__.py | bbhunter/NTLMRecon | 139 | 11194694 | <filename>src/ntlmrecon/__init__.py
import argparse
import json
import requests
import csv
import sys
import os
from colorama import init as init_colorama
from multiprocessing.dummy import Pool as ThreadPool
from ntlmrecon.ntlmutil import gather_ntlm_info
from ntlmrecon.misc import print_banner, INTERNAL_WORDLIST
from... |
angler/__init__.py | joamatab/angler | 102 | 11194698 | <reponame>joamatab/angler<filename>angler/__init__.py
# used for setup.py
name = "angler"
__version__ = '0.0.15'
# import the main classes
from .optimization import Optimization
from .simulation import Simulation
# import the various utilities
from .constants import *
from .plot import *
from .structures import *
fr... |
local_configs/segformer/B3/segformer.b3.1024x1024.city.160k.py | wzpscott/SegformerDistillation | 903 | 11194699 | _base_ = [
'../../_base_/models/segformer.py',
'../../_base_/datasets/cityscapes_1024x1024_repeat.py',
'../../_base_/default_runtime.py',
'../../_base_/schedules/schedule_160k_adamw.py'
]
# model settings
norm_cfg = dict(type='SyncBN', requires_grad=True)
find_unused_parameters = True
model = dict(
... |
Python/Tests/TestData/TestDiscoverer/ConfigPythonFunctions/test_misc_prefixes.py | techkey/PTVS | 404 | 11194705 | <filename>Python/Tests/TestData/TestDiscoverer/ConfigPythonFunctions/test_misc_prefixes.py
def test_func():
pass
def check_func():
pass
def example_func():
pass
def verify_func():
pass
|
academicstoday_project/account/tests/test_profile.py | LeeDoona/EasyGrading | 146 | 11194707 | <reponame>LeeDoona/EasyGrading
from django.core.urlresolvers import resolve
from django.http import HttpRequest
from django.http import QueryDict
from django.test import TestCase
from django.test import Client
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login, logout
from d... |
riscv/machine.py | kevinyuan/pydgin | 159 | 11194745 | #=========================================================================
# machine.py
#=========================================================================
from pydgin.storage import RegisterFile
from pydgin.utils import specialize, r_ulonglong
from utils import trim_64
from isa import ENABLE_FP
from csr import... |
saleor/payment/migrations/0024_auto_20210326_0837.py | fairhopeweb/saleor | 15,337 | 11194747 | # Generated by Django 3.1.7 on 2021-03-26 08:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("payment", "0023_auto_20201110_0834"),
]
operations = [
migrations.AlterField(
model_name="transaction",
name="error"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.