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 |
|---|---|---|---|---|---|---|---|---|---|---|
vue/bridge/vue_instance.py | adamlwgriffiths/vue.py | 274 | 160328 | from .object import Object
from .vuex_instance import VuexInstance
class VueInstance(Object):
@staticmethod
def __can_wrap__(obj) -> object:
return hasattr(obj, "_isVue") and obj._isVue
@property
def store(self) -> object:
store = self.__getattr__("store")
return VuexInstance(... | 0 | 3 | 0 | 0 | 3 | 0 |
gammapy/visualization/panel.py | JohannesBuchner/gammapy | 155 | 160333 | <filename>gammapy/visualization/panel.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Helper functions and functions for plotting gamma-ray images."""
import numpy as np
from astropy.coordinates import Angle
__all__ = ["MapPanelPlotter"]
__doctest_requires__ = {("colormap_hess", "colormap_milagr... | 0 | 0 | 0 | 0 | 0 | 0 |
codigo/Live164/app/full_plex.py | BrunoPontesLira/live-de-python | 572 | 160358 | <gh_stars>100-1000
from fastapi import (
APIRouter, Request, WebSocket, WebSocketDisconnect
)
from fastapi.templating import Jinja2Templates
from fastapi.responses import HTMLResponse
from pydantic import BaseModel
from .manager import ws_manager
class Message(BaseModel):
message: str
duplex_router = APIRo... | 0 | 0 | 0 | 0 | 0 | 0 |
terrascript/data/innovationnorway/domeneshop.py | mjuenema/python-terrascript | 507 | 160360 | <filename>terrascript/data/innovationnorway/domeneshop.py
# terrascript/data/innovationnorway/domeneshop.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:15:33 UTC)
import terrascript
class domeneshop_domain(terrascript.Data):
pass
class domeneshop_domains(terrascript.Data):
pass
class do... | 0 | 0 | 0 | 0 | 0 | 0 |
library/_builtins.py | creativemindplus/skybison | 278 | 160374 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. (http://www.facebook.com)
# $builtin-init-module$
# These values are injected by our boot process. flake8 has no knowledge about
# their definitions and will complain without these circular assignments.
_Unbound = _Unbound # noqa: F821
def _... | 0 | 0 | 0 | 0 | 0 | 1 |
tests/bi_encoders/qa/tfhub/test_lareqa_qa.py | boba-and-beer/vectorhub | 385 | 160387 | from vectorhub.bi_encoders.qa.tfhub import LAReQA2Vec
from ....test_utils import assert_encoder_works
def test_lare_qa_works():
"""
Testing for LAReQA works
"""
encoder = LAReQA2Vec()
assert_encoder_works(encoder, data_type='text', model_type='bi_encoder')
| 0 | 0 | 0 | 0 | 0 | 0 |
docs/source/tutorial/v2/using_liberty.py | mjhajharia/deprecated | 169 | 160404 | # coding: utf-8
import liberty
liberty.print_value("hello")
liberty.print_value("hello again")
liberty.better_print("Hi Tom!")
| 0 | 0 | 0 | 0 | 0 | 0 |
steamctl/commands/steamid/cmds.py | rossengeorgiev/steamctl | 138 | 160431 |
import logging
_LOG = logging.getLogger(__name__)
def cmd_steamid(args):
from steam.steamid import SteamID
if args.s_input.startswith('http'):
_LOG.debug("Input is URL. Making online request to resolve SteamID")
s = SteamID.from_url(args.s_input) or SteamID()
else:
s = SteamID(ar... | 0 | 0 | 0 | 0 | 0 | 0 |
menpo/shape/base.py | apapaion/menpo | 311 | 160449 | from menpo.base import Vectorizable
from menpo.landmark import Landmarkable
from menpo.transform.base import Transformable
from menpo.visualize import LandmarkableViewable, Viewable
class Shape(Vectorizable, Transformable, Landmarkable, LandmarkableViewable, Viewable):
"""
Abstract representation of shape. Sh... | 0 | 1 | 0 | 0 | 1 | 0 |
dataset/ActivityNet_Captions/preprocess/anchors/deprecated/get_anchors.py | cxqj/5-densevideocaptioning | 150 | 160527 | '''
This script is to get anchors and pos/neg weights
'''
import os
import h5py
import json
import math
import numpy as np
import h5py
import random
import time
import threading
from sklearn.cluster import KMeans
sample_ratio = 1.0
c3d_resolution = 16
stride = 4
sample_num = 1
n_anchors = 128
tiou_... | 0 | 0 | 0 | 0 | 0 | 0 |
venv/Lib/site-packages/adodbapi/examples/db_table_names.py | ajayiagbebaku/NFL-Model | 150 | 160549 | <gh_stars>100-1000
""" db_table_names.py -- a simple demo for ADO database table listing."""
import sys
import adodbapi
try:
databasename = sys.argv[1]
except IndexError:
databasename = "test.mdb"
provider = ["prv", "Microsoft.ACE.OLEDB.12.0", "Microsoft.Jet.OLEDB.4.0"]
constr = "Provider=%(prv)s;Data Source=... | 0 | 0 | 0 | 0 | 0 | 0 |
src/sage/modules/module_functors.py | bopopescu/sage | 1,742 | 160594 | from __future__ import annotations
"""
Module Functors
AUTHORS:
- <NAME> (2017-10): Initial implementation of
:class:`QuotientModuleFunctor`
"""
#*****************************************************************************
# Copyright (C) 2017 <NAME> <<EMAIL>>
#
# This program is free software: you can redi... | 0 | 5 | 1 | 0 | 6 | 0 |
tools/esp_app_trace/pylibelf/util/__init__.py | ghsecuritylab/esp_alexa_idf | 104 | 160651 | <gh_stars>100-1000
from .. import *
from ..types import *
from ..constants import *
from ctypes import *
import os
def _class(elf): return ord(elf_getident(elf, None).contents[EI_CLASS])
def is32(elf): return _class(elf) == ELFCLASS32
def is64(elf): return _class(elf) == ELFCLASS64
def select(elf, fname):
i... | 0 | 0 | 0 | 0 | 0 | 0 |
processing/processCard4.py | Bermuhz/DataMiningCompetitionFirstPrize | 128 | 160657 | # -*- coding: UTF-8 -*-
import time
import datetime
import numpy as np
import sys
import os.path
import json
if sys.argv[1] == 'train':
root_loc = "trainProcessed/card_train_inverted_cleaned.txt"
feature_loc = "trainProcessed/CardProcessed.txt"
elif sys.argv[1] == 'test':
root_loc = "testProcessed... | 0 | 1 | 0 | 0 | 1 | 0 |
Codes/jxdeng3264/000-100/002.Add-Two-Numbers/Solution.py | liuxiaohui1221/algorithm | 256 | 160663 | <gh_stars>100-1000
#!/usr/bin/env python
# encoding: utf-8
# author: pyclearl
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
# leetcode这里要注释掉才能AC
class Solution(object):
def __init__(self):
self.carry = 0
def addTwoNumbers(self, l1, l2):
... | 0 | 0 | 0 | 0 | 0 | 0 |
pypi_packages/adabelief_tf0.0.1/adabelief_tf/__init__.py | wes-chen/Adabelief-Optimizer | 1,005 | 160684 | from .AdaBelief_tf import AdaBeliefOptimizer | 0 | 0 | 0 | 0 | 0 | 0 |
demo/examples/scheme/eqpde_d1q2q2_shallow_water.py | Mopolino8/pylbm | 106 | 160701 | <reponame>Mopolino8/pylbm
# Authors:
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
# License: BSD 3 clause
"""
Example of a two velocities scheme for the shallow water system
d_t(h) + d_x(q) = 0, t > 0, 0 < x < 1,
d_t(q) + d_x(q^2/h+gh^2/2) = 0, t > 0, 0 < x < 1,
"""
import sympy as sp
import pylbm
# pylin... | 0 | 0 | 0 | 0 | 0 | 0 |
src/dataflow/core/utterance_tokenizer.py | luweishuang/task_oriented_dialogue_as_dataflow_synthesis | 257 | 160760 | <reponame>luweishuang/task_oriented_dialogue_as_dataflow_synthesis
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import re
from typing import List
import spacy
from spacy.language import Language
from dataflow.core.constants import SpecialStrings
def tokenize_datetime(text: str) -> str:... | 0 | 0 | 0 | 0 | 0 | 0 |
arbitrage/public_markets/bitfinexusd.py | fiona-pet/bitcoin-arbitrage | 1,633 | 160762 | from arbitrage.public_markets._bitfinex import Bitfinex
class BitfinexUSD(Bitfinex):
def __init__(self):
super().__init__("USD", "btcusd")
| 0 | 0 | 0 | 0 | 0 | 0 |
tools/python/descriptions/exceptions.py | kudlav/organicmaps | 4,879 | 160783 | <gh_stars>1000+
class DescriptionError(Exception):
pass
class ParseError(DescriptionError):
pass
class GettingError(DescriptionError):
pass
| 0 | 0 | 0 | 0 | 0 | 0 |
armi/materials/thorium.py | keckler/armi | 162 | 160793 | # Copyright 2019 TerraPower, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | 6 | 4 | 1 | 0 | 11 | 0 |
evaluate.py | bycloudai/layered-neural-atlases | 213 | 160837 | <filename>evaluate.py
import matplotlib as mpl
mpl.use('Agg')
import skimage.metrics
import io
from scipy.interpolate import griddata
import matplotlib.image as mpimg
import torch
import colorsys
from pathlib import Path
from loss_utils import get_rigidity_loss, get_optical_flow_loss_all, get_optical_flow_alpha_loss_a... | 0 | 0 | 0 | 0 | 0 | 0 |
src/genie/libs/parser/iosxe/tests/ShowInterfacesCounters/cli/equal/golden_output_expected.py | balmasea/genieparser | 204 | 160845 | expected_output = {
"interface": {
"GigabitEthernet1/0/1": {
"out": {
"mcast_pkts": 188396,
"bcast_pkts": 0,
"ucast_pkts": 124435064,
"name": "GigabitEthernet1/0/1",
"octets": 24884341205,
},
... | 0 | 0 | 0 | 0 | 0 | 0 |
etl/parsers/etw/Microsoft_Windows_Graphics_Printing3D.py | IMULMUL/etl-parser | 104 | 160856 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
Microsoft-Windows-Graphics-Printing3D
GUID : be967569-e3c8-425b-ad0e-4f2c790b1848
"""
from construct import Int8sl, Int8ul, Int16ul, Int16sl, Int32sl, Int32ul, Int64sl, Int64ul, Bytes, Double, Float32l, Struct
from etl.utils import WString, CString, SystemTime, Guid
from e... | 0 | 0 | 0 | 0 | 0 | 0 |
rpmvenv/extensions/python/__init__.py | oleynikandrey/rpmvenv | 150 | 160865 | <filename>rpmvenv/extensions/python/__init__.py<gh_stars>100-1000
"""Core feature extensions for the project related to Python packaging."""
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
| 0 | 0 | 0 | 0 | 0 | 0 |
esim/model.py | achyudh/castor | 132 | 160900 | from __future__ import annotations
import sys
import math
import numpy as np
from datetime import datetime
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
def ortho_weight(ndim) -> object:
... | 14 | 15 | 0 | 2 | 31 | 0 |
cx_Freeze/samples/pythonnet-demo/setup.py | TechnicalPirate/cx_Freeze | 358 | 160905 | """
A setup script to create executables and demonstrate the use pythonnet.
"""
import sys
from cx_Freeze import setup, Executable
base = None
if sys.platform == "win32":
base = "Win32GUI"
executables = [
Executable("helloform.py", icon="python-clear.ico", base=base),
Executable("splitter.py", icon="pyth... | 0 | 0 | 0 | 0 | 0 | 0 |
RecoTBCalo/EcalTBTDCReconstructor/python/Ecal2006TBH2TDCRanges_v1_cff.py | ckamtsikis/cmssw | 852 | 160925 | import FWCore.ParameterSet.Config as cms
tdcZeros = cms.VPSet(cms.PSet(
endRun = cms.int32(31031),
tdcZero = cms.double(1050.5),
startRun = cms.int32(27540)
),
cms.PSet(
endRun = cms.int32(999999),
tdcZero = cms.double(1058.5),
startRun = cms.int32(31032)
))
| 0 | 0 | 0 | 0 | 0 | 0 |
foo/ui/messageBox.py | MangetsuC/arkHelper | 147 | 160988 | <gh_stars>100-1000
from os import getcwd, path, getlogin
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import (QDialog,
QHBoxLayout,
QLabel,
QPushButton, QVBoxLayout, QLineEdit)
from common import theme
class AMessageBox(QDial... | 0 | 0 | 0 | 0 | 0 | 0 |
Trakttv.bundle/Contents/Libraries/Shared/elapsed/main.py | disrupted/Trakttv.bundle | 1,346 | 160996 | <filename>Trakttv.bundle/Contents/Libraries/Shared/elapsed/main.py<gh_stars>1000+
from elapsed.sample import DummySample, Sample
import inspect
import logging
log = logging.getLogger(__name__)
ENABLED = False
SAMPLES = []
DUMMY_SAMPLE = DummySample()
def setup(enabled=False):
global ENABLED
ENABLED = enab... | 0 | 0 | 0 | 0 | 0 | 0 |
carball/__init__.py | unitedroguegg/carball | 119 | 160998 | <filename>carball/__init__.py
try:
from carball.decompile_replays import decompile_replay
from carball.decompile_replays import analyze_replay_file
except ModuleNotFoundError as e:
print("Not importing functions due to missing packages:", e) | 0 | 0 | 0 | 0 | 0 | 0 |
tests/scripts/prepare_stanza.py | souvikg10/rasa-nlu-examples | 129 | 161000 | <reponame>souvikg10/rasa-nlu-examples
import stanza
if __name__ == "__main__":
# This part of the script will download a stanza model.
# If there's a more lightweight way of doing this I'd love to hear it.
stanza.download("en", model_dir="tests/data/stanza")
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/unit/test_content_validity.py | abdullahzamanbabar/syntribos | 277 | 161016 | # Copyright 2016 Intel
#
# 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, softwar... | 0 | 0 | 0 | 0 | 0 | 0 |
xpath/common/colors.py | r0oth3x49/xpath | 113 | 161018 | <reponame>r0oth3x49/xpath
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# pylint: disable=R,W,E,C
"""
Author : <NAME> (r0ot h3x49)
Github : https://github.com/r0oth3x49
License : MIT
Copyright (c) 2016-2025 <NAME> (r0ot h3x49)
Permission is hereby granted, free of charge, to any person obtaining a copy of this soft... | 0 | 0 | 0 | 0 | 0 | 0 |
verification/flopy/mf6/modflow/mfgwtmst.py | INTERA-Inc/mf6cts | 351 | 161034 | # DO NOT MODIFY THIS FILE DIRECTLY. THIS FILE MUST BE CREATED BY
# mf6/utils/createpackages.py
# FILE created on August 06, 2021 20:57:00 UTC
from __future__ import annotations
from .. import mfpackage
from ..data.mfdatautil import ArrayTemplateGenerator
class ModflowGwtmst(mfpackage.MFPackage):
"""
ModflowG... | 14 | 0 | 4 | 1 | 19 | 0 |
packages/core/minos-microservice-saga/tests/test_saga/test_executions/test_executors/test_local.py | minos-framework/minos-python | 247 | 161064 | <reponame>minos-framework/minos-python<gh_stars>100-1000
import unittest
from unittest.mock import (
AsyncMock,
)
from uuid import (
uuid4,
)
from minos.saga import (
Executor,
LocalExecutor,
SagaContext,
SagaFailedExecutionStepException,
SagaOperation,
)
from tests.utils import (
Foo,
... | 0 | 0 | 0 | 0 | 0 | 0 |
neutronclient/osc/v2/logging/network_log.py | slawqo/python-neutronclient | 120 | 161067 | # Copyright 2017-2018 FUJTISU 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
#
# Unless requ... | 1 | 13 | 0 | 0 | 14 | 0 |
src/prefect/tasks/sql_server/sql_server.py | nicolasiltis/prefect | 8,633 | 161086 | <filename>src/prefect/tasks/sql_server/sql_server.py
import pyodbc
from prefect import Task
from prefect.utilities.tasks import defaults_from_attrs
class SqlServerExecute(Task):
"""
Task for executing a query against a SQL Server database.
Args:
- db_name (str): name of SQL Server database
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/speech_utils/speech_features.py | roberthoenig/VQ-VAE-Speech | 241 | 161103 | #####################################################################################
# MIT License #
# #
# Copyright (C) 2019 <NAME> ... | 0 | 3 | 3 | 0 | 6 | 0 |
tests/transformation/test_qonnx_to_finn.py | mmrahorovic/finn | 109 | 161107 | <reponame>mmrahorovic/finn<filename>tests/transformation/test_qonnx_to_finn.py
# Copyright (c) 2021, Xilinx
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code mus... | 0 | 0 | 0 | 0 | 0 | 0 |
fbastani-solution/graphextract/graph_extract_good.py | Hulihrach/RoadDetector | 180 | 161132 | import numpy as np
from scipy.ndimage import imread
from scipy.misc import imsave
from itertools import izip
from collections import deque
from pylibs.spatialfunclib import projection_onto_line
import sqlite3
import math
import sys
import os
import pickle
# globals
min_lat, min_lon, max_lat, max_lon = None, None, None... | 0 | 0 | 0 | 0 | 0 | 0 |
morepath/tests/fixtures/self_scan/__init__.py | hugovk/morepath | 314 | 161168 | <filename>morepath/tests/fixtures/self_scan/__init__.py
def get_this_package():
from morepath.autosetup import caller_package
return caller_package(1)
def do_scan():
import morepath
morepath.scan()
| 0 | 0 | 0 | 0 | 0 | 0 |
timemachines/skatertools/components/residuals.py | iklasky/timemachines | 253 | 161185 | <reponame>iklasky/timemachines
def residual(s:dict, y, x):
""" Return residuals
:param s: state - supply empty dict on first call
:param y: incoming observation
:param x: term structure of predictions out k steps ahead, made after y received
:returns k-vector of residuals
"""
... | 0 | 0 | 0 | 0 | 0 | 0 |
vaas-app/src/vaas/manager/migrations/0003_auto_20210414_1138.py | allegro/vaas | 251 | 161201 | # Generated by Django 3.1.6 on 2021-04-14 09:38
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
('cluster', '0002_logicalcluster_partial_reload'),
('manager', '0002_auto_20210225_1216'),
]
operations: list[object] =... | 0 | 0 | 2 | 0 | 2 | 0 |
tests/test_scoring.py | metasyn/scikeras | 111 | 161204 | import numpy as np
from sklearn.metrics import r2_score as sklearn_r2_score
from tensorflow import convert_to_tensor
from scikeras.wrappers import KerasRegressor
from .mlp_models import dynamic_regressor
def test_kerasregressor_r2_correctness() -> object:
"""Test custom R^2 implementation against scikit-learn'... | 0 | 2 | 0 | 0 | 2 | 0 |
examples/export.py | scanner/osxphotos | 656 | 161223 | <gh_stars>100-1000
""" Export all photos to ~/Desktop/export
If file has been edited, export the edited version,
otherwise, export the original version """
import os.path
import osxphotos
def main():
db = os.path.expanduser("~/Pictures/Photos Library.photoslibrary")
photosdb = osxphotos.PhotosDB(db... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/mask_prediction.py | kiyoungkim1/LMkor | 183 | 161228 | # inspired by https://github.com/renatoviolin/next_word_prediction
import torch
import string
import transformers
transformers.logging.set_verbosity_error()
from transformers import BertTokenizerFast, BertForMaskedLM
bert_tokenizer = BertTokenizerFast.from_pretrained('kykim/bert-kor-base')
bert_model = BertForMasked... | 5 | 3 | 0 | 0 | 8 | 0 |
skyline/functions/database/queries/latest_anomalies.py | datastreaming/skyline-1 | 396 | 161235 | from __future__ import division
import logging
import traceback
from sqlalchemy.sql import select
from database import get_engine, engine_disposal, anomalies_table_meta
# @added 20210420 - Task #4022: Move mysql_select calls to SQLAlchemy
# Add a global method to query the DB for the latest_anomalies
def latest_ano... | 0 | 1 | 0 | 0 | 1 | 0 |
spotty/providers/gcp/helpers/deployment.py | greglira/spotty | 246 | 161282 | <reponame>greglira/spotty
import logging
from collections import OrderedDict
from time import sleep
from httplib2 import ServerNotFoundError
from spotty.commands.writers.abstract_output_writrer import AbstractOutputWriter
from spotty.providers.gcp.resources.instance import Instance
from spotty.providers.gcp.resources.s... | 0 | 0 | 0 | 0 | 0 | 0 |
pixie/plugins/info.py | Discord4Life/ToukaMusic | 158 | 161299 | import discord
from discord.ext import commands
class Info:
"""Info is a class within Pixie that is only for accessing data from discords built in things (Although we add Pixie's status command here)"""
def __init__(self, bot):
self.bot = bot
@commands.command(name="userinfo", pass_context=True... | 1 | 0 | 0 | 0 | 1 | 0 |
osquery/extensions/ExtensionManager.py | eoinmiller-r7/osquery-python | 274 | 161329 | <gh_stars>100-1000
#
# Autogenerated by Thrift Compiler (0.10.0)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
# options string: py
#
from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException
from thrift.protocol.TProtocol import TProtocolException
import s... | 0 | 0 | 0 | 0 | 0 | 0 |
Tools/BlenderExport/ogrepkg/meshexport.py | VonChenPlus/ogre | 701 | 161333 | from __future__ import annotations
"""Mesh and animation export classes.
@author <NAME>
"""
# Copyright (C) 2005 <NAME>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# ver... | 23 | 76 | 3 | 27 | 129 | 0 |
snmpsim/record/sap.py | RuiCunhaM/snmpsim | 298 | 161338 | <filename>snmpsim/record/sap.py<gh_stars>100-1000
#
# This file is part of snmpsim software.
#
# Copyright (c) 2010-2019, <NAME> <<EMAIL>>
# License: http://snmplabs.com/snmpsim/license.html
#
from snmpsim.grammar import sap
from snmpsim.record import dump
class SapRecord(dump.DumpRecord):
grammar = sap.SapGramma... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/utils.py | darkroomdave/sheetfu | 893 | 161427 | <gh_stars>100-1000
import os
from googleapiclient.http import HttpMockSequence
from sheetfu.client import SpreadsheetApp
import json
def mock_google_sheets_responses(fixture_files=None):
"""
Function to mock one or multiple requests to sheets.
:param fixture_files: Fixture file name (must be located in th... | 0 | 0 | 0 | 0 | 0 | 0 |
bazel/third_party_repositories.bzl | windrunner123/sentinel-cpp | 121 | 161443 | <filename>bazel/third_party_repositories.bzl
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")
all_content = """filegroup(name = "all", srcs = glob(["**"]), visibility = ["//visibility:public"])"""
def include_third_party_repositories():
http_archive(
name = "com_github_lib... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/xrdbparser.py | yous/iTerm2-Color-Schemes | 21,573 | 161458 | import os
import re
xrdb_regex = re.compile("(.+)\.[xX][rR][dD][bB]$")
class Xrdb(object):
def __init__(self, filename):
"""Parse an xrdb file"""
self.name = xrdb_regex.match(os.path.basename(filename)).group(1)
self.colors = [None] * 16
color_regex = re.compile("#define +Ansi_... | 0 | 0 | 0 | 0 | 0 | 0 |
src/torchphysics/problem/spaces/__init__.py | TomF98/torchphysics | 203 | 161478 | <reponame>TomF98/torchphysics<gh_stars>100-1000
"""Contains the Spaces and Points classes.
Spaces
It's purpose is to define variable names and dimensions that can
be used in functions, domains, models and more.
Points
The ``Points`` object is a central part of TorchPhysics. They consit of a PyTorch-Tensor
an... | 0 | 0 | 0 | 0 | 0 | 0 |
jorldy/core/agent/double.py | Kyushik/JORLDY | 300 | 161505 | <gh_stars>100-1000
import torch
torch.backends.cudnn.benchmark = True
import torch.nn.functional as F
from .dqn import DQN
class Double(DQN):
def __init__(self, **kwargs):
super(Double, self).__init__(**kwargs)
def learn(self):
transitions = self.memory.sample(self.batch_size)
for k... | 0 | 0 | 0 | 0 | 0 | 0 |
haystack/graph_retriever/__init__.py | agolo/haystack | 4,544 | 161518 | <reponame>agolo/haystack
from haystack.graph_retriever.text_to_sparql import Text2SparqlRetriever
| 0 | 0 | 0 | 0 | 0 | 0 |
office365/sharepoint/search/query/queryAutoCompletionResults.py | wreiner/Office365-REST-Python-Client | 544 | 161534 | from office365.runtime.client_value import ClientValue
class QueryAutoCompletionResults(ClientValue):
pass
| 0 | 0 | 0 | 0 | 0 | 0 |
leetcode.com/python/16_3Sum_Closest.py | XSoyOscar/Algorithms | 713 | 161548 | <reponame>XSoyOscar/Algorithms<filename>leetcode.com/python/16_3Sum_Closest.py
class Solution(object):
def threeSumClosest(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
"""
nums.sort()
triplate = []
prevSum = float("-inf"... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/pytests/unit/beacons/test_service.py | tomdoherty/salt | 9,425 | 161553 | # Python libs
import pytest
# Salt libs
import salt.beacons.service as service_beacon
from tests.support.mock import MagicMock, patch
@pytest.fixture
def configure_loader_modules() -> dict[object,dict[str,dict[object,object]]]:
return {service_beacon: {"__context__": {}, "__salt__": {}}}
def test_non_list_con... | 0 | 1 | 0 | 0 | 1 | 0 |
tha2/nn/base/util.py | luuil/talking-head-anime-2-demo | 626 | 161560 | from typing import Optional
from torch.nn import Module
from tha2.nn.base.init_function import create_init_function
from tha2.nn.base.module_factory import ModuleFactory
from tha2.nn.base.nonlinearity_factory import resolve_nonlinearity_factory
from tha2.nn.base.normalization import NormalizationLayerFactory
... | 10 | 2 | 0 | 0 | 12 | 0 |
Algorithms/Searching & Sorting/Exponential Search/exponential_search.py | strangestroad/interview-techdev-guide | 320 | 161565 | from __future__ import annotations
'''
Implementation of exponential search
Time Complexity: O(logn)
Space Complexity: Depends on implementation of binary_search {O(logn): recursive, O(1):iterative}
Used for unbounded search, when the length of array is infinite or not known
'''
#iterative implementation of binary se... | 0 | 2 | 0 | 0 | 2 | 0 |
tests/client_test.py | jjinno/pygerduty | 144 | 161573 | <gh_stars>100-1000
from __future__ import absolute_import
import httpretty
import pygerduty
import pygerduty.v2
import pytest
###################
# Version 1 Tests #
###################
@httpretty.activate
def test_unknown_subdomain_v1():
httpretty.register_uri(
httpretty.GET, "https://contosso.pagerduty... | 0 | 0 | 0 | 0 | 0 | 0 |
docs_src/path_operation_advanced_configuration/tutorial007.py | jomue/fastapi | 53,007 | 161578 | <filename>docs_src/path_operation_advanced_configuration/tutorial007.py<gh_stars>1000+
from typing import List
import yaml
from fastapi import FastAPI, HTTPException, Request
from pydantic import BaseModel, ValidationError
app = FastAPI()
class Item(BaseModel):
name: str
tags: List[str]
@app.post(
"/i... | 0 | 0 | 0 | 0 | 0 | 0 |
owmeta/data_trans/wormatlas.py | marcodafonseca/PyOpenWorm | 118 | 161588 | <gh_stars>100-1000
import traceback
from rdflib.namespace import Namespace
from owmeta_core.dataobject import ObjectProperty
from owmeta_core.datasource import GenericTranslation
from owmeta_core.data_trans.csv_ds import CSVDataSource, CSVDataTranslator
from .. import CONTEXT
from ..network import Network
from ..wor... | 0 | 0 | 0 | 0 | 0 | 0 |
benchmark/calc_loss.py | scottmcm/fwumious_wabbit | 106 | 161606 | <reponame>scottmcm/fwumious_wabbit
import math
import sys
def calc_loss(model_preds_file, input_file):
model_preds = open(model_preds_file, 'rt')
input = open(input_file, 'rt')
loss = 0.
i = 0
for y_hat in model_preds:
i += 1
y = next(input).split("|")[0].strip()
loss += c... | 0 | 0 | 0 | 0 | 0 | 0 |
Rice-Python-Data-Representations/week2/examples3_listsearch.py | Sam-Gao-Xin/Courses- | 622 | 161608 | """
Searching lists.
"""
toys = ["blocks", "slinky", "fidget spinner", "cards", "doll house", "legos", "blocks", "teddy bear"]
# Finding items in a list
print(toys.index("legos"))
print(toys.index("blocks"))
#print(toys.index("video game"))
print("")
# Checking if items are in a list
print("legos" in toys)
print("b... | 0 | 0 | 0 | 0 | 0 | 0 |
nahamconctf2021/some-really-ordinary-program/exploit2.py | nhtri2003gmail/ctf-write-ups | 101 | 161610 | #!/usr/bin/env python3
# 2 srop version
from pwn import *
binary = context.binary = ELF('./some-really-ordinary-program')
binary.symbols['main'] = 0x401022
binary.symbols['midread'] = 0x401006
if args.REMOTE:
p = remote('challenge.nahamcon.com', 32629)
else:
p = process(binary.path)
syscall = next(binary.search(... | 0 | 0 | 0 | 0 | 0 | 0 |
wyze_sdk/api/base.py | RebelTat/wyze-sdk | 132 | 161671 | import logging
from abc import ABCMeta
from typing import Optional, Sequence
from wyze_sdk.errors import WyzeClientConfigurationError
from wyze_sdk.service import (ApiServiceClient, EarthServiceClient,
GeneralApiServiceClient, PlatformServiceClient,
ScaleServ... | 9 | 9 | 0 | 0 | 18 | 0 |
code_examples/popart/block_sparse/examples/sparse_attention/short_demo.py | payoto/graphcore_examples | 260 | 161674 | <gh_stars>100-1000
# Copyright (c) 2020 Graphcore Ltd. All rights reserved.
import pdb
import os
import numpy as np
from scipy import stats
import ctypes
import popart
from sparse_attention_utils import Heads, Convert
so_path = os.path.join(os.path.dirname(os.path.realpath(__file__)),
"../../cu... | 0 | 0 | 0 | 0 | 0 | 0 |
chazutsu/datasets/movie_review.py | yasufumy/chazutsu | 250 | 161696 | import os
from chazutsu.datasets.framework.xtqdm import xtqdm
from chazutsu.datasets.framework.dataset import Dataset
from chazutsu.datasets.framework.resource import Resource
class MovieReview(Dataset):
def __init__(self, kind="polarity"):
super().__init__(
name="Moview Review Data",
... | 0 | 0 | 0 | 0 | 0 | 1 |
hvplot/sample_data.py | lhoupert/hvplot | 338 | 161723 | <gh_stars>100-1000
"""
Loads hvPlot sample data using intake catalogue.
"""
import os
try:
from intake import open_catalog
except:
raise ImportError('Loading hvPlot sample data requires intake '
'and intake-parquet. Install it using conda or '
'pip before loading da... | 0 | 0 | 0 | 0 | 0 | 0 |
code/data/TUM_RGBD.py | binbin-xu/DeeperInverseCompositionalAlgorithm | 154 | 161740 | from __future__ import annotations
"""
Data loader for TUM RGBD benchmark
@author: <NAME>
@date: March 2019
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import sys, os, random
import pickle
import numpy as np... | 6 | 10 | 1 | 10 | 27 | 0 |
tests/engine/system_test.py | ldelebec/asteroid | 722 | 161741 | <reponame>ldelebec/asteroid<gh_stars>100-1000
from torch import nn, optim
from torch.utils import data
from pytorch_lightning import Trainer
from asteroid.engine.system import System
from asteroid.utils.test_utils import DummyDataset
def test_system():
model = nn.Sequential(nn.Linear(10, 10), nn.ReLU())
opti... | 0 | 0 | 0 | 0 | 0 | 0 |
MediaConvert-JobProgressMetrics/pipeline-base/event_collector.py | kwekuq/aws-media-services-vod-automation | 129 | 161780 | #!/usr/bin/env python3.6
from __future__ import annotations
import boto3
import datetime
import json
import time
import decimal
from botocore.client import ClientError
from boto3 import resource
from boto3.dynamodb.conditions import Key
import logging
import subprocess
#import urllib
from urllib.parse import urlparse
i... | 0 | 10 | 0 | 0 | 10 | 0 |
contrib/play/tripler.py | Rosencrantz/aleph | 1,213 | 161786 | from banal import ensure_list
from rdflib import Namespace, ConjunctiveGraph, URIRef, Literal
from rdflib.namespace import FOAF, DC, RDF, RDFS, SKOS
from followthemoney import model
from pprint import pprint
from elasticsearch import Elasticsearch
from elasticsearch.helpers import scan
es = Elasticsearch()
collection... | 0 | 0 | 0 | 0 | 0 | 0 |
projects/TGS_salt/DingHan/data/DingHan/seresnet50/model_resnet50_bn.py | liaopeiyuan/ml-arsenal-public | 280 | 161851 | from common import *
# https://github.com/pytorch/vision/blob/master/torchvision/models/resnet.py
# resnet18 : BasicBlock, [2, 2, 2, 2]
# resnet34 : BasicBlock, [3, 4, 6, 3]
# resnet50 : Bottleneck [3, 4, 6, 3]
#
# https://medium.com/neuromation-io-blog/deepglobe-challenge-three-papers-from-neuromation-accepte... | 7 | 8 | 0 | 0 | 15 | 0 |
analytics/tests/test_activity_views.py | dumpmemory/zulip | 17,004 | 161868 | <reponame>dumpmemory/zulip
from unittest import mock
from django.utils.timezone import now as timezone_now
from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.test_helpers import queries_captured
from zerver.models import Client, UserActivity, UserProfile, flush_per_request_caches
class ActivityTest(Z... | 0 | 0 | 0 | 0 | 0 | 0 |
2011_03_04/count_and_say.py | samisafatli/dojo | 114 | 161885 | def count_and_say(palavra) -> object:
dicionario = {}
palavra = palavra.replace(' ', '')
for letra in palavra:
if not letra in dicionario.keys():
dicionario[letra] = 1
else:
dicionario[letra] += 1
retorno = ''
for letra, quantidade in diciona... | 0 | 1 | 0 | 0 | 1 | 0 |
recipes/Python/577380_Dragon_Lexical_Analyzer/recipe-577380.py | tdiprima/code | 2,023 | 161890 | <filename>recipes/Python/577380_Dragon_Lexical_Analyzer/recipe-577380.py
import sys
import os
EOF = ""
def get_num():
digits = []
t = getchar()
while t.isdigit():
digits.append(t)
t = getchar()
if t != EOF:
ungetc(t)
num = int("".join(digits))
return num
def get_word(... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/CompileTests/Python_tests/test2011_020.py | maurizioabba/rose | 488 | 161898 | # test comments
| 0 | 0 | 0 | 0 | 0 | 0 |
google/ads/googleads/errors.py | wxxlouisa/google-ads-python | 285 | 161906 | # Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 0 | 0 | 0 | 0 | 0 | 0 |
web/__init__.py | pwh19920920/spiders | 390 | 161945 | from ._response import response
| 0 | 0 | 0 | 0 | 0 | 0 |
novmpy.py | j0hnBlk/NoVmpy | 187 | 161950 | <filename>novmpy.py
# idapython fix <= 7.6
# DO NOT REMOVE ME
import sys
sys.stdout.encoding = 'utf-8'
# for test
# ida_loader.load_plugin('F:/NoVmpy/novmpy.py')
import idaapi
NOVMPY_VERSION = "0.1"
class NoVmpyPlugin(idaapi.plugin_t):
flags = 0
comment = ""
help = ""
wanted_name = "NoVmpy"
wan... | 0 | 0 | 0 | 0 | 0 | 0 |
Chapter10/external_api.py | yoyboy/Software-Architecture-with-Python | 103 | 161987 | <reponame>yoyboy/Software-Architecture-with-Python
# Code Listing #6
"""
Showing how to debug programs with external dependencies such as an API
Note: This code is only for illustrative purposes and is not executable.
"""
import external_api
def process(json_data, skey='suspect_key',svalue='suspect_value'):
""... | 0 | 0 | 0 | 0 | 0 | 0 |
tfx/experimental/templates/taxi/e2e_tests/vertex_e2e_test.py | micahjsmith/tfx | 1,813 | 161995 | # Copyright 2020 Google LLC. 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 a... | 2 | 2 | 2 | 0 | 6 | 0 |
tests/cluecode/data/ics/chromium-testing-gmock-scripts/upload.py | s4-2/scancode-toolkit | 1,511 | 162003 | #!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); | 0 | 0 | 0 | 0 | 0 | 0 |
tutorials/tutorial-3-mrdmd.py | mfarthin/PyDMD | 451 | 162012 | <reponame>mfarthin/PyDMD
# Tutorial 3: Multiresolution DMD: different time scales
# In this tutorial we will show the possibilities of the multiresolution dynamic modes decomposition (mrDMD) with respect to the classical DMD. We follow a wonderful blog post written by <NAME> [available here](http://www.pyrunner.com/... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/align.py | JohnVillalovos/subaligner | 227 | 162045 | import os
from subaligner.predictor import Predictor
from subaligner.subtitle import Subtitle
if __name__ == "__main__":
examples_dir = os.path.dirname(os.path.abspath(__file__))
output_dir = os.path.join(examples_dir, "tmp")
os.makedirs(output_dir, exist_ok=True)
video_file_path = os.path.join(example... | 0 | 0 | 0 | 0 | 0 | 0 |
src/random_string.py | leftbrainstuff/amazon-transcribe-comprehend-podcast | 122 | 162143 | from __future__ import annotations
import boto3
import random
import string
import uuid
import httplib
import urlparse
import json
import base64
import hashlib
"""
If included in a Cloudformation build as a CustomResource, generate a random string of length
given by the 'length' parameter.
By default the character set... | 2 | 2 | 0 | 0 | 4 | 0 |
net/views/search.py | juandesant/astrometry.net | 460 | 162172 | from django.shortcuts import get_object_or_404, redirect, render
from django.template import Context, RequestContext
from django import forms
from django.db.models import Count
try:
# py3
from urllib.parse import urlencode
except ImportError:
# py2
from urllib import urlencode
from astrometry.net.mode... | 0 | 2 | 0 | 0 | 2 | 0 |
tfquery/utils.py | mazen160/tfquery | 262 | 162181 | <filename>tfquery/utils.py
#!/usr/env python3
from os import listdir
from os.path import isfile
from os.path import join
import json
import logging
import tfquery.tfstate as tfstate
from tfquery.sql_handler import SQLHandler
def get_all_tfstates(dir):
onlyfiles = [join(dir, f) for f in listdir(dir) if isfile(jo... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_data/test_datasets/test_sot_test_dataset.py | kevin3314/mmtracking | 2,226 | 162182 | # Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
import tempfile
import mmcv
import numpy as np
import pytest
from mmtrack.datasets import DATASETS as DATASETS
PREFIX = osp.join(osp.dirname(__file__), '../../data')
LASOT_ANN_PATH = f'{PREFIX}/demo_sot_data/lasot'
@pytest.mark.parametrize('data... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/SampleApps/python/flask-app/app.py | samruddhikhandale/Oryx | 403 | 162205 | from flask import Flask
from datetime import datetime
from flask import current_app
app = Flask(__name__)
@app.route("/")
def hello() -> object:
return "Hello World! " + str(datetime.now())
@app.route("/applicationpath")
def applicationPath() -> object:
return current_app.root_path
| 0 | 2 | 0 | 0 | 2 | 0 |
source_code/3-3-practice-download-images.py | VickyMin1994/easy-scraping-tutorial | 708 | 162226 | <reponame>VickyMin1994/easy-scraping-tutorial
from bs4 import BeautifulSoup
import requests
import os
os.makedirs('./img/', exist_ok=True)
URL = "http://www.nationalgeographic.com.cn/animals/"
html = requests.get(URL).text
soup = BeautifulSoup(html, 'lxml')
img_ul = soup.find_all('ul', {"class": "img_list"})
for ul ... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/local/independent/test_measurement_str.py | pgoslatara/soda-sql | 787 | 162264 | # Copyright 2020 Soda
# 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
#... | 0 | 0 | 0 | 0 | 0 | 0 |
ncclient/operations/third_party/h3c/rpc.py | NorthLandTeam/ncclient | 498 | 162299 | # -*- coding: utf-8 -*-
# by yangxufeng.zhao
from __future__ import annotations
from ncclient.xml_ import *
from ncclient.operations import util
from ncclient.operations.rpc import RPC
class GetBulk(RPC):
"The *get-bulk* RPC."
def request(self, filter: object | None=None) -> object:
"""Retrieve run... | 7 | 7 | 0 | 0 | 14 | 0 |
vega/networks/pytorch/losses/smooth_l1_loss.py | jie311/vega | 724 | 162303 | <filename>vega/networks/pytorch/losses/smooth_l1_loss.py
# -*- 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 wil... | 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.