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 |
|---|---|---|---|---|---|---|---|---|---|---|
mhw_armor_edit/ftypes/lbm_skill.py | nicolas43000/MHWorldData | 129 | 123333 | # coding: utf-8
from mhw_armor_edit import ftypes as ft
from mhw_armor_edit.ftypes import StructFile, Struct
class LbmSkillEntry(Struct):
STRUCT_SIZE: int = 10
unk1: ft.ubyte()
unk2: ft.ubyte()
item_id: ft.ushort()
item_qty: ft.ushort()
unk3: ft.pad(4)
class LbmSkill(StructFile):
EntryFa... | 0 | 0 | 7 | 0 | 7 | 0 |
pypykatz/smb/dcsync.py | wisdark/pypykatz | 1,861 | 123337 | <reponame>wisdark/pypykatz
import asyncio
from pypykatz import logging
async def dcsync(url, username = None):
from aiosmb.commons.connection.url import SMBConnectionURL
from aiosmb.commons.interfaces.machine import SMBMachine
smburl = SMBConnectionURL(url)
connection = smburl.get_connection()
users = []
if us... | 0 | 0 | 0 | 0 | 0 | 0 |
claf/machine/__init__.py | GMDennis/claf | 225 | 123350 | <reponame>GMDennis/claf
from claf.machine.open_qa import OpenQA
from claf.machine.nlu import NLU
# fmt: off
__all__ = [
"OpenQA",
"NLU",
]
# fmt: on
| 0 | 0 | 0 | 0 | 0 | 0 |
examples/custom/parallel_plot/parallel_reset.py | goncaloperes/bokeh | 15,193 | 123357 | from bokeh.models import ActionTool
class ParallelResetTool(ActionTool):
""" Tool to reset only plot axes and not selections
"""
__implementation__: str = 'parallel_reset.ts'
| 0 | 0 | 1 | 0 | 1 | 0 |
sarpy/io/general/nitf_elements/tres/unclass/PIAPEA.py | spacefan/sarpy | 119 | 123433 |
from ..tre_elements import TREExtension, TREElement
__classification__ = "UNCLASSIFIED"
__author__ = "<NAME>"
class PIAPEAType(TREElement):
def __init__(self, value):
super(PIAPEAType, self).__init__()
self.add_field('LASTNME', 's', 28, value)
self.add_field('FIRSTNME', 's', 28, value)
... | 0 | 0 | 1 | 0 | 1 | 0 |
DQMOffline/Trigger/python/HMesonGammaMonitor_Client_cff.py | ckamtsikis/cmssw | 852 | 123441 | <filename>DQMOffline/Trigger/python/HMesonGammaMonitor_Client_cff.py<gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
from DQMServices.Core.DQMEDHarvester import DQMEDHarvester
hmesongammaEfficiency = DQMEDHarvester("DQMGenericClient",
# subDirs = cms.untracked.vstring("HLT/Higgs/HMesonGamma/*"),
... | 0 | 0 | 0 | 0 | 0 | 0 |
bookwyrm/tests/views/landing/test_landing.py | mouse-reeve/fedireads | 270 | 123452 | <reponame>mouse-reeve/fedireads<filename>bookwyrm/tests/views/landing/test_landing.py
""" test for app action functionality """
from unittest.mock import patch
from django.contrib.auth.models import AnonymousUser
from django.template.response import TemplateResponse
from django.test import TestCase
from django.test.cli... | 0 | 0 | 0 | 0 | 0 | 0 |
targets/arty/etherbone.py | skiphansen/litex-buildenv | 198 | 123494 | from litex.soc.integration.soc_core import mem_decoder
from litex.soc.integration.soc_sdram import *
from liteeth.common import convert_ip
from liteeth.core import LiteEthUDPIPCore
from liteeth.frontend.etherbone import LiteEthEtherbone
from liteeth.mac import LiteEthMAC
from liteeth.phy import LiteEthPHY
from target... | 0 | 0 | 0 | 0 | 0 | 0 |
vergeml/glossary.py | cclauss/vergeml | 324 | 123509 | <reponame>cclauss/vergeml<gh_stars>100-1000
PARAM_DESCR = {
'epochs': 'How many epochs to train.',
'learning rate': 'Optimizer learning rate.',
'batch size': 'The number of samples to use in one training batch.',
'decay': 'Learning rate decay.',
'early stopping': 'Early stopping delta and patience.'... | 0 | 0 | 0 | 0 | 0 | 0 |
python/tests/test_auxdata.py | clayne/gtirb | 230 | 123523 | <gh_stars>100-1000
import unittest
from unittest import mock
import gtirb
class AuxDataTest(unittest.TestCase):
def setUp(self):
self.fake_ir = mock.MagicMock()
self.fake_ir.get_by_uuid = None
def test_lazy(self):
ad1 = gtirb.AuxData("test1", "string")
self.assertEqual(ad1.da... | 0 | 0 | 0 | 0 | 0 | 0 |
bups/scheduler/__init__.py | emersion/bups | 106 | 123583 | <filename>bups/scheduler/__init__.py
import anacron
import systemd
import systemd_user
schedulers = {
"anacron": anacron,
"systemd": systemd,
"systemd-user": systemd_user
}
| 0 | 0 | 0 | 0 | 0 | 0 |
upvote/gae/modules/upvote_app/api/web/events.py | iwikmai/upvote | 453 | 123595 | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | 0 | 3 | 0 | 0 | 3 | 0 |
meter/connector/master.py | anbo225/docklet | 273 | 123606 | <reponame>anbo225/docklet<gh_stars>100-1000
#!/usr/bin/python3
import socket, select, errno, threading, os
class master_connector:
tcp_port = 1727
max_minions = 256
conn = {}
epoll_fd = select.epoll()
def establish_vswitch(ovsname):
os.system('ovs-vsctl del-br ovs-%s >/dev/null 2>&1' % ovsname)
os.syst... | 0 | 0 | 0 | 0 | 0 | 0 |
Python/CanWeSort/Code.py | cs-mshah/AlgoCode | 151 | 123651 | <filename>Python/CanWeSort/Code.py
# Function for finding if it possible
# to obtain sorted array or not
def fun(arr, n, k):
v = []
# Iterate over all elements until K
for i in range(k):
# Store elements as multiples of K
for j in range(i, n, k):
v.append(arr[j]);
... | 0 | 0 | 0 | 0 | 0 | 0 |
pil_pillow__examples/gray/main.py | DazEB2/SimplePyScripts | 117 | 123661 | <reponame>DazEB2/SimplePyScripts
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
# pip install Pillow
from PIL import Image, ImageOps
image_file = "input.jpg"
image = Image.open(image_file)
image_gray = ImageOps.grayscale(image)
image_gray.save('image_gray.png')
image_gray.show()
| 0 | 0 | 0 | 0 | 0 | 0 |
setup.py | mitsuhiko/snaek | 272 | 123681 | <gh_stars>100-1000
from setuptools import setup
from setuptools.dist import Distribution
# Dogfood ourselves here. Since however we at this point might not be
# installed yet we cannot use snaek_rust_modules directly. Additionally
# we might not be able to import outselves yet because the setup
# requirements are no... | 0 | 0 | 0 | 0 | 0 | 0 |
native/libcst/tests/fixtures/global_nonlocal.py | jschavesr/LibCST | 880 | 123709 | <reponame>jschavesr/LibCST
global a
global b , c, d
nonlocal a
nonlocal a , b | 0 | 0 | 0 | 0 | 0 | 0 |
test/unit/agent/common/context.py | dp92987/nginx-amplify-agent | 308 | 123716 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
from hamcrest import *
from amplify.agent.common.context import context
from test.base import BaseTestCase
from test.fixtures.defaults import *
__author__ = "<NAME>"
__copyright__ = "Copyright (C) Nginx, Inc. All rights reserved."
__license__ = ""
__maintainer__ = "<NAME>"
_... | 0 | 0 | 0 | 0 | 0 | 0 |
fcos_core/layers/mask_prob.py | Davidnet/EmbedMask | 181 | 123724 | <reponame>Davidnet/EmbedMask
# import torch
# from torch import nn
# from torch.autograd import Function
from fcos_core import _C
mask_prob_cuda = _C.maskprob_forward | 0 | 0 | 0 | 0 | 0 | 0 |
t/umash.py | warmchang/umash | 108 | 123761 | <gh_stars>100-1000
import cffi
import faulthandler
import os
import sys
from cffi_util import read_stripped_header
SELF_DIR = os.path.dirname(os.path.abspath(__file__))
TOPLEVEL = os.path.abspath(SELF_DIR + "/../") + "/"
# The reference implementation is at the top level.
sys.path.append(TOPLEVEL)
HEADERS = [
"... | 0 | 0 | 0 | 0 | 0 | 0 |
differential_privacy/run_stackoverflow_with_secrets_test.py | garyxcheng/federated | 330 | 123807 | <filename>differential_privacy/run_stackoverflow_with_secrets_test.py
# Copyright 2021, 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
#
# http://www.apache.org/licenses/LIC... | 0 | 0 | 0 | 0 | 0 | 0 |
dialogue-engine/test/programytest/parser/template/graph_tests/test_rand.py | cotobadesign/cotoba-agent-oss | 104 | 123825 | <gh_stars>100-1000
"""
Copyright (c) 2020 COTOBA DESIGN, Inc.
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 use, copy, modify, mer... | 0 | 0 | 0 | 0 | 0 | 0 |
fixit/common/tests/test_comments.py | sk-/Fixit | 313 | 123826 | <filename>fixit/common/tests/test_comments.py
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import tokenize
from io import BytesIO
from libcst.testing.utils import UnitTest
from fixit.co... | 0 | 0 | 0 | 0 | 0 | 0 |
koalixcrm/crm/migrations/0049_auto_20181014_2258.py | Cataldir/koalixcrm | 290 | 123873 | <reponame>Cataldir/koalixcrm<gh_stars>100-1000
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2018-10-12 20:56
from __future__ import unicode_literals
from django.db import migrations
def reverse_func(apps, schema_editor):
return 1
def backup_identifiers(apps, schema_editor):
Position = apps.get_mo... | 0 | 0 | 0 | 0 | 0 | 0 |
verisure/__init__.py | gablin/python-verisure | 131 | 123877 | <reponame>gablin/python-verisure
"""
A python module for reading and changing status of verisure devices through
verisure app API.
"""
__all__ = [
'Error',
'LoginError',
'ResponseError',
'Session'
]
from .session import ( # NOQA
Error,
LoginError,
ResponseError,
Session
)
ALARM_ARMED... | 0 | 0 | 0 | 0 | 0 | 0 |
pyjswidgets/pyjamas/ui/GlassWidget.ie6.py | takipsizad/pyjs | 739 | 123953 | # Copyright 2006 <NAME> and contributors
# Copyright (C) 2009 <NAME> <<EMAIL>>
# Copyright (C) 2010 <NAME> <<EMAIL>>
# Copyright (C) 2010 <NAME> (IE override) <<EMAIL>>
#
# 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... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/test_ns.py | q0w/snug | 123 | 123962 | import json
from pathlib import Path
import aiohttp
import pytest
from gentools import sendreturn
import ns
import snug
live = pytest.config.getoption('--live')
CRED_PATH = Path('~/.snug/ns.json').expanduser()
auth = json.loads(CRED_PATH.read_bytes())
@pytest.fixture(scope='module')
async def exec():
async wit... | 0 | 0 | 0 | 0 | 0 | 0 |
flows/transitions.py | sergioisidoro/django-flows | 104 | 123986 | # -*- coding: UTF-8 -*-
import random
from flows.components import COMPLETE
class Linear(object):
"""
The `Linear` transition assumes that once an `Action` has completed,
the flow should transition to the next `Action` in the relevant
`Scaffold`'s `action_set`. If there are no more actions left, then
... | 0 | 2 | 0 | 0 | 2 | 0 |
node_launcher/node_set/bitcoind/bitcoind_rpc_client.py | ryan-lingle/node-launcher | 249 | 123988 | from __future__ import annotations
import base64
import binascii
import decimal
import json
import os
import platform
import sys
import urllib.parse as urlparse
from http.client import HTTP_PORT, HTTPConnection
DEFAULT_USER_AGENT = "AuthServiceProxy/0.1"
DEFAULT_HTTP_TIMEOUT = 30
# (un)hexlify to/from unicode, neede... | 9 | 8 | 1 | 3 | 21 | 0 |
chapter6/name_mangling.py | sharad16j/Expert-Python-Programming-Third-Edition | 112 | 124022 | class Base(object):
def __secret(self):
print("don't tell")
def public(self):
self.__secret()
class Derived(Base):
def __secret(self):
print("never ever")
if __name__ == "__main__":
print("Base class members:", dir(Base))
print("Derived class members:", dir(Derived))
... | 0 | 0 | 0 | 0 | 0 | 0 |
protos/gen/python/protos/public/modeldb/versioning/Enums_pb2.py | stefan-petrov-toptal/modeldb | 835 | 124023 | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: modeldb/versioning/Enums.proto
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_data... | 0 | 0 | 0 | 0 | 0 | 0 |
saleor/shipping/migrations/0026_shippingzone_description.py | fairhopeweb/saleor | 15,337 | 124051 | # Generated by Django 3.1.4 on 2020-12-29 12:49
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
("shipping", "0025_auto_20201130_1122"),
]
operations: list[object] = [
migrations.AddField(
model_name="sh... | 0 | 0 | 2 | 0 | 2 | 0 |
mmgen/models/translation_models/pix2pix.py | plutoyuxie/mmgeneration | 718 | 124100 | # Copyright (c) OpenMMLab. All rights reserved.
from __future__ import annotations
import torch
from torch.nn.parallel.distributed import _find_tensors
from mmgen.models.builder import MODELS
from ..common import set_requires_grad
from .static_translation_gan import StaticTranslationGAN
@MODELS.register_module()
cla... | 2 | 4 | 0 | 1 | 7 | 0 |
querybuilder/tests/__init__.py | wesokes/django-query-builder | 110 | 124112 | <gh_stars>100-1000
default_app_config = 'querybuilder.tests.apps.QuerybuilderTestConfig'
| 0 | 0 | 0 | 0 | 0 | 0 |
scripts/03_glove_build_counts.py | svlandeg/sense2vec | 1,140 | 124120 | <reponame>svlandeg/sense2vec<gh_stars>1000+
#!/usr/bin/env python
import os
from pathlib import Path
from wasabi import msg
import typer
def main(
# fmt: off
glove_dir: str = typer.Argument(..., help="Directory containing the GloVe build"),
in_dir: str = typer.Argument(..., help="Directory with preprocess... | 0 | 0 | 0 | 0 | 0 | 0 |
prerender/cache/disk.py | bosondata/chrome-prerender | 169 | 124122 | <filename>prerender/cache/disk.py
import os
import lzma
import asyncio
import functools
from typing import Optional
from aiofiles.os import stat
import diskcache
from .base import CacheBackend
CACHE_ROOT_DIR: str = os.environ.get('CACHE_ROOT_DIR', '/tmp/prerender')
class DiskCache(CacheBackend):
def __init__(... | 0 | 0 | 0 | 0 | 0 | 0 |
EventFilter/RPCRawToDigi/python/rpcUnpacker_cfi.py | ckamtsikis/cmssw | 852 | 124148 | import FWCore.ParameterSet.Config as cms
import EventFilter.RPCRawToDigi.rpcUnpackingModule_cfi
rpcunpacker = EventFilter.RPCRawToDigi.rpcUnpackingModule_cfi.rpcUnpackingModule.clone()
rpcunpacker.InputLabel = cms.InputTag("rawDataCollector")
rpcunpacker.doSynchro = cms.bool(True)
| 0 | 0 | 0 | 0 | 0 | 0 |
server/security.py | s-bauer/yang-explorer | 437 | 124153 | <filename>server/security.py<gh_stars>100-1000
import logging
from django.shortcuts import render_to_response
from django.template import RequestContext
def policy_handler(request):
return render_to_response('crossdomain.xml', {}, RequestContext(request))
| 0 | 0 | 0 | 0 | 0 | 0 |
anuga/file_conversion/tests/test_2pts.py | samcom12/anuga_core | 136 | 124193 | # external modules
import unittest
import tempfile
import shutil
import numpy as num
# ANUGA modules
from anuga.shallow_water.shallow_water_domain import Domain
from anuga.coordinate_transforms.geo_reference import Geo_reference
from anuga.file.sww import Write_sww, SWW_file
from anuga.abstract_2d_finite_volumes.gene... | 0 | 0 | 0 | 0 | 0 | 0 |
core/preprocess_utils.py | saramsv/wss | 116 | 124241 | # Lint as: python2, python3
# Copyright 2020 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 ... | 27 | 23 | 0 | 0 | 50 | 0 |
bookwyrm/views/interaction.py | mouse-reeve/fedireads | 270 | 124258 | """ boosts and favs """
from django.contrib.auth.decorators import login_required
from django.core.cache import cache
from django.db import IntegrityError
from django.http import HttpResponse, HttpResponseBadRequest, HttpResponseNotFound
from django.shortcuts import redirect
from django.utils.decorators import method_d... | 0 | 4 | 0 | 0 | 4 | 0 |
tests/test_setup_dirs.py | flying-sheep/goatools | 477 | 124293 | #!/usr/bin/env python3
"""Test that all GOATOOLS package dirs are in the setup.py file"""
# pylint: disable=wrong-import-position
from os import walk
from os.path import join
from os.path import abspath
import sys
sys.argv = [abspath(__file__), '--help']
from setup import NAME # goatools
from setup import PACKAGE... | 0 | 2 | 0 | 0 | 2 | 0 |
tests/forte/data/serialization_tests.py | J007X/forte | 163 | 124330 | # Copyright 2021 The Forte 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 applicable ... | 2 | 1 | 7 | 0 | 10 | 0 |
Drake-Z/0009/0009.py | saurabh896/python-1 | 3,976 | 124383 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'第 0009 题:一个HTML文件,找出里面的链接。'
__author__ = 'Drake-Z'
import os, re
from html.parser import HTMLParser
from html.entities import name2codepoint
class MyHTMLParser(HTMLParser):
def handle_starttag(self, tag, attrs):
if tag == 'a':
for (variables, ... | 0 | 0 | 0 | 0 | 0 | 0 |
stanford-augmented-image-classification/i_commandline_arguments.py | meghanaravikumar/sigopt-examples | 213 | 124392 | from a_resnet_training_common_cli import Hyperparameters
from stanford_cars_augmentation_cli import AugmentHyperparameters, AugmentCLI
def generate_cli_hpo(parser) -> object:
"""Adding Hyperparameters to CLI arguments"""
parser.add_argument("--" + Hyperparameters.SCEDULER_RATE.value, dest=Hyperparameters.SCED... | 0 | 2 | 0 | 0 | 2 | 0 |
train_deep_ensemble.py | omegafragger/deterministic-uncertainty-quantification | 180 | 124395 | <reponame>omegafragger/deterministic-uncertainty-quantification
import argparse
import pathlib
import torch
import torch.nn as nn
import torch.nn.functional as F
from tqdm import tqdm
from utils.datasets import all_datasets
from utils.cnn_duq import SoftmaxModel as CNN
from torchvision.models import resnet18
class... | 0 | 0 | 0 | 0 | 0 | 0 |
pennylane/gradients/general_shift_rules.py | therooler/pennylane | 539 | 124400 | <reponame>therooler/pennylane
# Copyright 2018-2021 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
... | 0 | 0 | 0 | 0 | 0 | 0 |
test/issues/160/main.py | InsertAReallyCreativeNameHere/tinyexr | 479 | 124406 | <gh_stars>100-1000
import OpenEXR
import Imath
import numpy as np
import simpleimageio as sio
width = 420
height = 32
border_left = 0
border_right = 420 - 80
num_splats = 10000
red = np.zeros((height, width), dtype=np.float32)
green = np.zeros((height, width), dtype=np.float32)
blue = np.zeros((height, width), dtype=... | 0 | 0 | 0 | 0 | 0 | 0 |
facility/test/facility_grader_test.py | mike715/assignment | 101 | 124420 | <reponame>mike715/assignment
import sys, os, pytest
sys.path.append(os.getcwd())
from do_grader_lib import PartQuality
from facility import grader
with open('facility/data/fl_3_1', 'r') as input_data_file:
input_data = input_data_file.read()
quality = PartQuality('test', 4052, 2546)
greedy_submission = '2550.0... | 0 | 0 | 0 | 0 | 0 | 0 |
coding_interviews/cracking_the_coding_interview/string/001.05.py | LeandroTk/Algorithms | 205 | 124427 | from __future__ import annotations
'''
One Away: There are three types of edits that can be performed on strings:
insert a character, remove a character, or replace a character.
Given two strings, write a function to check if they are one edit (or zero edits) away.
Example:
pale, ple -> true
pales, pale -> true
pale,... | 0 | 3 | 0 | 0 | 3 | 0 |
apps/accounts/social_auth_pipeline.py | goztrk/django-htk | 206 | 124450 | <reponame>goztrk/django-htk<filename>apps/accounts/social_auth_pipeline.py<gh_stars>100-1000
# Third Party / PIP Imports
# Django Imports
from django.shortcuts import redirect
# Django Extensions Imports
from social_core.pipeline.partial import partial
# HTK Imports
from htk.apps.accounts.emails import welcome_email
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/api/views/bp_api_v1.py | LeslieLeung/2c | 236 | 124458 | <filename>src/api/views/bp_api_v1.py
#!/usr/bin/env python
"""
Created by howie.hu at 2021/4/10.
Description:v1 接口函数
Changelog: all notable changes to this file will be documented
"""
from flask import Blueprint, current_app, request
bp_api = Blueprint("v1", __name__, url_prefix="/v1")
@bp_api.route("/pi... | 0 | 0 | 0 | 0 | 0 | 0 |
setup.py | TomKingsfordUoA/ResidualMaskingNetwork | 242 | 124463 | <gh_stars>100-1000
import os
from setuptools import find_packages, setup
version = None
with open("README.md") as ref:
data = ref.readlines()[2]
version = data[data.find("version-v")+9:data.find("-blue")]
assert version is not None, data
cwd = os.path.dirname(os.path.abspath(__file__))
def write_version... | 0 | 0 | 0 | 0 | 0 | 0 |
src/0054.spiral-matrix/spiral-matrix.py | lyphui/Just-Code | 782 | 124465 | <reponame>lyphui/Just-Code
class Solution:
def spiralOrder(self, matrix: List[List[int]]) -> List[int]:
res = []
if not matrix: return res
x = y = i = 0
delta = ((0, 1), (1, 0), (0, -1), (-1, 0))
pos = [0, 0, len(matrix[0])-1, len(matrix)-1] # 左、上、右、下。后面懒得判断推出来的。
whil... | 0 | 0 | 0 | 0 | 0 | 0 |
causalml/inference/tf/__init__.py | rainfireliang/causalml | 2,919 | 124483 | from .dragonnet import DragonNet
| 0 | 0 | 0 | 0 | 0 | 0 |
scripts/visualization.py | hehefan/PointRNN | 136 | 124490 | """
3D Point Cloud Visualization
Original Author: https://github.com/argoai/argoverse-api
Modified by <NAME>
Date October 2019
"""
import os
import numpy as np
import argparse
import matplotlib
import matplotlib.pyplot as plt
from PIL import Image
from mpl_toolkits.mplot3d import Axes3D
from mayavi import mlab
from t... | 16 | 3 | 0 | 0 | 19 | 0 |
notebook/numpy_block.py | vhn0912/python-snippets | 174 | 124505 | import numpy as np
a1 = np.ones((2, 3), int)
print(a1)
# [[1 1 1]
# [1 1 1]]
a2 = np.full((2, 3), 2)
print(a2)
# [[2 2 2]
# [2 2 2]]
print(np.block([a1, a2]))
# [[1 1 1 2 2 2]
# [1 1 1 2 2 2]]
print(np.block([[a1], [a2]]))
# [[1 1 1]
# [1 1 1]
# [2 2 2]
# [2 2 2]]
print(np.block([[a1, a2], [a2, a1]]))
# [[1 ... | 0 | 0 | 0 | 0 | 0 | 0 |
splink/iterate.py | riddhi150390/splink | 176 | 124514 | <reponame>riddhi150390/splink
from typing import Callable
from pyspark.sql.dataframe import DataFrame
from pyspark.sql.session import SparkSession
from .expectation_step import run_expectation_step
from .maximisation_step import run_maximisation_step
from .model import Model
from typeguard import typechecked
import l... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/Sikuli/OpenDialogClickFolderSelect.sikuli/OpenDialogClickFolderSelect.py | marmyshev/vanessa-automation | 296 | 124538 | <gh_stars>100-1000
click("Bb60pnanxm.png")
exit(0) | 0 | 0 | 0 | 0 | 0 | 0 |
petridish/data/openml.py | Bhaskers-Blu-Org2/petridishnn | 121 | 124543 | <reponame>Bhaskers-Blu-Org2/petridishnn
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import numpy as np
import scipy.io.arff as arff
import bisect
import json
import os, sys
import subprocess
import tensorflow as tf
from tensorpack.dataflow import RNGDataFlow, BatchData, PrefetchData
from ... | 0 | 0 | 0 | 0 | 0 | 0 |
gryphon/lib/exchange/vault_of_satoshi.py | qiquanzhijia/gryphon | 1,109 | 124569 | # -*- coding: utf-8 -*-
from __future__ import annotations
import time
import os
import datetime
import requests
import hmac
import urllib
import hashlib
import base64
import json
import math
from cdecimal import *
from delorean import Delorean
from collections import OrderedDict
from gryphon.lib.money import Money
fr... | 3 | 0 | 0 | 5 | 8 | 0 |
tests/conftest.py | Dimche-msk/panoramisk | 123 | 124616 | <filename>tests/conftest.py
import subprocess
import pytest
from panoramisk import utils
class Asterisk:
def __init__(self):
self.cwd = 'tests/docker'
self.proc = None
def start(self):
self.stop()
self.proc = subprocess.Popen(
['docker-compose', 'up'],
... | 0 | 0 | 0 | 0 | 0 | 0 |
sourced/ml/tests/test_indexer.py | vmarkovtsev/ml | 122 | 124633 | import tempfile
import unittest
from pyspark import Row
from sourced.ml.models import DocumentFrequencies
from sourced.ml.tests import create_spark_for_test
from sourced.ml.transformers import Indexer
class IndexerTests(unittest.TestCase):
def setUp(self):
data = [Row(to_index="to_index%d" % i, value=i)... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_doc.py | iver56/julius | 256 | 124669 | from doctest import testmod
import unittest
from julius import resample, fftconv, lowpass, bands, utils
class DocStringTest(unittest.TestCase):
def test_resample(self):
self.assertEqual(testmod(resample).failed, 0)
def test_fftconv(self):
self.assertEqual(testmod(fftconv).failed, 0)
def... | 0 | 0 | 0 | 0 | 0 | 0 |
rastervision_aws_batch/rastervision/aws_batch/aws_batch_runner.py | theoway/raster-vision | 1,577 | 124675 | <filename>rastervision_aws_batch/rastervision/aws_batch/aws_batch_runner.py
import logging
import os
import uuid
from typing import List, Optional
from rastervision.pipeline import rv_config
from rastervision.pipeline.runner import Runner
log = logging.getLogger(__name__)
AWS_BATCH = 'batch'
def submit_job(cmd: Lis... | 0 | 0 | 0 | 0 | 0 | 0 |
CPAC/unet/__init__.py | Lawreros/C-PAC | 125 | 124695 | <gh_stars>100-1000
from .function import write_nifti, estimate_dice, extract_large_comp, predict_volumes, MyParser
from .model import weigths_init, Conv3dBlock, UpConv3dBlock, Conv2dBlock, UpConv2dBlock, UNet3d, UNet2d, MultiSliceBcUNet, MultiSliceSsUNet, MultiSliceModel
from .dataset import VolumeDataset, BlockDatas... | 0 | 0 | 0 | 0 | 0 | 0 |
selenium/pyvirtualdisplay-download-without-headless/example-chrome-wiht-options.py | whitmans-max/python-examples | 140 | 124701 | from selenium import webdriver
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.chrome.options import Options
import time
start_time = time.time()
options = Options()
options.add_argument("--headless")
options.add_argument("--disable-gpu")
options.add_argument("--disable-extens... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/scipy/solve_triangular.py | RoboticExplorationLab/micropython-ulab | 232 | 124719 | import math
try:
from ulab import scipy, numpy as np
except ImportError:
import scipy
import numpy as np
A = np.array([[3, 0, 2, 6], [2, 1, 0, 1], [1, 0, 1, 4], [1, 2, 1, 8]])
b = np.array([4, 2, 4, 2])
# forward substitution
result = scipy.linalg.solve_triangular(A, b, lower=True)
ref_result = np.array(... | 0 | 0 | 0 | 0 | 0 | 0 |
src/binding/pyct_icp/__init__.py | xiang-1208/ct_icp | 123 | 124720 | from .pyct_icp import * | 0 | 0 | 0 | 0 | 0 | 0 |
marathon/__init__.py | missingcharacter/marathon-python | 202 | 124721 | from .client import MarathonClient
from .models import MarathonResource, MarathonApp, MarathonTask, MarathonConstraint
from .exceptions import MarathonError, MarathonHttpError, NotFoundError, InvalidChoiceError
from .util import get_log
log = get_log()
| 0 | 0 | 0 | 0 | 0 | 0 |
examples/supernova/in_code_demo.py | hase1128/dragonfly | 675 | 124759 | """
In code demo for supernova experiment.
-- <EMAIL>
"""
from dragonfly import load_config, maximise_function, maximise_multifidelity_function
# From current directory
from snls import objective as snls_objective
from snls_mf import objective as snls_mf_objective
from snls_mf import cost as snls_mf_cost
def mai... | 0 | 0 | 0 | 0 | 0 | 0 |
resource/lib/python2.7/site-packages/pyasn1/type/char.py | claudiopastorini/geofire-python | 1,346 | 124773 | #
# This file is part of pyasn1 software.
#
# Copyright (c) 2005-2017, <NAME> <<EMAIL>>
# License: http://pyasn1.sf.net/license.html
#
from pyasn1.type import univ, tag
class NumericString(univ.OctetString):
tagSet = univ.OctetString.tagSet.tagImplicitly(
tag.Tag(tag.tagClassUniversal, tag.tagFormatSimple... | 0 | 0 | 3 | 0 | 3 | 0 |
stevedore/tests/test_cache.py | jaraco/stevedore | 133 | 124792 | <gh_stars>100-1000
# 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, softwa... | 0 | 0 | 0 | 0 | 0 | 0 |
app/master/build_store.py | rsennewald/ClusterRunner | 164 | 124800 | from collections import OrderedDict
from itertools import islice
from typing import List
from app.master.build import Build
from app.util.exceptions import ItemNotFoundError
class BuildStore:
"""
Build storage service that stores and handles all builds.
"""
_all_builds_by_id = OrderedDict()
@cla... | 4 | 3 | 0 | 0 | 7 | 0 |
shenfun/forms/__init__.py | spectralDNS/shenfun | 138 | 124870 | <reponame>spectralDNS/shenfun<gh_stars>100-1000
#pylint: disable=missing-docstring
from .project import *
from .inner import *
from .operators import *
from .arguments import *
| 0 | 0 | 0 | 0 | 0 | 0 |
src/ralph/lib/polymorphic/tests/migrations/0001_initial.py | DoNnMyTh/ralph | 1,668 | 124905 | <gh_stars>1000+
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('contenttypes', '0002_remove_content_type_name'),
]
operations = [
migrations.CreateModel(
name='... | 0 | 0 | 0 | 0 | 0 | 0 |
MicroTokenizer/tokenizers/unicode_script/generate_script_data.py | howl-anderson/MicroTokenizer | 136 | 124953 | <filename>MicroTokenizer/tokenizers/unicode_script/generate_script_data.py
def main():
# build indexes from 'scripts.txt'
idx = []
names = []
cats = []
import urllib.request
import re
import textwrap
url = "http://www.unicode.org/Public/UNIDATA/Scripts.txt"
f = urllib.request.urlo... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/dev/test_checksite.py | mskymoore/yoda | 747 | 125030 | # coding=utf-8
from unittest import TestCase
from click.testing import CliRunner
import mock
import yoda
from requests.models import Response
class TestChecksite(TestCase):
"""
Test for the following commands:
| Module: dev
| command: checksite
"""
def __init__(self, methodName:... | 1 | 0 | 0 | 0 | 1 | 0 |
gramex/handlers/functionhandler.py | NAnnamalai/gramex | 130 | 125031 | <reponame>NAnnamalai/gramex<filename>gramex/handlers/functionhandler.py<gh_stars>100-1000
import json
import tornado.web
import tornado.gen
from types import GeneratorType
from gramex.transforms import build_transform
from gramex.config import app_log, CustomJSONEncoder
from .basehandler import BaseHandler
class Func... | 0 | 0 | 0 | 0 | 0 | 0 |
libsortvis/algos/cyclesort.py | tknuth/sortvis | 117 | 125044 |
def cyclesort(lst):
for i in range(len(lst)):
if i != lst[i]:
n = i
while 1:
tmp = lst[int(n)]
if n != i:
lst[int(n)] = last_value
lst.log()
else:
lst[int(n)] = None
... | 0 | 0 | 0 | 0 | 0 | 0 |
admin/test/test_merge_pr.py | stackriot/flocker | 2,690 | 125055 | # Copyright ClusterHQ Inc. See LICENSE file for details.
from __future__ import annotations
"""
Tests for :module:`admin.merge_pr`.
"""
import os
import subprocess
from hypothesis import given
from hypothesis.strategies import (
booleans,
dictionaries,
fixed_dictionaries,
just,
lists,
one_of,... | 2 | 3 | 0 | 0 | 5 | 0 |
raspberryturk/embedded/raspberryturkd.py | Dzhuks/raspberryturk | 169 | 125114 | <reponame>Dzhuks/raspberryturk
import logging
import signal
import time
from daemon import runner
import raspberryturk
from raspberryturk.embedded.agent import Agent
class RaspberryTurkDaemon(object):
def __init__(self):
self.stdin_path = '/dev/null'
self.stdout_path = raspberryturk.log_path('rasp... | 0 | 0 | 0 | 0 | 0 | 0 |
vimfiles/bundle/vim-python/submodules/pylint/tests/functional/i/invalid/invalid_hash_returned.py | ciskoinch8/vimrc | 463 | 125201 | """Check invalid value returned by __hash__ """
# pylint: disable=too-few-public-methods,missing-docstring,no-self-use,import-error, useless-object-inheritance
import six
from missing import Missing
class FirstGoodHash(object):
"""__hash__ returns <type 'int'>"""
def __hash__(self) -> int:
return 1... | 0 | 8 | 0 | 0 | 8 | 0 |
pubnub/endpoints/file_operations/download_file.py | natekspencer/pubnub-python | 146 | 125215 | from pubnub.endpoints.file_operations.file_based_endpoint import FileOperationEndpoint
from pubnub.enums import HttpMethod, PNOperationType
from pubnub.crypto import PubNubFileCrypto
from pubnub.models.consumer.file import PNDownloadFileResult
from pubnub.request_handlers.requests_handler import RequestsRequestHandler
... | 0 | 16 | 0 | 4 | 20 | 0 |
valentyusb/usbcore/rx/shifter.py | rjeschmi/valentyusb | 105 | 125258 | #!/usr/bin/env python3
from migen import *
from migen.fhdl.decorators import ResetInserter
from ..test.common import BaseUsbTestCase
import unittest
@ResetInserter()
class RxShifter(Module):
"""RX Shifter
A shifter is responsible for shifting in serial bits and presenting them
as parallel data. The shi... | 0 | 0 | 0 | 0 | 0 | 0 |
test/ext/mypy/plugin_files/mixin_not_mapped.py | petit87/sqlalchemy | 5,383 | 125265 | from sqlalchemy import Column
from sqlalchemy import Integer
from sqlalchemy import String
from sqlalchemy.orm import declarative_base
from sqlalchemy.orm import registry
reg: registry = registry()
Base = declarative_base()
class SomeAbstract(Base):
__abstract__: bool = True
class HasUpdatedAt:
updated_a... | 0 | 0 | 6 | 0 | 6 | 0 |
vimfiles/bundle/vim-python/submodules/pylint/tests/regrtest_data/absimp/string.py | ciskoinch8/vimrc | 463 | 125287 | """
https://www.logilab.org/ticket/70495
https://www.logilab.org/ticket/70565
"""
from __future__ import absolute_import, print_function
import string
print(string)
| 0 | 0 | 0 | 0 | 0 | 0 |
running_modes/configurations/transfer_learning/adaptive_learning_rate_configuration.py | lilleswing/Reinvent-1 | 183 | 125302 | <reponame>lilleswing/Reinvent-1
from dataclasses import dataclass
@dataclass
class AdaptiveLearningRateConfiguration:
mode: str = "constant"
gamma: float = 0.8
step: int = 1
start: float = 5E-4
min: float = 1E-5
threshold: float = 1E-4
average_steps: int = 4
patience: int = 8
resta... | 0 | 0 | 0 | 0 | 0 | 0 |
main.py | matthew-z/pytorch_rnet | 227 | 125313 | <reponame>matthew-z/pytorch_rnet
import argparse
import datetime
from pathlib import Path
from allennlp.commands import main, Subcommand
from allennlp.commands.train import train_model
from allennlp.common import Params
from allennlp.common.util import import_submodules
from allennlp.models import Model
class MyTrai... | 0 | 0 | 0 | 0 | 0 | 0 |
research/long_block_sequencer/long_block_encoder.py | legacyai/tf-transformers | 116 | 125356 | <reponame>legacyai/tf-transformers<gh_stars>100-1000
# coding=utf-8
# Copyright 2021 TF-Transformers 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
#
# ht... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/external_libs/scapy-2.4.5/scapy/contrib/automotive/gm/gmlanutils.py | dariusgrassi/trex-core | 250 | 125386 | <reponame>dariusgrassi/trex-core<filename>scripts/external_libs/scapy-2.4.5/scapy/contrib/automotive/gm/gmlanutils.py<gh_stars>100-1000
#! /usr/bin/env python
# This file is part of Scapy
# See http://www.secdev.org/projects/scapy for more information
# Copyright (C) <NAME> <<EMAIL>>
# Copyright (C) <NAME> <<EMAIL>>
#... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/hacker_news_assets/hacker_news_assets/pipelines/story_recommender.py | rpatil524/dagster | 4,606 | 125409 | <gh_stars>1000+
from dagster import fs_io_manager
from dagster.core.asset_defs import build_assets_job
from hacker_news_assets.assets.comment_stories import comment_stories
from hacker_news_assets.assets.download_items import comments, stories
from hacker_news_assets.assets.recommender_model import component_top_storie... | 0 | 0 | 0 | 0 | 0 | 0 |
ci/drone/supplier.py | parauliya/osie | 108 | 125427 | <gh_stars>100-1000
#!/usr/bin/env python
from __future__ import print_function
import json
import os
import packet
m = packet.Manager(os.getenv("PACKET_API_TOKEN"))
c = m.get_capacity()
cap = {}
for fac in c:
for plan, v in c[fac].items():
p = cap.get(plan, {})
level = v["level"]
lvl = ... | 0 | 0 | 0 | 0 | 0 | 0 |
vissl/models/__init__.py | blazejdolicki/vissl | 2,512 | 125440 | # Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Here we create all the models required for SSL. The default model is
BaseSSLMultiInputOutputModel, however users can create their own model... | 1 | 4 | 0 | 0 | 5 | 0 |
examples/utils/app.py | pichatelli/simple-settings | 213 | 125490 | from simple_settings import settings
from simple_settings.utils import settings_stub
# Stub examples
with settings_stub(SOME_SETTING='foo'):
assert settings.SOME_SETTING == 'foo'
assert settings.SOME_SETTING == 'bar'
@settings_stub(SOME_SETTING='foo')
def get_some_setting() -> object:
return settings.SOME_SE... | 0 | 1 | 0 | 0 | 1 | 0 |
Chapter03/3_9a_unix_domain_socket_server.py | shamir456/Python-Network-Programming-Cookbook-Second-Edition | 125 | 125559 | #!/usr/bin/env python
# Python Network Programming Cookbook, Second Edition -- Chapter - 3
# This program is optimized for Python 2.7.12 and Python 3.5.2.
# It may run on any other version with/without modifications.
import socket
import os
import time
SERVER_PATH = "/tmp/python_unix_socket_server"
def run_unix_do... | 0 | 0 | 0 | 0 | 0 | 0 |
LeetCode/python3/704.py | ZintrulCre/LeetCode_Archiver | 279 | 125570 | class Solution:
def search(self, nums, target) -> object:
"""
:type nums: List[int]
:type target: int
:rtype: int
"""
start, end = 0, len(nums)- 1
while start <= end:
mid = start + (end - start) // 2
if nums[mid] < target:
... | 0 | 1 | 0 | 0 | 1 | 0 |
tools/npy_2_aud.py | KeigoTakamura/Waveglow_Inference_in_CUDA | 135 | 125578 | <gh_stars>100-1000
import os, sys
import numpy as np
from scipy.io.wavfile import write
folder = sys.argv[1]
for file in os.listdir(folder):
if file.endswith(".npy"):
print(file, file.split(".")[0])
a = np.load(folder+file)
write(folder+file.split(".")[0]+".wav", 22050, a) | 0 | 0 | 0 | 0 | 0 | 0 |
oss_src/unity/python/sframe/__init__.py | venkattgg/venkey | 493 | 125616 | """
@package graphlab
...
GraphLab Create is a machine learning platform that enables data scientists and
app developers to easily create intelligent applications at scale. Building an
intelligent, predictive application involves iterating over multiple steps:
cleaning the data, developing features, training a model, a... | 0 | 3 | 0 | 0 | 3 | 0 |
examples/parallel/run_parallel_sw_merimbula_test.py | GeoscienceAustralia/anuga_core | 136 | 125623 | #!/usr/bin/env python
#########################################################
#
# Main file for parallel mesh testing.
#
# This is a modification of the run_parallel_advection.py
# file.
#
#
# *) The (new) files that have been added to manage the
# grid partitioning are
# +) pmesh_divide_metis.py: subdivide a pm... | 3 | 1 | 0 | 0 | 4 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.