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 |
|---|---|---|---|---|
mim/commands/train.py | zhouzaida/mim | 188 | 75107 | import os
import os.path as osp
import random as rd
import subprocess
from typing import Optional, Tuple, Union
import click
from mim.click import CustomCommand, param2lowercase
from mim.utils import (
echo_success,
exit_with_error,
get_installed_path,
highlighted_error,
is_installed,
module_f... |
setup.py | bgruening/MACS | 159 | 75141 | <gh_stars>100-1000
#!/usr/bin/env python3
"""Description:
Setup script for MACS -- Model Based Analysis for ChIP-Seq data
This code is free software; you can redistribute it and/or modify it
under the terms of the BSD License (see the file LICENSE included with
the distribution).
"""
import sys
import os
import re
f... |
steamctl/commands/assistant/__init__.py | rossengeorgiev/steamctl | 138 | 75144 | <filename>steamctl/commands/assistant/__init__.py
from steamctl.argparser import register_command
epilog = """\
"""
@register_command('assistant', help='Helpful automation', epilog=epilog)
def cmd_parser(cp):
def print_help(*args, **kwargs):
cp.print_help()
cp.set_defaults(_cmd_func=print_help)
... |
testing/scripts/run_android_wpt.py | iridium-browser/iridium-browser | 575 | 75204 | <reponame>iridium-browser/iridium-browser<filename>testing/scripts/run_android_wpt.py
#!/usr/bin/env vpython3
# Copyright 2019 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.
"""Runs Web Platform Tests (WPT) on Android bro... |
contrib/tools/python/src/Lib/plat-mac/Carbon/Qdoffs.py | HeyLey/catboost | 6,989 | 75216 | <reponame>HeyLey/catboost
from _Qdoffs import *
|
src/sage/combinat/subword.py | hsm207/sage | 1,742 | 75223 | <filename>src/sage/combinat/subword.py
r"""
Subwords
A subword of a word `w` is a word obtained by deleting the letters at some
(non necessarily adjacent) positions in `w`. It is not to be confused with the
notion of factor where one keeps adjacent positions in `w`. Sometimes it is
useful to allow repeated uses of the... |
packages/core/minos-microservice-common/minos/common/testing/database/clients.py | minos-framework/minos-python | 247 | 75231 | from collections.abc import (
AsyncIterator,
)
from typing import (
Any,
)
from ...database import (
DatabaseClient,
)
from .operations import (
MockedDatabaseOperation,
)
class MockedDatabaseClient(DatabaseClient):
"""For testing purposes"""
def __init__(self, *args, **kwargs):
supe... |
preprocess.py | lcylcy/FastSpeech | 745 | 75239 | import torch
import numpy as np
import shutil
import os
from data import ljspeech
import hparams as hp
def preprocess_ljspeech(filename):
in_dir = filename
out_dir = hp.mel_ground_truth
if not os.path.exists(out_dir):
os.makedirs(out_dir, exist_ok=True)
metadata = ljspeech.build_from_path(in_... |
torchx/runner/api.py | ldworkin/torchx | 101 | 75241 | <reponame>ldworkin/torchx
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import json
import logging
import time
from datetime import da... |
test_files/uctable_N.py | garrettluu/js-adler32 | 224 | 75259 | <filename>test_files/uctable_N.py
uctable = [ [ 48 ],
[ 49 ],
[ 50 ],
[ 51 ],
[ 52 ],
[ 53 ],
[ 54 ],
[ 55 ],
[ 56 ],
[ 57 ],
[ 194, 178 ],
[ 194, 179 ],
[ 194, 185 ],
[ 194, 188 ],
[ 194, 189 ],
[ 194, 190 ],
[ 217, 160 ],
[ 217, 161 ],
[ 217, 162 ],
[ 217, 163 ],
[ 217, 164 ],
... |
rex_gym/model/terrain.py | y-prudent/rex-gym | 827 | 75266 | <reponame>y-prudent/rex-gym
# Original script: https://github.com/bulletphysics/bullet3/blob/master/examples/pybullet/examples/heightfield.py
import pybullet_data as pd
import rex_gym.util.pybullet_data as rpd
import pybullet as p
import random
from rex_gym.util import flag_mapper
FLAG_TO_FILENAME = {
'mounts': "... |
expiringdict/__init__.py | jonnyyu/expiringdict | 294 | 75274 | <gh_stars>100-1000
"""
Dictionary with auto-expiring values for caching purposes.
Expiration happens on any access, object is locked during cleanup from expired
values. Can not store more than max_len elements - the oldest will be deleted.
>>> ExpiringDict(max_len=100, max_age_seconds=10)
The values stored in the fo... |
mnist/mnist.py | Calysto/conx-data | 105 | 75275 | import h5py
import numpy as np
from keras.datasets import mnist
from keras.utils import to_categorical
# input image dimensions
img_rows, img_cols = 28, 28
# the data, shuffled and split between train and test sets
(x_train, y_train), (x_test, y_test) = mnist.load_data()
x_train = x_train.reshape(x_train.shape[0], img... |
es-clip/es_bitmap.py | daia99/brain-tokyo-workshop | 1,097 | 75278 | <filename>es-clip/es_bitmap.py
#!/usr/bin/env python3
import os
os.environ['OPENBLAS_NUM_THREADS'] = '1'
os.environ['OMP_NUM_THREADS'] = '1'
import argparse
import cProfile
import json
import multiprocessing as mp
import os
import re
import numpy as np
from PIL import Image
from pgpelib import PGPE
from utils impo... |
pyspider/database/mysql/taskdb.py | zgwcome/pyspider | 13,935 | 75307 | #!/usr/bin/envutils
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# Author: Binux<<EMAIL>>
# http://binux.me
# Created on 2014-07-17 18:53:01
import re
import six
import time
import json
import mysql.connector
from pyspider.libs import utils
from pyspider.database.base.taskdb imp... |
vimfiles/bundle/vim-python/submodules/pylint/tests/functional/m/member/member_checks_typed_annotations.py | ciskoinch8/vimrc | 463 | 75318 | # pylint: disable=missing-docstring,invalid-name,too-few-public-methods
class A:
myfield: int
class B(A):
pass
class C:
pass
class D(C, B):
pass
a = A()
print(a.myfield)
b = B()
print(b.myfield)
d = D()
print(d.myfield)
c = C()
print(c.myfield) # [no-member]
|
src/include/catalog/li_extras.py | wapache-org/greenplum-gpdb | 5,535 | 75324 | #! /usr/local/bin/python
import sys
import datetime
import pdb
#pdb.set_trace()
# Test and declaration generator for linear_interpolation
# Utility
def kwot(s):
"""Single quote a string, doubling contained quotes as needed."""
return "'" + "''".join(s.split("'")) + "'"
# Following section is just fragile ... |
pyzx/graph/graph.py | mnm-team/pyzx-heuristics | 219 | 75336 | # PyZX - Python library for quantum circuit rewriting
# and optimization using the ZX-calculus
# Copyright (C) 2018 - <NAME> and <NAME>
# 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
... |
Hard/same-bsts.py | SaumyaRai2010/algoexpert-data-structures-algorithms | 152 | 75344 |
# SAME BSTS
# O(N^2) time and space
def sameBsts(arrayOne, arrayTwo):
# Write your code here.
if len(arrayOne) != len(arrayTwo):
return False
if len(arrayOne) == 0:
return True
if arrayOne[0] != arrayTwo[0]:
return False
leftSubtreeFirst = [num for num in arrayOne[1:] if num < arrayOne[0]]
rightS... |
colour/models/rgb/hanbury2003.py | rift-labs-developer/colour | 1,380 | 75354 | <gh_stars>1000+
# -*- coding: utf-8 -*-
"""
IHLS Colour Encoding
====================
Defines the :math:`IHLS` (Improved HLS) colourspace related transformations:
- :func:`colour.RGB_to_IHLS`
- :func:`colour.IHLS_to_RGB`
References
----------
- :cite:`Hanbury2003` : <NAME>. (2003). A 3D-Polar Coordinate Colour... |
vaurien/protocols/memcache.py | mozilla-libs/vaurien | 131 | 75387 | <reponame>mozilla-libs/vaurien<gh_stars>100-1000
import re
from vaurien.protocols.base import BaseProtocol
from vaurien.util import chunked
RE_LEN = re.compile('Content-Length: (\d+)', re.M | re.I)
RE_KEEPALIVE = re.compile('Connection: Keep-Alive')
RE_MEMCACHE_COMMAND = re.compile('(.*)\r\n')
EOH = '\r\n\r\n'
CRLF... |
dataset_preprocessing/generate_OF_FDD.py | malikhussain72/cnn_fall-detection | 183 | 75402 |
import os
import cv2
import glob
import sys
sys.path.append('/usr/local/lib/python2.7/site-packages/')
#os.system('/home/adrian/dense_flow/build/extract_cpu -f={} -x={} -y={} -i=tmp/image -b 20 -t 1 -d 3 -o=dir'.format('test.avi', '/flow_x', '/flow_y'))
data_folder = 'FDD_images/'
output_path = 'FDD_OF/'
i = 0
if no... |
toad/utils/progress.py | wolaituodiban/toad | 325 | 75446 | import sys
from time import time
class Progress:
"""
"""
def __init__(self, iterable, size = None, interval = 0.1):
"""
Args:
iterable
size (int): max size of iterable
interval (float): update bar interval second, default is `0.1`
Attrs:
... |
hacker-rank/algorithms/strings/two-strings/two-strings.py | palash24/algorithms | 113 | 75478 | <reponame>palash24/algorithms<gh_stars>100-1000
#!/usr/bin/env python
import sys
def char_set(string):
chars = {}
for c in string:
chars[c] = True
return chars
def test_case():
A = sys.stdin.readline().strip()
B = sys.stdin.readline().strip()
bCharSet = char_set(B)
for c in A:
... |
virtual/lib/python3.8/site-packages/django_bootstrap5/html.py | Calebu6214/Instagram-clone | 118 | 75494 | <reponame>Calebu6214/Instagram-clone
from django.forms.utils import flatatt
from django.utils.html import format_html
from django_bootstrap5.text import text_value
from django_bootstrap5.utils import get_url_attrs
def render_script_tag(url):
"""Build a script tag."""
return render_tag("script", get_url_attrs... |
src/visitpy/visit_flow/visit_flow_vpe/examples/flow_vpe_pyocl_compile_dw_mag.py | visit-dav/vis | 226 | 75496 | # Copyright (c) Lawrence Livermore National Security, LLC and other VisIt
# Project developers. See the top-level LICENSE file for dates and other
# details. No copyright assignment is required to contribute to VisIt.
"""
file: vpe_flow_npy_ops_example_1.py
author: <NAME> <<EMAIL>>
created: 3/28/2012
description... |
skift/__init__.py | dimidd/skift | 244 | 75502 | <reponame>dimidd/skift
"""Utilities for pandas."""
from .core import FirstColFtClassifier # noqa: F401
from .core import IdxBasedFtClassifier # noqa: F401
from .core import FirstObjFtClassifier # noqa: F401
from .core import ColLblBasedFtClassifier # noqa: F401
from .core import SeriesFtClassifier # noqa: F401
f... |
sbin/submitty_daemon_jobs/submitty_jobs/bulk_qr_split.py | zeez2030/Submitty | 411 | 75505 | #!/usr/bin/env python3
"""Split PDFS by QR code and move images and PDFs to correct folder."""
import os
import traceback
import numpy
from . import write_to_log as logger
from . import submitty_ocr as scanner
# try importing required modules
try:
from PyPDF2 import PdfFileReader, PdfFileWriter
from pdf2imag... |
tests/clpy_tests/random_tests/test_distributions.py | fixstars/clpy | 142 | 75518 | <filename>tests/clpy_tests/random_tests/test_distributions.py
import unittest
import clpy
from clpy.random import distributions
from clpy import testing
@testing.parameterize(*testing.product({
'shape': [(4, 3, 2), (3, 2)],
'loc_shape': [(), (3, 2)],
'scale_shape': [(), (3, 2)],
})
)
@testing.gpu
class T... |
test/Driver/Dependencies/Inputs/fake-build-for-bitcode.py | AbdouSarr/swift | 825 | 75523 | #!/usr/bin/env python
# fake-build-for-bitcode.py - Fake build with -embed-bitcode -*- python -*-
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See http://sw... |
library/oci_load_balancer_backend.py | slmjy/oci-ansible-modules | 106 | 75527 | #!/usr/bin/python
# Copyright (c) 2018, Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for detail... |
heat/db/sqlalchemy/migrate_repo/versions/080_resource_attrs_data.py | noironetworks/heat | 265 | 75543 | #
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... |
tests/test_dict.py | fakegit/pydu | 229 | 75545 | import pytest
import unittest
from pydu.dict import AttrDict, LookupDict, CaseInsensitiveDict, OrderedDefaultDict, attrify
class TestAttrDict:
def test_attr_access_with_init(self):
d = AttrDict(key=1)
assert d['key'] == 1
assert d.key == 1
def test_attr_access_without_init(self):
... |
play_with_human_local.py | Andrea-MariaDB-2/LastOrder-Dota2 | 332 | 75549 | <gh_stars>100-1000
from gym_env.dota_game import DotaGame, TEAM_RADIANT, TEAM_DIRE
from dotaservice.protos.dota_shared_enums_pb2 import DOTA_GAMEMODE_1V1MID
from agents.dota_agent import PPOAgent
from multiprocessing import Process
from sys import platform
import time
import os
import pathlib
# path example
DOTA_CLIN... |
python_toolbox/caching/decorators.py | hboshnak/python_toolbox | 119 | 75558 | # Copyright 2009-2017 <NAME>.
# This program is distributed under the MIT license.
'''
Defines the `cache` decorator.
See its documentation for more details.
'''
# todo: examine thread-safety
import datetime as datetime_module
from python_toolbox import misc_tools
from python_toolbox import binary_search
from pytho... |
src/Tools/PythonScripts/ComputeSpecialFunctionsTestValues.py | MyIntelligenceAgency/infer | 1,416 | 75568 | # Licensed to the .NET Foundation under one or more agreements.
# The .NET Foundation licenses this file to you under the MIT license.
# See the LICENSE file in the project root for more information.
"""A script to evaluate test values for special functions in high precision.
This scripts looks for .csv files in /test... |
src/compas/geometry/triangulation/delaunay_numpy.py | XingxinHE/compas | 235 | 75602 | from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from numpy import asarray
from scipy.spatial import Voronoi
from scipy.spatial import Delaunay
__all__ = [
'delaunay_from_points_numpy',
'voronoi_from_points_numpy',
]
def delaunay_from_points_numpy... |
text/SST/params_fit.py | laura-rieger/deep-explanation-penalization | 105 | 75606 | <reponame>laura-rieger/deep-explanation-penalization
import numpy as np
from numpy.random import randint
class p:
train_both = True # whether to train just one model or both
sparse_signal = False # train on incorrect data points or not
signal_strength = 1.0 # how much to weight kl-divergence
startin... |
glance/db/sqlalchemy/alembic_migrations/data_migrations/ocata_migrate01_community_images.py | daespinel/glance | 309 | 75612 | <gh_stars>100-1000
# Copyright 2016 Rackspace
# Copyright 2016 Intel Corporation
#
# 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.... |
_solved/solutions/case-trump-vote09.py | DuongVit/scipy2018-geospatial-data | 333 | 75616 | f = plt.figure(figsize=(6,6))
plt.scatter(pres.swing_full, lp.weights.lag_spatial(w, pres.swing_full))
plt.plot((-.3,.1),(-.3,.1), color='k')
plt.title('$I = {:.3f} \ \ (p < {:.3f})$'.format(moran.I,moran.p_sim)) |
recipes/examples/scif.py | robertmaynard/hpc-container-maker | 340 | 75618 | <filename>recipes/examples/scif.py<gh_stars>100-1000
"""
Build the CUDA-STREAM benchmark for multiple CUDA compute capabilities.
Make each build available as a SCI-F application.
"""
Stage0 += baseimage(image='nvcr.io/nvidia/cuda:9.1-devel-centos7', _as='devel')
# Install the GNU compiler
Stage0 += gnu(fortran=False)... |
utils/training/learning_rate_controller.py | sundogrd/tensorflow_end2end_speech_recognition | 351 | 75633 | <filename>utils/training/learning_rate_controller.py
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""Decay learning rate per epoch."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
class Controller(object):
"""Controll learning rate per epoch.
... |
minemeld/run/config.py | dreilly1982/minemeld-core | 147 | 75646 | <reponame>dreilly1982/minemeld-core<gh_stars>100-1000
# Copyright 2015 Palo Alto Networks, Inc
#
# 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... |
cvat/apps/engine/migrations/0049_auto_20220202_0710.py | ACHultman/cvat | 4,197 | 75663 | # Generated by Django 3.2.11 on 2022-02-02 07:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('engine', '0048_auto_20211112_1918'),
]
operations = [
migrations.AlterField(
model_name='labeledshape',
name='type'... |
Tutorials/01. 10 Days of Statistics/002. Day 0 - Weighted Mean.py | Snehakri022/HackerrankPractice | 831 | 75671 | # Problem: https://www.hackerrank.com/challenges/s10-weighted-mean/problem
# Score: 30
n = int(input())
arr = list(map(int, input().split()))
weights = list(map(int, input().split()))
print(round(sum([arr[x]*weights[x] for x in range(len(arr))]) / sum(weights), 1))
|
propeller/paddle/data/feature_column.py | JZZ-NOTE/ERNIE | 3,712 | 75696 | # Copyright (c) 2019 PaddlePaddle 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 app... |
mealie/db/models/model_base.py | danielpalstra/mealie | 1,927 | 75719 | <reponame>danielpalstra/mealie<filename>mealie/db/models/model_base.py
import sqlalchemy.ext.declarative as dec
from requests import Session
SqlAlchemyBase = dec.declarative_base()
class BaseMixins:
def update(self, *args, **kwarg):
self.__init__(*args, **kwarg)
@classmethod
def get_ref(cls_type... |
test/resource/test_data/suite_tree/LibraryWithReallyTooLongName.py | jimpriest/sublime-robot-framework-assistant | 103 | 75730 | <filename>test/resource/test_data/suite_tree/LibraryWithReallyTooLongName.py
from robot.api.deco import keyword
class LibraryWithReallyTooLongName(object):
def long_name_keyword(self, *args):
"""Documentation goes here"""
print args
def other_long_name_keyword(self, *args, **kwargs)... |
phishing/setmail.py | m00tiny/scripts | 877 | 75741 | <filename>phishing/setmail.py
#!/usr/bin/env python
# Copyright (c) 2012, AverageSecurityGuy
# All rights reserved.
#
# 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 ab... |
libmoon/deps/dpdk/usertools/cpu_layout.py | anonReview/Implementation | 287 | 75746 | <gh_stars>100-1000
#!/usr/bin/env python
#
# BSD LICENSE
#
# Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
# Copyright(c) 2017 Cavium, Inc. All rights reserved.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provi... |
mmdet/core/my_mmcv/runner/hooks/mean_teacher_optimizer.py | Ernstsen/Pedestron | 594 | 75750 | <filename>mmdet/core/my_mmcv/runner/hooks/mean_teacher_optimizer.py
from torch.nn.utils import clip_grad
from mmcv.runner.hooks.hook import Hook
class OptimizerHook(Hook):
def __init__(self, grad_clip=None, mean_teacher=None):
self.grad_clip = grad_clip
self.mean_teacher = mean_teacher
def ... |
code/models/layers.py | tchittesh/EAS- | 169 | 75772 | <gh_stars>100-1000
from models.basic_model import BasicModel
import tensorflow as tf
import numpy as np
import copy
def apply_noise(weights, noise_config):
if noise_config is None:
return weights
noise_type = noise_config.get('type', 'normal')
if noise_type == 'normal':
ratio = noise_config.get('ratio', 1e-3)
... |
pycipher/caesar.py | onlykood/pycipher | 196 | 75776 | <reponame>onlykood/pycipher
#implements Caesar substitution cipher
#Author: <NAME>
#Created: 2012-04-28
from pycipher.base import Cipher
class Caesar(Cipher):
"""The Caesar Cipher has a key consisting of an integer 1-25.
This cipher encrypts a letter according to the following equation::
c = (p ... |
examples/searchlight/genre_searchlight_example.py | osaaso3/brainiak | 235 | 75799 | <reponame>osaaso3/brainiak
# The following code is designed to perform a searchlight at every voxel in the brain looking at the difference in pattern similarity between musical genres (i.e. classical and jazz). In the study where the data was obtained, subjects were required to listen to a set of 16 songs twice (two ru... |
Adafruit_QT_Py_ESP32-S2/Storage/code.py | gamblor21/Adafruit_Learning_System_Guides | 665 | 75802 | # SPDX-FileCopyrightText: 2021 <NAME> for Adafruit Industries
# SPDX-License-Identifier: Unlicense
"""
CircuitPython Essentials Storage CP Filesystem code.py file
"""
import time
import board
import microcontroller
import neopixel
pixel = neopixel.NeoPixel(board.NEOPIXEL, 1)
try:
with open("/temperature.txt", "a"... |
core/data/collates/collate_functions.py | cjy97/LibFewShot | 471 | 75806 | # -*- coding: utf-8 -*-
import itertools
from collections import Iterable
import torch
class GeneralCollateFunction(object):
"""A Generic `Collate_fn`.
For finetuning-train.
"""
def __init__(self, trfms, times):
"""Initialize a `GeneralCollateFunction`.
Args:
trfms (lis... |
pointers/pointers.py | lootek/govspy | 106 | 75807 | # There is no equivalent to pointers in python
def upit(str):
return str.upper()
def uplist(mylist):
for i in range(len(mylist)):
mylist[i] = mylist[i].upper()
name = "peter"
upit(name)
print name # peter
name = upit(name)
print name # PETER
# but you can do a useless cheat and make it mutable
na... |
lib/training/train_factory.py | shachargluska/centerpose | 245 | 75831 | from __future__ import absolute_import, division, print_function
from .multi_pose import MultiPoseTrainer
train_factory = {
'multi_pose': MultiPoseTrainer,
}
|
examples/optimization/multiobjective/constnsga2jpq.py | sveilleux1/pybrain | 2,208 | 75832 | <gh_stars>1000+
from __future__ import print_function
#!/usr/bin/env python
""" An illustration of using the NSGA-II multi-objective optimization algorithm
on Constrained Multi-Objective Optimization benchmark function. """
__author__ = '<NAME>, <EMAIL>'
from pybrain.optimization import ConstMultiObjectiveGA
from py... |
dassl/evaluation/build.py | Fyy10/Dassl.pytorch | 563 | 75859 | from dassl.utils import Registry, check_availability
EVALUATOR_REGISTRY = Registry("EVALUATOR")
def build_evaluator(cfg, **kwargs):
avai_evaluators = EVALUATOR_REGISTRY.registered_names()
check_availability(cfg.TEST.EVALUATOR, avai_evaluators)
if cfg.VERBOSE:
print("Loading evaluator: {}".format(... |
pylot/planning/hybrid_astar/hybrid_astar_planner.py | mageofboy/pylot | 231 | 75861 | from hybrid_astar_planner.HybridAStar.hybrid_astar_wrapper \
import apply_hybrid_astar
import numpy as np
from pylot.planning.planner import Planner
class HybridAStarPlanner(Planner):
"""Wrapper around the Hybrid A* planner.
Note:
Details can be found at `Hybrid A* Planner`_.
Args:
... |
pyscf/pbc/cc/test/test_kuccsd_supercell_vs_kpts.py | robert-anderson/pyscf | 501 | 75871 | <reponame>robert-anderson/pyscf
import unittest
import numpy
from pyscf.pbc import gto
from pyscf.pbc import scf,cc
from pyscf import cc as mol_cc
from pyscf.pbc.tools.pbc import super_cell
#from pyscf import lib
#from pyscf.pbc import gto
#from pyscf.pbc import scf,cc
#from pyscf.pbc.cc import kccsd_uhf
#from pys... |
DeepAlignmentNetwork/menpofit/checks.py | chiawei-liu/DeepAlignmentNetwork | 220 | 75973 | <filename>DeepAlignmentNetwork/menpofit/checks.py
import warnings
import collections
from functools import partial
import numpy as np
from menpo.base import name_of_callable
from menpo.shape import TriMesh
from menpo.transform import PiecewiseAffine
def check_diagonal(diagonal):
r"""
Checks that the diagonal... |
conda/common/url.py | jack-pappas/conda | 4,825 | 76000 | <gh_stars>1000+
# -*- coding: utf-8 -*-
# Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import absolute_import, division, print_function, unicode_literals
import codecs
from getpass import getpass
from os.path import abspath, expanduser
import re
import socket
from .compat i... |
pypyr/steps/dsl/cmd.py | mofm/pypyr | 261 | 76009 | <gh_stars>100-1000
"""pypyr step yaml definition for commands - domain specific language."""
import shlex
import subprocess
import logging
from pypyr.errors import ContextError
from pypyr.utils import types
# logger means the log level will be set correctly
logger = logging.getLogger(__name__)
class CmdStep():
"... |
t_1000/__init__.py | chao5645/T-1000 | 111 | 76018 | <filename>t_1000/__init__.py
from t_1000.application import T1000 |
test/test_user_otp.py | HailLab/girder | 395 | 76023 | # -*- coding: utf-8 -*-
import pytest
from girder.exceptions import AccessException
from girder.models.setting import Setting
from girder.models.user import User
from girder.settings import SettingKey
from pytest_girder.assertions import assertStatus, assertStatusOk
def testInitializeOtp(user):
# The logic for t... |
ig/main.py | goldsborough/ | 204 | 76029 | '''Entry point and command line parsing for ig.'''
from __future__ import print_function
import argparse
import logging
import os
import sys
from ig import colors, graph, serve, walk
def setup_logging():
'''Sets up the root logger.'''
handler = logging.StreamHandler(sys.stderr)
formatter = logging.Form... |
kino/functions.py | DongjunLee/kino-bot | 109 | 76043 | <reponame>DongjunLee/kino-bot
# -*- coding: utf-8 -*-
import random
import re
import subprocess
import time
from .background import schedule
from .nlp.ner import NamedEntitiyRecognizer
from .skills.bus import Bus
from .skills.feed import FeedNotifier
from .skills.github import GithubManager
from .skills.humor impor... |
backend/lost/logic/pipeline/exec_utils.py | JonasGoebel/lost | 490 | 76050 | <reponame>JonasGoebel/lost
import os
import hashlib
import importlib
import zipfile
def zipdir(path, out_path, timestamp=None):
# zipf is zipfile handle
zipf = zipfile.ZipFile(out_path, 'w', zipfile.ZIP_DEFLATED)
for root, dirs, files in os.walk(path):
for file in files:
src = os.pa... |
tests/unit_test_benchmarking.py | JamesPHoughton/pysd | 240 | 76069 | import os
from unittest import TestCase
# most of the features of this script are already tested indirectly when
# running vensim and xmile integration tests
_root = os.path.dirname(__file__)
class TestErrors(TestCase):
def test_canonical_file_not_found(self):
from pysd.tools.benchmarking import runner... |
packages/vaex-core/vaex/dataset.py | And0k/vaex | 337 | 76090 | from abc import abstractmethod, abstractproperty
import os
from pathlib import Path
import collections.abc
import logging
import pkg_resources
import uuid
from urllib.parse import urlparse
from typing import Set, List
import threading
import numpy as np
from frozendict import frozendict
import pyarrow as pa
import v... |
h2o-py/tests/testdir_jira/pyunit_pubdev_6603.py | ahmedengu/h2o-3 | 6,098 | 76127 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
sys.path.insert(1,"../../")
from tests import pyunit_utils
import h2o
import pandas as pd
def pubdev_6603():
hf = h2o.H2OFrame(pd.DataFrame([{'a': 1, 'b': 2}, {'a': 3, 'b': 4}]))
s1, s2 = hf.split_frame(ratios=[0.5], seed=1)
h2o.remove([hf, s1, s2... |
flextensor/optimize/optimize_gemm_conv2d.py | imxian/FlexTensor | 135 | 76137 | <reponame>imxian/FlexTensor<filename>flextensor/optimize/optimize_gemm_conv2d.py
import os
import sys
import argparse
import time
import json
import tvm
import torch
from flextensor.utils import Config
from flextensor.task import Task, TASK_TABLE
from flextensor.scheduler import schedule, schedule_with_config
from fl... |
bookwyrm/tests/views/imports/test_import_review.py | mouse-reeve/fedireads | 270 | 76140 | <reponame>mouse-reeve/fedireads
""" test for app action functionality """
from unittest.mock import patch
from django.template.response import TemplateResponse
from django.test import TestCase
from django.test.client import RequestFactory
from bookwyrm.tests.validate_html import validate_html
from bookwyrm import mode... |
projects/capture_screenshot/screenshot.py | rossi2018/python-mini-projects | 9,957 | 76142 | import os
import argparse
import pyautogui
import time
parser = argparse.ArgumentParser()
parser.add_argument("-p", "--path", help="absolute path to store screenshot.", default=r"./images")
parser.add_argument("-t", "--type", help="h (in hour) or m (in minutes) or s (in seconds)", default='h')
parser.add_argument("-f... |
flocker/provision/_effect.py | stackriot/flocker | 2,690 | 76172 | <filename>flocker/provision/_effect.py
from functools import partial
from six import reraise
from characteristic import attributes
from effect import (
sync_performer, Effect,
ComposedDispatcher, TypeDispatcher, base_dispatcher)
from treq import get
from pyrsistent import PClass, field
from txeffect import defe... |
language/question_answering/decatt_docreader/layers/decomposable_attention.py | naveenjafer/language | 1,199 | 76211 | # coding=utf-8
# Copyright 2018 The Google AI Language Team 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 ... |
IOPool/Input/test/test_make_multi_lumi_cfg.py | ckamtsikis/cmssw | 852 | 76216 | import FWCore.ParameterSet.Config as cms
process = cms.Process("WRITE")
process.source = cms.Source("EmptySource", numberEventsInLuminosityBlock = cms.untracked.uint32(4))
process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(20))
process.out = cms.OutputModule("PoolOutputModule", fileName = cms.untra... |
indra/sources/reach/reader.py | zebulon2/indra | 136 | 76217 | <filename>indra/sources/reach/reader.py
from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
import os
import logging
from indra import get_config
# Before the import, we have to deal with the CLASSPATH to avoid clashes
# with Eidos.
def _set_classpath():
clp = os... |
examples/singleobjective/simulated_annealing/simulated_annealing_binary.py | 12yuens2/jMetalPy | 335 | 76226 | from jmetal.algorithm.singleobjective.simulated_annealing import SimulatedAnnealing
from jmetal.operator import BitFlipMutation
from jmetal.problem import OneMax
from jmetal.util.solution import print_function_values_to_file, print_variables_to_file
from jmetal.util.termination_criterion import StoppingByEvaluations
i... |
owtf/managers/plugin.py | Udbhavbisarya23/owtf | 1,514 | 76235 | <reponame>Udbhavbisarya23/owtf<gh_stars>1000+
"""
owtf.managers.plugin
~~~~~~~~~~~~~~~~~~~~
This module manages the plugins and their dependencies
"""
import imp
import json
import os
from owtf.models.plugin import Plugin
from owtf.models.test_group import TestGroup
from owtf.settings import PLUGINS_DIR
from owtf.util... |
tests/test_utils_geodesic.py | qbarthelemy/pyRiemann | 301 | 76263 | <reponame>qbarthelemy/pyRiemann
import numpy as np
from pyriemann.utils.geodesic import (
geodesic_riemann,
geodesic_euclid,
geodesic_logeuclid,
geodesic,
)
from pyriemann.utils.mean import mean_riemann, mean_logeuclid, mean_euclid
import pytest
from pytest import approx
def get_geod_func():
geod_... |
ykdl/extractors/iqiyi/video.py | SeaHOH/ykdl | 136 | 76291 | <reponame>SeaHOH/ykdl
# -*- coding: utf-8 -*-
from .._common import *
from .util import md5, md5x, cmd5x
# vms
# src=1702633101b340d8917a69cf8a4b8c7c
# salt=t6hrq6k0n6n6k6qdh6tje6wpb62v7654
# salt=u6fnp3eok0dpftcq9qbr4n9svk8tqh7u
# src=02020031010000000000
# salt=3sj8xof48xof4tk9f4tk9ypgk9ypg5ul
def gettmts(tvid, ... |
src/model.py | markveillette/high-fidelity-generative-compression | 266 | 76314 | <filename>src/model.py
"""
Stitches submodels together.
"""
import numpy as np
import time, os
import itertools
from functools import partial
from collections import defaultdict, namedtuple
import torch
import torch.nn as nn
import torch.nn.functional as F
# Custom modules
from src import hyperprior
from src.loss im... |
i18n/json_to_js.py | bharati-software/blockly-games-Kannada | 1,184 | 76325 | <reponame>bharati-software/blockly-games-Kannada<gh_stars>1000+
#!/usr/bin/python
# Converts .json files from Translatewiki into .js files.
#
# Copyright 2013 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obta... |
src/Testing/ZopeTestCase/connections.py | rbanffy/Zope | 289 | 76340 | <reponame>rbanffy/Zope
##############################################################################
#
# Copyright (c) 2005 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... |
cupy_alias/manipulation/transpose.py | fixstars/clpy | 142 | 76368 | from clpy.manipulation.transpose import * # NOQA
|
binding.gyp | lideming/fuse-native | 181 | 76385 | <reponame>lideming/fuse-native<filename>binding.gyp
{
"targets": [{
"target_name": "fuse",
"include_dirs": [
"<!(node -e \"require('napi-macros')\")",
"<!(node -e \"require('fuse-shared-library/include')\")",
],
"libraries": [
"<!(node -e \"require('fuse-shared-library/lib')\")",
... |
alipay/aop/api/response/AlipayOverseasTravelShopSyncResponse.py | antopen/alipay-sdk-python-all | 213 | 76408 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AlipayOverseasTravelShopSyncResponse(AlipayResponse):
def __init__(self):
super(AlipayOverseasTravelShopSyncResponse, self).__init__()
self._shop_biz_status = None
... |
launchpad/nodes/courier/courier_utils.py | leloykun/launchpad | 264 | 76436 | # Lint as: python3
# Copyright 2020 DeepMind Technologies Limited. 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
#
# ... |
src/encoded/tests/fixtures/schemas/experiment.py | procha2/encoded | 102 | 76441 | <gh_stars>100-1000
import pytest
@pytest.fixture
def experiment_chip_control(testapp, lab, award, ileum):
item = {
'award': award['uuid'],
'lab': lab['uuid'],
'status': 'released',
'date_released': '2019-10-08',
'biosample_ontology': ileum['uuid'],
'assay_term_name':... |
pennylane/transforms/specs.py | ral9000/pennylane | 712 | 76447 | # Copyright 2018-2021 Xanadu Quantum Technologies Inc.
# 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... |
experiments/counters.py | PetrDlouhy/django-experiments | 237 | 76462 | from django.utils.functional import cached_property
from redis.exceptions import ConnectionError, ResponseError
from experiments.redis_client import get_redis_client
COUNTER_CACHE_KEY = 'experiments:participants:%s'
COUNTER_FREQ_CACHE_KEY = 'experiments:freq:%s'
class Counters(object):
@cached_property
d... |
tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/structured_output.py | joshz123/tensorflow | 388 | 76476 | # Copyright 2019 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... |
enaml/widgets/tool_bar.py | xtuzy/enaml | 1,080 | 76487 | <gh_stars>1000+
#------------------------------------------------------------------------------
# Copyright (c) 2013, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
#-------------------------------------... |
Lib/test/test_compiler/testcorpus/77_class__class__no_class.py | diogommartins/cinder | 1,886 | 76497 | def f():
def g():
__class__
|
examples/simple_experiment_example.py | shaoeric/hyperparameter_hunter | 688 | 76498 | <gh_stars>100-1000
from hyperparameter_hunter import Environment, CVExperiment
from hyperparameter_hunter.utils.learning_utils import get_toy_classification_data
from xgboost import XGBClassifier
def execute():
env = Environment(
train_dataset=get_toy_classification_data(),
results_path="Hyperpara... |
tfx/orchestration/portable/system_node_handler.py | avelez93/tfx | 1,813 | 76501 | # Copyright 2020 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
pwnypack/oracle.py | iksteen/dpf | 133 | 76521 | <reponame>iksteen/dpf
"""
This module provides a functions that, given an oracle function that returns
``True`` when a message is properly padded and ``False`` otherwise, will
decrypt or encrypt a given message assuming that the underlying cipher
operates in CBC mode.
"""
from __future__ import print_function, divisio... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.