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 |
|---|---|---|---|---|---|---|---|---|---|---|
bindings/python/setup.py | yutiansut/opentick | 147 | 1790923 | <filename>bindings/python/setup.py
try:
import distribute_setup
distribute_setup.use_setuptools()
except:
pass
from setuptools import setup, find_packages
import os
import re
with open(os.path.join(os.path.dirname(__file__), 'opentick',
'__init__.py')) as f:
version = re.search("__versi... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/psd_tools/psd/test_image_resources.py | afrigon/psd-tools | 644 | 1790924 | <reponame>afrigon/psd-tools<filename>tests/psd_tools/psd/test_image_resources.py
from __future__ import absolute_import, unicode_literals
import pytest
import os
from psd_tools.constants import Resource
from psd_tools.psd.image_resources import ImageResources, ImageResource, Slices
from IPython.display import display
... | 0 | 0 | 0 | 0 | 0 | 0 |
packages/fetchai/skills/ml_data_provider/strategy.py | bryanchriswhite/agents-aea | 126 | 1790945 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may ob... | 0 | 0 | 0 | 0 | 0 | 0 |
chapter15_Homomorphic_Encryption/models.py | iroan/Practicing-Federated-Learning | 227 | 1790978 | <filename>chapter15_Homomorphic_Encryption/models.py
import torch
from torchvision import models
import numpy as np
def encrypt_vector(public_key, x):
return [public_key.encrypt(i) for i in x]
def encrypt_matrix(public_key, x):
ret = []
for r in x:
ret.append(encrypt_vector(public_key, r))
return ret
... | 0 | 0 | 0 | 0 | 0 | 0 |
gwd/backbones/res2net.py | kazakh-shai/kaggle-global-wheat-detection | 136 | 1791000 | from __future__ import annotations
import torch.nn as nn
from mmcv.cnn import constant_init, kaiming_init
from mmcv.runner import load_checkpoint
from torch.nn.modules.batchnorm import _BatchNorm
from mmdet.models.backbones.res2net import Res2Net
from mmdet.models.backbones.resnet import BasicBlock, Bottleneck
from mm... | 1 | 0 | 0 | 0 | 1 | 0 |
block/models/criterions/kl_divergence.py | Karol-G/block.bootstrap.pytorch | 312 | 1791014 | <reponame>Karol-G/block.bootstrap.pytorch
# import torch.nn.functional as F
# import torch.nn as nn
# from torch.autograd import Variable
# from bootstrap.lib.logger import Logger
# class KLDivLoss(nn.Module):
# def __init__(self, engine=None):
# super(KLDivLoss, self).__init__()
# self.loss = nn.... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_training/test_callbacks/test_logging/test_tensorboard.py | 0h-n0/inferno | 204 | 1791020 | import unittest
import os
from shutil import rmtree
import numpy as np
import torch
import torch.nn as nn
from inferno.trainers.basic import Trainer
from torch.utils.data.dataset import TensorDataset
from torch.utils.data.dataloader import DataLoader
from inferno.trainers.callbacks.logging.tensorboard import Tensorboa... | 1 | 3 | 1 | 0 | 5 | 0 |
.backup/ProREG.py | yerang823/landmark-detection | 612 | 1791026 | <filename>.backup/ProREG.py
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
#
import torch
import torch.nn as nn
def weights_init_reg(m):
if isinstance(m, nn.Conv2d) o... | 0 | 0 | 0 | 0 | 0 | 0 |
hardware/opentrons_hardware/scripts/generate_header.py | y3rsh/opentrons | 235 | 1791102 | <reponame>y3rsh/opentrons
"""Script to generate c++ header file of canbus constants."""
from __future__ import annotations
import argparse
import io
from enum import Enum
from pathlib import Path
from typing import Type, Any
from opentrons_hardware.drivers.can_bus import (
MessageId,
FunctionCode,
NodeId,
... | 0 | 0 | 0 | 0 | 0 | 0 |
kqueen/tests/test_kubeapi.py | LaudateCorpus1/kqueen | 140 | 1791108 | from kqueen.kubeapi import KubernetesAPI
from kubernetes.client.rest import ApiException
from pprint import pprint as print
import pytest
import yaml
import kubernetes
def fake_raise(exc) -> object:
def fn(self, *args, **kwargs):
raise exc
return fn
class TestKubeApi:
def test_missing_cluster_... | 0 | 3 | 0 | 0 | 3 | 0 |
examples/docs_snippets_crag/docs_snippets_crag_tests/concepts_tests/io_management_tests/test_output_config.py | dagster-io/dagster | 4,606 | 1791115 | from docs_snippets_crag.concepts.io_management.output_config import execute_my_job_with_config
def test_execute_job():
execute_my_job_with_config()
| 0 | 0 | 0 | 0 | 0 | 0 |
reddit2telegram/channels/r_vault_hunters/app.py | mainyordle/reddit2telegram | 187 | 1791124 | <gh_stars>100-1000
#encoding:utf-8
from utils import weighted_random_subreddit
subreddit = weighted_random_subreddit({
'borderHands': 1,
'Borderlands': 1,
'Borderlands2': 1,
'borderlands3': 1
})
t_channel = '@r_vault_hunters'
def send_post(submission, r2t):
return r2t.send_simple(submission)
| 0 | 0 | 0 | 0 | 0 | 0 |
python_toolbox/wx_tools/timing/thread_timer.py | hboshnak/python_toolbox | 119 | 1791137 | # Copyright 2009-2017 <NAME>.
# This program is distributed under the MIT license.
# todo: daemonize?
# todo: kickass idea: make all timers use one thread that will sleep smartly
# to send all events correctly.
import threading
import time
import wx
from python_toolbox.wx_tools.timing import cute_base_timer
wxEVT... | 0 | 2 | 1 | 2 | 5 | 0 |
Coins in a Line II.py | RijuDasgupta9116/LintCode | 321 | 1791150 | <gh_stars>100-1000
"""
There are n coins with different value in a line. Two players take turns to take one or two coins from left side until
there are no more coins left. The player who take the coins with the most value wins.
Could you please decide the first player will win or lose?
Example
Given values array A = ... | 0 | 0 | 0 | 0 | 0 | 0 |
RecoParticleFlow/PFTracking/python/particleFlowDisplacedVertex_cff.py | ckamtsikis/cmssw | 852 | 1791164 | import FWCore.ParameterSet.Config as cms
from RecoParticleFlow.PFTracking.particleFlowDisplacedVertex_cfi import *
| 0 | 0 | 0 | 0 | 0 | 0 |
imagenet/models/layers/full_attention.py | batuozt/transformer-ls | 177 | 1791259 | <filename>imagenet/models/layers/full_attention.py
# Copyright (c) 2021 Microsoft Corporation. Licensed under the MIT license.
# Written by <NAME>, <EMAIL>
from torch import nn
import torch
from timm.models.layers import trunc_normal_
class Attention(nn.Module):
def __init__(self, dim, num_heads=8, qkv_bias=False... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/utils.py | seantis/mailthon | 230 | 1791264 | from sys import version_info
from pytest import fixture
from mock import Mock, call
if version_info[0] == 3:
unicode = str
bytes_type = bytes
else:
unicode = lambda k: k.decode('utf8')
bytes_type = str
def mocked_smtp(*args, **kwargs) -> object:
smtp = Mock()
smtp.return_value = smtp
smt... | 0 | 2 | 0 | 0 | 2 | 0 |
data_structures/linked_lists/doubly_linked_list.py | vinta/fuck-coding-interviews | 590 | 1791292 | # coding: utf-8
from __future__ import annotations
from data_structures.linked_lists.singly_linked_list import LinkedList
class DoublyListNode:
def __init__(self, value: object | None=None, next: object | None=None, previous: object | None=None):
self.value = value
self.next = next
self.pr... | 5 | 3 | 0 | 0 | 8 | 0 |
features/steps/matrix-visualization.py | eaton-lab/toyplot | 438 | 1791306 | # Copyright 2014, Sandia Corporation. Under the terms of Contract
# DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain
# rights in this software.
from behave import *
import numpy
import toyplot.locator
@given(u'a matrix')
def step_impl(context):
numpy.random.seed(1234)
context.ma... | 0 | 0 | 0 | 0 | 0 | 0 |
app/utils/RequestUtil.py | modoupi/git-webhook | 1,617 | 1791318 | # -*- coding: utf-8 -*-
from __future__ import annotations
'''
Created on 2015-8-21
@author: hustcc
'''
from flask.globals import request, session
# get / post data
def get_parameter(key, default: object | None=None) -> object:
'''
info:获得请求参数,包括get和post,其他类型的访问不管
'''
# post参数
if request.method ... | 1 | 2 | 0 | 0 | 3 | 0 |
oceanlotus/ol_unpack_shellcode_from_decoy.py | H1d3r/malware-research | 322 | 1791330 | # This script extracts the shellcode from the fake document dropper of the
# latest OceanLotus campaign using the side-loading technique against
# legitimate "rastls.exe" application from Symantec
# Details about OceanLotus can be found at
# https://www.welivesecurity.com/wp-content/uploads/2018/03/ESET_OceanLotus.pdf... | 0 | 0 | 0 | 0 | 0 | 0 |
code-preprocessing/log-reconstruction/evaluations_append.py | cavalcantigor/coco | 181 | 1791345 | <reponame>cavalcantigor/coco<filename>code-preprocessing/log-reconstruction/evaluations_append.py
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import sys
import argparse
import fileinput
from cocoprep.archive_exceptions import PreprocessingException, Prepr... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/SDKTool/src/ui/dialog/edit_dialog.py | Passer-D/GameAISDK | 1,210 | 1791387 | # -*- coding: utf-8 -*-
from __future__ import annotations
"""
Tencent is pleased to support the open source community by making GameAISDK available.
This source code file is licensed under the GNU General Public License Version 3.
For full details, please refer to the file "LICENSE.txt" which is provided as part of t... | 5 | 1 | 0 | 1 | 7 | 0 |
Chapter05/Ch5/custom_events.py | henrryyanez/Tkinter-GUI-Programming-by-Example | 127 | 1791391 | <filename>Chapter05/Ch5/custom_events.py
import random
import tkinter as tk
win = tk.Tk()
sv = tk.StringVar()
sv.set('You are walking around with an open wallet...')
lab = tk.Label(win, textvar=sv)
def user_found_money(event=None):
amount = event.x
sv.set('You found £' + str(amount))
def user_lost_money(ev... | 0 | 0 | 0 | 0 | 0 | 0 |
src/oncall/auth/logout.py | navoday-91/oncall | 857 | 1791496 | # Copyright (c) LinkedIn Corporation. All rights reserved. Licensed under the BSD-2 Clause license.
# See LICENSE in the project root for license information.
from .. import db
def on_post(req, resp):
session = req.env['beaker.session']
connection = db.connect()
cursor = connection.cursor()
cursor.ex... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/tensorflow/test_models/densenet.py | MaximProshin/nncf | 136 | 1791526 | <gh_stars>100-1000
"""
Copyright (c) 2022 Intel Corporation
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 ... | 0 | 0 | 0 | 0 | 0 | 0 |
starfish/core/imagestack/test/factories/with_coords.py | haoxusci/starfish | 164 | 1791528 | <reponame>haoxusci/starfish<filename>starfish/core/imagestack/test/factories/with_coords.py<gh_stars>100-1000
from collections import OrderedDict
import numpy as np
import xarray as xr
from starfish.core.imagestack.imagestack import ImageStack
from starfish.core.imagestack.physical_coordinates import _get_physical_co... | 0 | 0 | 0 | 0 | 0 | 0 |
lightbulb/modules/distinguish_waf.py | mehrdad-shokri/lightbulb-framework | 497 | 1791534 | <filename>lightbulb/modules/distinguish_waf.py<gh_stars>100-1000
from lightbulb.core.utils.httphandler import HTTPHandler
from lightbulb.core.utils.common import findlibrary
import json
META = {
'author': '<NAME>, <NAME>',
'description': 'Identifies a WAF filter using a distinguish tree',
'type':'Distingui... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/admin/clush-tests/CLIOptionParserTest.py | utdsimmons/ohpc | 692 | 1791540 | <filename>tests/admin/clush-tests/CLIOptionParserTest.py<gh_stars>100-1000
#!/usr/bin/env python
# ClusterShell.CLI.OptionParser test suite
# Written by <NAME> 2010-09-25
"""Unit test for CLI.OptionParser"""
from optparse import OptionConflictError
import os
import sys
import tempfile
import unittest
sys.path.inser... | 0 | 0 | 0 | 0 | 0 | 0 |
compiler/model_configs/sram_7b_256w_4wpr_25las_1rw.py | im-world/OpenRAM | 335 | 1791568 | from shared_config import *
word_size = 7
num_words = 256
words_per_row = 4
local_array_size = 25
output_extended_config = True
output_datasheet_info = True
netlist_only = True
nominal_corner_only = True
| 0 | 0 | 0 | 0 | 0 | 0 |
gateway/src/post.py | bother3000/Smart-IoT-Planting-System | 171 | 1791572 | #!/usr/bin/env python
import requests
HTTP POST message to cloud platform
#Most times gateway communicate with cloud via MQTT(hbmqtt framework),
#in some special time, it need to use HTTP(requests framework) to POST message to cloud.
| 0 | 0 | 0 | 0 | 0 | 0 |
rex/exploit/shellcodes/x86_setregister.py | balbassam/rex | 471 | 1791632 | from __future__ import annotations
import claripy
from ..shellcode import Shellcode
class X86SetRegister(Shellcode):
os: list[str] = ["cgc", "unix"]
arches: list[str] = ["X86"]
name: str = "setregister"
codes: dict[str,list[bytes]] = {
'eax': [b"\xb8", b"\xbb", b"\xff\xe3"],
... | 1 | 1 | 4 | 0 | 6 | 0 |
setup/snap.py | Cam2337/snap-python | 242 | 1791658 | # This file was automatically generated by SWIG (http://www.swig.org).
# Version 2.0.9
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from __future__ import annotations
from sys import version_info
if version_info >= (3,0,0):
new_instancemethod ... | 48 | 1,683 | 0 | 0 | 1,731 | 0 |
how-to-use-azureml/reinforcement-learning/multiagent-particle-envs/files/particle_train.py | lobrien/MachineLearningNotebooks | 3,074 | 1791691 | import argparse
import re
import os
import ray
from ray.tune import run_experiments
from ray.tune.registry import register_trainable, register_env, get_trainable_cls
import ray.rllib.contrib.maddpg.maddpg as maddpg
from rllib_multiagent_particle_env import env_creator
from util import parse_args
def setup_ray():
... | 0 | 5 | 0 | 0 | 5 | 0 |
modules/dnn/feathernet/tools/gluon2pytorch.py | zongwave/libxcam | 1,439 | 1791741 | #!/usr/bin/env python3
# encoding: utf-8
# @Time : 2018/8/4 下午11:32
# @Author : yuchangqian
# @Contact : <EMAIL>
# @File : gluon2pytorch.py
import os
import mxnet as mx
from gluoncv.model_zoo import get_model
import torch
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-m', '--model', ... | 0 | 0 | 0 | 0 | 0 | 0 |
Python/if.py | saurabhcommand/Hello-world | 1,428 | 1791743 | <gh_stars>1000+
//Compare
a = int(input("Please input value for A "))
b = int(input("Please input value for B "))
if b > a:
print("b is greater than a")
elif a == b:
print("a and b are equal")
| 0 | 0 | 0 | 0 | 0 | 0 |
src/pretix/api/serializers/voucher.py | fabm3n/pretix | 1,248 | 1791765 | <reponame>fabm3n/pretix
#
# This file is part of pretix (Community Edition).
#
# Copyright (C) 2014-2020 <NAME> and contributors
# Copyright (C) 2020-2021 rami.io GmbH and contributors
#
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General
# Public License ... | 0 | 0 | 0 | 0 | 0 | 0 |
leetcode.com/python/69_Sqrt(x).py | vansh-tiwari/coding-interview-gym | 713 | 1791766 | class Solution(object):
def mySqrt(self, x) -> object:
"""
:type x: int
:rtype: int
"""
if x < 2:
return x
left, right = 0, x // 2
while left <= right:
mid = left + (right - left) // 2
num = mid * mid
if num > x:... | 0 | 1 | 0 | 0 | 1 | 0 |
froide/document/models.py | xenein/froide | 198 | 1791850 | from __future__ import annotations
from django.db import models
from filingcabinet.models import (
AbstractDocument,
AbstractDocumentCollection,
DocumentManager as FCDocumentManager,
DocumentCollectionManager as FCDocumentCollectionManager,
get_page_image_filename,
Page,
)
from froide.helper.a... | 5 | 16 | 0 | 0 | 21 | 0 |
demo/centernet_tensorrt_engine.py | shachargluska/centerpose | 245 | 1791910 | from __future__ import annotations
import logging
import os
import sys
import cv2
import numpy as np
import torch
import torch.nn as nn
import _init_paths
from config import cfg, update_config
from models.utils import _gather_feat, _transpose_and_gather_feat
from tensorrt_model import TRTModel
from utils.image import... | 10 | 11 | 0 | 0 | 21 | 0 |
factorioBlueprintVisualizer/draw.py | piebro/factorio-blueprint-visualizer | 122 | 1791918 | <filename>factorioBlueprintVisualizer/draw.py
import numpy as np
def get_drawing(bbox_width, bbox_height, svg_width_in_mm=250, background_color="#dddddd", metadata_str=None):
dwg = [f'<svg baseProfile="tiny" height="{svg_width_in_mm*bbox_height/bbox_width}mm" version="1.2" viewBox="0,0,{bbox_width},{bbox_height}" wi... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/calculate_shap.py | janged/explainx | 310 | 1792009 | from __future__ import annotations
from imports import *
from rescale_numeric_feature import *
"""
This class calculates feature importance
Input:
"""
class calculate_shap():
def __init__(self):
super(calculate_shap, self).__init__()
self.param: None = None
def xgboost_shap(self, model, ... | 2 | 10 | 0 | 1 | 13 | 0 |
tests/scripts/builder.py | florianjacob/gpuocelot | 221 | 1792024 | <reponame>florianjacob/gpuocelot
# \file build.py
#
# \author <NAME> <<EMAIL>>
# \date December 13, 2011
#
# \brief Common elements of SConstruct files for GPU Ocelot regression tests
#
import SCons
import os
import sys
import platform
def getCudaPaths():
"""Determines CUDA {bin,lib,include} paths
returns (bin_pa... | 0 | 0 | 0 | 0 | 0 | 0 |
femlib/test.py | jzw0025/fem-with-python | 148 | 1792031 | from ifem import test_solve_system
test_solve_system()
from applications import test_uniform_bar
test_uniform_bar()
| 0 | 0 | 0 | 0 | 0 | 0 |
dev/Gems/CloudGemLeaderboard/AWS/lambda-code/ServiceLambda/api/player_ban.py | brianherrera/lumberyard | 1,738 | 1792033 | #
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
# its licensors.
#
# For complete copyright and license terms please see the LICENSE at the root of this
# distribution (the "License"). All use of this software is governed by the License,
# or, if provided, by the license below or th... | 2 | 2 | 0 | 0 | 4 | 0 |
notebooks/exercise_solutions/n07_simulation_plot-speeds.py | pydy/pydy-tutorial-human-standing | 134 | 1792117 | plot(t, rad2deg(y[:, 3:]))
xlabel('Time [s]')
ylabel('Angular Rate [deg/s]')
legend(["${}$".format(vlatex(s)) for s in speeds]) | 0 | 0 | 0 | 0 | 0 | 0 |
codes/RANet_lib/Resnet_ins101.py | v1viswan/RANet_modifications | 267 | 1792153 | # ************************************
# Author: <NAME>
# Email: <EMAIL>
# Github: https://github.com/Storife
# ************************************
import torch
import torch.nn as nn
from numpy.random import normal
from numpy.linalg import svd
from math import sqrt
import torchvision.models as models
# from resnet_ins... | 1 | 1 | 0 | 0 | 2 | 0 |
pythran/tests/test_version.py | jeanlaroche/pythran | 1,647 | 1792169 | <gh_stars>1000+
import re
import pythran
from pythran.tests import TestEnv
class TestVersion(TestEnv):
def test_version_check_cython(self):
# Cython actually does this check (variable is named
# `pythran_is_pre_0_9_6`). Make sure it doesn't break.
v = pythran.__version__
pre_096 =... | 0 | 0 | 0 | 0 | 0 | 0 |
fuxi/common/thirdparty/wydomain/utils/googlect.py | cocobear/fuxi | 731 | 1792174 | <gh_stars>100-1000
# encoding: utf-8
# import sys
# sys.path.append("../")
import time
import json
import logging
from random import Random,uniform
from urllib.parse import quote
from common import http_request_get
def random_sleep():
time.sleep(uniform(0,2))
def random_str(randomlength=8):
rstr = ''
c... | 0 | 0 | 0 | 0 | 0 | 0 |
datasources/manual/cord_nineteen_transformer.py | mfleming99/COVID-QA | 336 | 1792210 | # Simple script to turn CORD-19 data into .txt files to be added to
# the deepset.ai text annotation tool
# assumes you downbloaded the CORD-19 data: https://pages.semanticscholar.org/coronavirus-research
# On a modern laptop this scrip takes about less tha a minute to run on each CORD-19 subset.
import os
import sys... | 0 | 0 | 0 | 0 | 0 | 0 |
app/api/models/LXCImage.py | bet4it/lxdui | 589 | 1792277 | <gh_stars>100-1000
from app.api.models.LXDModule import LXDModule
from app.lib.conf import MetaConf
from app.api.utils.firebaseAuthentication import firebaseLogin
from app import __metadata__ as meta
import logging
import requests
import subprocess
import shutil
import os
import yaml
import tarfile
logging = logging.g... | 0 | 0 | 0 | 0 | 0 | 0 |
lightseq/training/ops/pytorch/builder/__init__.py | onlyrico/lightseq | 1,985 | 1792280 | from .builder import CUDAOpBuilder
from .kernel_builder import KernelBuilder
from .transformer_builder import TransformerBuilder
from .adam_builder import AdamBuilder
# TODO: infer this list instead of hard coded
# List of all available ops
__op_builders__ = [
KernelBuilder(),
TransformerBuilder(),
AdamBui... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/python/test_langserver.py | csullivan/ffi-navigator | 148 | 1792302 | from ffi_navigator import langserver
from ffi_navigator.util import join_path, normalize_path
import logging
import os
curr_path = os.path.dirname(os.path.realpath(os.path.expanduser(__file__)))
def run_find_definition(server, path, line, character) -> object:
uri = langserver.path2uri(path)
res = server.m_t... | 0 | 4 | 0 | 0 | 4 | 0 |
src/graphql/pyutils/group_by.py | glennlaughlin/graphql-core | 249 | 1792335 | <reponame>glennlaughlin/graphql-core<gh_stars>100-1000
from collections import defaultdict
from typing import Callable, Collection, Dict, List, TypeVar
__all__ = ["group_by"]
K = TypeVar("K")
T = TypeVar("T")
def group_by(items: Collection[T], key_fn: Callable[[T], K]) -> Dict[K, List[T]]:
"""Group an unsorted ... | 0 | 0 | 0 | 0 | 0 | 0 |
plotdevice/context.py | plotdevice/plotdevice | 110 | 1792356 | # encoding: utf-8
import os, re, types
from contextlib import contextmanager
from collections import namedtuple
from os.path import exists, expanduser
from objc import super
from .lib.cocoa import *
from .lib import pathmatics
from .util import _copy_attr, _copy_attrs, _flatten, trim_zeroes, numlike, autorelease
from ... | 0 | 0 | 0 | 0 | 0 | 0 |
cflearn/models/cv/gan/losses.py | carefree0910/carefree-learn | 400 | 1792399 | import torch
from torch import nn
from typing import Optional
from typing import NamedTuple
from .discriminators import DiscriminatorOutput
from ....misc.toolkit import get_gradient
class GANTarget(NamedTuple):
is_real: bool
labels: Optional[torch.Tensor] = None
class GradientNormLoss(nn.Module):
def ... | 8 | 3 | 2 | 1 | 14 | 0 |
scripts/divide_shapenet_label.py | KunalMGupta/deep_cage | 123 | 1792401 | <reponame>KunalMGupta/deep_cage
import multiprocessing
import subprocess
import shlex
from shutil import copy2
import os
from glob import glob
import numpy as np
from collections import OrderedDict
from pytorch_points.utils.pc_utils import load, save_ply, save_ply_property
from multiprocessing.pool import ThreadPool
fr... | 0 | 0 | 0 | 0 | 0 | 0 |
pynput__examples/pynput__global_hot_key.py | DazEB2/SimplePyScripts | 117 | 1792425 | <filename>pynput__examples/pynput__global_hot_key.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
# pip install pynput
from pynput.keyboard import Key, Listener
def on_release(key):
if key == Key.f7:
print('screenshot')
# Fullscreen
import pyscreenshot as Imag... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/pybullet/gym/pybullet_envs/minitaur/robots/robot_base.py | felipeek/bullet3 | 9,136 | 1792457 | <filename>examples/pybullet/gym/pybullet_envs/minitaur/robots/robot_base.py
# Lint as: python3
"""The abstract robot class."""
import abc
from typing import Optional, Sequence
# Action names for robots operating kinematically.
LINEAR_VELOCITY = "linear_velocity"
ANGULAR_VELOCITY = "angular_velocity"
class RobotBase... | 0 | 0 | 0 | 0 | 0 | 0 |
nautobot/utilities/management/commands/makemigrations.py | psmware-ltd/nautobot | 384 | 1792569 | # noinspection PyUnresolvedReferences
from django.core.management.commands.makemigrations import Command
from django.db import models
from . import custom_deconstruct
__all__ = ("Command",)
# Overload deconstruct with our own.
models.Field.deconstruct = custom_deconstruct
| 0 | 0 | 0 | 0 | 0 | 0 |
examples/parallel/run_sequential_dist_distribute_merimbula.py | GeoscienceAustralia/anuga_core | 136 | 1792599 | <reponame>GeoscienceAustralia/anuga_core
"""Run parallel shallow water domain.
run using command like:
python run_sequential_dist_distribute_merimbula.py
will produce 4 pickled files corresponding partitioned domains
"""
#------------------------------------------------------------------------------
#... | 0 | 0 | 0 | 0 | 0 | 0 |
myia/ir/clone.py | strint/myia | 222 | 1792622 | <filename>myia/ir/clone.py
"""Graph cloning facilities.
GraphRemapper/BasicRemapper are the core remapping classes that can be extended
by graph transformers.
"""
from dataclasses import dataclass
from ..info import About
from ..utils import Partializable
from .anf import ANFNode, Apply, Constant, Graph, Parameter
f... | 0 | 0 | 0 | 0 | 0 | 0 |
python/existing-vpc-new-ec2-ebs-userdata/app.py | marclyo/aws-cdk-examples | 2,941 | 1792636 | #!/usr/bin/env python3
from aws_cdk import core
from cdk_vpc_ec2.cdk_vpc_ec2_stack import CdkVpcEc2Stack
# Define your account id to make import vpc work
env_cn = core.Environment(account="YOUR_ACCOUNT_ID_WITHOUT_HYPHEN", region="cn-northwest-1")
app = core.App()
CdkVpcEc2Stack(app, "cdk-vpc-ec2", env=env_cn)
app.... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/calendar.py | alexanu/trading-with-python | 318 | 1792648 | <gh_stars>100-1000
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Calendar functions
based on examples from here: https://stackoverflow.com/questions/33094297/create-trading-holiday-calendar-with-pandas
and pandas docs: https://pandas.pydata.org/pandas-docs/stable/timeseries.html?highlight=abstractholidaycalendar
... | 0 | 0 | 0 | 0 | 0 | 0 |
kratos/python_scripts/sub_model_part_skin_detection_process.py | lkusch/Kratos | 778 | 1792682 | <filename>kratos/python_scripts/sub_model_part_skin_detection_process.py
# Importing the Kratos Library
import KratosMultiphysics
def Factory(settings, Model):
if(type(settings) != KratosMultiphysics.Parameters):
raise Exception("expected input shall be a Parameters object, encapsulating a json string")
... | 0 | 0 | 0 | 0 | 0 | 0 |
solutions/problem_111.py | ksvr444/daily-coding-problem | 1,921 | 1792736 | <reponame>ksvr444/daily-coding-problem
def add_needed_char(needed, char):
if char not in needed:
needed[char] = 0
needed[char] += 1
def remove_gained_char(needed, char):
needed[char] -= 1
def get_anagram_starts(string, word):
if len(word) > len(string):
return []
anagram_indices... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/integration/cartography/intel/aws/ec2/test_ec2_instances.py | ramonpetgrave64/cartography | 2,322 | 1792771 | import cartography.intel.aws.ec2
import cartography.intel.aws.iam
import tests.data.aws.ec2.instances
import tests.data.aws.iam
from cartography.util import run_analysis_job
TEST_ACCOUNT_ID = '000000000000'
TEST_REGION = 'us-east-1'
TEST_UPDATE_TAG = 123456789
def test_load_ec2_instances(neo4j_session, *args):
"... | 0 | 0 | 0 | 0 | 0 | 0 |
h2o-py/tests/testdir_jira/pyunit_pubdev_7119.py | vishalbelsare/h2o-3 | 6,098 | 1792829 | import sys
sys.path.insert(1,"../../")
import h2o
from tests import pyunit_utils
import pandas as pd
def pubdev_7119():
# Test 1
pd_df = pd.DataFrame({'col1': [1,2], 'col2': ['foo"foo\nfoo','foo2'], 'col3': [1,2]})
h2o_df = h2o.H2OFrame(pd_df)
pd_df2 = h2o_df.as_data_frame()
print(pd_df)
... | 0 | 0 | 0 | 0 | 0 | 0 |
mos_RangeNet/tasks/semantic/dataset/kitti/parser.py | collector-m/LiDAR-MOS | 268 | 1792839 | <gh_stars>100-1000
import os
import numpy as np
import torch
from torch.utils.data import Dataset
from common.laserscan import LaserScan, SemLaserScan
from dataset.kitti.utils import load_poses, load_calib
EXTENSIONS_SCAN = ['.bin']
EXTENSIONS_LABEL = ['.label']
EXTENSIONS_RESIDUAL = ['.npy']
def is_scan(filename):
... | 0 | 0 | 0 | 0 | 0 | 0 |
cloudiscovery/provider/aws/command.py | MalarvizhiK/cloudiscovery | 429 | 1792877 | <reponame>MalarvizhiK/cloudiscovery
from provider.aws.all.command import All
from provider.aws.common_aws import generate_session, aws_verbose
from provider.aws.iot.command import Iot
from provider.aws.limit.command import Limit
from provider.aws.policy.command import Policy
from provider.aws.security.command import Se... | 0 | 0 | 0 | 0 | 0 | 0 |
tokenization/bpe_tokenization.py | evinaybit/100-Days-of-NLP | 239 | 1792887 | import os
import sentencepiece as spm
DATAFILE = '../data/pg16457.txt'
MODELDIR = 'models'
spm.SentencePieceTrainer.train(f'''\
--model_type=bpe\
--input={DATAFILE}\
--model_prefix={MODELDIR}/bpe\
--vocab_size=500''')
sp = spm.SentencePieceProcessor()
sp.load(os.path.join(MODELDIR, 'bpe.model'))
inp... | 0 | 0 | 0 | 0 | 0 | 0 |
Python-Data-Structures-and-Algorithms-master/Chapter05/stack_queue_1.py | white-source/happy_shua_shua | 131 | 1792920 | <filename>Python-Data-Structures-and-Algorithms-master/Chapter05/stack_queue_1.py
class Queue:
def __init__(self):
self.inbound_stack = []
self.outbound_stack = []
def dequeue(self):
if not self.outbound_stack:
while self.inbound_stack:
self.outbound_stack.ap... | 0 | 0 | 0 | 0 | 0 | 0 |
Util/CythonUtil.py | leoatchina/MachineLearning | 1,107 | 1792965 | <reponame>leoatchina/MachineLearning
import sys
import Cython.Compiler.Main
from numpy.distutils.command import build_src
from numpy.distutils.misc_util import appendpath
from numpy.distutils import log
from os.path import join as p_join, dirname
from distutils.dep_util import newer_group
from distutils.errors i... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/transform/headers.py | OptionMetrics/petl | 495 | 1792980 | <gh_stars>100-1000
from __future__ import division, print_function, absolute_import
# rename()
##########
import petl as etl
table1 = [['sex', 'age'],
['m', 12],
['f', 34],
['-', 56]]
# rename a single field
table2 = etl.rename(table1, 'sex', 'gender')
table2
# rename multiple fields by... | 0 | 0 | 0 | 0 | 0 | 0 |
corehq/apps/accounting/migrations/0039_auto_20180828_2258.py | dimagilg/commcare-hq | 471 | 1793063 | <filename>corehq/apps/accounting/migrations/0039_auto_20180828_2258.py<gh_stars>100-1000
# Generated by Django 1.11.14 on 2018-08-28 22:58
from django.db import migrations, models
from corehq.apps.accounting.bootstrap.config.user_buckets_august_2018 import (
BOOTSTRAP_CONFIG,
)
from corehq.apps.accounting.bootstr... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_userfields_with_modelserializer.py | simiotics/djangorestframework-queryfields | 195 | 1793075 | <reponame>simiotics/djangorestframework-queryfields<gh_stars>100-1000
from rest_framework.test import APIClient
from tests.utils import decode_content
def test_model_list_response_unfiltered():
response = APIClient().get('/snippets/')
expected = [
{
'id': 1,
'title': 'Fork bom... | 0 | 0 | 0 | 0 | 0 | 0 |
components/cronet/tools/jar_src.py | google-ar/chromium | 2,151 | 1793114 | #!/usr/bin/env python
#
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import optparse
import os
import sys
import tempfile
REPOSITORY_ROOT = os.path.abspath(os.path.join(
os.path.dirname(__file__), ... | 0 | 0 | 0 | 0 | 0 | 0 |
tutorials/PlottingGraphsWithMatplotlibAndUnrealEnginePython_Assets/graph_texture.py | avivazran/UnrealEnginePython | 2,350 | 1793122 | <gh_stars>1000+
import unreal_engine as ue
# EPixelFormat defines the various pixel formats for a texture/image, we will use RGBA with 8bit per channel
from unreal_engine.enums import EPixelFormat
import matplotlib
# set the Agg renderer as we do not need any toolkit
matplotlib.use('Agg')
import matplotlib.pyplot as ... | 0 | 0 | 0 | 0 | 0 | 0 |
Python/Algorithm/ValidationRange.py | piovezan/SOpt | 148 | 1793128 | try:
a = int(input("Escolha entre 1 e 6"))
if a < 1 or a > 6:
print ("o valor deve ser entre 1 e 6")
except ValueError:
print ("Escolha uma opção válida")
#https://pt.stackoverflow.com/q/433462/101
| 0 | 0 | 0 | 0 | 0 | 0 |
Reversing/flare-emu-string-deobfuscation.py | nbargnesi/Tools | 130 | 1793139 | <reponame>nbargnesi/Tools
# https://unit42.paloaltonetworks.com/using-idapython-to-make-your-life-easier-part-1/
# https://www.hex-rays.com/products/ida/support/ida74_idapython_no_bc695_porting_guide.shtml
# https://gitlab.com/krabsonsecurity/buer-loader-analysis/blob/master/stringdec.py
# https://hex-rays.com/products... | 0 | 0 | 0 | 0 | 0 | 0 |
core/dataset/loader_single.py | hyunynim/DIST-Renderer | 176 | 1793173 | import numpy as np
import os, sys
import copy
import torch
import torch.utils.data
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..'))
from common.geometry import Camera
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
from mesh_dataset import MeshLoader
class LoaderSingle(... | 4 | 5 | 0 | 0 | 9 | 0 |
r6sapi/definitions/loadouts.py | MechMaster48/RainbowSixSiege-Python-API | 144 | 1793201 | <reponame>MechMaster48/RainbowSixSiege-Python-API<gh_stars>100-1000
"""
Copyright (c) 2016-2020 jackywathy
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 li... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/unzip.py | PavelBlend/fluid-engine-dev | 1,355 | 1793207 | <filename>scripts/unzip.py
#!/usr/bin/env python
"""
Copyright (c) 2018 <NAME>
I am making my contributions/submissions to this project solely in my personal
capacity and am not conveying any rights to any intellectual property of any
third parties.
"""
import sys
import zipfile
def main():
input_zip = sys.argv... | 0 | 0 | 0 | 0 | 0 | 0 |
src/1221.split-a-string-in-balanced-strings/split-a-string-in-balanced-strings.py | lyphui/Just-Code | 782 | 1793226 | class Solution:
def balancedStringSplit(self, s: str) -> int:
cnt = tmp = 0
for i in s:
if i == 'R':
tmp += 1
if i == 'L':
tmp -= 1
if not tmp:
cnt += 1
return cnt | 1 | 1 | 0 | 0 | 2 | 0 |
tests/test_invariants.py | michaelpetrov/dataclasses-json | 811 | 1793261 | from collections import deque
from hypothesis import given
from hypothesis.strategies import (frozensets, integers, lists, one_of, sets,
tuples)
from tests.entities import (DataClassWithDeque, DataClassWithFrozenSet,
DataClassWithList, DataClassWithOption... | 0 | 0 | 0 | 0 | 0 | 0 |
skompiler/toskast/sklearn/neural_network/__init__.py | odinsemvosem/SKompiler | 112 | 1793311 | """
Multilayer perceptron
"""
| 0 | 0 | 0 | 0 | 0 | 0 |
nflows/distributions/uniform.py | Tennessee-Wallaceh/nflows | 522 | 1793339 | <reponame>Tennessee-Wallaceh/nflows<gh_stars>100-1000
from typing import Union
import torch
from torch import distributions
class BoxUniform(distributions.Independent):
def __init__(
self,
low: Union[torch.Tensor, float],
high: Union[torch.Tensor, float],
reinterpreted_batch_ndims... | 0 | 0 | 0 | 0 | 0 | 0 |
behaviors/apps.py | audiolion/django-behaviors | 225 | 1793341 | # -*- coding: utf-8
from django.apps import AppConfig
from django.conf import settings
class BehaviorsConfig(AppConfig):
name: str = 'behaviors'
@classmethod
def are_slug_unique(cls) -> object:
# By default, the Slugged behavior will generate unique slugs.
# You can disable this constrain... | 0 | 1 | 1 | 0 | 2 | 0 |
modules/nltk_contrib/classifier/exceptions/invaliddataerror.py | h4ck3rm1k3/NLP-project | 123 | 1793349 | <filename>modules/nltk_contrib/classifier/exceptions/invaliddataerror.py
# Natural Language Toolkit - InvalidDataError
# Is thrown when the input data entered by the user is invalid
#
# Author: <NAME> <<EMAIL>>
#
# URL: <http://www.nltk.org/>
# This software is distributed under GPL, for license information see LICEN... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/unit/contentproviders/test_swhid.py | davidjsherman/repo2docker | 1,047 | 1793366 | <reponame>davidjsherman/repo2docker<gh_stars>1000+
import json
import os
import io
import tarfile
import shutil
import re
import urllib
import pytest
import tempfile
import logging
import requests_mock
from os import makedirs
from os.path import join
from unittest.mock import patch, MagicMock, mock_open
from zipfile i... | 0 | 0 | 0 | 0 | 0 | 0 |
src/azure-cli/azure/cli/command_modules/eventgrid/inbound_ip_rules.py | YuanyuanNi/azure-cli | 3,287 | 1793398 | <reponame>YuanyuanNi/azure-cli
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# -------------------------------------... | 0 | 0 | 0 | 0 | 0 | 0 |
modules/ecr__enum_repos/main.py | jack-ganbold/ccat | 380 | 1793400 | <reponame>jack-ganbold/ccat
#!/usr/bin/env python3
import os
import json
import sys
import boto3
import fire
# TODO: Accept command line args
SAVE_TO_FILE_DIRECTORY = './data'
SAVE_TO_FILE_PATH = '{}/ecr__enum_repos_data.json'.format(SAVE_TO_FILE_DIRECTORY)
module_info = {
'name': 'ecr__enum_repos',
'au... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/pincell_multigroup/build_xml.py | norberto-schmidt/openmc | 262 | 1793415 | from math import log10
import numpy as np
import openmc
import openmc.mgxs
###############################################################################
# Create multigroup data
# Instantiate the energy group data
groups = openmc.mgxs.EnergyGroups(group_edges=[
1e-5, 0.0635, 10.0, 1.0e2, 1.0e3, 0.5e6, 1.0e6, ... | 0 | 0 | 0 | 0 | 0 | 0 |
demo/sot_demo.py | collector-m/UniTrack | 240 | 1793453 | # ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by <NAME> (<EMAIL>)
# ------------------------------------------------------------------------------
import os
import pdb
import sys
sys.path[0] = os.getcwd()
... | 1 | 1 | 10 | 0 | 12 | 0 |
src/ploomber/io/pretty_print.py | MarcoJHB/ploomber | 2,141 | 1793505 | <gh_stars>1000+
def iterable(obj):
sorted_ = sorted(f"'{element}'" for element in obj)
if len(sorted_) > 1:
sorted_[-1] = f'and {sorted_[-1]}'
return ", ".join(sorted_)
def them_or_name(obj):
return 'them' if len(obj) > 1 else f"'{list(obj)[0]}'"
def trailing_dot(obj):
return ' '.join(... | 0 | 0 | 0 | 0 | 0 | 0 |
dbaas/logical/service/project.py | didindinn/database-as-a-service | 303 | 1793569 | <reponame>didindinn/database-as-a-service
from django_services import service
from .. import models
class ProjectService(service.CRUDService):
model_class = models.Project
| 0 | 0 | 0 | 0 | 0 | 0 |
fame/storage/local_storage.py | ocnly/hall-of-fame | 952 | 1793647 | """Local storage implementation."""
__author__ = '<NAME>'
__copyright__ = '2018 Sourcerer, Inc'
import os
import shutil
from datetime import datetime
from .storage_base import StorageBase
class LocalStorage(StorageBase):
def __init__(self, work_dir):
self.work_dir = work_dir
def make_dirs(self, pa... | 3 | 7 | 0 | 0 | 10 | 0 |
sabnzbd/utils/__init__.py | smilers/sabnzbd | 1,354 | 1793682 | # Needed so the import always works
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/aws/client_test.py | akshaysharma096/clusterman | 281 | 1793685 | <gh_stars>100-1000
# Copyright 2019 Yelp Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | 0 | 0 | 0 | 0 | 0 | 0 |
handmocap/hand_modules/test_options.py | Paultool/frankmocap | 1,612 | 1793726 | <gh_stars>1000+
# Copyright (c) Facebook, Inc. and its affiliates.
# Part of the code from https://github.com/junyanz/pytorch-CycleGAN-and-pix2pix
from .base_options import BaseOptions
class TestOptions(BaseOptions):
def initialize(self):
BaseOptions.initialize(self)
self.parser.add_argument('--p... | 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.