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 |
|---|---|---|---|---|
model/building_blocks.py | NijatZeynalov/Tacotron-2-keras | 110 | 11022337 | <filename>model/building_blocks.py
import keras.backend as K
import keras.initializers as k_init
from keras.layers import (Conv1D, Dense, Activation, MaxPooling1D, Add,
Concatenate, Bidirectional, GRU, Dropout,
BatchNormalization, Lambda, Dot, Multiply)
def get_conv... |
active_selection/ceal.py | hitman996/pytorch-deeplab-xception | 126 | 11022354 | from dataloader.paths import PathsDataset
from dataloader.indoor_scenes import IndoorScenesWithAllInfo
from utils.misc import visualize_entropy, visualize_spx_dataset
from dataloader import indoor_scenes, dataset_base
import constants
import torch
from torch.utils.data import DataLoader
from tqdm import tqdm
import num... |
api/chalicelib/core/integration_jira_cloud.py | nogamenofun98/openreplay | 3,614 | 11022380 | from chalicelib.utils import pg_client, helper
from chalicelib.core.integration_jira_cloud_issue import JIRACloudIntegrationIssue
from chalicelib.core import integration_base
PROVIDER = "JIRA"
class JIRAIntegration(integration_base.BaseIntegration):
def __init__(self, tenant_id, user_id):
self.__tenant_i... |
alphastarmini/core/sl/load_replay_info.py | liuruoze/mini-AlphaStar | 108 | 11022391 | import os
import csv
import shutil
import numpy as np
import pandas as pd
from tqdm import tqdm
from absl import app
from absl import flags
from pysc2 import run_configs
from pysc2.lib import features
from pysc2.lib import point
from s2clientprotocol import sc2api_pb2 as sc_pb
FLAGS = flags.FLAGS
... |
Python/libraries/recognizers-number/recognizers_number/number/utilities.py | AhmedLeithy/Recognizers-Text | 688 | 11022420 | <gh_stars>100-1000
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from decimal import localcontext
def precision(*args, **kwargs):
def decorator(f):
def inner_decorator(*a, **kwa):
with localcontext() as ctx:
ctx.prec = kwargs['... |
django_enumfield/db/fields.py | jackton1/django-enumfield | 164 | 11022421 | <reponame>jackton1/django-enumfield
from enum import Enum
from functools import partial
from typing import Any, Callable # noqa: F401
import six
from django import forms
from django.db import models
from django.utils.encoding import force_text
from django.utils.translation import ugettext
from django_enumfield.excep... |
python-cim/samples/dump_object.py | pombredanne/flare-wmi | 390 | 11022423 | <filename>python-cim/samples/dump_object.py<gh_stars>100-1000
#!/usr/bin/env python2
"""
extract an object buffer from a WMI repository.
author: <NAME>
email: <EMAIL>
"""
import os
import sys
import logging
import argparse
import cim
logger = logging.getLogger(__name__)
def main(argv=None):
if argv is None:... |
emukit/examples/profet/performance_assessment.py | EmuKit/Emukit | 272 | 11022428 | <reponame>EmuKit/Emukit<filename>emukit/examples/profet/performance_assessment.py<gh_stars>100-1000
import numpy as np
import scipy.stats as stats
def compute_runtime_feval(trajectory: np.ndarray, target: float) -> int:
"""
Computes the runtime in terms of number of function evaluations until a performance sm... |
mmdet/core/hook/setter_hook.py | Jack-Hu-2001/UniverseNet | 314 | 11022437 | from mmcv.runner import HOOKS, Hook
@HOOKS.register_module()
class EpochSetterHook(Hook):
"""Epoch setter hook.
This hook can be used to notify current epoch to model.
"""
def __init__(self, target_vars):
self.target_vars = target_vars
def before_epoch(self, runner):
for var in ... |
mmdet/ops/carafe/__init__.py | deepakksingh/mmdetection | 1,141 | 11022439 | from .carafe import CARAFE, CARAFENaive, CARAFEPack, carafe, carafe_naive
__all__ = ['carafe', 'carafe_naive', 'CARAFE', 'CARAFENaive', 'CARAFEPack']
|
sarpy/io/general/nitf_elements/tres/unclass/MSTGTA.py | bombaci-vsc/sarpy | 119 | 11022459 | <gh_stars>100-1000
from ..tre_elements import TREExtension, TREElement
__classification__ = "UNCLASSIFIED"
__author__ = "<NAME>"
class MSTGTAType(TREElement):
def __init__(self, value):
super(MSTGTAType, self).__init__()
self.add_field('TGTNUM', 's', 5, value)
self.add_field('TGTID', 's'... |
bumblebee_status/modules/contrib/hostname.py | rosalogia/bumblebee-status | 1,089 | 11022470 | # pylint: disable=C0111,R0903
"""Displays the system hostname.
contributed by `varkokonyi <https://github.com/varkokonyi>`_ - many thanks!
"""
import platform
import core.module
import core.widget
import core.decorators
class Module(core.module.Module):
@core.decorators.every(minutes=60)
def __init__(self... |
osf/migrations/0043_merge_20170725_1328.py | gaybro8777/osf.io | 628 | 11022474 | <filename>osf/migrations/0043_merge_20170725_1328.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-07-25 18:28
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('osf', '0042_auto_20170707_1019'),
('osf... |
backend/prod/deploy/viewfinder.py | sleepingAnt/viewfinder | 645 | 11022477 | #!/usr/bin/env python
#
# Copyright 2011 Viewfinder Inc. All Rights Reserved.
"""Deployment descriptor for the Viewfinder web server.
"""
__author__ = '<EMAIL> (<NAME>)'
# List server specifications. Each specification details:
servers = [
{ "type": "www",
"path": "backend/viewfinder/viewfinder.py",
"proce... |
cinder/volume/drivers/inspur/instorage/instorage_const.py | alexisries/openstack-cinder | 571 | 11022484 | # Copyright 2017 Inspur Corp.
# 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 ... |
awx/main/scheduler/__init__.py | Avinesh/awx | 11,396 | 11022495 | <reponame>Avinesh/awx<gh_stars>1000+
# Copyright (c) 2017 Ansible, Inc.
#
from .task_manager import TaskManager
__all__ = ['TaskManager']
|
freight/constants.py | armandomeeuwenoord/freight | 562 | 11022503 | <gh_stars>100-1000
import os
import sys
def get_python_version():
v = sys.version_info
return f"{v.major}.{v.minor}.{v.micro}"
PYTHON_VERSION = get_python_version()
PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
|
utils.py | dermatologist/image-similarity-clustering | 195 | 11022554 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 18 20:13:14 2020
@author: dougl
"""
import string
def col_num_to_alpha(n, zero_indexed=True):
''' col_num_to_alpha(28) = 'AC' '''
if zero_indexed:
n = n + 1
string = ''
while n > 0:
n, remainder = divmod(n - 1, 26)
... |
chapter6/private_variables.py | sharad16j/Expert-Python-Programming-Third-Edition | 112 | 11022576 | <reponame>sharad16j/Expert-Python-Programming-Third-Edition<filename>chapter6/private_variables.py
_observers = []
def add_observer(observer):
_observers.append(observer)
def get_observers():
"""Makes sure _observers cannot be modified."""
return tuple(_observers)
|
threadedcomments/migrations/0001_initial.py | netlandish/django-threadedcomments | 313 | 11022580 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.db import models, migrations, connection
import django.db.models.deletion
is_index = connection.vendor != 'mysql'
if 'django.contrib.comments' in settings.INSTALLED_APPS:
BASE_APP = 'comments'
else:
B... |
fuckmessage.py | jizizr/PagerMaid_Plugins | 153 | 11022599 | <reponame>jizizr/PagerMaid_Plugins
""" Module to automate sticker deletion. """
from pagermaid import log
from pagermaid.listener import listener
from pagermaid.utils import alias_command, lang
@listener(is_plugin=True, outgoing=True, command=alias_command("fuckmessage"),
description="删除最近 200 条消息中包含指定关键字的消... |
Scripts/jupyter-nbextension-script.py | pyparallel/pyparallel | 652 | 11022603 | #!C:\Users\Trent\Home\src\pyparallel\PCbuild\amd64\python.exe
# EASY-INSTALL-ENTRY-SCRIPT: 'notebook==4.0.6','console_scripts','jupyter-nbextension'
__requires__ = 'notebook==4.0.6'
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.exit(
load_entry_point('notebook==4.0.6'... |
tests/context_processors/urls.py | ni-ning/django | 61,676 | 11022621 | <reponame>ni-ning/django
from django.urls import path
from . import views
urlpatterns = [
path('request_attrs/', views.request_processor),
path('debug/', views.debug_processor),
]
|
Message.py | aswinjayaji/bunk_bot | 445 | 11022658 | import re
def getnametime(x):
matchobj = re.search("(.+)(\d?\d:\d{2}\s*[AP]M)", x)
return(matchobj.group(1), matchobj.group(2))
class Message:
def __init__(self, strings):
self.strings = []
self.strings.extend(strings)
self.name, self.time = getnametime(strings[0])
self.st... |
tests/evaluation_test.py | techthiyanes/SummerTime | 178 | 11022679 | import unittest
from typing import Tuple, List, Dict
from summertime.evaluation import SUPPORTED_EVALUATION_METRICS
from helpers import print_with_color
class TestEvaluationMetrics(unittest.TestCase):
def get_summary_pairs(self, size: int = 1) -> Tuple[List[str]]:
test_output = (
... |
statsmodels/distributions/copula/api.py | CCHiggins/statsmodels | 6,931 | 11022707 | from statsmodels.distributions.copula.copulas import (
CopulaDistribution)
from statsmodels.distributions.copula.archimedean import (
ArchimedeanCopula, FrankCopula, ClaytonCopula, GumbelCopula)
import statsmodels.distributions.copula.transforms as transforms
from statsmodels.distributions.copula.elliptical i... |
xrspatial/tests/test_local.py | g2giovanni/xarray-spatial | 547 | 11022734 | <reponame>g2giovanni/xarray-spatial
import numpy as np
import pytest
import xarray as xr
from xrspatial.local import (
cell_stats,
combine,
lesser_frequency,
equal_frequency,
greater_frequency,
lowest_position,
highest_position,
popularity,
rank,
)
arr = xr.DataArray([[2, 2, 2, 2]... |
asteroid/losses/__init__.py | ldelebec/asteroid | 722 | 11022750 | from .pit_wrapper import PITLossWrapper
from .mixit_wrapper import MixITLossWrapper
from .sinkpit_wrapper import SinkPITLossWrapper
from .sdr import PairwiseNegSDR
from .sdr import pairwise_neg_sisdr, singlesrc_neg_sisdr, multisrc_neg_sisdr
from .sdr import pairwise_neg_sdsdr, singlesrc_neg_sdsdr, multisrc_neg_sdsdr
fr... |
tests/testing_utils.py | tywmick/scikeras | 111 | 11022765 | <gh_stars>100-1000
import pickle
import re
from functools import partial
import numpy as np
import pytest
from sklearn import config_context
from sklearn.utils.estimator_checks import (
parametrize_with_checks as _parametrize_with_checks,
)
def basic_checks(estimator, loader):
"""Run basic checks (fit, sco... |
sdk/core/azure-servicemanagement-legacy/tests/test_legacy_mgmt_sqldatabase.py | rsdoherty/azure-sdk-for-python | 2,728 | 11022781 | # coding: utf-8
#-------------------------------------------------------------------------
# Copyright (c) Microsoft. 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
# ... |
tests/test_util.py | iksteen/dpf | 133 | 11022798 | <reponame>iksteen/dpf
import pwny
def test_cycle():
assert pwny.cycle(64) == 'AAAABAAACAAADAAAEAAAFAAAGAAAHAAAIAAAJAAAKAAALAAAMAAANAAAOAAAPAAA'
def test_cycle_width():
assert pwny.cycle(64, width=2) == 'AABACADAEAFAGAHAIAJAKALAMANAOAPAQARASATAUAVAWAXAYAZBBCBDBEBFBGBH'
def test_cycle_find():
assert pwn... |
lsh/minhash.py | nervecell23/LSH | 231 | 11022812 | # -*- coding: utf-8 -*-
try:
from functools import lru_cache
except ImportError:
from functools32 import lru_cache
import numpy as np
from .cMinhash import minhash_32, minhash_64
class MinHasher(object):
def __init__(self, seeds, char_ngram=8, random_state=None, hashbytes=8):
"""The MinHasher cr... |
test/__main__.py | Yuliianto/AIML-FLASK-API | 115 | 11022813 | <reponame>Yuliianto/AIML-FLASK-API
# A script to enable execution of any python unit test in this directory.
# It will be called when Python tries to 'execute' this directory
"""
Usage:
* execute all unit tests in this dir
python <dir> [options] [-a]
* execute a certain set of tests
python <dir> [o... |
sktime/classification/feature_based/__init__.py | marcio55afr/sktime | 5,349 | 11022871 | # -*- coding: utf-8 -*-
"""Feature based time series classifiers."""
__all__ = [
"Catch22Classifier",
"MatrixProfileClassifier",
"SignatureClassifier",
"TSFreshClassifier",
]
from sktime.classification.feature_based._catch22_classifier import Catch22Classifier
from sktime.classification.feature_based._... |
great_expectations/execution_engine/pandas_batch_data.py | victorcouste/great_expectations | 6,451 | 11022898 | import pandas as pd
from great_expectations.execution_engine.execution_engine import BatchData
class PandasBatchData(BatchData):
def __init__(self, execution_engine, dataframe: pd.DataFrame):
super().__init__(execution_engine=execution_engine)
self._dataframe = dataframe
@property
def da... |
sequana/cpg_islands.py | vladsaveliev/sequana | 138 | 11022911 |
def CpG(sequence, size=200):
"""
The Sequence Manipulation Suite: CpG Islands
Results for 1200 residue sequence "sample sequence" starting "taacatactt".
CpG islands search using window size of 200.
Range, value
32 to 231, the y-value is 1.75 and the %GC content is 50.5
33 to 232, the y-va... |
test/test_regression_133.py | Duiesel/python-jsonschema-objects | 329 | 11022917 | <filename>test/test_regression_133.py<gh_stars>100-1000
import python_jsonschema_objects as pjs
def test_nested_arrays_work_fine():
schema = {
"title": "Example Schema",
"type": "object",
"properties": {
"a": {"type": "array", "items": {"type": "string"}, "default": []}
... |
git_code_debt/discovery.py | boidolr/git-code-debt | 213 | 11022942 | <reponame>boidolr/git-code-debt
from types import ModuleType
from typing import Any
from typing import List
from typing import Sequence
from typing import Set
from typing import Type
from git_code_debt.metrics.base import DiffParserBase
from git_code_debt.util.discovery import discover
def is_metric_cls(cls: Type[An... |
tools/tplog.py | mxzeng/gestures | 2,151 | 11022952 | <gh_stars>1000+
#!/usr/bin/python
#
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""TPLog Manipulation"""
import getopt
import logging
import os
import simplejson as json
import sys
from opera... |
quantdsl/domain/services/price_processes.py | johnbywater/quantdsl | 269 | 11023000 | <filename>quantdsl/domain/services/price_processes.py
from quantdsl.exceptions import DslError
from quantdsl.priceprocess.base import PriceProcess
def get_price_process(price_process_name):
# Load the price process object.
assert price_process_name, "Price process name is required"
price_process_module_na... |
datapackage/__init__.py | hjoukl/datapackage-py | 183 | 11023047 | <filename>datapackage/__init__.py
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from . import config
__version__ = config.VERSION
# Module API
from .cli import cli
from .package import Packa... |
tests/test_expressions.py | lap1nou/ViperMonkey | 874 | 11023050 | """
Tests the grammars and logic in expressions.py
"""
from textwrap import dedent
import vipermonkey
from vipermonkey.core import *
import vipermonkey.core.literals
def test_paragraphs():
"""Tests references to the .Paragraphs field of the current doc."""
context = vipermonkey.Context()
context['Active... |
package/awesome_panel/application/components/gallery_page_component.py | gmatteo/awesome-panel | 179 | 11023059 | <reponame>gmatteo/awesome-panel
"""In this module we define the GalleryPageComponent"""
import panel as pn
import param
from awesome_panel.application.models import Page
from awesome_panel.application.services import PageService
from awesome_panel.application.views.gallery_page_view import GalleryPageView
cla... |
notebooks/_solutions/pandas_06_groupby_operations44.py | rprops/Python_DS-WS | 183 | 11023078 | <reponame>rprops/Python_DS-WS
#sums_decade.groupby(level='year').transform(lambda x: x / x.sum())
ratios_decade = sums_decade / sums_decade.groupby(level='year').transform('sum')
ratios_decade |
athena/models/tts_transformer.py | wgfi110/athena | 791 | 11023081 | # coding=utf-8
# Copyright (C) 2019 ATHENA AUTHORS; <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
#
# Unles... |
test.py | Md-Ferdous/EfficientDet.Pytorch | 1,682 | 11023082 | <gh_stars>1000+
import torch
from models import EfficientDet
from models.efficientnet import EfficientNet
if __name__ == '__main__':
inputs = torch.randn(5, 3, 512, 512)
# Test EfficientNet
model = EfficientNet.from_pretrained('efficientnet-b0')
inputs = torch.randn(4, 3, 512, 512)
P = model(inpu... |
env/lib/python3.6/site-packages/altair/expr/tests/test_expr.py | anthowen/duplify | 1,134 | 11023102 | <gh_stars>1000+
from __future__ import division
import operator
from ... import expr
from .. import datum
def test_unary_operations():
OP_MAP = {'-': operator.neg, '+': operator.pos}
for op, func in OP_MAP.items():
z = func(datum.xxx)
assert repr(z) == '({0}datum.xxx)'.format(op)
def test_... |
example/zk-found-2212.ryu/materials/check-fle-states.py | yuanguohuo/namazu | 458 | 11023111 | <filename>example/zk-found-2212.ryu/materials/check-fle-states.py<gh_stars>100-1000
#!/usr/bin/python
## FIXME: move these ones to the config file
HOSTS = ['192.168.42.1', '192.168.42.2', '192.168.42.3']
import telnetlib
import re
def parse_stat_str(s):
print 'Parsing %s: ' % s
d = {'mode': 'NOTPARSED', 'zxi... |
python/kserve/kserve/model_repository.py | ittus/kserve | 1,146 | 11023140 | # Copyright 2021 The KServe 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 or agreed to in wr... |
languages/python/django-oso/django_oso/middleware.py | connec/oso | 2,167 | 11023143 | <filename>languages/python/django-oso/django_oso/middleware.py
"""Middleware"""
from django.conf import settings
from django_oso.oso import reset_oso
from oso import OsoError
from .auth import request_authorized, authorize
# TODO (dhatch): Make this configurable.
# HTTP status codes that are permitted without author... |
aiohttp_session/nacl_storage.py | jelitox/aiohttp-session | 169 | 11023146 | <gh_stars>100-1000
import binascii
import json
from typing import Any, Callable, Optional
import nacl.exceptions
import nacl.secret
import nacl.utils
from aiohttp import web
from nacl.encoding import Base64Encoder
from . import AbstractStorage, Session
from .log import log
class NaClCookieStorage(AbstractStorage):
... |
addons/Sprytile-6b68d00/rx/linq/observable/min.py | trisadmeslek/V-Sekai-Blender-tools | 733 | 11023183 | from rx import Observable
from rx.internal import extensionmethod
from rx.internal.basic import identity
from rx.internal.exceptions import SequenceContainsNoElementsError
def first_only(x):
if not len(x):
raise SequenceContainsNoElementsError()
return x[0]
@extensionmethod(Observable)
def min(self... |
src/sparseml/tensorflow_v1/nn/layers.py | clementpoiret/sparseml | 922 | 11023196 | <filename>src/sparseml/tensorflow_v1/nn/layers.py
# Copyright (c) 2021 - present / Neuralmagic, 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.apa... |
LeetCode/0138_Copy_List_with_Random_Pointer.py | Achyut-sudo/PythonAlgorithms | 144 | 11023201 | """
# Definition for a Node.
class Node:
def __init__(self, x: int, next: 'Node' = None, random: 'Node' = None):
self.val = int(x)
self.next = next
self.random = random
"""
def solve(head):
d = {}
h = head
while(h):
copy = Node(h.val)
d[h] = copy
h = h.ne... |
enc_bash/bash_dec.py | shyamjangid07/Reverse-Engineering | 337 | 11023217 | # uncompyle6 version 3.7.3
# Python bytecode 2.7
# Decompiled from: Python 2.7.16 (default, Oct 10 2019, 22:02:15)
# [GCC 8.3.0]
# Embedded file name: <AsecX>
import os
from time import sleep
os.system('clear')
os.system('xdg-open https://www.youtube.com/channel/UCuPp2fYqlG7IvltINFMAOgQ')
sleep(1)
print ' ... |
furniture/env/xml_adjusting/rescale.py | KejiaChen/assembly | 364 | 11023270 | import argparse
import sys
import xml.etree.ElementTree as ET
from pyquaternion import Quaternion
def str2bool(v):
return v.lower() == "true"
def str2floatlist(v):
return [float(x) for x in v.split(",")]
def argsparser():
parser = argparse.ArgumentParser()
parser.add_argument(
"--path", t... |
tests/utils/test_functools.py | kw-0/MyGrad | 147 | 11023275 | <filename>tests/utils/test_functools.py
import mygrad as mg
from mygrad.operation_base import _NoValue
from .functools import SmartSignature
def test_init():
pargs = SmartSignature(1, None, a_kwarg=1, not_set=_NoValue)
assert (1, None) == pargs.args
assert dict(a_kwarg=1) == pargs.kwargs
def test_tenso... |
aliyun-python-sdk-slb/aliyunsdkslb/__init__.py | leafcoder/aliyun-openapi-python-sdk | 1,001 | 11023333 | <gh_stars>1000+
__version__ = '3.3.8' |
scripts/compute_pr_curve.py | wuzzh/master_thesis_code | 206 | 11023349 | <reponame>wuzzh/master_thesis_code<gh_stars>100-1000
"""
Generates precision/recall curves for the given detections and ground truth BBTXT files.
The script generates several files - a PDF plot, PNG plot and CSV files with the precision and
recall values, which were used to generate the curves.
-----------------------... |
jwt_auth/__init__.py | sundeepkumar/django-jwt-auth-master | 175 | 11023364 | <filename>jwt_auth/__init__.py
"""
django-jwt-auth library
-----------------------
Several utilities to implement JWT Authentication in Django.
:copyright: (c) 2014 by <NAME>
:license: MIT. See LICENSE for more details
"""
__title__ = 'jwt_auth'
__version__ = '0.0.2'
__author__ = '<NAME>'
__license__ = 'MIT'
__copyr... |
datar/dplyr/distinct.py | stjordanis/datar | 110 | 11023412 | <filename>datar/dplyr/distinct.py
"""Subset distinct/unique rows
See source https://github.com/tidyverse/dplyr/blob/master/R/distinct.R
"""
from typing import Any
import pandas
from pandas import DataFrame
from pipda import register_verb, register_func
from pipda.utils import CallingEnvs
from ..core.contexts import ... |
sc2reader/scripts/sc2attributes.py | HADB/sc2reader | 117 | 11023416 | <filename>sc2reader/scripts/sc2attributes.py
# -*- coding: utf-8 -*-
#
# Recursively searches for s2gs files in specified paths. Adds
# new attributes and values and allows the user to choose when
# conflicts are detected.
#
# Usage: sc2attributes PATH...
#
# Cannot be run from an egg installation because attributes.js... |
pygears/lib/sdp.py | bogdanvuk/pygears | 120 | 11023440 | <gh_stars>100-1000
from pygears import gear, module, find
from pygears.lib import dreg
from pygears.typing import Tuple, Uint
from pygears.sim import clk
TWrDin = Tuple[{'addr': Uint['w_addr'], 'data': 'w_data'}]
TRdDin = Uint['w_addr']
def sdp_wr_port_setup(module):
module.ram = {}
@gear(sim_setup=sdp_wr_port... |
rest/translation/tests/test_translation.py | mfredriksz/adaptnlp | 410 | 11023441 | <reponame>mfredriksz/adaptnlp
import os
os.environ["TRANSLATION_MODEL"] = 'Helsinki-NLP/opus-mt-en-de'
from starlette.testclient import TestClient
from app.main import app
client = TestClient(app)
def test_home():
response = client.get('/')
assert response.json() == {"message": "Welcome to AdaptNLP"}
... |
tests/datatypes/test-gDay.py | eLBati/pyxb | 123 | 11023442 | # -*- coding: utf-8 -*-
import logging
if __name__ == '__main__':
logging.basicConfig()
_log = logging.getLogger(__name__)
import pyxb
import unittest
import pyxb.binding.datatypes as xsd
class Test_gDay (unittest.TestCase):
def testBasic (self):
self.assertRaises(pyxb.SimpleTypeValueError, xsd.gDay, 0... |
lambda/cloudwatch_to_discord_test.py | jfalcou/infra | 135 | 11023481 | from cloudwatch_to_discord import parse_sns_message
EXAMPLE_TRAFFIC_EVENT = dict(
AlarmName="Traffic", AlarmDescription="A high amount of traffic: did we just get slashdotted?",
AWSAccountId="052730242331", NewStateValue="ALARM",
NewStateReason="Threshold Crossed: 3 out of the last 3 datapoints "
... |
trainmeshwarp.py | pgrady3/handobjectconsist | 103 | 11023483 | <filename>trainmeshwarp.py<gh_stars>100-1000
import argparse
from datetime import datetime
import os
import pickle
from matplotlib import pyplot as plt
import torch
from tqdm import tqdm
from libyana.exputils.argutils import save_args
from libyana.exputils.monitoring import Monitor
from libyana.modelutils import mode... |
misc/update/python/grabheaders_threaded.py | sy3kic/nZEDb | 472 | 11023500 | <filename>misc/update/python/grabheaders_threaded.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys, os, time
import threading
try:
import queue
except ImportError:
import Queue as queue
import subprocess
import string
import signal
import datetime
import lib.info as info
from lib.info import bcolors
conf... |
Joy_QA_Platform/ApiManager/operations/operation_report.py | bzc128/Joy_QA_Platform | 123 | 11023504 | <gh_stars>100-1000
import json
import os
import datetime
import time
from django.http import JsonResponse
from django.shortcuts import render_to_response, render
from django.forms.models import model_to_dict
from frame.utils.common import get_ajax_msg, dataToJson
from ApiManager.utils.file_tools import get_time_stamp... |
cup_test/cup_net_async_test.py | liu0208xuan/CUP | 900 | 11023524 | #!/bin/env python
# -*- coding: utf-8 -*
"""
@author <NAME>
@brief
@note
"""
import os
import sys
_NOW_PATH = os.path.dirname(os.path.abspath(__file__)) + '/'
sys.path.insert(0, _NOW_PATH + '../')
import cup
from cup import unittest
#from cup.unittest import CCaseExecutor
from cup.net import asyn
# from ... |
test/test_translate.py | zippotju/nematus | 572 | 11023526 | #!/usr/bin/env python3
import sys
import os
import unittest
import logging
sys.path.append(os.path.abspath('../nematus'))
from translate import main as translate
from settings import TranslationSettings
from test_utils import load_wmt16_model
level = logging.DEBUG
logging.basicConfig(level=level, format='%(levelname... |
Tests/pyc/winforms_hw.py | cwensley/ironpython2 | 1,078 | 11023535 | <filename>Tests/pyc/winforms_hw.py<gh_stars>1000+
# Licensed to the .NET Foundation under one or more agreements.
# The .NET Foundation licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information.
import clr
clr.AddReference("System.Windows.Forms")
from Syst... |
python/Goal.py | ahaque/twitch-troll-detection | 107 | 11023545 | '''
@author: <NAME>
@date: April 2014
A Goal object consists of a specific button and the strength of the goal.
That is, how important is this goal compared to other concurrent goals.
'''
from Enumerations import Button
class Goal:
# Must be of type Button
button = None
# Must be between 0 a... |
vel/api/__init__.py | galatolofederico/vel | 273 | 11023549 | <filename>vel/api/__init__.py<gh_stars>100-1000
from .callback import Callback
from .info import BatchInfo, EpochInfo, TrainingInfo
from .learner import Learner
from .model import (
Model, BackboneModel, LinearBackboneModel, SupervisedModel, RnnLinearBackboneModel, RnnModel, RnnSupervisedModel
)
from .model_factory... |
Python/Auto_Backup/Auto_Backup.py | iamakkkhil/Rotten-Scripts | 1,127 | 11023566 | """
A basic Backup script, that can sync all the files in a folder to a different folder
ultimately creating a backup of the main folder.
Uses MultiThreading for additional speed. Takes a Threshold as user input and compresses
the file bigger than threshold using gzip.
"""
import argparse
import gzip
import os
import ... |
python-modules/twisted/twisted/conch/test/test_channel.py | stormtheh4ck3r/python-for-android | 267 | 11023567 | <gh_stars>100-1000
# Copyright (C) 2007-2008 Twisted Matrix Laboratories
# See LICENSE for details
"""
Test ssh/channel.py.
"""
from twisted.conch.ssh import channel
from twisted.trial import unittest
class MockTransport(object):
"""
A mock Transport. All we use is the getPeer() and getHost() methods.
C... |
src/python/grpcio_tests/tests/health_check/_health_servicer_test.py | txl0591/grpc | 117 | 11023570 | <gh_stars>100-1000
# Copyright 2016 gRPC 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 or a... |
electronics/scripts/export_util.py | chrisdearman/splitflap | 2,138 | 11023587 | <filename>electronics/scripts/export_util.py
#!/usr/bin/env python
# Copyright 2015-2016 <NAME> and the splitflap contributors
#
# 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
#
# ... |
restrain_jit/abs_compiler/from_bc.py | thautwarm/restrain-jit | 116 | 11023602 | <filename>restrain_jit/abs_compiler/from_bc.py<gh_stars>100-1000
import types
import bytecode as bc
import typing as t
from restrain_jit.abs_compiler import instrnames as InstrNames
from restrain_jit.abs_compiler import py_apis as RT
from restrain_jit.vm import am
u_map = {
InstrNames.UNARY_POSITIVE: RT.py_pos,
... |
modoboa/limits/forms.py | HarshCasper/modoboa | 1,602 | 11023611 | <reponame>HarshCasper/modoboa
"""Custom forms."""
from django import forms
from django.utils.translation import ugettext as _
from modoboa.lib.permissions import get_object_owner
from . import utils
from .lib import allocate_resources_from_user
class ResourcePoolForm(forms.Form):
"""Dynamic form to display user... |
test/docstrings/oneline1.py | kylebarron/MagicPython | 1,482 | 11023612 | <filename>test/docstrings/oneline1.py
'''>>> print("""docstring""")'''
async
""">>> print('''docstring''')"""
await
"""\n>>> print('''docstring''')"""
await
""" >>> print('''docstring''')"""
await
""" 1 >>> print('''docstring''')"""
await
''' : punctuation.definition.string.begin.python, source.python, ... |
examples/nlp_seq/input_pipeline.py | jaehlee/flax | 2,249 | 11023637 | <filename>examples/nlp_seq/input_pipeline.py
# Copyright 2021 The Flax 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 r... |
tests/test_elastigroup.py | mschwitalla/senza | 106 | 11023665 | <filename>tests/test_elastigroup.py
import click
import pytest
import responses
from mock import MagicMock
from senza.spotinst import MissingSpotinstAccount
from senza.components.elastigroup import (component_elastigroup, ELASTIGROUP_DEFAULT_PRODUCT,
ELASTIGROUP_DEFAULT_STRATE... |
CircuitPython_Star_Gazer/code.py | gamblor21/Adafruit_Learning_System_Guides | 665 | 11023683 | <filename>CircuitPython_Star_Gazer/code.py
"""
This example will access an API, grab a number like hackaday skulls, github
stars, price of bitcoin, twitter followers... if you can find something that
spits out JSON data, we can display it!
"""
import gc
import time
import board
import busio
from digitalio import Digita... |
env/Lib/site-packages/OpenGL/GLES1/QCOM/driver_control.py | 5gconnectedbike/Navio2 | 210 | 11023697 | '''OpenGL extension QCOM.driver_control
This module customises the behaviour of the
OpenGL.raw.GLES1.QCOM.driver_control to provide a more
Python-friendly API
Overview (from the spec)
This extension exposes special control features in a driver to a
developer. A use of these controls would be to override state o... |
benchmarks/tensorexpr/tensor_engine.py | Hacky-DH/pytorch | 60,067 | 11023698 | tensor_engine = None
def unsupported(func):
def wrapper(self):
return func(self)
wrapper.is_supported = False
return wrapper
def is_supported(method):
if hasattr(method, "is_supported"):
return method.is_supported
return True
def set_engine_mode(mode):
global tensor_engine... |
genomics/no-more-business-as-usual/4-Variation/ftp.py | OlegZharkov/SARS-CoV-2 | 132 | 11023711 | <reponame>OlegZharkov/SARS-CoV-2
#!/usr/bin/python
import os, sys
wget_str = open('wget.sh', 'w+')
md5sum_file = open('md5sum.sh', 'w+')
for line in open("illumina_2020-06-08.txt"):
line = line.strip()
for l in open("current_metadata_ena.tsv"):
if line in l:
cols = l.split('\t')
... |
modules/image/classification/shufflenet_v2_imagenet/module.py | chunzhang-hub/PaddleHub | 8,360 | 11023769 | # copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
DeploymentCloud/Deployment.Common/scripts/msiserver.py | itshawi/data-accelerator | 185 | 11023786 | <gh_stars>100-1000
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
#!/usr/bin/env python
import adal
import json
import SocketServer
from urlparse import urlparse
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
import hdinsight_common.ClusterManifestParser ... |
tools/gen_mapping.py | dekoder/misp-galaxy | 361 | 11023803 | <reponame>dekoder/misp-galaxy<gh_stars>100-1000
#!/usr/bin/env python3
'''
Author: <NAME>
License: AGPL v3
This builds an automatic mapping between the galaxy clusters of the same type.
The mapping is made by using the synonyms documented in each cluster.
The output is saved in the cluster files themselves, if a chan... |
transformer/transformer/decoder.py | chainer/models | 112 | 11023852 | <filename>transformer/transformer/decoder.py
import chainer.functions as F
import chainer.links as L
from chainer import Chain
from .utils import SublayerConnection
class Decoder(Chain):
"""
Base building block for the decoder that holds the number of decoder layers
"""
def __init__(self, subla... |
endpoints/v2/catalog.py | ibazulic/quay | 2,027 | 11023865 | from collections import namedtuple
from flask import jsonify
import features
from app import model_cache
from auth.auth_context import get_authenticated_user, get_authenticated_context
from auth.registry_jwt_auth import process_registry_jwt_auth
from data import model
from data.cache import cache_key
from endpoints.... |
test/IECoreScene/MeshMergeOpTest.py | bradleyhenke/cortex | 386 | 11023883 | ##########################################################################
#
# Copyright (c) 2008-2011, Image Engine Design 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:
#
# * Redis... |
build_all.py | codyd51/axle | 453 | 11023897 | #!/usr/local/bin/python3
from pathlib import Path
from build_kernel_headers import copy_kernel_headers
from build_programs import build_all_programs
from build_utils import run_and_check
def main():
parent_folder = Path(__file__).parent
# run_and_check(['bash', 'build-newlib.sh'], cwd=parent_folder)
cop... |
spafe/utils/levinsondr.py | SuperKogito/cautious-palm-tree | 205 | 11023907 | <filename>spafe/utils/levinsondr.py
"""
- Levinson module
- Original author: <NAME>, 2011
"""
import numpy
__all__ = ["LEVINSON", "rlevinson"]
def LEVINSON(r, order=None, allow_singularity=False):
"""
Levinson-Durbin recursion.
Find the coefficients of a length(r)-1 order autoregressive linear process
... |
CVE-2017-12860/CVE-2017-12860.py | devhug/CVEs | 489 | 11023910 | <gh_stars>100-1000
import binascii
import socket
def makepacket(number):
numberstring = str(number)
while len(numberstring) < 4:
numberstring = "0" + numberstring
passcode = binascii.hexlify(numberstring.encode()).decode()
packet = "45454d5030313030455bc678040000004a0000000100000000... |
tests/templates/test_subroutines/test_all_singles_doubles.py | MoritzWillmann/pennylane | 539 | 11023918 | <gh_stars>100-1000
# Copyright 2018-2021 Xanadu Quantum Technologies 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 b... |
assistive_gym/envs/human_testing.py | chstetco/assistive-gym | 216 | 11023943 | <filename>assistive_gym/envs/human_testing.py
import os
from gym import spaces
import numpy as np
import pybullet as p
from .env import AssistiveEnv
from .agents import human
from .agents.human import Human
human_controllable_joint_indices = human.right_arm_joints + human.left_arm_joints
class HumanTestingEnv(Assisti... |
unicorn/tests/regress/init.py | clayne/unicorn_pe | 491 | 11023948 | <reponame>clayne/unicorn_pe<gh_stars>100-1000
#!/usr/bin/python
# By <NAME>
from unicorn import *
from unicorn.x86_const import *
import regress, struct
mu = 0
class Init(regress.RegressTest):
def init_unicorn(self, ip, sp, counter):
global mu
#print "[+] Emulating IP: %x SP: %x - Counter: %x" ... |
third_party/libfbx/build_defs.bzl | dherbst/lullaby | 1,198 | 11023969 | <filename>third_party/libfbx/build_defs.bzl
"""Contents of libfbx BUILD file used by local_repository_env rule."""
FBX_BUILD_FILE_CONTENTS = """
package(
default_visibility = ["//visibility:public"],
)
cc_library(
name = "libfbx",
srcs = select({
"@bazel_tools//src/conditions:darwin": [
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.