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 |
|---|---|---|---|---|---|---|---|---|---|---|
packages/jet_bridge_base/jet_bridge_base/fields/json.py | KrunchMuffin/jet-bridge | 1,247 | 148904 | from __future__ import absolute_import
import json
from six import string_types
from jet_bridge_base.fields.field import Field
class JSONField(Field):
field_error_messages: dict[str,str] = {
'invalid': 'not a valid JSON'
}
def to_internal_value_item(self, value) -> object:
if isinstance... | 0 | 2 | 1 | 0 | 3 | 0 |
irc/client_aio.py | kratz00/irc | 362 | 148911 | # -*- coding: utf-8 -*-
"""
Internet Relay Chat (IRC) asyncio-based protocol client library.
This an extension of the IRC client framework in irc.client that replaces
original select-based event loop with one that uses Python 3's native
asyncio event loop.
This implementation shares many of the features of its selec... | 0 | 0 | 0 | 0 | 0 | 0 |
data_capture/schedules/region_3.py | mepsd/CLAC | 126 | 148918 | import xlrd
import functools
from django import forms
from django.core.exceptions import ValidationError
from django.template.loader import render_to_string
from .base import (BasePriceList, hourly_rates_only_validator,
min_price_validator)
from .spreadsheet_utils import generate_column_index_map, ... | 0 | 11 | 3 | 0 | 14 | 0 |
msvc/libpsl-pc.py | kloczek/libpsl | 102 | 148941 | # !/usr/env/python
# Simple script to generate libpsl.pc from libpsl.pc.in
# for Visual Studio builds
import sys
import argparse
from replace import replace_multi
from pc_base import BasePCItems
def main(argv) -> int:
parser = argparse.ArgumentParser(description='Setup basic libpsl.pc file info')
... | 0 | 1 | 0 | 0 | 1 | 0 |
examples/bigquery-cross-project-slot-monitoring/tests/helpers_test.py | ruchirjain86/professional-services | 2,116 | 148955 | <gh_stars>1000+
# Copyright 2018 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | 0 | 0 | 0 | 0 | 0 | 0 |
Algorithms/Graph_Algorithms/articulation_points.py | arslantalib3/algo_ds_101 | 182 | 148963 | <filename>Algorithms/Graph_Algorithms/articulation_points.py
from collections import defaultdict
class Graph:
def __init__(self,vertices):
self.V= vertices #No. of vertices
self.graph = defaultdict(list) # default dictionary to store graph
self.Time = 0
# function to add an edge to graph
def addEdge(self,... | 0 | 0 | 0 | 0 | 0 | 0 |
kratos/python_scripts/response_functions/response_function_interface.py | lkusch/Kratos | 778 | 149013 | class ResponseFunctionInterface(object):
"""
This response function interface provides a unique interface for all possible ways
to calculate the value and gradient of a response.
The interface is designed to be used in e.g. optimization, where the value and gradient
of a response is required, howev... | 0 | 1 | 0 | 0 | 1 | 0 |
ochopod/bindings/generic/marathon.py | autodesk-cloud/ochopod | 139 | 149029 | #
# Copyright (c) 2015 Autodesk 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 applicable l... | 0 | 2 | 0 | 0 | 2 | 0 |
honcho/compat.py | laobaox/honcho | 1,079 | 149073 | """
Compatibility layer and utilities, mostly for proper Windows and Python 3
support.
"""
import sys
# This works for both 32 and 64 bit Windows
ON_WINDOWS = 'win32' in str(sys.platform).lower()
| 0 | 0 | 0 | 0 | 0 | 0 |
keystone/common/sql/expand_repo/versions/034_expand_add_application_credential_table.py | ferag/keystone | 615 | 149092 | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/simple-skill.py | WPettersson/rhasspy | 944 | 149099 | <gh_stars>100-1000
#!/usr/bin/env python3
import json
# pip install paho-mqtt
import paho.mqtt.client as mqtt
def on_connect(client, userdata, flags, rc):
"""Called when connected to MQTT broker."""
client.subscribe("hermes/intent/#")
client.subscribe("hermes/nlu/intentNotRecognized")
print("Connecte... | 0 | 0 | 0 | 0 | 0 | 0 |
Validation/Mixing/test/testsuite_SmartPointers_cfg.py | ckamtsikis/cmssw | 852 | 149107 | import FWCore.ParameterSet.Config as cms
from SimGeneral.MixingModule.mixObjects_cfi import *
process = cms.Process("PRODVAL1")
process.load("DQM.SiStripCommon.DaqMonitorROOTBackEnd_cfi")
process.RandomNumberGeneratorService = cms.Service("RandomNumberGeneratorService",
moduleSeeds = cms.PSet(
mix = cms.... | 0 | 0 | 0 | 0 | 0 | 0 |
opy/_regtest/src/osh/arith_parse.py | Schweinepriester/oil | 2,209 | 149110 | #!/usr/bin/env python
"""
arith_parse.py - Parse shell arithmetic, which is based on C.
"""
from core import tdop
from core import util
from osh.meta import Id
from core import word
from osh.meta import ast
p_die = util.p_die
def NullIncDec(p, w, bp) -> object:
""" ++x or ++x[1] """
right = p.ParseUntil(bp)
c... | 0 | 8 | 0 | 0 | 8 | 0 |
src/genie/libs/parser/junos/tests/Ping/cli/equal/golden_output_2_expected.py | balmasea/genieparser | 204 | 149174 | <gh_stars>100-1000
expected_output = {
"ping": {
"address": "2001:db8:223c:2c16::2",
"data-bytes": 56,
"result": [
{
"bytes": 16,
"from": "2001:db8:223c:2c16::2",
"hlim": 64,
"icmp-seq": 0,
"time": "9... | 0 | 0 | 0 | 0 | 0 | 0 |
mitmproxy/contentviews/image/view.py | KarlParkinson/mitmproxy | 24,939 | 149206 | import imghdr
from typing import Optional
from mitmproxy.contentviews import base
from mitmproxy.coretypes import multidict
from . import image_parser
def test_ico(h, f) -> str:
if h.startswith(b"\x00\x00\x01\x00"):
return "ico"
imghdr.tests.append(test_ico)
class ViewImage(base.View):
name: str ... | 2 | 3 | 1 | 0 | 6 | 0 |
controller/credentials_controller.py | Chandru01061997/pythonDB | 409 | 149215 | from __future__ import annotations
import os
from flask import Blueprint, request
from flask_cors import CORS
from service.astra_service import astra_service
credentials_controller = Blueprint('credentials_controller', __name__)
CORS(credentials_controller)
# This controller handles the functionality for connectin... | 0 | 2 | 0 | 0 | 2 | 0 |
pyjobs/assessment/managers.py | Mdslino/PyJobs | 132 | 149222 | from django.db import models
from django.db.models.functions import Cast
class AssessmentQuerySet(models.QuerySet):
def assessment_grade(self, user, assessment) -> object:
all_answers = self.filter(
user=user,
question__assessment=assessment,
)
correct_answers = all... | 1 | 3 | 0 | 0 | 4 | 0 |
collectfast/tests/utils.py | jezdez/collectfast | 267 | 149234 | import functools
import os
import pathlib
import random
import unittest
import uuid
from typing import Any
from typing import Callable
from typing import Type
from typing import TypeVar
from typing import cast
import pytest
from django.conf import settings as django_settings
from django.utils.module_loading import imp... | 9 | 11 | 1 | 0 | 21 | 0 |
angr/engines/pcode/arch/ArchPcode_MIPS_LE_32_default.py | matthewpruett/angr | 6,132 | 149241 | <reponame>matthewpruett/angr
###
### This file was automatically generated
###
from archinfo.arch import register_arch, Endness, Register
from .common import ArchPcode
class ArchPcode_MIPS_LE_32_default(ArchPcode):
name = 'MIPS:LE:32:default'
pcode_arch = 'MIPS:LE:32:default'
description = 'MIPS32 32-bi... | 0 | 0 | 0 | 0 | 0 | 0 |
release/stubs.min/System/__init___parts/IAsyncResult.py | htlcnn/ironpython-stubs | 182 | 149250 | <gh_stars>100-1000
class IAsyncResult:
""" Represents the status of an asynchronous operation. """
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
AsyncState=property(lambda self: ... | 0 | 0 | 0 | 0 | 0 | 0 |
test_python_toolbox/test_math_tools/test_convert_to_base_in_tuple.py | hboshnak/python_toolbox | 119 | 149289 | # Copyright 2009-2017 <NAME>.
# This program is distributed under the MIT license.
'''Testing module for `python_toolbox.math_tools.convert_to_base_in_tuple`.'''
import sys
from python_toolbox.math_tools import convert_to_base_in_tuple
from python_toolbox import cute_testing
def test():
assert convert_to_base_... | 0 | 0 | 0 | 0 | 0 | 0 |
ctools/worker/learner/comm/flask_fs_learner.py | XinyuJing/DI-star | 267 | 149291 | import os
import sys
import time
import traceback
import torch
from queue import Queue
import requests
from typing import List
from functools import partial
from ctools.utils import read_file, save_file, get_rank, get_world_size, get_data_decompressor, remove_file, broadcast
from .base_comm_learner import BaseCommLea... | 10 | 14 | 0 | 2 | 26 | 0 |
http_prompt/options.py | ScriptBox99/http-prompt | 8,477 | 149297 | """Meta data for HTTPie options."""
FLAG_OPTIONS = [
('--body', 'Print only response body'),
('--check-status', 'Check HTTP status code'),
('--continue', 'Resume an interrupted download'),
('--debug', 'Print debug information'),
('--download', 'Download as a file'),
('--follow', 'Allow full red... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/fuzz/run.py | Bladez1753/lightning | 2,288 | 149303 | #!/usr/bin/env python3
import argparse
import logging
import os
import re
import subprocess
from concurrent.futures import ThreadPoolExecutor, as_completed
def job(command):
"""Takes a list of str, and runs it as a subprocess."""
command_line = " ".join(command)
logging.debug(f"Running '{command_line}'\n... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/578485_First_Class_Enums_in_Python/recipe-578485.py | tdiprima/code | 2,023 | 149306 | #!/usr/bin/env python
def enum(*names):
"""A true immutable symbolic enumeration with qualified value access."""
class EnumValue(object):
__slots__ = ("type", "value",)
def __init__(self, type, value):
self.type = type
self.value = value
def __hash__(self):
... | 0 | 0 | 0 | 0 | 0 | 0 |
llluiop/0007/CodeLine.py | saurabh896/python-1 | 3,976 | 149321 | <filename>llluiop/0007/CodeLine.py<gh_stars>1000+
#!/usr/bin.env python
import os
def main():
f = open('code.cpp')
blanks = 0
comments = 0
lines = 0
for line in f.readlines():
if len(line.split()) == 0:
blanks += 1
elif line.startswith("//"):
comments += 1... | 0 | 0 | 0 | 0 | 0 | 0 |
icecream/__version__.py | dawngerpony/icecream | 5,823 | 149329 | # -*- coding: utf-8 -*-
#
# IceCream - Never use print() to debug again
#
# <NAME>
# grunseid.com
# <EMAIL>
#
# License: MIT
#
__title__ = 'icecream'
__license__ = 'MIT'
__version__ = '2.1.1'
__author__ = '<NAME>'
__contact__ = '<EMAIL>'
__url__ = 'https://github.com/gruns/icecream'
__description__ = (
'Never use... | 0 | 0 | 0 | 0 | 0 | 0 |
tfne/visualizer/codeepneat/tfnev_codeepneat_mainwindow_ui.py | githealthy18/Tensorflow-Neuroevolution | 121 | 149352 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'tfnev_codeepneat_mainwindow_ui.ui'
#
# Created by: PyQt5 UI code generator 5.15.0
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from Py... | 0 | 0 | 0 | 0 | 0 | 0 |
testall.py | Krande/CalculiX-Examples | 177 | 149361 | <gh_stars>100-1000
#!/usr/bin/python
"""execute all test scripts in the example collection"""
import os, fnmatch, multiprocessing
# Enable multithreading for ccx
os.environ['OMP_NUM_THREADS'] = str(multiprocessing.cpu_count())
# Locate all files matching supplied filename pattern in and below
# current directory.
cou... | 0 | 0 | 0 | 0 | 0 | 0 |
.azure-pipelines/testCreateEnv.py | moritzschaefer/snakepipes | 256 | 149368 | #!/usr/bin/env python
import subprocess as sp
import sys
import argparse
sys.path.append("..")
from snakePipes import common_functions as cf
def parse_args() -> object:
parser = argparse.ArgumentParser()
required = parser.add_argument_group('Required Arguments')
required.add_argument("-d",
... | 0 | 1 | 0 | 0 | 1 | 0 |
powerdnsadmin/models/history.py | turip/PowerDNS-Admin | 1,431 | 149418 | <filename>powerdnsadmin/models/history.py
import traceback
from flask import current_app
from datetime import datetime
from .base import db
class History(db.Model):
id = db.Column(db.Integer, primary_key=True)
msg = db.Column(db.String(256))
# detail = db.Column(db.Text().with_variant(db.Text(length=2**... | 0 | 0 | 0 | 0 | 0 | 0 |
sahara/service/edp/job_binaries/manila/implementation.py | ksshanam/sahara | 161 | 149440 | <reponame>ksshanam/sahara<gh_stars>100-1000
# Copyright (c) 2017 OpenStack Foundation
#
# 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
#
# Unl... | 0 | 0 | 0 | 0 | 0 | 0 |
res/PyTorchExamples/examples/RNN-noinit/__init__.py | chogba6/ONE | 255 | 149501 | import torch
import torch.nn as nn
_input_size = 4
_seq_len = 2
_batch = 3
_hidden_size = 3
# model
class net_RNN(nn.Module):
def __init__(self):
super().__init__()
self.op = nn.RNN(_input_size, _hidden_size, 1)
def forward(self, input) -> object:
return self.op(input)
_model_ = ne... | 0 | 1 | 0 | 0 | 1 | 0 |
src/apps/datatables/models/draw_request_column_filter.py | RogerTangos/datahub-stub | 192 | 149517 | <filename>src/apps/datatables/models/draw_request_column_filter.py
'''
Represents a single filter on a column.
'''
class DrawRequestColumnFilter:
'''
Initialize the filter with the column name, filter text,
and operation (must be "=", "<=", ">=", "<", ">", or "!=").
'''
def __init__(self, column_nam... | 0 | 0 | 0 | 0 | 0 | 0 |
rllib/examples/action_masking.py | linyiyue/ray | 21,382 | 149526 | import argparse
from gym.spaces import Box, Discrete
import os
from ray.rllib.examples.env.action_mask_env import ActionMaskEnv
from ray.rllib.examples.models.action_mask_model import \
ActionMaskModel, TorchActionMaskModel
parser = argparse.ArgumentParser()
parser.add_argument(
"--run",
type=str,
def... | 0 | 0 | 0 | 0 | 0 | 0 |
homeassistant/components/cloudflare/const.py | MrDelik/core | 30,023 | 149535 | <reponame>MrDelik/core<filename>homeassistant/components/cloudflare/const.py
"""Constants for Cloudflare."""
DOMAIN = "cloudflare"
# Config
CONF_RECORDS = "records"
# Defaults
DEFAULT_UPDATE_INTERVAL = 60 # in minutes
# Services
SERVICE_UPDATE_RECORDS = "update_records"
| 0 | 0 | 0 | 0 | 0 | 0 |
Src/StdLib/Lib/test/crashers/compiler_recursion.py | cwensley/ironpython2 | 2,557 | 149543 | """
The compiler (>= 2.5) recurses happily.
"""
compile('()'*9**5, '?', 'exec')
| 0 | 0 | 0 | 0 | 0 | 0 |
learn2learn/vision/datasets/tiered_imagenet.py | Brikwerk/learn2learn | 1,774 | 149551 | <reponame>Brikwerk/learn2learn<gh_stars>1000+
#!/usr/bin/env python3
import os
import io
import pickle
import tarfile
import numpy as np
import torch
import torch.utils.data as data
from PIL import Image
from learn2learn.data.utils import download_file_from_google_drive
class TieredImagenet(data.Dataset):
"""... | 0 | 0 | 0 | 0 | 0 | 0 |
setup.py | bohniti/tormentor | 101 | 149556 | #import setuptools
from setuptools import setup, Extension
from distutils.util import convert_path
main_ns = {}
ver_path = convert_path('tormentor/version.py')
with open(ver_path) as ver_file:
exec(ver_file.read(), main_ns)
setup(
name='tormentor',
version=main_ns['__version__'],
packages=['tormentor'... | 0 | 0 | 0 | 0 | 0 | 0 |
aiogram_dialog/widgets/utils.py | bkvalexey/aiogram_dialog | 198 | 149575 | from typing import Union, Sequence, Tuple, Callable, Dict, List
from .data.data_context import DataGetter, StaticGetter, CompositeGetter
from .input import MessageHandlerFunc, BaseInput, MessageInput
from .kbd import Keyboard, Group
from .media import Media
from .text import Multi, Format, Text
from .widget_event impo... | 6 | 6 | 0 | 0 | 12 | 0 |
sdk/python/pulumi_azure/logicapps/get_workflow.py | ScriptBox99/pulumi-azure | 109 | 149582 | <reponame>ScriptBox99/pulumi-azure
# 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, Seque... | 0 | 0 | 0 | 0 | 0 | 0 |
torba/torba/tasks.py | mittalkartik2000/lbry-sdk | 4,076 | 149589 | from __future__ import annotations
from asyncio import Event, get_event_loop
class TaskGroup:
def __init__(self, loop: object | None=None):
self._loop = loop or get_event_loop()
self._tasks: set[object] = set()
self.done = Event()
def add(self, coro) -> object:
task = self._l... | 1 | 1 | 0 | 1 | 3 | 0 |
shot_profile_variance/shot_profile_with_orbd_and_fouls_sim.py | airalcorn2/NBA_Tutorials | 123 | 149603 | from __future__ import annotations
import random
import pandas as pd
shots = 90
ot_shots = 10
##########
# Team 1 #
##########
team1 = {
'2pt rate': .80,
'3pt rate': .20,
'2pt%': .50,
'3pt%': .33333,
'orbd': .225,
'foul3': .015,
'foul2': .057,
'ft%': .77
}
##########
# Team 2 #
#####... | 0 | 3 | 0 | 0 | 3 | 0 |
sagemaker-experiments/track-an-airflow-workflow/code/train.py | jerrypeng7773/amazon-sagemaker-examples | 2,610 | 149611 | # Copyright 2018 Amazon.com, Inc. or its 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file acc... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/components/honeywell/test_init.py | andersop91/core | 22,481 | 149615 | """Test honeywell setup process."""
from unittest.mock import create_autospec, patch
import somecomfort
from homeassistant.config_entries import ConfigEntryState
from homeassistant.core import HomeAssistant
from tests.common import MockConfigEntry
@patch("homeassistant.components.honeywell.UPDATE_LOOP_SLEEP_TIME"... | 6 | 2 | 0 | 0 | 8 | 0 |
Scripts/sims4communitylib/enums/sim_type.py | ColonolNutty/Sims4CommunityLibrary | 118 | 149649 | """
The Sims 4 Community Library is licensed under the Creative Commons Attribution 4.0 International public license (CC BY 4.0).
https://creativecommons.org/licenses/by/4.0/
https://creativecommons.org/licenses/by/4.0/legalcode
Copyright (c) COLONOLNUTTY
"""
from typing import Tuple
from sims4communitylib.enums.enum... | 3 | 1 | 185 | 0 | 189 | 0 |
scripts/gdb/get_frame_sizes.py | ramonbrugman/SunriseOS | 177 | 149675 | import gdb
class GetFrameSizesCommand(gdb.Command):
"""Gets the size of each frame, and of the whole stack.
Useful debugging tool to find out which functions have a fat stackframe.
"""
def __init__(self):
super(GetFrameSizesCommand, self).__init__(
"get-frame-sizes",
... | 0 | 0 | 0 | 0 | 0 | 0 |
emlearn/tools/__init__.py | Brax94/emlearn | 161 | 149727 |
from . import mel_filterbank
from . import window_function
| 0 | 0 | 0 | 0 | 0 | 0 |
benchmark/test/test_metrics_parser.py | stackriot/flocker | 2,690 | 149750 | <gh_stars>1000+
# Copyright 2016 ClusterHQ Inc. See LICENSE file for details.
from benchmark.metrics_parser import (
mean, container_convergence, cpu_usage_for_process,
wallclock_for_operation, request_latency, handle_cputime_metric,
handle_wallclock_metric
)
from flocker.testtools import TestCase
class... | 0 | 0 | 0 | 0 | 0 | 0 |
Tree/1409. Queries on a Permutation With Key.py | beckswu/Leetcode | 138 | 149754 | class Solution:
def processQueries(self, queries: List[int], m: int) -> List[int]:
mp = [i for i in range(1, m+1)]
res = []
for i, v in enumerate(queries):
j = mp.index(v)
#print(v,j)
res += j,
del mp[j]
mp.insert(0, v)
ret... | 0 | 0 | 0 | 0 | 0 | 0 |
ansible/roles/lib_openshift_3.2/build/src/oc_secret.py | fahlmant/openshift-tools | 164 | 149761 | # pylint: skip-file
from __future__ import annotations
import base64
# pylint: disable=too-many-arguments
class Secret(OpenShiftCLI):
''' Class to wrap the oc command line tools
'''
def __init__(self,
namespace,
secret_name: object | None=None,
decode: bo... | 10 | 5 | 0 | 0 | 15 | 0 |
core/roslib/test/test_roslib_stacks.py | mcx/ros | 2,051 | 149762 | <reponame>mcx/ros
# Software License Agreement (BSD License)
#
# Copyright (c) 2009, <NAME>, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retai... | 0 | 0 | 0 | 0 | 0 | 0 |
google/cloud/forseti/common/util/rule_validator.py | aarontp/forseti-security | 921 | 149809 | # Copyright 2017 The Forseti Security 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
#
# Unless required by ap... | 0 | 1 | 0 | 0 | 1 | 0 |
WebMirror/management/rss_parser_funcs/feed_parse_extractDustToRust.py | fake-name/ReadableWebProxy | 193 | 149816 | <filename>WebMirror/management/rss_parser_funcs/feed_parse_extractDustToRust.py
def extractDustToRust(item):
"""
Parser for 'Dust to Rust'
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or 'preview' in item['title'].lower():
return None
if 'Kyuuketsu Hime' in i... | 0 | 0 | 0 | 0 | 0 | 0 |
Allura/allura/ext/search/search_main.py | rohankumardubey/allura | 113 | 149827 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (t... | 2 | 4 | 4 | 0 | 10 | 0 |
setup.py | jermp/tongram | 116 | 149842 | <reponame>jermp/tongram
from setuptools import setup
from distutils.core import Extension
module = Extension('tongrams',
define_macros = [('MAJOR_VERSION', '1'),
('MINOR_VERSION', '0')],
include_dirs = ['./include', './external/emphf', './ext... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/sqlflowdsl/nodes.py | lqkweb/sqlflow | 152 | 149880 | # coding=utf-8
from __future__ import annotations
class NodeType:
select: str = 'SELECT'
insert: str = 'INSERT'
delete: str = 'DELETE'
update: str = 'UPDATE'
train: str = 'TRAIN'
register: str = 'REGISTER'
load: str = 'LOAD'
save: str = 'SAVE'
connect: str = 'CONNECT'
set: str ... | 2 | 4 | 25 | 0 | 31 | 0 |
auto_editor/utils/video.py | brighteyed/auto-editor | 835 | 149885 | <reponame>brighteyed/auto-editor
'''utils/video.py'''
# Internal Libraries
import os
from shutil import move
# Included Libraries
from .func import fnone
from auto_editor.render.audio import make_new_audio
def handle_audio_tracks(ffmpeg, write_file, args, a_tracks, chunks, speeds, fps, temp,
log):
for t in r... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/lint.py | OwenDeng1993/Husky | 117 | 149915 | #!/usr/bin/env python
from __future__ import annotations
import getopt
import os
import subprocess
import sys
CPPLINT_PY = os.path.dirname(os.path.abspath(__file__)) + '/cpplint.py'
CPPLINT_EXTENSIONS = ['cpp', 'hpp', 'tpp']
CPPLINT_FILTERS = ['-whitespace/indent', '-runtime/references', '+build/include_alpha', '-bu... | 2 | 2 | 0 | 0 | 4 | 0 |
make_with_masked.py | nishihara-tm/inappropriate-words-ja | 110 | 149977 | <gh_stars>100-1000
import sys
import os
import argparse
def make_masked(args):
source_file_path = os.path.join(os.path.dirname(__file__), args.filename)
word_list = set()
with open(source_file_path,"r",encoding="utf-8") as f:
words = f.read().split("\n")
for w in words:
if len(... | 0 | 0 | 0 | 0 | 0 | 0 |
python/tests/test_random.py | mbp28/ecole | 234 | 149997 | <gh_stars>100-1000
import copy
import pickle
import ecole
def test_RandomEngine():
"""Test bindings of the RandomEngine."""
assert ecole.RandomEngine.min_seed < ecole.RandomEngine.max_seed
random_engine = ecole.RandomEngine(42)
rand_val_1 = random_engine()
assert isinstance(rand_val_1, int)
... | 0 | 0 | 0 | 0 | 0 | 0 |
misc/arg_handler.py | ltnguyen14/Quant_stock | 168 | 150025 | <filename>misc/arg_handler.py
import argparse
from pipeline import backtest
from pipeline.backtest import TestStrategy
from pipeline.strategies.ff_strat import FeedforwardStrategy
from scripts import feedforward_nn, recurrent_lstm, ConvNet
from scripts import data_process as dp
from misc.graph import graph
def arg_pa... | 0 | 0 | 0 | 0 | 0 | 0 |
flask_dance/utils.py | kerryhatcher/flask-dance | 836 | 150034 | from __future__ import annotations
import functools
from datetime import datetime
try:
from datetime import timezone
utc = timezone.utc
except ImportError:
from datetime import timedelta, tzinfo
class UTC(tzinfo):
def utcoffset(self, dt) -> object:
return timedelta(0)
de... | 2 | 9 | 0 | 0 | 11 | 0 |
megatron/data/distdata.py | adammoody/Megatron-DeepSpeed | 106 | 150045 | from __future__ import annotations
import os
import numpy as np
import torch
import torch.nn.functional as F
import torch.distributed as dist
class DistDataError(Exception):
"""Defines an empty exception to throw when some other rank hit a real exception."""
pass
class DistData(object):
def __init__(self... | 7 | 9 | 0 | 0 | 16 | 0 |
aztk/client/job/helpers/submit.py | Geims83/aztk | 161 | 150055 | from datetime import timedelta
import azure.batch.models as batch_models
from aztk import models
from aztk.utils import constants, helpers
def submit_job(
core_job_operations,
job_configuration,
start_task,
job_manager_task,
autoscale_formula,
software_metadata_key: s... | 1 | 1 | 0 | 0 | 2 | 0 |
paas-ce/paas/esb/esb/bkauth/validators.py | renmcc/bk-PaaS | 767 | 150061 | <reponame>renmcc/bk-PaaS
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not u... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/hachoir/parser/network/__init__.py | 0x20Man/Watcher3 | 320 | 150068 | from hachoir.parser.network.tcpdump import TcpdumpFile # noqa
| 0 | 0 | 0 | 0 | 0 | 0 |
vumi/transports/vumi_bridge/tests/test_vumi_bridge.py | praekelt/vumi | 199 | 150071 | import json
import os
from twisted.internet.defer import inlineCallbacks, returnValue, DeferredQueue
from twisted.internet.task import Clock
from twisted.web.client import Agent
from twisted.web.server import NOT_DONE_YET
import certifi
from vumi.message import TransportUserMessage
from vumi.tests.fake_connection im... | 2 | 4 | 1 | 0 | 7 | 0 |
src/pyhf/optimize/common.py | Saransh-cpp/pyhf | 188 | 150116 | <filename>src/pyhf/optimize/common.py
"""Common Backend Shim to prepare minimization for optimizer."""
from pyhf import get_backend
from pyhf.tensor.common import _TensorViewer
def _make_stitch_pars(tv=None, fixed_values=None):
"""
Construct a callable to stitch fixed parameter values into the unfixed paramet... | 0 | 0 | 0 | 0 | 0 | 0 |
data_utils/crop_synthtext.py | cuongngm/MASTER-pytorch | 229 | 150120 | <reponame>cuongngm/MASTER-pytorch
# -*- coding: utf-8 -*-
# @Author: <NAME>
# @Email: <EMAIL>
# @Created Time: 6/28/2019 4:06 PM
# Multi-process crop synthtext and save it to lmdb or images/text file
from typing import *
import sys
import os
from itertools import chain
import math
import re
import logging
from multip... | 0 | 0 | 0 | 0 | 0 | 0 |
transformations/abbreviation_transformation/abbrev.py | raft001/NL-Augmenter | 583 | 150122 | """
THIS CODE IS NOT BEING USED DIRECTLY. This is the code used to scrape the dictionaries.
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
"""
ref: https://medium.com/coinmonks/remaking-of-shortened-sms-tweet-post-slangs-and-word-contraction-into-sentences-nlp-7bd1bbc6fcff
"""
from bs4 import Beautifu... | 0 | 0 | 0 | 0 | 0 | 0 |
metrics/code_eval/code_eval.py | WojciechKusa/datasets | 10,608 | 150124 | <reponame>WojciechKusa/datasets<gh_stars>1000+
# coding=utf-8
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# 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 th... | 0 | 0 | 0 | 0 | 0 | 0 |
eval.py | gmt710/CIFAR-ZOO | 705 | 150135 | # -*- coding: UTF-8 -*-
'''
@author: <NAME>
@contact: <EMAIL>
@time: 2021/2/19 16:57
@file: eval.py
@desc:
'''
# -*-coding:utf-8-*-
import argparse
import logging
import torch
import torch.backends.cudnn as cudnn
import torchvision.transforms as transforms
import yaml
from easydict import EasyDict
from models import... | 0 | 0 | 0 | 0 | 0 | 0 |
execution_trace/tests/functions/f_return.py | yoyonel/python-execution-trace | 197 | 150148 | <filename>execution_trace/tests/functions/f_return.py
from execution_trace.record import record
@record(10) # 1
def f(): # 2
"""Fn with return.""" # 3
x = 3 # 4
return x # 5
args = ()
expected_trace = [{u'data': [{u'lineno': 3, u'state': {}},
{u'lineno': 4, u'state': {u... | 0 | 0 | 0 | 0 | 0 | 0 |
medium/property-based-testing/test_is_mail.py | saneravi/ML_Stuff | 209 | 150176 | # Third party modules
import hypothesis.strategies as s
import mpu.string # Martins Python Utilities
from hypothesis import given
@given(s.emails())
def test_is_email(email):
assert mpu.string.is_email(email), f"is_email({email}) returned False"
@given(s.ip_addresses(v=4))
def test_is_ipv4(ip):
assert mpu.... | 0 | 0 | 0 | 0 | 0 | 0 |
SimPEG/electromagnetics/natural_source/utils/edi_files_utils.py | prisae/simpeg | 358 | 150177 | <reponame>prisae/simpeg
from __future__ import print_function
# Functions to import and export MT EDI files.
from SimPEG import mkvc
from scipy.constants import mu_0
from numpy.lib import recfunctions as recFunc
from .data_utils import rec_to_ndarr
# Import modules
import numpy as np
import os, sys, re
class EDIimp... | 0 | 0 | 0 | 0 | 0 | 0 |
src/1046.last-stone-weight/last-stone-weight.py | lyphui/Just-Code | 782 | 150206 | <filename>src/1046.last-stone-weight/last-stone-weight.py<gh_stars>100-1000
class Solution:
def lastStoneWeight(self, stones: List[int]) -> int:
while len(stones) > 1:
stones.sort()
a = stones.pop()
b = stones.pop()
last = a - b
if last:
... | 0 | 0 | 0 | 0 | 0 | 0 |
webrecorder/test/test_colls_api.py | ssteo/webrecorder | 1,217 | 150207 | from datetime import datetime
import os
from .testutils import FullStackTests
# ============================================================================
class TestWebRecCollsAPI(FullStackTests):
@classmethod
def setup_class(cls):
super(TestWebRecCollsAPI, cls).setup_class()
def test_create_a... | 0 | 0 | 0 | 0 | 0 | 0 |
test/e2e2/spec/test_api_domains.py | peterthomassen/desec-stack | 197 | 150212 | from conftest import DeSECAPIV1Client, NSLordClient, random_domainname
def test_create(api_user: DeSECAPIV1Client):
assert len(api_user.domain_list()) == 0
assert api_user.domain_create(random_domainname()).status_code == 201
assert len(api_user.domain_list()) == 1
def test_get(api_user_domain: DeSECAPI... | 3 | 0 | 0 | 0 | 3 | 0 |
my/grapheme_cluster.py | cibu/language-resources | 177 | 150218 | <reponame>cibu/language-resources
#! /usr/bin/env python
#
# 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/lice... | 0 | 0 | 0 | 0 | 0 | 0 |
src/hobbits-plugins/analyzers/KaitaiStruct/ksy_py/game/saints_row_2_vpp_pc.py | SabheeR/hobbits | 304 | 150219 | <filename>src/hobbits-plugins/analyzers/KaitaiStruct/ksy_py/game/saints_row_2_vpp_pc.py
# This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild
from pkg_resources import parse_version
import kaitaistruct
from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO
import coll... | 0 | 0 | 0 | 0 | 0 | 0 |
fud/fud/stages/xilinx/emulation.py | badenh/calyx | 109 | 150241 | import logging as log
from pathlib import Path
from fud.stages import Stage, SourceType
from fud.utils import TmpDir
from fud import errors
class HwEmulationStage(Stage):
name: str = "wdb"
def __init__(self, config):
super().__init__(
src_state="xclbin",
target_state="wdb",
... | 15 | 4 | 1 | 4 | 24 | 0 |
cumulusci/cli/ui.py | emregunel/CumulusCI | 163 | 150244 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
"""Format and display CLI output.
Classes:
CliTable: Pretty prints tabular data to stdout, via Rich's Console API
"""
import os
from typing import List
from rich import box, print
from rich.console import Console
from rich.style import Style
from rich.table import Table
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/genie/libs/parser/iosxe/tests/ShowRunInterface/cli/equal/golden_output_12_expected.py | jacobgarder/genieparser | 204 | 150251 | <reponame>jacobgarder/genieparser<filename>src/genie/libs/parser/iosxe/tests/ShowRunInterface/cli/equal/golden_output_12_expected.py
expected_output = {
"interfaces": {
"Port-channel20": {
"description": "distacc Te1/1/1, Te2/1/1",
"switchport_trunk_vlans": "9,51",
"switc... | 0 | 0 | 0 | 0 | 0 | 0 |
src/spoof.py | yo-it/eap | 374 | 150252 | <filename>src/spoof.py
import logging
logging.getLogger("scapy.runtime").setLevel(logging.ERROR) # scapy, don't be noisy
from scapy.all import *
from time import sleep
conf.verb = 0 # please, scapy! :(
GREEN = "\033[1;32m"
YELLOW = "\033[1;93m"
NORMAL = "\033[0;0m"
class ARPSpoof(object):
def __init__(self, targ... | 0 | 0 | 0 | 0 | 0 | 0 |
api/v2/views/maintenance_record.py | simpsonw/atmosphere | 197 | 150254 | from rest_framework.filters import BaseFilterBackend, SearchFilter
from django_filters import rest_framework as filters
from core.models import MaintenanceRecord
from api.permissions import CanEditOrReadOnly
from api.v2.serializers.details import MaintenanceRecordSerializer
from api.v2.views.base import AuthOptionalVi... | 0 | 1 | 3 | 0 | 4 | 0 |
cui_classes/cui_containers.py | BlenderNPR/Abnormal | 133 | 150268 | from __future__ import annotations
import bgl
from .cui_shapes import *
from .cui_bezier_box import *
from .cui_items import *
#
#
#
class CUIContainer(CUIRectWidget):
def __init__(self) -> None:
super().__init__()
self.horizontal_margin: int = 0
self.vertical_margin: int = 0
se... | 61 | 89 | 0 | 33 | 183 | 0 |
tests/test_strategy.py | tgragnato/geneva | 1,182 | 150305 | <reponame>tgragnato/geneva
import logging
import pytest
import actions.tree
import actions.drop
import actions.tamper
import actions.duplicate
import actions.sleep
import actions.utils
import actions.strategy
import evaluator
import evolve
import layers.layer
from scapy.all import IP, TCP, Raw
def test_mate(logger)... | 0 | 0 | 0 | 0 | 0 | 0 |
test/test_mdict.py | Viocalpan/bottle | 6,086 | 150311 | <gh_stars>1000+
import unittest
from bottle import MultiDict, HeaderDict
class TestMultiDict(unittest.TestCase):
def test_isadict(self):
""" MultiDict should behaves like a normal dict """
d, m = dict(a=5), MultiDict(a=5)
d['key'], m['key'] = 'value', 'value'
d['k2'], m['k2'] = 'v1'... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/usda/unit-runner.py | GermanAizek/tinyusdz | 159 | 150321 | <filename>tests/usda/unit-runner.py<gh_stars>100-1000
import os
import glob
import subprocess
if __name__ == '__main__':
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument("--basedir", type=str, default="tests/usda")
parser.add_argument("--app", type=str, default="./build... | 0 | 0 | 0 | 0 | 0 | 0 |
aries_cloudagent/utils/tests/test_classloader.py | euroledger/aries-cloudagent-python | 247 | 150327 | from unittest import TestCase, mock
from ...core.error import BaseError
from .. import classloader as test_module
from ..classloader import ClassLoader, ClassNotFoundError, ModuleLoadError
class TestClassLoader(TestCase):
def test_import_loaded(self):
assert ClassLoader.load_module("unittest")
def ... | 0 | 0 | 0 | 0 | 0 | 0 |
twiml/voice/refer/refer-2/refer-2.6.x.py | deshartman/api-snippets | 234 | 150361 | <reponame>deshartman/api-snippets<filename>twiml/voice/refer/refer-2/refer-2.6.x.py
from twilio.twiml.voice_response import Refer, VoiceResponse
response = VoiceResponse()
refer = Refer()
refer.sip(
'sip:<EMAIL>?X-AcctNumber=123456&X-ReasonForCalling=billing-question'
)
response.append(refer)
print(response)
| 0 | 0 | 0 | 0 | 0 | 0 |
demo/dask/cpu_training.py | bclehmann/xgboost | 23,866 | 150377 | import xgboost as xgb
from xgboost.dask import DaskDMatrix
from dask.distributed import Client
from dask.distributed import LocalCluster
from dask import array as da
def main(client) -> object:
# generate some random data for demonstration
m = 100000
n = 100
X = da.random.random(size=(m, n), chunks=10... | 0 | 1 | 0 | 0 | 1 | 0 |
homeassistant/generated/__init__.py | MrDelik/core | 30,023 | 150380 | <gh_stars>1000+
"""All files in this module are automatically generated by hassfest.
To update, run python3 -m script.hassfest
"""
| 0 | 0 | 0 | 0 | 0 | 0 |
utils/consistency_loss.py | Veronica1997/Human-segmantation | 707 | 150390 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
@Author : <NAME>
@Contact : <EMAIL>
@File : kl_loss.py
@Time : 7/23/19 4:02 PM
@Desc :
@License : This source code is licensed under the license found in the
LICENSE file in the root directory of this source tree.
"""
import torch... | 1 | 1 | 0 | 0 | 2 | 0 |
Training/MOOC Tensorflow 2.0/BeiDa/class1/p31_matmul.py | church06/Pythons | 177 | 150397 | <filename>Training/MOOC Tensorflow 2.0/BeiDa/class1/p31_matmul.py
import tensorflow as tf
a = tf.ones([3, 2])
b = tf.fill([2, 3], 3.)
print("a:", a)
print("b:", b)
print("a*b:", tf.matmul(a, b))
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_autograder.py | Kandongwe/RunestoneServer | 344 | 150403 | <gh_stars>100-1000
import json
import time
import pytest
from .utils import settings_context
# parameters:
# 1. question name
# 2. event
# 2. correct answer
# 3. bad answer
# 4. correct_scores
#
# Test fillb, mChoice, dragNdrop, clickableArea, parsons, unittest
WHICH_ANSWER = ["first_answer", "last_answer", "best_answ... | 0 | 0 | 0 | 0 | 0 | 0 |
yubico/yubikey_usb_hid.py | larcho/python-yubico | 161 | 150406 | <gh_stars>100-1000
"""
module for accessing a USB HID YubiKey
"""
# Copyright (c) 2010, 2011, 2012 Yubico AB
# See the file COPYING for licence statement.
__all__ = [
# constants
# functions
# classes
'YubiKeyUSBHID',
'YubiKeyUSBHIDError',
'YubiKeyUSBHIDStatus',
]
from .yubico_version import __version__
... | 0 | 0 | 0 | 0 | 0 | 0 |
PatchMatch_Bidirectional.py | MingtaoGuo/PatchMatch | 167 | 150422 | <gh_stars>100-1000
import numpy as np
import scipy.misc as misc
from PIL import Image
import cv2
import time
def normalize(F_L):
return F_L/np.sqrt(np.sum(np.square(F_L)))
def cal_distance(A, B, A_prime, B_prime, a_x, a_y, b_x, b_y, patch_size):
A_H = A.shape[0]
A_W = A.shape[1]
B_H = B.sh... | 0 | 0 | 0 | 0 | 0 | 0 |
src/sdk/python/sample.py | cuisonghui/tera | 2,003 | 150434 | #!/usr/bin/env python
# encoding: utf-8
"""
sample of using Tera Python SDK
"""
from TeraSdk import Client, RowMutation, RowReader, TeraSdkException
from TeraSdk import MUTATION_CALLBACK, READER_CALLBACK, Status
import time
def mutation_callback(raw_mu):
""" mutation callback """
mu = RowMutation(raw_mu)
... | 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.