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 |
|---|---|---|---|---|
tests/server.py | nickanna42/sprite.js | 181 | 100404 | import SimpleHTTPServer
import SocketServer
import os
PORT = 8000
class Allow(SimpleHTTPServer.SimpleHTTPRequestHandler):
def send_head(self):
"""Common code for GET and HEAD commands.
This sends the response code and MIME headers.
Return value is either a file obje... |
src/vnect_model.py | Pandinosaurus/VNect | 220 | 100413 | #!/usr/bin/env python3
# -*- coding: UTF-8 -*-
# Reference:
# https://github.com/timctho/VNect-tensorflow
# https://github.com/EJShim/vnect_estimator
import tensorflow as tf
import tensorflow.contrib as tc
import numpy as np
import pickle
# in tf.layers.conv2d: default_weight_name = kernel, default_bias_name = bia... |
tencentcloud/tts/v20190823/tts_client.py | PlasticMem/tencentcloud-sdk-python | 465 | 100506 | <reponame>PlasticMem/tencentcloud-sdk-python
# -*- coding: utf8 -*-
# Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. 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 Lic... |
apps/dash-salesforce-crm/index.py | JeroenvdSande/dash-sample-apps | 2,332 | 100563 | import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State
from app import sf_manager, app
from panels import opportunities, cases, leads
server = app.server
app.layout = html.Div(
[
html.Div(
className="row header",
... |
src/fermilib/utils/_sparse_tools.py | ProjectQ-Framework/FermiLib | 102 | 100572 | # Copyright 2017 ProjectQ-Framework (www.projectq.ch)
#
# 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... |
cmake_build.py | couchbase/couchbase-python-client | 189 | 100604 | <filename>cmake_build.py
#
# Copyright 2019, Couchbase, Inc.
# 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... |
tests/unit/scalar/test_time.py | matt-koevort/tartiflette | 530 | 100609 | import datetime
import pytest
from tartiflette.scalar.builtins.time import ScalarTime
@pytest.mark.parametrize(
"value,should_raise_exception,expected",
[
(None, True, "Time cannot represent value: < None >."),
(True, True, "Time cannot represent value: < True >."),
(False, True, "Ti... |
mrq/redishelpers.py | fredstro/mrq | 745 | 100624 | from future.builtins import range
from .utils import memoize
from . import context
def redis_key(name, *args):
prefix = context.get_current_config()["redis_prefix"]
if name == "known_subqueues":
return "%s:ksq:%s" % (prefix, args[0].root_id)
elif name == "queue":
return "%s:q:%s" % (prefix, args[0].id)... |
glumpy/geometry/path.py | antoineMoPa/glumpy | 1,074 | 100662 | # -----------------------------------------------------------------------------
# Copyright (c) 2009-2016 <NAME>. All rights reserved.
# Distributed under the (new) BSD License.
# -----------------------------------------------------------------------------
import re
import string
from . import arc, curves
class Path(... |
examples/utils/visualize/exploration_exploitation_chart.py | JokerHB/mealpy | 162 | 100664 | #!/usr/bin/env python
# ------------------------------------------------------------------------------------------------------%
# Created by "Thieu" at 11:35, 11/07/2021 %
# ... |
pypy/tool/isolate_slave.py | nanjekyejoannah/pypy | 381 | 100678 | import sys, os, imp
sys.path.insert(0, os.path.realpath(os.path.join(os.path.dirname(__file__), '..', '..')))
from pypy.tool import slaveproc
class IsolateSlave(slaveproc.Slave):
mod = None
def do_cmd(self, cmd):
cmd, data = cmd
if cmd == 'load':
assert self.mod is None
... |
habitat_extensions/sensors.py | Felix2048/VLN-CE | 106 | 100701 | <reponame>Felix2048/VLN-CE<gh_stars>100-1000
from copy import deepcopy
from typing import Any
import numpy as np
from gym import Space, spaces
from habitat.config import Config
from habitat.core.registry import registry
from habitat.core.simulator import Sensor, SensorTypes, Simulator
from habitat.sims.habitat_simulat... |
examples/rest-api-python/src/db/notes.py | drewfish/serverless-stack | 5,922 | 100719 | import time
import numpy
def getNotes():
return {
"id1": {
"noteId": "id1",
"userId": "user1",
"content": str(numpy.array([1,2,3,4])),
"createdAt": int(time.time()),
},
"id2": {
"noteId": "id2",
"userId": "user2",
"... |
test/com/facebook/buck/core/starlark/rule/testdata/print_works_in_impl/defs.bzl | Unknoob/buck | 8,027 | 100741 | <gh_stars>1000+
""" Module docstring """
def _impl(_ctx):
print("printing at debug level")
my_rule = rule(
attrs = {
},
implementation = _impl,
)
|
code/n4_bias_correction.py | Delta-Sigma/brain_segmentation | 315 | 100742 | from nipype.interfaces.ants import N4BiasFieldCorrection
import sys
import os
import ast
if len(sys.argv) < 2:
print("INPUT from ipython: run n4_bias_correction input_image dimension n_iterations(optional, form:[n_1,n_2,n_3,n_4]) output_image(optional)")
sys.exit(1)
# if output_image is given
if len(sys.argv)... |
promise2012/Vnet/util.py | kevin28520/VNet3D | 121 | 100744 | from tensorflow.python.framework import graph_util
from tensorflow.python.framework import graph_io
import tensorflow as tf
def convertMetaModelToPbModel(meta_model, pb_model):
# Step 1
# import the model metagraph
saver = tf.train.import_meta_graph(meta_model + '.meta', clear_devices=True)
# make tha... |
small_text/integrations/transformers/__init__.py | chschroeder/small-text | 218 | 100798 | from small_text.integrations.pytorch.exceptions import PytorchNotFoundError
try:
from small_text.integrations.transformers.datasets import TransformersDataset
from small_text.integrations.transformers.classifiers.classification import (
TransformerModelArguments,
TransformerBasedClassification,... |
examples/Redfish/get_SmartArray_EncryptionSettings.py | andreaslangnevyjel/python-ilorest-library | 214 | 100825 | # Copyright 2020 Hewlett Packard Enterprise Development LP
#
# 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 ... |
about.py | ardovm/wxGlade | 225 | 100831 | """
About box with general info
@copyright: 2002-2007 <NAME>
@copyright: 2014-2016 <NAME>
@copyright: 2017 <NAME>
@license: MIT (see LICENSE.txt) - THIS PROGRAM COMES WITH NO WARRANTY
"""
import bugdialog
import codecs
import wx
import wx.html
import wx.lib.wxpTag
import config
import misc
import os.path
class wxGl... |
tests/test_hosts_entry.py | mastanpatel/python-hosts | 102 | 100847 | <reponame>mastanpatel/python-hosts
# -*- coding: utf-8 -*-
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from python_hosts.hosts import HostsEntry
def test_create_ipv4_instance():
""" add an ipv4 type entry """
hosts_entry = HostsEntry(entry_type='ipv... |
objectModel/Python/cdm/persistence/syms/manifest_databases_persistence.py | rt112000/CDM | 884 | 100890 | <filename>objectModel/Python/cdm/persistence/syms/manifest_databases_persistence.py
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
import dateutil.parser
from cdm.enums import CdmObjectType
from cdm.objectmodel... |
test/test_string_representation.py | vladsaveliev/pyensembl | 162 | 100926 | <reponame>vladsaveliev/pyensembl
from pyensembl import Locus, Gene, ensembl_grch37, Transcript, Exon
from nose.tools import eq_
def test_Locus_string_representation():
locus = Locus("X", 1000, 1010, "+")
string_repr = str(locus)
expected = "Locus(contig='X', start=1000, end=1010, strand='+')"
eq_(stri... |
torchgeo/trainers/utils.py | khlaifiabilel/torchgeo | 678 | 100935 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
"""Common trainer utilities."""
import warnings
from collections import OrderedDict
from typing import Dict, Optional, Tuple, Union
import torch
import torch.nn as nn
from torch import Tensor
from torch.nn.modules import Co... |
test/issues/test_071.py | ajnelson-nist/pySHACL | 167 | 100951 | # -*- coding: utf-8 -*-
#
"""
https://github.com/RDFLib/pySHACL/issues/71
"""
import rdflib
from pyshacl import validate
shacl_file_text = """\
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix... |
tests/nnapi/specs/V1_0/concat_float_4D_axis3_1_nnfw.mod.py | periannath/ONE | 255 | 100974 | <gh_stars>100-1000
#
# Copyright (C) 2017 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 requir... |
tests/test_pwm.py | CrazyIvan359/python-periphery | 433 | 100993 | import os
import sys
import periphery
from .test import ptest, pokay, passert, AssertRaises
if sys.version_info[0] == 3:
raw_input = input
pwm_chip = None
pwm_channel = None
def test_arguments():
ptest()
# Invalid open types
with AssertRaises("invalid open types", TypeError):
periphery.PW... |
marley/worlds/blackjack/__init__.py | cool-RR/grid_royale | 255 | 100997 | <reponame>cool-RR/grid_royale<gh_stars>100-1000
# Copyright 2020 <NAME> and collaborators.
# This program is distributed under the MIT license.
from .core import *
from .sharknadoing import *
from .commanding import command_group |
python/tests/sklearn/preprocessing/one_hot_encoder_test.py | voganrc/mleap | 1,401 | 101008 | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
tests/v1/id.py | tombry/virlutils | 133 | 101029 | <filename>tests/v1/id.py
from . import BaseTest
from .mocks.api import MockVIRLServer
from click.testing import CliRunner
import requests_mock
from virl.cli.main import virl
class IdTest(BaseTest):
def test_virl_id_nosim(self):
with requests_mock.mock() as m:
# Mock the request to return what... |
scripts/parseLog.py | Kandongwe/RunestoneServer | 344 | 101062 | <filename>scripts/parseLog.py
#!/usr/bin/env python3
# {address space usage: 359067648 bytes/342MB} {rss usage: 107823104 bytes/102MB} [pid: 11266|app: 0|req: 99163/885977] 172.16.31.10 () {48 vars in 1249 bytes} [Thu Feb 15 16:28:43 2018] GET /runestone/ajax/getnumonline => generated 16 bytes in 2553 msecs (HTTP/1.1 ... |
python/_impl.py | gglin001/poptorch | 128 | 101073 | <gh_stars>100-1000
# Copyright (c) 2020 Graphcore Ltd. All rights reserved.
from contextlib import contextmanager
import copy
import fcntl
import hashlib
import os
from typing import Dict, Any
import torch
# Do not import any poptorch.* here: it will break the poptorch module
from ._logging import logger
from . impor... |
third_party/gsutil/third_party/rsa/tests/test_parallel.py | tingshao/catapult | 5,079 | 101113 | """Test for multiprocess prime generation."""
import unittest
import rsa.prime
import rsa.parallel
import rsa.common
class ParallelTest(unittest.TestCase):
"""Tests for multiprocess prime generation."""
def test_parallel_primegen(self):
p = rsa.parallel.getprime(1024, 3)
self.assertFalse(r... |
tests/test_model_type.py | Attsun1031/schematics | 1,430 | 101135 | <gh_stars>1000+
import pytest
from schematics.models import Model
from schematics.types import IntType, StringType
from schematics.types.compound import ModelType, ListType
from schematics.exceptions import DataError
from schematics.util import ImportStringError
def test_simple_embedded_models():
class Location(... |
pyNastran/bdf/cards/test/test_bars.py | ACea15/pyNastran | 293 | 101140 | import os
import unittest
import numpy as np
from pyNastran.bdf.bdf import BDF, BDFCard, CBAR, PBAR, PBARL, GRID, MAT1
from pyNastran.bdf.field_writer_8 import print_card_8
from pyNastran.bdf.mesh_utils.mass_properties import (
mass_properties, mass_properties_nsm) #mass_properties_breakdown
from pyNastran.bdf.c... |
airmozilla/comments/forms.py | RAMilewski/airmozilla | 115 | 101146 | <filename>airmozilla/comments/forms.py
from django import forms
from airmozilla.base.forms import BaseForm
from airmozilla.comments.models import Comment
class CommentForm(BaseForm):
name = forms.CharField(required=False)
comment = forms.CharField(widget=forms.Textarea)
reply_to = forms.IntegerField(req... |
argostranslate/fewshot.py | argosopentechnologies/Argos-Translate | 1,114 | 101151 | prompt = """Translate to French (fr)
From English (es)
==========
Bramshott is a village with mediaeval origins in the East Hampshire district of Hampshire, England. It lies 0.9 miles (1.4 km) north of Liphook. The nearest railway station, Liphook, is 1.3 miles (2.1 km) south of the village.
----------
Bramshott est u... |
tests/gold_tests/tls/tls_client_cert_override_plugin.test.py | cmcfarlen/trafficserver | 1,351 | 101163 | <gh_stars>1000+
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "Li... |
pixloc/pixlib/models/base_optimizer.py | jmorlana/pixloc | 457 | 101183 | <filename>pixloc/pixlib/models/base_optimizer.py
"""
Implements a simple differentiable optimizer based on Levenberg-Marquardt
with a constant, scalar damping factor and a fixed number of iterations.
"""
import logging
from typing import Tuple, Dict, Optional
import torch
from torch import Tensor
from .base_model imp... |
aztk/spark/models/plugins/jupyter/configuration.py | Geims83/aztk | 161 | 101191 | import os
from aztk.models.plugins.plugin_configuration import PluginConfiguration, PluginPort, PluginTargetRole
from aztk.models.plugins.plugin_file import PluginFile
dir_path = os.path.dirname(os.path.realpath(__file__))
def JupyterPlugin():
return PluginConfiguration(
name="jupyter",
ports=[Pl... |
packages/core/src/RPA/core/locators/literal.py | amisol/rpaframework | 518 | 101206 | <filename>packages/core/src/RPA/core/locators/literal.py
from typing import Union
from RPA.core.locators import LocatorsDatabase, Locator, TYPES
LocatorType = Union[str, Locator]
def _unquote(text):
if text.startswith('"') and text.endswith('"'):
text = text[1:-1]
return text
def parse(locator: Loc... |
tock/projects/migrations/0026_auto_20200519_1616.py | elisoncrum/tock | 134 | 101211 | # Generated by Django 2.2.12 on 2020-05-19 20:16
from django.db import migrations
def populate_project_organizations(apps, schema_editor):
Project = apps.get_model('projects', 'Project')
Organization = apps.get_model('organizations', 'Organization')
# assignment of existing projects to orgs based on proj... |
api/src/opentrons/hardware_control/modules/lid_temp_status.py | anuwrag/opentrons | 235 | 101221 | <reponame>anuwrag/opentrons<gh_stars>100-1000
from opentrons.drivers.types import Temperature
from opentrons.hardware_control.modules.types import TemperatureStatus
class LidTemperatureStatus:
"""A wrapper for the lid temperature status."""
TEMP_THRESHOLD = 0.3
"""The threshold under which the difference... |
tests/helpers.py | achalpatel/thenewboston-python | 122 | 101227 | <reponame>achalpatel/thenewboston-python
from thenewboston.accounts.manage import create_account
from thenewboston.verify_keys.verify_key import encode_verify_key
def random_encoded_account_number():
signing_key, account_number = create_account()
return encode_verify_key(verify_key=account_number)
|
torch/_package/exporter.py | jsun94/nimble | 206 | 101345 | import torch
from torch.serialization import normalize_storage_type, location_tag, _should_read_directly
import io
import pickle
import pickletools
from .find_file_dependencies import find_files_source_depends_on
from ._custom_import_pickler import CustomImportPickler
from ._importlib import _normalize_path
import type... |
sdk/python/pulumi_azure/devtest/lab.py | henriktao/pulumi-azure | 109 | 101361 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... |
docs/src/assets/soap_weighting_plot.py | Iximiel/dscribe | 265 | 101388 | import numpy as np
import matplotlib.pyplot as plt
fig, (ax1, ax2, ax3) = plt.subplots(3, 1, sharex=True, figsize=(8,12))
# Plot pow with different settings
t = 1e-2
rcut = 5
settings = [
[2, rcut/(1/t*(1-t)) ** (1 / 2), 1],
[4, rcut/(1/t*(1-t)) ** (1 / 4), 1],
[8, rcut/(1/t*(1-t)) ** (1 / 8), 1],
]
rmin... |
Chapter09/chatbots_code/chatbot.py | vinay4711/Hands-On-Natural-Language-Processing-with-Python | 110 | 101426 | <reponame>vinay4711/Hands-On-Natural-Language-Processing-with-Python<gh_stars>100-1000
from sklearn import metrics
from itertools import chain
from six.moves import range, reduce
import numpy as np
import tensorflow as tf
from data_utils import tokenize, parse_dialogs_per_response
from memory_network import MemoryNetw... |
exercises/list-ops/list_ops.py | kishankj/python | 1,177 | 101430 | <gh_stars>1000+
def append(list1, list2):
pass
def concat(lists):
pass
def filter(function, list):
pass
def length(list):
pass
def map(function, list):
pass
def foldl(function, list, initial):
pass
def foldr(function, list, initial):
pass
def reverse(list):
pass
|
modules/tools/prediction/data_pipelines/common/util.py | jzjonah/apollo | 22,688 | 101439 | <reponame>jzjonah/apollo<filename>modules/tools/prediction/data_pipelines/common/util.py
#!/usr/bin/env python3
###############################################################################
# Copyright 2018 The Apollo Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
#... |
planning&perception/moveit_skill/probot_demo/scripts/moveit_fk_demo.py | Hinson-A/guyueclass | 227 | 101448 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2019 Wuhan PS-Micro Technology Co., Itd.
#
# 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.apach... |
test/test_tensorflow_recipe.py | huggingface/neural-compressor | 172 | 101456 | <reponame>huggingface/neural-compressor
#
# -*- coding: utf-8 -*-
#
import unittest
import os
import yaml
import tensorflow as tf
from tensorflow.python.framework import graph_util
from neural_compressor.adaptor.tf_utils.util import disable_random
def build_fake_yaml_disable_first_quantization():
fake_yaml = ''... |
atomate/vasp/firetasks/approx_neb_dynamic_tasks.py | rkingsbury/atomate | 167 | 101493 | from fireworks import FiretaskBase, FWAction, explicit_serialize, Workflow
from atomate.utils.utils import env_chk
from atomate.vasp.database import VaspCalcDb
from atomate.vasp.fireworks.approx_neb import ImageFW
from atomate.common.powerups import powerup_by_kwargs
__author__ = "<NAME>"
__email__ = "<EMAIL>"
@expl... |
certstream/__init__.py | costasko/certstream-python | 331 | 101498 | from .core import listen_for_events |
scripts/analytics/file_summary.py | gaybro8777/osf.io | 628 | 101499 | <filename>scripts/analytics/file_summary.py
import django
django.setup()
from django.contrib.contenttypes.models import ContentType
from django.db.models import Q
import logging
from dateutil.parser import parse
from datetime import datetime, timedelta
from django.utils import timezone
from osf.models import Abstract... |
vegans/models/unconditional/LRGAN.py | unit8co/vegans | 459 | 101517 | """
LRGAN
-----
Implements the latent regressor GAN well described in the BicycleGAN paper[1].
It introduces an encoder network which maps the generator output back to the latent
input space. This should help to prevent mode collapse and improve image variety.
Losses:
- Generator: Binary cross-entropy + L1-latent... |
facexlib/headpose/hopenet_arch.py | spy14414/facexlib | 164 | 101521 | import torch
import torch.nn as nn
import torchvision
class HopeNet(nn.Module):
# Hopenet with 3 output layers for yaw, pitch and roll
# Predicts Euler angles by binning and regression with the expected value
def __init__(self, block, layers, num_bins):
super(HopeNet, self).__init__()
if b... |
recipes/Python/535165_stock_market_check_v2/recipe-535165.py | tdiprima/code | 2,023 | 101540 | from threading import Thread
from time import sleep
from PythonCard import model
import urllib
import re
def get_quote(symbol):
global quote
base_url = 'http://finance.google.com/finance?q='
content = urllib.urlopen(base_url + symbol).read()
m = re.search('class="pr".*?>(.*?)<', conten... |
th_evernote/forms.py | Leopere/django-th | 1,069 | 101553 | <reponame>Leopere/django-th
# coding: utf-8
from django import forms
from django.forms import TextInput
from th_evernote.models import Evernote
class EvernoteForm(forms.ModelForm):
"""
for to handle Evernote service
"""
class Meta:
model = Evernote
fields = ('tag', 'notebook', )... |
demo/play_with_saved_model.py | simonoso/EasyRL | 125 | 101588 | import gym
import numpy as np
import tensorflow as tf
from tensorflow import saved_model as sm
from easy_rl.utils.window_stat import WindowStat
from easy_rl.utils.gym_wrapper.atari_wrapper import make_atari, wrap_deepmind
import time
def main():
gym_env = gym.make("CartPole-v0")
atari_env = make_atari("PongN... |
utilities/source_setup/setup.py | sanjayankur31/org.geppetto | 164 | 101595 | #!/usr/bin/python
#
# Script to clone Geppetto git repositories
# If a target directory is not passed as the
# first argument, the sourcesdir specified in
# config.json is used
# If config.json is used, org.geppetto.core,
# model, frontend and simulation are
# included automatically.
# The user can chose to select the ... |
optbinning/binning/continuous_binning.py | jensgk/optbinning | 207 | 101599 | """
Optimal binning algorithm for continuous target.
"""
# <NAME> <<EMAIL>>
# Copyright (C) 2019
import numbers
import time
from sklearn.utils import check_array
import numpy as np
from ..information import solver_statistics
from ..logging import Logger
from .auto_monotonic import auto_monotonic_continuous
from .a... |
server/apps/movie/adminx.py | Mayandev/django_morec | 129 | 101656 | <filename>server/apps/movie/adminx.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2019-04-19 20:45
# @Author : Mayandev
# @Site : https://github.com/Mayandev/
# @File : adminx.py
# @Software: PyCharm
import xadmin
from .models import Movie, Genre
class MovieAdmin(object):
list_display = ['i... |
openr/py/openr/cli/tests/prefixmgr/tests.py | nathanawmk/openr | 880 | 101662 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
from typing import Optional
from unittest.mock import MagicMock, patch
from click.testing import CliRun... |
rl/test.py | fancyerii/blog-codes | 159 | 101668 | <gh_stars>100-1000
import gym
import numpy as np
from matplotlib import pyplot as plt
env = gym.envs.make("MountainCar-v0")
env.reset()
plt.figure()
plt.imshow(env.render(mode='rgb_array'))
for x in range(1000):
env.step(1)
plt.figure()
plt.imshow(env.render(mode='rgb_array'))
env.render(close=False) |
utils/utils.py | Dai-z/pytorch-superpoint | 390 | 101683 | """util functions
# many old functions, need to clean up
# homography --> homography
# warping
# loss --> delete if useless
"""
import numpy as np
import torch
from pathlib import Path
import datetime
import datetime
from collections import OrderedDict
import torch.nn.functional as F
import torch.nn as nn
###### check... |
kolibri/core/logger/constants/interaction_types.py | MBKayro/kolibri | 545 | 101698 | <reponame>MBKayro/kolibri<filename>kolibri/core/logger/constants/interaction_types.py
HINT = "hint"
ANSWER = "answer"
ERROR = "error"
|
tools/utilities/optimizer/profile_builder.py | awf/ELL | 2,094 | 101712 | #!/usr/bin/env python3
####################################################################################################
#
# Project: Embedded Learning Library (ELL)
# File: profile_builder.py
# Authors: <NAME>
#
# Requires: Python 3.x
#
####################################################################... |
nnef_tools/model/utils.py | KhronosGroup/NNEF-Tools | 193 | 101727 | # Copyright (c) 2020 The Khronos Group 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 agreed ... |
tests/test_zkviz.py | ktw5691/zkviz | 105 | 101750 | from pathlib import Path
from tempfile import TemporaryDirectory
from unittest import TestCase
from zkviz import zkviz
class TestListZettels(TestCase):
def test_list_zettels_with_md_extension(self):
# Create a temporary folder and write files in it
with TemporaryDirectory() as tmpdirname:
... |
rpython/translator/goal/targetgcbench.py | nanjekyejoannah/pypy | 381 | 101758 | <gh_stars>100-1000
from rpython.translator.goal import gcbench
from rpython.memory.test.test_transformed_gc import MyGcHooks, GcHooksStats
# _____ Define and setup target ___
GC_HOOKS_STATS = GcHooksStats()
def entry_point(argv):
GC_HOOKS_STATS.reset()
ret = gcbench.entry_point(argv)
minors = GC_HOOKS_ST... |
ml-models-analyses/readahead-mixed-workload/parse-experiments-with-faults.py | drewscottt/kernel-ml | 167 | 101784 | <filename>ml-models-analyses/readahead-mixed-workload/parse-experiments-with-faults.py
#!/usr/bin/env python3.9
#
# Copyright (c) 2019-2021 <NAME>
# Copyright (c) 2021-2021 <NAME>
# Copyright (c) 2021-2021 <NAME>
# Copyright (c) 2021-2021 <NAME>
# Copyright (c) 2020-2021 <NAME>
# Copyright (c) 2020-2021 <NAME>
# Copyr... |
modules/vulnerabilities/other/netgear-router-auth-bypass.py | cckuailong/pocsploit | 106 | 101787 | <gh_stars>100-1000
import requests
# Vuln Base Info
def info():
return {
"author": "cckuailong",
"name": '''NETGEAR DGN2200v1 Router Authentication Bypass''',
"description": '''NETGEAR DGN2200v1 Router does not require authentication if a page has ".jpg", ".gif", or "ess_" substrings, howe... |
revise/libs/python/pyste/tests/runtests.py | DD-L/deel.boost.python | 198 | 101810 | <reponame>DD-L/deel.boost.python
# Copyright <NAME> 2003. Use, modification and
# distribution is subject to the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#!/usr/bin/python
import sys
sys.path.append('../src/Pyste')
impo... |
web/iosblog/settings.py | mrscorpion/MSEasyReader | 519 | 101811 | <filename>web/iosblog/settings.py<gh_stars>100-1000
"""
Django settings for iosblog project.
Generated by 'django-admin startproject' using Django 1.9.1.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djan... |
test/numbers/complex1.py | kylebarron/MagicPython | 1,482 | 101815 | 3.14j
10.j
10j
.001j
1e100j
3.14e-10j
3.14 : constant.numeric.float.python, source.python
j : constant.numeric.float.python, source.python, storage.type.imaginary.number.python
10. : constant.numeric.float.python, source.python
j : constant.numeric.float.python, source.pyth... |
megatron/text_generation_server.py | zhisbug/Megatron-LM | 2,869 | 101816 | <gh_stars>1000+
# coding=utf-8
# Copyright (c) 2020, NVIDIA CORPORATION. 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... |
butterflow/version.py | changhaitravis/butterflow | 1,340 | 101817 | __version__ = '0.2.4a4'
|
notebook/numpy_fancy_indexing.py | vhn0912/python-snippets | 174 | 101827 | import numpy as np
a = np.arange(10) * 10
print(a)
# [ 0 10 20 30 40 50 60 70 80 90]
print(a[5])
# 50
print(a[8])
# 80
print(a[[5, 8]])
# [50 80]
print(a[[5, 4, 8, 0]])
# [50 40 80 0]
print(a[[5, 5, 5, 5]])
# [50 50 50 50]
idx = np.array([[5, 4], [8, 0]])
print(idx)
# [[5 4]
# [8 0]]
print(a[idx])
# [[50 40]
... |
predpatt/rules.py | spyysalo/PredPatt | 114 | 101834 | from __future__ import print_function
class Rule(object):
def __init__(self):
pass
def __repr__(self):
return self.name()
@classmethod
def name(cls):
return cls.__name__.split('.')[-1]
@classmethod
def explain(cls):
return cls.__doc__
def __cmp__(self, other)... |
bnpy/datasets/zzz_unsupported/JainNealEx1.py | jun2tong/bnp-anomaly | 184 | 101841 | <filename>bnpy/datasets/zzz_unsupported/JainNealEx1.py
'''
JainNealEx1.py
Toy binary data from K=5 states.
Usage
---------
To take a look at the states, just run this script as an executable.
$ python JainNealEx1.py
'''
import numpy as np
import scipy.linalg
from bnpy.data import XData
def get_short_name():
''... |
otrans/recognize/speech2text.py | jiyanglii/OpenTransformer | 321 | 101858 | <filename>otrans/recognize/speech2text.py
import torch
from otrans.data import EOS, BOS
from otrans.recognize.base import Recognizer
from packaging import version
class SpeechToTextRecognizer(Recognizer):
def __init__(self, model, lm=None, lm_weight=0.1, ctc_weight=0.0, beam_width=5, nbest=1,
max_... |
cacreader/swig-4.0.2/Examples/test-suite/python/using_extend_runme.py | kyletanyag/LL-Smartcard | 1,031 | 101908 | from using_extend import *
f = FooBar()
if f.blah(3) != 3:
raise RuntimeError, "blah(int)"
if f.blah(3.5) != 3.5:
raise RuntimeError, "blah(double)"
if f.blah("hello") != "hello":
raise RuntimeError, "blah(char *)"
if f.blah(3, 4) != 7:
raise RuntimeError, "blah(int,int)"
if f.blah(3.5, 7.5) != (3.... |
animeMusic_server/helper/image.py | waahah/animeMusic | 287 | 101911 | # -*- coding:utf-8 -*-
# 图片处理代码基于http://fc-lamp.blog.163.com/blog/static/174566687201282424018946/小幅度修改
from PIL import Image as image
def resizeImg(**args):
args_key = {'path': '', 'out_path': '', 'width': '', 'height': '', 'quality': 75}
arg = {}
for key in args_key:
if key in args:
... |
app/backend/src/couchers/migrations/versions/62fcd41e4dcd_implement_signup_flow_v2.py | foormea/couchers | 226 | 101955 | """Implement signup flow v2
Revision ID: <KEY>
Revises: 1c7784767710
Create Date: 2021-06-25 08:17:24.410658
"""
import geoalchemy2
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = "<KEY>"
down_revision = "1c7784767710"
bran... |
exercises/pt/solution_01_03_02.py | Jette16/spacy-course | 2,085 | 101960 | <gh_stars>1000+
# Importar a classe da língua inglesa (English) e criar um objeto nlp
from spacy.lang.en import English
nlp = English()
# Processar o texto
doc = nlp("I like tree kangaroos and narwhals.")
# Uma partição do Doc para "tree kangaroos"
tree_kangaroos = doc[2:4]
print(tree_kangaroos.text)
# Uma partição... |
server/workers/dataprocessing/src/streamgraph.py | chreman/Headstart | 111 | 101965 | <gh_stars>100-1000
import pandas as pd
import logging
import sys
import re
import numpy as np
from itertools import chain
from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer
from sklearn.decomposition import NMF, LatentDirichletAllocation
formatter = logging.Formatter(fmt='%(asctime)s %(level... |
DjangoTutorial_v3.5/lesson1/task1/tests_subtask4.py | behzod/pycharm-courses | 213 | 101972 | from test_helper import run_common_tests, failed, passed, get_answer_placeholders, do_not_run_on_check
if __name__ == '__main__':
do_not_run_on_check()
run_common_tests()
|
CalibTracker/SiStripESProducers/python/SiStripGainESProducer_cfi.py | ckamtsikis/cmssw | 852 | 101996 | import FWCore.ParameterSet.Config as cms
siStripGainESProducer = cms.ESProducer("SiStripGainESProducer",
appendToDataLabel = cms.string(''),
printDebug = cms.untracked.bool(False),
AutomaticNormalization = cms.bool(False),
APVGain = cms.VPSet(
cms.PSet(
Record = cms.string('SiStripA... |
src/lightning_classes/lightning_ner.py | mohamedbakrey12/prpjectINDeepLearning | 122 | 101999 | from typing import Dict
import numpy as np
import pytorch_lightning as pl
import torch
from omegaconf import DictConfig
from src.utils.technical_utils import load_obj
class LitNER(pl.LightningModule):
def __init__(self, cfg: DictConfig, tag_to_idx: Dict):
super(LitNER, self).__init__()
self.cfg ... |
ex/parser/scanner_command_unabbreviate.py | my-personal-forks/Vintageous | 1,146 | 102015 | from .state import EOF
from .tokens import TokenEof
from .tokens_base import TOKEN_COMMAND_UNABBREVIATE
from .tokens_base import TokenOfCommand
from Vintageous import ex
@ex.command('unabbreviate', 'una')
class TokenUnabbreviate(TokenOfCommand):
def __init__(self, params, *args, **kwargs):
super().__init_... |
auctioning_platform/auctions/auctions/application/use_cases/ending_auction.py | nhdinh/smp-modulith | 299 | 102028 | <reponame>nhdinh/smp-modulith
from dataclasses import dataclass
from auctions.application.repositories import AuctionsRepository
from auctions.domain.value_objects import AuctionId
@dataclass
class EndingAuctionInputDto:
auction_id: AuctionId
class EndingAuction:
def __init__(self, auctions_repo: AuctionsR... |
config/custom_components/ziggonext/const.py | LRvdLinden/homeassistant-config | 288 | 102064 | <filename>config/custom_components/ziggonext/const.py<gh_stars>100-1000
"""Constants for the Ziggo Mediabox Next integration."""
ZIGGO_API = "ziggo_api"
CONF_COUNTRY_CODE = "country_code"
RECORD = "record"
REWIND = "rewind"
FAST_FORWARD = "fast_forward" |
thespian/test/test_actorSignals.py | dendron2000/Thespian | 210 | 102094 | import logging
import time, datetime
from thespian.actors import *
from thespian.test import *
import signal
import os
class KillMeActor(Actor):
def receiveMessage(self, msg, sender):
logging.info('EchoActor got %s (%s) from %s', msg, type(msg), sender)
self.send(sender, os.getpid())
class Paren... |
lib/__init__.py | uwitec/LEHome | 151 | 102106 | import command, speech, sound, model, helper
|
tests/test_managers_otp.py | aphex3k/specter-desktop | 683 | 102107 | <reponame>aphex3k/specter-desktop
import os
from cryptoadvance.specter.managers.otp_manager import OtpManager
import time
def test_OtpManager(empty_data_folder):
# A OtpManager manages Otp, one-time-passwords
# via json-files in an empty data folder
otpm = OtpManager(data_folder=empty_data_folder)
ass... |
env/lib/python3.8/site-packages/_plotly_utils/importers.py | acrucetta/Chicago_COVI_WebApp | 11,750 | 102142 | <filename>env/lib/python3.8/site-packages/_plotly_utils/importers.py
import importlib
def relative_import(parent_name, rel_modules=(), rel_classes=()):
"""
Helper function to import submodules lazily in Python 3.7+
Parameters
----------
rel_modules: list of str
list of submodules to impor... |
infra/bots/recipe_modules/run/api.py | pospx/external_skia | 2,151 | 102166 | <filename>infra/bots/recipe_modules/run/api.py
# Copyright 2016 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.
# pylint: disable=W0201
from recipe_engine import recipe_api
TEST_DEFAULT_ASSET_VERSION = '42'
class Ski... |
tests/conftest.py | zenoone/deepqmc | 224 | 102211 | <filename>tests/conftest.py
import torch
torch.manual_seed(0)
|
cftracker/config/cn_config.py | Existever/PyCFTrackers | 231 | 102217 | <gh_stars>100-1000
class CNConfig:
interp_factor = 0.075
sigma = 0.2
lambda_= 0.01
output_sigma_factor=1./16
padding=1
cn_type = 'pyECO'
|
tests/gdb/print_symbol.py | cohortfsllc/cohort-cocl2-sandbox | 2,151 | 102229 | <gh_stars>1000+
# -*- python -*-
# Copyright (c) 2012 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import gdb_test
class PrintSymbolTest(gdb_test.GdbTest):
def test_print_symbol(self):
self.gdb.Command('br... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.