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 |
|---|---|---|---|---|
test/msan/lit.cfg.py | QuarkTheAwesome/compiler-rt-be-aeabi | 118 | 9489 | # -*- Python -*-
import os
# Setup config name.
config.name = 'MemorySanitizer' + getattr(config, 'name_suffix', 'default')
# Setup source root.
config.test_source_root = os.path.dirname(__file__)
# Setup default compiler flags used with -fsanitize=memory option.
clang_msan_cflags = (["-fsanitize=memory",
... |
src/sage/tests/books/computational-mathematics-with-sagemath/domaines_doctest.py | hsm207/sage | 1,742 | 9498 | <filename>src/sage/tests/books/computational-mathematics-with-sagemath/domaines_doctest.py<gh_stars>1000+
## -*- encoding: utf-8 -*-
"""
This file (./domaines_doctest.sage) was *autogenerated* from ./domaines.tex,
with sagetex.sty version 2011/05/27 v2.3.1.
It contains the contents of all the sageexample environments f... |
webots_ros2_core/webots_ros2_core/devices/gps_device.py | TaoYibo1866/webots_ros2 | 176 | 9500 | <reponame>TaoYibo1866/webots_ros2
# Copyright 1996-2021 Cyberbotics Ltd.
#
# 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... |
courses/backend/django-for-everybody/Web Application Technologies and Django/resources/dj4e-samples/tmpl/views.py | Nahid-Hassan/fullstack-software-development | 297 | 9505 | <filename>courses/backend/django-for-everybody/Web Application Technologies and Django/resources/dj4e-samples/tmpl/views.py
from django.shortcuts import render
from django.views import View
# Create your views here.
def simple(request):
return render(request, 'tmpl/simple.html')
def guess(request) :
context ... |
lib/twitter_utils.py | Vman45/ask-alexa-twitter | 310 | 9507 | <gh_stars>100-1000
import requests
import jsonpickle
from requests_oauthlib import OAuth1
from urllib.parse import parse_qs, urlencode
import cherrypy
from collections import defaultdict
import json
import os
import re
from collections import defaultdict
# For readable serializations
jsonpickle.set_encoder_options('... |
tests/test_random.py | hirnimeshrampuresoftware/python-tcod | 231 | 9515 | <filename>tests/test_random.py<gh_stars>100-1000
import copy
import pickle
import tcod
def test_tcod_random() -> None:
rand = tcod.random.Random(tcod.random.COMPLEMENTARY_MULTIPLY_WITH_CARRY)
assert 0 <= rand.randint(0, 100) <= 100
assert 0 <= rand.uniform(0, 100) <= 100
rand.guass(0, 1)
rand.inv... |
src/Products/Five/viewlet/viewlet.py | rbanffy/Zope | 289 | 9516 | ##############################################################################
#
# Copyright (c) 2006 Zope Foundation and Contributors.
# All Rights Reserved.
#
# 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... |
python-3.6.0/Doc/includes/email-unpack.py | emacslisp/python | 854 | 9518 | #!/usr/bin/env python3
"""Unpack a MIME message into a directory of files."""
import os
import email
import mimetypes
from email.policy import default
from argparse import ArgumentParser
def main():
parser = ArgumentParser(description="""\
Unpack a MIME message into a directory of files.
""")
parser.add_a... |
tkinter_examples/draw_chess_board.py | DazEB2/SimplePyScripts | 117 | 9520 | <filename>tkinter_examples/draw_chess_board.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
from tkinter import *
root = Tk()
root.title('Chess board')
canvas = Canvas(root, width=700, height=700, bg='#fff')
canvas.pack()
fill = '#fff'
outline = '#000'
size = 88
for i in range(8):
f... |
mars/learn/cluster/_k_means_init.py | hxri/mars | 2,413 | 9549 | <filename>mars/learn/cluster/_k_means_init.py<gh_stars>1000+
# Copyright 1999-2021 Alibaba Group Holding Ltd.
#
# 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/li... |
tests/pure-req.py | rbanffy/bjoern | 2,326 | 9577 | import sys
import socket
conn = socket.create_connection(('0.0.0.0', 8080))
msgs = [
# 0 Keep-Alive, Transfer-Encoding chunked
'GET / HTTP/1.1\r\nConnection: Keep-Alive\r\n\r\n',
# 1,2,3 Close, EOF "encoding"
'GET / HTTP/1.1\r\n\r\n',
'GET / HTTP/1.1\r\nConnection: close\r\n\r\n',
'GET / HTTP/... |
Gelatin/parser/Parser.py | Etherbay/Gelatin | 107 | 9585 | <gh_stars>100-1000
# Copyright (c) 2010-2017 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merg... |
icons/svg2png.py | benburrill/formiko | 116 | 9589 | # -*- coding: utf-8 -*-
from gi.repository.GdkPixbuf import Pixbuf
from os import makedirs
def main():
for size in (16, 22, 24, 32, 48, 64, 128, 256, 512):
icon = Pixbuf.new_from_file_at_scale("formiko.svg", size, size, True)
makedirs("%dx%d" % (size, size))
icon.savev("%dx%d/formiko.png"... |
angr/engines/pcode/arch/ArchPcode_PowerPC_LE_32_QUICC.py | matthewpruett/angr | 6,132 | 9631 | ###
### This file was automatically generated
###
from archinfo.arch import register_arch, Endness, Register
from .common import ArchPcode
class ArchPcode_PowerPC_LE_32_QUICC(ArchPcode):
name = 'PowerPC:LE:32:QUICC'
pcode_arch = 'PowerPC:LE:32:QUICC'
description = 'PowerQUICC-III 32-bit little endian fa... |
recipes/Python/52228_Remote_control_with_telnetlib/recipe-52228.py | tdiprima/code | 2,023 | 9633 | <reponame>tdiprima/code<filename>recipes/Python/52228_Remote_control_with_telnetlib/recipe-52228.py
# auto_telnet.py - remote control via telnet
import os, sys, string, telnetlib
from getpass import getpass
class AutoTelnet:
def __init__(self, user_list, cmd_list, **kw):
self.host = kw.get('host', 'localho... |
Codes/Python32/Lib/importlib/test/extension/test_path_hook.py | eyantra/FireBird_Swiss_Knife | 319 | 9637 | from importlib import _bootstrap
from . import util
import collections
import imp
import sys
import unittest
class PathHookTests(unittest.TestCase):
"""Test the path hook for extension modules."""
# XXX Should it only succeed for pre-existing directories?
# XXX Should it only work for directories contai... |
external_plugin_deps.bzl | michalgagat/plugins_oauth | 143 | 9646 | <reponame>michalgagat/plugins_oauth
load("//tools/bzl:maven_jar.bzl", "maven_jar")
def external_plugin_deps(omit_commons_codec = True):
JACKSON_VERS = "2.10.2"
maven_jar(
name = "scribejava-core",
artifact = "com.github.scribejava:scribejava-core:6.9.0",
sha1 = "ed761f450d8382f75787e8fe... |
litex/build/altera/quartus.py | osterwood/litex | 1,501 | 9678 | #
# This file is part of LiteX.
#
# Copyright (c) 2014-2019 <NAME> <<EMAIL>>
# Copyright (c) 2019 msloniewski <<EMAIL>>
# Copyright (c) 2019 vytautasb <<EMAIL>>
# SPDX-License-Identifier: BSD-2-Clause
import os
import subprocess
import sys
import math
from shutil import which
from migen.fhdl.structure import _Fragmen... |
Knapsack.py | byterubpay/mininero1 | 182 | 9688 | <reponame>byterubpay/mininero1
import Crypto.Random.random as rand
import itertools
import math #for log
import sys
def decomposition(i):
#from stack exchange, don't think it's uniform
while i > 0:
n = rand.randint(1, i)
yield n
i -= n
def Decomposition(i):
while True:
l = l... |
deep-rl/lib/python2.7/site-packages/OpenGL/GL/ARB/transform_feedback_instanced.py | ShujaKhalid/deep-rl | 210 | 9764 | <filename>deep-rl/lib/python2.7/site-packages/OpenGL/GL/ARB/transform_feedback_instanced.py<gh_stars>100-1000
'''OpenGL extension ARB.transform_feedback_instanced
This module customises the behaviour of the
OpenGL.raw.GL.ARB.transform_feedback_instanced to provide a more
Python-friendly API
Overview (from the spec)... |
ahrs/common/geometry.py | jaluebbe/ahrs | 184 | 9788 | <filename>ahrs/common/geometry.py
# -*- coding: utf-8 -*-
"""
Geometrical functions
---------------------
References
----------
.. [W1] Wikipedia: https://de.wikipedia.org/wiki/Ellipse#Ellipsengleichung_(Parameterform)
.. [WAE] Wolfram Alpha: Ellipse. (http://mathworld.wolfram.com/Ellipse.html)
"""
import numpy as n... |
dataclassses_howto.py | CvanderStoep/VideosSampleCode | 285 | 9811 | <gh_stars>100-1000
import dataclasses
import inspect
from dataclasses import dataclass, field
from pprint import pprint
import attr
class ManualComment:
def __init__(self, id: int, text: str):
self.id: int = id
self.text: str = text
def __repr__(self):
return "{}(id={}, text={})".for... |
rdkit/ML/InfoTheory/BitRank.py | kazuyaujihara/rdkit | 1,609 | 9818 | <filename>rdkit/ML/InfoTheory/BitRank.py
#
# Copyright (C) 2001,2002,2003 <NAME> and Rational Discovery LLC
#
""" Functionality for ranking bits using info gains
**Definitions used in this module**
- *sequence*: an object capable of containing other objects which supports
__getitem__() and __len__(). Ex... |
layers/eight_mile/pytorch/layers.py | dpressel/baseline | 241 | 9820 | <gh_stars>100-1000
import copy
import math
import logging
from typing import Dict, List, Optional, Tuple, Union
import os
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.jit as jit
import torch.autograd
import contextlib
import glob
from eight_mile.utils import listify... |
third_party/blink/tools/blinkpy/web_tests/breakpad/dump_reader_multipart_unittest.py | zipated/src | 2,151 | 9840 | # Copyright (C) 2013 Google Inc. 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 above copyright
# notice, this list of conditions and the ... |
Chapter04/python/2.0.0/com/sparksamples/util.py | quguiliang/Machine-Learning-with-Spark-Second-Edition | 112 | 9848 | <gh_stars>100-1000
import os
import sys
from pyspark.sql.types import *
PATH = "/home/ubuntu/work/ml-resources/spark-ml/data"
SPARK_HOME = "/home/ubuntu/work/spark-2.0.0-bin-hadoop2.7/"
os.environ['SPARK_HOME'] = SPARK_HOME
sys.path.append(SPARK_HOME + "/python")
from pyspark import SparkContext
from pyspark import S... |
original/baselines/train/JointE+ONE.py | thunlp/JointNRE | 186 | 9882 | #coding:utf-8
import numpy as np
import tensorflow as tf
import os
import time
import datetime
import ctypes
import threading
import json
ll1 = ctypes.cdll.LoadLibrary
lib_cnn = ll1("./init_cnn.so")
ll2 = ctypes.cdll.LoadLibrary
lib_kg = ll2("./init_know.so")
class Config(object):
def __init__(self):
self.in... |
unittests/test_apiv2_user.py | mtcolman/django-DefectDojo | 249 | 9910 | <reponame>mtcolman/django-DefectDojo
from rest_framework.test import APITestCase, APIClient
from django.urls import reverse
from rest_framework.authtoken.models import Token
class UserTest(APITestCase):
"""
Test the User APIv2 endpoint.
"""
fixtures = ['dojo_testdata.json']
def setUp(self):
... |
tests/param/get_param_type_spec_test.py | nickgaya/bravado-core | 122 | 9926 | # -*- coding: utf-8 -*-
import pytest
from mock import Mock
from bravado_core.exception import SwaggerMappingError
from bravado_core.operation import Operation
from bravado_core.param import get_param_type_spec
from bravado_core.param import Param
from bravado_core.spec import Spec
@pytest.fixture
def body_param_spe... |
azure-devops/azure/devops/released/build/build_client.py | imafidon2020/azure-devops-python-api | 248 | 9934 | <filename>azure-devops/azure/devops/released/build/build_client.py
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# ... |
dojo/db_migrations/0147_rename_sslyze_parser.py | dant24/django-DefectDojo | 249 | 9949 | <filename>dojo/db_migrations/0147_rename_sslyze_parser.py
from django.db import migrations
def rename_sslyze_parser(apps, schema_editor):
Test_Type_model = apps.get_model('dojo', 'Test_Type')
try:
test_type_sslyze = Test_Type_model.objects.get(name='SSLyze 3 Scan (JSON)')
test_type_sslyze.name... |
saleor/graphql/channel/tests/test_base_channel_listing.py | fairhopeweb/saleor | 15,337 | 10042 | from collections import defaultdict
import graphene
import pytest
from django.core.exceptions import ValidationError
from ....shipping.error_codes import ShippingErrorCode
from ..mutations import BaseChannelListingMutation
def test_validate_duplicated_channel_ids(channel_PLN, channel_USD):
# given
channel_i... |
QUICK_START/NODE_SQUEEZESEG_CLUSTER/src/script/squeezeseg/utils/clock.py | Hqss/DINK | 189 | 10051 | <reponame>Hqss/DINK
#! /usr/bin/python2
# -*- coding: utf-8 -*-
"""
Clock function to take running time following Segmatch.
"""
# BSD 3-Clause License
#
# Copyright (c) 2019, FPAI
# Copyright (c) 2019, SeriouslyHAO
# Copyright (c) 2019, xcj2019
# Copyright (c) 2019, Leonfirst
#
# All rights reserved.
#
# Redistribution... |
tests/periodicities/gen_makefile.py | jmabry/pyaf | 377 | 10077 | <reponame>jmabry/pyaf<filename>tests/periodicities/gen_makefile.py
import os
import glob
subdirs = glob.glob("tests/periodicities/*");
subdirs = ['tests/periodicities/Month',
'tests/periodicities/Minute',
'tests/periodicities/Week',
'tests/periodicities/Business_Hour',
'test... |
examples/forest_fire/run.py | fire-suppression-abm/mesa | 1,704 | 10095 | <filename>examples/forest_fire/run.py
from forest_fire.server import server
server.launch()
|
llvm-7.0.0.src/utils/unicode-case-fold.py | sillywalk/grazz | 171 | 10099 | <filename>llvm-7.0.0.src/utils/unicode-case-fold.py<gh_stars>100-1000
#!/usr/bin/env python
"""
Unicode case folding database conversion utility
Parses the database and generates a C++ function which implements the case
folding algorithm. The database entries are of the form:
<code>; <status>; <mapping>; # <name>
... |
reviewboard/webapi/tests/test_review_screenshot_comment.py | ParikhKadam/reviewboard | 921 | 10105 | <filename>reviewboard/webapi/tests/test_review_screenshot_comment.py<gh_stars>100-1000
from __future__ import unicode_literals
from django.contrib.auth.models import User
from djblets.webapi.errors import PERMISSION_DENIED
from reviewboard.reviews.models import ScreenshotComment
from reviewboard.webapi.resources impo... |
examples/api/default_value.py | clamdad/atom | 222 | 10118 | <filename>examples/api/default_value.py
# --------------------------------------------------------------------------------------
# Copyright (c) 2013-2021, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
... |
vipermonkey/core/filetype.py | lap1nou/ViperMonkey | 874 | 10124 | <reponame>lap1nou/ViperMonkey<filename>vipermonkey/core/filetype.py
"""
Check for Office file types
ViperMonkey is a specialized engine to parse, analyze and interpret Microsoft
VBA macros (Visual Basic for Applications), mainly for malware analysis.
Author: <NAME> - http://www.decalage.info
License: BSD, see source ... |
packs/kubernetes/tests/test_third_party_resource.py | userlocalhost2000/st2contrib | 164 | 10125 | <gh_stars>100-1000
from st2tests.base import BaseSensorTestCase
from third_party_resource import ThirdPartyResource
class ThirdPartyResourceTestCase(BaseSensorTestCase):
sensor_cls = ThirdPartyResource
def test_k8s_object_to_st2_trigger_bad_object(self):
k8s_obj = {
'type': 'kanye',
... |
bbio/bbio.py | timgates42/PyBBIO | 102 | 10129 | <filename>bbio/bbio.py
"""
PyBBIO - bbio.py
Copyright (c) 2012-2015 - <NAME> <<EMAIL>>
Released under the MIT license
https://github.com/graycatlabs/PyBBIO
"""
import sys, atexit
from .platform import platform_init, platform_cleanup
from .common import ADDITIONAL_CLEANUP, util_init
def bbio_init():
""" Pre-run... |
tests/unit_tests/cx_core/integration/integration_test.py | clach04/controllerx | 204 | 10137 | <gh_stars>100-1000
from cx_core import integration as integration_module
from cx_core.controller import Controller
def test_get_integrations(fake_controller: Controller):
integrations = integration_module.get_integrations(fake_controller, {})
inteagration_names = {i.name for i in integrations}
assert inte... |
datapackage_pipelines/web/server.py | gperonato/datapackage-pipelines | 109 | 10139 | import datetime
import os
from io import BytesIO
import logging
from functools import wraps
from copy import deepcopy
from collections import Counter
import slugify
import yaml
import mistune
import requests
from flask import \
Blueprint, Flask, render_template, abort, send_file, make_response
from flask_cors imp... |
morepath/__init__.py | hugovk/morepath | 314 | 10144 | # flake8: noqa
"""This is the main public API of Morepath.
Additional public APIs can be imported from the :mod:`morepath.error`
and :mod:`morepath.pdbsupport` modules. For custom directive
implementations that interact with core directives for grouping or
subclassing purposes, or that need to use one of the Morepath
... |
examples/custom_shape/stages.py | oksumoron/locust | 18,336 | 10172 | <reponame>oksumoron/locust<filename>examples/custom_shape/stages.py
from locust import HttpUser, TaskSet, task, constant
from locust import LoadTestShape
class UserTasks(TaskSet):
@task
def get_root(self):
self.client.get("/")
class WebsiteUser(HttpUser):
wait_time = constant(0.5)
tasks = [U... |
docs_src/options/callback/tutorial001.py | madkinsz/typer | 7,615 | 10194 | import typer
def name_callback(value: str):
if value != "Camila":
raise typer.BadParameter("Only Camila is allowed")
return value
def main(name: str = typer.Option(..., callback=name_callback)):
typer.echo(f"Hello {name}")
if __name__ == "__main__":
typer.run(main)
|
examples/pybullet/gym/pybullet_envs/minitaur/envs/env_randomizers/minitaur_alternating_legs_env_randomizer.py | felipeek/bullet3 | 9,136 | 10221 | """Randomize the minitaur_gym_alternating_leg_env when reset() is called.
The randomization include swing_offset, extension_offset of all legs that mimics
bent legs, desired_pitch from user input, battery voltage and motor damping.
"""
import os, inspect
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(in... |
roles/openshift_health_checker/library/ocutil.py | shgriffi/openshift-ansible | 164 | 10226 | #!/usr/bin/python
"""Interface to OpenShift oc command"""
import os
import shlex
import shutil
import subprocess
from ansible.module_utils.basic import AnsibleModule
ADDITIONAL_PATH_LOOKUPS = ['/usr/local/bin', os.path.expanduser('~/bin')]
def locate_oc_binary():
"""Find and return oc binary file"""
# htt... |
Python/swap_numbers.py | saurabhcommand/Hello-world | 1,428 | 10245 | a = 5
b = 7
a,b = b,a
print a
print b
|
minotaur/_minotaur.py | giannitedesco/minotaur | 172 | 10257 | <filename>minotaur/_minotaur.py
from typing import Dict, Tuple, Optional
from pathlib import Path
import asyncio
from ._mask import Mask
from ._event import Event
from ._base import InotifyBase
__all__ = ('Minotaur',)
class Notification:
__slots__ = (
'_path',
'_type',
'_isdir',
... |
pyclustering/container/examples/__init__.py | JosephChataignon/pyclustering | 1,013 | 10258 | <reponame>JosephChataignon/pyclustering
"""!
@brief Collection of examples devoted to containers.
@authors <NAME> (<EMAIL>)
@date 2014-2020
@copyright BSD-3-Clause
""" |
tests/conftest.py | junjunjunk/torchgpipe | 532 | 10262 | <reponame>junjunjunk/torchgpipe
import pytest
import torch
@pytest.fixture(autouse=True)
def manual_seed_zero():
torch.manual_seed(0)
@pytest.fixture(scope='session')
def cuda_sleep():
# Warm-up CUDA.
torch.empty(1, device='cuda')
# From test/test_cuda.py in PyTorch.
start = torch.cuda.Event(en... |
pyqtgraph/dockarea/DockDrop.py | hishizuka/pyqtgraph | 2,762 | 10289 | <reponame>hishizuka/pyqtgraph
# -*- coding: utf-8 -*-
from ..Qt import QtCore, QtGui
class DockDrop(object):
"""Provides dock-dropping methods"""
def __init__(self, allowedAreas=None):
object.__init__(self)
if allowedAreas is None:
allowedAreas = ['center', 'right', 'left', 'top', '... |
homeassistant/components/kaiterra/const.py | MrDelik/core | 30,023 | 10305 | """Consts for Kaiterra integration."""
from datetime import timedelta
from homeassistant.const import (
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
CONCENTRATION_MILLIGRAMS_PER_CUBIC_METER,
CONCENTRATION_PARTS_PER_BILLION,
CONCENTRATION_PARTS_PER_MILLION,
PERCENTAGE,
Platform,
)
DOMAIN = "kaite... |
apps/project/views/issue.py | rainydaygit/testtcloudserver | 349 | 10320 | <reponame>rainydaygit/testtcloudserver
from flask import request
from apps.auth.auth_require import required
from apps.project.business.issue import IssueBusiness, IssueRecordBusiness, IssueDashBoardBusiness
from apps.project.extentions import parse_json_form, validation, parse_list_args2
from library.api.render impor... |
reddit2telegram/channels/news/app.py | mainyordle/reddit2telegram | 187 | 10323 | #encoding:utf-8
from utils import weighted_random_subreddit
t_channel = '@news756'
subreddit = weighted_random_subreddit({
'politics': 0.5,
'news': 0.5
})
def send_post(submission, r2t):
return r2t.send_simple(submission,
text='{title}\n\n{self_text}\n\n/r/{subreddit_name}\n{short_link}',
... |
source/documentModel/representations/DocumentNGramSymWinGraph.py | Vyvy-vi/Ngram-Graphs | 178 | 10333 | <gh_stars>100-1000
"""
DocumentNGramSymWinGraph.py
Created on May 23, 2017, 4:56 PM
"""
import networkx as nx
import pygraphviz as pgv
import matplotlib.pyplot as plt
from networkx.drawing.nx_agraph import graphviz_layout
from DocumentNGramGraph import DocumentNGramGraph
class DocumentNGramSymWinGraph(Documen... |
venv/Lib/site-packages/pandas/tests/window/moments/test_moments_consistency_ewm.py | ajayiagbebaku/NFL-Model | 28,899 | 10345 | import numpy as np
import pytest
from pandas import (
DataFrame,
Series,
concat,
)
import pandas._testing as tm
@pytest.mark.parametrize("func", ["cov", "corr"])
def test_ewm_pairwise_cov_corr(func, frame):
result = getattr(frame.ewm(span=10, min_periods=5), func)()
result = result.loc[(slice(Non... |
nni/retiarii/hub/pytorch/nasbench201.py | nbl97/nni | 2,305 | 10349 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from typing import Callable, Dict
import torch
import torch.nn as nn
from nni.retiarii import model_wrapper
from nni.retiarii.nn.pytorch import NasBench201Cell
__all__ = ['NasBench201']
OPS_WITH_STRIDE = {
'none': lambda C_in, C_out, st... |
examples/scripts/flopy_lake_example.py | andrewcalderwood/flopy | 351 | 10400 | import os
import sys
import numpy as np
import matplotlib.pyplot as plt
import flopy
def run():
workspace = os.path.join("lake")
# make sure workspace directory exists
if not os.path.exists(workspace):
os.makedirs(workspace)
fext = "png"
narg = len(sys.argv)
iarg = 0
if narg > 1:... |
changes/api/build_coverage.py | vault-the/changes | 443 | 10473 | <reponame>vault-the/changes
from changes.api.base import APIView
from changes.lib.coverage import get_coverage_by_build_id, merged_coverage_data
from changes.models.build import Build
class BuildTestCoverageAPIView(APIView):
def get(self, build_id):
build = Build.query.get(build_id)
if build is ... |
venv/Lib/site-packages/openpyxl/worksheet/errors.py | ajayiagbebaku/NFL-Model | 5,079 | 10480 | <gh_stars>1000+
#Autogenerated schema
from openpyxl.descriptors.serialisable import Serialisable
from openpyxl.descriptors import (
Typed,
String,
Bool,
Sequence,
)
from openpyxl.descriptors.excel import CellRange
class Extension(Serialisable):
tagname = "extension"
uri = String(allow_none=T... |
idaes/apps/matopt/materials/lattices/diamond_lattice.py | carldlaird/idaes-pse | 112 | 10489 | #################################################################################
# The Institute for the Design of Advanced Energy Systems Integrated Platform
# Framework (IDAES IP) was produced under the DOE Institute for the
# Design of Advanced Energy Systems (IDAES), and is copyright (c) 2018-2021
# by the softwar... |
test/tc/tet_tc_base_predict_multiclass.py | dumpmemory/Pytorch-NLU | 115 | 10501 | # !/usr/bin/python
# -*- coding: utf-8 -*-
# @time : 2021/7/25 19:30
# @author : Mo
# @function: predict model, 预测模块-多类分类
# 适配linux
import platform
import json
import sys
import os
path_root = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
path_sys = os.path.join(path_root, "pytorch_nlu", "pyto... |
tensorflow/python/training/localhost_cluster_performance_test.py | connectthefuture/tensorflow | 101 | 10512 | # 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... |
bell2014/energy/prob_abs_s.py | dmaugis/intrinsic | 134 | 10525 | <gh_stars>100-1000
import numpy as np
class ProbAbsoluteShading(object):
def __init__(self, params):
self.params = params
def cost(self, s_nz):
if self.params.abs_shading_weight:
if self.params.abs_shading_log:
return self.params.abs_shading_weight * \
... |
code/ch_02_foundations/_02_noneness.py | SuppMonkey/write.pythonic.code | 679 | 10534 | <filename>code/ch_02_foundations/_02_noneness.py<gh_stars>100-1000
def find_accounts(search_text):
# perform search...
if not db_is_available:
return None
# returns a list of account IDs
return db_search(search_text)
accounts = find_accounts('python')
if accounts is None:
print("Error: DB ... |
docs/_downloads/dbc5873471dad3c21022112121cbd008/tensorboard_profiler_tutorial.py | woojinsong/PyTorch-tutorials-kr | 221 | 10557 | """
PyTorch Profiler With TensorBoard
====================================
This tutorial demonstrates how to use TensorBoard plugin with PyTorch Profiler
to detect performance bottlenecks of the model.
Introduction
------------
PyTorch 1.8 includes an updated profiler API capable of
recording the CPU side operations ... |
utils/editor.py | tien1504/idinvert_pytorch | 415 | 10572 | <reponame>tien1504/idinvert_pytorch
# python 3.7
"""Utility functions for image editing from latent space."""
import os.path
import numpy as np
__all__ = [
'parse_indices', 'interpolate', 'mix_style',
'get_layerwise_manipulation_strength', 'manipulate', 'parse_boundary_list'
]
def parse_indices(obj, min_val... |
test/cts/tool/CTSConverter/src/nn/specs/V1_1/depthwise_conv2d_float_weights_as_inputs_relaxed.mod.py | zhaoming0/webml-polyfill | 255 | 10586 | #
# Copyright (C) 2018 The Android Open Source Project
#
# 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 la... |
single-shot-pose/lib/linemod_dataset.py | take-cheeze/models | 112 | 10602 | <gh_stars>100-1000
import numpy as np
import os
from chainercv.chainer_experimental.datasets.sliceable import GetterDataset
from chainercv.utils import read_image
linemod_object_diameters = {
'ape': 0.103,
'benchvise': 0.286908,
'cam': 0.173,
'can': 0.202,
'cat': 0.155,
'driller': 0.262,
... |
cubes/common.py | digitalsatori/cubes | 1,020 | 10616 | # -*- encoding: utf-8 -*-
"""Utility functions for computing combinations of dimensions and hierarchy
levels"""
from __future__ import absolute_import
import re
import os.path
import json
from collections import OrderedDict
from .errors import ModelInconsistencyError, ArgumentError, ConfigurationError
from . impor... |
wavenet_iaf.py | Ella77/ClariNet | 126 | 10617 | import torch
import torch.nn as nn
import torch.nn.functional as F
from modules import Conv, ResBlock
class Wavenet_Student(nn.Module):
def __init__(self, num_blocks_student=[1, 1, 1, 1, 1, 1], num_layers=10,
front_channels=32, residual_channels=64, gate_channels=128, skip_channels=64,
... |
sql/src/test/resources/joins/create_sample_table.py | MichelaSalvemini/Modelli_project | 677 | 10620 | #! /usr/bin/env python
from __future__ import print_function
import pandas as pd
import numpy as np
import argparse
def generate_csv(start_index, fname):
cols = [
str('A' + str(i)) for i in range(start_index, NUM_COLS + start_index)
]
data = []
for i in range(NUM_ROWS):
vals = (np.ra... |
cookietemple/create/templates/cli/cli_python/{{ cookiecutter.project_slug_no_hyphen }}/tests/__init__.py | e2jk/cookietemple | 117 | 10628 | <gh_stars>100-1000
"""Test suite for the {{ cookiecutter.project_slug_no_hyphen }} package."""
|
bricks/ev3dev/modules/pybricks/robotics.py | ZPhilo/pybricks-micropython | 115 | 10629 | # SPDX-License-Identifier: MIT
# Copyright (c) 2018-2020 The Pybricks Authors
"""Pybricks robotics module."""
from _pybricks.robotics import DriveBase
|
rl_repr/batch_rl/evaluation.py | xxdreck/google-research | 23,901 | 10641 | <reponame>xxdreck/google-research<filename>rl_repr/batch_rl/evaluation.py
# coding=utf-8
# Copyright 2021 The Google Research 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
#
# ... |
bagua/torch_api/contrib/sync_batchnorm.py | mmathys/bagua | 635 | 10646 | <gh_stars>100-1000
# Copyright (c) Uber Technologies, Inc. and its affiliates.
# Copyright (c) 2021 Kuaishou AI Platform & DS3 Lab.
#
# 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.
from distutils.version import ... |
PNN/model.py | jingxiufenghua/rec-model | 1,323 | 10654 | <reponame>jingxiufenghua/rec-model
"""
Created on July 20, 2020
Updated on May 19, 2021
model: Product-based Neural Networks for User Response Prediction
@author: <NAME>(<EMAIL>)
"""
import tensorflow as tf
from tensorflow.keras import Model
from tensorflow.keras.regularizers import l2
from tensorflow.keras.layers i... |
vehicle/views.py | BernardAli/vehicle-service-mgt | 105 | 10682 | <filename>vehicle/views.py
from django.shortcuts import render,redirect,reverse
from . import forms,models
from django.db.models import Sum
from django.contrib.auth.models import Group
from django.http import HttpResponseRedirect
from django.contrib.auth.decorators import login_required,user_passes_test
from django.con... |
model/img2seq_torch.py | marcoleewow/LaTeX_OCR | 290 | 10707 | <gh_stars>100-1000
import time
import sys
import os
import numpy as np
import torch
import torch.nn as nn
import torchvision.models as models
from torch.nn.utils.rnn import pack_padded_sequence
from model.base_torch import BaseModel
from model.utils.general import init_dir, get_logger
from model.utils.g... |
icons.py | jasantunes/alfred-golinks | 312 | 10730 | <gh_stars>100-1000
# encoding: utf-8
#
# Copyright (c) 2019 <NAME> <<EMAIL>>
#
# MIT Licence. See http://opensource.org/licenses/MIT
#
# Created on 2019-09-06
#
"""Overlay check mark on icons."""
from __future__ import print_function, absolute_import
from Cocoa import (
NSBitmapImageRep,
NSPNGFileType,
... |
examples/applications/plot_impact_imbalanced_classes.py | cdchushig/imbalanced-learn | 5,678 | 10769 | """
==========================================================
Fitting model on imbalanced datasets and how to fight bias
==========================================================
This example illustrates the problem induced by learning on datasets having
imbalanced classes. Subsequently, we compare different approac... |
packages/pyright-internal/src/tests/samples/genericTypes12.py | sasano8/pyright | 4,391 | 10798 | # This sample tests the checker's ability to enforce
# type invariance for type arguments.
# pyright: strict
from typing import Dict, Union
foo: Dict[Union[int, str], str] = {}
bar: Dict[str, str] = {}
# This should generate an error because
# both type parameters for Dict are invariant,
# and str isn't assignable ... |
native_prophet.py | 1143048123/cddh | 177 | 10803 | <gh_stars>100-1000
# coding: utf-8
# quote from kmaiya/HQAutomator
# 谷歌搜索部分原版搬运,未做修改
import time
import json
import requests
import webbrowser
questions = []
def get_answer():
resp = requests.get('http://htpmsg.jiecaojingxuan.com/msg/current',timeout=4).text
resp_dict = json.loads(resp)
... |
python/ht/nodes/styles/styles.py | Hengle/Houdini-Toolbox | 136 | 10804 | """Classes representing color entries and mappings."""
# =============================================================================
# IMPORTS
# =============================================================================
from __future__ import annotations
# Standard Library
import re
from typing import TYPE_CHEC... |
ichnaea/taskapp/app.py | mikiec84/ichnaea | 348 | 10841 | """
Holds global celery application state and startup / shutdown handlers.
"""
from celery import Celery
from celery.app import app_or_default
from celery.signals import (
beat_init,
worker_process_init,
worker_process_shutdown,
setup_logging,
)
from ichnaea.log import configure_logging
from ichnaea.ta... |
dev/bazel/deps/micromkl.bzl | cmsxbc/oneDAL | 169 | 10865 | <filename>dev/bazel/deps/micromkl.bzl<gh_stars>100-1000
#===============================================================================
# Copyright 2020-2021 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 ma... |
dataviz/euvotes.py | Udzu/pudzu | 119 | 10893 | from pudzu.charts import *
from pudzu.sandbox.bamboo import *
import seaborn as sns
# generate map
df = pd.read_csv("datasets/euvotes.csv").set_index('country')
palette = tmap(RGBA, sns.cubehelix_palette(11, start=0.2, rot=-0.75))
ranges = [20000000,10000000,5000000,2000000,1000000,500000,200000,100000,0]
def voteco... |
sandbox/error-correct-pass2.py | sadeepdarshana/khmer | 558 | 10906 | #! /usr/bin/env python
# This file is part of khmer, https://github.com/dib-lab/khmer/, and is
# Copyright (C) 2011-2015, Michigan State University.
# Copyright (C) 2015, The Regents of the University of California.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted pro... |
src/packagedcode/cargo.py | Siddhant-K-code/scancode-toolkit | 1,511 | 10920 | <reponame>Siddhant-K-code/scancode-toolkit<filename>src/packagedcode/cargo.py
# Copyright (c) nexB Inc. and others. All rights reserved.
# ScanCode is a trademark of nexB Inc.
# SPDX-License-Identifier: Apache-2.0
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
# See https://github.com/nexB/scan... |
tests/testing/units.py | mandaltj/gem5_chips | 135 | 10921 | <reponame>mandaltj/gem5_chips<filename>tests/testing/units.py
#!/usr/bin/env python2.7
#
# Copyright (c) 2016 ARM Limited
# All rights reserved
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limite... |
mythic-docker/app/routes/routes.py | rmusser01/Mythic | 934 | 10922 | <reponame>rmusser01/Mythic<gh_stars>100-1000
from app import (
mythic,
links,
nginx_port,
listen_port,
mythic_admin_password,
mythic_admin_user,
default_operation_name,
mythic_db
)
import app
import asyncpg
import redis
from peewee_async import Manager
from sanic.response i... |
sdl2/blendmode.py | namelivia/py-sdl2 | 222 | 10923 | <gh_stars>100-1000
from ctypes import c_int
from .dll import _bind
__all__ = [
# Enums
"SDL_BlendMode",
"SDL_BLENDMODE_NONE", "SDL_BLENDMODE_BLEND", "SDL_BLENDMODE_ADD",
"SDL_BLENDMODE_MOD", "SDL_BLENDMODE_MUL", "SDL_BLENDMODE_INVALID",
"SDL_BlendOperation",
"SDL_BLENDOPERATION_ADD", "SDL_BLEN... |
quickbooks/objects/companycurrency.py | varunbheemaiah/python-quickbooks | 234 | 11003 | <gh_stars>100-1000
from six import python_2_unicode_compatible
from .base import QuickbooksManagedObject, QuickbooksTransactionEntity, Ref, CustomField, MetaData
@python_2_unicode_compatible
class CompanyCurrency(QuickbooksManagedObject, QuickbooksTransactionEntity):
"""
QBO definition: Applicable only for th... |
atlas/foundations_contrib/src/test/archiving/test_artifact_downloader.py | DeepLearnI/atlas | 296 | 11007 |
from foundations_spec import *
from unittest.mock import call
class TestArtifactDownloader(Spec):
mock_archiver = let_mock()
make_directory_mock = let_patch_mock('os.makedirs')
@let
def source_directory(self):
return self.faker.uri_path()
@let
def download_directory(self):
... |
tests/test_git_commit_one_file.py | mubashshirjamal/code | 1,582 | 11009 | <reponame>mubashshirjamal/code
# -*- coding: utf-8 -*-
import os
from vilya.models.project import CodeDoubanProject
from vilya.models import git
from tests.base import TestCase
from tests.utils import mkdtemp
from vilya.libs import gyt
from vilya.libs.permdir import get_repo_root
class TestGit(TestCase):
@pr... |
sunshinectf2020/speedrun/exploit_05.py | nhtri2003gmail/ctf-write-ups | 101 | 11025 | <reponame>nhtri2003gmail/ctf-write-ups<filename>sunshinectf2020/speedrun/exploit_05.py
#!/usr/bin/env python3
from pwn import *
binary = context.binary = ELF('./chall_05')
if not args.REMOTE:
p = process(binary.path)
else:
p = remote('chal.2020.sunshinectf.org', 30005)
p.sendlineafter('Race, life\'s greatest.\n',... |
CompareWHDR.py | Z7Gao/InverseRenderingOfIndoorScene | 171 | 11038 | <filename>CompareWHDR.py
import numpy as np
import sys
import json
import glob
import os.path as osp
import cv2
def compute_whdr(reflectance, judgements, delta=0.1):
points = judgements['intrinsic_points']
comparisons = judgements['intrinsic_comparisons']
id_to_points = {p['id']: p for p in points}
row... |
theonionbox/stamp.py | ralphwetzel/theonionbox | 120 | 11039 | __title__ = 'The Onion Box'
__description__ = 'Dashboard to monitor Tor node operations.'
__version__ = '20.2'
__stamp__ = '20200119|095654'
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.