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/unit/test_parse_env_file.py | Parnassius/poethepoet | 446 | 85885 | from poethepoet.envfile import parse_env_file
import pytest
valid_examples = [
(
"""
# empty
""",
{},
),
(
"""
# single word values
WORD=something
WORD_WITH_HASH=some#thing
NUMBER=0
EMOJI=😃😃
DOUBLE_QUOTED_WORD="something"
... |
django/django-pyodbc-azure/DjangoWebProject1/__init__.py | garotogordo/azure-sql-database-samples | 674 | 85892 | """
Package for DjangoWebProject1.
"""
|
alg/interpole/diag-bias/main-offpoirl.py | DaraOrange/mlforhealthlabpub | 171 | 85898 | <filename>alg/interpole/diag-bias/main-offpoirl.py
import argparse
import dill
import jax
import numpy as np
import pomdp
pomdp.horizon = 25
parser = argparse.ArgumentParser()
parser.add_argument('--silent', action='store_true')
parser.add_argument('--cont', action='store_true')
parser.add_argument('--bias', action='... |
tests/dataframe_protocol_test.py | sethvargo/vaex | 337 | 85922 | <reponame>sethvargo/vaex
import numpy as np
import pyarrow as pa
import pytest
from typing import Any, Optional, Tuple, Dict, Iterable, Sequence
DataFrameObject = Any
ColumnObject = Any
import vaex
from common import *
from vaex.dataframe_protocol import _from_dataframe_to_vaex, _DtypeKind, _VaexBuffer, _VaexColumn, ... |
spikeinterface/comparison/groundtruthcomparison.py | khl02007/spikeinterface | 116 | 85936 | import pandas as pd
import numpy as np
from .basecomparison import BaseTwoSorterComparison
from .comparisontools import (do_score_labels, make_possible_match,
make_best_match, make_hungarian_match, do_confusion_matrix, do_count_score,
compute_performance)
cl... |
src/cutadapt/adapters.py | marcelm/cutadapt | 375 | 85941 | """
Adapter finding and trimming classes
The ...Adapter classes are responsible for finding adapters.
The ...Match classes trim the reads.
"""
import logging
from enum import IntFlag
from collections import defaultdict
from typing import Optional, Tuple, Sequence, Dict, Any, List, Union
from abc import ABC, abstractme... |
tests/previs/test_track.py | MehmetErer/anima | 101 | 85958 | <filename>tests/previs/test_track.py
# -*- coding: utf-8 -*-
import unittest
from anima.edit import Track, Clip, File
class TrackTestCase(unittest.TestCase):
"""tests the anima.previs.Track class
"""
def test_to_xml_method_is_working_properly(self):
"""testing if the to xml method is working pro... |
pydpm/_model/_basic_model.py | HalcyonBravado/Pydpm | 112 | 85975 |
# Author: <NAME> <<EMAIL>>; <NAME> <<EMAIL>>; <NAME> <<EMAIL>>
# License: BSD-3-Claus
class Params(object):
def __init__(self):
"""
The basic class for storing the parameters in the probabilistic model
"""
super(Params, self).__init__()
class Basic_Model(object):
def __init__... |
pyfakefs/tests/fixtures/module_with_attributes.py | kmerenkov/pyfakefs | 422 | 86003 | <reponame>kmerenkov/pyfakefs
# Copyright 2017 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... |
Geometry/RPCGeometry/test/rpcgeo.py | ckamtsikis/cmssw | 852 | 86034 | <filename>Geometry/RPCGeometry/test/rpcgeo.py
import FWCore.ParameterSet.Config as cms
process = cms.Process("Demo")
process.load("Configuration.Geometry.GeometryExtended2015Reco_cff")
process.load("Geometry.RPCGeometry.rpcGeometry_cfi")
process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(1)
)
pr... |
recipes/Python/148291_Behavior_like_list_object_carried_out/recipe-148291.py | tdiprima/code | 2,023 | 86066 | class Listlike:
def __init__(self):
self.list = [1, 2, 3, 4, 5]
def __getitem__(self, index):
return self.list[index]
def __len__(self):
return len(self.list)
>>> listlike = Listlike()
>>> list(listlike)
[1, 2, 3, 4, 5]
|
ptstat/dist/uniform.py | timmyzhao/ptstat | 116 | 86080 | import torch
from torch.autograd import Variable
from ptstat.core import RandomVariable, _to_v
# TODO: Implement Uniform(a, b) constructor.
class Uniform(RandomVariable):
"""
Uniform(0, 1) iid rv.
"""
def __init__(self, size, cuda=False):
super(Uniform, self).__init__()
assert len(size... |
recipes/Python/303061_Remove_whitespaceonly_text_nodes_XML/recipe-303061.py | tdiprima/code | 2,023 | 86106 | def remove_whilespace_nodes(node, unlink=False):
"""Removes all of the whitespace-only text decendants of a DOM node.
When creating a DOM from an XML source, XML parsers are required to
consider several conditions when deciding whether to include
whitespace-only text nodes. This function ignores al... |
mindspore_serving/server/start_worker.py | mindspore-ai/serving | 157 | 86119 | <gh_stars>100-1000
# Copyright 2021 Huawei Technologies Co., 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 by applicab... |
pymtl3/stdlib/test_utils/valrdy_test_srcs.py | jbrzozo24/pymtl3 | 152 | 86157 | """
========================================================================
Test sources
========================================================================
Test sources with CL or RTL interfaces.
Author : <NAME>
Date : Mar 11, 2019
"""
from collections import deque
from copy import deepcopy
from pymtl3 impor... |
cctbx/miller/tst_map_to_asu_isym.py | dperl-sol/cctbx_project | 155 | 86160 | from __future__ import absolute_import, division, print_function
from six.moves import range
def intify(a):
return tuple([int(round(val)) for val in a])
def reference_map(sg, mi):
from cctbx import sgtbx
asu = sgtbx.reciprocal_space_asu(sg.type())
isym_ = []
mi_ = []
for hkl in mi:
found = False
... |
articles/making-chrome-headless-undetectable/inject.py | sangaline/intoli-article-materials | 248 | 86202 | <reponame>sangaline/intoli-article-materials<filename>articles/making-chrome-headless-undetectable/inject.py
from bs4 import BeautifulSoup
from mitmproxy import ctx
# load in the javascript to inject
with open('injected-test-bypasses.js', 'r') as f:
content_js = f.read()
def response(flow):
# only process 2... |
screen.py | nicholas-zww/ActualVim | 849 | 86224 | class Cell:
def __init__(self, c=' '):
self.c = c
self.highlight = {}
def __mul__(self, n):
return [Cell(self.c) for i in range(n)]
def __str__(self):
return self.c
class Highlight:
def __init__(self, line, highlight):
self.line = line
self.highlight = ... |
data_processing/create_voxel_off.py | vedanthpadigelwar/if-net | 209 | 86245 | <filename>data_processing/create_voxel_off.py
from voxels import VoxelGrid
import numpy as np
import multiprocessing as mp
from multiprocessing import Pool
import glob
import os
import argparse
def create_voxel_off(path):
voxel_path = path + '/voxelization_{}.npy'.format( res)
off_path = path + '/voxelizat... |
pygorithm/geometry/rect_broad_phase.py | bharadwaj-9/pygorithm | 4,736 | 86269 | """
Author: <NAME>
Created On: 23 August 2017
"""
# To test if two rectangle intersect, we only have to find out
# if their projections intersect on all of the coordinate axes
import inspect
class Coord:
"""Coord
Class to initialize Coordinate of one point
"""
def __init__(self, x, y):
self... |
examples/python_api_example/src/example.py | zmughal-contrib/SourcetrailDB | 274 | 86314 | import argparse
import os
import sourcetraildb as srctrl
def main():
parser = argparse.ArgumentParser(description="SourcetrailDB Python API Example")
parser.add_argument("--database-file-path", help="path to the generated Sourcetrail database file",
type=str, required=True)
parser.add_argument("--source-file-path... |
15Flask/day04/cart/__init__.py | HaoZhang95/PythonAndMachineLearning | 937 | 86321 | from flask import Blueprint
# 每一个模块蓝图可以拥有自己的静态文件夹,默认的app会设置好系统级别的static
# 但是蓝图需要自己手动设置注册静态文件的路径
# 为了区分加载的是主应用下的static还是模块下的static,给模块初始化的时候添加url前缀
# 添加前缀后,那么该蓝图.route的时候就自动添加了该前缀, 加载img的时候使用/cart/static/xxx.img
# 如果模块模板和主营业模板下都拥有相同的html名字,则优先加载主营业下的模板
cart_blue = Blueprint('cart', __name__,
stat... |
codewars_Error_correction_1__Hamming_Code.py | DazEB2/SimplePyScripts | 117 | 86355 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
# SOURCE: https://www.codewars.com/kata/5ef9ca8b76be6d001d5e1c3e/train/python
def chunks(l, n):
"""Yield successive n-sized chunks from l."""
for i in range(0, len(l), n):
yield l[i: i + n]
# Task 1: Encode function
#
# Implem... |
intro/summary-exercises/examples/plot_optimize_lidar_data_fit.py | zmoon/scipy-lecture-notes | 2,538 | 86361 | """
The lidar system, data and fit (1 of 2 datasets)
================================================
Generate a chart of the data fitted by Gaussian curve
"""
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import leastsq
def model(t, coeffs):
return coeffs[0] + coeffs[1] * np.exp(- ((t-... |
venv/Lib/site-packages/statsmodels/tsa/arima/datasets/brockwell_davis_2002/data/dowj.py | EkremBayar/bayar | 6,931 | 86363 | <gh_stars>1000+
"""
Dow-Jones Utilities Index, Aug.28--Dec.18, 1972.
Dataset described in [1]_ and included as a part of the ITSM2000 software [2]_.
Downloaded on April 22, 2019 from:
http://www.springer.com/cda/content/document/cda_downloaddocument/ITSM2000.zip
See also https://finance.yahoo.com/quote/%5EDJU/history... |
mmedit/models/backbones/sr_backbones/ttsr_net.py | Jian137/mmediting-1 | 1,884 | 86373 | from functools import partial
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import build_conv_layer
from mmcv.runner import load_checkpoint
from mmedit.models.common import (PixelShufflePack, ResidualBlockNoBN,
make_layer)
from mmedit.models.registr... |
src/c3nav/routing/utils/draw.py | johnjohndoe/c3nav | 132 | 86384 | from django.conf import settings
def _ellipse_bbox(x, y, height):
x *= settings.RENDER_SCALE
y *= settings.RENDER_SCALE
y = height-y
return ((x - 2, y - 2), (x + 2, y + 2))
def _line_coords(from_point, to_point, height):
return (from_point.x * settings.RENDER_SCALE, height - (from_point.y * sett... |
draft_kings/response/schema/draft_group.py | jaebradley/draftkings_client | 111 | 86398 | # pylint: disable=unused-argument, no-self-use
from marshmallow import Schema, fields, EXCLUDE, post_load
from draft_kings.response.objects.draft_group import ContestType, League, Game, DraftGroup, DraftGroupResponse
class ContestTypeSchema(Schema):
class Meta:
unknown = EXCLUDE
contestTypeId = fie... |
etl/parsers/etw/Microsoft_Windows_WMPNSS_PublicAPI.py | IMULMUL/etl-parser | 104 | 86404 | # -*- coding: utf-8 -*-
"""
Microsoft-Windows-WMPNSS-PublicAPI
GUID : 614696c9-85af-4e64-b389-d2c0db4ff87b
"""
from construct import Int8sl, Int8ul, Int16ul, Int16sl, Int32sl, Int32ul, Int64sl, Int64ul, Bytes, Double, Float32l, Struct
from etl.utils import WString, CString, SystemTime, Guid
from etl.dtyp import Sid
fro... |
mc-cnn/rgs.py | datvuthanh/SPIMNET | 746 | 86438 | #!/usr/bin/env python3
import sys
dataset, action = sys.argv[1:]
assert(dataset in {'mb', 'kitti'})
assert(action in {'test_te', 'train_tr'})
workers = [
('localhost', '-gpu 1'),
('localhost', '-gpu 2'),
('localhost', '-gpu 3'),
('localhost', '-gpu 4'),
]
if dataset == 'kitti' and action == 'train_t... |
tests/unit/tasks/test_check_queue_size.py | guvenbz/amazon-s3-find-and-forget | 165 | 86474 | from types import SimpleNamespace
import pytest
from mock import patch, MagicMock
from backend.lambdas.tasks.check_queue_size import handler
pytestmark = [pytest.mark.unit, pytest.mark.task]
@patch("backend.lambdas.tasks.check_queue_size.sqs")
def test_it_returns_correct_queue_size(mock_resource):
mock_queue =... |
tests/tensortrade/unit/feed/api/float/test_operations.py | nicomon24/tensortrade | 3,081 | 86476 | <gh_stars>1000+
import pandas as pd
from tensortrade.feed import Stream
from tests.utils.ops import assert_op
def test_add():
# (left, right) : (Stream, Stream)
s1 = Stream.source([3, -4, 6, -7, 2, -6], dtype="float")
s2 = Stream.source([-3, 4, -6, 7, -2, 6], dtype="float")
w1 = s1.add(s2).rename... |
net/util.py | juandesant/astrometry.net | 460 | 86479 | <gh_stars>100-1000
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django import forms
from django.utils.safestring import mark_safe
from django.forms import widgets
class HorizontalRadioSelect(widgets.RadioSelect):
input_type = 'radio'
template_name = 'radio-horizontal.html'
... |
src/sensing/drivers/radar/umrr_driver/src/smartmicro/Helper/basicThreadHelper/threadHelper.py | P4nos/Aslan | 227 | 86492 | import threading
import logging
import time
class ThreadHelperException(Exception):
pass
class ThreadHelper(threading.Thread):
"""
The class provides a frame for the threads used in the framework.
"""
# ------------------------------------------------------------------------------... |
pyGPs/Optimization/scg.py | Corentin-LF/pyGPs | 196 | 86519 | from __future__ import division
from past.utils import old_div
#===============================================================================
# SCG Scaled conjugate gradient optimization.
#
# Copyright (c) <NAME> (1996-2001)
# updates by <NAME> 2013
#
# Permission is granted for anyone to copy, use, or modif... |
tests/integration/test_hive_query/test.py | DevTeamBK/ClickHouse | 8,629 | 86540 | import logging
import os
import time
import pytest
from helpers.cluster import ClickHouseCluster
from helpers.test_tools import TSV
logging.getLogger().setLevel(logging.INFO)
logging.getLogger().addHandler(logging.StreamHandler())
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
@pytest.fixture(scope="modu... |
src/tests/t_general.py | tizenorg/platform.upstream.krb5 | 372 | 86559 | #!/usr/bin/python
from k5test import *
for realm in multipass_realms(create_host=False):
# Create a policy and see if it survives a dump/load.
realm.run_kadminl('addpol fred')
dumpfile = os.path.join(realm.testdir, 'dump')
realm.run_as_master([kdb5_util, 'dump', dumpfile])
realm.run_as_master([kdb5... |
djangoerp/core/templatetags/avatar.py | xarala221/django-erp | 345 | 86580 | #!/usr/bin/env python
"""This file is part of the django ERP project.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLD... |
DQM/SiStripMonitorClient/python/RecoForDQM_Cosmic_cff.py | ckamtsikis/cmssw | 852 | 86593 | <reponame>ckamtsikis/cmssw
import FWCore.ParameterSet.Config as cms
# Digitiser ####
# SiStrip
from EventFilter.SiStripRawToDigi.SiStripDigis_cfi import *
siStripDigis.ProductLabel = 'source'
# SiPixel
from EventFilter.SiPixelRawToDigi.SiPixelRawToDigi_cfi import *
siPixelDigis.InputLabel = 'source'
# Local Reco ... |
twilio/rest/api/v2010/account/call/event.py | BrimmingDev/twilio-python | 1,362 | 86615 | # coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base import values
from twilio.base.instance_resource import InstanceResource
from twilio.base.list_resource import ListResource
from twilio.base.page import Page
class EventList(ListRe... |
monk/pytorch_tests.py | take2rohit/monk_v1 | 542 | 86634 | <reponame>take2rohit/monk_v1<gh_stars>100-1000
import os
import sys
import time
from monk.pip_unit_tests.pytorch.test_optimizer_sgd import test_optimizer_sgd
from monk.pip_unit_tests.pytorch.test_optimizer_nesterov_sgd import test_optimizer_nesterov_sgd
from monk.pip_unit_tests.pytorch.test_optimizer_rmsprop import te... |
python/GafferSceneUI/BoundQueryUI.py | ddesmond/gaffer | 561 | 86659 | ##########################################################################
#
# Copyright (c) 2021, Cinesite VFX Ltd. 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 ... |
desktop/core/ext-py/ply-3.9/example/optcalc/calc.py | kokosing/hue | 7,986 | 86701 | <filename>desktop/core/ext-py/ply-3.9/example/optcalc/calc.py<gh_stars>1000+
# -----------------------------------------------------------------------------
# calc.py
#
# A simple calculator with variables. This is from O'Reilly's
# "Lex and Yacc", p. 63.
# ------------------------------------------------------------... |
tests/test_plotly.py | paultimothymooney/docker-python-2 | 2,030 | 86704 | import unittest
import plotly.graph_objs as go
class TestPlotly(unittest.TestCase):
def test_figure(self):
trace = {'x': [1, 2], 'y': [1, 3]}
data = [ trace ]
go.Figure(data=data)
|
datadog_checks_dev/datadog_checks/dev/tooling/commands/meta/windows/__init__.py | tdimnet/integrations-core | 663 | 86764 | <reponame>tdimnet/integrations-core
# (C) Datadog, Inc. 2021-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import click
from ...console import CONTEXT_SETTINGS
from .pdh import pdh
ALL_COMMANDS = [pdh]
@click.group(context_settings=CONTEXT_SETTINGS, short_help='Windows ut... |
src/robots/__init__.py | sergioisidoro/django-robots | 252 | 86777 | <gh_stars>100-1000
from pkg_resources import get_distribution
__version__ = get_distribution("django-robots").version
|
convlab2/policy/ppo/multiwoz/__init__.py | Malavikka/ConvLab-2 | 339 | 86781 | <reponame>Malavikka/ConvLab-2<filename>convlab2/policy/ppo/multiwoz/__init__.py
from convlab2.policy.ppo.multiwoz.ppo_policy import PPOPolicy |
omniglot/archs.py | tam17aki/pytorch-adacos | 209 | 86847 | import numpy as np
from torch import nn
from torch.nn import functional as F
import torch
from torchvision import models
import torchvision
__all__ = ['ResNet_IR']
class ResNet_IR(nn.Module):
def __init__(self, args):
super().__init__()
if args.backbone == 'resnet18':
self.backbone ... |
kuwala/common/jupyter/modules/poi_controller.py | bmahmoudyan/kuwala | 381 | 86849 | import json
import os
from geojson import Polygon
from kuwala.modules.common import polyfill_polygon
# Get the aggregated number of a specific POI category per H3 index at a given resolution
def get_pois_by_category_in_h3(sp, category, resolution, polygon_coords):
polygon_cells = None
if polygon_coords:
... |
megatron/module.py | eric-haibin-lin/Megatron-LM | 309 | 86873 | <gh_stars>100-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/LICENS... |
tick/base/tests/standard_normal_distribution_test.py | sumau/tick | 411 | 86887 | # License: BSD 3 clause
# -*- coding: utf8 -*-
import unittest
from tick.base.build.base import standard_normal_cdf, \
standard_normal_inv_cdf
from scipy.stats import norm
import numpy as np
from numpy.random import normal, uniform
class Test(unittest.TestCase):
def setUp(self):
self.size = 10
... |
fastflix/widgets/panels/info_panel.py | ObviousInRetrospect/FastFlix | 388 | 86895 | <filename>fastflix/widgets/panels/info_panel.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import re
from itertools import chain
from pathlib import Path
from typing import List, Union
from box import Box, BoxList
from PySide6 import QtCore, QtGui, QtWidgets
from fastflix.language import t
from fas... |
bot-bosses/tsadmiral/MyBot.py | HaliteChallenge/Halite-II | 232 | 86925 | """
Welcome to your first Halite-II bot!
This bot's name is Settler. It's purpose is simple (don't expect it to win complex games :) ):
1. Initialize game
2. If a ship is not docked and there are unowned planets
2.a. Try to Dock in the planet if close enough
2.b If not, go towards the planet
Note: Please do not place... |
src/api-service/__app__/onefuzzlib/azure/creds.py | tonybaloney/onefuzz | 2,692 | 86967 | <reponame>tonybaloney/onefuzz
#!/usr/bin/env python
#
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import functools
import logging
import os
import urllib.parse
from typing import Any, Callable, Dict, List, Optional, TypeVar, cast
from uuid import UUID
import requests
from azure.core.excep... |
pyx12/examples/deident834.py | azoner/pyx12 | 120 | 86969 | #! /usr/bin/env python
import sys
import getopt
import os.path
import logging
import random
# Intrapackage imports
libpath = os.path.abspath(os.path.join(os.path.dirname(__file__), '../..'))
if os.path.isdir(libpath):
sys.path.insert(0, libpath)
import pyx12
import pyx12.x12file
import pyx12.x12context
import pyx... |
dex-net/src/dexnet/database/keys.py | peter0749/PointNetGPD | 193 | 86996 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
Copyright ©2017. The Regents of the University of California (Regents). All Rights Reserved.
Permission to use, copy, modify, and distribute this software and its documentation for educational,
research, and not-for-profit purposes, without fee and without a signed licensi... |
paddlespeech/server/utils/onnx_infer.py | jerryuhoo/PaddleSpeech | 1,379 | 87000 | # Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
omaha_server/feedback/tasks.py | makar21/omaha-server | 142 | 87005 | # coding: utf8
"""
This software is licensed under the Apache 2 license, quoted below.
Copyright 2014 Crystalnix Limited
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/... |
Examples/AppKit/CocoaBindings/TableModelWithSearch/FilteringArrayController.py | Khan/pyobjc-framework-Cocoa | 132 | 87032 | <gh_stars>100-1000
#
# FilteringArrayController.py
# TableModelWithSearch
#
# Created by <NAME> on Sun Apr 04 2004.
# Copyright (c) 2004 __MyCompanyName__. All rights reserved.
#
from Cocoa import *
import re
kLiteralSearch = u'Literal Search'
kRegularExpressionSearch = u'Regular Expression Search'
def regexForS... |
examples/bicycle/kifdd_triangle.py | okkhoy/rlpy | 265 | 87036 | <gh_stars>100-1000
from __future__ import division
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from past.utils import old_div
import rlpy
import numpy as np
from hyperopt impor... |
pythran/tests/scipy/hausdorff.py | davidbrochart/pythran | 1,647 | 87046 | #
# Copyright (C) <NAME>, <NAME>, and <NAME>, 2016
#
# Distributed under the same BSD license as Scipy.
#
# adapted from scipy's cython version
import numpy as np
import numpy.random as random
#pythran export directed_hausdorff(float64[:,:], float64[:,:], int)
#pythran export directed_hausdorff_noshuffle(float64[:,:]... |
src/ralph/dns/tests.py | pinoatrome/ralph | 1,668 | 87077 | <reponame>pinoatrome/ralph<filename>src/ralph/dns/tests.py
# -*- coding: utf-8 -*-
from unittest.mock import patch
from django.db import transaction
from django.test import override_settings, TestCase, TransactionTestCase
from ralph.assets.tests.factories import (
ConfigurationClassFactory,
EthernetFactory
)
... |
rpython/rtyper/lltypesystem/llgroup.py | nanjekyejoannah/pypy | 381 | 87091 | import weakref
from rpython.rtyper.lltypesystem import lltype, llmemory, rffi
from rpython.rlib.rarithmetic import LONG_BIT
class GroupType(lltype.ContainerType):
"""A 'group' that stores static structs together in memory.
On 32-bit platforms, the point is that they can be referenced by a
GroupMemberOffs... |
examples/protocols/sockets/scripts/udpclient.py | Dangku/ESP8266_RTOS_SDK | 2,701 | 87093 | # This example code is in the Public Domain (or CC0 licensed, at your option.)
# Unless required by applicable law or agreed to in writing, this
# software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
# CONDITIONS OF ANY KIND, either express or implied.
# -*- coding: utf-8 -*-
from builtins import input... |
keanu-python/docs/remove_underscores.py | bwplotka/keanu | 153 | 87094 | <gh_stars>100-1000
import os
try:
os.rename('_build/html/_static', '_build/html/static')
os.rename('_build/html/_modules', '_build/html/modules')
os.rename('_build/html/_sources', '_build/html/sources')
except:
pass
root_dir = '_build/html'
for directory, subdirectories, files in os.walk(root_dir):
... |
examples/competitive/bot.py | DrInfy/python-sc2 | 242 | 87096 | <filename>examples/competitive/bot.py
import sc2
class CompetitiveBot(sc2.BotAI):
async def on_start(self):
print("Game started")
# Do things here before the game starts
async def on_step(self, iteration):
# Populate this function with whatever your bot should do!
pass
de... |
src/maestral/cli/cli_settings.py | gliptak/maestral | 436 | 87124 | from __future__ import annotations
from typing import TYPE_CHECKING
import click
from .output import echo, ok
from .common import convert_api_errors, existing_config_option, inject_proxy
from .core import DropboxPath, CliException
if TYPE_CHECKING:
from ..main import Maestral
@click.command(
help="""
Auto... |
neo/bin/prompt.py | volekerb/neo-python | 387 | 87128 | <reponame>volekerb/neo-python
#!/usr/bin/env python3
import argparse
import datetime
import os
import traceback
import asyncio
import termios
import sys
from prompt_toolkit.completion import WordCompleter
from prompt_toolkit.history import FileHistory
from prompt_toolkit.shortcuts import print_formatted_text, PromptSe... |
numba/pylowering.py | mawanda-jun/numba | 1,738 | 87130 | <gh_stars>1000+
"""
Lowering implementation for object mode.
"""
from __future__ import print_function, division, absolute_import
from llvmlite.llvmpy.core import Type, Constant
import llvmlite.llvmpy.core as lc
import operator
from . import cgutils, generators, ir, types, utils
from .errors import ForbiddenConstruc... |
openfda/parallel/reducer.py | FDA/openfda | 388 | 87155 | import collections
import logging
import os
import tempfile
from pickle import loads
import leveldb
logger = logging.getLogger('mapreduce')
def group_by_key(iterator):
'''Group identical keys together.
Given a sorted iterator of (key, value) pairs, returns an iterator of
(key1, values), (key2, values).
'''
... |
packages/syft/src/syft/core/node/common/node_table/entity.py | vishalbelsare/PySyft | 8,428 | 87159 | # stdlib
from typing import Any
# third party
from sqlalchemy import Column
from sqlalchemy import LargeBinary
from sqlalchemy import String
# relative
from . import Base
from ..... import deserialize
from ..... import serialize
class Entity(Base):
__tablename__ = "entity"
name = Column(String(255), primar... |
examples/pervasive/modules/wip/ll_controls.py | EricLina/attn2d | 490 | 87177 | import sys
import math
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from fairseq import utils
def progressive_max(x):
T = x.size(1)
x = F.pad(x, (T-1, 0), 'constant', -1)
x = F.max_pool1d(x.unsqueeze(1).float(), # shape into B, C, T
T, # kernel... |
examples/scripts/10_custom_backends.py | buildfail/frontera | 1,267 | 87186 | """
Custom backend example
"""
import random
from frontera import FrontierManager, Settings, FrontierTester, graphs
from frontera.contrib.backends.memory import MemoryBaseBackend
SITE_LIST = [
[('http://google.com', [])],
[('http://scrapinghub.com', [])],
[('http://zynga.com', [])],
[('http://microso... |
tests/__init__.py | JKitok/girder | 395 | 87191 | # -*- coding: utf-8 -*-
import unittest.mock
from girder import constants, logger
# Mock the logging methods so that we don't actually write logs to disk,
# and so tests can potentially inspect calls to logging methods.
print(constants.TerminalColor.warning('Mocking Girder log methods.'))
for handler in logger.handle... |
asreader/custombricks/save_the_best.py | rkadlec/asreader | 113 | 87194 | <reponame>rkadlec/asreader
__author__ = 'lada'
import os.path
from blocks.extensions import SimpleExtension
from blocks.serialization import secure_dump
SAVED_TO = "saved_to"
class SaveTheBest(SimpleExtension):
"""Check if a log quantity has the minimum/maximum value so far
and if that is true then save a ... |
infer_tools_tree/utils.py | gvieralopez/Coronary-Artery-Tracking-via-3D-CNN-Classification | 107 | 87195 | import numpy as np
import warnings
from scipy.ndimage.interpolation import zoom
import torch
import math
import copy
import cv2
from skimage import measure
import pandas as pd
def resample(imgs, spacing, new_spacing, order=2):
if len(imgs.shape) == 3:
new_shape = np.round(imgs.shape * spacing / new_spacing... |
Python/demos/d04_SimpleReconstruction.py | tsadakane/TIGRE | 326 | 87220 | <gh_stars>100-1000
#%% Demo 4: Simple Image reconstruction
#
#
# This demo will show how a simple image reconstruction can be performed,
# by using OS-SART and FDK
#
# --------------------------------------------------------------------------
# --------------------------------------------------------------------------
... |
contrib/0.挖宝行动/youzidata-机坪跑道航空器识别/src/data/yolo_dataset.py | huaweicloud/ModelArts-Lab | 1,045 | 87232 | # Copyright 2018 Deep Learning Service of Huawei Cloud. 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... |
hardware/chip/rtl872xd/hal/hal_test/uart/ucube.py | wstong999/AliOS-Things | 4,538 | 87281 | src = Split('''
uart_test.c
''')
component = aos_component('uart_test', src)
component.add_cflags('-Wall')
component.add_cflags('-Werror')
|
pad__unpad__example.py | DazEB2/SimplePyScripts | 117 | 87284 | <gh_stars>100-1000
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
def pad(s: bytes, bs=8) -> bytes:
pad_size = bs - (len(s) % bs)
return s + bytes([pad_size] * pad_size)
def unpad(s: bytes) -> bytes:
pad_size = s[-1]
return s[:-pad_size]
if __name__ == '__main__':
data... |
bmtk/simulator/pointnet/pyfunction_cache.py | aaberbach/bmtk | 216 | 87297 | <reponame>aaberbach/bmtk<gh_stars>100-1000
# Copyright 2017. <NAME>. All rights reserved
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
# following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this... |
tests/unit/fixtures/mock_hooks.py | troyready/runway | 134 | 87306 | """Mock hooks."""
import os
GLOBAL_VALUE = os.getenv("AWS_DEFAULT_REGION")
|
test/issues/test_012.py | ajnelson-nist/pySHACL | 167 | 87336 | <reponame>ajnelson-nist/pySHACL
# -*- coding: utf-8 -*-
#
"""
https://github.com/RDFLib/pySHACL/issues/12
"""
from pyshacl import validate
shacl_file_text = """
@prefix hei: <http://hei.org/customer/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .... |
dev/mixtures/Table2.9_to_JSON.py | pauliacomi/CoolProp | 520 | 87393 | <reponame>pauliacomi/CoolProp
data = """CO2-H2O 1.030538 0.828472 1.021392 0.895156 1
CO2-N2 0.994140013 1.107654104 1.022709642 1.047578256 1
CO2-O2 1.000000 1.031986 1.000000 1.084460 0
CO2-Ar 1.027147 0.968781 1.001378 1.029710 1
CO2-CO 0.993245 1.068392 1.030855 1.245499 0
H2O-N2 0.954149 ... |
research/cvt_text/corpus_processing/example.py | 873040/Abhishek | 82,518 | 87413 | <filename>research/cvt_text/corpus_processing/example.py
# Copyright 2018 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... |
tests/test_message.py | xjiro/python-valve | 136 | 87421 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# Copyright (C) 2013 <NAME>
from __future__ import (absolute_import,
unicode_literals, print_function, division)
import inspect
try:
from mock import Mock
except ImportError:
from unittest.mock import Mock
import pytest
import six
from valve... |
xpath/extractor/tables.py | r0oth3x49/xpath | 113 | 87446 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# pylint: disable=R,W,E,C
"""
Author : <NAME> (r0ot h3x49)
Github : https://github.com/r0oth3x49
License : MIT
Copyright (c) 2016-2025 <NAME> (r0ot h3x49)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated docume... |
test/benchmark_array_creation.py | Yousazoe/oxBot | 242 | 87451 | """
Testing what the fastest way is to create a 1D Array with 2 values
"""
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
import random
import numpy as np
x, y = random.uniform(0, 300), random.uniform(0, 300)
def numpy_array(x, y):
# Calculate distances between each of the... |
tests/test_commandline_classify_speakers.py | erayee/Montreal-Forced-Aligner | 702 | 87485 | <reponame>erayee/Montreal-Forced-Aligner<gh_stars>100-1000
import os
import pytest
from montreal_forced_aligner.command_line.classify_speakers import run_classify_speakers
from montreal_forced_aligner.command_line.mfa import parser
def test_classify(basic_corpus_dir, sick_dict_path, english_ivector_model, generated_... |
oracle_problems/problem_3.py | loftwah/Daily-Coding-Problem | 129 | 87509 | """This problem was asked by Oracle.
Given a binary search tree, find the floor and ceiling of a given integer.
The floor is the highest element in the tree less than or equal to an integer,
while the ceiling is the lowest element in the tree greater than or equal to an integer.
If either value does not exist, retu... |
recipes/Python/577859_CLOSlike_aroundbeforeafter_auxiliary/recipe-577859.py | tdiprima/code | 2,023 | 87531 | #!/usr/bin/env python
#
# Copyright (c) 2011 <NAME> (zuo). All rights reserved.
# Licensed under the MIT License.
#
# Python 2.5+/3.x-compatibile.
#
# The newest version of this module should be downloadable from:
# https://github.com/zuo/Zuo-s-Recipes-and-Drafts/blob/master/auxmethods.py
from __future__ import with_s... |
testData/typeinspection/ignoreInitArguments.py | alek-sun/pydantic-pycharm-plugin | 238 | 87541 | <reponame>alek-sun/pydantic-pycharm-plugin
from pydantic import BaseModel
class A(BaseModel):
a: int
def __init__(self, xyz: str):
super().__init__(a=xyz)
A(xyz=123<warning descr="null">)</warning>
A(a=123) |
utils/scripts/gen_onnx_spectrogram_model.py | dreiss/glow | 2,838 | 87562 | <reponame>dreiss/glow<filename>utils/scripts/gen_onnx_spectrogram_model.py
# Copyright (c) Glow Contributors. See CONTRIBUTORS file.
#
# 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
#
# ht... |
psdaq/psdaq/pyxpm/surf/devices/ti/_UCD92xx.py | ZhenghengLi/lcls2 | 134 | 87564 | <reponame>ZhenghengLi/lcls2<filename>psdaq/psdaq/pyxpm/surf/devices/ti/_UCD92xx.py
#-----------------------------------------------------------------------------
# This file is part of the 'SLAC Firmware Standard Library'. It is subject to
# the license terms in the LICENSE.txt file found in the top-level directory
# o... |
bruges/models/test/models_test.py | EvanBianco/bruges | 209 | 87590 | import unittest
import numpy as np
from numpy import array
from bruges.models import reconcile, interpolate, panel
from bruges.models import wedge
class ModelTest(unittest.TestCase):
"""
Tests models.
"""
def test_reconcile(self):
a = np.array([2, 6, 7, 7, 3])
b = np.array([3, 7, 3])
... |
depth/self_supervised_sfm/dataset.py | sarthakahuja11/cvml_project | 171 | 87612 | import os
import numpy as np
import tensorflow as tf
from depth.self_supervised_sfm.utils import readlines
AUTOTUNE = tf.data.experimental.AUTOTUNE
########################
# Constants
#########################
KITTI_K = np.array([[0.58, 0, 0.5, 0], # fx/width
[0, 1.92, 0.5, 0],
... |
s3_credentials/cli.py | simonw/s3-credentials | 106 | 87614 | from re import A
import boto3
import botocore
import click
import configparser
from csv import DictWriter
import io
import itertools
import json
import mimetypes
import os
import re
import sys
import textwrap
from . import policies
def bucket_exists(s3, bucket):
try:
s3.head_bucket(Bucket=bucket)
... |
test/programytest/extensions/test_base.py | cdoebler1/AIML2 | 345 | 87615 | import unittest
import unittest.mock
from programy.extensions.base import Extension
class MockExtension(Extension):
def execute(self,context, data):
raise NotImplementedError()
class ExtensionTests(unittest.TestCase):
def test_ensure_not_implemented(self):
bot = unittest.mock.Mock()
... |
docs/examples/use_cases/video_superres/tools/split_scenes.py | cyyever/DALI | 3,967 | 87641 | <gh_stars>1000+
import argparse
import os
import subprocess
def split_scenes(raw_data_path, out_data_path):
out_data_path = os.path.join(out_data_path,'orig','scenes')
if not os.path.isdir(os.path.join(out_data_path,'train')):
os.makedirs(os.path.join(out_data_path,'train'))
if not os.path.isdir... |
uq360/utils/transformers/one_class_svm.py | Sclare87/UQ360 | 148 | 87648 | from sklearn.svm import OneClassSVM
from uq360.utils.transformers.feature_transformer import FeatureTransformer
class OneClassSVMTransformer(FeatureTransformer):
"""One-class SVM outlier-classifier based derived feature.
This transformer fits an SVM decision boundary enclosing the
full training set. This ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.