max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 7 115 | max_stars_count int64 101 368k | id stringlengths 2 8 | content stringlengths 6 1.03M |
|---|---|---|---|---|
netbox/extras/api/nested_serializers.py | TheFlyingCorpse/netbox | 4,994 | 11071626 | <reponame>TheFlyingCorpse/netbox<filename>netbox/extras/api/nested_serializers.py<gh_stars>1000+
from rest_framework import serializers
from extras import choices, models
from netbox.api import ChoiceField, WritableNestedSerializer
from netbox.api.serializers import NestedTagSerializer
from users.api.nested_serializer... |
AppPkg/Applications/Python/Python-2.7.2/Lib/test/test_codecmaps_cn.py | CEOALT1/RefindPlusUDK | 2,757 | 11071636 | #!/usr/bin/env python
#
# test_codecmaps_cn.py
# Codec mapping tests for PRC encodings
#
from test import test_support
from test import test_multibytecodec_support
import unittest
class TestGB2312Map(test_multibytecodec_support.TestBase_Mapping,
unittest.TestCase):
encoding = 'gb2... |
orator/dbal/column_diff.py | wjzero/orator | 1,484 | 11071637 | # -*- coding: utf-8 -*-
from .identifier import Identifier
class ColumnDiff(object):
def __init__(
self, old_column_name, column, changed_properties=None, from_column=None
):
self.old_column_name = old_column_name
self.column = column
self.changed_properties = changed_properti... |
lldb/packages/Python/lldbsuite/test/lldbplatformutil.py | uber-common/llvm-project | 456 | 11071641 | """ This module contains functions used by the test cases to hide the
architecture and/or the platform dependent nature of the tests. """
from __future__ import absolute_import
# System modules
import itertools
import re
import subprocess
import sys
import os
# Third-party modules
import six
from six.moves.urllib im... |
tests/testrun.py | yeti-threatintel/yeti | 1,250 | 11071677 | import sys
from os import path
from datetime import timedelta
from mongoengine import connect
YETI_ROOT = path.normpath(path.dirname(path.dirname(path.abspath(__file__))))
sys.path.append(YETI_ROOT)
from core.config.config import yeti_config
from core.entities.malware import MalwareFamily, Malware
from core.indicato... |
p2p/cancellable.py | jin10086/py-evm | 137 | 11071681 | <gh_stars>100-1000
from typing import (
Awaitable,
TypeVar,
)
from cancel_token import CancelToken
class CancellableMixin:
cancel_token: CancelToken = None
_TReturn = TypeVar('_TReturn')
async def wait(self,
awaitable: Awaitable[_TReturn],
token: CancelToke... |
testing/utils/client.py | FerrySchuller/remme-core | 129 | 11071686 | <filename>testing/utils/client.py
"""
Provide utils clients use to send transaction.
It is vendor code from client library written in Python.
Core also has the same utilities, but it will be easier to substitute these function with
client library function (when it will be uploaded to PyPi), than particularly use core... |
auctioning_platform/auctions_infrastructure/auctions_infrastructure/queries/__init__.py | nhdinh/smp-modulith | 299 | 11071688 | <reponame>nhdinh/smp-modulith<filename>auctioning_platform/auctions_infrastructure/auctions_infrastructure/queries/__init__.py
__all__ = ["SqlGetActiveAuctions", "SqlGetSingleAuction"]
from auctions_infrastructure.queries.auctions import SqlGetActiveAuctions, SqlGetSingleAuction
|
skompiler/toskast/sklearn/ensemble/forest.py | odinsemvosem/SKompiler | 112 | 11071689 | <filename>skompiler/toskast/sklearn/ensemble/forest.py
"""
Decision trees to SKAST
"""
from skompiler.dsl import sum_
from ..common import classifier
from ..tree.base import decision_tree
def random_forest_classifier(model, inputs, method="predict_proba"):
"""
Creates a SKAST expression corresponding to a giv... |
tests/artificial/gen_makefile.py | jmabry/pyaf | 377 | 11071699 | import os
import glob
def mkdir_p(path):
try:
os.makedirs(path)
except:
pass
subdirs = glob.glob("tests/artificial/transf_*");
print("PYTHON=python3\n\n");
lAllTarget = "";
for subdir1 in sorted(subdirs):
lBase = os.path.basename(subdir1);
test_target = "";
for filename in so... |
glance/db/sqlalchemy/alembic_migrations/versions/ocata_expand01_add_visibility.py | Steap/glance | 309 | 11071742 | # 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, software
# d... |
odps/udf/tests/test_usercounter.py | Emersonxuelinux/aliyun-odps-python-sdk | 412 | 11071754 | <reponame>Emersonxuelinux/aliyun-odps-python-sdk
# Copyright 1999-2017 Alibaba Group Holding Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LIC... |
experimental/lo/conv2d.py | kshithijiyer/qkeras | 388 | 11071762 | # Copyright 2020 Google LLC
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... |
basex-api/src/main/python/QueryBindExample.py | mrdziuban/basex | 441 | 11071777 | <reponame>mrdziuban/basex<gh_stars>100-1000
# -*- coding: utf-8 -*-
# This example shows how external variables can be bound to XQuery expressions.
#
# Documentation: https://docs.basex.org/wiki/Clients
#
# (C) BaseX Team 2005-21, BSD License
from BaseXClient import BaseXClient
# create session
session = BaseXClient.... |
pgoapi/auth_ptc.py | xDyN/api1311 | 2,557 | 11071791 | <reponame>xDyN/api1311<filename>pgoapi/auth_ptc.py<gh_stars>1000+
"""
pgoapi - Pokemon Go API
Copyright (c) 2016 tjado <https://github.com/tejado>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software w... |
torch/onnx/symbolic_opset12.py | Hacky-DH/pytorch | 60,067 | 11071794 | import torch
import torch.onnx.symbolic_helper as sym_help
from torch.onnx.symbolic_helper import parse_args, _parse_arg, _unimplemented
from torch.onnx.utils import _add_block, _add_input_to_block, _add_output_to_block
from sys import maxsize
from torch.onnx.symbolic_opset9 import permute, _reshape_from_tensor
import ... |
amazon_paapi/sdk/models/item.py | frenners/python-amazon-paapi | 121 | 11071809 | # coding: utf-8
"""
Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License").
You may not use this file except in compliance with the License.
A copy of the License is located at
http://www.apache.org/licenses/LICENSE-2.0
... |
env/Lib/site-packages/OpenGL/GLES2/OES/texture_cube_map_array.py | 5gconnectedbike/Navio2 | 210 | 11071822 | '''OpenGL extension OES.texture_cube_map_array
This module customises the behaviour of the
OpenGL.raw.GLES2.OES.texture_cube_map_array to provide a more
Python-friendly API
Overview (from the spec)
OpenGL ES 3.1 supports two-dimensional array textures. An array texture
is an ordered set of images with the same ... |
backend/test/integration/test_comment.py | restato/bunnybook | 131 | 11071825 | <filename>backend/test/integration/test_comment.py
import pytest
@pytest.mark.asyncio
async def test_create_comment(ben):
content = "Test"
post_id = (await ben.conn.post("/posts", json={"content": content})) \
.json()["id"]
new_comment_request = await ben.conn.post(f"/posts/{post_id}/comments",
... |
mach_nix/generators/__init__.py | fiksn/mach-nix | 490 | 11071826 | <reponame>fiksn/mach-nix
from abc import ABC, abstractmethod
from typing import List
from mach_nix.requirements import Requirement
from mach_nix.resolver import Resolver
class ExpressionGenerator(ABC):
def __init__(self, resolver: Resolver):
self.resolver = resolver
@abstractmethod
def generate... |
insights/parsers/tests/test_postconf.py | haithcockce/insights-core | 121 | 11071836 | <filename>insights/parsers/tests/test_postconf.py
import pytest
import doctest
from insights.core import ContentException
from insights.parsers import postconf, SkipException
from insights.parsers.postconf import PostconfBuiltin, Postconf, _Postconf
from insights.tests import context_wrap
V_OUT1 = """
""".strip()
V_... |
homeassistant/components/wiffi/__init__.py | andersop91/core | 22,481 | 11071845 | """Component for wiffi support."""
from datetime import timedelta
import errno
import logging
from wiffi import WiffiTcpServer
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_PORT, CONF_TIMEOUT, Platform
from homeassistant.core import HomeAssistant, callback
from homeassistan... |
xsssniper/core/scanner.py | Marzooq13579/Hack-Gadgets | 370 | 11071863 | <gh_stars>100-1000
#!/usr/bin/env python
try:
from mechanize import Request, urlopen, URLError, HTTPError,ProxyHandler, build_opener, install_opener, Browser
except ImportError:
print "\n[X] Please install mechanize module:"
print " http://wwwsearch.sourceforge.net/mechanize/\n"
exit()
import rand... |
django_grpc/serializers/__init__.py | nielsvaneck/django-grpc | 164 | 11071869 | <filename>django_grpc/serializers/__init__.py
from .base import BaseModelSerializer, message_to_python
def serialize_model(message_class, instance, serializers):
"""
Shortcut
"""
return BaseModelSerializer.serialize_model(message_class, instance, serializers)
def deserialize_message(message) -> dict... |
qmpy/analysis/database.py | tachyontraveler/qmpy | 103 | 11071878 | import qmpy
import qmpy.data as data
import logging
logger = logging.getLogger(__name__)
def apply_filter(words, keyword):
"""
Assign a keyword to all entries whose references contain any of the given
list of words.
Examples:
>>> apply_filter(["pressure", "mpa", "gpa", "kbar"], "high pressure")... |
benchmark/torch/AlphaZero/Coach.py | lp2333/PARL | 3,172 | 11071884 | <reponame>lp2333/PARL
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# ... |
pororo/tasks/morph_inflection.py | jayten42/pororo | 1,137 | 11071885 | """Morphological Inflection related modeling class"""
import pickle
from typing import Optional
from pororo.tasks.utils.base import PororoFactoryBase, PororoSimpleBase
from pororo.tasks.utils.download_utils import download_or_load
class PororoInflectionFactory(PororoFactoryBase):
"""
Conduct Morphological i... |
Crypto Git Repository/print_repo_log.py | DazEB2/SimplePyScripts | 117 | 11071894 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
if __name__ == '__main__':
import api
api.print_log(reverse=True)
|
src/test/python/test_preinits.py | seletz/jep | 210 | 11071913 | import unittest
import sys
from jep_pipe import jep_pipe
from jep_pipe import build_java_process_cmd
def containsBug46006():
# cpython 3.10.0 and 3.10.1 are affected by https://bugs.python.org/issue46006.
# Since this bug should not occur in most environments we do not want to stop
# jep from building by ... |
tests/test_dcc.py | gtmanfred/irc3 | 178 | 11071914 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
from irc3.testing import BotTestCase
from irc3.compat import asyncio
from irc3.dcc.client import DCCSend
from irc3.dcc.optim import DCCSend as DCCSendOptim
from irc3.plugins.dcc import dcc_command
from irc3 import dcc_event
from irc3 import utils
import tempfile
import pytest
... |
models/official/detection/utils/shape_utils.py | GerinTang/tpu | 5,098 | 11071923 | # Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
prepare_distill_dataset.py | CaimdotAIAccount/youtube8mchallenge | 144 | 11071965 | # Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... |
payment_lib_examples/alipay-sdk-python/virtual_environment/lib/python3.4/site-packages/alipay/aop/api/domain/OpenApiRefundFundDetailPojo.py | cuhk-mobitec/S3KVetter | 213 | 11071983 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class OpenApiRefundFundDetailPojo(object):
def __init__(self):
self._funds = None
self._trans_in = None
self._trans_in_type = None
self._type = None
@property
d... |
sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/models/_models_py3.py | rsdoherty/azure-sdk-for-python | 2,728 | 11072009 | <reponame>rsdoherty/azure-sdk-for-python
# 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... |
tools/cygprofile/patch_orderfile.py | google-ar/chromium | 777 | 11072028 | <gh_stars>100-1000
#!/usr/bin/python
# Copyright 2013 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.
"""Patch an orderfile.
Starting with a list of symbols in a binary and an orderfile (ordered list of
sections), matches... |
ioflo/base/completing.py | BradyHammond/ioflo | 128 | 11072029 | <reponame>BradyHammond/ioflo
"""completing.py done action module
"""
#print("module {0}".format(__name__))
import time
import struct
from collections import deque
import inspect
from ..aid.sixing import *
from ..aid import odict, oset
from ..aid import aiding
from . import excepting
from . import registering
from ... |
src/greplin/scales/meter.py | frenzymadness/scales | 273 | 11072044 | # Copyright 2011 The scales 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 agreed to in w... |
src/backend/common/models/webcast.py | ofekashery/the-blue-alliance | 266 | 11072052 | <gh_stars>100-1000
from typing import TypedDict
from backend.common.consts.webcast_type import WebcastType
class _WebcastRequired(TypedDict, total=True):
type: WebcastType
channel: str
class _WebcastOptional(TypedDict, total=False):
file: str
date: str
class Webcast(_WebcastRequired, _WebcastOpti... |
flow/scenarios/bottleneck.py | SHITIANYU-hue/flow | 805 | 11072057 | """Pending deprecation file.
To view the actual content, go to: flow/networks/bottleneck.py
"""
from flow.utils.flow_warnings import deprecated
from flow.networks.bottleneck import BottleneckNetwork
from flow.networks.bottleneck import ADDITIONAL_NET_PARAMS # noqa: F401
@deprecated('flow.scenarios.bottleneck',
... |
pygmt/tests/test_grdcontour.py | weiji14/gmt-python | 168 | 11072089 | <reponame>weiji14/gmt-python
"""
Test Figure.grdcontour.
"""
import os
import numpy as np
import pytest
from pygmt import Figure
from pygmt.exceptions import GMTInvalidInput
from pygmt.helpers.testing import load_static_earth_relief
TEST_DATA_DIR = os.path.join(os.path.dirname(__file__), "data")
TEST_CONTOUR_FILE = o... |
hubspot3/tickets.py | benaduggan/hubspot3 | 137 | 11072099 | """
hubspot tickets api
"""
from hubspot3.base import BaseClient
from hubspot3.utils import get_log
from typing import Dict, List
TICKETS_API_VERSION = "1"
class TicketsClient(BaseClient):
"""
hubspot3 Tickets client
:see: https://developers.hubspot.com/docs/methods/tickets/tickets-overview
"""
... |
typed_python/lib/sorted_dict.py | APrioriInvestments/typed_python | 105 | 11072102 | from typed_python import (
TypeFunction, Class, Member, Final, Entrypoint, OneOf, Generator, Tuple,
Forward, ListOf
)
def less(x, y):
return x < y
@TypeFunction
def SortedDict(K, V, comparator=less):
Node = Forward("Node")
@Node.define
class Node(Class, Final):
key = Member(K)
... |
tests/numpy/sum.py | Fryguy/py2rb | 124 | 11072122 | # coding: utf-8
import numpy as np
x = np.array([1, 5])
w = np.array([2, 9])
b = 5
z = np.sum(w*x) + b
print(z)
z = (w * 3).sum()
print(z)
|
strawberry/printer.py | ddirkson/strawberry | 2,062 | 11072135 | from itertools import chain
from typing import Optional, cast
from graphql.type import is_object_type, is_specified_directive
from graphql.utilities.print_schema import (
is_defined_type,
print_args,
print_block,
print_deprecated,
print_description,
print_directive,
print_implemented_interf... |
tests/test_as_channel_first.py | dylanbuchi/MONAI | 2,971 | 11072148 | <reponame>dylanbuchi/MONAI<filename>tests/test_as_channel_first.py<gh_stars>1000+
# Copyright 2020 - 2021 MONAI Consortium
# 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.apach... |
pyatv/protocols/mrp/protobuf/SetVolumeMessage_pb2.py | Jacobs4/pyatv | 532 | 11072155 | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: pyatv/protocols/mrp/protobuf/SetVolumeMessage.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflect... |
env/Lib/site-packages/_plotly_utils/colors/carto.py | andresgreen-byte/Laboratorio-1--Inversion-de-Capital | 11,750 | 11072171 | <gh_stars>1000+
"""
Color sequences and scales from CARTO's CartoColors
Learn more at https://github.com/CartoDB/CartoColor
CARTOColors are made available under a Creative Commons Attribution license: https://creativecommons.org/licenses/by/3.0/us/
"""
from ._swatches import _swatches
def swatches(template=None):
... |
bfxapi/websockets/order_manager.py | kirinchen/bitfinex-api-py | 162 | 11072195 | <filename>bfxapi/websockets/order_manager.py
"""
Module used to house all of the functions/classes used to handle orders
"""
import time
import asyncio
from ..utils.custom_logger import CustomLogger
from ..models import Order
from ..utils.auth import calculate_order_flags, gen_unique_cid
class OrderManager:
"""... |
boto3_type_annotations_with_docs/boto3_type_annotations/directconnect/paginator.py | cowboygneox/boto3_type_annotations | 119 | 11072201 | <reponame>cowboygneox/boto3_type_annotations
from typing import Dict
from botocore.paginate import Paginator
class DescribeDirectConnectGatewayAssociations(Paginator):
def paginate(self, associationId: str = None, associatedGatewayId: str = None, directConnectGatewayId: str = None, virtualGatewayId: str = None, P... |
cacreader/swig-4.0.2/Examples/test-suite/python/template_default_arg_runme.py | kyletanyag/LL-Smartcard | 1,031 | 11072202 | <filename>cacreader/swig-4.0.2/Examples/test-suite/python/template_default_arg_runme.py
import template_default_arg
helloInt = template_default_arg.Hello_int()
helloInt.foo(template_default_arg.Hello_int.hi)
x = template_default_arg.X_int()
if (x.meth(20.0, 200) != 200):
raise RuntimeError, ("X_int test 1 faile... |
bustag/app/local.py | skypjsfly/bustag | 4,197 | 11072219 | <filename>bustag/app/local.py<gh_stars>1000+
'''
handle local file related functions
'''
import re
from peewee import SqliteDatabase, DatabaseError
from bustag.spider.db import Item, LocalItem, ItemRate, RATE_TYPE, RATE_VALUE, db, DBError
from bustag.util import logger, get_data_path
def add_local_fanhao(fanhao, tag... |
test/nn/test_sequential.py | Kenneth-Schroeder/pytorch_geometric | 12,651 | 11072227 | import torch
import torch.fx
from torch.nn import Linear, ReLU, Dropout
from torch_sparse import SparseTensor
from torch_geometric.nn import Sequential, MessagePassing
from torch_geometric.nn import GCNConv, JumpingKnowledge, global_mean_pool
def test_sequential():
x = torch.randn(4, 16)
edge_index = torch.t... |
irc/tests/test_client.py | larsks/irc | 362 | 11072249 | <reponame>larsks/irc<filename>irc/tests/test_client.py
from unittest import mock
import pytest
import irc.client
def test_version():
assert isinstance(irc._get_version(), str)
@mock.patch('irc.connection.socket')
def test_privmsg_sends_msg(socket_mod):
server = irc.client.Reactor().server()
server.con... |
src/tests/test_cases/capitalization.py | sanders41/pydocstyle | 776 | 11072278 | <filename>src/tests/test_cases/capitalization.py<gh_stars>100-1000
"""A valid module docstring."""
from .expected import Expectation
expectation = Expectation()
expect = expectation.expect
@expect("D403: First word of the first line should be properly capitalized "
"('Do', not 'do')")
def not_capitalized():... |
tests/io/test_core.py | daniel-falk/kedro | 2,047 | 11072287 | from decimal import Decimal
from fractions import Fraction
from pathlib import PurePosixPath
from typing import Any, List
import pytest
from kedro.io.core import AbstractDataSet, _parse_filepath, get_filepath_str
# List sourced from https://docs.python.org/3/library/stdtypes.html#truth-value-testing.
# Excludes None... |
workers/repomirrorworker/models_interface.py | giuseppe/quay | 2,027 | 11072288 | from abc import ABCMeta, abstractmethod
from collections import namedtuple
from six import add_metaclass
class RepoMirrorToken(namedtuple("NextRepoMirrorToken", ["min_id"])):
"""
RepoMirrorToken represents an opaque token that can be passed between runs of the repository
mirror worker to continue mirrori... |
speech/melgan/model/res_stack.py | OthmaneJ/deep-tts | 213 | 11072298 | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
class ResStack(nn.Module):
def __init__(self, channel):
super(ResStack, self).__init__()
self.layers = nn.ModuleList([
nn.Sequential(
nn.LeakyReLU(),
nn.utils.weight_n... |
New paper writing/train.py | EagleW/PaperRobot-Incremental-Draft-Generation-of-Scientific-Ideas | 453 | 11072301 | import gc
import os
import sys
import time
import torch
import pickle
import argparse
import torch.nn as nn
from collections import OrderedDict
from eval import Evaluate
from loader.logger import Tee
from loader.loader import load_file_with_terms
from loader.preprocessing import prepare_mapping, AssembleM... |
tests/test_tutorial/test_code_structure/test_tutorial002.py | spawn08/sqlmodel | 5,490 | 11072308 | <reponame>spawn08/sqlmodel
from unittest.mock import patch
from sqlmodel import create_engine
from ...conftest import get_testing_print_function
expected_calls = [
[
"Created hero:",
{
"id": 1,
"name": "Deadpond",
"age": None,
"secret_name": "<NAME>... |
components/autofill/core/browser/pattern_provider/transpile_default_regex_patterns.py | zealoussnow/chromium | 14,668 | 11072327 | #!/usr/bin/env python
# Copyright 2020 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 io
import json
import sys
def to_string_literal(json_string_literal):
return json.dumps(json_string_literal)
def build_cpp_... |
hs_composite_resource/urls.py | hydroshare/hydroshare | 178 | 11072328 | <filename>hs_composite_resource/urls.py<gh_stars>100-1000
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^_internal/(?P<resource_id>[0-9a-f]+)/(?P<coverage_type>[A-z]+)/update-coverage/$',
views.update_resource_coverage, name="update_resource_coverage"),
url(r'^_internal/(?P... |
src/graphql/validation/rules/unique_directives_per_location.py | KingDarBoja/graphql-core | 590 | 11072344 | <reponame>KingDarBoja/graphql-core
from collections import defaultdict
from typing import Any, Dict, List, Union, cast
from ...error import GraphQLError
from ...language import (
DirectiveDefinitionNode,
DirectiveNode,
Node,
SchemaDefinitionNode,
SchemaExtensionNode,
TypeDefinitionNode,
Typ... |
python/ql/test/experimental/query-tests/Security/CWE-287/auth_good_3.py | madhurimamandal/codeql | 4,036 | 11072358 | from ldap3 import Server, Connection, ALL
from flask import request, Flask
from ldap3.utils.dn import escape_rdn
from ldap3.utils.conv import escape_filter_chars
app = Flask(__name__)
@app.route("/passwordFromEnv")
def passwordFromEnv():
"""
The bind's password argument is a non-empty string
"""
dn ... |
linear_nets.py | sanketvmehta/continual-learning | 891 | 11072370 | from torch import nn
import numpy as np
import utils
import excitability_modules as em
class fc_layer(nn.Module):
'''Fully connected layer, with possibility of returning "pre-activations".
Input: [batch_size] x ... x [in_size] tensor
Output: [batch_size] x ... x [out_size] tensor'''
def __init__(s... |
xbox/webapi/api/provider/usersearch/__init__.py | Landcross/xbox-webapi-python | 122 | 11072373 | """
Usersearch - Search for gamertags / userprofiles
"""
from xbox.webapi.api.provider.baseprovider import BaseProvider
from xbox.webapi.api.provider.usersearch.models import UserSearchResponse
class UserSearchProvider(BaseProvider):
USERSEARCH_URL = "https://usersearch.xboxlive.com"
HEADERS_USER_SEARCH = {"x... |
robosuite/utils/robot_utils.py | spatric5/robosuite | 397 | 11072391 | <filename>robosuite/utils/robot_utils.py
# Utilities functions for working with robots
from robosuite.robots import BIMANUAL_ROBOTS
def check_bimanual(robot_name):
"""
Utility function that returns whether the inputted robot_name is a bimanual robot or not
Args:
robot_name (str): Name of the rob... |
model/third_party/HMNet/Models/Trainers/BaseTrainer.py | NickSchoelkopf/SummerTime | 178 | 11072394 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import os
class BaseTrainer:
def __init__(self, opt):
self.opt = opt
if self.opt["cuda"] == True:
self.use_cuda = True
print("Using Cuda\n")
else:
self.use_cuda = False
... |
third_party/com_codota.bzl | wix/exodus | 186 | 11072406 | load("//:import_external.bzl", import_external = "safe_wix_scala_maven_import_external")
def dependencies():
import_external(
name = "com_codota_codota_sdk_java",
artifact = "com.codota:codota-sdk-java:1.0.11",
artifact_sha256 = "134bd08c3763c41aedd9f6a162c1d39d97a3cd5accaf86182b00d0a502856f94",
... |
caserec/recommenders/rating_prediction/user_attribute_knn.py | khalillakhdhar/recommander_python | 407 | 11072416 | <gh_stars>100-1000
# coding=utf-8
""""
User Based Collaborative Filtering Recommender with Attributes (User Attribute KNN)
[Rating Prediction]
User-Attribute-kNN predicts a user’s rating according to how similar users rated the same item. The algorithm
matches similar users based on the similarity of t... |
psqlextra/backend/migrations/operations/add_default_partition.py | adamchainz/django-postgres-extra | 529 | 11072433 | <gh_stars>100-1000
from psqlextra.backend.migrations.state import PostgresPartitionState
from .partition import PostgresPartitionOperation
class PostgresAddDefaultPartition(PostgresPartitionOperation):
"""Adds a new default partition to a :see:PartitionedPostgresModel."""
def state_forwards(self, app_label,... |
setup.py | kayuksel/AdaBound | 3,197 | 11072436 | <filename>setup.py<gh_stars>1000+
from setuptools import setup
__VERSION__ = '0.0.5'
setup(name='adabound',
version=__VERSION__,
description='AdaBound optimization algorithm, build on PyTorch.',
long_description=open("README.md").read(),
long_description_content_type="text/markdown",
key... |
tests/serializers/test_base64_serializer.py | next-franciscoalgaba/python-benedict | 365 | 11072438 | <reponame>next-franciscoalgaba/python-benedict<gh_stars>100-1000
# -*- coding: utf-8 -*-
from benedict.serializers import Base64Serializer
import unittest
class base64_serializer_test_case(unittest.TestCase):
def test_decode_base64(self):
# TODO
pass
def test_encode_base64(self):
#... |
corehq/apps/accounting/management/commands/make_domain_enterprise_level.py | dimagilg/commcare-hq | 471 | 11072442 | from django.core.management import BaseCommand
from corehq.apps.domain.forms import DimagiOnlyEnterpriseForm
from corehq.apps.domain.models import Domain
from corehq.util.decorators import require_debug_true
class Command(BaseCommand):
help = ('Create a billing account and an enterprise level subscription '
... |
controllers/exploits.py | noraj/Kvasir | 194 | 11072447 | <filename>controllers/exploits.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
##--------------------------------------#
## Kvasir
##
## (c) 2010-2014 Cisco Systems, Inc.
## (c) 2015 <NAME>
##
## Exploits controller
##
## Author: <NAME> <<EMAIL>>
##--------------------------------------#
from skaldship.hosts import host... |
treeio/identities/forms.py | Andrea-MariaDB-2/treeio | 242 | 11072486 | <filename>treeio/identities/forms.py
# encoding: utf-8
# Copyright 2011 Tree.io Limited
# This file is part of Treeio.
# License www.tree.io/license
"""
Identities module forms
"""
from django import forms
from django.core.files.storage import default_storage
from django.template import defaultfilters
from django.core... |
tests/testapp/test_nexus_module.py | YPlan/gargoyle | 138 | 11072490 | from __future__ import absolute_import, division, print_function, unicode_literals
import json
from django.contrib.auth.models import User
from django.test import TestCase
from gargoyle import gargoyle
from gargoyle.models import DISABLED, GLOBAL, Switch
class NexusModuleTestCase(TestCase):
def setUp(self):
... |
contrib/remote-dev-tool/remote-dev-tool.py | luxius-luminus/pai | 1,417 | 11072496 | <reponame>luxius-luminus/pai
#!/usr/bin/env python3
# Copyright (c) Microsoft Corporation
# All rights reserved.
#
# MIT License
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the Software without restri... |
venv/Lib/site-packages/pygments/lexers/_vbscript_builtins.py | EkremBayar/bayar | 6,989 | 11072508 | <filename>venv/Lib/site-packages/pygments/lexers/_vbscript_builtins.py
"""
pygments.lexers._vbscript_builtins
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
These are manually translated lists from
http://www.indusoft.com/pdf/VBScript%20Reference.pdf.
:copyright: Copyright 2006-2021 by the Pygments team, see ... |
Algo and DSA/LeetCode-Solutions-master/Python/least-number-of-unique-integers-after-k-removals.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 11072537 | <reponame>Sourav692/FAANG-Interview-Preparation<gh_stars>1000+
# Time: O(n)
# Space: O(n)
import collections
class Solution(object):
def findLeastNumOfUniqueInts(self, arr, k):
"""
:type arr: List[int]
:type k: int
:rtype: int
"""
count = collections.Counter(arr)
... |
detectron2/modeling/anchor_generator.py | Nour-7/detectron2 | 171 | 11072538 | <gh_stars>100-1000
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import math
from typing import List
import torch
from torch import nn
from detectron2.config import configurable
from detectron2.layers import ShapeSpec
from detectron2.structures import Boxes, RotatedBoxes
from detectron2.utils.... |
segmentation/utils/test_utils.py | wudongyuan/PanopticCenter | 506 | 11072539 | <filename>segmentation/utils/test_utils.py
# ------------------------------------------------------------------------------
# Utility functions for multi-scale testing.
# Written by Pingjun (https://github.com/bowenc0221/panoptic-deeplab/issues/25)
# Modified by <NAME> (<EMAIL>)
# --------------------------------------... |
pypower/uopf.py | Bengt/PYPOWER | 221 | 11072571 | # Copyright (c) 1996-2015 PSERC. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
"""Solves combined unit decommitment / optimal power flow.
"""
from time import time
from copy import deepcopy
from numpy import flatnonzero as find
from pypow... |
flex/loading/common/single_header/collection_format.py | maroux/flex | 160 | 11072621 | from flex.constants import (
STRING,
CSV,
COLLECTION_FORMATS,
)
from flex.validation.common import (
generate_object_validator,
)
collection_format_schema = {
'type': STRING,
'default': CSV,
'enum': COLLECTION_FORMATS,
}
collection_format_validator = generate_object_validator(
schema... |
env/lib/python3.8/site-packages/numpy/testing/print_coercion_tables.py | acrucetta/Chicago_COVI_WebApp | 1,738 | 11072625 | <filename>env/lib/python3.8/site-packages/numpy/testing/print_coercion_tables.py
#!/usr/bin/env python
"""Prints type-coercion tables for the built-in NumPy types
"""
from __future__ import division, absolute_import, print_function
import numpy as np
# Generic object that can be added, but doesn't do anything else
c... |
agate/table/line_chart.py | andriyor/agate | 663 | 11072647 | <reponame>andriyor/agate
#!/usr/bin/env python
# pylint: disable=W0212
import leather
def line_chart(self, x=0, y=1, path=None, width=None, height=None):
"""
Render a line chart using :class:`leather.Chart`.
:param x:
The name or index of a column to plot as the x-axis. Defaults to the
f... |
test/integration/samples_in/simple_percent_comment.py | Inveracity/flynt | 487 | 11072648 | <filename>test/integration/samples_in/simple_percent_comment.py
var = 5
a = "Test: %s" % var # cool formatting!
|
v2.9.7/libxml2-2.9.7/python/tests/xpath.py | yapingxin/libxml2 | 11,356 | 11072685 | <filename>v2.9.7/libxml2-2.9.7/python/tests/xpath.py
#!/usr/bin/python -u
#
# this test exercise the XPath basic engine, parser, etc, and
# allows to detect memory leaks
#
import sys
import libxml2
# Memory debug specific
libxml2.debugMemory(1)
doc = libxml2.parseFile("tst.xml")
if doc.name != "tst.xml":
print("d... |
benchmark/python/sparse/updater.py | Vikas-kum/incubator-mxnet | 228 | 11072698 | <filename>benchmark/python/sparse/updater.py
# 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,... |
examples/shadertoy.py | szabolcsdombi/zengl | 116 | 11072712 | import struct
import zengl
from window import Window
window = Window(1280, 720)
ctx = zengl.context()
image = ctx.image(window.size, 'rgba8unorm')
uniform_buffer = ctx.buffer(size=64)
# Tested with:
# Happy Jumping - https://www.shadertoy.com/view/3lsSzf
# Raymarching - Primitives - https://www.shadertoy.com/view/... |
Sketchbots/sw/labqueue/support/handlers.py | rlugojr/ChromeWebLab | 306 | 11072785 | # Copyright 2013 Google 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 ... |
Projects/robosat-master/robosat/tools/train.py | DanielMabadeje/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials | 3,266 | 11072793 | <reponame>DanielMabadeje/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials
import os
import sys
import argparse
import collections
from PIL import Image
import torch
import torch.backends.cudnn
from torch.nn import DataParallel
from torch.optim import SGD
from torch.optim.lr_scheduler import MultiStepL... |
Cogs/Hw.py | RehanPlayz/CorpBot.py | 368 | 11072822 | <filename>Cogs/Hw.py
import discord, time
from discord.ext import commands
from Cogs import Utils, PCPP, DisplayName, Message, PickList
def setup(bot):
# Add the bot and deps
settings = bot.get_cog("Settings")
bot.add_cog(Hw(bot, settings))
# This is the Uptime module. It keeps track of how long the b... |
pypy/module/_multibytecodec/app_multibytecodec.py | nanjekyejoannah/pypy | 381 | 11072858 | # NOT_RPYTHON
#
# The interface here may be a little bit on the lightweight side.
from _multibytecodec import MultibyteIncrementalDecoder
from _multibytecodec import MultibyteIncrementalEncoder
class MultibyteStreamReader(MultibyteIncrementalDecoder):
def __new__(cls, stream, errors=None):
self = Multiby... |
alipay/aop/api/response/KoubeiCateringDishCommruleSyncResponse.py | antopen/alipay-sdk-python-all | 213 | 11072870 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.KbdishCommRuleInfo import KbdishCommRuleInfo
class KoubeiCateringDishCommruleSyncResponse(AlipayResponse):
def __init__(self):
super(KoubeiCateringDishCo... |
lib/jinja2/testsuite/utils.py | Slashbunny/maraschino | 790 | 11072911 | <reponame>Slashbunny/maraschino
# -*- coding: utf-8 -*-
"""
jinja2.testsuite.utils
~~~~~~~~~~~~~~~~~~~~~~
Tests utilities jinja uses.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
import gc
import unittest
import pickle
from jinja2.testsuite import Jinj... |
venv/venv.py | MaxTurchin/pycopy-lib | 126 | 11072914 | <gh_stars>100-1000
import sys
import os
if len(sys.argv) != 2:
print("usage: venv ENV_DIR")
sys.exit(1)
env = sys.argv[1]
os.makedirs(env + "/bin")
with open(env + "/bin/activate", "w") as f:
f.write("""\
export PYCOPYPATH=%s
""" % os.path.abspath(env + "/lib"))
|
tests/wipy/pin_irq.py | sebastien-riou/micropython | 13,648 | 11072979 | <reponame>sebastien-riou/micropython<filename>tests/wipy/pin_irq.py
"""
Pin IRQ test for the CC3200 based boards.
"""
from machine import Pin
import machine
import os
import time
mch = os.uname().machine
if "LaunchPad" in mch:
pins = ["GP16", "GP13"]
elif "WiPy" in mch:
pins = ["GP16", "GP13"]
else:
raise... |
compilers/src/make.py | ksuarez95/coinhive-block | 105 | 11072981 | domains = open("../../domains", "r").read().split('\n')
output = open('../../hostfile', "w")
output.write("##COINHIVE DOMAINS\n")
for domain in domains:
output.write("0.0.0.0 " + domain + "\n")
output.write("##END COINHIVE\n")
|
tests/import/import1b.py | learnforpractice/micropython-cpp | 692 | 11073015 | <gh_stars>100-1000
var = 123
def throw():
raise ValueError
|
python-midonetclient/src/midonetclient/port.py | obino/midonet | 221 | 11073030 | <filename>python-midonetclient/src/midonetclient/port.py
# Copyright 2013 Midokura PTE LTD.
# All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/lic... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.