max_stars_repo_path string | max_stars_repo_name string | max_stars_count int64 | id string | content string | add_param_types int64 | add_return_types int64 | add_class_field_types int64 | add_instance_field_types int64 | add_total int64 | add_error int64 |
|---|---|---|---|---|---|---|---|---|---|---|
neurokernel/routing_table.py | KathyFeiyang/neurokernel | 235 | 3285371 | <filename>neurokernel/routing_table.py
#!/usr/bin/env python
"""
Routing table class.
"""
import numpy as np
import networkx as nx
import pandas as pd
class RoutingTable(object):
"""
Routing table class.
Simple class that stores pairs of strings that can signify
one-hop routes between entities in a ... | 0 | 0 | 0 | 0 | 0 | 0 |
model/preprocess-shifting-window.py | arcada-uas/LSTMVis | 1,146 | 3285375 | #!/usr/bin/env python
"""
This Script does the preprocessing of a data set in form
of a shifting window over the data. This is needed for
the Saliency and the Word Influence Calculations.
"""
import os
import sys
import argparse
import numpy
import h5py
import itertools
__author__ = '<NAME>'
class Indexer:
def... | 0 | 1 | 0 | 4 | 5 | 0 |
homeassistant/components/met/weather.py | andersop91/core | 22,481 | 3285411 | <gh_stars>1000+
"""Support for Met.no weather service."""
from __future__ import annotations
import logging
from types import MappingProxyType
from typing import Any
import voluptuous as vol
from homeassistant.components.weather import (
ATTR_FORECAST_CONDITION,
ATTR_FORECAST_TEMP,
ATTR_FORECAST_TIME,
... | 0 | 0 | 0 | 0 | 0 | 0 |
wikipedia2vec/cli.py | mattolson93/wikipedia2vec | 744 | 3285413 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# License: Apache License 2.0
import click
import functools
import logging
import multiprocessing
import os
from .dump_db import DumpDB
from .dictionary import Dictionary
from .link_graph import LinkGraph
from .mention_db import MentionDB
from .wikipedia2vec import Wikipedia... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/unit/test_loader.py | radish-bdd/radish2 | 182 | 3285465 | """
radish
~~~~~~
The root from red to green. BDD tooling for Python.
:copyright: (c) 2019 by <NAME> <<EMAIL>>
:license: MIT, see LICENSE for more details.
"""
import pytest
from radish.loader import load_modules, load_module
from radish.errors import RadishError
def test_loader_should_raise_if_location_to_load_n... | 0 | 0 | 0 | 0 | 0 | 0 |
runtime/python/Tools/pynche/ChipViewer.py | hwaipy/InteractionFreeNode | 207 | 3285473 | from __future__ import annotations
"""Chip viewer and widget.
In the lower left corner of the main Pynche window, you will see two
ChipWidgets, one for the selected color and one for the nearest color. The
selected color is the actual RGB value expressed as an X11 #COLOR name. The
nearest color is the named col... | 8 | 1 | 2 | 0 | 11 | 0 |
smarts/sstudio/generators.py | idsc-frazzoli/SMARTS | 554 | 3285480 | # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
#
# 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 the rights
# to us... | 11 | 10 | 0 | 2 | 23 | 0 |
tensorflow/lite/tools/signature/signature_def_utils_test.py | EricRemmerswaal/tensorflow | 190,993 | 3285481 | <reponame>EricRemmerswaal/tensorflow
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the 'License');
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICEN... | 0 | 0 | 0 | 0 | 0 | 0 |
launchpad/nodes/python/addressing.py | deepmind/launchpad | 264 | 3285490 | # Lint as: python3
# Copyright 2020 DeepMind Technologies Limited. 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
#
# ... | 6 | 1 | 0 | 0 | 7 | 0 |
test/earl.py | ROZBEH/rdflib | 1,424 | 3285523 | <filename>test/earl.py<gh_stars>1000+
from datetime import datetime
from rdflib import Graph, URIRef, Literal, BNode, RDF, Namespace
from rdflib.namespace import FOAF, DOAP, DC
from nose.tools import nottest
EARL = Namespace("http://www.w3.org/ns/earl#")
report = Graph()
report.bind("foaf", FOAF)
report.bind("earl... | 0 | 0 | 0 | 0 | 0 | 0 |
main.py | TRI-ML/sdflabel | 105 | 3285558 | import os
import sys
import argparse
import configparser
import shutil
import utils.data as config
from pipelines.train_css import train_css
from pipelines.refine_css import refine_css
from pipelines.refine_css_demo import refine_css_demo
from pipelines.evaluate_dump import evaluate
import torch
import numpy
seed = 1... | 0 | 0 | 0 | 0 | 0 | 0 |
build/dart/verify_sources.py | allansrc/fuchsia | 210 | 3285575 | #!/usr/bin/env python3.8
# Copyright 2019 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import annotations
import argparse
import os
import sys
import pathlib
def main() -> int | object:
parser = ar... | 0 | 2 | 0 | 0 | 2 | 0 |
src/gam/display.py | GAM-team/GAM | 102 | 3285579 | from __future__ import annotations
"""Methods related to display of information to the user."""
import csv
import datetime
import io
import sys
import webbrowser
import dateutil
import googleapiclient.http
#TODO: get rid of these hacks
import gam
from gam.var import *
from gam import controlflow
from gam import gapi... | 1 | 12 | 0 | 0 | 13 | 0 |
tests/risk/test_risk_cumulative.py | Code37/zipline | 412 | 3285589 | #
# Copyright 2016 Quantopian, 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 wr... | 0 | 0 | 0 | 0 | 0 | 0 |
exercises/practice/rational-numbers/.meta/example.py | tamireinhorn/python | 1,177 | 3285590 | from math import gcd
class Rational:
def __init__(self, numer, denom):
# abs used for backward compatibility with fractions.gcd
gcd_num = abs(gcd(numer, denom))
self.numer = numer // gcd_num
self.denom = denom // gcd_num
if self.denom < 0:
self.numer *= -1
... | 0 | 10 | 0 | 0 | 10 | 0 |
Packs/FeedIntel471/Integrations/Intel471Actors/Intel471Actors_test.py | diCagri/content | 799 | 3285592 | import pytest
import Intel471Actors as feed
BUILD_PARAM_DICT_DATA = [
(
{'credentials': {'identifier': 'username', 'password': '<PASSWORD>'}, 'insecure': True,
'fetch_time': '10 minutes', 'proxy': False}, # input
'https://api.intel471.com/v1/actors?actor=*' # expected
),
(
... | 0 | 0 | 0 | 0 | 0 | 0 |
universe/wrappers/experimental/random_env.py | BitJetKit/universe | 8,120 | 3285609 | import logging
from universe import vectorized
logger = logging.getLogger(__name__)
class RandomEnv(vectorized.Wrapper):
'''
Randomly sample from a list of env_ids between episodes.
Passes a list of env_ids to configure. When done=True, calls env.reset()
to sample from the list.
'''
def __ini... | 0 | 2 | 0 | 0 | 2 | 0 |
benchmarks/bench_dimension.py | AtelierLibre/momepy | 268 | 3285628 | import geopandas as gpd
import momepy as mm
import numpy as np
class TimeDimension:
def setup(self):
test_file_path = mm.datasets.get_path("bubenec")
self.df_buildings = gpd.read_file(test_file_path, layer="buildings")
self.df_streets = gpd.read_file(test_file_path, layer="streets")
... | 0 | 0 | 0 | 0 | 0 | 0 |
catalyst/utils/quantization.py | sergunya17/catalyst | 2,693 | 3285638 | <gh_stars>1000+
from typing import Dict, Optional, Union
import torch
from torch import quantization
from catalyst.typing import Model
from catalyst.utils.torch import get_nn_from_ddp_module
def quantize_model(
model: Model, qconfig_spec: Dict = None, dtype: Union[str, Optional[torch.dtype]] = "qint8"
) -> Mode... | 0 | 0 | 0 | 0 | 0 | 0 |
app/grandchallenge/workstation_configs/migrations/0002_workstationconfig_image_context.py | nlessmann/grand-challenge.org | 101 | 3285679 | # Generated by Django 3.1.6 on 2021-02-26 14:40
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
("workstation_configs", "0001_squashed_0008_auto_20201001_0758"),
]
operations: list[object] = [
migrations.AddField(
... | 0 | 0 | 2 | 0 | 2 | 0 |
clearml/backend_api/services/v2_2/events.py | arielleoren/clearml | 1,118 | 3285680 | <reponame>arielleoren/clearml<gh_stars>1000+
"""
events service
Provides an API for running tasks to report events collected by the system.
"""
import enum
import six
from ....backend_api.session import BatchRequest, CompoundRequest, NonStrictDataModel, Request, Response, \
schema_property, StringEnum
class Me... | 0 | 0 | 0 | 0 | 0 | 0 |
Tests/test_PopGen_GenePop_nodepend.py | lukasz-kozlowski/biopython | 2,856 | 3285686 | <filename>Tests/test_PopGen_GenePop_nodepend.py
# Copyright 2007 by <NAME> <<EMAIL>>. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Tests for PopGen GenePop nodepend modul... | 0 | 0 | 0 | 0 | 0 | 0 |
docs/source/conf.py | max-nicholson/pipupgrade | 517 | 3285694 | <reponame>max-nicholson/pipupgrade
import sys
import os, os.path as osp
import datetime as dt
def pardir(path, level = 1):
for _ in range(level):
path = osp.dirname(path)
return path
BASEDIR = osp.abspath(pardir(__file__, 2))
NOW = dt.datetime.now()
sys.path.insert(0, BASEDIR)
import pipupgrade
... | 0 | 0 | 0 | 0 | 0 | 0 |
setup.py | ishine/SMRCToolkit | 1,238 | 3285704 | from setuptools import setup
from setuptools import find_packages
setup(name='sogou_mrc',
version='0.1',
description='sogou_mrc',
author='<NAME>',
install_requires=['numpy', 'tensorflow-gpu==1.12', 'tensorflow-hub', "tqdm", "spacy", "jieba",
"stanfordnlp"],
packag... | 0 | 0 | 0 | 0 | 0 | 0 |
test/swig/DequantizeLinear.py | AyishaR/deepC | 223 | 3285706 | <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 divitional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "Licen... | 0 | 0 | 0 | 0 | 0 | 0 |
mainapp/migrations/0057_add_status_to_relief_camp.py | sndp487/rescuekerala | 657 | 3285713 | # Generated by Django 2.1 on 2018-08-19 10:47
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
("mainapp", "0056_auto_20180819_1420"),
]
operations: list[object] = [
migrations.AddField(
model_name="rescu... | 0 | 0 | 2 | 0 | 2 | 0 |
tools/test_apps/system/monitor_ide_integration/app_test.py | lovyan03/esp-idf | 8,747 | 3285719 | <filename>tools/test_apps/system/monitor_ide_integration/app_test.py
from __future__ import unicode_literals
import glob
import json
import os
import re
import threading
import ttfw_idf
from SimpleWebSocketServer import SimpleWebSocketServer, WebSocket
from tiny_test_fw import Utility
class IDEWSProtocol(WebSocket)... | 0 | 0 | 0 | 0 | 0 | 0 |
promgen/prometheus.py | hieuldt/promgen | 913 | 3285733 | <reponame>hieuldt/promgen
# Copyright (c) 2017 LINE Corporation
# These sources are released under the terms of the MIT license: see LICENSE
import collections
import datetime
import json
import logging
import subprocess
import tempfile
from urllib.parse import urljoin
import pytz
import yaml
from dateutil import pars... | 0 | 0 | 0 | 0 | 0 | 0 |
data/transcoder_evaluation_gfg/python/PROGRAM_TO_FIND_THE_VOLUME_OF_A_TRIANGULAR_PRISM.py | mxl1n/CodeGen | 241 | 3285753 | <reponame>mxl1n/CodeGen
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
def f_gold ( l , b , h ) :
return ( ( l * b * h ) / 2 )
#TOFILL
if __name__ == '__main__':
pa... | 0 | 0 | 0 | 0 | 0 | 0 |
PYTHON/algorithms/fibonacci_recursive.py | Danish-Belal/CodeCollection | 125 | 3285770 | <reponame>Danish-Belal/CodeCollection<filename>PYTHON/algorithms/fibonacci_recursive.py
#---Fibonacci recursive python function---
def Fibonacci(n):
if n<=1 :
return n
else :
#recursive function
return Fibonacci(n-1)+Fibonacci(n-2)
#---main---
n = int(input("Input an integer: ")) #get ... | 0 | 0 | 0 | 0 | 0 | 0 |
dnsgate/dnsgate.py | jakeogh/dnsgate | 121 | 3285801 | #!/usr/bin/env python3
# tab-width:4
# pylint: disable=missing-docstring
# MIT License
# https://github.com/jakeogh/dnsgate/blob/master/LICENSE
#
# "psl domain" is "Public Second Level domain"
# extracted using https://publicsuffix.org/
# essentially this is the first level at which
# the public could register domains... | 32 | 9 | 0 | 0 | 41 | 0 |
tests/utest/test_external_rules.py | admariner/robotframework-robocop | 102 | 3285805 | import sys
from pathlib import Path
import pytest
import robocop.exceptions
@pytest.fixture
def test_data() -> object:
return Path(__file__).parent.parent / "test_data"
class TestExternalRules:
def test_loading_external_rule(self, robocop_pre_load, test_data): # noqa
robocop_pre_load.config.ext_r... | 0 | 1 | 0 | 0 | 1 | 0 |
zipline/pipeline/loaders/blaze/utils.py | liveget/zipline | 412 | 3285816 | from __future__ import annotations
from zipline.pipeline.common import SID_FIELD_NAME, TS_FIELD_NAME
from zipline.pipeline.loaders.blaze.core import ffill_query_in_range
from zipline.pipeline.loaders.utils import (
normalize_data_query_bounds,
normalize_timestamp_to_query_time,
)
def load_raw_data(assets,
... | 1 | 1 | 0 | 0 | 2 | 0 |
tests/test_picture.py | naveen521kk/skia-python | 120 | 3285817 | import skia
import pytest
@pytest.fixture
def recorder() -> object:
return skia.PictureRecorder()
def test_Picture_init():
assert isinstance(skia.Picture(skia.Rect(100, 100)), skia.Picture)
def test_Picture_playback(picture, canvas):
picture.playback(canvas)
def test_Picture_cullRect(picture):
a... | 0 | 2 | 0 | 0 | 2 | 0 |
examples/plot_state_border/main.py | konstride/overpass-api-python-wrapper | 266 | 3285853 | <reponame>konstride/overpass-api-python-wrapper
#!/usr/bin/env python
# Author: <NAME> (Fju) 2018
# This file is part of the overpass-api-python-wrapper project
# which is licensed under Apache 2.0.
# See LICENSE.txt for the full license text.
import os
import xml.etree.ElementTree
import matplotlib.pyplot a... | 0 | 0 | 0 | 0 | 0 | 0 |
src/twisted/spread/__init__.py | giadram/twisted | 9,953 | 3285857 | <gh_stars>1000+
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Twisted Spread: Spreadable (Distributed) Computing.
@author: <NAME>
"""
| 0 | 0 | 0 | 0 | 0 | 0 |
examples/01_plotting/plot_prob_atlas.py | OliverWarrington/nilearn | 827 | 3285858 | <filename>examples/01_plotting/plot_prob_atlas.py
"""
Visualizing 4D probabilistic atlas maps
=======================================
This example shows how to visualize probabilistic atlases made of 4D images.
There are 3 different display types:
1. "contours", which means maps or ROIs are shown as contours delineat... | 0 | 0 | 0 | 0 | 0 | 0 |
vega/datasets/common/avazu.py | jie311/vega | 724 | 3285872 | # -*- coding: utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the MIT License.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the... | 6 | 3 | 0 | 0 | 9 | 0 |
tasks/deps.py | vladcorneci/golden-gate | 262 | 3285882 | # Copyright 2017-2020 Fitbit, Inc
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
"""Helpers to check dependencies"""
from builtins import range
import re
import semver
from invoke import Exit
def _make_semver_version(version) -> object:
parts = version.split(".")
for _ in range(le... | 6 | 4 | 0 | 0 | 10 | 0 |
tests/unit/exceptions_test.py | konstantin-Sk/pika | 2,479 | 3285898 | """
Tests for pika.exceptions
"""
import unittest
from pika import exceptions
# missing-docstring
# pylint: disable=C0111
# invalid-name - our tests use long, descriptive names
# pylint: disable=C0103
class ExceptionTests(unittest.TestCase):
def test_amqp_connection_error_one_param_repr(self):
self.a... | 0 | 0 | 0 | 0 | 0 | 0 |
matrixprofile/io/__init__.py | MORE-EU/matrixprofile | 262 | 3285926 | __all__ = [
'to_disk',
'from_disk',
'to_json',
'from_json',
'to_mpf',
'from_mpf',
]
from matrixprofile.io.__io import to_disk
from matrixprofile.io.__io import from_disk
from matrixprofile.io.__io import to_json
from matrixprofile.io.__io import from_json
from matrixprofile.io.protobuf.protobuf... | 0 | 0 | 0 | 0 | 0 | 0 |
pyexfil/network/FTP/ftp_exfil.py | goffinet/PyExfil | 603 | 3285939 | <filename>pyexfil/network/FTP/ftp_exfil.py
#!/usr/bin/python
import os
import sys
import zlib
import time
import base58
from ftplib import FTP
from ftplib import FTP_TLS
from operator import itemgetter
OKAY = 0
ERR = -1
DELIMITER = "-"
CHUNKS_SIZE = 127
SLEEP = 0.01
class GetContent():
def __init__(self, dir="... | 0 | 0 | 0 | 0 | 0 | 0 |
src/main/python/rlbot/utils/rendering/rendering_manager.py | VirxEC/RLBot | 408 | 3285940 | <filename>src/main/python/rlbot/utils/rendering/rendering_manager.py
import ctypes
import hashlib
from typing import Optional, Set
import flatbuffers
from rlbot.messages.flat import Float
from rlbot.utils.structures.game_data_struct import Vector3
from rlbot.utils.structures.game_status import RLBotCoreStatus
from rlb... | 0 | 0 | 0 | 0 | 0 | 0 |
questions/swap-adjacent-in-lr-string/Solution.py | marcus-aurelianus/leetcode-solutions | 141 | 3285957 | <reponame>marcus-aurelianus/leetcode-solutions
"""
In a string composed of 'L', 'R', and 'X' characters, like "RXXLRXRXL", a move consists of either replacing one occurrence of "XL" with "LX", or replacing one occurrence of "RX" with "XR". Given the starting string start and the ending string end, return True if and o... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/offboard_position_velocity_ned.py | TSC21/MAVSDK-Python | 137 | 3286032 | #!/usr/bin/env python3
import asyncio
from mavsdk import System
from mavsdk.offboard import (PositionNedYaw, VelocityNedYaw, OffboardError)
async def run() -> None:
drone = System()
await drone.connect(system_address="udp://:14540")
print("Waiting for drone to connect...")
async for state in drone.c... | 0 | 1 | 0 | 0 | 1 | 0 |
dali/test/python/test_external_source_parallel_custom_serialization.py | cyyever/DALI | 3,967 | 3286048 | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. 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 requi... | 11 | 31 | 0 | 0 | 42 | 0 |
homeassistant/components/sia/__init__.py | MrDelik/core | 30,023 | 3286087 | """The sia integration."""
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_PORT
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady
from .const import DOMAIN, PLATFORMS
from .hub import SIAHub
async def async_setup_entry(hass... | 4 | 2 | 2 | 0 | 8 | 0 |
tests/cases/exceptions.py | div72/py2many | 345 | 3286095 | #!/usr/bin/env python3
def show():
try:
raise Exception("foo")
except Exception as e:
print("caught")
finally:
print("Finally")
try:
3 / 0
except ZeroDivisionError:
print("OK")
try:
raise Exception("foo")
except:
print("Got it")
i... | 0 | 0 | 0 | 0 | 0 | 0 |
qualcoder/GUI/ui_dialog_refi_export_endings.py | ericbrasiln/QualCoder | 150 | 3286102 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui_dialog_refi_export_endings.ui'
#
# Created by: PyQt5 UI code generator 5.14.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Dialog_refi_export_line_endings(object):
de... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/bridge_test.py | metbosch/script.kodi.http.ambilight | 172 | 3286103 | import bridge
import requests_mock
BRIDGE_IP = '127.0.0.1'
USERNAME = 'fake'
LIGHTS = {u'1': {u'name': u'fake',
u'state': {u'alert': u'none',
u'bri': 254,
u'hue': 17738,
u'on': True,
u'sat'... | 0 | 0 | 0 | 0 | 0 | 0 |
src/ralph/lib/error_handling/middleware.py | pinoatrome/ralph | 1,668 | 3286108 | <filename>src/ralph/lib/error_handling/middleware.py
import logging
import traceback
from django.conf import settings
from django.db import OperationalError
from ralph.lib.error_handling.exceptions import WrappedOperationalError
logger = logging.getLogger(__name__)
class OperationalErrorHandlerMiddleware:
def... | 0 | 0 | 0 | 0 | 0 | 0 |
abusehelper/core/utils.py | AbuseSA/abusehelper | 117 | 3286110 | <reponame>AbuseSA/abusehelper
from __future__ import absolute_import
import csv
import ssl
import gzip
import time
import socket
import httplib
import inspect
import urllib2
import traceback
import functools
import collections
import email.parser
import cPickle as pickle
try:
from ssl import create_default_contex... | 0 | 0 | 0 | 0 | 0 | 0 |
linux/keyman-config/keyman_config/gnome_keyboards_util.py | SabineSIL/keyman-1 | 219 | 3286137 | <gh_stars>100-1000
#!/usr/bin/python3
import logging
import os
from gi.repository import Gio
from gi.overrides.GLib import Variant
class GnomeKeyboardsUtil():
def __init__(self):
self.input_sources = Gio.Settings.new("org.gnome.desktop.input-sources")
def read_input_sources(self):
sourcesVal... | 0 | 0 | 0 | 0 | 0 | 0 |
src/visitpy/pyavt/examples/py_test_mpicom_query.py | visit-dav/vis | 226 | 3286138 | <reponame>visit-dav/vis<gh_stars>100-1000
# VisIt Python Query
#
# Tests VisIt's mpicom python MPI wrapper.
#
#
# Usage:
# Load in the Query window or run with provided driver:
# visit -o path/to/rect2d.silo -nowin -cli -s visit_mpicom_test.py
#
class Dog:
"""
A simple class used to test mpi ops on a python... | 0 | 0 | 0 | 0 | 0 | 0 |
pyxb/bundles/opengis/sos_2_0.py | eLBati/pyxb | 123 | 3286149 | from pyxb.bundles.opengis.raw.sos_2_0 import *
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/exceptions/source/diagnose/keyword_argument.py | ponponon/loguru | 11,391 | 3286151 | <reponame>ponponon/loguru<filename>tests/exceptions/source/diagnose/keyword_argument.py
import sys
from loguru import logger
logger.remove()
logger.add(sys.stderr, format="", colorize=True, backtrace=False, diagnose=True)
def f(x):
return 1 / x
y = 0
with logger.catch():
f(x=y)
x = 0
with logger.catch(... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/check.py | Sungdong9Kim/iotivity-constrained | 266 | 3286187 | #!/usr/bin/env python3
# This file is part of the Soletta (TM) Project
#
# Copyright (C) 2015 Intel Corporation. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ... | 0 | 0 | 0 | 2 | 2 | 0 |
Demos/benchmarks/nqueens.py | matham/cython | 6,663 | 3286214 | #!/usr/bin/env python
"""Simple, brute-force N-Queens solver."""
__author__ = "<EMAIL> (<NAME>)"
# Python imports
import optparse
import re
import string
from time import time
# Local imports
import util
import cython
try:
from builtins import range as _xrange
except ImportError:
from __builtin__ import x... | 0 | 2 | 0 | 0 | 2 | 0 |
mindspore/mindrecord/filereader.py | Vincent34/mindspore | 3,200 | 3286217 | <filename>mindspore/mindrecord/filereader.py
# Copyright 2019-2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
... | 0 | 0 | 0 | 0 | 0 | 0 |
piccolo/apps/migrations/tables.py | 0scarB/piccolo | 750 | 3286220 | <gh_stars>100-1000
from __future__ import annotations
import typing as t
from piccolo.columns import Timestamp, Varchar
from piccolo.columns.defaults.timestamp import TimestampNow
from piccolo.table import Table
class Migration(Table):
name = Varchar(length=200)
app_name = Varchar(length=200)
ran_on = T... | 0 | 0 | 0 | 0 | 0 | 0 |
somaticseq/somatic_xgboost.py | bioinform/somaticseq | 159 | 3286226 | #!/usr/bin/env python3
from __future__ import annotations
import argparse
import xgboost as xgb
import pandas as pd
import numpy as np
import re
import logging
import somaticseq.ntchange_type as ntchange
from copy import copy
from somaticseq._version import __version__
DEFAULT_PARAM = {'max_depth': 8, 'nthread': 1,... | 1 | 3 | 0 | 0 | 4 | 0 |
examples/heroku/main.py | hirosassa/bolt-python | 504 | 3286237 | <filename>examples/heroku/main.py
import logging
from slack_bolt import App
logging.basicConfig(level=logging.DEBUG)
app = App()
@app.command("/hello-bolt-python-heroku")
def hello(body, ack):
user_id = body["user_id"]
ack(f"Hi <@{user_id}>!")
from flask import Flask, request
from slack_bolt.adapter.flask... | 0 | 0 | 0 | 0 | 0 | 0 |
scale/scheduler/tasks/services/messaging/message_handler_task.py | kaydoh/scale | 121 | 3286246 | <reponame>kaydoh/scale<gh_stars>100-1000
"""Defines the class for a message handler task"""
from __future__ import unicode_literals
from job.tasks.base_task import AtomicCounter
from node.resources.node_resources import NodeResources
from node.resources.resource import Cpus, Mem
from scheduler.tasks.system_task import... | 0 | 0 | 0 | 0 | 0 | 0 |
descarteslabs/client/services/metadata/cli.py | carderne/descarteslabs-python | 167 | 3286257 | #!/usr/bin/env python
# Copyright 2018-2020 Descartes Labs.
#
# 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 applicabl... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/tutorials/nasbench_as_dataset.py | dutxubo/nni | 2,305 | 3286280 | <gh_stars>1000+
"""
Use NAS Benchmarks as Datasets
==============================
In this tutorial, we show how to use NAS Benchmarks as datasets.
For research purposes we sometimes desire to query the benchmarks for architecture accuracies,
rather than train them one by one from scratch.
NNI has provided query tools ... | 0 | 0 | 0 | 0 | 0 | 0 |
src/build/util/android_chrome_version.py | Mr-Sheep/naiveproxy | 643 | 3286287 | # Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Different build variants of Chrome for Android have different version codes.
For targets that have the same package name (e.g. Chrome, Chrome Modern,
Mono... | 0 | 1 | 0 | 0 | 1 | 0 |
azure-devops/azext_devops/devops_sdk/v5_0/task_agent/task_agent_client.py | doggy8088/azure-devops-cli-extension | 326 | 3286288 | <filename>azure-devops/azext_devops/devops_sdk/v5_0/task_agent/task_agent_client.py<gh_stars>100-1000
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the proje... | 0 | 0 | 0 | 0 | 0 | 0 |
testing/__init__.py | dweindl/exhale | 169 | 3286290 | # -*- coding: utf8 -*-
########################################################################################
# This file is part of exhale. Copyright (c) 2017-2019, <NAME>. #
# Full BSD 3-Clause license available here: #
# ... | 0 | 1 | 0 | 0 | 1 | 0 |
wechatpy/exceptions.py | fuh/wechatpy | 2,428 | 3286302 | <reponame>fuh/wechatpy
# -*- coding: utf-8 -*-
"""
wechatpy.exceptions
~~~~~~~~~~~~~~~~~~~~
Basic exceptions definition.
:copyright: (c) 2014 by messense.
:license: MIT, see LICENSE for more details.
"""
class WeChatException(Exception):
"""Base exception for wechatpy"""
def __init__(se... | 0 | 0 | 0 | 0 | 0 | 0 |
falcon_kit/mains/generic_unsplit.py | peterjc/FALCON | 216 | 3286319 | from __future__ import absolute_import
import argparse
import logging
import os
import sys
from .. import io
LOG = logging.getLogger()
def run(result_fn_list_fn, gathered_fn) -> object:
thatdir = os.path.dirname(result_fn_list_fn)
thisdir = os.path.dirname(gathered_fn)
result_fn_list = io.deserialize(re... | 0 | 3 | 0 | 0 | 3 | 0 |
tests/unit/butterfree/hooks/test_hookable_component.py | fossabot/butterfree | 208 | 3286347 | <gh_stars>100-1000
import pytest
from pyspark.sql.functions import expr
from butterfree.hooks import Hook, HookableComponent
from butterfree.testing.dataframe import assert_dataframe_equality
class TestComponent(HookableComponent):
def construct(self, dataframe):
pre_hook_df = self.run_pre_hooks(datafram... | 0 | 0 | 0 | 0 | 0 | 0 |
back/tests/test_views/test_alarm_clock_view/test_list.py | ramonakira/piclodio3 | 120 | 3286349 | <reponame>ramonakira/piclodio3<gh_stars>100-1000
from collections import OrderedDict
from rest_framework import status
from rest_framework.reverse import reverse
from tests.test_views.test_alarm_clock_view.base import Base
class TestList(Base):
def setUp(self):
super(TestList, self).setUp()
self.... | 0 | 0 | 0 | 0 | 0 | 0 |
terrascript/ns1/d.py | mjuenema/python-terrascript | 507 | 3286372 | # terrascript/ns1/d.py
# Automatically generated by tools/makecode.py ()
import warnings
warnings.warn(
"using the 'legacy layout' is deprecated", DeprecationWarning, stacklevel=2
)
import terrascript
class ns1_dnssec(terrascript.Data):
pass
class ns1_record(terrascript.Data):
pass
class ns1_zone(te... | 0 | 0 | 0 | 0 | 0 | 0 |
tapiriik/web/email.py | prohfesor/tapiriik | 1,445 | 3286376 | from __future__ import annotations
from django.template.loader import get_template
from django.template import Context
from django.core.mail import EmailMultiAlternatives
from django.conf import settings
def generate_message_from_template(template, context) -> tuple[object, object]:
context["STATIC_URL"] = settings.S... | 1 | 1 | 0 | 0 | 2 | 0 |
cherrypy/test/test_logging.py | drewja/cherrypy | 1,822 | 3286400 | """Basic tests for the CherryPy core: request handling."""
import logging
from cheroot.test import webtest
import pytest
import requests # FIXME: Temporary using it directly, better switch
import cherrypy
from cherrypy.test.logtest import LogCase
# Some unicode strings.
tartaros = u'\u03a4\u1f71\u03c1\u03c4\u03b1... | 0 | 6 | 0 | 0 | 6 | 0 |
porespy/tools/__init__.py | jamesobutler/porespy | 165 | 3286402 | <gh_stars>100-1000
r"""
Tools
#####
**Helper Functions**
This module contains a variety of functions for manipulating images in
ways do NOT return a modified version of the original image.
.. currentmodule:: porespy
.. autosummary::
:template: mybase.rst
:toctree: generated/
tools.align_image_with_openpn... | 0 | 0 | 0 | 0 | 0 | 0 |
furniture/env/controllers/jaco_ik_controller.py | KejiaChen/assembly | 364 | 3286407 | <filename>furniture/env/controllers/jaco_ik_controller.py
"""
NOTE: requires pybullet module.
Run `pip install pybullet==1.9.5`.
"""
import numpy as np
try:
import pybullet as p
except ImportError:
raise Exception(
"Please make sure pybullet is installed. Run `pip install pybullet==1.9.5`"
)
from... | 0 | 0 | 0 | 0 | 0 | 0 |
cpp/codegen/cpp/type_converters.py | hhhaiai/profilo | 1,466 | 3286420 | <gh_stars>1000+
"""
Copyright 2018-present, Facebook, 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 agree... | 0 | 0 | 0 | 0 | 0 | 0 |
setup.py | grey-btw/DeepADoTS | 440 | 3286421 | from setuptools import setup
def parse_requirements(filename) -> object:
""" load requirements from a pip requirements file """
lineiter = (line.strip() for line in open(filename))
return [line for line in lineiter if line and not line.startswith("#")]
setup(
name='deep-adots',
author='<NAME>, <... | 0 | 1 | 0 | 0 | 1 | 0 |
third_party/virtualbox/src/VBox/ValidationKit/testmanager/webui/wuihlpform.py | Fimbure/icebox-1 | 521 | 3286424 | # -*- coding: utf-8 -*-
# $Id: wuihlpform.py $
from __future__ import annotations
"""
Test Manager Web-UI - Form Helpers.
"""
__copyright__ = \
"""
Copyright (C) 2012-2017 Oracle Corporation
This file is part of VirtualBox Open Source Edition (OSE), as
available from http://www.virtualbox.org. This file is free soft... | 54 | 38 | 2 | 1 | 95 | 0 |
native_client_sdk/src/tools/getos.py | zealoussnow/chromium | 14,668 | 3286438 | #!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import annotations
"""Determine OS and various other system properties.
Determine the name of the platform used an... | 0 | 9 | 0 | 0 | 9 | 0 |
contributer_demo/demo1/src/formation/script/ga1.py | lnexenl/XTDrone | 457 | 3286449 | <reponame>lnexenl/XTDrone
import numpy as np
import random
import time
import os
class GA1():
def __init__(self, vehicle_num, vehicles_speed, target_num, targets, time_lim):
# vehicles_speed,targets in the type of narray
self.vehicle_num = vehicle_num
self.vehicles_speed = vehicles_speed
... | 0 | 0 | 0 | 0 | 0 | 0 |
questions/check-completeness-of-a-binary-tree/Solution.py | marcus-aurelianus/leetcode-solutions | 141 | 3286452 | <filename>questions/check-completeness-of-a-binary-tree/Solution.py
'''
Given a binary tree, determine if it is a complete binary tree.
Definition of a complete binary tree from Wikipedia:
In a complete binary tree every level, except possibly the last, is completely filled, and all nodes in the last level are as far ... | 0 | 0 | 0 | 0 | 0 | 0 |
openapi_python_client/schema/openapi_schema_pydantic/responses.py | oterrier/openapi-python-client | 172 | 3286453 | from typing import Dict, Union
from .reference import Reference
from .response import Response
Responses = Dict[str, Union[Response, Reference]]
"""
A container for the expected responses of an operation.
The container maps a HTTP response code to the expected response.
The documentation is not necessarily expected ... | 0 | 0 | 0 | 0 | 0 | 0 |
external/AR/ltr/models/backbone/resnet18_vggm.py | tzhhhh123/Stark | 376 | 3286458 | import math
import torch
import torch.nn as nn
from collections import OrderedDict
from torchvision.models.resnet import BasicBlock
from .base import Backbone
class SpatialCrossMapLRN(nn.Module):
def __init__(self, local_size=1, alpha=1.0, beta=0.75, k=1, ACROSS_CHANNELS=True):
super(SpatialCrossMapLRN, s... | 0 | 0 | 0 | 0 | 0 | 1 |
pytorch-semseg/ptsemseg/models/__init__.py | riciche/SimpleCVReproduction | 3,348 | 3286469 | <gh_stars>1000+
import copy
import torchvision.models as models
from ptsemseg.models.fcn import fcn8s, fcn16s, fcn32s
from ptsemseg.models.segnet import segnet
from ptsemseg.models.unet import unet
from ptsemseg.models.pspnet import pspnet
from ptsemseg.models.icnet import icnet
from ptsemseg.models.linknet import lin... | 0 | 0 | 0 | 0 | 0 | 0 |
demos/file_upload/file_receiver.py | DengJackNo1/tornado | 15,056 | 3286481 | <filename>demos/file_upload/file_receiver.py
#!/usr/bin/env python
"""Usage: python file_receiver.py
Demonstrates a server that receives a multipart-form-encoded set of files in an
HTTP POST, or streams in the raw data of a single file in an HTTP PUT.
See file_uploader.py in this directory for code that uploads file... | 0 | 0 | 0 | 0 | 0 | 0 |
convlab2/dst/comer/multiwoz/convert_mw.py | Malavikka/ConvLab-2 | 339 | 3286482 | import os
import json
import pickle
import torch
from pytorch_pretrained_bert import BertTokenizer
from collections import defaultdict
### this file is to convert the raw woz data into the format required for prepross.py
bert=True
bert_type='bert-large-uncased'
tokenizer=BertTokenizer.from_pretrained(bert_type)
def _t... | 0 | 1 | 0 | 0 | 1 | 0 |
Configuration/Generator/python/Psi2SToJPsiPiPi_14TeV_TuneCP5_pythia8_cfi.py | Purva-Chaudhari/cmssw | 852 | 3286485 | import FWCore.ParameterSet.Config as cms
from Configuration.Generator.Pythia8CommonSettings_cfi import *
from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import *
generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter",
pythiaPylistVerbosity = cms.untracked.int32(0),
pythiaHepMCVerbosity = cm... | 0 | 0 | 0 | 0 | 0 | 0 |
pymaze/cell.py | stantonious/pymaze | 154 | 3286487 |
from __future__ import annotations
class Cell(object):
"""Class for representing a cell in a 2D grid.
Attributes:
row (int): The row that this cell belongs to
col (int): The column that this cell belongs to
visited (bool): True if this cell has been visited by an algori... | 0 | 2 | 0 | 5 | 7 | 0 |
src/oci/object_storage/__init__.py | Manny27nyc/oci-python-sdk | 249 | 3286488 | # 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 at http://www.apache.org/licenses/LICENSE-2.0. You may c... | 0 | 0 | 0 | 0 | 0 | 0 |
syzygy/pdb/pdb.gyp | nzeh/syzygy | 343 | 3286498 | <filename>syzygy/pdb/pdb.gyp<gh_stars>100-1000
# Copyright 2012 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/LICENS... | 0 | 0 | 0 | 0 | 0 | 0 |
hypertools/tools/describe.py | mewbak/hypertools | 1,681 | 3286503 | #!/usr/bin/env python
from __future__ import annotations
from __future__ import division
from builtins import range
import warnings
import numpy as np
from scipy.stats.stats import pearsonr
from scipy.spatial.distance import cdist
import matplotlib.pyplot as plt
import seaborn as sns
from .reduce import reduce as redu... | 5 | 4 | 0 | 0 | 9 | 0 |
tests/es_migration/test_mapping_index_converter.py | topdown618/aliyun-log-python-sdk | 130 | 3286515 | <gh_stars>100-1000
#!/usr/bin/env python
# encoding: utf-8
# Copyright (C) Alibaba Cloud Computing
# All rights reserved.
import unittest
from aliyun.log.es_migration.mapping_index_converter import \
MappingIndexConverter
class TestMappingIndexConverter(unittest.TestCase):
def test_to_index_config(self):... | 0 | 0 | 0 | 0 | 0 | 0 |
test/yaml/sam-official-samples/encryption_proxy/encryption.py | manuel-trejo-rico/goformation | 791 | 3286541 | from __future__ import annotations
import boto3
import json
import base64
import os
kms = boto3.client('kms')
bad_request = {
'statusCode': 400,
'headers': {
'Content-Type': 'application/json'
},
'body': json.dumps({'error': 'Invalid argument'})
}
def encrypt(key, message) -> object:
'''e... | 0 | 2 | 0 | 0 | 2 | 0 |
Codes/Liam/371_sum_of_two_integers.py | liuxiaohui1221/algorithm | 256 | 3286558 | <gh_stars>100-1000
# 执行用时 : 44 ms
# 内存消耗 : 13.4 MB
# 方案:计算机组成原理
class Solution:
def getSum(self, a: int, b: int) -> int:
while b:
a, b = (a ^ b) & 0xFFFFFFFF, (a & b) << 1
return a if a >> 31 == 0 else a - 4294967296
| 0 | 0 | 0 | 0 | 0 | 0 |
py/jpy/src/test/python/jpy_modretparam_test.py | devinrsmith/deephaven-core | 210 | 3286588 | import unittest
import array
import sys
import jpyutil
jpyutil.init_jvm(jvm_maxmem='512M', jvm_classpath=['target/test-classes'])
import jpy
try:
import numpy as np
except:
np = None
def annotate_fixture_methods(type, method) -> bool:
# print('annotate_fixture_methods: type =', type, ', method =', met... | 0 | 1 | 0 | 0 | 1 | 0 |
tfuzz/create_dict.py | ValkyrieFuzzer/dockerized_fuzzing | 106 | 3286606 | <gh_stars>100-1000
#!/usr/bin/env python
import os
import sys
import angr
import string
import itertools
import logging
l = logging.getLogger("create_dict")
def hexescape(s):
'''
perform hex escaping on a raw string s
'''
out = []
acceptable = (string.ascii_letters + string.digits + " .").enco... | 0 | 0 | 0 | 0 | 0 | 0 |
api/tests/integration/tests/mass/mass_and_gross_fmla.py | tsingdao-Tp/Indigo | 204 | 3286616 | import sys
sys.path.append('../../common')
from env_indigo import *
indigo = Indigo()
print("*** Molecules ***")
def handleMolecule(mol):
print('%0.3f %0.3f %0.3f %s %s' % (
mol.molecularWeight(), mol.monoisotopicMass(), mol.mostAbundantMass(), mol.grossFormula(), mol.massComposition()))
def handleMol... | 0 | 0 | 0 | 0 | 0 | 0 |
audiomate/encoding/frame_based.py | CostanzoPablo/audiomate | 133 | 3286621 | <filename>audiomate/encoding/frame_based.py
import numpy as np
from . import base
from audiomate.utils import misc
class FrameHotEncoder(base.Encoder):
"""
The FrameHotEncoder is used to encode the labels per frame.
It creates a matrix with dimension num-frames x len(labels).
The vector (2nd dim) has... | 0 | 0 | 0 | 0 | 0 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.