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 |
|---|---|---|---|---|
release/check_preamble.py | sivchand/smart_open | 2,047 | 12602731 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2019 <NAME> <<EMAIL>>
#
# This code is distributed under the terms and conditions
# from the MIT License (MIT).
#
"""Checks preambles of Python script files.
We want to ensure they all contain the appropriate license and copyright.
For the purposes of this script, the *pream... |
metadata_in_type_annotations.py | CvanderStoep/VideosSampleCode | 285 | 12602735 | <filename>metadata_in_type_annotations.py
from typing import Annotated, TypeVar, get_args
import struct2
UnsignedShort = Annotated[int, struct2.ctype('H')]
SignedChar = Annotated[int, struct2.ctype('b')]
assert get_args(UnsignedShort) == (int, struct2.ctype('H'))
class Student(struct2.Packed):
name: Annotated[s... |
junc/utils/utils.py | moliushang/wireframe_ | 148 | 12602788 | from numpy.random import randn
import ref
import torch
import numpy as np
def adjust_learning_rate(optimizer, epoch, LR, LR_param):
#lr = LR * (0.1 ** (epoch // dropLR))
LR_policy = LR_param.get('lr_policy', 'step')
if LR_policy == 'step':
steppoints = LR_param.get('steppoints', [4, 7, 9, 10])
... |
doc/examples/scripts/sequence/hcn_similarity.py | alex123012/biotite | 208 | 12602814 | """
Similarity of HCN and related channels
======================================
This example creates a simple dendrogram for HCN channels and
other proteins of the *cyclic nucleotide–gated* (NCG) ion channel
superfamily.
As distance measure the deviation from sequence identity is used:
For identical sequences the d... |
samples/archive/hls4ml/toynn.py | zzzDavid/heterocl | 236 | 12602820 | import heterocl as hcl
import numpy as np
import numpy.testing as tst
import os
import urllib.request
from hlib.op.extern import (
create_extern_module, register_extern_ip,
register_tensors, include_dependency)
@register_extern_ip(type="vhls")
def toynn_vhls_ip(input_1, output_1, name=None):
if name is No... |
sparse_operation_kit/documents/source/util.py | ShaunHeNJU/DeepRec-1 | 292 | 12602841 | <filename>sparse_operation_kit/documents/source/util.py
"""
Copyright (c) 2021, NVIDIA 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-... |
artemis/plotting/test_easy_plotting.py | peteroconnor-bc/artemis | 235 | 12602847 | <reponame>peteroconnor-bc/artemis
import numpy as np
from artemis.plotting.easy_plotting import ezplot
__author__ = 'peter'
class DataContainer(object):
def __init__(self, im, line, struct, text, number):
self._im = im
self._line = line
self._struct = struct
self._text = text
... |
saleor/graphql/warehouse/tests/benchmark/test_stocks.py | eanknd/saleor | 1,392 | 12602874 | <filename>saleor/graphql/warehouse/tests/benchmark/test_stocks.py
import pytest
from .....warehouse.models import Stock, Warehouse
from ....tests.utils import get_graphql_content
@pytest.fixture
def stocks(address, variant):
warehouses = Warehouse.objects.bulk_create(
[
Warehouse(
... |
jnpr/openclos/cli_parser.py | rohitt29/OpenClos | 114 | 12602893 | #------------------------------------------------------------------------------
# cli_parser.py
#------------------------------------------------------------------------------
'''
@author : rgiyer
Date : October 20th, 2014
This module is responsible for parsing command model defined in
cl... |
Alignment/CommonAlignmentProducer/python/ALCARECOTkAlCosmics_Output_cff.py | ckamtsikis/cmssw | 852 | 12602898 | # Author : <NAME>
# Date : July 19th, 2007
# last update: $Date: 2011/02/09 09:10:11 $ by $Author: cerminar $
import FWCore.ParameterSet.Config as cms
# AlCaReco for track based alignment using Cosmic muon events
OutALCARECOTkAlCosmics_noDrop = cms.PSet(
SelectEvents = cms.untracked.PSet(
Sele... |
chapter2/chapter2_basics_05.py | GoodMonsters/Building-Data-Science-Applications-with-FastAPI | 107 | 12602938 | <gh_stars>100-1000
def retrieve_page(page):
if page > 3:
return {"next_page": None, "items": []}
return {"next_page": page + 1, "items": ["A", "B", "C"]}
items = []
page = 1
while page is not None:
page_result = retrieve_page(page)
items += page_result["items"]
page = page_result["next_pag... |
care/facility/migrations/0149_auto_20200802_2156.py | gigincg/care | 189 | 12602981 | # Generated by Django 2.2.11 on 2020-08-02 16:26
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('facility', '0148_populate_unencrypted_patients'),
]
operations = [
migrations.RenameField(
model_name='historicalpatientregistration',
... |
alipay/aop/api/domain/Appinfos.py | antopen/alipay-sdk-python-all | 213 | 12602987 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class Appinfos(object):
def __init__(self):
self._app_name = None
self._app_type = None
self._mini_app_id = None
@property
def app_name(self):
... |
src/tcclib/payloadobj.py | CollectiveDS/tccprofile | 244 | 12603016 | """Payload Object"""
from datetime import datetime
from uuid import uuid1
_NOW = datetime.now().strftime('%Y-%m-%d-%H%M%S')
class ServicesDict:
_REQ_ATTRS = ['identifier',
'identifier_type',
'csreq',
'allowed']
_TCC_SERVICE_PAYLOAD_MAP = {'identifier': ... |
orguniqueview.py | Sinamore/orgextended | 120 | 12603033 | <reponame>Sinamore/orgextended
import sublime, sublime_plugin
import logging
log = logging.getLogger(__name__)
ViewMappings = {}
def CreateUniqueViewNamed(name, syntax):
# Close the view if it exists
win = sublime.active_window()
for view in win.views():
if view.name() == name:
win.f... |
concordia/signals/signals.py | juliecentofanti172/juliecentofanti.github.io | 134 | 12603039 | import django.dispatch
reservation_obtained = django.dispatch.Signal(
providing_args=["asset_pk", "reservation_token"]
)
reservation_released = django.dispatch.Signal(
providing_args=["asset_pk", "reservation_token"]
)
|
code/LFW/evaluate.py | huangyangyu/SeqFace | 136 | 12603063 | #!/usr/bin/env python
#coding: utf-8
#author: huangyangyu
layer_num = 27
#layer_num = 64
import os
import sys
import gflags
import cPickle
import numpy as np
root_dir = os.path.dirname(os.path.abspath("__file__")) + "/../../"
sys.path.append(root_dir + "code/")
if not gflags.FLAGS.has_key("model_dir"):
gflags.D... |
backdoors/shell/__pupy/pupy/pupysh.py | mehrdad-shokri/backdoorme | 796 | 12603125 | <reponame>mehrdad-shokri/backdoorme<filename>backdoors/shell/__pupy/pupy/pupysh.py
#!/usr/bin/env python
# -*- coding: UTF8 -*-
# --------------------------------------------------------------
# Copyright (c) 2015, <NAME> (<EMAIL>)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or ... |
cd/canary-azure-devops/pipeline_configs/read_config.py | ganesh-k13/citrix-k8s-ingress-controller | 315 | 12603145 | <reponame>ganesh-k13/citrix-k8s-ingress-controller
import argparse
import json
class ConfigReader(object):
@staticmethod
def populate_env(input_params):
print(input_params)
if input_params.action == 'delete':
print('##vso[task.setvariable variable=TEARDOWN_FLAG]True')
with ... |
xfel/command_line/cxi_xmerge.py | dperl-sol/cctbx_project | 155 | 12603166 | <reponame>dperl-sol/cctbx_project
# -*- mode: python; coding: utf-8; indent-tabs-mode: nil; python-indent: 2 -*-
#
# LIBTBX_SET_DISPATCHER_NAME cxi.xmerge
#
# $Id$
from __future__ import absolute_import, division, print_function
from six.moves import range
import iotbx.phil
from dials.array_family import flex
from cc... |
dp/cloud/python/magma/configuration_controller/request_router/request_router.py | Aitend/magma | 539 | 12603180 | """
Copyright 2021 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES O... |
app/src/server.py | rgarciajim/minimal-docker-python-setup | 165 | 12603195 | <filename>app/src/server.py
from flask import Flask, request, jsonify
from flask.ext.redis import FlaskRedis
app = Flask(__name__)
app.config.update(
REDIS_URL="redis://redis:6379/0"
)
redis_store = FlaskRedis(app)
@app.route('/')
def index():
addr = request.remote_addr
redis_store.incr(addr)
visits... |
experiments/list5/calculate_label_prediction_scores.py | Elfsong/pygaggle | 166 | 12603267 | import argparse
import glob
import json
import numpy as np
from sklearn.metrics import accuracy_score, f1_score
from fever_utils import make_sentence_id
def calculate_scores(args):
evidences = {}
with open(args.dataset_file, 'r', encoding='utf-8') as f:
for line in f:
line_json = json.loa... |
Cktgen/cktgen/cktgen/cktgen_from_json.py | mabrains/ALIGN-public | 119 | 12603275 | <filename>Cktgen/cktgen/cktgen/cktgen_from_json.py
from .cktgen import *
import json
if __name__ == "__main__":
args,tech = parse_args()
assert args.source != ''
src = args.source
assert args.placer_json != ''
with open( args.placer_json, "rt") as fp:
placer_results = json.load( fp)
with open( "IN... |
system/t04_mirror/list.py | Yelp/aptly | 666 | 12603306 | <filename>system/t04_mirror/list.py<gh_stars>100-1000
from lib import BaseTest
import re
class ListMirror1Test(BaseTest):
"""
list mirrors: regular list
"""
fixtureCmds = [
"aptly mirror create --ignore-signatures mirror1 http://cdn-fastly.deb.debian.org/debian/ stretch",
"aptly mirror... |
maha/parsers/rules/distance/values.py | TRoboto/Maha | 152 | 12603323 | <reponame>TRoboto/Maha<filename>maha/parsers/rules/distance/values.py<gh_stars>100-1000
from maha.expressions import EXPRESSION_SPACE_OR_NONE
from maha.parsers.templates import DistanceUnit, Value
from maha.rexy import non_capturing_group
from ..common import TWO_SUFFIX, ValueUnit
KILO = "كيلو"
CENTI = "سا?نتيم?"
MIL... |
terrascript/data/camptocamp/jwt.py | mjuenema/python-terrascript | 507 | 12603374 | # terrascript/data/camptocamp/jwt.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:19:50 UTC)
__all__ = []
|
examples/bayesian-optimization/main-visualize.py | yuki-koyama/mathtoolbox | 195 | 12603399 | <gh_stars>100-1000
#
# Prerequisites:
# pip3 install matplotlib pandas seaborn
#
# Usage:
# python3 main-visualize.py </path/to/rand_result.csv> </path/to/bo_result.csv> </path/to/output.pdf>
#
from typing import Dict, Tuple
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
import sys
def pro... |
utils.py | pjbgf/python-paddingoracle | 286 | 12603401 | # -*- coding: utf-8 -*-
from base64 import urlsafe_b64decode, urlsafe_b64encode
def dotnet_b64decode(s):
'''Decode .NET Web-Base64 encoded data.'''
s, pad_bytes = s[:-1], int(s[-1])
s += ('=' * pad_bytes)
return urlsafe_b64decode(s)
def dotnet_b64encode(s):
'''.NET Web-Base64 encode data.'''
... |
openmc/data/resonance_covariance.py | janmalec/openmc | 262 | 12603410 | from collections.abc import MutableSequence
import warnings
import io
import copy
import numpy as np
import pandas as pd
from . import endf
import openmc.checkvalue as cv
from .resonance import Resonances
def _add_file2_contributions(file32params, file2params):
"""Function for aiding in adding resonance paramet... |
neural_parts/models/siren.py | naynasa/neural_parts_fork | 137 | 12603437 | import torch
from torch import nn
import numpy as np
class SineLayer(nn.Module):
def __init__(self, in_dims, out_dims, bias=True, is_first=False, omega_0=30):
super().__init__()
self.omega_0 = omega_0
self.in_dims = in_dims
# If is_first=True, omega_0 is a frequency factor which ... |
functions/KNearestNeighborsClassifier.py | sdash77/raster-functions | 173 | 12603446 | <gh_stars>100-1000
import pandas as pd
import numpy as np
from sklearn.neighbors import KNeighborsClassifier
'''
This raster function performs k-nearest neighbors classification
using scikit-learn and generates a map of the classification of
each pixel.
http://scikit-learn.org/stable/documentation.html
http://scik... |
sympy/physics/control/__init__.py | bigfooted/sympy | 603 | 12603471 | <gh_stars>100-1000
from .lti import TransferFunction, Series, Parallel, Feedback
__all__ = ['TransferFunction', 'Series', 'Parallel', 'Feedback']
|
utils_cv/classification/widget.py | muminkoykiran/computervision-recipes | 7,899 | 12603478 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import os
import bqplot
import bqplot.pyplot as bqpyplot
import pandas as pd
from fastai.data_block import LabelList
from ipywidgets import widgets, Layout, IntSlider
import numpy as np
from utils_cv.common.image import im_... |
fig/replaced_by_d3/tanh.py | Zander-Davidson/Neural-Network-Exercise | 14,090 | 12603498 | """
tanh
~~~~
Plots a graph of the tanh function."""
import numpy as np
import matplotlib.pyplot as plt
z = np.arange(-5, 5, .1)
t = np.tanh(z)
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(z, t)
ax.set_ylim([-1.0, 1.0])
ax.set_xlim([-5,5])
ax.grid(True)
ax.set_xlabel('z')
ax.set_title('ta... |
mudpi/extensions/timer/trigger.py | icyspace/mudpi-core | 163 | 12603517 | """
Timer Trigger Interface
Calls actions after a
configurable elapsed time.
"""
import time
from . import NAMESPACE
from mudpi.utils import decode_event_data
from mudpi.extensions import BaseInterface
from mudpi.extensions.trigger import Trigger
from mudpi.logger.Logger import Logger, LOG_LEVEL
from mudpi... |
doorman/users/mixins.py | haim/doorman | 614 | 12603524 | # -*- coding: utf-8 -*-
from flask_login import UserMixin
class NoAuthUserMixin(UserMixin):
def get_id(self):
return u''
@property
def username(self):
return u''
|
src/xobjc.py | MustangYM/xia0LLDB | 464 | 12603579 | #! /usr/bin/env python3
# ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______
# |______|______|______|______|______|______|______|______|______|______|______|______|______|______|______|______|______|
# _ ___ _ _ _____ ... |
rules/actions_write/file.bzl | CyberFlameGO/examples | 572 | 12603585 | <reponame>CyberFlameGO/examples
"""Generate a file.
In this example, the content is passed via an attribute. If you generate
large files with a lot of static content, consider using
`ctx.actions.expand_template` instead.
"""
def file(**kwargs):
_file(out = "{name}.txt".format(**kwargs), **kwargs)
def _impl(ctx):... |
indy_common/serialization.py | Rob-S/indy-node | 627 | 12603597 | from common.serializers.json_serializer import JsonSerializer
attrib_raw_data_serializer = JsonSerializer()
|
wagtail/tests/modeladmintest/migrations/0009_relatedlink.py | brownaa/wagtail | 8,851 | 12603623 | <reponame>brownaa/wagtail<filename>wagtail/tests/modeladmintest/migrations/0009_relatedlink.py<gh_stars>1000+
# Generated by Django 3.1.1 on 2020-10-01 18:16
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('wagtailcore', ... |
hs_swat_modelinstance/migrations/0003_auto_20151013_1955.py | hydroshare/hydroshare | 178 | 12603649 | <reponame>hydroshare/hydroshare
# -*- coding: utf-8 -*-
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('hs_core', '0006_auto_20150917_1515'),
('hs_model_program', '0003_auto_20150813_1730'),
('hs_swat_modelinstance', '0002_auto_20150813... |
dockerscan/actions/image/console.py | michalkoczwara/dockerscan | 1,286 | 12603666 | <filename>dockerscan/actions/image/console.py
import os
import logging
from dockerscan import get_log_level, run_in_console
from .api import *
from .model import *
from ..helpers import display_results_console
log = logging.getLogger('dockerscan')
def launch_dockerscan_image_info_in_console(config: DockerImageInfo... |
tests/components/weathering/test_exponential_weatherer.py | amanaster2/landlab | 257 | 12603670 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri May 1 14:02:18 2020
@author: gtucker
"""
from landlab import RasterModelGrid
from landlab.components import ExponentialWeatherer
def test_create_weatherer_and_change_rate():
grid = RasterModelGrid((3, 3), 1.0)
grid.add_zeros("soil__depth", ... |
Site-blocker/web-blocker.py | A-kriti/Amazing-Python-Scripts | 930 | 12603716 | <gh_stars>100-1000
import time
from datetime import datetime as dt
# Windows host file path
hostsPath = r"C:\Windows\System32\drivers\etc\hosts"
redirect = "127.0.0.1"
# Add the website you want to block, in this list
websites = [
"www.amazon.in", "www.youtube.com", "youtube.com", "www.facebook.com",
"faceboo... |
numba/tests/test_llvm_pass_timings.py | auderson/numba | 6,620 | 12603718 | import unittest
from numba import njit
from numba.tests.support import TestCase, override_config
from numba.misc import llvm_pass_timings as lpt
timings_raw1 = """
===-------------------------------------------------------------------------===
... Pass execution timing report ...
===-----------... |
modules/dbnd-airflow-monitor/src/airflow_monitor/tracking_service/error_aggregator.py | busunkim96/dbnd | 224 | 12603734 | from typing import Optional
from weakref import WeakKeyDictionary
import attr
from dbnd._core.utils.timezone import utcnow
@attr.s
class ErrorAggregatorResult:
message = attr.ib() # type: Optional[str]
should_update = attr.ib() # type: bool
class ErrorAggregator:
def __init__(self):
# we use... |
deepchem/molnet/load_function/clintox_datasets.py | cjgalvin/deepchem | 3,782 | 12603811 | """
Clinical Toxicity (clintox) dataset loader.
@author <NAME>
"""
import os
import deepchem as dc
from deepchem.molnet.load_function.molnet_loader import TransformerGenerator, _MolnetLoader
from deepchem.data import Dataset
from typing import List, Optional, Tuple, Union
CLINTOX_URL = "https://deepchemdata.s3-us-west... |
src/tfi/doc/template.py | ajbouh/tfi | 160 | 12603842 | <gh_stars>100-1000
import base64
from collections import OrderedDict
from jinja2 import Template as JinjaTemplate
from tfi.format.html.bibtex import citation_bibliography_html
from tfi.format.html.python import html_repr
from tfi.format.html.rst import parse_rst as _parse_rst
from tfi.parse.html import visible_text_for... |
sandbox/__init__.py | kevin-brown/django-cacheback | 160 | 12603844 | <gh_stars>100-1000
from .celeryconfig import app as celery_app
__all__ = ('celery_app',)
|
symoroutils/parfile.py | songhongxiang/symoro | 109 | 12603865 | <filename>symoroutils/parfile.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
# This file is part of the OpenSYMORO project. Please see
# https://github.com/symoro/symoro/blob/master/LICENCE for the licence.
"""
This module performs writing and reading data into PAR file. PAR is a
plain text file used to represent the... |
tests/integration_tests_plugins/dockercompute/setup.py | ilan-WS/cloudify-manager | 124 | 12603949 | from setuptools import setup
setup(name='dockercompute', packages=['dockercompute'])
|
virtual_env/lib/python3.5/site-packages/google_compute_engine/accounts/oslogin_utils.py | straydag/To_Due_Backend | 322 | 12603950 | <gh_stars>100-1000
#!/usr/bin/python
# Copyright 2017 Google 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
#
# Unles... |
notebook/pandas_normalization.py | vhn0912/python-snippets | 174 | 12603982 | import pandas as pd
import scipy.stats
from sklearn import preprocessing
df = pd.DataFrame([[0, 1, 2], [3, 4, 5], [6, 7, 8]],
columns=['col1', 'col2', 'col3'],
index=['a', 'b', 'c'])
print(df)
# col1 col2 col3
# a 0 1 2
# b 3 4 5
# c 6 7 8
... |
tests/dopamine/continuous_domains/run_experiment_test.py | kuldeepbrd1/dopamine | 9,825 | 12604002 | # coding=utf-8
# Copyright 2021 The Dopamine Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... |
code/chapter-15/benchmark.py | dnaveenr/Practical-Deep-Learning-Book | 564 | 12604018 | # <NAME>
# 2019 Edgise
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import numpy as np
import tensorflow as tf
import keras
from keras.applications.mobilenetv2 import MobileNetV2, preprocess_input, decode_predictions
import os
#import cv2
import PIL
import time
execution_path = os.getcwd()
print("tf version : " + ... |
malaya_speech/train/model/glowtts/common.py | ishine/malaya-speech | 111 | 12604021 | import numpy as np
import tensorflow as tf
from ..utils import shape_list
def maximum_path(value, mask, max_neg_val=-np.inf):
""" Numpy-friendly version. It's about 4 times faster than torch version.
value: [b, t_x, t_y]
mask: [b, t_x, t_y]
"""
value = value * mask
dtype = value.dtype
mas... |
testdata/iris_lightgbm_rf.py | sysutf/leaves | 334 | 12604086 | import numpy as np
import pickle
from sklearn import datasets
import lightgbm as lgb
from sklearn.model_selection import train_test_split
data = datasets.load_iris()
X = data['data']
y = data['target']
y[y > 0] = 1
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=0)
n_estimators ... |
deploy/scripts/aphros/stat.py | ChristopherKotthoff/Aphros-with-GraphContraction | 252 | 12604093 | <gh_stars>100-1000
import os
def GetVal(path, colname, t0):
s = os.path.join(path, "stat.dat")
res = 0.
# best
tb = None
vb = None
with open(s) as f:
head = f.readline().split()
it = head.index('t')
iv = head.index(colname)
for l in f:
t = float(l... |
Stock/Data/Viewer/JaccardIndex/DyStockDataJaccardIndexWidgets.py | Leonardo-YXH/DevilYuan | 135 | 12604176 | from PyQt5.QtWidgets import QTabWidget
from ....Common.DyStockCommon import *
from .DyStockDataJaccardIndexWidget import *
class DyStockDataJaccardIndexWidgets(QTabWidget):
def __init__(self, jaccardDfs):
super().__init__()
self._jaccardDfs = jaccardDfs
self._initUi()
self... |
src/lib/mailcap.py | DTenore/skulpt | 2,671 | 12604190 | <reponame>DTenore/skulpt<gh_stars>1000+
import _sk_fail; _sk_fail._("mailcap")
|
src/compas/numerical/lma/lma_numpy.py | XingxinHE/compas | 235 | 12604196 | # from __future__ import absolute_import
# from __future__ import division
# from __future__ import print_function
# __all__ = ['lma_numpy']
# def objective(qind, E, Ci, Cf, Ct, Cit, pzi, out=2):
# q = E.dot(qind)
# Q = diags([q.flatten()], [0])
# Di = Cit.dot(Q).dot(Ci)
# Df = Cit.dot(Q).dot(Cf)
# ... |
tools/metrics/utils/buildsystem.py | ivafanas/sltbench | 146 | 12604356 | from collections import namedtuple
MAKE = 'make'
NINJA = 'ninja'
ALL = [MAKE, NINJA]
_BuildSystem = namedtuple('BuildSystem', 'cmake_generator,build_command')
def create(args):
bs = args.build_system
if bs == MAKE:
return _BuildSystem(cmake_generator='Unix Makefiles',
... |
rpython/annotator/policy.py | nanjekyejoannah/pypy | 381 | 12604383 | # base annotation policy for specialization
from rpython.annotator.specialize import default_specialize as default
from rpython.annotator.specialize import (
specialize_argvalue, specialize_argtype, specialize_arglistitemtype,
specialize_arg_or_var, memo, specialize_call_location)
from rpython.flowspace.operati... |
armi/bookkeeping/tests/__init__.py | keckler/armi | 162 | 12604391 | # Copyright 2019 TerraPower, 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 obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... |
Val_model_subpixel.py | Dai-z/pytorch-superpoint | 390 | 12604418 | """script for subpixel experiment (not tested)
"""
import numpy as np
import torch
from torch.autograd import Variable
import torch.backends.cudnn as cudnn
import torch.optim
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
from tqdm import tqdm
from utils.loader import dataLoader, modelLo... |
freepie-samples/sample1.py | d2002b/alvr1 | 1,946 | 12604469 | <gh_stars>1000+
# Click trackpad of first controller by "C" key
alvr.buttons[0][alvr.Id("trackpad_click")] = keyboard.getKeyDown(Key.C)
alvr.buttons[0][alvr.Id("trackpad_touch")] = keyboard.getKeyDown(Key.C)
# Move trackpad position by arrow keys
if keyboard.getKeyDown(Key.LeftArrow):
alvr.trackpad[0][0] = -1.0
al... |
data_pipeline/helpers/priority_refresh_queue.py | poros/data_pipeline | 110 | 12604482 | <reponame>poros/data_pipeline
# -*- coding: utf-8 -*-
# Copyright 2016 Yelp 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 re... |
problems/14/solution_14.py | r1cc4rdo/daily_coding_problem | 158 | 12604493 | <gh_stars>100-1000
import math
import random
def coding_problem_14():
"""
The area of a circle is defined as $\pi r^2$. Estimate $\pi$ to 3 decimal places using a Monte Carlo method.
Example:
>>> import math
>>> import random
>>> random.seed(0xBEEF)
>>> pi_approx = coding_problem_14()
... |
tests/test_init.py | google/evojax | 365 | 12604569 | <reponame>google/evojax<filename>tests/test_init.py
# Copyright 2022 The EvoJAX 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
#
#... |
pseudo/api_translators/cpp_api_handlers.py | mifieldxu/pseudo-lang | 661 | 12604608 | <reponame>mifieldxu/pseudo-lang<gh_stars>100-1000
from pseudo.pseudo_tree import Node, call, method_call, local, assignment, to_node
from pseudo.api_handlers import BizarreLeakingNode, NormalLeakingNode
class Read(BizarreLeakingNode):
'''
transforms `io:read`
`a = io:read()`
`cin << a`
'''
de... |
dnachisel/Specification/SpecEvaluation/ProblemConstraintsEvaluations.py | simone-pignotti/DnaChisel | 124 | 12604611 | from .SpecEvaluation import SpecEvaluation
from .SpecEvaluations import SpecEvaluations
class ProblemConstraintsEvaluations(SpecEvaluations):
"""Special multi-evaluation class for all constraints of a same problem.
See submethod ``.from_problem``
"""
specifications_role = "constraint"
@staticm... |
python/traffic_manager.py | APinkLemon/Learn-Carla | 148 | 12604636 | <reponame>APinkLemon/Learn-Carla<gh_stars>100-1000
import argparse
import carla
import cv2
import logging
import time
import numpy as np
from numpy import random
from queue import Queue
from queue import Empty
def parser():
argparser = argparse.ArgumentParser(
description=__doc__)
argparser.add_argume... |
examples/from-wiki/demo_meta_matrixmul_cheetah.py | hesom/pycuda | 1,264 | 12604647 | <filename>examples/from-wiki/demo_meta_matrixmul_cheetah.py
#!python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
PyCuda Optimized Matrix Multiplication
Template Meta-programming Example using Cheetah
(modified from SciPy09 Advanced Tutorial)
"""
# ------------------------------------------------------------... |
xmodaler/lr_scheduler/noam_lr.py | cclauss/xmodaler | 830 | 12604677 | <reponame>cclauss/xmodaler<gh_stars>100-1000
import torch
from xmodaler.config import configurable
from .build import LR_SCHEDULER_REGISTRY
@LR_SCHEDULER_REGISTRY.register()
class NoamLR(torch.optim.lr_scheduler._LRScheduler):
@configurable
def __init__(
self,
*,
optimizer,
mode... |
tests/test_utils.py | fluxility/drf-haystack | 201 | 12604713 | <reponame>fluxility/drf-haystack
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.test import TestCase
from drf_haystack.utils import merge_dict
class MergeDictTestCase(TestCase):
def setUp(self):
self.dict_a = {
"person": {
"last... |
tests/test_cswrapper.py | CSchulzeTLK/FMPy | 225 | 12604740 | <reponame>CSchulzeTLK/FMPy<filename>tests/test_cswrapper.py
import unittest
from fmpy import read_model_description, simulate_fmu
from fmpy.util import download_test_file
from fmpy.cswrapper import add_cswrapper
class CSWrapperTest(unittest.TestCase):
def test_cswrapper(self):
filename = 'CoupledClutche... |
st2common/benchmarks/micro/test_mongo_transport_compression.py | momokuri-3/st2 | 4,920 | 12604774 | <filename>st2common/benchmarks/micro/test_mongo_transport_compression.py<gh_stars>1000+
# Copyright 2021 The StackStorm 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:/... |
libtmux/_compat.py | jamosta/libtmux | 398 | 12604779 | # -*- coding: utf8 -*-
# flake8: NOQA
import sys
from collections.abc import MutableMapping
console_encoding = sys.__stdout__.encoding
def console_to_str(s):
"""From pypa/pip project, pip.backwardwardcompat. License MIT."""
try:
return s.decode(console_encoding, 'ignore')
except UnicodeDecodeErro... |
docs/papers/sc2013/bench/pythran/pi_buffon.py | davidbrochart/pythran | 1,647 | 12604790 | #skip.runas pi_estimate(40000000)
#pythran export pi_estimate(int)
from math import sqrt, pow
from random import random
def pi_estimate(DARTS):
hits = 0
"omp parallel for private(i,x,y,dist), reduction(+:hits)"
for i in xrange (0, DARTS):
x = random()
y = random()
dist = sqrt(pow(x, 2) + pow... |
nlt/util/math.py | isabella232/neural-light-transport | 176 | 12604794 | # Copyright 2020 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 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, ... |
goatools/grouper/sorter_nts.py | flying-sheep/goatools | 477 | 12604797 | """Sorts GO IDs or user-provided sections containing GO IDs."""
__copyright__ = "Copyright (C) 2016-2019, <NAME>, <NAME>, All rights reserved."
__author__ = "<NAME>"
class SorterNts(object):
"""Handles GO IDs in user-created sections.
* Get a 2-D list of sections:
sections = [
... |
atlas/foundations_local_docker_scheduler_plugin/src/test/test_cron_job_scheduler.py | DeepLearnI/atlas | 296 | 12604802 |
from foundations_spec import *
import unittest.mock
from foundations_local_docker_scheduler_plugin.cron_job_scheduler import CronJobScheduler, CronJobSchedulerError
class TestCronJobScheduler(Spec):
mock_get = let_patch_mock('requests.get')
mock_delete = let_patch_mock('requests.delete')
mock_patch = let... |
app/config/urls/rendering_subdomain.py | njmhendrix/grand-challenge.org | 101 | 12604804 | from django.http import HttpResponseRedirect
from django.template.response import TemplateResponse
from django.urls import path
from django.views.generic import TemplateView
from grandchallenge.workstations.views import SessionDetail, session_proxy
def handler404(request, exception):
domain = request.site.domain... |
seq2seq/dataset/__init__.py | mtran14/pytorch-seq2seq | 1,491 | 12604807 | from .fields import SourceField, TargetField
|
SRT/lib/datasets/VideoDatasetV2.py | yerang823/landmark-detection | 612 | 12604877 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
from os import path as osp
from copy import deepcopy as copy
from tqdm import tqdm
import warnings, random, numpy as np
f... |
pex/sorted_tuple.py | alexey-tereshenkov-oxb/pex | 2,160 | 12604946 | <reponame>alexey-tereshenkov-oxb/pex<gh_stars>1000+
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import
from pex.typing import TYPE_CHECKING, Generic, cast, overload
if TYPE_CHECKING:
from typing... |
venv/Lib/site-packages/altair/vegalite/schema.py | ajayiagbebaku/NFL-Model | 6,831 | 12604977 | """Altair schema wrappers"""
# flake8: noqa
from .v4.schema import *
|
common/dataset/ShapeNetV2.py | hyunynim/DIST-Renderer | 176 | 12604992 | <gh_stars>100-1000
import os, sys
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..'))
from geometry import Shape
import json
from tqdm import tqdm
def read_split_file(split_file):
with open(split_file, 'r') as f:
split = json.load(f)
key_list = list(split.keys())
assert... |
migrations/versions/4d302aa44bc8_add_additional_revis.py | vault-the/changes | 443 | 12605008 | <filename>migrations/versions/4d302aa44bc8_add_additional_revis.py
"""Add additional revision data
Revision ID: 4d302aa44bc8
Revises: 215db24a630a
Create Date: 2013-11-26 16:20:59.454360
"""
# revision identifiers, used by Alembic.
revision = '4d302aa44bc8'
down_revision = '215db24a630a'
from alembic import op
impo... |
tests/Exscript/QueueTest.py | saveshodhan/exscript | 226 | 12605045 | <gh_stars>100-1000
from builtins import object
import sys
import unittest
import re
import os.path
import warnings
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..'))
warnings.simplefilter('ignore', DeprecationWarning)
import shutil
import time
import ctypes
from functools import partial
from temp... |
rest_registration/verification_notifications.py | psibean/django-rest-registration | 329 | 12605075 | <reponame>psibean/django-rest-registration<filename>rest_registration/verification_notifications.py<gh_stars>100-1000
from typing import TYPE_CHECKING, Dict
from rest_framework.request import Request
from rest_registration.exceptions import VerificationTemplatesNotFound
from rest_registration.notifications.email impo... |
tests/components/image/__init__.py | tbarbette/core | 30,023 | 12605091 | <reponame>tbarbette/core
"""Tests for the Image integration."""
|
tools/authgen.py | abharath27/azure-libraries-for-net | 365 | 12605109 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
leetcode.com/python/373_Find_K_Pairs_with_Smallest_Sums.py | vansh-tiwari/coding-interview-gym | 713 | 12605119 | <gh_stars>100-1000
import heapq
class Solution(object):
def kSmallestPairs(self, nums1, nums2, k):
"""
:type nums1: List[int]
:type nums2: List[int]
:type k: int
:rtype: List[List[int]]
"""
maxHeap = []
for nums1Idx in range(min(k, len(nums1))):
... |
src/genie/libs/parser/iosxr/tests/ShowProcessMemory/cli/equal/golden_output_expected.py | balmasea/genieparser | 204 | 12605183 |
expected_output = {
'jid': {1: {'index': {1: {'data': 344,
'dynamic': 0,
'jid': 1,
'process': 'init',
'stack': 136,
'text': 296}}},
51: {'index': {1: {'data': 1027776,
'd... |
opencga-app/build/analysis/tabix-0.2.6/tabix.py | roalva1/opencga | 125 | 12605231 | #!/usr/bin/env python
# Author: <NAME> and <NAME>
# License: MIT/X11
import sys
from ctypes import *
from ctypes.util import find_library
import glob, platform
def load_shared_library(lib, _path='.', ver='*'):
"""Search for and load the tabix library. The
expectation is that the library is located in
the... |
virtual/lib/python3.8/site-packages/openapi_spec_validator/handlers/utils.py | dan-mutua/flaskwk3 | 201 | 12605241 | import os.path
from six.moves.urllib.parse import urlparse, unquote
from six.moves.urllib.request import url2pathname
def uri_to_path(uri):
parsed = urlparse(uri)
host = "{0}{0}{mnt}{0}".format(os.path.sep, mnt=parsed.netloc)
return os.path.normpath(
os.path.join(host, url2pathname(unquote(parsed... |
Trakttv.bundle/Contents/Libraries/Shared/plugin/core/backup/tasks/__init__.py | disrupted/Trakttv.bundle | 1,346 | 12605258 | from plugin.core.backup.tasks.archive import ArchiveTask
from plugin.core.backup.tasks.compact import CompactTask
|
src/strategy/python/strategy.py | oxnz/design-patterns | 117 | 12605281 | '''http://stackoverflow.com/questions/963965/how-is-this-strategy-pattern-written-in-python-the-sample-in-wikipedia'''
import types
class StrategyExample:
def __init__(self, func=None):
self.name = "Strategy Example 0"
if func :
self.execute = t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.