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 |
|---|---|---|---|---|
SoftLayer/CLI/virt/create.py | dvzrv/softlayer-python | 126 | 11156875 | <filename>SoftLayer/CLI/virt/create.py
"""Manage, delete, order compute instances."""
# :license: MIT, see LICENSE for more details.
import click
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import exceptions
from SoftLayer.CLI import formatting
from SoftLayer.CLI import helpers
from Soft... |
modules/src/fact.py | rampreeth/JARVIS-on-Messenger | 1,465 | 11156880 | <filename>modules/src/fact.py
import json
from random import choice
import config
import modules
from templates.quick_replies import add_quick_reply
from templates.text import TextTemplate
def process(input, entities=None):
output = {}
try:
with open(config.FACTS_SOURCE_FILE) as facts_file:
... |
sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_favorites_operations.py | moovy2/azure-sdk-for-python | 2,728 | 11156881 | <gh_stars>1000+
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator... |
nova/tests/functional/test_servers_resource_request.py | zjzh/nova | 1,874 | 11156893 | # 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 to in... |
homeassistant/components/blockchain/__init__.py | domwillcode/home-assistant | 30,023 | 11156903 | <reponame>domwillcode/home-assistant<gh_stars>1000+
"""The blockchain component."""
|
typer-cli-python/source_code_step_3/rptodo/database.py | syberflea/materials | 3,682 | 11156910 | <reponame>syberflea/materials<gh_stars>1000+
"""This module provides the RP To-Do database functionality."""
import configparser
from pathlib import Path
from rptodo import DB_WRITE_ERROR, SUCCESS
DEFAULT_DB_FILE_PATH = Path.home().joinpath(
"." + Path.home().stem + "_todo.json"
)
def get_database_path(config_... |
tools/system_design/xmlparser/domain.py | roboterclubaachen/xpcc | 161 | 11156925 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from . import utils
from . import xml_utils
from .parser_exception import ParserException
class Domain:
""" Representation of a domain ids.
Attributes:
name -- Name of the domain
description -- Description string
id -- ID of the domains
"""
def __init__(s... |
DEQ-Sequence/models/deq_transformer.py | ashwinipokle/deq | 548 | 11156945 | <reponame>ashwinipokle/deq<gh_stars>100-1000
import torch
import torch.nn.functional as F
import torch.nn as nn
import torch.autograd as autograd
import sys
import copy
import numpy as np
from termcolor import colored
import os
sys.path.append('../../')
from lib.optimizations import weight_norm, VariationalDropout, V... |
assemble.py | mit-han-lab/gan-compression | 1,005 | 11156951 | import argparse
import copy
import os
import torch
from models import networks
from utils.util import load_network
def create_opt(old_opt, role):
assert role in ['A', 'B']
new_opt = copy.deepcopy(old_opt)
new_opt.ngf = getattr(old_opt, 'ngf_%s' % role)
new_opt.no_style_encoder = getattr(old_opt, 'no... |
bertkpe/generator/generator_utils.py | kariswr/Multilingual-BERT-KPE | 274 | 11156958 | <reponame>kariswr/Multilingual-BERT-KPE
import re
import string
import unicodedata
from nltk.stem.porter import PorterStemmer
stemmer = PorterStemmer()
def normalize_answer(s):
def remove_articles(text):
return re.sub(r'\b(a|an|the)\b', ' ', text)
def white_space_fix(text):
return ' '.join(te... |
lib/tool_shed/util/repository_content_util.py | rikeshi/galaxy | 1,085 | 11156962 | <filename>lib/tool_shed/util/repository_content_util.py
import os
import shutil
import tool_shed.repository_types.util as rt_util
from tool_shed.util import (
commit_util,
xml_util,
)
def upload_tar(trans, rdah, tdah, repository, tar, uploaded_file, upload_point, remove_repo_files_not_in_tar,
... |
workshop_material/011_global_optimization.py | nrupatunga/pyimageconf2018 | 106 | 11156978 |
# So what about those magic parameters? How did I determine them?
# Well, I used a hyperparameter optimizer!
#
# This example introduces the optimizer I used and we will talk about how it works in some detail.
import dlib
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
from matplotlib im... |
teaminterface/support_console.py | aprilsanchez/ictf-framework | 110 | 11156979 | <gh_stars>100-1000
import requests
from clint.textui import prompt, puts, colored, validators, columns
from config import config
import sys
univ_name_id=0
univ_url_id=1
prof_name_id=2
prof_email_id=3
prof_url_id=4
def _db_api_post_authenticated(endpoint, args):
try:
ret = requests.post(config['DB_API_URL... |
tests/toolz_test.py | tommy-mor/pyrsistent | 1,613 | 11156990 | <reponame>tommy-mor/pyrsistent<filename>tests/toolz_test.py
from pyrsistent import get_in, m, v
def test_get_in():
# This is not an extensive test. The doctest covers that fairly good though.
get_in(m(a=v(1, 2, 3)), ['m', 1]) == 2
|
muddery/server/database/worlddata/game_settings.py | dongwudanci/muddery | 127 | 11157017 | <reponame>dongwudanci/muddery<filename>muddery/server/database/worlddata/game_settings.py
"""
Query and deal common tables.
"""
from muddery.server.database.worlddata.base_query import BaseQuery
from muddery.server.database.worlddata.worlddata import WorldData
class GameSettings(BaseQuery):
"""
Game setting ... |
Algo and DSA/LeetCode-Solutions-master/Python/maximum-genetic-difference-query.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 11157036 | <reponame>Sourav692/FAANG-Interview-Preparation
# Time: O(nlogk + mlogk), k is max(max(vals), n-1)
# Space: O(n + logk)
import collections
class Trie(object):
def __init__(self, bit_count):
self.__root = {}
self.__bit_count = bit_count
def insert(self, num, v):
node = self._... |
controle_estoque/Crud/CrudCompra.py | jucimar1/controleEstoque | 134 | 11157038 | # -*- coding: utf-8 -*-
from datetime import date
from sqlalchemy.exc import IntegrityError
from sqlalchemy import desc
from sqlalchemy import case
from Crud.core import Conexao
from Crud.Models import Compra, Fornecedor, StatusEntrega, StatusPagamento, CatAPagar
class CrudCompra(object):
def __init__(self,... |
tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/loaders/pickle_loader.py | TolyaTalamanov/open_model_zoo | 2,201 | 11157050 | <reponame>TolyaTalamanov/open_model_zoo<filename>tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/loaders/pickle_loader.py<gh_stars>1000+
"""
Copyright (c) 2018-2022 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the ... |
crawler/gather/pipelines/harddisk.py | shifei123/test | 283 | 11157052 | <reponame>shifei123/test
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
from datetime import datetime
from ..items import OnceItem
import csv
class HardDiskPipeline(object... |
code/default/gae_proxy/server/lib/google/appengine/api/capabilities/__init__.py | wuyongwen/XX-Net | 1,463 | 11157059 | #!/usr/bin/env python
#
# Copyright 2007 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 o... |
tests/unit/cfngin/lookups/handlers/test_dynamodb.py | avosper-intellaegis/runway | 134 | 11157074 | <filename>tests/unit/cfngin/lookups/handlers/test_dynamodb.py
"""Tests for runway.cfngin.lookups.handlers.dynamodb."""
# pylint: disable=no-self-use
# pyright: basic
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Dict
import pytest
from runway.cfngin.lookups.handlers.dynamodb import Dynamo... |
pinax/blog/__init__.py | shadytradesman/pinax-blog | 315 | 11157081 | import pkg_resources
__version__ = pkg_resources.get_distribution("pinax-blog").version
default_app_config = "pinax.blog.apps.AppConfig"
|
pypeit/scripts/scriptbase.py | ykwang1/PypeIt | 107 | 11157084 | <reponame>ykwang1/PypeIt<gh_stars>100-1000
"""
Implements base classes for use with ``PypeIt`` scripts.
.. include common links, assuming primary doc root is up one directory
.. include:: ../include/links.rst
"""
import argparse
import textwrap
from functools import reduce
class SmartFormatter(argparse.HelpFormatter... |
pycalphad/tests/test_database.py | HUISUN24/pycalphad | 162 | 11157148 | """
The test_database module contains tests for the Database object.
"""
from io import StringIO
import pytest
import hashlib
import os
from copy import deepcopy
from pyparsing import ParseException
from sympy import Symbol, Piecewise, And
from pycalphad import Database, Model, variables as v
from pycalphad.variables i... |
mindsdb/api/mysql/mysql_proxy/datahub/information_schema.py | mindsdb/main | 261 | 11157163 | from functools import partial
import pandas as pd
from mindsdb.api.mysql.mysql_proxy.utilities.sql import query_df
from mindsdb.api.mysql.mysql_proxy.classes.sql_query import get_all_tables
from mindsdb.api.mysql.mysql_proxy.datahub.datanodes.datanode import DataNode
from mindsdb.api.mysql.mysql_proxy.datahub.datanod... |
webs/douban/parsers/movie_photo.py | billvsme/videoSpider | 216 | 11157185 | <filename>webs/douban/parsers/movie_photo.py
# -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
def start_parser(text):
data = {}
s = BeautifulSoup(text, "lxml")
photo_category_nodes = s.select('#content .article .mod')
for photo_category_node in photo_category_nodes:
photo_category_name =... |
src/web/reactionforms/heroku-restart-all-dynos/__init__.py | anderson-attilio/runbook | 155 | 11157195 | ######################################################################
# Cloud Routes Web Application
# -------------------------------------------------------------------
# Reaction - Forms Class
######################################################################
from wtforms import Form
from wtforms import TextFi... |
lib/hachoir/field/fake_array.py | 0x20Man/Watcher3 | 320 | 11157198 | <gh_stars>100-1000
import itertools
from hachoir.field import MissingField
class FakeArray:
"""
Simulate an array for GenericFieldSet.array(): fielset.array("item")[0] is
equivalent to fielset.array("item[0]").
It's possible to iterate over the items using::
for element in fieldset.array("it... |
alipay/aop/api/domain/ParamExtInfo.py | antopen/alipay-sdk-python-all | 213 | 11157208 | <filename>alipay/aop/api/domain/ParamExtInfo.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class ParamExtInfo(object):
def __init__(self):
self._param_name = None
self._param_value = None
self._type = None
@property... |
python/ray/serve/exceptions.py | firebolt55439/ray | 21,382 | 11157218 | <reponame>firebolt55439/ray<gh_stars>1000+
class RayServeException(Exception):
pass
|
zhihu/zhihu/cookie.py | jsbxyyx/ZhihuSpider | 183 | 11157222 | #encoding=utf8
import pdb
import os
import time
import json
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
import logging
from .yumdama import identify
# ------------------------------------------
# 版本:1.0
# 日期:2017-8-06
# 作者:AlexTan
# <CSDN: htt... |
locations/spiders/boots_no.py | davidchiles/alltheplaces | 297 | 11157237 | <filename>locations/spiders/boots_no.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
import re
import urllib.parse
import scrapy
from locations.items import GeojsonPointItem
class BootsNOSpider(scrapy.Spider):
name = "boots_no"
item_attributes = {'brand': 'Boots'}
allowed_domains = ['apotek.boots.no', 'zpi... |
tests/repo_test.py | gaganchhabra/appkernel | 156 | 11157292 | <gh_stars>100-1000
import json
from pymongo.errors import WriteError
import time
from appkernel.model import CustomProperty
from .utils import *
from appkernel.configuration import config
from pymongo import MongoClient
import pytest
from datetime import timedelta, date
def setup_module(module):
config.mongo_dat... |
src/py-opentimelineio/opentimelineio/schema/serializable_collection.py | desruie/OpenTimelineIO | 1,021 | 11157296 | <reponame>desruie/OpenTimelineIO
from .. core._core_utils import add_method
from .. import _otio
@add_method(_otio.SerializableCollection)
def __str__(self):
return "SerializableCollection({}, {}, {})".format(
str(self.name),
str(list(self)),
str(self.metadata)
)
@add_method(_otio.Se... |
leetcode.com/python/60_Permutation_Sequence.py | its-sushant/coding-interview-gym | 713 | 11157312 | class Solution(object):
def getPermutation(self, n, k):
"""
:type n: int
:type k: int
:rtype: str
"""
factorial = {1: 1, 2: 2, 3: 6, 4: 24, 5: 120, 6: 720, 7: (5040), 8: (40320), 9: (362880)}
digits = [str(x) for x in range(1, n + 1)]
number = []
... |
tutorials/sklearn/hpsearch/source/worker.py | Meghanath-Data/ml-on-gcp | 465 | 11157357 | <gh_stars>100-1000
# Copyright 2017, Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... |
detection_of_site_changes_Unistream/show_last_diff.py | DazEB2/SimplePyScripts | 117 | 11157368 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
"""Скрипт находит последние две ревизии, сохраняет их текст в файлы и сравнивает с помощью kdiff3."""
if __name__ == '__main__':
from main import session, TextRevision
# TODO: нет смысла запрашивать все, если нужны только 2 последнии
... |
applications/classification/ner_tagging/app/src/model.py | evinaybit/100-Days-of-NLP | 239 | 11157381 | import torch
import torch.nn as nn
class CharBiLSTMCRF(nn.Module):
def __init__(self, vocab_size, emb_dim, hid_dim, char_emb_dim, char_hid_dim, char_vocab_size, tag_vocab_size, sent_pad_token, tag_start_token, dropout=0.3):
super().__init__()
self.hid_dim = hid_dim
self.sent_pad_token = se... |
pdpipe/df/df_transformer.py | yarkhinephyo/pdpipe | 438 | 11157389 | """Handles for all pandas.DataFrame dataframe-outputing transformations."""
from typing import List, Dict
from pandas import DataFrame
from ..core import PdPipelineStage
# === DataFrame methods ===
class _DataFrameMethodTransformer(PdPipelineStage):
def __init__(
self,
method_name: str,
... |
tests/test_bayesiannetwork.py | quantumblacklabs/causalnex | 1,523 | 11157403 | # Copyright 2019-2020 QuantumBlack Visual Analytics Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# THE SOFTWARE IS PROVIDED "AS IS"... |
sdk/python/pulumi_gcp/storage/hmac_key.py | la3mmchen/pulumi-gcp | 121 | 11157409 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... |
geonotebook/layers.py | irina694/earth-science-notebook | 1,076 | 11157465 | from collections import namedtuple
from collections import OrderedDict
import sys
import six
from . import annotations
from .config import Config
from .vis.utils import discrete_colors, RasterStyleOptions, \
rgba2hex, VectorStyleOptions
BBox = namedtuple('BBox', ['ulx', 'uly', 'lrx', 'lry'])
class Geonoteboo... |
postprocessing/visualization/tools/neu2vtk.py | fabian-kutschera/SeisSol | 165 | 11157515 | #!/usr/bin/env python
##
# @file
# This file is part of SeisSol.
#
# @author <NAME> (driel AT geophysik.uni-muenchen.de, http://www.geophysik.lmu.de/Members/driel)
#
# @section LICENSE
# Copyright (c) SeisSol Group
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without... |
deep-rl/lib/python2.7/site-packages/OpenGL/raw/WGL/I3D/swap_frame_lock.py | ShujaKhalid/deep-rl | 210 | 11157523 | '''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.WGL import _types as _cs
# End users want this...
from OpenGL.raw.WGL._types import *
from OpenGL.raw.WGL import _errors
from OpenGL.constant import Constant as _C
import ctype... |
python/lbann/onnx/tests/lbann2onnx_test.py | jonesholger/lbann | 194 | 11157545 | """
A test suite to check whether lbann.onnx can convert typical LBANN networks to ONNX networks correctly.
For each test case, this script
1. converts a given LBANN network into an ONNX network, and
2. adds dummy (zero) parameters to the converted network (if ADD_DUMMY_PARAMS is set),
3. saves the network to DUMP_DIR... |
maya/Tests/connectNamespace_test.py | narumiruna/alembic | 921 | 11157555 | <filename>maya/Tests/connectNamespace_test.py
##-*****************************************************************************
##
## Copyright (c) 2013,
## <NAME>, Inc. and
## Industrial Light & Magic, a division of Lucasfilm Entertainment Company Ltd.
##
## All rights reserved.
##
## Redistribution and use in source... |
fhir/resources/tests/test_questionnaire.py | cstoltze/fhir.resources | 144 | 11157564 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
Profile: http://hl7.org/fhir/StructureDefinition/Questionnaire
Release: R4
Version: 4.0.1
Build ID: 9346c8cc45
Last updated: 2019-11-01T09:29:23.356+11:00
"""
from pydantic.validators import bytes_validator # noqa: F401
from .. import fhirtypes # noqa: F401
from .. impo... |
extensions/print_page.py | FeliciaXmL/ipython_extensions | 333 | 11157587 | """Disable the IPython notebook pager
turn paged output into print statements
"""
from __future__ import print_function
from IPython.core import page
_save_page = None
def load_ipython_extension(ip):
global _save_page
if not hasattr(ip, 'kernel'):
# not in a kernel, nothing to do
return
... |
configs/det/_base_/models/faster_rcnn_central_mnb15_fpn_intern.py | OpenGVLab/gv-benchmark | 106 | 11157596 | <filename>configs/det/_base_/models/faster_rcnn_central_mnb15_fpn_intern.py
_base_ = ['./faster_rcnn_r50_fpn.py']
model = dict(
type='FasterRCNN',
backbone=dict(type='Central_Model',
backbone_name='MTB15',
task_names=('gv_patch', 'gv_global'),
main_task_nam... |
nngen/scheduler.py | RyusukeYamano/nngen | 207 | 11157608 | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from collections import defaultdict
import inspect
from . import basic_types as bt
class _Scheduler(object):
""" ASAP scheduler """
def __init__(self):
self.current_stage = 0
self.re... |
tests/core/test_urlencode.py | detritus3872/kartothek | 171 | 11157610 | <reponame>detritus3872/kartothek<filename>tests/core/test_urlencode.py
# -*- coding: utf-8 -*-
from urllib.parse import quote as quote_python
from kartothek.core.urlencode import quote as quote_ktk
from kartothek.core.urlencode import unquote as unquote_ktk
TEST_STRING = "Test string with lots of special characters ... |
modules/image/instance_segmentation/solov2/data_feed.py | chunzhang-hub/PaddleHub | 8,360 | 11157632 | <gh_stars>1000+
import os
import base64
import cv2
import numpy as np
from PIL import Image, ImageDraw
import paddle.fluid as fluid
def create_inputs(im, im_info):
"""generate input for different model type
Args:
im (np.ndarray): image (np.ndarray)
im_info (dict): info of image
Returns:
... |
graphgym/custom_graphgym/encoder/example.py | NucciTheBoss/pytorch_geometric | 2,350 | 11157634 | import torch
from ogb.utils.features import get_bond_feature_dims
from torch_geometric.graphgym.register import (
register_edge_encoder,
register_node_encoder,
)
@register_node_encoder('example')
class ExampleNodeEncoder(torch.nn.Module):
"""
Provides an encoder for integer node features
... |
climetlab/readers/numpy.py | emadehsan/climetlab | 182 | 11157636 | <reponame>emadehsan/climetlab
# (C) Copyright 2020 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its... |
snippets/models.py | hit9/skylark | 114 | 11157670 | <filename>snippets/models.py<gh_stars>100-1000
import MySQLdb
from skylark import Database, Model, Field, PrimaryKey, ForeignKey
class User(Model):
name = Field()
email = Field()
class Post(Model):
name = Field()
post_id = PrimaryKey()
user_id = ForeignKey(User.id)
Database.set_dbapi(MySQLdb)
D... |
camel_tools/dialectid/__init__.py | CAMeL-Lab/camel_tools | 211 | 11157671 | # -*- coding: utf-8 -*-
# MIT License
#
# Copyright 2018-2021 New York University <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation t... |
tests/test_component_and_injector_params.py | TinkerBoard-Android/external-google-fruit | 1,666 | 11157678 | #!/usr/bin/env python3
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... |
pfr-solution/code/predict.py | Hulihrach/RoadDetector | 180 | 11157708 | <filename>pfr-solution/code/predict.py
import torch
from torch.autograd import Variable
import numpy as np
from torchvision import transforms
import os
from tqdm import tqdm
import yaml
from PIL import Image
import itertools
import rd
from PIL import PILLOW_VERSION; assert PILLOW_VERSION=="4.3.0.post0"
n_gpu = 1
de... |
tests/mocks/pycopy-cpython_core/ulogging.py | BradenM/micropython-stubber | 126 | 11157715 | from logging import *
|
tests/checkpoint/test_partitionedPS_saver.py | Ezra-H/autodist | 127 | 11157739 | import atexit
import os
import time
import tensorflow as tf
import numpy as np
from multiprocessing import Process
from tensorflow.core.protobuf import config_pb2
from autodist import AutoDist
from autodist.checkpoint.saver import Saver as autodist_saver
from autodist.strategy import PartitionedPS
vocab_size = 1000... |
applications/SwimmingDEMApplication/tests/tests_python_scripts/candelier_scripts/nodal_history_analyser.py | lkusch/Kratos | 778 | 11157760 | <gh_stars>100-1000
import matplotlib.pyplot as plt
import math
def ExtractVariableHistory(file_path, var_name, results):
with open(file_path, mode = 'r') as f:
indices = None
first_line_already_read = False
for line in f:
if first_line_already_read:
... |
python_toolbox/cute_profile/__init__.py | hboshnak/python_toolbox | 119 | 11157791 | # Copyright 2009-2017 <NAME>.
# This program is distributed under the MIT license.
'''
Defines `profile_ready`, a decorator for flexibly profiling a function..
See its documentation for more details.
'''
from . import base_profile
from .cute_profile import profile_ready |
demo/track_players.py | ausport/soccerontable | 465 | 11157805 | import numpy as np
import soccer3d
from soccer3d.tracking import Detection, find_tracks, smooth_trajectory, convert_to_MOT
from os.path import join
import utils.camera as cam_utils
import utils.misc as misc_utils
import json
import argparse
from tqdm import tqdm
import glog
import matplotlib.pyplot as plt
parser = ar... |
util/stages.py | juandesant/astrometry.net | 460 | 11157817 | # This file is part of the Astrometry.net suite.
# Licensed under a 3-clause BSD style license - see LICENSE
from __future__ import print_function
import os
from astrometry.util.file import *
'''
Stages: a utility for saving and resuming computation, savings
intermediate results as pickle files.
'''
class CallGlob... |
prog1/implementacoes/uri/1013.py | gabrielmbs/Tamburetei | 209 | 11157835 | <reponame>gabrielmbs/Tamburetei
v = input().split()
a, b, c = v
m = (int(a) + int(b) + abs(int(a) - int(b)))/2
maior = (int(m) + int(c) + abs(int(m) - int(c)))/2
print(int(maior), 'eh o maior')
|
tests/debugpy/test_exception.py | r3m0t/debugpy | 695 | 11157839 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in the project root
# for license information.
from __future__ import absolute_import, division, print_function, unicode_literals
import pytest
import sys
from tests import debug
from tests.debug import runners,... |
datasets/smokers/testexpt.py | saraswat/TensorLog | 108 | 11157872 | <reponame>saraswat/TensorLog
import unittest
import tfexpt
import expt
class TestTimeNative(unittest.TestCase):
def testIt(self):
time = expt.runMain()
self.assertTrue(time <= 0.1)
class TestTimeTF(unittest.TestCase):
def testIt(self):
time = tfexpt.runMain()
self.assertTrue(time < 0.5)
if __na... |
apps/monitor/views/prometheus_redis.py | Paul3MK/NewsBlur | 3,073 | 11157876 | <gh_stars>1000+
import os
import socket
from django.views import View
from django.shortcuts import render
"""
RedisActiveConnections
RedisCommands
RedisConnects
RedisUsedMemory
RedisSize
"""
class RedisGrafanaMetric(View):
category = "Redis"
def autoconf(self):
try:
self.get_info()
... |
tests/macro/scripts/MPI/np_Sendrecv.py | dina-fouad/pyccel | 206 | 11157877 | # pylint: disable=missing-function-docstring, missing-module-docstring/
from mpi4py import MPI
if __name__ == '__main__':
rank = -1
#we must initialize rank
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
if rank == 0:
partner = 1
if rank == 1:
partner = 0
msg = rank + 1000
... |
share/schema/schema_check.py | vb-wayne/paragraph | 111 | 11157900 | <reponame>vb-wayne/paragraph<gh_stars>100-1000
#! /usr/bin/env python
from __future__ import print_function
import os
import json
import jsonschema
base_dir = os.path.abspath(os.path.join(__file__, '..', '..', '..'))
schema_dir = os.path.join(base_dir, 'share', 'schema')
paragraph_dir = os.path.join(base_dir, 'data',... |
recipes/mimalloc/all/test_package/conanfile.py | dvirtz/conan-center-index | 562 | 11157907 | from conans import ConanFile, CMake, RunEnvironment, tools
import os
class MimallocTestConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"
def build(self):
# No override:
if not self.options["mimalloc"].override:
self._test_files = ["mi_api... |
bazel/python.bzl | phlax/envoy-mobile | 399 | 11157912 | abi_bzl_template = """\
def python_tag():
return "{python_tag}"
def abi_tag():
return "{abi_tag}"
"""
# we reuse the PYTHON_BIN_PATH environment variable from pybind11 so that the
# ABI tag we detect is always compatible with the version of python that was
# used for the build
_PYTHON_BIN_PATH_ENV = "PYTHON_B... |
toytree/Toytree.py | smau8/toytree | 127 | 11157920 | #!/usr/bin/env python
from __future__ import print_function, absolute_import
import itertools
from decimal import Decimal
from copy import copy
import numpy as np
from .TreeNode import TreeNode
from .TreeStyle import TreeStyle, COLORS2
from .StyleChecker import StyleChecker
from .Coords import Coords
from .TreeParse... |
foliant/config/__init__.py | foliant-docs/foliant | 105 | 11157937 | <gh_stars>100-1000
from foliant.utils import get_available_config_parsers
from foliant.config import include, path
class Parser(*get_available_config_parsers().values()):
pass
|
test-endtoend/gen-config.py | dolfly/flume | 249 | 11157955 | #!/usr/bin/env python
#
# Output generated is intended to be piped into the the flume shell
# usage:
# gen-config.py [nodes [eventsPerNode [#collecotrs [#agents]]]]
#
# generally the output is piped to the flume shell
# gen-config.py ... | flume shell
def printFlumeScript (master, agents, collectors, collectorS... |
first_n_fibo.py | deepak5998/Py | 726 | 11157983 | # Write a function that computes the
# list of the first 100 Fibonacci numbers
FIB_ARR = [0, 1]
def first_n_fibo(n):
if n < 2:
return FIB_ARR
else:
while len(FIB_ARR) < n:
FIB_ARR.append(FIB_ARR[-1] + FIB_ARR[-2])
return FIB_ARR
n = 10
arr = first_n_fibo(n)
print(arr)
|
tests/test_live_catalina_10_15_1.py | oPromessa/osxphotos | 656 | 11157991 | <filename>tests/test_live_catalina_10_15_1.py
# Test live photos
import pytest
import osxphotos
PHOTOS_DB = "./tests/Test-Cloud-10.15.1.photoslibrary/database/photos.db"
UUID_DICT = {
"live": "51F2BEF7-431A-4D31-8AC1-3284A57826AE",
"not_live": "9D671650-B2FD-4760-84CA-FD25AF622C63",
}
@pytest.fixture(scop... |
modules/dbnd/src/targets/extras/pandas_ctrl.py | ipattarapong/dbnd | 224 | 11158005 | import logging
from typing import Any
from pandas import DataFrame
from targets.extras import DataTargetCtrl
from targets.marshalling import get_marshaller_ctrl
from targets.target_config import FileFormat, file
from targets.utils.performance import target_timeit
logger = logging.getLogger(__name__)
file_table = f... |
plane detection/python/plane_detection.py | liuqiaoping7/zed-examples | 472 | 11158014 | ########################################################################
#
# Copyright (c) 2021, STEREOLABS.
#
# All rights reserved.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHA... |
test/hdmi2ethernet/make.py | auscompgeek/litex-buildenv | 198 | 11158023 | #!/usr/bin/env python3
import argparse
import importlib
def _get_args():
parser = argparse.ArgumentParser()
parser.add_argument("-b", "--bridge", default="etherbone", help="Bridge to use")
parser.add_argument("--port", default="2", help="UART port")
parser.add_argument("--baudrate", default=115200, he... |
experimental/sngp/normalization.py | FrancescoPinto/edward2 | 591 | 11158025 | <filename>experimental/sngp/normalization.py
# coding=utf-8
# Copyright 2021 The Edward2 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/LICENS... |
dabl/portfolios/portfolio_mixed.py | bhishanpdl/dabl | 500 | 11158033 | <gh_stars>100-1000
from sklearn.linear_model import LogisticRegression
from sklearn.ensemble import RandomForestClassifier
from sklearn.experimental import enable_hist_gradient_boosting
from sklearn.ensemble import HistGradientBoostingClassifier
from sklearn.svm import SVC
enable_hist_gradient_boosting
def portfolio... |
tests/test_model/test_backbone/test_shufflenetv2_unit.py | ZJCV/PyCls | 110 | 11158046 | # -*- coding: utf-8 -*-
"""
@date: 2020/12/25 上午10:14
@file: test_shufflenetv1_unit.py
@author: zj
@description:
"""
import torch
import torch.nn as nn
from zcls.model.backbones.shufflenet.shufflenetv2_unit import ShuffleNetV2Unit
def test_shufflenetv2_unit():
data = torch.randn(1, 24, 56, 56)
inplanes = 2... |
pymtl3/passes/backends/generic/structural/test/StructuralTranslatorL3_test.py | kevinyuan/pymtl3 | 152 | 11158059 | <reponame>kevinyuan/pymtl3<gh_stars>100-1000
#=========================================================================
# StructuralTranslatorL3_test.py
#=========================================================================
# Author : <NAME>
# Date : May 21, 2019
"""Test the level 3 structural translators."""
im... |
test/SourceKit/Inputs/sourcekitd_path_sanitize.py | lwhsu/swift | 72,551 | 11158066 | #!/usr/bin/env python
# sourcekitd_path_sanitize.py - Cleans up paths from sourcekitd-test output
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2019 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://s... |
intake/gui/tests/test_base.py | tewf/intake | 578 | 11158078 | #-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2019, Anaconda, Inc. and Intake contributors
# All rights reserved.
#
# The full license is in the LICENSE file, distributed with this software.
#------------------------------------------------------------------------... |
GPy/kern/src/rbf.py | ekalosak/GPy | 1,685 | 11158093 | <filename>GPy/kern/src/rbf.py<gh_stars>1000+
# Copyright (c) 2012, GPy authors (see AUTHORS.txt).
# Licensed under the BSD 3-clause license (see LICENSE.txt)
import numpy as np
from .stationary import Stationary
from .psi_comp import PSICOMP_RBF, PSICOMP_RBF_GPU
from ...core import Param
from paramz.caching import Ca... |
covid_plot_active.py | djay/covidthailand | 116 | 11158098 | import re
import matplotlib.cm
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import utils_thai
from covid_data import get_ifr
from covid_data import scrape_and_combine
from covid_plot_utils import plot_area
from covid_plot_utils import source
from utils_pandas import cum2daily
from utils_pand... |
mlvm/scripts/spark_bq.py | deep2064/initialization-actions | 426 | 11158122 | from pyspark.sql import SparkSession
spark = SparkSession.builder.appName("mlvmTest").getOrCreate()
table = "bigquery-public-data.samples.shakespeare"
df = spark.read.format("bigquery").option("table", table).load()
df.take(1)
|
server/frontend/app/utils.py | jakuta-tech/TinyCheck | 2,054 | 11158142 | <reponame>jakuta-tech/TinyCheck<filename>server/frontend/app/utils.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import psutil
import time
import yaml
import sys
import os
from functools import reduce
import shutil
import re
def terminate_process(process):
"""
Terminale all instances o... |
examples/binding1.py | wcastello/splunk-sdk-python | 495 | 11158173 | #!/usr/bin/env python
#
# Copyright 2011-2015 Splunk, 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... |
components/isceobj/Alos2Proc/runPrepareSlc.py | vincentschut/isce2 | 1,133 | 11158237 | #
# Author: <NAME>
# Copyright 2015-present, NASA-JPL/Caltech
#
import os
import logging
import datetime
import numpy as np
import isceobj
from isceobj.Constants import SPEED_OF_LIGHT
from isceobj.Alos2Proc.Alos2ProcPublic import overlapFrequency
from contrib.alos2proc.alos2proc import rg_filter
from contrib.alos2pro... |
tests/expressions.py | marketneutral/alphatools | 302 | 11158248 | <filename>tests/expressions.py<gh_stars>100-1000
from alphatools.research import run_pipeline, make_factor_plot
from alphatools.expression import ExpressionAlpha
from alphatools.ics import Sector, SubIndustry
from zipline.pipeline.factors import AverageDollarVolume, CustomFactor, Returns
from zipline.pipeline.data impo... |
tests_app/tests/unit/models.py | makerGeek/drf-extensions | 1,172 | 11158258 | <reponame>makerGeek/drf-extensions<gh_stars>1000+
from .key_constructor.bits.models import *
from .routers.nested_router_mixin.models import *
from .serializers.models import *
|
strawberryfields/backends/bosonicbackend/ops.py | federico0112/strawberryfields | 646 | 11158267 | # Copyright 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 by applicable law or agre... |
Linux/etc/api/intelligencex.py | Dave360-crypto/Oblivion | 339 | 11158274 | #!/usr/bin/python
import os
import re
import datetime
import pprint
import requests
import pathlib
import random
import getpass
from pathlib import Path
import coloredlogs
import logging
import verboselogs
from etc.api.intelxapi import *
from etc.api.keys import *
from etc.api.googledrv.gdrive_folder import subir_arq... |
compiler-tools/RealtimePreview/gen_data_json.py | amjunliang/virtualview_tools | 186 | 11158284 | <reponame>amjunliang/virtualview_tools<filename>compiler-tools/RealtimePreview/gen_data_json.py<gh_stars>100-1000
# -*- coding: UTF-8 -*-
import sys
import os
import base64
import json
templates_path = sys.argv[1]
xml_build_path = sys.argv[2]
progress_template_name = sys.argv[3] if len(sys.argv) > 3 else None
# prin... |
mmtbx/max_lik/__init__.py | dperl-sol/cctbx_project | 155 | 11158295 | <reponame>dperl-sol/cctbx_project
from __future__ import absolute_import, division, print_function
import cctbx.array_family.flex # import dependency
import boost_adaptbx.boost.python as bp
ext = bp.import_ext("mmtbx_max_lik_ext")
from mmtbx_max_lik_ext import *
|
desktop/core/ext-py/unicodecsv-0.14.1/setup.py | zhoudahong/hue | 5,079 | 11158341 | #!/usr/bin/env python
import os
from setuptools import setup, find_packages
version = __import__('unicodecsv').__version__
setup(
name='unicodecsv',
version=version,
description="Python2's stdlib csv module is nice, but it doesn't support unicode. This module is a drop-in replacement which *does*.",
l... |
examples/NeurIPS2018-AI-for-Prosthetics-Challenge/final_submit/submit_model.py | jkren6/PARL | 3,172 | 11158363 | <reponame>jkren6/PARL
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.