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 |
|---|---|---|---|---|---|---|---|---|---|---|
mediawiki__wikipedia.py | DazEB2/SimplePyScripts | 117 | 3216577 | <filename>mediawiki__wikipedia.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
# pip install pymediawiki
# https://github.com/barrust/mediawiki
# http://pymediawiki.readthedocs.io/en/latest/index.html
def wiki_search(query: str, lang='ru', unquote_percent_encoded=False) -> str:
# Defa... | 0 | 0 | 0 | 0 | 0 | 0 |
common/security-features/subresource/video.py | meyerweb/wpt | 14,668 | 3216599 | import os, sys
from wptserve.utils import isomorphic_decode
import importlib
subresource = importlib.import_module("common.security-features.subresource.subresource")
def generate_payload(request, server_data) -> object:
file = os.path.join(request.doc_root, u"media", u"movie_5.ogv")
return open(file, "rb").re... | 0 | 1 | 0 | 0 | 1 | 0 |
sql_server/pyodbc/operations.py | VenturaFranklin/django-pyodbc-azure | 336 | 3216600 | import datetime
import uuid
import warnings
from django.conf import settings
from django.db.backends.base.operations import BaseDatabaseOperations
from django.utils import timezone
from django.utils.encoding import force_text
import pytz
class DatabaseOperations(BaseDatabaseOperations):
compiler_module = 'sql_s... | 0 | 0 | 0 | 0 | 0 | 1 |
galaxy/main/migrations/0092_content_module_utils.py | bmclaughlin/galaxy | 904 | 3216605 | from django.db import migrations, models
INSERT_MODULE_UTILS_CONTENT_TYPE = """
INSERT INTO main_contenttype
(name, description, created, modified)
VALUES
('module_utils', 'Module Utils', now(), now())
"""
DELETE_MODULE_UTILS_CONTENT_TYPE = """
DELETE FROM main_contenttype WHERE name = 'module_utils'
"""
class... | 0 | 0 | 2 | 0 | 2 | 0 |
var/spack/repos/builtin.mock/packages/quantum-espresso/package.py | LiamBindle/spack | 2,360 | 3216609 | <reponame>LiamBindle/spack<filename>var/spack/repos/builtin.mock/packages/quantum-espresso/package.py<gh_stars>1000+
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
class ... | 0 | 0 | 0 | 0 | 0 | 0 |
users/middleware.py | hrbhat/twissandra | 308 | 3216626 | import cass
def get_user(request):
if 'username' in request.session:
try:
user = cass.get_user_by_username(request.session['username'])
return {
'username': user.username,
'password': <PASSWORD>,
'is_authenticated': True
}
... | 0 | 0 | 0 | 0 | 0 | 0 |
todoist/managers/labels.py | jonringer/todoist-python | 617 | 3216629 | <filename>todoist/managers/labels.py
# -*- coding: utf-8 -*-
from .. import models
from .generic import AllMixin, GetByIdMixin, Manager, SyncMixin
class LabelsManager(Manager, AllMixin, GetByIdMixin, SyncMixin):
state_name = "labels"
object_type = "label"
def add(self, name, **kwargs):
"""
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/encode_task_trim_fastq.py | motorny/chip-seq-pipeline2 | 261 | 3216669 | <reponame>motorny/chip-seq-pipeline2
#!/usr/bin/env python
# ENCODE DCC fastq merger wrapper
# Author: <NAME> (<EMAIL>)
import sys
import os
import argparse
from encode_lib_common import (
assert_file_not_empty, copy_f_to_f, log, ls_l, mkdir_p,
run_shell_cmd, strip_ext_fastq)
def parse_arguments(debug=False... | 0 | 0 | 0 | 0 | 0 | 0 |
common/security-features/scope/worker.py | meyerweb/wpt | 14,668 | 3216676 | import os, sys, json
from wptserve.utils import isomorphic_decode, isomorphic_encode
import importlib
util = importlib.import_module("common.security-features.scope.util")
def main(request, response):
policyDeliveries = json.loads(request.GET.first(b'policyDeliveries', b'[]'))
worker_type = request.GET.first(b'ty... | 0 | 0 | 0 | 0 | 0 | 0 |
addon_common/scripts/strip_debugging.py | Unnoen/retopoflow | 1,600 | 3216687 | <filename>addon_common/scripts/strip_debugging.py<gh_stars>1000+
#!/usr/bin/python3
import os
import re
import sys
import glob
if len(sys.argv) < 2 or sys.argv[1] != 'YES!':
print('CAUTION: running this will alter **ALL** .py files in every subdirectory!')
print('To ensure you are certain you want to run it, ... | 0 | 0 | 0 | 0 | 0 | 0 |
apps/samples/appengine-channelapi/appengine/chatactoe.py | HannesGitH/chrome-extensions-samples | 2,981 | 3216731 | #!/usr/bin/python2.4
#
# Copyright 2010 Google Inc. All Rights Reserved.
# pylint: disable-msg=C6310
"""Channel Tic Tac Toe
This module demonstrates the App Engine Channel API by implementing a
simple tic-tac-toe game.
"""
import datetime
import logging
import os
import random
import re
import uuid
import sys
from ... | 0 | 0 | 0 | 0 | 0 | 0 |
recommender/mapper2.py | Finite-Abelian/Data_Analytics_with_Hadoop | 177 | 3216733 | <reponame>Finite-Abelian/Data_Analytics_with_Hadoop
#!/usr/bin/env python
import csv
from framework import Mapper
class IdentityMapper(Mapper):
def map(self):
for row in self:
key, value = row.split(self.sep)
self.emit(key, value)
if __name__ == '__main__':
mapper = IdentityM... | 0 | 0 | 0 | 0 | 0 | 0 |
docs/docs_env/Lib/site-packages/pip-1.0-py2.5.egg/pip/commands/install.py | gilsonbp/Django-facebook | 606 | 3216751 | import os, sys
from pip.req import InstallRequirement, RequirementSet
from pip.req import parse_requirements
from pip.log import logger
from pip.locations import build_prefix, src_prefix
from pip.basecommand import Command
from pip.index import PackageFinder
from pip.exceptions import InstallationError
class InstallC... | 0 | 2 | 4 | 0 | 6 | 0 |
aws-blog-jobserver-emr/python_lambda/models.py | securityscorecard/aws-big-data-blog | 305 | 3216765 | import time
import logging
import json
from sjsclient import client
logging.basicConfig()
logger = logging.getLogger()
logger.setLevel(logging.INFO)
sjs = client.Client("http://jobserver.ml-test-blog.internal:8090")
myApp = sjs.apps.get("ml")
myContext = sjs.contexts.get("ml-context")
def testHandler(event, context... | 0 | 4 | 0 | 0 | 4 | 0 |
src/oci/data_integration/models/read_operation_config.py | Manny27nyc/oci-python-sdk | 249 | 3216770 | # coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | 0 | 11 | 0 | 12 | 23 | 0 |
test/unit3/test_string_methods.py | DTenore/skulpt | 2,671 | 3216771 | <reponame>DTenore/skulpt
""" Unit test for string methods"""
import unittest
import re
class StringMethodsTests(unittest.TestCase):
def test_concat(self):
self.assertEqual("O" + "K", "OK")
def test(t):
t = "O" + t
return t
self.assertEqual(test("K"), "OK")
... | 0 | 0 | 0 | 0 | 0 | 0 |
models/action_recognition/model_templates/gesture-recognition/tools/data/prepare_jester_annot.py | dqawami/openvino_training_extensions | 256 | 3216785 | """
Copyright (c) 2020 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 agreed to in wri... | 0 | 3 | 0 | 0 | 3 | 0 |
examples/gridding/Point_Interpolation.py | gerritholl/MetPy | 819 | 3216786 | <gh_stars>100-1000
# Copyright (c) 2016 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""
Point Interpolation
===================
Compares different point interpolation approaches.
"""
import cartopy.crs as ccrs
import cartopy.feature as cfeature
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/genie/libs/parser/iosxr/tests/ShowBgpInstances/cli/equal/golden_output_1_expected.py | balmasea/genieparser | 204 | 3216798 |
expected_output = {
"instance": {
"default": {
"address_families": ["ipv4 unicast", "vpnv4 unicast", "ipv6 unicast"],
"bgp_id": 34984,
"instance_id": 0,
"num_vrfs": 12,
"placed_grp": "v4_routing",
}
},
"number_of_bgp_instances": 1... | 0 | 0 | 0 | 0 | 0 | 0 |
ambiente_virtual/Lib/site-packages/alembic/ddl/sqlite.py | PI-UNIVESP-Penapolis/PRODEA | 1,324 | 3216800 | <reponame>PI-UNIVESP-Penapolis/PRODEA
import re
from typing import Any
from typing import Dict
from typing import Optional
from typing import TYPE_CHECKING
from typing import Union
from sqlalchemy import cast
from sqlalchemy import JSON
from sqlalchemy import schema
from sqlalchemy import sql
from .impl import Defaul... | 0 | 0 | 0 | 0 | 0 | 0 |
saas/forms.py | kaiserho/djaodjin-saas | 383 | 3216804 | # Copyright (c) 2021, DjaoDjin inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and t... | 6 | 10 | 6 | 0 | 22 | 0 |
automation/services/coda-user-agent/agent.py | arjundashrath/mina | 929 | 3216823 | from __future__ import annotations
from CodaClient import Client, Currency, CurrencyFormat
import os
import schedule
import time
import urllib3
import random
from requests.exceptions import ConnectionError
from prometheus_client import Counter, start_http_server
def getenv_default_map(env_var: str, f, default) -> obje... | 8 | 8 | 0 | 1 | 17 | 0 |
guillotina/metrics.py | plone/guillotina | 173 | 3216855 | from typing import Dict
from typing import Optional
from typing import Type
import asyncio
import time
import traceback
try:
from prometheus_client import Counter
from prometheus_client import Histogram
except ImportError:
Counter = Histogram = None
ERROR_NONE = "none"
ERROR_GENERAL_EXCEPTION = "excepti... | 10 | 3 | 1 | 0 | 14 | 0 |
insights/parsers/podman_list.py | lhuett/insights-core | 121 | 3216861 | """
PodmanList - command ``/usr/bin/podman (images|ps)``
====================================================
Parse the output of command "podman_list_images" and "podman_list_containers",
which have very similar formats.
The header line is parsed and used as the names for the remaining columns.
All fields in both he... | 0 | 0 | 12 | 0 | 12 | 0 |
tools/json_schema_compiler/model.py | Scopetta197/chromium | 212 | 3216881 | <gh_stars>100-1000
# Copyright (c) 2012 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 copy
import os.path
import re
class ParseException(Exception):
"""Thrown when data in the model is invalid.
"""
def __in... | 0 | 0 | 0 | 0 | 0 | 0 |
src/covidify/data_visualization.py | chensteven/covidify | 323 | 3216888 | <gh_stars>100-1000
"""
data_visualization.py - Extract data from date range and create models
Usage:
data_visualization.py [options]
data_visualization.py -h | --help
Options:
-h --help Show this message.
--output_folder=OUT Output folder for the data and reports to be saved.
--countr... | 0 | 0 | 0 | 0 | 0 | 0 |
espresso/data/feat_text_dataset.py | ChunChiehChang/espresso | 920 | 3216926 | # Copyright (c) <NAME>
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import annotations
from io import BytesIO
import logging
import os
import re
from concurrent.futures.thread import ThreadPoolExecutor
from subprocess impo... | 33 | 10 | 0 | 8 | 51 | 0 |
audio_zen/model/module/causal_conv.py | ShkarupaDC/FullSubNet | 219 | 3216929 | <filename>audio_zen/model/module/causal_conv.py
import torch
import torch.nn as nn
from torch.nn.utils import weight_norm
from audio_zen.fvcore.nn import FlopCountAnalysis, flop_count_str
class Chomp1d(nn.Module):
def __init__(self, chomp_size):
super(Chomp1d, self).__init__()
self.chomp_size = c... | 0 | 0 | 0 | 0 | 0 | 0 |
ontobio/io/entityparser.py | vanaukenk/ontobio | 101 | 3216930 | <filename>ontobio/io/entityparser.py
from ontobio.io import assocparser
from ontobio.io import parser_version_regex
from ontobio.model import association
from typing import Dict, List
import logging
import json
logger = logging.getLogger(__name__)
# TODO - use abstract parent for both entity and assoc
class Entit... | 0 | 0 | 0 | 0 | 0 | 0 |
基础教程/A2-神经网络基本原理/第7步 - 深度神经网络/src/ch14-DnnBasic/Level3_ch10.py | microsoft/ai-edu | 11,094 | 3216945 | <reponame>microsoft/ai-edu
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
import numpy as np
from pathlib import Path
import matplotlib.pyplot as plt
import math
from MiniFramework.NeuralNet_4_0 import *
from MiniFra... | 0 | 0 | 0 | 0 | 0 | 0 |
nuplan/database/nuplan_db/ego_pose.py | motional/nuplan-devkit | 128 | 3216962 | from __future__ import annotations # postpone evaluation of annotations
import logging
from typing import Any, Dict, List, Optional, Tuple
import cv2
import numpy as np
import numpy.typing as npt
from pyquaternion import Quaternion
from scipy import ndimage
from scipy.spatial.transform import Rotation as R
from sqla... | 13 | 10 | 25 | 0 | 48 | 0 |
python/texttest_fixture.py | yangyangisyou/GildedRose-Refactoring-Kata | 2,201 | 3216970 | # -*- coding: utf-8 -*-
from __future__ import print_function
from gilded_rose import *
if __name__ == "__main__":
print ("OMGHAI!")
items = [
Item(name="+5 Dexterity Vest", sell_in=10, quality=20),
Item(name="Aged Brie", sell_in=2, quality=0),
Item(name="Elixir of the M... | 0 | 0 | 0 | 0 | 0 | 0 |
src/sage/combinat/root_system/root_lattice_realization_algebras.py | UCD4IDS/sage | 1,742 | 3216977 | r"""
Group algebras of root lattice realizations
"""
# ****************************************************************************
# Copyright (C) 2013 <NAME> <nthiery at users.sf.net>
# <NAME> <anne at math.ucdavis.edu>
# <NAME> <mshimo at vt.edu>
# ... | 7 | 19 | 0 | 0 | 26 | 0 |
codegen_sources/model/src/trainer.py | AlexShypula/CodeGen | 241 | 3216993 | # 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.
#
from __future__ import annotations
import math
import os
import random
import time
from collections import OrderedDict
from conc... | 19 | 21 | 0 | 18 | 58 | 0 |
Lib/idlelib/idle_test/test_squeezer.py | pxeger/cpython | 52,316 | 3217001 | <gh_stars>1000+
"Test squeezer, coverage 95%"
from textwrap import dedent
from tkinter import Text, Tk
import unittest
from unittest.mock import Mock, NonCallableMagicMock, patch, sentinel, ANY
from test.support import requires
from idlelib.config import idleConf
from idlelib.percolator import Percolator
from idlelib... | 0 | 0 | 0 | 0 | 0 | 0 |
third_party/py/gflags/gflags/exceptions.py | sevki/bazel | 218 | 3217007 | #!/usr/bin/env python
# Copyright 2002 Google Inc. All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of c... | 3 | 1 | 0 | 0 | 4 | 0 |
tests/generative/integration/fault_tolerance_main.py | henry54809/faucet | 393 | 3217022 | #!/usr/bin/env python3
"""Mininet tests for FAUCET fault-tolerance results.
* must be run as root
* you can run a specific test case only, by adding the class name of the test
case to the command. Eg ./mininet_main.py FaucetUntaggedIPv4RouteTest
It is strongly recommended to run these tests via Docker, to ensur... | 0 | 1 | 0 | 0 | 1 | 0 |
2020_11_18/dojo_test.py | devppjr/dojo | 114 | 3217027 | import unittest
from dojo import split_shoe, check_shoe
class DojoTest(unittest.TestCase):
def test_split_shoe1(self):
self.assertEqual(split_shoe("40 D"), [40,"D"])
def test_split_shoe2(self):
self.assertEqual(split_shoe("41 E"), [41,"E"])
def test_split_shoe3(self):
self.assertEq... | 0 | 0 | 0 | 0 | 0 | 0 |
example_plugin/example_plugin/__init__.py | XT-Lee/hoomd-blue | 204 | 3217034 | <filename>example_plugin/example_plugin/__init__.py
# Copyright (c) 2009-2021 The Regents of the University of Michigan
# This file is part of the HOOMD-blue project, released under the BSD 3-Clause
# License.
"""Example python module."""
from hoomd.example_plugin import update
| 0 | 0 | 0 | 0 | 0 | 0 |
contrib/pools-management/subports.py | digitalsimboja/kuryr-kubernetes | 155 | 3217067 | # Copyright 2017 Red Hat, 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 writing, ... | 4 | 1 | 0 | 0 | 5 | 0 |
DEEPLEARNING/DL_VOXELNET/parse_log.py | Hqss/DINK | 189 | 3217072 | <filename>DEEPLEARNING/DL_VOXELNET/parse_log.py
# BSD 3-Clause License
#
# Copyright (c) 2019, FPAI
# Copyright (c) 2019, SeriouslyHAO
# Copyright (c) 2019, xcj2019
# Copyright (c) 2019, Leonfirst
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitt... | 0 | 0 | 0 | 0 | 0 | 0 |
res/PyTorchExamples/examples/RNN-bi/__init__.py | chogba6/ONE | 255 | 3217082 | import torch
import torch.nn as nn
_input_size = 3
_seq_len = 2
_batch = 2
_hidden_size = 5
_num_layers = 2
# model
class net_RNN(nn.Module):
def __init__(self):
super().__init__()
self.op = nn.RNN(_input_size, _hidden_size, _num_layers, bidirectional=True)
def forward(self, inputs) -> objec... | 0 | 1 | 0 | 0 | 1 | 0 |
utils/lm_functions.py | rupeshshrestha123/end2end-asr-pytorch | 250 | 3217093 | <reponame>rupeshshrestha123/end2end-asr-pytorch<filename>utils/lm_functions.py
import torch
import os
import math
import torch.nn as nn
from models.lm.transformer_lm import TransformerLM
from utils.optimizer import NoamOpt
from utils import constant
# def save_model(model, epoch, opt, metrics, label2id, id2label, be... | 0 | 0 | 0 | 0 | 0 | 0 |
adv/diffai/__main__.py | eliphatfs/adversarial | 190 | 3217128 | <reponame>eliphatfs/adversarial
import future
import builtins
import past
import six
import copy
from timeit import default_timer as timer
from datetime import datetime
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets
from t... | 0 | 0 | 0 | 0 | 0 | 0 |
desktop_local_tests/windows/windows_dns_force_public_dns_servers_disrupter.py | UAEKondaya1/expressvpn_leak_testing | 219 | 3217145 | <gh_stars>100-1000
from desktop_local_tests.disrupter import Disrupter
from xv_leak_tools.log import L
from xv_leak_tools.manual_input import message_and_await_enter
class WindowsDNSForcePublicDNSServersDisrupter(Disrupter):
def __init__(self, device, parameters):
super().__init__(device, parameters)
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/integration/gcp/conftest.py | suomitekai/fairing | 334 | 3217153 | <reponame>suomitekai/fairing
import pytest
import random
from kubeflow import fairing
import httplib2
from google.cloud import storage
GCS_PROJECT_ID = fairing.cloud.gcp.guess_project_name()
TEST_GCS_BUCKET = '{}-fairing'.format(GCS_PROJECT_ID)
@pytest.fixture
def temp_gcs_prefix():
rnd_prefix = "fairing_test_as... | 0 | 0 | 0 | 0 | 0 | 0 |
external/text/doc/make_perf_table.py | geenen124/iresearch | 12,278 | 3217179 | <filename>external/text/doc/make_perf_table.py
#!/usr/bin/env python
# Copyright (C) 2020 <NAME>
#
# Distributed under the Boost Software License, Version 1.0. (See
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
import argparse
import json
parser = argparse.ArgumentParser(desc... | 0 | 0 | 0 | 0 | 0 | 0 |
grr/server/grr_response_server/gui/api_integration_tests/osquery_test.py | khanhgithead/grr | 4,238 | 3217186 | #!/usr/bin/env python
"""Integration tests for the Osquery flow, its API client and API endpoints."""
import json
from absl import app
from grr_api_client import utils
from grr_response_proto.api import osquery_pb2 as api_osquery_pb2
from grr_response_server.flows.general import osquery as osquery_flow
from grr_respo... | 1 | 1 | 0 | 0 | 2 | 0 |
ck_wzyd.py | 58565856/checkinpanel | 752 | 3217188 | # -*- coding: utf-8 -*-
"""
cron: 00 8 * * *
new Env('王者营地');
"""
from urllib import parse
import requests
from notify_mtr import send
from utils import get_data
class WZYD:
def __init__(self, check_items):
self.check_items = check_items
@staticmethod
def sign(data) -> object:
response... | 0 | 2 | 0 | 0 | 2 | 0 |
torchvision/datasets/caltech.py | yoshitomo-matsubara/vision | 12,063 | 3217195 | import os
import os.path
from typing import Any, Callable, List, Optional, Union, Tuple
from PIL import Image
from .utils import download_and_extract_archive, verify_str_arg
from .vision import VisionDataset
class Caltech101(VisionDataset):
"""`Caltech 101 <http://www.vision.caltech.edu/Image_Datasets/Caltech10... | 11 | 11 | 1 | 5 | 28 | 0 |
tools/mo/openvino/tools/mo/utils/error.py | ryanloney/openvino-1 | 1,127 | 3217209 | # Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import re
class BasicError(Exception):
""" Base class for all exceptions in Model Optimizer
It operates like Exception but when it is converted to str,
it formats string as args[0... | 0 | 2 | 0 | 0 | 2 | 0 |
app/grandchallenge/algorithms/migrations/0006_algorithm_use_flexible_inputs.py | nlessmann/grand-challenge.org | 101 | 3217240 | <filename>app/grandchallenge/algorithms/migrations/0006_algorithm_use_flexible_inputs.py
# Generated by Django 3.1.6 on 2021-03-18 14:00
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("algorithms", "0005_algorithm_average_duration"),
]
operatio... | 0 | 0 | 0 | 0 | 0 | 0 |
Lib/mainthread.py | snazari/Pyto | 701 | 3217267 | <filename>Lib/mainthread.py
"""
Access the main thread
This module allows you to run code on the main thread easely. This can be used for modifiying the UI.
Example:
.. highlight:: python
.. code-block:: python
from UIKit import UIScreen
import mainthread
def set_brightness():
inverted = int(no... | 0 | 0 | 0 | 0 | 0 | 0 |
myia/operations/prim_scalar_mul.py | strint/myia | 222 | 3217271 | """Definitions for the primitive `scalar_mul`."""
from ..lib import (
UniformPrimitiveInferrer,
assert_scalar,
bprop_to_grad_transform,
)
from ..xtype import Number
from . import primitives as P
def pyimpl_scalar_mul(x: Number, y: Number) -> Number:
"""Implement `scalar_mul`."""
assert_scalar(x, ... | 2 | 2 | 0 | 0 | 4 | 0 |
spotpy/examples/tutorial_rosenbrock.py | cheginit/spotpy | 182 | 3217289 | # -*- coding: utf-8 -*-
'''
Copyright (c) 2018 by <NAME>
This file is part of Statistical Parameter Optimization Tool for Python(SPOTPY).
:author: <NAME>
This file holds the example code from the Rosenbrock tutorial web-documention.
'''
from __future__ import absolute_import
from __future__ import division
from __fut... | 0 | 0 | 0 | 0 | 0 | 0 |
Lib/fontTools/cffLib/__init__.py | bhumikapaharia/fonttools | 38,667 | 3217296 | from __future__ import annotations
"""cffLib: read/write Adobe CFF fonts
OpenType fonts with PostScript outlines contain a completely independent
font file, Adobe's *Compact Font Format*. So dealing with OpenType fonts
requires also dealing with CFF. This module allows you to read and write
fonts written in the CFF fo... | 49 | 132 | 4 | 11 | 196 | 0 |
coremltools/converters/mil/mil/passes/apply_common_pass_pipeline.py | tonybove-apple/coremltools | 2,740 | 3217324 | <gh_stars>1000+
# Copyright (c) 2020, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
from coremltools.converters.mil.mil.passes.quantization_passes import AbstractQuantiz... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/exampleDoc.py | yaqwsx/KiK | 784 | 3217342 | <gh_stars>100-1000
#!/usr/bin/env python3
"""
Generate documentation in markdown format for examples
"""
import sys
from kikit.doc import runBoardExample, runBoardExampleJoin
from pcbnewTransition import pcbnew
counter = 0
def autoName():
global counter
counter += 1
return f"examplePanel{counter}"
SRC ... | 0 | 0 | 0 | 0 | 0 | 0 |
buildchain/buildchain/vagrant.py | SaintLoong/metalk8s | 255 | 3217377 | <filename>buildchain/buildchain/vagrant.py<gh_stars>100-1000
# coding: utf-8
"""Tasks to manage vagrant.
This module provides a task that spawns an environment, using
Vagrant, with the ISO content mounted, and a task generation a
SSH key pair to be used during control plane expansion in this
environment.
"""
impor... | 0 | 0 | 0 | 0 | 0 | 0 |
Tests/RunCMake/FileAPI/MixedStateless-check.py | eWert-Online/esy-cmake | 107 | 3217381 | <gh_stars>100-1000
from check_index import *
def check_reply(r):
assert is_dict(r)
assert sorted(r.keys()) == ["__test-v1", "__test-v3", "client-foo", "query.json"]
check_index__test(r["__test-v1"], 1, 3)
check_error(r["__test-v3"], "unknown query file")
check_reply_client_foo(r["client-foo"])
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/clusterfuzz/_internal/tests/appengine/handlers/cron/load_bigquery_stats_test.py | mspectorgoogle/clusterfuzz | 5,023 | 3217397 | # Copyright 2019 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 | 0 |
venv/lib/python3.7/site-packages/xmind/__about__.py | taoyu0429/xmid2excel | 347 | 3217402 | <filename>venv/lib/python3.7/site-packages/xmind/__about__.py<gh_stars>100-1000
__title__ = 'XMind'
__description__ = 'XMind是基于Python实现,提供了对XMind思维导图进行创建、解析、更新的一站式解决方案!'
__keywords__ = 'xmind, mind mapping, 思维导图, XMind思维导图',
__url__ = 'https://github.com/zhuifengshen/xmind'
__author__ = 'Devin'
__author_email__ = '<EMA... | 0 | 0 | 0 | 0 | 0 | 0 |
OneStage/yolo/w_name2txt.py | linh22/Object-Detection-and-Tracking | 1,543 | 3217411 | <reponame>linh22/Object-Detection-and-Tracking
import os
names = os.listdir('/home/cai/Desktop/object_detection/datasets/coco/result/images/') #图片路径
i=0
train_val = open('/home/cai/Desktop/yolo_dataset/data/train.txt','w') #txt文件路径
for name in names:
index = name.rfind('.')
name = name[:index]
train_val.w... | 0 | 0 | 0 | 0 | 0 | 0 |
Lib/test/test_spwd.py | gerph/cpython | 2,441 | 3217460 | <filename>Lib/test/test_spwd.py
import os
import unittest
from test import support
spwd = support.import_module('spwd')
@unittest.skipUnless(hasattr(os, 'geteuid') and os.geteuid() == 0,
'root privileges required')
class TestSpwdRoot(unittest.TestCase):
def test_getspall(self):
entr... | 0 | 0 | 0 | 0 | 0 | 0 |
ansys/mapdl/core/_commands/solution/miscellaneous_loads.py | RGPATCHI/pymapdl | 194 | 3217461 | <filename>ansys/mapdl/core/_commands/solution/miscellaneous_loads.py
class MiscellaneousLoads:
def anpres(self, nfram="", delay="", ncycl="", refframe="", **kwargs):
"""Produces an animated sequence of the time-harmonic pressure variation
APDL Command: ANPRES
of an engine-order excitation i... | 0 | 0 | 0 | 0 | 0 | 0 |
Chapter20/05_cheetah_ga_batch.py | holestine/Deep-Reinforcement-Learning-Hands-On-Second-Edition | 621 | 3217466 | #!/usr/bin/env python3
import sys
import gym
import pybullet_envs
import argparse
import itertools
import collections
import copy
import time
import numpy as np
import torch
import torch.nn as nn
import torch.multiprocessing as mp
from tensorboardX import SummaryWriter
NOISE_STD = 0.005
POPULATION_SIZE = 2000
PAREN... | 5 | 6 | 0 | 0 | 11 | 0 |
conf/locators_conf.py | RajkumarQxf2/qxf2-page-object-model | 207 | 3217485 | <gh_stars>100-1000
#Common locator file for all locators
#Locators are ordered alphabetically
############################################
#Selectors we can use
#ID
#NAME
#css selector
#CLASS_NAME
#LINK_TEXT
#PARTIAL_LINK_TEXT
#XPATH
###########################################
#Locators for the footer object(footer_o... | 0 | 0 | 0 | 0 | 0 | 0 |
pygears/lib/fmaps/union.py | bogdanvuk/pygears | 120 | 3217494 | <reponame>bogdanvuk/pygears
from pygears import alternative, TypeMatchError, gear
from pygears.typing import Union
from pygears.lib import fmap as common_fmap
from pygears.lib.mux import mux
from pygears.lib.demux import demux_ctrl
from pygears.lib.ccat import ccat
from pygears.lib.shred import shred
def unionmap_che... | 0 | 0 | 0 | 0 | 0 | 0 |
dataviva/utils/cached_query.py | joelvisroman/dataviva-site | 126 | 3217507 | from __future__ import annotations
from flask import abort, current_app, make_response, Flask, jsonify, request, \
Response, session, g, get_flashed_messages
from dataviva import view_cache
''' Get/Sets a given ID in the cache. If data is not supplied,
used as getter'''
def cached_query(id, d... | 2 | 4 | 0 | 0 | 6 | 0 |
contrib/python/win_unicode_console/win_unicode_console/readline_hook.py | jochenater/catboost | 6,989 | 3217512 |
from __future__ import annotations
from __future__ import print_function # PY2
import sys
import traceback
import warnings
import ctypes.util
from ctypes import (pythonapi, cdll, cast,
c_char_p, c_void_p, c_size_t, CFUNCTYPE)
from .info import WINDOWS
try:
import pyreadline
except ImportError:
p... | 2 | 5 | 0 | 1 | 8 | 0 |
tests/test_trendet_errors.py | jokaorgua/trendet | 272 | 3217520 | <gh_stars>100-1000
# Copyright 2019-2020 <NAME>
# See LICENSE for details.
import pytest
from investpy import get_stock_historical_data
import trendet
def test_errors():
"""
This function raises trendet errors to improve coverage
"""
params = [
{
'stock': ['error'],
... | 0 | 0 | 0 | 0 | 0 | 0 |
demo/example/foo/forms.py | afahounko/django-plans | 240 | 3217526 | from django.forms import ModelForm, HiddenInput
from .models import Foo
from .validators import max_foos_validator
class FooForm(ModelForm):
class Meta:
model = Foo
fields: str = '__all__'
widgets: dict[str,object] = {
'user': HiddenInput,
}
def clean(self) -> obj... | 0 | 1 | 2 | 0 | 3 | 0 |
flex/constants.py | maroux/flex | 160 | 3217555 | <gh_stars>100-1000
from __future__ import unicode_literals
import numbers
import six
from flex._compat import Sequence, Mapping
SCHEMES = (
'http', 'https', 'ws', 'wss',
)
MIMETYPES = (
'application/json',
)
NULL = 'null'
BOOLEAN = 'boolean'
INTEGER = 'integer'
NUMBER = 'number'
STRING = 'string'
ARRAY ... | 0 | 0 | 0 | 0 | 0 | 0 |
sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/models/_models_py3.py | rsdoherty/azure-sdk-for-python | 2,728 | 3217558 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | 205 | 0 | 79 | 0 | 284 | 0 |
crawl-ref/source/webserver/webtiles/connection.py | OctopodesWeekly/crawl | 1,921 | 3217572 | <gh_stars>1000+
import fcntl
import os
import os.path
import socket
import tempfile
import time
import warnings
from datetime import datetime
from datetime import timedelta
from tornado.escape import json_encode
from tornado.escape import to_unicode
from tornado.escape import utf8
from tornado.ioloop import IOLoop
fr... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/file_io/xfs_file_io.py | dfjxs/dfvfs | 176 | 3217598 | <filename>tests/file_io/xfs_file_io.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for the X File System (XFS) file-like object."""
import os
import unittest
from dfvfs.file_io import xfs_file_io
from dfvfs.lib import definitions
from dfvfs.lib import errors
from dfvfs.path import factory as path_spec_fact... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_race_conditions.py | o3cloud/dash-renderer | 109 | 3217607 | <reponame>o3cloud/dash-renderer<gh_stars>100-1000
import itertools
import time
import flask
from dash import Dash
from dash.dependencies import Input, Output
import dash_html_components as html
import dash_core_components as dcc
from .IntegrationTests import IntegrationTests
from .utils import wait_for
class Tests(... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/cupyx_tests/fallback_mode_tests/test_fallback.py | Onkar627/cupy | 6,180 | 3217610 | <filename>tests/cupyx_tests/fallback_mode_tests/test_fallback.py<gh_stars>1000+
import functools
import operator
import unittest
import numpy
import pytest
import cupy
from cupy import testing
from cupyx import fallback_mode
from cupyx.fallback_mode import fallback
from cupyx.fallback_mode.notification import Fallbac... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/administrative.py | bbhunter/celerystalk | 373 | 3217613 | from __future__ import annotations
import tarfile
import lib.db
import os
import time
def backup_all_workspaces(backup_file: object | None=None) -> dict[str,object | str]:
cs_path = lib.db.get_current_install_path()[0][0]
timestr = time.strftime("%Y%m%d-%H%M%S")
backup_file = os.path.join(cs_path,"cs_backu... | 1 | 1 | 0 | 0 | 2 | 0 |
smtp_enum.py | HiMiC/scripts-averagesecurityguy | 877 | 3217630 | <reponame>HiMiC/scripts-averagesecurityguy<filename>smtp_enum.py<gh_stars>100-1000
#!/usr/bin/env python3
# Copyright (c) 2015, LCI Technology Group, LLC
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are... | 0 | 0 | 0 | 0 | 0 | 0 |
mythril/laser/ethereum/transaction/concolic.py | kalloc/mythril | 1,887 | 3217632 | <reponame>kalloc/mythril<gh_stars>1000+
"""This module contains functions to set up and execute concolic message
calls."""
from typing import List, Union
from mythril.disassembler.disassembly import Disassembly
from mythril.laser.ethereum.cfg import Node, Edge, JumpType
from mythril.laser.ethereum.state.calldata impor... | 0 | 0 | 0 | 0 | 0 | 0 |
alembic/versions/54672c4d904_increase_size_of_xref_column.py | bigblue/pynab | 161 | 3217640 | <gh_stars>100-1000
"""Increase size of xref column
Revision ID: 54672c4d904
Revises: 3ee16503d82
Create Date: 2015-03-03 20:59:38.872362
"""
# revision identifiers, used by Alembic.
revision = '54672c4d904'
down_revision = '3ee16503d82'
from alembic import op
import sqlalchemy as sa
def upgrade():
### command... | 0 | 0 | 0 | 0 | 0 | 0 |
bin/pdb2pqr-1.6/src/forcefield.py | cristhiand3/BioBlender | 130 | 3217646 | """
Forcefield.py
This module takes a pdblist as input and replaces the occupancy and
tempfactor fields with charge and radius fields, with values as defined
by a particular forcefield. The forcefield structure is modeled off of
the structures.py file, where each forcefield is considered a chain o... | 0 | 0 | 0 | 0 | 0 | 0 |
loss_util.py | ubc-vision/canonical-capsules | 154 | 3217650 | <filename>loss_util.py
import torch
from tqdm import tqdm
import torch.nn as nn
import torch.nn.functional as F
def evaluate_pose(x, att):
# x: B3N, att: B1KN1
# ts: B3k1
pai = att.sum(dim=3, keepdim=True) # B1K11
att = att / torch.clamp(pai, min=1e-3)
ts = torch.sum(
att * x... | 0 | 0 | 0 | 0 | 0 | 0 |
dlflow/models/internal/DNNBinaryClassifier.py | 12860/dlflow | 156 | 3217655 | from dlflow.mgr import model, config
from dlflow.models import ModelBase
import tensorflow as tf
class _Embedding(tf.keras.layers.Layer):
def __init__(self, input_dim, output_dim):
super(_Embedding, self).__init__()
self.input_dim = input_dim
self.output_dim = output_dim
def build(se... | 0 | 2 | 0 | 1 | 3 | 0 |
train_segmentation.py | JamesWang007/Open3D-PointNet | 120 | 3217664 | <reponame>JamesWang007/Open3D-PointNet
from __future__ import print_function
import argparse
import os
import random
import numpy as np
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim as optim
import torch.utils.data
import torchvision.datasets as dset
import torchvision.transforms as tra... | 0 | 0 | 0 | 0 | 0 | 0 |
kolibri/core/exams/test/test_models.py | MBKayro/kolibri | 545 | 3217691 | <reponame>MBKayro/kolibri
from django.test import TestCase
from kolibri.core.auth.models import Facility
from kolibri.core.auth.models import FacilityUser
from kolibri.core.auth.test.helpers import provision_device
from kolibri.core.exams.models import Exam
class ExamTestCase(TestCase):
def setUp(self):
... | 0 | 0 | 0 | 0 | 0 | 0 |
chrome/test/functional/media/media_basic_playback.py | Scopetta197/chromium | 212 | 3217725 | <reponame>Scopetta197/chromium<filename>chrome/test/functional/media/media_basic_playback.py<gh_stars>100-1000
#!/usr/bin/env python
# Copyright (c) 2012 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.
"""Basic playback te... | 0 | 0 | 0 | 0 | 0 | 0 |
hubspot/crm/schemas/models/model_property.py | Ronfer/hubspot-api-python | 117 | 3217727 | # coding: utf-8
from __future__ import annotations
"""
Schemas
The CRM uses schemas to define how custom objects should store and represent information in the HubSpot CRM. Schemas define details about an object's type, properties, and associations. The schema can be uniquely identified by its **object type ID... | 24 | 28 | 2 | 24 | 78 | 0 |
platform/coredb/coredb/query_managers/project.py | admariner/polyaxon | 3,200 | 3217732 | #!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, 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 ... | 0 | 0 | 6 | 0 | 6 | 0 |
janitor/functions/encode_categorical.py | farhanreynaldo/pyjanitor | 674 | 3217733 | from typing import Hashable, Iterable, Union
import pandas_flavor as pf
import pandas as pd
from pandas.api.types import is_list_like
import warnings
from janitor.utils import check, check_column, deprecated_alias
from enum import Enum
@pf.register_dataframe_method
@deprecated_alias(columns="column_names")
def encode... | 4 | 3 | 2 | 0 | 9 | 0 |
PR_BCI_team/Team_StarLab/DKHan/examples/bcic_dg/bcic_iv_2a_moabb_cropped_DG.py | PatternRecognition/OpenBMI | 217 | 3217742 | <gh_stars>100-1000
"""
Cropped Decoding on BCIC IV 2a Dataset
======================================
"""
######################################################################
# Building on the `Trialwise decoding
# tutorial <./plot_bcic_iv_2a_moabb_trial.html>`__, we now do more
# data-efficient cropped decoding!
#... | 0 | 0 | 0 | 0 | 0 | 0 |
symengine/tests/test_series_expansion.py | Midnighter/symengine.py | 133 | 3217759 | <reponame>Midnighter/symengine.py
from symengine.utilities import raises
from symengine.lib.symengine_wrapper import (series, have_piranha, have_flint,
Symbol, Integer, sin, cos, exp, sqrt, E)
def test_series_expansion():
x = Symbol('x')
ex = series(sin(1+x), x, n=10)
assert ex.coeff(x, 7) == -cos(1)/... | 0 | 0 | 0 | 0 | 0 | 0 |
preprocessors/image_transformations.py | slowy07/tensor2robot | 456 | 3217763 | # coding=utf-8
# Copyright 2021 The Tensor2Robot 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 ... | 32 | 12 | 0 | 0 | 44 | 0 |
authx/backend/api/crud.py | yezz123/authx | 141 | 3217777 | import re
from datetime import datetime
from typing import Optional, Tuple
from email_validator import EmailNotValidError, validate_email
from authx.backend.base import Base
class UsersCRUDMixin(Base):
"""User CRUD MIXIN"""
async def get(self, id: int) -> Optional[dict]:
"""
Get a user by i... | 15 | 10 | 0 | 0 | 25 | 0 |
presidio-image-redactor/presidio_image_redactor/__init__.py | vtols/presidio | 1,408 | 3217783 | """Image Redactor root module."""
import logging
from .ocr import OCR
from .tesseract_ocr import TesseractOCR
from .image_analyzer_engine import ImageAnalyzerEngine
from .image_redactor_engine import ImageRedactorEngine
from .image_pii_verify_engine import ImagePiiVerifyEngine
# Set up default logging (with NullHandl... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/imagenet/nin.py | zaltoprofen/chainer | 3,705 | 3217788 | import chainer
import chainer.functions as F
import chainer.initializers as I
import chainer.links as L
class NIN(chainer.Chain):
"""Network-in-Network example model."""
insize: int = 227
def __init__(self):
super(NIN, self).__init__()
conv_init = I.HeNormal() # MSRA scaling
w... | 0 | 1 | 1 | 0 | 2 | 0 |
webapi/api/view.py | gonzalorodrigo/SoPaper | 158 | 3217797 | #!/usr/bin/env python2
# -*- coding: UTF-8 -*-
# File: view.py
# Date: Mon May 26 17:10:14 2014 +0000
# Author: <NAME> <<EMAIL>>
from . import app, redirect, url_for, make_response, request, api_method
from flask import render_template
@app.route('/')
def home() -> object:
return render_template('index.html')
@... | 0 | 4 | 0 | 0 | 4 | 0 |
context_menu/tests/test_menus.py | saleguas/context_menu | 301 | 3217818 | <reponame>saleguas/context_menu
import os
import sys
from context_menu import menus
def get_last_path_item(path):
return os.path.basename(os.path.normpath(path))
def test_method_info():
def example_func():
pass
cc = menus.ContextCommand('Test Command', python=example_func)
func_name, func... | 0 | 0 | 0 | 0 | 0 | 0 |
parametric_tSNE/__init__.py | pangyuteng/parametric_tsne | 154 | 3217872 | <filename>parametric_tSNE/__init__.py
#!/usr/bin/python
#__all__ = ["core"]
from .core import Parametric_tSNE
| 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.