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 |
|---|---|---|---|---|
examples/frameworks/pyramidapp.py | ashishmjn/gunicorn | 6,851 | 11046750 | from pyramid.config import Configurator
from pyramid.response import Response
def hello_world(request):
return Response('Hello world!')
def goodbye_world(request):
return Response('Goodbye world!')
config = Configurator()
config.add_view(hello_world)
config.add_view(goodbye_world, name='goodbye')
app = confi... |
alipay/aop/api/response/AlipayMarketingCampaignSelfActivityQueryResponse.py | antopen/alipay-sdk-python-all | 213 | 11046763 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.VoucherTemplate import VoucherTemplate
class AlipayMarketingCampaignSelfActivityQueryResponse(AlipayResponse):
def __init__(self):
super(AlipayMarketingC... |
problems/contains_duplicate.py | vinta/fuck-coding-interviews | 590 | 11046812 | # coding: utf-8
"""
https://leetcode.com/problems/contains-duplicate/
"""
from typing import List
class Solution:
def containsDuplicate(self, nums: List[int]) -> bool:
dedup_list = set(nums)
if nums and (len(nums) != len(dedup_list)):
return True
return False
class Solution2... |
tests/test_engine/test_update/test_update_mod_sort.py | bobuk/montydb | 478 | 11046833 | <reponame>bobuk/montydb
import pytest
from collections import OrderedDict
from pymongo.errors import WriteError as mongo_write_err
from montydb.errors import WriteError as monty_write_err
def test_update_mod_sort_1(monty_update, mongo_update):
docs = [
{"a": [10, 20, 60, 30, 10]}
]
spec = {"$pus... |
pyflux/gas/tests/gasreg_tests_skewt.py | ThomasHoppe/pyflux | 2,091 | 11046863 | import numpy as np
import pandas as pd
import pyflux as pf
# Set up some data to use for the tests
noise = np.random.normal(0,1,400)
y = np.zeros(400)
x1 = np.random.normal(0,1,400)
x2 = np.random.normal(0,1,400)
for i in range(1,len(y)):
y[i] = 0.1*y[i-1] + noise[i] + 0.1*x1[i] - 0.3*x2[i]
data = pd.DataFrame([y,... |
pydy/viz/scene.py | abhikamath/pydy | 298 | 11046908 | #!/usr/bin/env python
# standard library
from __future__ import division
import os
import sys
import warnings
import json
import distutils
import distutils.dir_util
import datetime
from collections import OrderedDict
# external
from pkg_resources import parse_version
import numpy as np
from sympy import latex
from sy... |
lstm_classifier/combined/lstm_classifier.py | undeadyequ/ser_model | 217 | 11046936 | import torch
import sys
import pickle
import numpy as np
import torch.nn as nn
from torch import optim
import torch.nn.functional as F
from utils import load_data, evaluate, plot_confusion_matrix
from config import model_config as config
class LSTMClassifier(nn.Module):
"""docstring for LSTMClassifier"""
def... |
examples/pandas_dataframe.py | shawnbrown/dbfread | 179 | 11046950 | <reponame>shawnbrown/dbfread
"""
Load content of a DBF file into a Pandas data frame.
The iter() is required because Pandas doesn't detect that the DBF
object is iterable.
"""
from dbfread import DBF
from pandas import DataFrame
dbf = DBF('files/people.dbf')
frame = DataFrame(iter(dbf))
print(frame)
|
growth-marketing-churn-analyses/more/scatter.py | DanielMabadeje/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials | 3,266 | 11046954 | __author__ = 'agibsonccc'
|
skills_ml/evaluation/representativeness_calculators/__init__.py | bhagyaramgpo/skills-ml | 147 | 11046963 | """Calculate representativeness of a dataset, such as job postings"""
|
tests/core/pyspec/eth2spec/test/merge/unittests/test_terminal_validity.py | jacobkaufmann/consensus-specs | 2,161 | 11046969 | from eth2spec.test.exceptions import BlockNotFoundException
from eth2spec.utils.ssz.ssz_typing import uint256
from eth2spec.test.helpers.fork_choice import (
prepare_empty_pow_block,
)
from eth2spec.test.context import spec_state_test, with_merge_and_later
# Copy of conditional merge part of `on_block(store: Stor... |
py2.5/processing/managers.py | geofft/multiprocess | 356 | 11046971 | <gh_stars>100-1000
#
# Module providing the `SyncManager` class for dealing
# with shared objects
#
# processing/managers.py
#
# Copyright (c) 2006-2008, <NAME> --- see COPYING.txt
#
__all__ = [ 'BaseManager', 'SyncManager', 'BaseProxy',
'CreatorMethod', 'Token' ]
#
# Imports
#
import os
... |
diagrams/aws/integration.py | analyticsftw/diagrams | 17,037 | 11046975 | # This module is automatically generated by autogen.sh. DO NOT EDIT.
from . import _AWS
class _Integration(_AWS):
_type = "integration"
_icon_dir = "resources/aws/integration"
class ApplicationIntegration(_Integration):
_icon = "application-integration.png"
class Appsync(_Integration):
_icon = "a... |
test/gspace/test_restrict_isometry.py | steven-lang/e2cnn | 356 | 11046994 | <filename>test/gspace/test_restrict_isometry.py
import unittest
from unittest import TestCase
from e2cnn.gspaces import *
import numpy as np
class TestRestrictGSpace(TestCase):
def test_restrict_rotations(self):
space = Rot2dOnR2(-1, maximum_frequency=10)
subspace, mapping,... |
jiant/tasks/lib/senteval/word_content.py | go-inoue/jiant | 1,108 | 11046995 | <filename>jiant/tasks/lib/senteval/word_content.py
from dataclasses import dataclass
from . import base as base
from jiant.tasks.lib.templates.shared import labels_to_bimap
@dataclass
class Example(base.Example):
@property
def label_to_id(self):
return SentEvalWordContentTask.LABEL_TO_ID
@dataclass
... |
sdks/python/apache_beam/ml/gcp/videointelligenceml_test.py | hengfengli/beam | 5,279 | 11047018 | <reponame>hengfengli/beam
#
# 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 ... |
lib/models/axialnet.py | csrhddlam/axial-deeplab | 383 | 11047036 | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from .utils import *
__all__ = ['axial26s', 'axial50s', 'axial50m', 'axial50l']
def conv1x1(in_planes, out_planes, stride=1):
"""1x1 convolution"""
return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=stride,... |
riptable/tests/run.py | 972d5defe3218bd62b741e6a2f11f5b3/riptable | 307 | 11047039 | # $Id$
import pytest
import sys
import os
def run_all(extra_args=None):
"""
Run all the tests of riptable.
Parameters
----------
extra_args : list
List of extra arguments (e.g. ['--verbosity=3'])
"""
if extra_args is None:
extra_args = []
pytest.main... |
qt__pyqt__pyside__pyqode/qt_image_resize__QPixmap_scaled/main.py | DazEB2/SimplePyScripts | 117 | 11047077 | <filename>qt__pyqt__pyside__pyqode/qt_image_resize__QPixmap_scaled/main.py<gh_stars>100-1000
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
app = QApplication([])
w = QWidget()
pix = QPixmap('img.png')
lay... |
pytorch/libs/nnet/activation.py | ishine/asv-subtools | 370 | 11047090 | <filename>pytorch/libs/nnet/activation.py<gh_stars>100-1000
# -*- coding:utf-8 -*-
# Copyright xmuspeech (Author: Snowdar 2019-05-29)
import numpy as np
import torch
import torch.nn.functional as F
from libs.support.utils import to_device
## Activation ✿
class Mish(torch.nn.Module):
"""A changed ReLU.
Mis... |
network/FasterRCNN.py | DesperateMaker/TrackR-CNN | 522 | 11047095 | # Cf. https://github.com/ppwwyyxx/tensorpack/blob/master/examples/FasterRCNN/train.py
# and https://github.com/ppwwyyxx/tensorpack/blob/master/examples/FasterRCNN/model.py
import tensorflow as tf
import numpy as np
from functools import partial
from datasets import DataKeys
from network.ConvolutionalLayers import Con... |
alipay/aop/api/domain/FaceExtInfo.py | antopen/alipay-sdk-python-all | 213 | 11047129 | <filename>alipay/aop/api/domain/FaceExtInfo.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class FaceExtInfo(object):
def __init__(self):
self._max_age = None
self._min_age = None
self._query_type = None
@property
... |
tool/prune/model_prune_mxnet.py | HrBbCi/MobieFace | 786 | 11047158 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import os
import argparse
import numpy as np
import mxnet as mx
parser = argparse.ArgumentParser(description='MXNet model prune')
# general
parser.add_argument('--model', default='./MobileFace_Ident... |
bakthat/utils.py | snario/bakthat | 144 | 11047165 | <filename>bakthat/utils.py
# -*- encoding: utf-8 -*-
import logging
from datetime import timedelta
import re
log = logging.getLogger(__name__)
def _timedelta_total_seconds(td):
"""Python 2.6 backward compatibility function for timedelta.total_seconds.
:type td: timedelta object
:param td: timedelta obje... |
doubleml/_utils.py | SvenKlaassen/doubleml-for-py | 103 | 11047194 | <reponame>SvenKlaassen/doubleml-for-py
import numpy as np
from sklearn.model_selection import cross_val_predict
from sklearn.base import clone
from sklearn.preprocessing import LabelEncoder
from sklearn.model_selection import KFold
from sklearn.model_selection import GridSearchCV, RandomizedSearchCV
from joblib impor... |
tests/resources/test_position.py | jwschmo/fast_arrow | 143 | 11047255 | <reponame>jwschmo/fast_arrow
from fast_arrow import StockPosition
from tests.test_util import gen_vcr, gen_client
class TestPosition(object):
def test_fetch_fields(self):
client = gen_client()
with gen_vcr().use_cassette('position_all.yaml'):
stock_positions = StockPosition.all(client... |
recipes/Python/410676_Generator_wxTreeCtrl_item/recipe-410676.py | tdiprima/code | 2,023 | 11047321 | <gh_stars>1000+
def iterchildren(treectrl, node):
cid, citem = treectrl.GetFirstChild(node)
while cid.IsOk():
yield cid
cid, citem = treectrl.GetNextChild(node, citem)
# sample usage
for i in iterchildren(myTreeControl, someNode):
print myTreeControl.GetItemText(i)
|
tests/dataset_tests/splitters_tests/test_random_splitter.py | pfnet/chainerchem | 184 | 11047347 | import numpy
import pytest
from chainer_chemistry.dataset.splitters.random_splitter import RandomSplitter
from chainer_chemistry.datasets import NumpyTupleDataset
@pytest.fixture
def dataset():
a = numpy.random.random((10, 10))
b = numpy.random.random((10, 8))
c = numpy.random.random((10, 1))
return ... |
modeling/fuzzware_modeling/__init__.py | felkal/fuzzware | 106 | 11047362 | import argparse
import yaml
from .fuzzware_utils.config import load_config_deep, update_config_file
def main():
# Do the parsing up front as importing angr takes time
parser = argparse.ArgumentParser(description="State restauration and MMIO access model identification")
parser.add_argument('statefiles', t... |
test/unit/channel/channel_event_hub_test.py | hyperledger-gerrit-archive/fabric-sdk-py | 389 | 11047371 | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... |
tests/wsgi/test_accept.py | PyCN/pulsar | 1,410 | 11047382 | import unittest
from pulsar.apps.test import test_wsgi_request
class AcceptTests(unittest.TestCase):
async def test_empty_mime(self):
request = await test_wsgi_request(headers=[('Accept', None)])
content_types = request.content_types
self.assertFalse(content_types)
async def test_co... |
azure_iot_edge/tests/e2e_utils.py | mchelen-gov/integrations-core | 663 | 11047386 | # (C) Datadog, Inc. 2020-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
from typing import Any
import requests
from datadog_checks.dev.docker import ComposeFileDown, ComposeFileUp
from datadog_checks.dev.structures import LazyFunction
from datadog_checks.dev.subprocess impor... |
eval/prf_metrics.py | swafe/DeepSegmentor | 150 | 11047519 | # Author: <NAME> <<EMAIL>>
"""
Calculate sensitivity and specificity metrics:
- Precision
- Recall
- F-score
"""
import numpy as np
from data_io import imread
def cal_prf_metrics(pred_list, gt_list, thresh_step=0.01):
final_accuracy_all = []
for thresh in np.arange(0.0, 1.0, thresh_step):
print(t... |
tests/unit/s3/test_cors_configuration.py | Yurzs/boto | 5,079 | 11047552 | <filename>tests/unit/s3/test_cors_configuration.py<gh_stars>1000+
#!/usr/bin/env python
import unittest
from boto.s3.cors import CORSConfiguration
CORS_BODY_1 = (
'<CORSConfiguration>'
'<CORSRule>'
'<AllowedMethod>PUT</AllowedMethod>'
'<AllowedMethod>POST</AllowedMethod>'
'<AllowedMethod>DELETE</A... |
algoexpert.io/python/Reverse_Linked_List.py | its-sushant/coding-interview-gym | 713 | 11047565 | # O(n) time | O(1) space
def reverseLinkedList(head):
prevN, nextN = None, None
while head is not None:
nextN = head.next
head.next = prevN
prevN = head
head = nextN
return prevN |
tests/test_text_query.py | priyanshu-kumar02/personfinder | 561 | 11047566 | # Copyright 2019 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... |
guillotina/commands/vacuum.py | rboixaderg/guillotina | 173 | 11047596 | <reponame>rboixaderg/guillotina<filename>guillotina/commands/vacuum.py
from guillotina.commands import Command
from guillotina.component import query_adapter
from guillotina.db.interfaces import IVacuumProvider
from guillotina.utils import iter_databases
import logging
logger = logging.getLogger("guillotina")
clas... |
tools/regression/xsl_reports/utils/log.py | zyiacas/boost-doc-zh | 198 | 11047619 | <reponame>zyiacas/boost-doc-zh
import inspect
import sys
def log_level():
frames = inspect.stack()
level = 0
for i in frames[ 3: ]:
if i[0].f_locals.has_key( '__log__' ):
level = level + i[0].f_locals[ '__log__' ]
return level
def stdlog( message ):
sys.stderr.write( ... |
test_sizzle.py | mindriot101/pyq | 144 | 11047641 | <reponame>mindriot101/pyq
from sizzle.selector import Selector
from sizzle.match import MatchEngine
import unittest
class TestSObjs(unittest.TestCase):
def test_type_selector(self):
sobjs = Selector.parse('class')
self.assertEqual(len(sobjs), 1)
self.assertEqual(sobjs[0].name, 'class')
... |
posts/migrations/0022_auto_20210911_0827.py | NakolenkeDevelopment/rustockholm.club | 496 | 11047648 | # Generated by Django 3.2 on 2021-09-11 08:27
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('posts', '0021_auto_20210910_1556'),
]
operations = [
migrations.RemoveField(
model_name='historicalpost',
name='is_approved_by... |
utils/proc_dict_vqa.py | zhaoyi3264/openvqa | 274 | 11047655 | <reponame>zhaoyi3264/openvqa
# --------------------------------------------------------
# mcan-vqa (Deep Modular Co-Attention Networks)
# Licensed under The MIT License [see LICENSE for details]
# Written by <NAME> https://github.com/cuiyuhao1996
# --------------------------------------------------------
import sys
sy... |
python/tvm/relay/op/contrib/contrib.py | robo-corg/incubator-tvm | 286 | 11047657 | <reponame>robo-corg/incubator-tvm<filename>python/tvm/relay/op/contrib/contrib.py<gh_stars>100-1000
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The AS... |
TrainingExtensions/tensorflow/src/python/aimet_tensorflow/keras/cross_layer_equalization.py | styler00dollar/Colab-docker-aimet | 945 | 11047660 | # /usr/bin/env python3.5
# -*- mode: python -*-
# =============================================================================
# @@-COPYRIGHT-START-@@
#
# Copyright (c) 2021, Qualcomm Innovation Center, Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification,... |
parcels/examples/example_mitgcm.py | noemieplanat/Copy-parcels-master | 202 | 11047723 | from datetime import timedelta as delta
from os import path
import numpy as np
import xarray as xr
from parcels import (
AdvectionRK4,
FieldSet,
JITParticle,
ParticleFile,
ParticleSet,
ScipyParticle,
)
ptype = {"scipy": ScipyParticle, "jit": JITParticle}
def run_mitgcm_zonally_reentrant(mode... |
plyer/platforms/ios/compass.py | EdwardCoventry/plyer | 1,184 | 11047730 | '''
iOS Compass
-----------
'''
from plyer.facades import Compass
from pyobjus import autoclass
class IosCompass(Compass):
def __init__(self):
super().__init__()
self.bridge = autoclass('bridge').alloc().init()
self.bridge.motionManager.setMagnetometerUpdateInterval_(0.1)
self.br... |
docs/examples/testing_seq.py | chevah/treq | 418 | 11047755 | <gh_stars>100-1000
from twisted.internet import defer
from twisted.trial.unittest import SynchronousTestCase
from twisted.web import http
from treq.testing import StubTreq, HasHeaders
from treq.testing import RequestSequence, StringStubbingResource
@defer.inlineCallbacks
def make_a_request(treq):
"""
Make a ... |
forsun/forsun.py | snower/forsun | 202 | 11047771 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# 15/6/10
# create by: snower
import os
import sys
import time
import logging
import traceback
import threading
from tornado.ioloop import IOLoop
from tornado import gen
from .servers.server import Server
from .plan import Plan
from . import store
from . import action
from . ... |
aiida/storage/psql_dos/migrations/versions/django_0042_prepare_schema_reset.py | mkrack/aiida-core | 153 | 11047785 | # -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... |
trains/backend_config/errors.py | doliveralg/trains | 2,097 | 11047813 | class ConfigurationError(Exception):
def __init__(self, msg, file_path=None, *args):
super(ConfigurationError, self).__init__(msg, *args)
self.file_path = file_path
|
TextGenerator/constant.py | yinhaoxs/CharacterRecognition-CRNN | 166 | 11047820 | from utils.random_tools import Random
class Const:
def __init__(self):
self.COLOR_TRANSPARENT = (0, 0, 0, 0)
self.COLOR_HALF_TRANSPARENT = (0, 0, 0, 55)
self.COLOR_RED = (255, 0, 0, 255)
self.COLOR_GREEN = (0, 255, 0, 255)
self.COLOR_BLUE = (0, 0, 255, 255)
self.CO... |
tests/test_loader_semaphore.py | dylanbuchi/MONAI | 2,971 | 11047837 | <reponame>dylanbuchi/MONAI
# Copyright 2020 - 2021 MONAI Consortium
# 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... |
tests/conftest.py | reliefs/tiktok_bot | 118 | 11047848 | import pytest
from tiktok_bot.api import TikTokAPI
@pytest.fixture()
def api():
return TikTokAPI()
|
plot.py | radgli/ML-Recon | 140 | 11047882 | import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import json
import argparse
from nbodykit.lab import *
from pmesh.pm import ParticleMesh
from matplotlib.gridspec import GridSpec
dk = 0.02
c = plt.rcParams['axes.prop_cycle'].by_key()['color']
def plot_loss(path):
loss_t... |
3rdParty/V8/v7.9.317/tools/dev/gen-tags.py | rajeev02101987/arangodb | 20,995 | 11047929 | #!/usr/bin/env python
# Copyright 2017 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""\
Convenience script for generating arch-specific ctags file.
This script MUST be executed at the top directory.
Usage:
$ tool... |
common/src/stack/command/stack/commands/sync/host/network/__init__.py | anooprajendra/stacki | 123 | 11047938 | # @copyright@
# Copyright (c) 2006 - 2019 Teradata
# All rights reserved. Stacki(r) v5.x stacki.com
# https://github.com/Teradata/stacki/blob/master/LICENSE.txt
# @copyright@
#
# @rocks@
# Copyright (c) 2000 - 2010 The Regents of the University of California
# All rights reserved. Rocks(r) v5.4 www.rocksclusters.org
# ... |
samples/openapi3/client/petstore/python-legacy/test/test_inline_object3.py | JigarJoshi/openapi-generator | 11,868 | 11047968 | # coding: utf-8
"""
OpenAPI Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
... |
osp/test/citations/jstor_record/test_article_id.py | davidmcclure/open-syllabus-project | 220 | 11047971 |
from osp.citations.jstor_record import JSTOR_Record
def test_article_id(mock_jstor):
path = mock_jstor.add_article(article_id='12345')
assert JSTOR_Record(path).article_id == '12345'
|
scaffoldgraph/prioritization/prioritization_ruleset.py | trumanw/ScaffoldGraph | 121 | 11047984 | <filename>scaffoldgraph/prioritization/prioritization_ruleset.py
"""
scaffoldgraph.prioritization.prioritization_ruleset
Implements a ruleset for scaffold prioritization when constructing scaffold trees.
"""
from .prioritization_rules import BaseScaffoldFilterRule
class ScaffoldRuleSet(object):
"""
Class de... |
notebook/for_usage.py | vhn0912/python-snippets | 174 | 11048001 | l = ['Alice', 'Bob', 'Charlie']
for name in l:
print(name)
# Alice
# Bob
# Charlie
l = ['Alice', 'Bob', 'Charlie']
for name in l:
if name == 'Bob':
print('!!BREAK!!')
break
print(name)
# Alice
# !!BREAK!!
l = ['Alice', 'Bob', 'Charlie']
for name in l:
if name == 'Bob':
print... |
tests/test_xlis_calendar.py | syonoki/exchange_calendars | 128 | 11048009 | <gh_stars>100-1000
import pytest
import pandas as pd
from exchange_calendars.exchange_calendar_xlis import XLISExchangeCalendar
from .test_exchange_calendar import EuronextCalendarTestBase
class TestXLISCalendar(EuronextCalendarTestBase):
@pytest.fixture(scope="class")
def calendar_cls(self):
yield X... |
nova/tests/unit/cmd/test_nova_api.py | zjzh/nova | 1,874 | 11048034 | <filename>nova/tests/unit/cmd/test_nova_api.py
# Copyright 2015 HPE, 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... |
docs/__init__.py | Tonow/cookiecutter | 8,822 | 11048055 | <reponame>Tonow/cookiecutter
"""Main package for docs."""
|
goose3/extractors/authors.py | martinvk1/goose-spkt | 575 | 11048089 | # -*- coding: utf-8 -*-
"""\
This is a python port of "Goose" orignialy licensed to Gravity.com
under one or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.
Python port was written by <NAME>ae
Gravity.com licenses this file... |
snippets/ch09/syngraph.py | kratunko/atap | 360 | 11048092 | <reponame>kratunko/atap
#!/usr/bin/env python3
# Creates a graph of synonyms using WordNet
import re
import networkx as nx
import matplotlib.pyplot as plt
from nltk.corpus import wordnet as wn
def graph_synsets(terms, pos=wn.NOUN, depth=2):
"""
Create a networkx graph of the given terms to the given depth.
... |
detection_of_site_changes_Unistream/main.py | DazEB2/SimplePyScripts | 117 | 11048119 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
# NOTE: костыль для винды, для исправления проблем с исключениями
# при выводе юникодных символов в консоль винды
import sys
if sys.platform == 'win32':
import codecs
# Для винды кодировкой консоли будет cp866
sys.stdout = codecs.getw... |
stores/apps/core/emailBackend.py | diassor/CollectorCity-Market-Place | 135 | 11048129 | from auth.models import User
from auth.backends import ModelBackend as BaseModelBackend
## Custom Auth backend
class ModelBackend(BaseModelBackend):
"""
Authenticates against django.contrib.auth.models.User.
"""
# TODO: Model, login attribute name and password attribute name should be
# configurabl... |
pyqtgraph/util/numba_helper.py | hishizuka/pyqtgraph | 2,762 | 11048137 | <filename>pyqtgraph/util/numba_helper.py
# -*- coding: utf-8 -*-
from warnings import warn
from .. import getConfigOption
def getNumbaFunctions():
if getConfigOption("useNumba"):
try:
import numba # noqa
except ImportError:
warn("numba library could not be loaded, but 'use... |
bench/linetest/linetest.py | gokr/spry | 368 | 11048152 | with open('lotslines') as f:
lines = f.readlines()
print "Lines: " + str(len(lines))
|
custom_components/bhyve/pybhyve/__init__.py | jdreamerz/bhyve-home-assistant | 122 | 11048154 | """Define module exports."""
from .client import Client # noqa
|
funsor/op_factory.py | fritzo/funsor | 198 | 11048156 | # Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
import inspect
import typing
from funsor import interpreter
from funsor.domains import BintType, Dependent, find_domain
from funsor.interpretations import eager
from funsor.interpreter import PatternMissingError
from funsor.tensor imp... |
py_feature/105_delta_time.py | weiziyoung/instacart | 290 | 11048190 | <reponame>weiziyoung/instacart
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 25 09:41:08 2017
@author: konodera
delta order time
"""
import pandas as pd
import numpy as np
from tqdm import tqdm
import utils
utils.start(__file__)
#=============================================================... |
main/index.py | dongan-beta/PyRetri | 1,063 | 11048221 | # -*- coding: utf-8 -*-
import argparse
import os
import pickle
from pyretri.config import get_defaults_cfg, setup_cfg
from pyretri.index import build_index_helper, feature_loader
from pyretri.evaluate import build_evaluate_helper
def parse_args():
parser = argparse.ArgumentParser(description='A tool box for d... |
py/testdir_single_jvm/test_big_sum_fail.py | gigliovale/h2o | 882 | 11048229 | <filename>py/testdir_single_jvm/test_big_sum_fail.py
import unittest, random, sys
sys.path.extend(['.','..','../..','py'])
import h2o, h2o_cmd, h2o_util, h2o_import as h2i
import h2o_exec as h2e
UNNECESSARY = False
class Basic(unittest.TestCase):
def tearDown(self):
h2o.check_sandbox_for_errors()
@cla... |
kapture/converter/openmvg/export_openmvg.py | v-mehta/kapture | 264 | 11048234 | <reponame>v-mehta/kapture
# Copyright 2020-present NAVER Corp. Under BSD 3-clause license
"""
Kapture to openmvg export functions.
"""
import json
import logging
import os
import os.path as path
from tqdm import tqdm
from typing import Dict, List, Optional, Set, Tuple, Union
import numpy as np
import quaternion
# k... |
atcoder/abc067/a.py | Ashindustry007/competitive-programming | 506 | 11048246 | <filename>atcoder/abc067/a.py
#!/usr/bin/env python3
# https://abc067.contest.atcoder.jp/tasks/abc067_a
a, b = map(int, input().split())
if a % 3 == 0 or b % 3 == 0 or (a + b) % 3 == 0: print('Possible')
else: print('Impossible')
|
consoleme/lib/templated_resources/models.py | shyovn/consoleme | 2,835 | 11048261 | from typing import List, Optional
from consoleme.lib.pydantic import BaseModel
class TemplateFile(BaseModel):
name: Optional[str]
owner: Optional[str]
include_accounts: Optional[List[str]]
exclude_accounts: Optional[List[str]]
number_of_accounts: Optional[int]
resource: str
resource_type:... |
urduhack/command/__init__.py | cinfotech94/urduhackk | 252 | 11048275 | # coding: utf8
"""
Urduhack command line application. This module enables command line functionality for urduhack.
"""
|
diagrams/k8s/network.py | Shimpei-GANGAN/diagrams | 17,037 | 11048291 | <reponame>Shimpei-GANGAN/diagrams<filename>diagrams/k8s/network.py
# This module is automatically generated by autogen.sh. DO NOT EDIT.
from . import _K8S
class _Network(_K8S):
_type = "network"
_icon_dir = "resources/k8s/network"
class Ep(_Network):
_icon = "ep.png"
class Ing(_Network):
_icon = ... |
podman/containers/__init__.py | kevinwylder/podman-py | 106 | 11048292 | """containers provides the operations against containers for a Podman service.
"""
import json
from http import HTTPStatus
import podman.errors as errors
def attach(api, name):
"""Attach to a container"""
raise NotImplementedError('Attach not implemented yet')
def changes(api, name):
"""Get files adde... |
keepercommander/plugins/pspasswd/pspasswd.py | Mkn-yskz/Commandy | 151 | 11048306 | <filename>keepercommander/plugins/pspasswd/pspasswd.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
# _ __
# | |/ /___ ___ _ __ ___ _ _ ®
# | ' </ -_) -_) '_ \/ -_) '_|
# |_|\_\___\___| .__/\___|_|
# |_|
#
# <NAME>
# Copyright 2018 Keeper Security Inc.
# Contact: <EMAIL>
#
import subprocess... |
src/sims4communitylib/classes/serialization/common_serializable.py | velocist/TS4CheatsInfo | 118 | 11048337 | """
The Sims 4 Community Library is licensed under the Creative Commons Attribution 4.0 International public license (CC BY 4.0).
https://creativecommons.org/licenses/by/4.0/
https://creativecommons.org/licenses/by/4.0/legalcode
Copyright (c) COLONOLNUTTY
"""
from typing import Union, Any, Dict
class CommonSerializa... |
running_modes/enums/running_mode_enum.py | lilleswing/Reinvent-1 | 183 | 11048340 | from dataclasses import dataclass
@dataclass(frozen=True)
class RunningModeEnum:
TRANSFER_LEARNING = "transfer_learning"
REINFORCEMENT_LEARNING = "reinforcement_learning"
SAMPLING = "sampling"
CREATE_MODEL = "create_model"
VALIDATION = "validation"
SCORING = "scoring"
CURRICULUM_LEARNING =... |
src/condor_tests/queue_itemdata_regression_test.py | sridish123/htcondor | 217 | 11048378 | <filename>src/condor_tests/queue_itemdata_regression_test.py
#!/usr/bin/python3
import htcondor
import random
import string
from operator import itemgetter
import sys
import os
from traceback import print_exc
import time
n_vars = 4
n_queues = 1
n_submits = 100
# start jobs on hold (they don't need to run to test)
ba... |
gpytorch/variational/_variational_strategy.py | jrg365/gpytorch | 188 | 11048448 | #!/usr/bin/env python3
import functools
from abc import ABC, abstractproperty
from copy import deepcopy
import torch
from .. import settings
from ..distributions import Delta, MultivariateNormal
from ..likelihoods import GaussianLikelihood
from ..models import ExactGP
from ..module import Module
from ..utils.broadca... |
.github/workflows/test.py | huangboju/Moots | 142 | 11048453 | # -*- coding: utf-8 -*-
import sys
if __name__ == '__main__':
argv = sys.argv[1:]
json = argv[0]
print(json) |
Lightwave/Lightwave_Pre_2015/LW_LayoutPasteFromExternal.py | morphingdesign/OD_CopyPasteExternal | 278 | 11048458 | #! /usr/bin/env python
# -*- Mode: Python -*-
# -*- coding: ascii -*-
__author__ = "<NAME>"
__date__ = "April 27, 2017"
__copyright__ = ""
__version__ = "1.0"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "Copies / Pastes Objects between various 3d applications"
__lwver__ = "... |
blitzdb/fields/binary.py | marcinguy/blitzdb3 | 252 | 11048465 | <filename>blitzdb/fields/binary.py
from .base import BaseField
class BinaryField(BaseField):
pass
|
bellybutton/initialization.py | sYnfo/bellybutton | 236 | 11048467 | <filename>bellybutton/initialization.py<gh_stars>100-1000
"""Initialization of new bellybutton configuration files."""
import os
INIT_TEMPLATE = '''settings:
all_files: &all_files !settings
included:
- ~+/*
excluded:
- ~+/.tox/*
allow_ignore: yes
{test_block}
default_settings: *{default_set... |
helm/dagster/schema/schema/charts/dagster/subschema/busybox.py | dbatten5/dagster | 4,606 | 11048484 | from pydantic import BaseModel # pylint: disable=no-name-in-module
from ...utils.kubernetes import ExternalImage
class Busybox(BaseModel):
image: ExternalImage
|
pymtl3/passes/backends/verilog/translation/behavioral/VBehavioralTranslatorL0.py | kevinyuan/pymtl3 | 152 | 11048518 | <reponame>kevinyuan/pymtl3
#=========================================================================
# VBehavioralTranslatorL0.py
#=========================================================================
# Author : <NAME>
# Date : March 18, 2019
"""Provide the level 0 SystemVerilog translator implementation."""
fr... |
arelle/plugin/SECCorrespondenceLoader.py | DataFinnovation/Arelle | 292 | 11048547 | # -*- coding: utf-8 -*-
'''
SECCorrespondenceLoader is a plug-in to both GUI menu and command line/web service
that loads a Correspondence tar.gz file.
(c) Copyright 2014 Mark V Systems Limited, All rights reserved.
'''
import datetime, re, os, time
from arelle import FileSource, ModelDocument
from arelle.ModelRssObj... |
src/python/fila.py | danilolmoura/Algoritmos-e-Estruturas-de-Dados | 653 | 11048551 | """ Implementação da estrutura de dados "fila" """
import random
class Queue:
def __init__(self):
self.__queue = []
def enqueue(self, value):
self.__queue.append(value)
def dequeue(self):
return self.__queue.pop(0)
def show(self):
print(f'Queue: {self.__queue}')
d... |
src/networkx/generators/tests/test_line.py | MarletteFunding/aws-kube-codesuite | 184 | 11048575 | <filename>src/networkx/generators/tests/test_line.py
import networkx as nx
from nose.tools import *
import networkx.generators.line as line
from networkx.testing.utils import *
def test_node_func():
# graph
G = nx.Graph()
G.add_edge(1, 2)
nf = line._node_func(G)
assert_equal(nf(1, 2), (1, 2))
... |
econml/tests/test_grf_cython.py | imatiach-msft/EconML | 1,846 | 11048632 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import unittest
import logging
import time
import random
import numpy as np
import sparse as sp
import pytest
from econml.tree import DepthFirstTreeBuilder, BestSplitter, Tree, MSE
from econml.grf import LinearMome... |
AutotestWebD/apps/scripts/initial/A0000_init_tb_exec_python_attrs.py | yangjourney/sosotest | 422 | 11048634 | <gh_stars>100-1000
import django
import sys,os
rootpath = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))).replace("\\","/")
# print(rootpath)
syspath=sys.path
sys.path=[]
sys.path.append(rootpath) #指定搜索路径绝对目录
sys.path.extend([rootpath+i for i in os.listdir(rootpath) if i[0]... |
Algo and DSA/LeetCode-Solutions-master/Python/minimum-flips-to-make-a-or-b-equal-to-c.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 11048643 | # Time: O(31)
# Space: O(1)
class Solution(object):
def minFlips(self, a, b, c):
"""
:type a: int
:type b: int
:type c: int
:rtype: int
"""
def number_of_1_bits(n):
result = 0
while n:
n &= n-1
result +... |
Geometry/HcalEventSetup/test/runTestHcalDDDGeometry_cfg.py | ckamtsikis/cmssw | 852 | 11048652 | <filename>Geometry/HcalEventSetup/test/runTestHcalDDDGeometry_cfg.py
import FWCore.ParameterSet.Config as cms
process = cms.Process("GeometryTest")
process.load("Geometry.CMSCommonData.hcalOnlyGeometryXML_cfi")
process.load("Geometry.HcalEventSetup.hcalTopologyIdeal_cfi")
#process.load("Configuration.StandardSequenc... |
src/oci/apigateway/models/static_public_key.py | Manny27nyc/oci-python-sdk | 249 | 11048687 | <filename>src/oci/apigateway/models/static_public_key.py
# coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown... |
data_structure/stack.py | ganeshskudva/Algorithm_Templates | 190 | 11048727 | <reponame>ganeshskudva/Algorithm_Templates
# stack common operation: push, pop, top
# stack is used in pairs, maintain extreme value
#
# FILO: First In, Last Out
# Time: O(1)
# Space: O(n)
# sequence stack based on list
def stack_operations():
# initialization
stack = []
# size of stack
size = len(s... |
cctbx/regression/tst_wilson_plot.py | dperl-sol/cctbx_project | 155 | 11048732 | <gh_stars>100-1000
from __future__ import absolute_import, division, print_function
from cctbx import statistics
from cctbx import miller
from cctbx import adptbx
from cctbx.development import random_structure
from cctbx.development import debug_utils
from cctbx.array_family import flex
from scitbx.python_utils import ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.