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 |
|---|---|---|---|---|
applications/RANSApplication/python_scripts/formulations/fractional_step/fractional_step_k_omega_sst_rans_formulation.py | lkusch/Kratos | 778 | 12679368 | # import kratos
import KratosMultiphysics as Kratos
import KratosMultiphysics.RANSApplication as KratosRANS
# import formulation interface
from KratosMultiphysics.RANSApplication.formulations.rans_formulation import RansFormulation
# import formulations
from KratosMultiphysics.RANSApplication.formulations.incompressi... |
wouso/interface/top/tests.py | AlexandruGhergut/wouso | 117 | 12679392 | from wouso.core.tests import WousoTest
from wouso.interface.top.models import TopUser
class TopTest(WousoTest):
def test_challenges(self):
player = self._get_player()
top_player = player.get_extension(TopUser)
self.assertEqual(top_player.won_challenges, 0) |
test/test_signature_combine.py | afermanian/signatory | 156 | 12679413 | # Copyright 2019 <NAME>. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... |
scripts/local.datalake.RemoveIamAllowedPrincipals.py | avrios/data-lake-as-code | 106 | 12679416 | import logging
import boto3
from botocore.exceptions import ClientError
lf = boto3.client('lakeformation')
permissions = []
permissionResp = lf.list_permissions()
permissions.extend(permissionResp['PrincipalResourcePermissions'])
while 'NextToken' in permissionResp:
print(permissionResp)
permissionResp = ... |
tests/test_restfulgit.py | msuszko/restfulgit | 103 | 12679417 | <filename>tests/test_restfulgit.py
# coding=utf-8
import unittest
from hashlib import sha512
import os
import os.path
import io
from base64 import b64decode
from contextlib import contextmanager
from datetime import timedelta
from tempfile import mkdtemp, mkstemp
from shutil import rmtree
from subprocess import check... |
util/util.py | sangkny/EnlightenGAN | 1,077 | 12679438 | <gh_stars>1000+
# from __future__ import print_function
import numpy as np
from PIL import Image
import inspect, re
import numpy as np
import torch
import os
import collections
from torch.optim import lr_scheduler
import torch.nn.init as init
# Converts a Tensor into a Numpy array
# |imtype|: the desired type of the ... |
src/app/migrations/0002_DropTheOnetimeApp.py | denkasyanov/education-backend | 151 | 12679469 | <filename>src/app/migrations/0002_DropTheOnetimeApp.py<gh_stars>100-1000
# Generated by Django 3.1.4 on 2021-01-02 18:09
from django.db import migrations
def drop_old_contenttypes(apps, schema_editor):
apps.get_model('contenttypes.ContentType').objects.filter(app_label='onetime').delete()
class Migration(migra... |
conanfile.py | szigetics/di | 531 | 12679481 | <reponame>szigetics/di
from conans import ConanFile, CMake
class DI(ConanFile):
name = "DI"
version = "latest"
url = "https://github.com/boost-ext/di"
license = "Boost"
description = "[Boost::ext].DI - C++14 Dependency Injection Library"
settings = "os", "compiler", "arch", "build_type"
ex... |
test/python/visualization/pulse_v2/test_layouts.py | Roshan-Thomas/qiskit-terra | 1,599 | 12679507 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative wo... |
lldb/packages/Python/lldbsuite/test/python_api/default-constructor/sb_lineentry.py | medismailben/llvm-project | 2,338 | 12679513 | """
Fuzz tests an object after the default construction to make sure it does not crash lldb.
"""
import lldb
def fuzz_obj(obj):
obj.GetStartAddress()
obj.GetEndAddress()
obj.GetFileSpec()
obj.GetLine()
obj.GetColumn()
obj.GetDescription(lldb.SBStream())
|
app/routers/auth/user_schema.py | cdlaimin/pity | 135 | 12679553 | from pydantic import BaseModel, validator
from app.excpetions.ParamsException import ParamsError
class UserDto(BaseModel):
name: str
password: str
username: str
email: str
@validator('name', 'password', 'username', 'email')
def field_not_empty(cls, v):
if isinstance(v, s... |
admin_interface/admin.py | cherijs/django-admin-interface | 1,129 | 12679575 | <gh_stars>1000+
# -*- coding: utf-8 -*-
from admin_interface.compat import gettext_lazy as _
from admin_interface.models import Theme
from django.contrib import admin
class ThemeAdmin(admin.ModelAdmin):
list_display = ('name', 'active', )
list_editable = ('active', )
list_per_page = 100
show_full_r... |
lldb/test/API/commands/target/stop-hooks/TestStopHookScripted.py | mkinsner/llvm | 2,338 | 12679627 | <filename>lldb/test/API/commands/target/stop-hooks/TestStopHookScripted.py
"""
Test stop hook functionality
"""
import lldb
import lldbsuite.test.lldbutil as lldbutil
from lldbsuite.test.lldbtest import *
from lldbsuite.test.decorators import *
class TestStopHooks(TestBase):
mydir = TestBase.compute_mydir(__fi... |
tests/messages/test_encode.py | fooker/mido | 658 | 12679643 | from mido.messages.specs import SPEC_BY_STATUS
from mido.messages.encode import encode_message
from mido.messages.decode import decode_message
def test_encode_decode_all():
"""Encode and then decode all messages on all channels.
Each data byte is different so that the test will fail if the
bytes are swap... |
seldom/db_operation/sqlite_db.py | chelizhi2020/seldom | 374 | 12679651 | <reponame>chelizhi2020/seldom
import sqlite3
from seldom.db_operation.base_db import SQLBase
class SQLiteDB(SQLBase):
def __init__(self, db_path):
"""
Connect to the sqlite database
"""
self.connection = sqlite3.connect(db_path)
self.cursor = self.connection.cursor()
... |
test/unit/model/test_views.py | rhpvorderman/galaxy | 1,085 | 12679718 | <filename>test/unit/model/test_views.py
import pytest
from sqlalchemy import (
Column,
Integer,
MetaData,
Table,
)
from sqlalchemy.sql import (
column,
text,
)
from galaxy.model.database_utils import (
create_database,
sqlalchemy_engine,
)
from galaxy.model.view.utils import (
Creat... |
tests/test_stream_xep_0085.py | E-Tahta/sleekxmpp | 499 | 12679755 | import time
import unittest
from sleekxmpp.test import SleekTest
class TestStreamChatStates(SleekTest):
def tearDown(self):
self.stream_close()
def testChatStates(self):
self.stream_start(mode='client', plugins=['xep_0030', 'xep_0085'])
results = []
def handle_state(msg):
... |
plugins/tests/myparser_test.py | otherbeast/hackers-tool-kit | 393 | 12679765 | <gh_stars>100-1000
#
# Unit tests for myparser.py
#
import myparser
import unittest
class TestMyParser(unittest.TestCase):
def test_emails(self):
word = 'domain.com'
results = '@domain.com***a@domain***banotherdomain.com***<EMAIL>***<EMAIL>***'
p = myparser.parser(results, word)
... |
test/labeling/test_utils.py | melonwater211/snorkel | 2,906 | 12679798 | <reponame>melonwater211/snorkel
import unittest
import numpy as np
import pandas as pd
from snorkel.labeling import filter_unlabeled_dataframe
class TestAnalysis(unittest.TestCase):
def test_filter_unlabeled_dataframe(self) -> None:
X = pd.DataFrame(dict(A=["x", "y", "z"], B=[1, 2, 3]))
y = np.a... |
compiler_gym/util/truncate.py | thecoblack/CompilerGym | 562 | 12679803 | <filename>compiler_gym/util/truncate.py
# 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.
from collections import deque
from typing import Iterable
def truncate(
string: str,
max_line... |
pyechonest/catalog.py | FosterFromGloster/PeskyDuplicates | 351 | 12679809 | #!/usr/bin/env python
# encoding: utf-8
"""
Copyright (c) 2010 The Echo Nest. All rights reserved.
Created by <NAME> on 2010-08-25.
The Catalog module loosely covers http://developer.echonest.com/docs/v4/catalog.html
Refer to the official api documentation if you are unsure about something.
"""
try:
import json
e... |
proxy/core/ssh/tunnel.py | sakurai-youhei/proxy.py | 1,891 | 12679819 | <gh_stars>1000+
# -*- coding: utf-8 -*-
"""
proxy.py
~~~~~~~~
⚡⚡⚡ Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on
Network monitoring, controls & Application development, testing, debugging.
:copyright: (c) 2013-present by <NAME> and contributors.
:license: BSD, se... |
sources/scripts/terraform_client.py | andrew-glenn/terraform-aws-control_tower_account_factory | 219 | 12679823 | <filename>sources/scripts/terraform_client.py
#!/usr/bin/python
# Copyright Amazon.com, Inc. or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
import os
import time
import requests
TERRAFORM_API_ENDPOINT = ""
LOCAL_CONFIGURATION_PATH = ""
TERRAFORM_VERSION = ""
def init(api_endpoint, t... |
spyglass/convert_report_to_junit.py | davideschiavone/pulpissimo | 228 | 12679836 | <reponame>davideschiavone/pulpissimo
#!/usr/bin/env python3.6
import argparse
from itertools import groupby, zip_longest
from textwrap import wrap
from xml.dom import minidom
import re
import sys
from xml.dom.minidom import Document
parser = argparse.ArgumentParser(description="Converts Spyglass lint reports of the l... |
venv/lib/python3.8/site-packages/statsmodels/tsa/tests/results/results_arima.py | johncollinsai/post-high-frequency-data | 6,931 | 12679856 | <reponame>johncollinsai/post-high-frequency-data<gh_stars>1000+
import os
import numpy as np
from numpy import genfromtxt
cur_dir = os.path.dirname(os.path.abspath(__file__))
path = os.path.join(cur_dir, "results_arima_forecasts.csv")
with open(path, "rb") as fd:
forecast_results = genfromtxt(fd, names=True, del... |
cupy_alias/manipulation/basic.py | fixstars/clpy | 142 | 12679858 | from clpy.manipulation.basic import * # NOQA
|
tools/wptserve/wptserve/logger.py | meyerweb/wpt | 14,668 | 12679865 | import logging
def get_logger():
# Use the root logger
return logging.getLogger()
|
src/genie/libs/parser/iosxe/show_config.py | nujo/genieparser | 204 | 12679878 | ''' show_config.py
IOSXE parsers for the following show command
* show configuration lock
'''
# Python
import re
# Metaparser
from genie.metaparser import MetaParser
from genie.metaparser.util.schemaengine import Schema, \
Optional, \
... |
DQM/L1TMonitor/python/L1TBMTFAlgoSelector_cfi.py | ckamtsikis/cmssw | 852 | 12679890 | import FWCore.ParameterSet.Config as cms
l1tBmtfAlgoSelector = cms.EDProducer(
'L1TBMTFAlgoSelector',
# verbose = cms.untracked.bool(False),
bmtfKalman = cms.InputTag("simKBmtfDigis:BMTF"),
bmtfLegacy = cms.InputTag("simBmtfDigis:BMTF"),
feds = cms.InputTag("rawDataCollector")
)
|
examples/vae/utils/custom_mlp.py | nipunbatra/pyro | 4,959 | 12679905 | <filename>examples/vae/utils/custom_mlp.py
# Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
from inspect import isclass
import torch
import torch.nn as nn
from pyro.distributions.util import broadcast_shape
class Exp(nn.Module):
"""
a custom module for exponentiation ... |
src/compas_rhino/conversions/_surfaces.py | funkchaser/compas | 235 | 12679938 | <reponame>funkchaser/compas
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from compas.geometry import Point
from Rhino.Geometry import NurbsSurface as RhinoNurbsSurface
from ._primitives import point_to_rhino
from ._primitives import point_to_compas
de... |
nuplan/planning/script/builders/training_callback_builder.py | motional/nuplan-devkit | 128 | 12679954 | import logging
from typing import List
import pytorch_lightning as pl
from hydra.utils import instantiate
from omegaconf import DictConfig
from nuplan.planning.script.builders.utils.utils_type import validate_type
logger = logging.getLogger(__name__)
def build_callbacks(cfg: DictConfig) -> List[pl.Callback]:
"... |
train.py | DalasNoin/ACER | 235 | 12679988 | <filename>train.py
# -*- coding: utf-8 -*-
import math
import random
import gym
import torch
from torch import nn
from torch.nn import functional as F
from memory import EpisodicReplayMemory
from model import ActorCritic
from utils import state_to_tensor
# Knuth's algorithm for generating Poisson samples
def _poisso... |
opta/commands/init_templates/variables/azure_location.py | riddopic/opta | 595 | 12679993 | from opta.commands.init_templates.helpers import dictionary_deep_set
from opta.commands.init_templates.template import TemplateVariable
LOCATIONS = [
"australiaeast",
"brazilsouth",
"canadacentral",
"centralus",
"eastus",
"eastus2",
"francecentral",
"germanywestcentral",
"japaneast"... |
examples/pageWindow.py | tgolsson/appJar | 666 | 12679995 | <gh_stars>100-1000
import sys
sys.path.append("../")
from appJar import gui
lid = 0
def add(btn):
global lid
app.openPage("Main Title", app.getSpinBox("spin"))
app.addLabel(str(lid), str(lid))
lid +=1
app.stopPage()
app=gui()
app.setBg("DarkKhaki")
app.setGeometry(280,400)
app.startPagedWindow("... |
pynq/lib/video/hierarchies.py | michalkouril/PYNQ | 1,537 | 12680000 | # Copyright (c) 2018, Xilinx, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of con... |
tests/extmod/uctypes_byteat.py | learnforpractice/micropython-cpp | 198 | 12680030 | try:
import uctypes
except ImportError:
print("SKIP")
raise SystemExit
data = bytearray(b'01234567')
print(uctypes.bytes_at(uctypes.addressof(data), 4))
print(uctypes.bytearray_at(uctypes.addressof(data), 4))
|
pylayers/antprop/diffRT.py | usmanwardag/pylayers | 143 | 12680042 | """
.. currentmodule:: pylayers.antprop.diffRT
.. autosummary::
:members:
"""
from __future__ import print_function
import doctest
import os
import glob
#!/usr/bin/python
# -*- coding: latin1 -*-
import numpy as np
import scipy.special as sps
import matplotlib.pyplot as plt
import pdb
def diff(fGHz,phi0,phi,si,s... |
ndscheduler/corescheduler/datastore/base_test.py | JonathanCalderon/ndscheduler | 1,038 | 12680068 | """Unit tests for DatastoreBase."""
import datetime
import unittest
from apscheduler.schedulers.blocking import BlockingScheduler
from ndscheduler.corescheduler import constants
from ndscheduler.corescheduler.datastore.providers.sqlite import DatastoreSqlite
class DatastoreBaseTest(unittest.TestCase):
def set... |
adb/systrace/catapult/common/py_trace_event/py_trace_event/trace_time_unittest.py | mohanedmoh/TBS | 2,151 | 12680092 | <reponame>mohanedmoh/TBS
# 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.
import contextlib
import logging
import platform
import sys
import unittest
from py_trace_event import trace_time
class TimerTest... |
tests/test_labeler.py | timgates42/dedupe | 2,190 | 12680103 | import dedupe
import unittest
import random
import pytest
SAMPLE = [({"name": "Bob", "age": "50"}, {"name": "Charlie", "age": "75"}),
({"name": "Meredith", "age": "40"}, {"name": "Sue", "age": "10"}),
({"name": "Willy", "age": "35"}, {"name": "William", "age": "35"}),
({"name": "Jimmy", "... |
carla_twist_to_control/src/carla_twist_to_control/carla_twist_to_control.py | SebastianHuch/ros-bridge | 314 | 12680118 | #!/usr/bin/env python
#
# Copyright (c) 2020 Intel Corporation
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""
receive geometry_nav_msgs::Twist and publish carla_msgs::CarlaEgoVehicleControl
use max wheel steer angle
"""
import sys
import ros... |
mindinsight/datavisual/data_transform/data_manager.py | mindspore-ai/mindinsight | 216 | 12680119 | # Copyright 2019-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 applicable law or agre... |
sunpy/io/ana.py | mridullpandey/sunpy | 628 | 12680124 | """
This module provides an ANA file Reader.
This is a modified version of `pyana <https://github.com/tvwerkhoven/pyana>`__.
.. warning::
The reading and writing of ana files is not supported under Windows.
"""
import os
import collections
from sunpy.io.header import FileHeader
try:
from sunpy.io import _p... |
Python/tdw/FBOutput/EnvironmentCollision.py | felixbinder/tdw | 307 | 12680125 | <gh_stars>100-1000
# automatically generated by the FlatBuffers compiler, do not modify
# namespace: FBOutput
import tdw.flatbuffers
class EnvironmentCollision(object):
__slots__ = ['_tab']
@classmethod
def GetRootAsEnvironmentCollision(cls, buf, offset):
n = tdw.flatbuffers.encode.Ge... |
scripts/extract_accuracy.py | awesome-archive/mixmatch | 1,124 | 12680132 | <reponame>awesome-archive/mixmatch
#!/usr/bin/env python
# Copyright 2019 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# U... |
mindinsight/explainer/manager/explain_loader.py | lvyufeng/mindconverter_standalone | 216 | 12680144 | <filename>mindinsight/explainer/manager/explain_loader.py<gh_stars>100-1000
# Copyright 2020-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.a... |
h2o-py/tests/testdir_misc/pyunit_factoring.py | ahmedengu/h2o-3 | 6,098 | 12680169 | <filename>h2o-py/tests/testdir_misc/pyunit_factoring.py
from __future__ import print_function
from builtins import zip
import sys
sys.path.insert(1,"../../")
import h2o
from tests import pyunit_utils
from h2o import H2OFrame
from h2o.exceptions import H2OTypeError, H2OValueError
def compare_frames(expected, actual):
... |
vega/algorithms/nas/sp_nas/spnas_trainer_callback.py | This-50m/vega | 724 | 12680200 | # -*- coding:utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the MIT License.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the ... |
third_party/blink/renderer/build/scripts/blinkbuild/name_style_converter.py | zealoussnow/chromium | 14,668 | 12680201 | <reponame>zealoussnow/chromium
# Copyright 2017 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=import-error,print-statement,relative-import
import copy
import re
SPECIAL_TOKENS = [
# This list shou... |
aztk/client/cluster/helpers/wait_for_task_to_complete.py | Geims83/aztk | 161 | 12680205 | <gh_stars>100-1000
import time
import azure.batch.models as batch_models
def wait_for_task_to_complete(core_cluster_operations, job_id: str, task_id: str):
while True:
task = core_cluster_operations.batch_client.task.get(job_id=job_id, task_id=task_id)
if task.state != batch_models.TaskState.comp... |
grove/display/jhd1802.py | Mehmet-Erkan/grove.py | 122 | 12680230 | <filename>grove/display/jhd1802.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# The MIT License (MIT)
# Copyright (C) 2018 Seeed Technology Co.,Ltd.
#
# This is the library for Grove Base Hat
# which used to connect grove sensors for Raspberry Pi.
'''
This is the code for
- `Grove - 16 x 2 LCD (Black on Red) ... |
tests/routers/test_routers_social.py | theoohoho/authx | 141 | 12680248 | <filename>tests/routers/test_routers_social.py
from unittest import mock
import pytest
from fastapi import FastAPI
from fastapi.testclient import TestClient
from starlette.middleware.sessions import SessionMiddleware
from authx import get_social_router
from tests.utils import ACCESS_COOKIE_NAME, REFRESH_COOKIE_NAME, ... |
src/third_party/swiftshader/third_party/llvm-7.0/llvm/utils/lit/tests/discovery.py | rhencke/engine | 171 | 12680264 | # Check the basic discovery process, including a sub-suite.
#
# RUN: %{lit} %{inputs}/discovery \
# RUN: -j 1 --debug --show-tests --show-suites \
# RUN: -v > %t.out 2> %t.err
# RUN: FileCheck --check-prefix=CHECK-BASIC-OUT < %t.out %s
# RUN: FileCheck --check-prefix=CHECK-BASIC-ERR < %t.err %s
#
# CHECK-BASIC-ERR:... |
eval/multi_bin/all_bins/run_single.py | cpbscholten/karonte | 294 | 12680265 | <gh_stars>100-1000
# 1) fw dir
# 2) result file
# 3) log file
import os
import sys
import json
class Runner:
def __init__(self, cmd):
self.cmd = cmd
def run_it(self):
os.system(self.cmd)
def run(config, log_dir):
jconfig = json.load(open(config, 'r'))
core_script = '/'.join(__file__... |
icevision/models/mmdet/fastai/__init__.py | ai-fast-track/mantisshrimp | 580 | 12680290 | <filename>icevision/models/mmdet/fastai/__init__.py
from icevision.models.mmdet.fastai.callbacks import *
from icevision.models.mmdet.fastai.learner import *
|
examples/global_code.py | quynhanh-ngx/pytago | 206 | 12680313 | A = [1, 2, 3]
for i, x in enumerate(A):
A[i] += x
B = A[0]
C = A[0]
D: int = 3
while C < A[2]:
C += 1
if C == A[2]:
print('True')
def main():
print("Main started")
print(A)
print(B)
print(C)
print(D)
if __name__ == '__main__':
main()
|
.travis/run-make-gateware-filter.py | auscompgeek/litex-buildenv | 198 | 12680332 | <gh_stars>100-1000
#!/usr/bin/python
import collections
import os
import pprint
import re
import signal
import subprocess
import sys
import threading
import time
log_file = open(sys.argv[1], 'w+')
# Suppressions for warning / info messages
#suppressions = [x.strip() for x in open(sys.argv[2], 'r').readlines() if not... |
proto/ptf/l3_host_fwd/test/l3_host_fwd.py | mkruskal-google/PI | 149 | 12680352 | #!/usr/bin/env python
# Copyright 2013-present Barefoot Networks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... |
dataviva/utils/profanities_filter.py | dogobox/datavivamaster | 126 | 12680358 | """
Module that provides a class that filters profanities
f = ProfanitiesFilter(['bad', 'un\w+'], replacements="-")
example = "I am doing bad ungood badlike things."
print f.clean(example)
# Returns "I am doing --- ------ badlike things."
f.inside_words = True
print f.clean(example)
... |
example-import-image/script.py | teachthenet/TeachCraft-Challenges | 503 | 12680375 | <filename>example-import-image/script.py
"""
This script does the following:
- Take an image as input, and read it pixel by pixel.
- For each pixel in the image, set a block in the minecraft world closest to the color of that pixel.
- End result should be pixel art in minecraft world.
- Use mario.gif in this directory ... |
LeetCode/0064_Minimum_Path_Sum.py | Achyut-sudo/PythonAlgorithms | 144 | 12680383 | <gh_stars>100-1000
class Solution:
def minPathSum(self, grid: List[List[int]]) -> int:
rows=len(grid)
columns=len(grid[0])
for i in range(1,columns):
grid[0][i]+=grid[0][i-1]
for j in range(1,rows):
grid[j][0]+=grid[j-1][0]
for k in range(1,rows):
... |
InvenTree/build/migrations/0006_auto_20190913_1407.py | ArakniD/InvenTree | 656 | 12680387 | <filename>InvenTree/build/migrations/0006_auto_20190913_1407.py
# Generated by Django 2.2.5 on 2019-09-13 14:07
import InvenTree.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('build', '0005_auto_20190604_2217'),
]
operations = [
migrati... |
modoboa/policyd/core.py | HarshCasper/modoboa | 1,602 | 12680388 | <filename>modoboa/policyd/core.py
"""Core components of the policy daemon."""
import asyncio
import concurrent.futures
from email.message import EmailMessage
import logging
import aiosmtplib
from dateutil.relativedelta import relativedelta
import aioredis
from django.conf import settings
from django.db import connec... |
tests/test_lr_schedulers.py | breezedeus/cnstd | 266 | 12680395 | import torch
import torch.nn as nn
from torch.optim import lr_scheduler
import matplotlib.pyplot as plt
from cnstd.lr_scheduler import WarmupCosineAnnealingRestarts
class NullModule(nn.Module):
def __init__(self):
super().__init__()
self.fc = nn.Linear(1, 1)
ori_lr = 5e-4
model = NullModule()
o... |
5]. Projects/Desktop Development/GUI Projects/05). Advanced Notepad/TextEditor.py | MLinesCode/The-Complete-FAANG-Preparation | 6,969 | 12680408 | <gh_stars>1000+
import tkinter as tk
from tkinter import font, colorchooser, filedialog, messagebox
from tkinter import ttk
import os
main_application = tk.Tk()
main_application.geometry("1450x700+50+40")
# main_application.geometry("1530x800+0+0")
main_application.title("Text Editor:- By <NAME>")
# MAIN MENU
main_m... |
oracle_analysis/motion_pattern_analysis.py | noahcao/DanceTrack | 137 | 12680422 | <reponame>noahcao/DanceTrack
"""
Script to calculate the average IoU of the same obejct on consecutive
frames, and the relative switch frequency (Figure3(b) and Figure3(c)).
The original data in paper is calculated on all sets: train+val+test.
On the train-set:
* Average IoU on consecutive fram... |
tests/python/unittest/test_auto_scheduler_search_task.py | XiaoSong9905/tvm | 4,640 | 12680428 | # 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 u... |
predictions/pred_constants.py | bfortuner/VOCdetect | 336 | 12680433 | <filename>predictions/pred_constants.py<gh_stars>100-1000
PRED_TYPE = 'Basic'
TTA_PRED_TYPE = 'TTA'
ENS_TYPE = 'Ens'
MEGA_ENS_TYPE = 'MegaEns'
|
tests/python/test_bls_assume_in_range.py | kxxt/taichi | 11,699 | 12680435 | <filename>tests/python/test_bls_assume_in_range.py<gh_stars>1000+
import taichi as ti
from .bls_test_template import bls_particle_grid
@ti.test(require=ti.extension.bls)
def test_scattering():
bls_particle_grid(N=128,
ppc=10,
block_size=8,
scatter... |
Code/Chenglong/gen_best_ensemble_model.py | ChenglongChen/Kaggle_Homedepot | 465 | 12680439 | <filename>Code/Chenglong/gen_best_ensemble_model.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
@author: <NAME> <<EMAIL>>
@brief: script for generating the best ensemble model from Chenglong's side
@note: 1. make sure you have run `python run_data.py` first
2. make sure you have built `some diverse` 1st level mod... |
py/clam.py | seahorn/crab-llvm | 161 | 12680472 | <reponame>seahorn/crab-llvm
#!/usr/bin/env python3
"""
Entry point to Clam Abstract Interpreter
"""
import argparse as a
import atexit
#from datetime import datetime
import errno
import io
import os
import os.path
import platform
import resource
import shutil
import subprocess as sub
import signal
import stats
import... |
hvad/test_utils/context_managers.py | Kunpors/dr.pors- | 341 | 12680504 | <reponame>Kunpors/dr.pors-
# -*- coding: utf-8 -*-
import shutil
import tempfile
import warnings
#===============================================================================
try:
from tempfile import TemporaryDirectory
except ImportError:
class TemporaryDirectory(object):
def __init__(self, suffix... |
tests/conftest.py | dgilland/fnc | 152 | 12680511 | from unittest import mock
import pytest
@pytest.fixture
def mocksleep():
with mock.patch("time.sleep") as mocked:
yield mocked
|
tests/client/construct_request_test.py | educatedguessing/bravado | 600 | 12680536 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
import mock
import pytest
from bravado_core.operation import Operation
from bravado_core.request import IncomingRequest
from bravado_core.request import unmarshal_request
from bravado_core.spec import Spec
from typing import Any
from typing import Dict
from bravado.client imp... |
bin/bnf_to_cnf/bnf_to_cnf/parser.py | s-weigand/darglint | 405 | 12680537 |
from lark import (
Lark,
Tree,
)
from .node import (
Node,
NodeType,
)
class Parser(object):
grammar = r'''
start: grammar
grammar: imports? external_imports? name? start_expression? production+
production: annotations? symbol _OPER expression
_OPER: "::="
... |
extra/src/autogluon/extra/model_zoo/models/standford_dog_models.py | zhiqiangdon/autogluon | 4,462 | 12680545 | """Pretrained models for Standford Dogs dataset"""
import os
import mxnet as mx
import gluoncv as gcv
from ..model_store import get_model_file
__all__ = ['standford_dog_resnet152_v1', 'standford_dog_resnext101_64x4d']
def standford_dog_resnet152_v1(pretrained=False, root=os.path.join('~', '.autogluon', 'models'),
... |
tests/test_models/test_bottom_up_forward.py | nightfuryyy/mmpose | 1,775 | 12680586 | <filename>tests/test_models/test_bottom_up_forward.py
# Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import torch
from mmpose.models.detectors import AssociativeEmbedding
def test_ae_forward():
model_cfg = dict(
type='AssociativeEmbedding',
pretrained=None,
backbone=di... |
bleak/backends/bluezdbus/scanner.py | arthurbiancarelli/bleak | 753 | 12680599 | <filename>bleak/backends/bluezdbus/scanner.py
import logging
from typing import Any, Dict, List, Optional
from dbus_next.aio import MessageBus
from dbus_next.constants import BusType, MessageType
from dbus_next.message import Message
from dbus_next.signature import Variant
from bleak.backends.bluezdbus import defs
fr... |
algorithms/dp/knapsack.py | vansh-tiwari/algorithms | 22,426 | 12680635 | <gh_stars>1000+
"""
Given the capacity of the knapsack and items specified by weights and values,
return the maximum summarized value of the items that can be fit in the
knapsack.
Example:
capacity = 5, items(value, weight) = [(60, 5), (50, 3), (70, 4), (30, 2)]
result = 80 (items valued 50 and 30 can both be fit in t... |
examples/23.ray_visibility.py | Neburski/NVISII | 149 | 12680638 | <reponame>Neburski/NVISII
import nvisii
import math
import PySide2
import colorsys
from PySide2.QtCore import *
from PySide2.QtWidgets import *
nvisii.initialize()
nvisii.resize_window(1000,1000)
nvisii.enable_denoiser()
# nvisii.configure_denoiser(False, False, True)
nvisii.set_max_bounce_depth(diffuse_depth=2, gloss... |
baselines/NGRAM/ngram_rerank.py | sordonia/HierarchicalEncoderDecoder | 116 | 12680662 | import os
import argparse
import cPickle
import operator
import itertools
from Common.psteff import *
def rerank(model_file, ctx_file, rnk_file):
pstree = PSTInfer()
pstree.load(model_file)
output_file = open(rnk_file + "_NGRAM.gen", "w")
coverage = 0
for num_line, (ctx_line, rnk_line)... |
qtpy/QtPrintSupport.py | spyder-ide/qtpy | 632 | 12680663 | <reponame>spyder-ide/qtpy
#
# Copyright © 2009- The Spyder Development Team
#
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
"""
Provides QtPrintSupport classes and functions.
"""
from . import PYQT5, PYQT6, PYSIDE6, PYSIDE2, PythonQtError
if PYQT5:
from PyQt5.QtPrintSupport impor... |
eventsourcing/tests/test_processapplication.py | johnbywater/eventsourcing | 972 | 12680668 | <filename>eventsourcing/tests/test_processapplication.py
from typing import List
from unittest.case import TestCase
from eventsourcing.dispatch import singledispatchmethod
from eventsourcing.domain import AggregateEvent
from eventsourcing.persistence import IntegrityError, Notification, Transcoder
from eventsourcing.s... |
specs/matchers/built_in/end_with_spec.py | danibaena/expects | 189 | 12680680 | # -*- coding: utf-8 -*
from collections import OrderedDict
from expects import *
from expects.testing import failure
IRRELEVANT_ARGS = (1, 2)
with describe('end_with'):
with before.each:
self.str = 'My foo string'
self.lst = [1, 2, 3]
self.dct = {'bar': 0, 'baz': 1}
self.ordered... |
setup.py | hiroki-sawano/puput | 554 | 12680696 | <reponame>hiroki-sawano/puput
import os
import re
import codecs
try:
from setuptools import setup, find_packages
except ImportError:
from distutils.core import setup
def get_metadata(package, field):
"""
Return package data as listed in `__{field}__` in `init.py`.
"""
init_py = codecs.open(os... |
python/bench/bench_cross_entropy.py | shauheen/triton | 3,352 | 12680705 | import torch
import triton
confs = [
triton.testing.Benchmark(
x_names = ['N'],
x_vals = [128, 256, 512, 1024, 2048, 3072, 4096, 6144, 8192],
line_arg = 'provider',
line_vals = ['triton', 'torch'],
line_names = ['Triton', 'Torch'],
... |
tests/integration/ERC20CRV/test_mintable_in_timeframe.py | AqualisDAO/curve-dao-contracts | 217 | 12680742 | <reponame>AqualisDAO/curve-dao-contracts
import pytest
from brownie.test import given, strategy
from tests.conftest import INITIAL_SUPPLY, YEAR, YEAR_1_SUPPLY, approx
@pytest.fixture(scope="module", autouse=True)
def initial_setup(chain, token):
chain.sleep(86401)
token.update_mining_parameters()
@given(ti... |
pcdet/models/backbones_3d/pfe/__init__.py | TillBeemelmanns/OpenPCDet | 184 | 12680753 | from .voxel_set_abstraction import VoxelSetAbstraction
__all__ = {
'VoxelSetAbstraction': VoxelSetAbstraction
}
|
algoexpert.io/python/Find_Three_Largest_Number.py | its-sushant/coding-interview-gym | 713 | 12680759 | <gh_stars>100-1000
# My solution using Hepa
import heapq
def findThreeLargestNumbers(array):
hp = []
for num in array:
if len(hp) < 3:
heapq.heappush(hp, num)
else:
if hp[0] < num:
heapq.heappop(hp)
heapq.heappush(hp, num)
return sorted(hp)
# Solution providd by Algoexpert
# O(n) time | O(1) sp... |
microraiden/utils/__init__.py | andrevmatos/microraiden | 417 | 12680778 | <reponame>andrevmatos/microraiden<filename>microraiden/utils/__init__.py
from .crypto import (
generate_privkey,
pubkey_to_addr,
privkey_to_addr,
addr_from_sig,
pack,
keccak256,
keccak256_hex,
sign,
sign_transaction,
eth_message_hash,
eth_sign,
eth_verify,
eth_sign_ty... |
DQM/SiStripMonitorHardware/python/siStripBuildTrackerMap_cfi.py | ckamtsikis/cmssw | 852 | 12680783 | <filename>DQM/SiStripMonitorHardware/python/siStripBuildTrackerMap_cfi.py
import FWCore.ParameterSet.Config as cms
siStripBuildTrackerMap = cms.EDAnalyzer(
"BuildTrackerMapPlugin",
#input root file containing histograms
InputFileName = cms.untracked.string('DQMStore.root'),
DoDifference = cms.untracked... |
crabageprediction/venv/Lib/site-packages/pandas/tests/indexes/timedeltas/test_timedelta_range.py | 13rianlucero/CrabAgePrediction | 28,899 | 12680806 | import numpy as np
import pytest
from pandas import (
Timedelta,
timedelta_range,
to_timedelta,
)
import pandas._testing as tm
from pandas.tseries.offsets import (
Day,
Second,
)
class TestTimedeltas:
def test_timedelta_range(self):
expected = to_timedelta(np.arange(5), unit="D")
... |
usaspending_api/idvs/v2/views/activity.py | g4brielvs/usaspending-api | 217 | 12680808 | from collections import OrderedDict
from copy import copy, deepcopy
from psycopg2.sql import Identifier, Literal, SQL
from rest_framework.request import Request
from rest_framework.response import Response
from rest_framework.views import APIView
from usaspending_api.common.cache_decorator import cache_response
from ... |
reviewboard/hostingsvcs/tests/test_bitbucket.py | seekingalpha/reviewboard | 921 | 12680830 | <gh_stars>100-1000
"""Unit tests for the Bitbucket hosting service."""
from __future__ import unicode_literals
import logging
from django.contrib.auth.models import User
from django.test.client import RequestFactory
from django.utils.safestring import SafeText
from djblets.testing.decorators import add_fixtures
fro... |
aleph/tests/test_groups_api.py | Rosencrantz/aleph | 1,213 | 12680834 | <reponame>Rosencrantz/aleph
from aleph.core import db
from aleph.views.util import validate
from aleph.tests.util import TestCase
class GroupsApiTestCase(TestCase):
def setUp(self):
super(GroupsApiTestCase, self).setUp()
self.role = self.create_user(foreign_id="user_1")
self.create_group("... |
samples/12-transitionparsing/tree_parser.py | tomshafer/nn4nlp | 1,037 | 12680835 | <gh_stars>1000+
from collections import defaultdict, Counter
import codecs
import time
import random
import dynet as dy
import numpy as np
from tree import Tree
def read_dataset(filename):
return [Tree.from_sexpr(line.strip()) for line in codecs.open(filename,"r")]
def get_vocabs(trees):
label_vocab = Counte... |
tests/test_compound.py | regoawt/django-rest-framework-mongoengine | 594 | 12680857 | """ testing compound fields list and dict """
from __future__ import unicode_literals
from django.test import TestCase
from mongoengine import Document, fields
from rest_framework_mongoengine.serializers import DocumentSerializer
from .models import DumbEmbedded
from .utils import dedent
class BasicCompoundDoc(Doc... |
evkit/rl/algo/ppo_replay.py | joel99/midlevel-reps | 120 | 12680870 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import random
class PPOReplay(object):
def __init__(self,
actor_critic,
clip_param,
ppo_epoch,
num_mini_batch,
value_loss_coef,
... |
cosrlib/dataproviders/ut1_blacklist.py | commonsearch/cosr-back | 141 | 12680874 | <reponame>commonsearch/cosr-back
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import tempfile
from collections import defaultdict
import shutil
from cosrlib.config import config
from cosrlib.url import URL
from . import BaseDataProvider
class DataProvider(BaseDataProv... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.