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 |
|---|---|---|---|---|---|---|---|---|---|---|
prometeo/old_mem/malloc_wrapper.py | kokizzu/prometeo | 509 | 1733325 | <gh_stars>100-1000
from ctypes import *
import os
def prmt_malloc(n_bytes):
mem_pointer = c_void_p()
cwd = os.getcwd()
malloc_wrapper = CDLL('%s/libmalloc_wrapper.so.0.1'%cwd)
malloc_wrapper.prmt_malloc(byref(mem_pointer), n_bytes)
return mem_pointer
def prmt_cast_to_double_p(pointer):
return... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/filter_samples.py | myuanz/cnocr | 1,562 | 1733341 | # coding: utf-8
# 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 (the
# "License"... | 0 | 2 | 0 | 0 | 2 | 0 |
d3rlpy/online/utility.py | ningyixue/AIPI530_Final_Project | 565 | 1733344 | <filename>d3rlpy/online/utility.py
from typing import cast
import gym
from gym.spaces import Discrete
def get_action_size_from_env(env: gym.Env) -> int:
if isinstance(env.action_space, Discrete):
return cast(int, env.action_space.n)
return cast(int, env.action_space.shape[0])
| 0 | 0 | 0 | 0 | 0 | 0 |
library/oci_tag_facts.py | slmjy/oci-ansible-modules | 106 | 1733345 | #!/usr/bin/python
# Copyright (c) 2017, 2018, Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for ... | 0 | 1 | 0 | 0 | 1 | 0 |
networks/tiny_yolo_v3/Tiny_yolo_v3_object_detector.py | cece95/ncappzoo | 968 | 1733375 | from openvino.inference_engine import IENetwork, IECore
import numpy
import cv2
import sys
sys.path.append('../../shared/Python/')
from Object_detector import *
class Tiny_yolo_v3_object_detector(Object_detector):
def __init__(self, ie, # type: IECore
net, # type: I... | 0 | 0 | 0 | 0 | 0 | 0 |
newm/grid.py | sadrach-cl/newm | 265 | 1733380 | <filename>newm/grid.py
#!/usr/bin/env python3
from __future__ import annotations
from typing import Optional
import math
import time
import logging
try:
from .config import configured_value
conf_time_scale = configured_value('grid.time_scale', .3)
conf_throw_ps = configured_value('grid.throw_ps', [1, 5,... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/trac/test-trac-0191.py | eLBati/pyxb | 123 | 1733435 | # -*- coding: utf-8 -*-
import logging
if __name__ == '__main__':
logging.basicConfig()
_log = logging.getLogger(__name__)
import pyxb.binding.generate
import pyxb.binding.datatypes as xs
import pyxb.binding.basis
import pyxb.utils.domutils
import os.path
xsd='''<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xm... | 0 | 0 | 0 | 0 | 0 | 0 |
leetcode/289.game-of-life.py | geemaple/algorithm | 177 | 1733460 | import collections
class Solution(object):
def gameOfLife(self, board):
"""
:type board: List[List[int]]
:rtype: void Do not return anything, modify board in-place instead.
"""
direction = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/py/test/thrift_TZlibTransport.py | Jimexist/thrift | 8,514 | 1733463 | #
# 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 (the
# "License"); you may not u... | 0 | 1 | 0 | 0 | 1 | 0 |
torchsat_imc/datasets/seg.py | Exdenta/torchsat | 316 | 1733505 | <gh_stars>100-1000
import os
from .utils import image_loader
class SegDataset(object):
"""SegDataset This class is for common semantic segmentation scenario.
Data organization adopted from PASCAL VOC datasets. http://host.robots.ox.ac.uk/pascal/VOC/index.html
The trainval.txt, train.txt or val.txt shoul... | 0 | 0 | 0 | 0 | 0 | 0 |
spectre/trading/calendar.py | rajach/spectre | 302 | 1733519 | from __future__ import annotations
"""
@author: Heerozh (<NAME>)
@copyright: Copyright 2019, Heerozh. All rights reserved.
@license: Apache 2.0
@email: <EMAIL>
"""
from collections import defaultdict
from typing import Dict
import pandas as pd
class Calendar:
"""
Usage:
call build() first, get business da... | 6 | 2 | 0 | 0 | 8 | 0 |
allennlp_semparse/state_machines/trainers/__init__.py | nitishgupta/allennlp-semparse | 105 | 1733531 | from allennlp_semparse.state_machines.trainers.decoder_trainer import DecoderTrainer
from allennlp_semparse.state_machines.trainers.expected_risk_minimization import (
ExpectedRiskMinimization,
)
from allennlp_semparse.state_machines.trainers.maximum_marginal_likelihood import (
MaximumMarginalLikelihood,
)
| 0 | 0 | 0 | 0 | 0 | 0 |
MuZero/implementations/AEMuZero.py | morozig/muzero | 111 | 1733539 | """
Defines an implementation of MuZeroNeuralNet that overrides the DefaultMuZero implementation.
This class handles training of a latent-to-real-state decoder jointly with the MuZero model.
To make use of this class, ensure your neural network class has a 'decoder' attribute that defines
a keras Model to a trainable ... | 4 | 4 | 0 | 0 | 8 | 0 |
slybot/slybot/tests/test_page_actions.py | hackrush01/portia | 6,390 | 1733569 | <reponame>hackrush01/portia
from unittest import TestCase
from slybot.pageactions import filter_for_url, PageActionsMiddleware
from os.path import dirname
from scrapy import Request
from scrapy import Spider
from slybot.spider import IblSpider
_PATH = dirname(__file__)
def mkreq():
return Request('http://localhost... | 0 | 0 | 0 | 0 | 0 | 0 |
2017-07_Seminar/Session 2 - Sentence CNN/code/cnn.py | dineshsonachalam/deeplearning4nlp-tutorial | 593 | 1733572 | <gh_stars>100-1000
"""
This implementation is a Convolutional Neural Network for sentence classification.
It uses the same preprocessing of Kim et al., EMNLP 2014, 'Convolutional Neural Networks for Sentence Classification ' (https://github.com/yoonkim/CNN_sentence).
Run the code:
1) Run 'python preprocess.py'. This ... | 0 | 0 | 0 | 0 | 0 | 0 |
vmoe/nn/vit_moe.py | google-research/vmoe | 205 | 1733615 | # Copyright 2022 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/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 0 | 0 | 0 | 0 | 0 | 1 |
qiskit/quantum_info/synthesis/qsd.py | t-imamichi/qiskit-core | 1,456 | 1733628 | <reponame>t-imamichi/qiskit-core<filename>qiskit/quantum_info/synthesis/qsd.py
# This code is part of Qiskit.
#
# (C) Copyright IBM 2022.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at htt... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_stats_utils.py | alexmon1989/russia_ddos | 199 | 1733674 | <gh_stars>100-1000
import pytest as pytest
from ripper.stats.utils import build_http_codes_distribution, rate_color
class DescribeStatsUtils:
@pytest.mark.parametrize('actual, expected', [
(0, '[red]0[/]'),
(15, '[red]15[/]'),
(35, '[dark_orange]35[/]'),
(55, '[orange1]55[/]'),
... | 0 | 0 | 0 | 0 | 0 | 0 |
pixiedust/apps/gateway/share.py | elgalu/pixiedust | 598 | 1733722 | <reponame>elgalu/pixiedust<filename>pixiedust/apps/gateway/share.py<gh_stars>100-1000
# -------------------------------------------------------------------------------
# Copyright IBM Corp. 2017
#
# Licensed under the Apache License, Version 2.0 (the 'License');
# you may not use this file except in compliance with th... | 0 | 0 | 0 | 0 | 0 | 0 |
ontobio/golr/beacon_query.py | alliance-genome/ontobio | 101 | 1733734 | from __future__ import annotations
from ontobio.golr.golr_query import GolrAssociationQuery, M
class BeaconAssociationQuery(GolrAssociationQuery):
"""
A query object for performing the beacon association search functionality.
Note that such searches are directionless: sources and targets have a
differe... | 7 | 3 | 0 | 0 | 10 | 0 |
tst/regression/scripts/utils/EquationOfState/__init__.py | lucyundead/athena--fork | 174 | 1733767 | brent_opt = dict(full_output=True, disp=True)
ode_opt = dict(mxstep=5000000, rtol=1e-15, atol=1e-13)
| 0 | 0 | 0 | 0 | 0 | 0 |
mamonsu/plugins/pgsql/relations_size.py | sgrinko/mamonsu | 188 | 1733770 | <reponame>sgrinko/mamonsu
# -*- coding: utf-8 -*-
from mamonsu.plugins.pgsql.plugin import PgsqlPlugin as Plugin
from .pool import Pooler
from mamonsu.lib.plugin import PluginDisableException
class RelationsSize(Plugin):
DEFAULT_CONFIG = {'enabled': 'False'}
key_rel_size_discovery = "pgsql.relation.size{0}"
... | 0 | 0 | 0 | 0 | 0 | 0 |
Contents/Libraries/Shared/rebulk/chain.py | jippo015/Sub-Zero.bundle | 1,553 | 1733787 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import annotations
"""
Chain patterns and handle repetiting capture group
"""
# pylint: disable=super-init-not-called
import itertools
from .loose import call, set_defaults
from .match import Match, Matches
from .pattern import Pattern, filter_match_kwargs
... | 3 | 27 | 0 | 9 | 39 | 0 |
tests/linear_test.py | klaudiapalasz/torchlayers | 573 | 1733805 | <reponame>klaudiapalasz/torchlayers
import torch
import torchlayers as tl
def test_last_dimension_linear():
module = tl.Linear(64)
module = tl.build(module, torch.randn(1, 3, 32, 32))
assert module(torch.randn(2, 6, 24, 32)).shape == (2, 6, 24, 64)
| 0 | 0 | 0 | 0 | 0 | 0 |
bmtk/builder/edges_sorter/memory_sorter.py | mjhyman/bmtk | 216 | 1733823 | <reponame>mjhyman/bmtk<filename>bmtk/builder/edges_sorter/memory_sorter.py
import os
import h5py
import logging
import numpy as np
from bmtk.utils.sonata.utils import add_hdf5_magic, add_hdf5_version
def _create_output_h5(input_file, output_file, edges_root, n_edges):
mode = 'r+' if os.path.exists(output_file) e... | 0 | 0 | 0 | 0 | 0 | 0 |
onnx_tf/handlers/backend/math_mixin.py | malisit/onnx-tensorflow | 1,110 | 1733828 | import copy
from .broadcast_mixin import BroadcastMixin
class BasicMathMixin(BroadcastMixin):
pass
class ArithmeticMixin(BroadcastMixin):
pass
class ReductionMixin(BroadcastMixin):
@classmethod
def _common(cls, node, **kwargs) -> list[object]:
attrs = copy.deepcopy(node.attrs)
axis = attrs.pop("... | 0 | 1 | 0 | 0 | 1 | 0 |
docs/scripts/generate_plugin_docs.py | kassemitani/openbr | 1,883 | 1733966 | import os, sys
import re
abstractions = ['FileList', 'File',
'TemplateList', 'Template',
'UntrainableTransform',
'MetaTransform', 'UntrainableMetaTransform',
'MetadataTransform', 'UntrainableMetadataTransform',
'TimeVaryingTransform',
... | 0 | 0 | 0 | 0 | 0 | 0 |
questions/minimum-add-to-make-parentheses-valid/Solution.py | marcus-aurelianus/leetcode-solutions | 141 | 1734014 | <reponame>marcus-aurelianus/leetcode-solutions<gh_stars>100-1000
"""
Given a string S of '(' and ')' parentheses, we add the minimum number of parentheses ( '(' or ')', and in any positions ) so that the resulting parentheses string is valid.
Formally, a parentheses string is valid if and only if:
It is the empty str... | 0 | 0 | 0 | 0 | 0 | 0 |
sailboat/build.py | cole-wilson/sailboat | 168 | 1734020 | from sailboat import Plugin, get_plugin, PluginNotFound
import enlighten
import os
import glob
import shutil
import re
import requests
import traceback
import blessed
import sys
import time
import colorama
colorama.init() # For Windows
from semver import VersionInfo
from semver import compare
class Build(Plugin):
... | 0 | 1 | 2 | 0 | 3 | 0 |
utils/stft.py | phamlehuy53/wavegrad2 | 179 | 1734075 | import torch
import torch.nn as nn
import torch.nn.functional as F
class STFTMag(nn.Module):
def __init__(self,
nfft: int=1024,
hop: int=256):
super().__init__()
self.nfft = nfft
self.hop = hop
self.register_buffer('window', torch.hann_window(nfft),... | 2 | 1 | 0 | 0 | 3 | 0 |
Module2/Python_Data_Analysis_code/Chapter 8/stemming_lemma.py | vijaysharmapc/Python-End-to-end-Data-Analysis | 119 | 1734092 | from nltk.corpus import brown
from nltk.corpus import stopwords
from nltk.stem import PorterStemmer
from nltk.stem import WordNetLemmatizer
import ch8util
from sklearn.feature_extraction.text import TfidfVectorizer
import numpy as np
import pandas as pd
import pickle
import dautil as dl
stemmer = PorterStemmer()
lemm... | 0 | 0 | 0 | 0 | 0 | 0 |
alembic/versions/2e43193729c3_video_table_add_total_count_column.py | billvsme/videoSpider | 216 | 1734102 | <filename>alembic/versions/2e43193729c3_video_table_add_total_count_column.py<gh_stars>100-1000
"""video table add total_count column
Revision ID: 2e43193729c3
Revises: ae<PASSWORD>
Create Date: 2016-02-24 23:09:35.627653
"""
# revision identifiers, used by Alembic.
revision = '2e43193729c3'
down_revision = 'ae347be... | 0 | 0 | 0 | 0 | 0 | 0 |
rlcard/games/gin_rummy/__init__.py | randombenj/rlcard | 1,735 | 1734146 | <reponame>randombenj/rlcard<gh_stars>1000+
from rlcard.games.gin_rummy.game import GinRummyGame as Game
| 0 | 0 | 0 | 0 | 0 | 0 |
pwnlib/rop/__init__.py | DrKeineLust/pwntools | 8,966 | 1734177 | <filename>pwnlib/rop/__init__.py
from pwnlib.rop.rop import ROP
| 0 | 0 | 0 | 0 | 0 | 0 |
bud.gyp | androdev4u/bud | 310 | 1734186 | <gh_stars>100-1000
{
"variables": {
"openssl_fips%": "",
"LIBOPENSSL": "<(PRODUCT_DIR)/libopenssl.a",
"gypkg_deps": [
"git://github.com/libuv/libuv.git@^1.9.0 => uv.gyp:libuv",
"git://github.com/nodejs/http-parser@^2.7.1 [gpg] => http_parser.gyp:http_parser",
"git://github.com/gypkg/ring... | 0 | 0 | 0 | 0 | 0 | 0 |
vnpy/gateway/xtp/__init__.py | ChaunceyDong/vnpy | 19,529 | 1734187 | <filename>vnpy/gateway/xtp/__init__.py
from vnpy_xtp import XtpGateway
| 0 | 0 | 0 | 0 | 0 | 0 |
lndmanage/lib/psbt.py | bitromortac/lndmanage | 166 | 1734197 | <reponame>bitromortac/lndmanage
"""PSBT (BIP 174) utilities.
https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki
Sources:
https://github.com/Jason-Les/python-psbt
Programming Bitcoin book, <NAME>
"""
from io import BytesIO
from typing import List, Tuple, Optional
PSBT_MAGIC_SEPARATOR = b'psbt' + b'\xFF'
PSB... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_session_cache.py | Anton-Latukha/wakatime | 1,198 | 1734228 | <gh_stars>1000+
# -*- coding: utf-8 -*-
import os
from wakatime.session_cache import SessionCache
from wakatime.logger import setup_logging
from . import utils
class SessionCacheTestCase(utils.TestCase):
patch_these = [
'wakatime.packages.requests.adapters.HTTPAdapter.send',
'wakatime.offlineque... | 0 | 0 | 0 | 0 | 0 | 0 |
Presentations/C++11 in the Wild - Techniques from a Real Codebase/profile-spaceship.py | IMCG/CPPCon14 | 1,412 | 1734283 | import os,time,sys
spaceships = ['spaceship1', 'spaceship2']
makes = ['make1', 'make2', 'make3']
cmd = 'clang++ -w -std=c++1y -stdlib=libc++ test.cc -o a.out -ftemplate-depth=2000 ' + ' '.join(sys.argv[1:])
def profile(cmd):
start = time.time()
os.system(cmd)
os.system(cmd)
os.system(cmd)
end = t... | 0 | 0 | 0 | 0 | 0 | 0 |
Medium/The Reverse Game(REVGAME)/The_Reverse_Game.py | anishsingh42/CodeChef | 127 | 1734285 | <reponame>anishsingh42/CodeChef<filename>Medium/The Reverse Game(REVGAME)/The_Reverse_Game.py
for _ in range(int(input())):
n,k=map(int,input().split())
def finalarr(n):
arr=[0]*n
arr[0]=n-1
for i in range(1,n):
if i%2:
arr[i]=n-1-arr[i-1]
else:
... | 0 | 0 | 0 | 0 | 0 | 0 |
vqgan_clip/masking.py | aman-tiwari/vqgan-clip | 130 | 1734318 | import torch
from torch import nn, optim
from torch.nn import functional as F
from torchvision import transforms
import math
import kornia.augmentation as K
def sinc(x) -> object:
return torch.where(x != 0, torch.sin(math.pi * x) / (math.pi * x), x.new_ones([]))
def lanczos(x, a) -> object:
cond = torch.logi... | 5 | 13 | 0 | 2 | 20 | 0 |
src/deep/unet/unet_trainer.py | DataForces/CV_LUNA | 207 | 1734385 | <reponame>DataForces/CV_LUNA
from __future__ import division
import time
import numpy as np
import trainer
from params import params as P
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from functools import partial
import logging
import scipy.misc
from parallel import ParallelBatchIterator
from... | 0 | 0 | 0 | 0 | 0 | 0 |
Python/Algorithms/Maths/PollardRho.py | Rr1901/AlgorithmsAndDataStructure | 195 | 1734398 | <filename>Python/Algorithms/Maths/PollardRho.py
"""
Title - Pollard's Rho Algorithm
Purpose - Performs factorization on a number.
Time Complexity - O(√n)
"""
import random
import math
class PollardRho:
""" Pollard's Rho Algorithm Implementation
n: an non negative integer
output: factorization of ... | 0 | 0 | 0 | 0 | 0 | 0 |
neurst/metrics/metric.py | ishine/neurst | 208 | 1734420 | # Copyright 2020 ByteDance Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 4 | 5 | 1 | 0 | 10 | 0 |
bin/check_update_metric.py | farheenkaifee/dashboard_3 | 284 | 1734442 | #!/usr/bin/env python2
"""
this program shows how the proto1 -> proto2 upgrade looks like for
all metrics given as cmdline arguments.
very convenient to verify the working of plugins etc.
"""
import sys
from pprint import pprint
import logging
from graph_explorer import structured_metrics
from graph_explorer import c... | 0 | 0 | 0 | 0 | 0 | 0 |
ml-agents/mlagents/trainers/policy.py | icaro56/ml-agents | 134 | 1734609 | import logging
import numpy as np
from mlagents.trainers import UnityException
from mlagents.trainers.models import LearningModel
logger = logging.getLogger("mlagents.trainers")
class UnityPolicyException(UnityException):
"""
Related to errors with the Trainer.
"""
pass
class Policy(object):
"... | 0 | 11 | 0 | 5 | 16 | 0 |
resotocore/tests/resotocore/validator_test.py | someengineering/resoto | 126 | 1734629 | <filename>resotocore/tests/resotocore/validator_test.py
from resotocore.validator import Validator
def test_path_exist() -> None:
v = Validator()
assert v.validate({"path": "does not exist"}, {"path": {"path_exists": True}}) is False
assert v.errors == {"path": ["Path does not exist: does not exist"]}
... | 0 | 0 | 0 | 0 | 0 | 0 |
classes/utils.py | bbhunter/beemka | 182 | 1734642 | <filename>classes/utils.py
import os, shutil
from classes.asar import Asar
class BaseUtils:
def prompt_for(self, message, valid_responses=None, default_response='', response_case_sensitive=False):
if valid_responses is None:
valid_responses = []
message = self.process_input_mes... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/required-operation/train2.py | wheatdog/guildai | 694 | 1734666 | <gh_stars>100-1000
import os
# Assert that our mock data set is available.
assert os.path.exists("data.txt")
# Simulate a model build by writing some empty file.
open("model.json", "w").close()
open("checkpoint.h5", "w").close()
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/emukit/test_functions/test_hennig1d.py | ndalchau/emukit | 272 | 1734684 | # Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from emukit.test_functions.quadrature import hennig1D
def test_hennig1D_return_shape():
"""
Test output dimension is 2d
"""
hennig1d_func, _ = hennig1D()
x = np.zer... | 0 | 0 | 0 | 0 | 0 | 0 |
1-100q/81.py | rampup01/Leetcode | 990 | 1734722 | '''
Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.
(i.e., [0,0,1,2,2,5,6] might become [2,5,6,0,0,1,2]).
You are given a target value to search. If found in the array return true, otherwise return false.
Example 1:
Input: nums = [2,5,6,0,0,1,2], target = 0
Outpu... | 0 | 1 | 0 | 0 | 1 | 0 |
elastichq/service/QueryService.py | billboggs/elasticsearch-HQ | 2,026 | 1734767 | <reponame>billboggs/elasticsearch-HQ
"""
.. module:: QueryService
.. moduleauthor:: <NAME> <<EMAIL>>
"""
from elastichq.globals import REQUEST_TIMEOUT
from .ConnectionService import ConnectionService
class QueryService:
def run_query(self, cluster_name, index_name, query_json):
connection = ConnectionS... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/unit_tests/test_cleaner.py | danielpalstra/mealie | 1,927 | 1734774 | <reponame>danielpalstra/mealie
import json
import re
import pytest
from datetime import timedelta
from mealie.services.scraper import cleaner
from mealie.services.scraper.scraper import open_graph
from tests.test_config import TEST_RAW_HTML, TEST_RAW_RECIPES
# https://github.com/django/django/blob/stable/1.3.x/django... | 0 | 0 | 0 | 0 | 0 | 0 |
python/models/attmix_CNN.py | HuiyingLi/DIIN | 262 | 1734776 | from __future__ import annotations
import tensorflow as tf
from util import blocks
from tensorflow.contrib.rnn.python.ops.core_rnn_cell import BasicLSTMCell
from tensorflow.contrib.rnn.python.ops.rnn_cell import LayerNormBasicLSTMCell
from my.tensorflow.nn import softsel, get_logits, highway_network, multi_conv1d, line... | 41 | 25 | 0 | 2 | 68 | 0 |
examples/generation/docking_generation/moldqn/chemgraph/docking_eval.py | Shicheng-Guo/TDC | 577 | 1734790 | import sys
sys.path.append("..")
import os
import json
import numpy as np
import pandas as pd
from tqdm import tqdm
import functools
import matplotlib.pyplot as plt
import tensorflow as tf
from dqn import molecules
from dqn import deep_q_networks
from dqn.py.SA_Score import sascorer
from chemutil import similarity
... | 1 | 2 | 0 | 0 | 3 | 0 |
moonlight/vision/hough_test.py | lithomas1/moonlight | 288 | 1734792 | <filename>moonlight/vision/hough_test.py<gh_stars>100-1000
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# ... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/build-font.py | ryankurte/micro-gui | 151 | 1734808 | #!/usr/bin/env python3
from os import listdir
from os.path import isfile, join
import argparse
import re
import string
from PIL import Image, ImageFont, ImageDraw
import pystache
def print_hex(val) -> object:
return "{0:#0{1}x}".format(val,4)
def process_char(font, char) -> object:
# Calculate char info
char_si... | 0 | 5 | 0 | 0 | 5 | 0 |
flocker/common/test/test_interface.py | stackriot/flocker | 2,690 | 1734814 | <filename>flocker/common/test/test_interface.py
# Copyright ClusterHQ Inc. See LICENSE file for details.
"""
Tests for ``flocker.common._interface``.
"""
from eliot.testing import (
assertHasMessage, capture_logging
)
from eliot import Field, MessageType
from pyrsistent import PClass, field, InvariantException
... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/run.py | Mescarr/crylogger | 141 | 1734825 | #!/usr/bin/python3
# Author: <NAME> (<EMAIL>)
# This script runs automated tests on a set of Android applications.
import os
import sys
import time
import argparse
import subprocess
import shutil
###############################################################################
# Common functions
######################... | 0 | 15 | 0 | 0 | 15 | 0 |
service/data_store/resource_id.py | lcrh/falken | 213 | 1734828 | <filename>service/data_store/resource_id.py<gh_stars>100-1000
# 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/LICENSE-2.0
#... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/com.netease.cloudmusic/xpath_test.py | hiyongz/uiautomator2 | 4,493 | 1734840 | <gh_stars>1000+
# coding: utf-8
#
import unittest
from logzero import logger
import uiautomator2 as u2
# d = u2.connect_usb("3578298f")
d = u2.connect_usb()
class MusicTestCase(unittest.TestCase):
def setUp(self):
self.package_name = "com.netease.cloudmusic"
d.ext_xpath.global_set({"timeout": 10... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/active_learning/test_ScorerSemanticSegmentation.py | CodeGuy-007/lightly | 1,515 | 1734843 | <filename>tests/active_learning/test_ScorerSemanticSegmentation.py
import unittest
import numpy as np
import lightly
from lightly.active_learning.scorers import ScorerSemanticSegmentation
from lightly.active_learning.scorers import ScorerClassification
class TestScorerSemanticSegmentation(unittest.TestCase):
de... | 0 | 0 | 0 | 0 | 0 | 0 |
qcodes/tests/drivers/AlazarTech/test_dll_wrapper.py | LGruenhaupt/Qcodes | 223 | 1734858 | """Tests DLL wrapper infrastructure"""
import logging
import gc
import os
import pytest
from qcodes.instrument_drivers.AlazarTech.dll_wrapper import WrappedDll, \
DllWrapperMeta
pytestmark = pytest.mark.skipif(
os.name != 'nt', reason='These tests are relevant only for Windows')
def test_wrapped_dll_sin... | 0 | 0 | 0 | 0 | 0 | 0 |
mango/loadedmarket.py | nhatminhbeo/mango-explorer | 131 | 1734867 | <reponame>nhatminhbeo/mango-explorer<gh_stars>100-1000
# # ⚠ Warning
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
# LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
# NO EVENT SHALL THE AUTHORS OR COPYRIGH... | 0 | 0 | 0 | 0 | 0 | 0 |
SAN/lib/utils/pts_utils.py | yerang823/landmark-detection | 612 | 1734897 | <reponame>yerang823/landmark-detection
##############################################################
### Copyright (c) 2018-present, <NAME> ###
### Style Aggregated Network for Facial Landmark Detection ###
### Computer Vision and Pattern Recognition, 2018 ###
##################################... | 0 | 0 | 0 | 0 | 0 | 0 |
python/ql/src/Resources/FileNotAlwaysClosed.py | vadi2/codeql | 4,036 | 1734900 | <gh_stars>1000+
f = open("filename")
... # Actions to perform on file
f.close()
# File only closed if actions are completed successfully
with open("filename") as f:
...# Actions to perform on file
# File always closed
f = open("filename")
try:
... # Actions to perform on file
finally:
f.close()
# File... | 0 | 0 | 0 | 0 | 0 | 0 |
extstats/utils/make_json_site.py | bakl/chrome-extensions-archive | 408 | 1734904 | <reponame>bakl/chrome-extensions-archive
import json, datetime
exts = json.load(open('data/PAGES.json'))
print('enriched loaded')
crxs = json.load(open('data/crx_stats.json'))
print('file stats loaded')
DATA = []
for ext in exts[:40000]:
try:
DATA.append({
'id': ext['ext_id'],
'na... | 0 | 0 | 0 | 0 | 0 | 0 |
tf-2-data-parallelism/src/train_resnet_simple.py | Amirosimani/amazon-sagemaker-script-mode | 144 | 1734939 | import os
import argparse
import numpy as np
import tensorflow as tf
import smdebug.tensorflow as smd
from model_def import get_resnet50
hook = smd.KerasHook.create_from_json_file()
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
def parse_args() -> object:
parser = argparse.ArgumentParser()
# hyperparameters ar... | 0 | 3 | 0 | 0 | 3 | 0 |
notebook/numpy_eye_identity.py | vhn0912/python-snippets | 174 | 1734948 | <gh_stars>100-1000
import numpy as np
# https://docs.scipy.org/doc/numpy/reference/generated/numpy.eye.html
e = np.eye(4)
print(type(e))
print(e)
print(e.dtype)
# <class 'numpy.ndarray'>
# [[ 1. 0. 0. 0.]
# [ 0. 1. 0. 0.]
# [ 0. 0. 1. 0.]
# [ 0. 0. 0. 1.]]
# float64
e = np.eye(4, M=3, k=1, dtype=np.in... | 0 | 0 | 0 | 0 | 0 | 0 |
pixloc/localization/model3d.py | jmorlana/pixloc | 457 | 1734980 | import logging
from collections import defaultdict
from typing import Dict, List, Optional
import numpy as np
from ..utils.colmap import read_model
from ..utils.quaternions import weighted_pose
logger = logging.getLogger(__name__)
class Model3D:
def __init__(self, path):
logger.info('Reading COLMAP mode... | 13 | 7 | 0 | 0 | 20 | 0 |
Sniffer v3.0/Plugin/QzoneCookie.py | gavin-thun/Sniffer | 154 | 1735030 | <filename>Sniffer v3.0/Plugin/QzoneCookie.py
#encoding: utf8
import os
from Toolbox.ColorTools import *
import re
from requests import *
import sys
def g_tk(p_skey):
h = 5381
for c in p_skey:
h += (h << 5) + ord(c)
return h & 0x7fffffff
def SendMsg(uin, skey, p_skey, msg):
qq = re.findall(r'... | 0 | 0 | 0 | 0 | 0 | 0 |
nodes/0.9.x/python/Document.LoadFamily.py | jdehotin/Clockworkfordynamo | 147 | 1735042 | <filename>nodes/0.9.x/python/Document.LoadFamily.py
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Insta... | 0 | 0 | 0 | 0 | 0 | 0 |
src/lambda_codebase/initial_commit/bootstrap_repository/adf-build/shared/cdk/cdk_constructs/tests/test_adf_codepipeline_output_artifacts.py | StewartW/aws-deployment-framework | 490 | 1735044 | # Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
# pylint: skip-file
from mock import patch
from copy import deepcopy
from cdk_constructs.adf_codepipeline import Action
from aws_cdk import ( aws_codepipeline )
from adf_codepipeline_test_constants import BASE_M... | 0 | 0 | 0 | 0 | 0 | 0 |
guillotina/tests/dbusers/test_setup.py | rboixaderg/guillotina | 173 | 1735102 | <filename>guillotina/tests/dbusers/test_setup.py
from . import settings
from guillotina.tests.utils import get_container
import pytest
pytestmark = pytest.mark.asyncio
@pytest.mark.app_settings(settings.DEFAULT_SETTINGS)
async def test_users_and_groups_folders_are_created_on_install(dbusers_requester):
async w... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/csj/s0/csj_tools/wn.3.mincut.py | treeaaa/wenet | 1,166 | 1735119 | import librosa
# import os
import sys
def mincut(wavscpfn, minsec):
outfn = wavscpfn + "_" + str(minsec)
with open(outfn, 'w') as bw:
with open(wavscpfn) as br:
for aline in br.readlines():
aline = aline.strip()
afn = aline.split('\t')[1]
# p... | 0 | 0 | 0 | 0 | 0 | 0 |
node_modules/keccak/binding.gyp | miguel567/nftgallery | 107 | 1735120 | <reponame>miguel567/nftgallery
{
'variables': {
'arch': '<!(node -p "process.arch")',
},
'target_default': {
'cflags': [
'-Wall',
'-Wextra',
],
},
'targets': [
{
'target_name': 'keccak',
'type': 'static_library',
'conditions': [
['arch in ("arm64","ppc64",... | 0 | 0 | 0 | 0 | 0 | 0 |
get_actual_news_from_rss_ya/webserver/ping_api.py | DazEB2/SimplePyScripts | 117 | 1735154 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
import requests
# # rs = requests.get('http://127.0.0.1:5000/get_news_list/games?last=2')
# # rs = requests.get('http://127.0.0.1:5000/get_news_list/games?last=-1')
# # rs = requests.get('http://127.0.0.1:5000/get_news_list?last=2')
# # rs = req... | 0 | 0 | 0 | 0 | 0 | 0 |
zip_file_example/shutil_make_archive/main.py | DazEB2/SimplePyScripts | 117 | 1735156 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
import shutil
DIR_NAME = 'dir_1'
shutil.make_archive(DIR_NAME, 'zip', DIR_NAME)
| 0 | 0 | 0 | 0 | 0 | 0 |
chips/compiler/parser.py | dillonhuff/Chips-2.0 | 221 | 1735185 | __author__ = "<NAME>"
__copyright__ = "Copyright (C) 2012, <NAME>"
__version__ = "0.1"
import struct
from copy import copy, deepcopy
from textwrap import dedent
from parse_tree import *
from tokens import Tokens
from allocator import Allocator
from types import *
types = [
"double",
"float",
"signed",
... | 0 | 71 | 0 | 4 | 75 | 0 |
tests/r/test_luv_colours.py | hajime9652/observations | 199 | 1735197 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.luv_colours import luv_colours
def test_luv_colours():
"""Test module luv_colours.py by downloading
luv_colours.csv and testing shape of
e... | 0 | 0 | 0 | 0 | 0 | 0 |
wagtailmenus/migrations/0008_auto_20160131_2327.py | pierremanceaux/wagtailmenus | 329 | 1735243 | <reponame>pierremanceaux/wagtailmenus
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wagtailmenus', '0007_auto_20160131_2000'),
]
operations = [
migrations.RemoveField(
... | 0 | 0 | 0 | 0 | 0 | 0 |
factory-ai-vision/EdgeSolution/modules/WebModule/backend/vision_on_edge/cameras/tests/test_utils.py | kaka-lin/azure-intelligent-edge-patterns | 176 | 1735247 | """App utilites tests.
"""
from unittest import mock
import cv2
import pytest
from ..utils import is_valid_rtsp, normalize_rtsp, verify_rtsp
@pytest.mark.parametrize(
"rtsp_str, output",
[
[0, True],
["0", True],
[1, True],
["1", True],
[2, False],
["2", False... | 0 | 3 | 0 | 0 | 3 | 0 |
scripts/examples/Arduino/Portenta-H7/40-WiFi/dns.py | jiskra/openmv | 1,761 | 1735256 | # DNS Example
#
# This example shows how to get the IP address for websites via DNS.
import network, usocket
SSID='' # Network SSID
KEY='' # Network key
# Init wlan module and connect to network
print("Trying to connect. Note this may take a while...")
wlan = network.WLAN(network.STA_IF)
wlan.deinit()
wlan.active(... | 0 | 0 | 0 | 0 | 0 | 0 |
core/pose_opt.py | liruilong940607/A-NeRF | 110 | 1735275 | <filename>core/pose_opt.py<gh_stars>100-1000
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from smplx import SMPL
import time
from .utils.skeleton_utils import SMPLSkeleton, axisang_to_rot, rot6d_to_rotmat,\
rot_to_axisang, rot6d_to_axisang, get... | 0 | 0 | 0 | 0 | 0 | 0 |
ChasingTrainFramework_GeneralOneClassDetection/train_GOCD.py | dvt0101/A-Light-and-Fast-Face-Detector-for-Edge-Devices | 1,172 | 1735294 | # -*- coding: utf-8 -*-
import logging
def start_train(param_dict,
mxnet_module,
context,
train_dataiter,
train_metric,
train_metric_update_frequency,
num_train_loops,
val_dataiter,
val_metr... | 0 | 0 | 0 | 0 | 0 | 0 |
robonet/video_prediction/training/trainable_interface.py | russellmendonca/RoboNet | 140 | 1735317 | from __future__ import annotations
from ray.tune import Trainable
import pdb
import tensorflow as tf
from robonet.datasets import get_dataset_class, load_metadata
from robonet.video_prediction.models import get_model
from robonet.video_prediction.utils import tf_utils
import numpy as np
import os
from tensorflow.contri... | 0 | 12 | 0 | 0 | 12 | 0 |
tests/strict/rt_monkeypatch_mod.py | Euromance/pycopy | 663 | 1735381 | import mod
def my_foo():
print("my_foo")
def __main__():
try:
mod.foo = my_foo
except RuntimeError:
print("RuntimeError1")
| 0 | 0 | 0 | 0 | 0 | 0 |
python/ql/test/query-tests/Security/CWE-209/Exceptions.py | timoles/codeql | 4,036 | 1735461 | try:
1+2
except Exception as e: #$ exceptionInfo
e
def test_exception():
try:
1+2
except Exception as e: #$ exceptionInfo
e
| 0 | 0 | 0 | 0 | 0 | 0 |
two_sigma_problems/problem_9.py | loftwah/Daily-Coding-Problem | 129 | 1735479 | """This problem was asked by Two Sigma.
Using a function rand5() that returns an integer from 1 to 5 (inclusive) with
uniform probability, implement a function rand7() that returns an integer
from 1 to 7 (inclusive).
""" | 0 | 0 | 0 | 0 | 0 | 0 |
HLTriggerOffline/Btag/python/hltBtagJetMCTools_cff.py | ckamtsikis/cmssw | 852 | 1735489 | #define hltBtagJetMCTools for jet/parton matching
import FWCore.ParameterSet.Config as cms
hltBtagPartons = cms.EDProducer("PartonSelector",
src = cms.InputTag("genParticles"),
withLeptons = cms.bool(False)
)
hltBtagJetsbyRef = cms.EDProducer("JetPartonMatcher",
jets = cms.InputTag("hltBtagCaloJetL1FastJe... | 0 | 0 | 0 | 0 | 0 | 0 |
utils/commons/ddp_utils.py | leminhnguyen/NATSpeech | 561 | 1735517 | from torch.nn.parallel import DistributedDataParallel
from torch.nn.parallel.distributed import _find_tensors
import torch.optim
import torch.utils.data
import torch
from packaging import version
class DDP(DistributedDataParallel):
"""
Override the forward call in lightning so it goes to training and validatio... | 0 | 1 | 0 | 0 | 1 | 0 |
scrapers/populate_district_database.py | loleg/covid_19 | 485 | 1735531 | #!/usr/bin/env python3
# This script creates a new sqlite database based on the CSV is reiceives as an argument
# The sqlite database is used as an intermediate step to merge new data in existing CSVs
import sqlite3
import traceback
import os
import sys
import db_common as dc
__location__ = dc.get_location()
try:
... | 0 | 0 | 0 | 0 | 0 | 0 |
koalixcrm/djangoUserExtension/admin.py | Cataldir/koalixcrm | 290 | 1735586 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
from koalixcrm.djangoUserExtension.models import *
from koalixcrm.djangoUserExtension.user_extension.user_extension import UserExtension, OptionUserExtension
from koalixcrm.djangoUserExtension.user_extension.template_set import TemplateSet, OptionTemplateSet
from koalixcrm.d... | 0 | 0 | 0 | 0 | 0 | 0 |
test/multiple_gpu_test/test_mgpu_mnist.py | jjjjohnson/InsightFace_TF | 721 | 1735669 | <reponame>jjjjohnson/InsightFace_TF
import tensorflow as tf
import tensorlayer as tl
import os
Layer = tl.layers.Layer
D_TYPE = tf.float32
class DenseLayer(Layer):
"""
The :class:`DenseLayer` class is a fully connected layer.
Parameters
----------
layer : a :class:`Layer` instance
The `La... | 0 | 0 | 0 | 0 | 0 | 0 |
python/array/maximumsumpathtwoarrays.py | MacSimmy/algo-and-data-structure | 11,393 | 1735678 | # http://www.geeksforgeeks.org/maximum-sum-path-across-two-arrays/
def max_sum(input1, input2) -> object:
max_sum = 0
i = 0
j = 0
sum1 = 0
sum2 = 0
while i < len(input1) and j < len(input2):
if input1[i] == input2[j]:
if sum1 > sum2:
max_sum += sum1 + input1[... | 0 | 1 | 0 | 0 | 1 | 0 |
dictionary/admin/badge.py | ankitgc1/django-sozluk-master | 248 | 1735680 | from django.contrib import admin
from dictionary.models import Badge
@admin.register(Badge)
class BadgeAdmin(admin.ModelAdmin):
list_display: tuple[str, str, str] = ("name", "description", "url")
search_fields: tuple[str] = ("name",)
| 0 | 0 | 2 | 0 | 2 | 0 |
lulu/extractors/nicovideo.py | fakegit/Lulu | 922 | 1735685 | #!/usr/bin/env python
from urllib import (
parse,
request,
)
from lulu.common import (
match1,
url_info,
print_info,
get_content,
download_urls,
playlist_not_supported,
)
from lulu.config import FAKE_HEADERS
__all__ = ['nicovideo_download']
site_info = 'niconico nicovideo.jp'
fake_he... | 1 | 1 | 0 | 0 | 2 | 0 |
tests/test_cli/test_cli_util.py | blarghmatey/pyinfra | 1,532 | 1735709 | <gh_stars>1000+
import os
import sys
from datetime import datetime
from unittest import TestCase
import pytest
from six.moves import cStringIO as StringIO
from pyinfra.operations import server
from pyinfra_cli.exceptions import CliError
from pyinfra_cli.util import get_operation_and_args, json_encode
class TestCliU... | 0 | 0 | 0 | 0 | 0 | 0 |
resource_tracker/filters/resource_pool_filter.py | LaudateCorpus1/squest | 112 | 1735725 | <reponame>LaudateCorpus1/squest
import django_filters
from django import forms
from resource_tracker.filters.tag_filter import TagFilter
from resource_tracker.models import ResourcePool
from Squest.utils.squest_filter import SquestFilter
class ResourcePoolFilter(SquestFilter):
name = django_filters.CharFilter(wi... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/578035_Disable_File_System_Redirector/recipe-578035.py | tdiprima/code | 2,023 | 1735731 | import ctypes
class disable_file_system_redirection:
_disable = ctypes.windll.kernel32.Wow64DisableWow64FsRedirection
_revert = ctypes.windll.kernel32.Wow64RevertWow64FsRedirection
def __enter__(self):
self.old_value = ctypes.c_long()
self.success = self._disable(ctypes.byref(self.old_value... | 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.