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 |
|---|---|---|---|---|---|---|---|---|---|---|
finetuning/prepare/prepare-twisty.py | wietsedv/bertje | 104 | 1653812 | import os
import json
import random
src_path = 'data/original/twisty'
meta_path = os.path.join(src_path, 'TwiSty-NL.json')
data_dir = os.path.join(src_path, 'users_id')
out_dir = 'data/prepared/twisty'
num_tweets = 200
def tweet_text(tweet, replace_ents: bool=True) -> object:
text = tweet['text']
if repla... | 1 | 2 | 0 | 0 | 3 | 0 |
spikeextractors/extractors/neoextractors/mcsrawrecordingextractor.py | zekearneodo/spikeextractors | 145 | 1653830 | from .neobaseextractor import NeoBaseRecordingExtractor
try:
import neo
HAVE_NEO = True
except ImportError:
HAVE_NEO = False
class MCSRawRecordingExtractor(NeoBaseRecordingExtractor):
extractor_name: str = 'mcsrawRecoding'
mode: str = 'file'
NeoRawIOClass: str = 'RawMCSRawIO'
| 0 | 0 | 3 | 0 | 3 | 0 |
compiler-rt/test/sanitizer_common/ios_commands/iossim_compile.py | medismailben/llvm-project | 289 | 1653851 | #!/usr/bin/python
import os, sys, subprocess
output = None
output_type = 'executable'
args = sys.argv[1:]
while args:
arg = args.pop(0)
if arg == '-shared':
output_type = 'shared'
elif arg == '-dynamiclib':
output_type = 'dylib'
elif arg == '-c':
output_type = 'object'
eli... | 0 | 0 | 0 | 0 | 0 | 0 |
observations/r/liver.py | hajime9652/observations | 199 | 1653859 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import csv
import numpy as np
import os
import sys
from observations.util import maybe_download_and_extract
def liver(path) -> tuple[object, object]:
"""Liver related laboratory dat... | 0 | 1 | 0 | 0 | 1 | 0 |
nextgen/bcbio/pipeline/demultiplex.py | bgruening/bcbb | 339 | 1653860 | from __future__ import annotations
"""Pipeline support for barcode analysis and de-mulitplexing.
"""
import os
import copy
import subprocess
from Bio import SeqIO
from Bio.SeqIO.QualityIO import FastqGeneralIterator
from bcbio import utils
from bcbio.pipeline.fastq import get_fastq_files
from bcbio.distributed.transa... | 0 | 8 | 0 | 0 | 8 | 0 |
data/slovenia-data/crawler.py | HiteshMah-Jan/covid19 | 356 | 1653883 | <reponame>HiteshMah-Jan/covid19<gh_stars>100-1000
import os
import datetime
import tabula
from pathlib import Path
import re
data_folder = 'data/slovenia-data/'
data_files = os.listdir(data_folder)
first_date = datetime.date(2020, 4, 14)
curr_date = first_date
today = datetime.date.today()
while curr_date < today:
... | 0 | 0 | 0 | 0 | 0 | 0 |
angrmanagement/ui/widgets/qvextemps_viewer.py | DennyDai/angr-management | 474 | 1653884 | <reponame>DennyDai/angr-management<filename>angrmanagement/ui/widgets/qvextemps_viewer.py
import logging
from PySide2.QtWidgets import QFrame, QLabel, QVBoxLayout, QHBoxLayout, QScrollArea, QSizePolicy
from PySide2.QtCore import Qt, QSize
from .qast_viewer import QASTViewer
l = logging.getLogger('ui.widgets.qvextemp... | 0 | 0 | 0 | 0 | 0 | 0 |
core/signals.py | gcnoopy/YaraGuardian | 178 | 1653898 | <gh_stars>100-1000
import logging
import datetime
from django.dispatch import receiver
from django.db.models.signals import post_save
from django.contrib.auth.signals import user_logged_in
from django.contrib.auth.models import Group
from django.contrib.auth import get_user_model
from rest_framework.authtoken.models i... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/unit/streamalert/shared/lookup_tables/test_driver_s3.py | cninja1/streamalert | 2,770 | 1653907 | <gh_stars>1000+
"""
Copyright 2017-present Airbnb, 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... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/init-py-test/subdirectory-okay.py | mikelolasagasti/bandit | 4,016 | 1653917 | <gh_stars>1000+
# A sample test file in a subdirectory and its parents both containing
# an __init__.py file outlined in bug/1743042.
print('hopefully no vulnerabilities here')
| 0 | 0 | 0 | 0 | 0 | 0 |
deep_sort-master/generate_videos.py | riciche/SimpleCVReproduction | 923 | 1653940 | <reponame>riciche/SimpleCVReproduction
# vim: expandtab:ts=4:sw=4
import os
import argparse
import show_results
def convert(filename_in, filename_out, ffmpeg_executable="ffmpeg"):
import subprocess
command = [ffmpeg_executable, "-i", filename_in, "-c:v", "libx264",
"-preset", "slow", "-crf", "2... | 0 | 0 | 0 | 0 | 0 | 0 |
data_structures/attribute.py | JanSurft/tornado | 103 | 1653981 |
class Attribute:
def __init__(self):
self.NAME: None = None
self.TYPE: None = None
self.POSSIBLE_VALUES: list[object] = []
self.MAXIMUM_VALUE: None = None
self.MINIMUM_VALUE: None = None
def set_name(self, attr_name):
self.NAME = attr_name
d... | 0 | 0 | 0 | 5 | 5 | 0 |
keras_xlnet/loader.py | SchenbergZY/keras-xlnet | 183 | 1654028 | import json
import numpy as np
import tensorflow as tf
from .xlnet import build_xlnet
__all__ = [
'build_model_from_config',
'load_model_weights_from_checkpoint',
'load_trained_model_from_checkpoint',
]
def checkpoint_loader(checkpoint_file) -> object:
def _loader(name) -> object:
return tf.... | 1 | 4 | 0 | 0 | 5 | 0 |
okta/utils.py | corylevine/okta-sdk-python | 145 | 1654033 | <gh_stars>100-1000
"""
Class of utility functions.
"""
from enum import Enum
from datetime import datetime as dt
from okta.constants import DATETIME_FORMAT, EPOCH_DAY, EPOCH_MONTH,\
EPOCH_YEAR
def format_url(base_string):
"""
Turns multiline strings in generated clients into
simple one-line string
... | 0 | 0 | 0 | 0 | 0 | 0 |
django_linter/suppressers/__init__.py | enefeq/django_linter | 101 | 1654048 | <reponame>enefeq/django_linter
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from pylint.checkers.classes import ClassChecker
from pylint.checkers.base import DocStringChecker
from pylint.checkers.design_analysis import MisdesignChecker
from pylint.checker... | 0 | 0 | 0 | 0 | 0 | 0 |
bentoml/utils/alg.py | Shumpei-Kikuta/BentoML | 3,451 | 1654051 | import time
class FixedBucket:
'''
Fixed size FIFO container.
'''
def __init__(self, size):
self._data = [None] * size
self._cur: int = 0
self._size = size
self._flag_full: bool = False
def put(self, v):
self._data[self._cur] = v
self._cur += 1
... | 1 | 4 | 0 | 2 | 7 | 0 |
bindings/python/pysurvive/__main__.py | ali-hdvr/libsurvive | 377 | 1654068 | import subprocess
import pysurvive
import sys
import os
from gooey import Gooey, GooeyParser
@Gooey(tabbed_groups=True,
image_dir=os.path.dirname(os.path.realpath(__file__)) + "/images",
use_cmd_args=True,
program_name="pysurvive",
richtext_controls=True,
clear_before_run=True)
def ... | 0 | 1 | 0 | 0 | 1 | 0 |
freight/models/task.py | armandomeeuwenoord/freight | 562 | 1654074 | from __future__ import annotations
from datetime import datetime
from sqlalchemy import Column, DateTime, ForeignKey, Integer, String
from sqlalchemy.schema import Index
from freight.config import db
from freight.db.types.json import JSONEncodedDict
class TaskStatus(object):
unknown: int = 0
pending: int = 1... | 0 | 8 | 8 | 0 | 16 | 0 |
sendmail/datadog_checks/sendmail/__init__.py | divyamamgai/integrations-extras | 158 | 1654125 | <gh_stars>100-1000
from .__about__ import __version__
from .sendmail import SendmailCheck
__all__ = ['__version__', 'SendmailCheck']
| 0 | 0 | 0 | 0 | 0 | 0 |
RCNN_GRU/model/model.py | sladesha/algorithm | 520 | 1654131 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2019/7/2 7:25 PM
# @Author : Slade
# @File : model.py
# -*- coding:utf-8 -*-
from __future__ import annotations
import tensorflow as tf
from tensorflow.contrib import rnn
import tensorflow.contrib.layers as layers
"""wd_5_bigru_cnn
两部分使用不同的 embedding, 因为R... | 2 | 17 | 0 | 11 | 30 | 0 |
premium/backend/src/baserow_premium/row_comments/models.py | ashishdhngr/baserow | 839 | 1654135 | from django.contrib.auth import get_user_model
from django.db import models
from baserow.contrib.database.table.models import Table
from baserow.core.mixins import CreatedAndUpdatedOnMixin
User = get_user_model()
class RowComment(CreatedAndUpdatedOnMixin, models.Model):
"""
A user made comment on a specific... | 0 | 0 | 3 | 0 | 3 | 0 |
modules/nltk_contrib/lpath/at_lite/tableedit_qtable.py | h4ck3rm1k3/NLP-project | 123 | 1654144 | from __future__ import annotations
from qttable import QTable
from qt import SIGNAL,PYSIGNAL
class TableEdit(QTable):
def __init__(self, parent: object | None=None):
QTable.__init__(self, parent)
self.data: None = None
def setData(self, data):
self.removeColumns(range(self.numCols()))
... | 1 | 0 | 0 | 2 | 3 | 0 |
datar/dplyr/pull.py | stjordanis/datar | 110 | 1654152 | """Extract a single colum
https://github.com/tidyverse/dplyr/blob/master/R/pull.R
"""
from typing import Mapping, Union
from pandas import DataFrame, Series
from pipda import register_verb
from ..core.contexts import Context
from ..core.utils import arg_match, df_getitem, position_at
from ..core.types import String... | 5 | 1 | 0 | 0 | 6 | 0 |
testing/MLDB-779_cant_test_bs_cls.py | kstepanmpmg/mldb | 665 | 1654190 | <gh_stars>100-1000
#
# filename
# mldb.ai inc, 2015
# this file is part of mldb. copyright 2015 mldb.ai inc. all rights reserved.
#
# This test is for issues MLDB-779 AND MLDB-780
# We do the training pipelines twice and each cls has a different
# failure point
#
from mldb import mldb
import datetime, random
dataset_... | 0 | 0 | 0 | 0 | 0 | 0 |
lyrebird/checker/on_response_upstream.py | DuXiao1997/lyrebird | 737 | 1654209 | from __future__ import annotations
from lyrebird import application
from .. import checker
class OnResponseUpstreamHandler:
def __call__(self, rules: object | None=None, *args, **kw) -> object:
def func(origin_func) -> object:
func_type = checker.TYPE_ON_RESPONSE_UPSTREAM
if not c... | 1 | 2 | 0 | 0 | 3 | 0 |
test/test_preprocessor.py | mkannwischer/PQClean | 266 | 1654221 | import pytest
import helpers
import pqclean
@pytest.mark.parametrize(
'implementation',
pqclean.Scheme.all_implementations(),
ids=str,
)
@helpers.filtered_test
def test_preprocessor(implementation: pqclean.Implementation):
cfiles = implementation.cfiles()
hfiles = implementation.hfiles()
erro... | 1 | 0 | 0 | 0 | 1 | 0 |
plato/domain/ontology.py | avmi/plato-research-dialogue-system | 899 | 1654229 | <reponame>avmi/plato-research-dialogue-system
"""
Copyright (c) 2019-2020 Uber 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
Unl... | 0 | 0 | 0 | 0 | 0 | 0 |
scaffoldgraph/vis/utils.py | UCLCheminformatics/ScaffoldGraph | 121 | 1654265 | from __future__ import annotations
"""
scaffoldgraph.vis.utils
"""
import matplotlib.pyplot as plt
import matplotlib as mpl
from rdkit.Chem.Draw import rdMolDraw2D
from rdkit import Chem
from loguru import logger
from urllib import parse
def _maybe_kekulize(mol) -> object:
"""Private: attempt to kekulize a mol... | 10 | 5 | 0 | 0 | 15 | 0 |
recipes/Python/577906_Remove_real_input_functicurrent_text_mode/recipe-577906.py | tdiprima/code | 2,023 | 1654269 | <reponame>tdiprima/code
# noinput.py
#
# A single line only to add after any imports to remove the contentious
# "input()" function from Python 1.4.0 to 2.7.2.
#
# This forces "input()" to become "raw_input()" and overrides the internel
# function for the current Python session. This means that if you really
# want the... | 0 | 0 | 0 | 0 | 0 | 0 |
nmtpytorch/utils/data.py | tejas1995/nmtpytorch | 420 | 1654311 | # -*- coding: utf-8 -*-
import torch
import logging
from torch.utils.data import DataLoader
import numpy as np
from ..utils.misc import fopen, pbar
logger = logging.getLogger('nmtpytorch')
def sort_predictions(data_loader, results) -> object:
"""Recovers the dataset order when bucketing samplers are used."""
... | 4 | 6 | 0 | 0 | 10 | 0 |
test/torchaudio_unittest/backend/sox_io/common.py | popcornell/audio | 1,718 | 1654320 | def name_func(func, _, params) -> str:
return f'{func.__name__}_{"_".join(str(arg) for arg in params.args)}'
def get_enc_params(dtype) -> tuple[str, int]:
if dtype == "float32":
return "PCM_F", 32
if dtype == "int32":
return "PCM_S", 32
if dtype == "int16":
return "PCM_S", 16
... | 0 | 2 | 0 | 0 | 2 | 0 |
recipes/Python/476215_reducipes_Excuses_use_reduce/recipe-476215.py | tdiprima/code | 2,023 | 1654354 | import operator
def factorial(n) -> object:
"""Calculate n factorial"""
return reduce(operator.mul, range(2, n+1), 1)
def intersection(*sets) -> object:
"""Get the intersection of all input sets"""
return reduce(set.intersection, sets)
def union(*sets) -> object:
"""Get the union of all input set... | 0 | 4 | 0 | 0 | 4 | 0 |
spotdl/download/__init__.py | ktelegenov/spotify-downloader | 4,019 | 1654391 | from spotdl.download.tracking_file_handler import DownloadTracker
from spotdl.download.progress_ui_handler import DisplayManager
from spotdl.download.ffmpeg import convert, has_correct_version
from spotdl.download.embed_metadata import set_id3_data
from spotdl.download.downloader import DownloadManager
| 0 | 0 | 0 | 0 | 0 | 0 |
bin/load-dataset-Adult.py | e-orlov/autosklearn-zeroconf | 176 | 1654397 | # -*- coding: utf-8 -*-
"""
Copyright 2017 <NAME>
Created on Sun Apr 23 11:52:59 2017
@author: ekobylkin
This is an example on how to prepare data for autosklearn-zeroconf.
It is using a well known Adult (Salary) dataset from UCI https://archive.ics.uci.edu/ml/datasets/Adult .
"""
import pandas as pd
# wget https://ar... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/pe/test_hooking.py | rafael-santiago/LIEF | 2,999 | 1654409 | <filename>tests/pe/test_hooking.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import lief
import unittest
import logging
import os
import sys
import stat
import re
import subprocess
import tempfile
import shutil
import time
import ctypes
from subprocess import Popen
from unittest import TestCase
from utils import... | 0 | 0 | 0 | 0 | 0 | 0 |
pyctuator/impl/__init__.py | TheCodingLand/pyctuator | 118 | 1654444 | <reponame>TheCodingLand/pyctuator<gh_stars>100-1000
SBA_V2_CONTENT_TYPE = "application/vnd.spring-boot.actuator.v2+json;charset=UTF-8"
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/frontend/detector_descriptor/test_superpoint.py | swershrimpy/gtsfm | 122 | 1654445 | """Tests for Superpoint detector descriptor
Authors: <NAME>
"""
import unittest
import tests.frontend.detector_descriptor.test_detector_descriptor_base as test_detector_descriptor_base
from gtsfm.frontend.detector.detector_from_joint_detector_descriptor import DetectorFromDetectorDescriptor
from gtsfm.frontend.detect... | 0 | 0 | 0 | 0 | 0 | 0 |
mermaid_demos/rdmm_synth_data_generation/create_rect.py | HastingsGreer/mermaid | 120 | 1654464 | from mermaid_demos.rdmm_synth_data_generation.create_poly import Poly
import numpy as np
class Rectangle(Poly):
def __init__(self,setting,scale: float=1.):
name, img_sz, center_pos, height, width, rotation = setting['name'],setting['img_sz'], setting['center_pos'], setting['height'], setting['width'], setti... | 1 | 2 | 0 | 2 | 5 | 0 |
python/custom_transformer/setup.py | ittus/kserve | 1,146 | 1654472 | <filename>python/custom_transformer/setup.py
# Copyright 2021 The KServe Authors.
#
# 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 ... | 0 | 0 | 0 | 0 | 0 | 0 |
zeus/api/resources/repository_stats.py | conrad-kronos/zeus | 221 | 1654495 | from datetime import timedelta
from sqlalchemy.sql import func
from flask import current_app, request
from typing import List
from zeus.api.utils import stats
from zeus.config import db
from zeus.models import Build, Repository, Revision
from zeus.utils import timezone
from zeus.vcs import vcs_client
from .base_repos... | 4 | 2 | 0 | 0 | 6 | 0 |
test/ext/mypy/files/mixin_one.py | bmacphee/sqlalchemy | 5,383 | 1654499 | <reponame>bmacphee/sqlalchemy
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()
# TODO: also reg.as_declarative_base()
Base = declarative_base()
class HasUpdatedAt:
... | 0 | 0 | 0 | 0 | 0 | 0 |
opennre/framework/__init__.py | ishine/OpenNRE | 3,284 | 1654521 | <reponame>ishine/OpenNRE
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from .data_loader import SentenceREDataset, SentenceRELoader, BagREDataset, BagRELoader, MultiLabelSentenceREDataset, MultiLabelSentenceRELoader
from .sentence_re import SentenceRE
from... | 0 | 0 | 0 | 0 | 0 | 0 |
spec/fixtures/semgrep/vendor/trivial2.py | hstocks/salus | 625 | 1654527 | <filename>spec/fixtures/semgrep/vendor/trivial2.py
# https://semgrep.live/WRE
class User:
def __init__(self, id):
self.id = id
def route(user_id):
user = User(1)
if user.id == user.id:
return '200'
else:
return '404' | 0 | 0 | 0 | 0 | 0 | 0 |
bashfuscator/core/engine/random.py | 0xflotus/Bashfuscator | 859 | 1654546 | <reponame>0xflotus/Bashfuscator<gh_stars>100-1000
"""
Defines RandomGen, a wrapper around all common functions relying on
randomness.
"""
import string
import random
import re
class RandomGen(object):
"""
Wrapper around :py:class:`random.SystemRandom`.
Provided for ease of use and to avoid
having to i... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/tokenizers/max_match/test_bidirectional.py | howl-anderson/MicroTokenizer | 136 | 1654554 | <filename>tests/tokenizers/max_match/test_bidirectional.py
import pytest
from MicroTokenizer import default_model_dir
from MicroTokenizer.tokenizers.max_match.bidirectional import (
MaxMatchBidirectionalTokenizer,
)
@pytest.mark.parametrize("input_text", pytest.helpers.tokenizer_test_cases())
def test_train(inpu... | 0 | 0 | 0 | 0 | 0 | 0 |
plato/agent/component/dialogue_policy/deep_learning/supervised_policy.py | avmi/plato-research-dialogue-system | 899 | 1654577 | <reponame>avmi/plato-research-dialogue-system
"""
Copyright (c) 2019-2020 Uber 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
Unl... | 0 | 0 | 0 | 0 | 0 | 0 |
src/DataJoin/common/data_join_service_pb2_grpc.py | huangwei19/9nfl | 103 | 1654581 | # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from DataJoin.common import common_pb2 as DataJoin_dot_common_dot_common__pb2
from DataJoin.common import data_join_service_pb2 as DataJoin_dot_common_dot_data__join__service__pb2
from google.protobuf import empty_pb2 as google_dot_proto... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/utils/cmgen.py | efedo/renderer | 1,857 | 1654593 | <gh_stars>1000+
import os
import platform
import shutil
import tempfile
CMGEN_FILEPATH = {
"Windows": "../../tools/win32/cmgen.exe",
"Darwin": "../../tools/macos/cmgen",
"Linux": "../../tools/linux/cmgen",
}
LOOKUP_COMMAND = "{cmgen} --ibl-dfg={filepath}.hdr"
DIFFUSE_COMMAND = "{cmgen} --format=hdr --ibl-... | 0 | 0 | 0 | 0 | 0 | 0 |
data/__init__.py | ramilmsh/monocularDepth-Inference | 134 | 1654604 | import torch.utils.data
from data.base_data_loader import BaseDataLoader
def CreateDataLoader(args) -> object:
data_loader = CustomDatasetDataLoader()
data_loader.initialize(args)
return data_loader
def CreateDataset(args) -> object:
dataset = None
from data.single_dataset import TestDataset
... | 0 | 5 | 0 | 0 | 5 | 0 |
tests/test_parser.py | 9seconds/hrss | 124 | 1654606 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
import pytest
import concierge.core.exceptions as exceptions
import concierge.core.lexer as lexer
import concierge.core.parser as parser
def is_trackable_host():
assert parser.is_trackable_host("Host")
assert not parser.is_trackable_host("Host-")
def get_host_to... | 0 | 0 | 0 | 0 | 0 | 0 |
readthedocs/builds/signals.py | yarons/readthedocs.org | 4,054 | 1654620 | """Build signals."""
import django.dispatch
build_complete = django.dispatch.Signal()
# Useful to know when to purge the footer
version_changed = django.dispatch.Signal()
| 0 | 0 | 0 | 0 | 0 | 0 |
python/151 Reverse Words in a String.py | allandproust/leetcode-share | 156 | 1654665 | '''
Given an input string, reverse the string word by word.
For example,
Given s = "the sky is blue",
return "blue is sky the".
Update (2015-02-12):
For C programmers: Try to solve it in-place in O(1) space.
Clarification:
What constitutes a word?
A sequence of non-space characters constitutes a word.
C... | 0 | 1 | 0 | 0 | 1 | 0 |
src/schnetpack/utils/script_utils/evaluation.py | lizhifeng1998/schnetpack | 450 | 1654694 | from __future__ import annotations
import os
import csv
__all__ = ["evaluate", "evaluate_dataset"]
def evaluate(
args,
model,
train_loader,
val_loader,
test_loader,
device,
metrics,
custom_header: object | None=None,
):
header = []
results = []
loaders = dict(train=trai... | 1 | 1 | 0 | 0 | 2 | 0 |
colossus/apps/notifications/tests/test_views.py | CreativeWurks/emailerpro | 372 | 1654699 | <filename>colossus/apps/notifications/tests/test_views.py
import json
from django.http import JsonResponse
from django.urls import reverse
from colossus.apps.accounts.models import User
from colossus.apps.notifications.models import Notification
from colossus.apps.notifications.tests.factories import NotificationFact... | 0 | 0 | 0 | 0 | 0 | 0 |
anuga/file_conversion/__init__.py | samcom12/anuga_core | 136 | 1654717 | <reponame>samcom12/anuga_core
""" Modules for performing conversions between file types, or for
resampling a given file.
In general, the naming convention follows this rule:
<file_ext_in>2<file_ext_out>('filename_in', 'filename_out')
for example:
sww2dem('northbeach.sww', 'out... | 0 | 0 | 0 | 0 | 0 | 0 |
models/dmcp/__init__.py | haolibai/dmcp | 119 | 1654725 | <reponame>haolibai/dmcp<filename>models/dmcp/__init__.py
# -*- coding:utf-8 -*-
from models.dmcp.dmcp_resnet import dmcp_resnet18, dmcp_resnet50
from models.dmcp.dmcp_mobilenet import dmcp_mobilenet_v2
| 0 | 0 | 0 | 0 | 0 | 0 |
machina/apps/forum_permission/migrations/0002_auto_20160607_0500.py | OneRainbowDev/django-machina | 572 | 1654751 | <filename>machina/apps/forum_permission/migrations/0002_auto_20160607_0500.py
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-06-07 03:00
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('forum_permissio... | 0 | 0 | 0 | 0 | 0 | 0 |
gameRole.py | UtkarshPrakash/PythonShootGame | 318 | 1654759 | # -*- coding: utf-8 -*-
"""
Created on Wed Sep 11 16:36:03 2013
@author: Leo
"""
import pygame
SCREEN_WIDTH = 480
SCREEN_HEIGHT = 800
TYPE_SMALL = 1
TYPE_MIDDLE = 2
TYPE_BIG = 3
# 子弹类
class Bullet(pygame.sprite.Sprite):
def __init__(self, bullet_img, init_pos):
pygame.sprite.Sprite._... | 0 | 0 | 0 | 7 | 7 | 0 |
sdf/util.py | yihong0618/sdf | 926 | 1654780 | import math
pi = math.pi
degrees = math.degrees
radians = math.radians
| 0 | 0 | 0 | 0 | 0 | 0 |
WebCrawler/getchu.py | yoshiko2/Movie_Data_Capture | 562 | 1654807 | <reponame>yoshiko2/Movie_Data_Capture
import sys
sys.path.append('../')
from ADC_function import *
from WebCrawler.crawler import *
import re
import time
from urllib.parse import quote
JSON_HEADERS = {"Referer": "https://dl.getchu.com/"}
COOKIES_DL = {"adult_check_flag": "1"}
COOKIES_WWW = {'getchu_adalt_flag': 'getch... | 0 | 0 | 0 | 0 | 0 | 0 |
hwt/doc_markers.py | mgielda/hwt | 134 | 1654841 | <reponame>mgielda/hwt<gh_stars>100-1000
def internal(fn):
"""
Decorator which does not affect functionality but it is used as marker
which tells that this object is not interesting for users and it is only used internally
"""
return fn | 0 | 0 | 0 | 0 | 0 | 0 |
mermaid_apps/create_synthetic_regularization_test_cases.py | HastingsGreer/mermaid | 120 | 1654889 | from __future__ import annotations
from __future__ import print_function
from future.utils import native_str
from builtins import str
from builtins import range
#import mermaid.set_pyreg_paths
import matplotlib as matplt
from mermaid.config_parser import MATPLOTLIB_AGG
if MATPLOTLIB_AGG:
matplt.use('Agg')
impo... | 24 | 10 | 0 | 0 | 34 | 0 |
consoleme/handlers/v2/service_control_policy.py | shyovn/consoleme | 2,835 | 1654906 | <reponame>shyovn/consoleme<filename>consoleme/handlers/v2/service_control_policy.py
import sentry_sdk
from consoleme.config import config
from consoleme.exceptions.exceptions import MustBeFte
from consoleme.handlers.base import BaseAPIV2Handler
from consoleme.lib.aws import get_scps_for_account_or_ou
from consoleme.mo... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/dbg_gdb_cli.py | rakati/ppci-mirror | 161 | 1654917 | #!/usr/bin/python
import argparse
import logging
from ppci.api import get_arch, get_object
from ppci.binutils.dbg import Debugger
from ppci.binutils.dbg.ptcli import PtDebugCli
from ppci.binutils.dbg.gdb.client import GdbDebugDriver
from ppci.binutils.dbg.gdb.transport import TCP
if __name__ == "__main__":
parse... | 0 | 0 | 0 | 0 | 0 | 0 |
src/0961.n-repeated-element-in-size-2n-array/n-repeated-element-in-size-2n-array.py | lyphui/Just-Code | 782 | 1654922 | <filename>src/0961.n-repeated-element-in-size-2n-array/n-repeated-element-in-size-2n-array.py
from collections import Counter
class Solution:
def repeatedNTimes(self, A: List[int]) -> int:
for i in range(1,4):#把问题放小就是大概率4个中有重复的,所以4个4个判断就可以了
for k in range(len(A) - i):
if A[k] == ... | 0 | 0 | 0 | 0 | 0 | 0 |
tensorstore/examples/python/beam/compute_dfbyf.py | stuarteberg/tensorstore | 106 | 1654956 | # http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing p... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/sender/execute.py | DefenceLogic/Osmedeus | 3,602 | 1654976 | <reponame>DefenceLogic/Osmedeus
import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
from lib.sender import send
from lib.core import utils
def get_cmd(options):
mode = options.get('MODE', 'general')
url = options.get('REMOTE_API') + '/api/commands/get/?module={0... | 0 | 0 | 0 | 0 | 0 | 0 |
forecasting/tests/unittests/test_forecasting.py | zhiqiangdon/autogluon | 4,462 | 1654978 | <reponame>zhiqiangdon/autogluon<filename>forecasting/tests/unittests/test_forecasting.py
import autogluon.forecasting
def test_forecasting():
print("Not Implemented")
| 0 | 0 | 0 | 0 | 0 | 0 |
symposion/reviews/admin.py | azkarmoulana/pycon | 154 | 1655044 | <gh_stars>100-1000
from django.contrib import admin
from symposion.reviews.models import (
NotificationTemplate, ProposalGroup, ProposalResult
)
admin.site.register(
NotificationTemplate,
list_display=[
'label',
'from_address',
'subject'
]
)
admin.site.register(
ProposalG... | 0 | 0 | 0 | 0 | 0 | 0 |
Chapter_16/ch16_ex2.py | pauldevos/Mastering-Object-Oriented-Python-Second-Edition | 108 | 1655060 | <reponame>pauldevos/Mastering-Object-Oriented-Python-Second-Edition
#!/usr/bin/env python3.7
"""
Mastering Object-Oriented Python 2e
Code Examples for Mastering Object-Oriented Python 2nd Edition
Chapter 16. Example 2.
"""
from typing import Type
import logging
import sys
# Multiple Loggers
# =====================... | 0 | 0 | 0 | 0 | 0 | 0 |
home-assistant/custom_components/cracow_air_quality/sensor.py | Adamvg/SmartHouse | 136 | 1655061 | from __future__ import annotations
import logging
import json
from datetime import datetime, timedelta
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from requests import (Request, Session)
_LOGGER = logging.getLogger(__name__)
from homeassistant.helpers.entity import Entity
from homeass... | 1 | 8 | 0 | 3 | 12 | 0 |
hs_core/migrations/0005_auto_20150910_0233.py | hydroshare/hydroshare | 178 | 1655087 | <filename>hs_core/migrations/0005_auto_20150910_0233.py
# -*- coding: utf-8 -*-
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('hs_core', '0004_auto_20150721_1125'),
]
operations = [
migrations.RemoveField(
model_name='base... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/highcharts/spline-irregular-time.py | Jbrunn/python-highcharts | 370 | 1655122 | # -*- coding: utf-8 -*-
"""
Highcharts Demos
Time data with irregular intervals: http://www.highcharts.com/demo/spline-irregular-time
"""
from datetime import datetime
from highcharts import Highchart
H = Highchart()
winter_12_13_data = [
[datetime(1970, 10, 21), 0],
[datetime(1970, 11, 4), 0.28],
[datetim... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/django/posts/api.py | mission-liao/restless | 575 | 1655125 | from django.contrib.auth.models import User
from restless.dj import DjangoResource
from restless.preparers import FieldsPreparer
from posts.models import Post
class PostResource(DjangoResource):
preparer = FieldsPreparer(fields={
'id': 'id',
'title': 'title',
'author': 'user.username',
... | 0 | 4 | 0 | 0 | 4 | 0 |
base/lib/pythonbin/ed25519/__init__.py | threefoldtech/sandbox_osx | 136 | 1655130 | from .keys import (BadSignatureError, BadPrefixError,
create_keypair, SigningKey, VerifyingKey,
remove_prefix, to_ascii, from_ascii)
(BadSignatureError, BadPrefixError,
create_keypair, SigningKey, VerifyingKey,
remove_prefix, to_ascii, from_ascii) # hush pyflakes
from ._version i... | 0 | 0 | 0 | 0 | 0 | 0 |
vint/utils/array.py | mosheavni/vint | 538 | 1655131 | from typing import TypeVar, List, Callable # noqa: F401
from functools import reduce
from operator import add
T = TypeVar('T')
S = TypeVar('S')
def flatten(l) -> object:
# type: (List[List[T]]) -> List[T]
return reduce(add, l, [])
def flat_map(f, l) -> object:
# type: (Callable[[S], List[T]], List[S])... | 0 | 2 | 0 | 0 | 2 | 0 |
tcapy/api/app_api.py | Ahrvo-Trading-Systems/tcapy | 189 | 1655153 | from __future__ import annotations
from __future__ import division, print_function
__author__ = 'saeedamen' # <NAME> / <EMAIL>
#
# Copyright 2019 Cuemacro
#
# See the License for the specific language governing permissions and limitations under the License.
#
from flask import Flask, request, jsonify
# hack to get ... | 0 | 1 | 0 | 0 | 1 | 0 |
data/transcoder_evaluation_gfg/python/SUBSEQUENCES_SIZE_THREE_ARRAY_WHOSE_SUM_DIVISIBLE_M_1.py | mxl1n/CodeGen | 241 | 1655211 | # Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
def f_gold ( A , N , M ) -> object :
ans = 0
h = [ 0 ] * M
for i in range ( 0 , N ) :
A [ i ] = A [ i ] % M
... | 0 | 1 | 0 | 0 | 1 | 0 |
cosypose/datasets/synthetic_dataset.py | ompugao/cosypose | 202 | 1655226 | import torch
import pandas as pd
import numpy as np
import pickle as pkl
import yaml
import cv2
from io import BytesIO
from .utils import make_detections_from_segmentation
from .datasets_cfg import make_urdf_dataset
from pathlib import Path
import torch.multiprocessing
torch.multiprocessing.set_sharing_strategy('file_s... | 2 | 3 | 0 | 0 | 5 | 0 |
pymagnitude/third_party/allennlp/data/dataset_readers/snli.py | tpeng/magnitude | 1,520 | 1655227 | <reponame>tpeng/magnitude
from __future__ import with_statement
from __future__ import absolute_import
#typing
import json
import logging
#overrides
from allennlp.common.file_utils import cached_path
from allennlp.data.dataset_readers.dataset_reader import DatasetReader
from allennlp.data.fields import Field, TextF... | 0 | 0 | 0 | 0 | 0 | 0 |
graphql_compiler/debugging_utils.py | manesioz/graphql-compiler | 521 | 1655246 | # Copyright 2017-present Kensho Technologies, LLC.
import re
import six
def remove_custom_formatting(query: str) -> str:
"""Prepare the query string for pretty-printing by removing all unusual formatting."""
query = re.sub("[\n ]+", " ", query)
return query.replace("( ", "(").replace(" )", ")")
def pre... | 4 | 3 | 0 | 0 | 7 | 0 |
awx/main/migrations/0058_v350_remove_limit_limit.py | Avinesh/awx | 11,396 | 1655316 | <gh_stars>1000+
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2019-02-05 18:29
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0057_v350_remove_become_method_type'),
]
operations = [
... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/iris.py | llllllllll/PyNomaly | 284 | 1655323 | <filename>examples/iris.py<gh_stars>100-1000
from PyNomaly import loop
import pandas as pd
from pydataset import data
from sklearn.cluster import DBSCAN
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
iris = pd.DataFrame(data('iris'))
iris = pd.DataFrame(iris.drop('Species', 1))
db = DBSCAN(... | 0 | 0 | 0 | 0 | 0 | 0 |
dota2/features/__init__.py | itsjfx/dota2 | 172 | 1655340 | from dota2.features.player import Player
from dota2.features.match import Match
from dota2.features.lobby import Lobby
from dota2.features.chat import ChatBase
from dota2.features.sharedobjects import SOBase
from dota2.features.party import Party
class FeatureBase(Player, Match, Lobby, Party, ChatBase, SOBase):
"... | 0 | 0 | 0 | 0 | 0 | 0 |
packages/implementations/OneLang-Reflect-v0.1/native/OneReflect.py | onelang/onelang | 267 | 1655393 | classes = {}
def get_class(obj) -> object:
return classes.get(name_key(obj.__class__.__name__))
def get_class_by_name(name) -> object:
return classes.get(name_key(name))
def setup_class(cls):
classes[name_key(cls.name)] = cls
def name_key(name) -> object:
return name.lower().replace("_", "")
class ... | 0 | 9 | 0 | 4 | 13 | 0 |
AutotestFramework/core/processor/Config.py | yangjourney/sosotest | 422 | 1655471 | <reponame>yangjourney/sosotest
# coding:utf-8
"""
Author:王吉亮
Date:20161027
Desc:配置文件转换类,将.conf的配置文件转换为dict
"""
import configparser
from core.decorator.normal_functions import *
#!/usr/bin/python
class MyConfig(configparser.ConfigParser):
def __init__(self,defaults=None):
configparser.ConfigParser.__init_... | 0 | 0 | 0 | 0 | 0 | 0 |
astroquery/sdss/__init__.py | rickynilsson/astroquery | 577 | 1655485 | <filename>astroquery/sdss/__init__.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
SDSS Spectra/Image/SpectralTemplate Archive Query Tool
------------------------------------------------------
"""
from astropy import config as _config
class Conf(_config.ConfigNamespace):
"""
Configurati... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/gen_java_source_jar.py | VSaliy/j2objc | 4,901 | 1655513 | <filename>scripts/gen_java_source_jar.py<gh_stars>1000+
#!/usr/bin/python
#
# 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... | 0 | 0 | 0 | 0 | 0 | 0 |
runway/cfngin/lookups/handlers/rxref.py | onicagroup/runway | 134 | 1655514 | <filename>runway/cfngin/lookups/handlers/rxref.py
"""Handler for fetching outputs from a stack in the current namespace."""
# pyright: reportIncompatibleMethodOverride=none
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from typing_extensions import Final, Literal
from ....lookups.handlers.... | 0 | 0 | 0 | 0 | 0 | 0 |
Lib/test/issue1811/foo.py | jeff5/jython-whinchat | 577 | 1655517 | <gh_stars>100-1000
issue1811 = __import__('test.issue1811', globals(), locals(), ['foo'])
| 0 | 0 | 0 | 0 | 0 | 0 |
Youtube_Video_Downloader/download_video.py | elishahyousaf/Awesome-Python-Scripts | 1,026 | 1655586 | <gh_stars>1000+
from pytube import YouTube
link = input('https://youtu.be/6M1rP2r672o')
yt = Youtube(link)
yt.streams.first().download()
print('downloaded', link)
| 0 | 0 | 0 | 0 | 0 | 0 |
nanodet/util/scatter_gather.py | automaton123456/nanodet | 4,388 | 1655595 | # Copyright 2021 RangiLyu.
#
# 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, so... | 4 | 5 | 0 | 0 | 9 | 0 |
learning_python/modules/collateral/module_basics/use_module2a.py | fallenfuzz/pynet | 528 | 1655609 | import my_module2
my_module2.dns_ip()
my_module2.dns_ip(dns="1.1.1.1")
| 0 | 0 | 0 | 0 | 0 | 0 |
test.py | sunshicheng/JobCenter | 152 | 1655689 | # -*- coding: utf-8 -*-
# @Author: guomaoqiu
# @File Name: test.py
# @Date: 2019-03-07 17:20:36
# @Last Modified by: guomaoqiu
# @Last Modified time: 2019-03-21 14:47:44
from apscheduler.schedulers.background import BackgroundScheduler
from flask import Flask
def sensor():
""" Function for test purposes. """
... | 0 | 1 | 0 | 0 | 1 | 0 |
tensorflow_text/python/ops/segment_combiner_ops.py | aprasad16/text | 14,668 | 1655708 | # coding=utf-8
# Copyright 2021 TF.Text Authors.
#
# 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 ag... | 0 | 1 | 0 | 0 | 1 | 0 |
scale/util/test/__init__.py | kaydoh/scale | 121 | 1655724 | import logging
# Disable logging for unit tests
logging.disable(logging.CRITICAL)
| 0 | 0 | 0 | 0 | 0 | 0 |
pyActionRec/__init__.py | Xiatian-Zhu/anet2016_cuhk | 253 | 1655736 | from config import ANET_CFG
import anet_db | 0 | 0 | 0 | 0 | 0 | 0 |
midi/urldecode.py | gonnavis/mariohtml5 | 261 | 1655740 | #!/usr/bin/env python
import urllib
import sys
with open (sys.argv[1], "r") as myfile:
data=myfile.read()
print "input data: " + data
decoded = urllib.unquote(data)
with open(sys.argv[1] + ".mid", "w") as text_file:
text_file.write("%s" % (decoded))
| 0 | 0 | 0 | 0 | 0 | 0 |
clickhouse_sqlalchemy/sql/ddl.py | hodgesrm/clickhouse-sqlalchemy | 251 | 1655746 | <gh_stars>100-1000
from sqlalchemy.sql.ddl import (
SchemaDropper as SchemaDropperBase, DropTable as DropTableBase
)
from sqlalchemy.sql.expression import UnaryExpression
from sqlalchemy.sql.operators import custom_op
class DropTable(DropTableBase):
def __init__(self, element, if_exists=False):
self.i... | 0 | 0 | 0 | 0 | 0 | 0 |
conanfile.py | Quincunx271/pmm | 176 | 1655751 | import conans
class PMM(conans.ConanFile):
name: str = 'pmm'
version: str = '1.5.1'
settings: None = None
exports_sources: str = '*'
generators: str = 'cmake'
# build_requires = (
# 'libman-generator/[*]@vector-of-bool/test'
# )
# generators = 'cmake', 'LibMan'
def build(... | 0 | 0 | 5 | 0 | 5 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.