content stringlengths 7 928k | avg_line_length float64 3.5 33.8k | max_line_length int64 6 139k | alphanum_fraction float64 0.08 0.96 | licenses list | repository_name stringlengths 7 104 | path stringlengths 4 230 | size int64 7 928k | lang stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|
#!/usr/bin/env python3
# Copyright (c) 2017-2020 The Ludirium Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test wallet load on startup.
Verify that a ludiriumd node can maintain list of wallets loading on sta... | 43.101695 | 98 | 0.69013 | [
"MIT"
] | ludirium/ludirium | test/functional/wallet_startup.py | 2,543 | Python |
# Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from openvino.tools.mo.front.common.partial_infer.utils import mo_array
from openvino.tools.mo.front.extractor import FrontExtractorOp
from openvino.tools.mo.front.kaldi.loader.utils import read_binary_bool_token, rea... | 40.6 | 130 | 0.719212 | [
"Apache-2.0"
] | 3Demonica/openvino | tools/mo/openvino/tools/mo/front/kaldi/extractors/tdnncomponent_ext.py | 2,436 | Python |
from fastcore.foundation import L
# 0~11 ์ซ์๋ฅผ ํฌํจํ L์ ์์ฑํฉ๋๋ค (range ์ฌ์ฉ)
t = ____________
print(t)
# L์ ๋ด์ฉ์ ๋ ๋ฐฐ ๋ถ๋ฆฝ๋๋ค
t __ 2
print(t)
# 0์ด ๋ด๊ธด ์์น (0, 12) ๋ฅผ ํํ ๋ฐฉ์์ผ๋ก ์ฐพ์์ ๋ฐํํฉ๋๋ค
t_1 = t[_, __]
print(t_1)
# 0์ด ๋ด๊ธด ์์น (0, 12) ๋ฅผ ๋ง์คํน ๋ฐฉ์์ผ๋ก ์ฐพ์์ ๋ฐํํฉ๋๋ค
# - ๋ง์คํฌ๋ฅผ ๋ง๋ญ๋๋ค 0๊ณผ 12๋ฒ์งธ ์์น์๋ง True๋ฅผ ๋ฃ์ต๋๋ค
mask = L([True])
mask += L([False] * 11)
ma... | 16.73913 | 39 | 0.631169 | [
"MIT"
] | deep-diver/fastai-course | exercises/chapter01/exc_01_07.py | 555 | Python |
from setuptools import setup, find_packages
setup(name='nisrep', version='1.0', packages=find_packages())
| 26.75 | 61 | 0.775701 | [
"MIT"
] | NGoetz/NF | setup.py | 107 | Python |
'''
Advent of Code - 2019
--- Day 2: 1202 Program Alarm ---
'''
from utils import *
from intcode import IntcodeRunner, HaltExecution
def parse_input(day):
return day_input(day, integers)[0]
def part1(program, noun=12, verb=2):
runner = IntcodeRunner(program)
runner.set_mem(1, noun)
runner.set_... | 21.82 | 48 | 0.549954 | [
"MIT"
] | basoares/advent-of-code | challenges/2019/python/d02.py | 1,091 | Python |
"""Workout schema module"""
import graphene
from exercises.schema import ExerciseType
from exercises.models import Exercise
class Query(graphene.ObjectType):
"""Workout query class"""
workout = graphene.List(ExerciseType,
body_part=graphene.String(),
exe... | 36.805556 | 77 | 0.612075 | [
"MIT"
] | adeoke/django-quarantine-workout-graphql | quarantineworkout/workout/schema.py | 1,325 | Python |
# Copyright 2015 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... | 41.110204 | 80 | 0.700655 | [
"Apache-2.0"
] | 1559603450/tensorflow | tensorflow/python/kernel_tests/variable_ops_test.py | 10,072 | Python |
import pylab as pl
from get_fish_info import get_fish_info
from fit_integrator_model import get_model_result, get_target_result
import numpy as np
from pathlib import Path
import gmm_model_fit
import pandas as pd
from pymoo.factory import get_problem, get_visualization, get_decomposition
# import random
#
# for dt in ... | 47.092975 | 185 | 0.660641 | [
"MIT"
] | arminbahl/mutant_zebrafish_behavior | armin_analysis/model_tests.py | 22,793 | Python |
from django.db import models
from django.utils import timezone
from django.core.exceptions import ValidationError
# from django.contrib.auth.models import User
from users.models import Student, College
from django.urls import reverse
from django.core import validators
class AbstractPostModel(models.Model):
title ... | 35.403509 | 91 | 0.733399 | [
"MIT"
] | franndyabreu/oncollegehub | app/blog/models.py | 2,018 | Python |
"""
Wrapper to get ROVA calendar from Rova's API
Acces to this ROVA API has been simplified since version 0.2.1 of this wrapper
Just use https://www.rova.nl/api/waste-calendar/upcoming?postalcode=1000AA&houseNumber=1&addition=&take=5
with a existing combination of postalcode, housenumber, housenumber addition
Be aware... | 31.261364 | 105 | 0.608142 | [
"MIT"
] | synoniem/rova | rova/rova.py | 2,751 | Python |
import numpy as np
import random
from collections import namedtuple, deque
from model import QNetwork
import torch
import torch.nn.functional as F
import torch.optim as optim
BUFFER_SIZE = int(1e5) # replay buffer size
BATCH_SIZE = 64 # minibatch size
GAMMA = 0.99 # discount factor
TAU = 1e-3 ... | 41.652439 | 127 | 0.624799 | [
"MIT"
] | 0xtristan/deep-reinforcement-learning | dqn/exercise/dqn_agent.py | 6,836 | Python |
from __future__ import print_function, division, absolute_import
import os
import unittest
from six import string_types
from .. import *
from ..compat import as_text, as_str, as_bytes
DEFAULT_VP_TEST_HOST = '127.0.0.1'
DEFAULT_VP_TEST_PORT = 5433
DEFAULT_VP_TEST_USER = 'dbadmin'
DEFAULT_VP_TEST_PASSWD = ''
DEFAULT_... | 32.971154 | 82 | 0.642461 | [
"MIT"
] | etsy/vertica-python | vertica_python/tests/base.py | 3,429 | Python |
from selenium_test.selenium_utils import *
from file_and_system.windows_os_utils import WindowsOsUtil
from python_common.global_param import GlobalParam
from http_request.request_utils import request_download_file_by_url
import cv2 as cv
import time
WindowsOsUtil.kill_process_by_name('MicrosoftWebDriver.exe')
# mail_l... | 44.537313 | 115 | 0.744135 | [
"MIT"
] | ivanlevsky/cowabunga-potato | selenium_test/sele_test_mail_login.py | 5,974 | Python |
# -*- coding: utf-8 -*-
# @Time : 2020/10/3
# @Author : Changxin Tian
# @Email : cx.tian@outlook.com
r"""
KGNNLS
################################################
Reference:
Hongwei Wang et al. "Knowledge-aware Graph Neural Networks with Label Smoothness Regularization
for Recommender Systems." in KDD 2019.... | 46.091703 | 120 | 0.597726 | [
"MIT"
] | xingkongxiaxia/RecBole | recbole/model/knowledge_aware_recommender/kgnnls.py | 21,110 | Python |
"""
JSONField automatically serializes most Python terms to JSON data.
Creates a TEXT field with a default value of "{}". See test_json.py for
more information.
from django.db import models
from django_extensions.db.fields import json
class LOL(models.Model):
extra = json.JSONField()
"""
import datetime
fro... | 29.607843 | 85 | 0.636755 | [
"BSD-3-Clause"
] | Mozilla-GitHub-Standards/b6a5bb5c98b18d87c72c770f29c4270008fc6fc6b787d531a2afcd382dc4cbad | vendor-local/src/django-extensions/build/lib/django_extensions/db/fields/json.py | 3,020 | Python |
import uuid
import arrow
from collections import namedtuple
HEADERS = ('start', 'stop', 'project', 'id', 'tags', 'updated_at')
class Frame(namedtuple('Frame', HEADERS)):
def __new__(cls, start, stop, project, id, tags=None, updated_at=None,):
try:
if not isinstance(start, arrow.Arrow):
... | 29.27957 | 79 | 0.565736 | [
"MIT"
] | blaulan/Watson | watson/frames.py | 5,446 | Python |
import torch
import numpy as np
from allennlp.nn import util
from relex.modules.offset_embedders import OffsetEmbedder
def position_encoding_init(n_position: int, embedding_dim: int):
position_enc = np.array([[pos / np.power(10000, 2 * (j // 2) / embedding_dim)
for j in range(embeddi... | 38.081967 | 81 | 0.584158 | [
"Apache-2.0"
] | DFKI-NLP/RelEx | relex/modules/offset_embedders/sine_offset_embedder.py | 2,323 | Python |
"""
Quotes API For Digital Portals
The quotes API combines endpoints for retrieving security end-of-day, delayed, and realtime prices with performance key figures and basic reference data on the security and market level. The API supports over 20 different price types for each quote and comes with basic searc... | 48.712687 | 1,302 | 0.603294 | [
"Apache-2.0"
] | factset/enterprise-sdk | code/python/QuotesAPIforDigitalPortals/v3/fds/sdk/QuotesAPIforDigitalPortals/model/inline_response20013.py | 13,055 | Python |
def calculalaNotafinalRGHT1():
#defenir variables
calculalanotaFinalRGHT=20
#datos de entrada
notaFinalRGHT=float(input("Ingrese la nota final"))
calculalaNotafinalRGHT=float(input("ingrese"))
#Proceso
if primeraUnidad<=20% and notaObotenida>=14:
primeranota=notaFinalRGHT
elif segundaUnidad<=15% an... | 29.255814 | 79 | 0.771065 | [
"Apache-2.0"
] | royturpo123/EXAMEN-01 | EstCondicional.py | 1,260 | Python |
import argparse
import os
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import DataLoader
from torch.utils.tensorboard import SummaryWriter
from ignite.metrics import IoU, Precision, Recall
import torchsat.transforms.transforms_cd as T
from torchsat.datasets.f... | 42.393939 | 115 | 0.674482 | [
"MIT"
] | alina2204/contrastive_SSL_ship_detection | torchsat/scripts/train_cd.py | 6,995 | Python |
# -*- coding: utf-8 -*-
"""Converts .pyfr[m, s] files to a Paraview VTK UnstructuredGrid File"""
from collections import defaultdict
import os
import numpy as np
from pyfr.shapes import BaseShape
from pyfr.util import subclass_where
from pyfr.writers import BaseWriter
class ParaviewWriter(BaseWriter):
# Suppo... | 31.074236 | 77 | 0.531057 | [
"BSD-3-Clause"
] | tjcorona/PyFR | pyfr/writers/paraview.py | 14,232 | Python |
#!/c/python27/python
import os
from utils import *
def cli_cpp(parms):
return os.path.join(parms['OVPN3'], "core", "test", "ovpncli", "cli.cpp")
def src_fn(parms, srcfile):
# Get source file name
if srcfile:
if '.' not in os.path.basename(srcfile):
srcfile += ".cpp"
else:
... | 37.882979 | 641 | 0.624544 | [
"MIT"
] | february29/FchVPN | Carthage/Checkouts/openvpn-adapter/OpenVPN Adapter/Vendors/openvpn/win/build.py | 3,561 | Python |
#!/usr/bin/env python
## @package teleop_joy A node for controlling the P3DX with an XBox controller
import rospy
from geometry_msgs.msg import Twist
from nav_msgs.msg import Odometry
from sensor_msgs.msg import Joy
import numpy as np
def quat2yaw(q):
return np.arctan2(2*(q.y*q.z + q.w*q.x), 1 - 2*(q.z**2 + q.w... | 24.615385 | 78 | 0.715625 | [
"MIT"
] | Lovestarni/asv_simulator | nodes/teleop_joy.py | 1,280 | Python |
import os
import fs
from .utils import Docs, custom_dedent
class TestTutorial(Docs):
def test_level_1(self):
expected = "world"
folder = "level-1-jinja2-cli"
self._moban(folder, expected)
def test_level_1_custom_define(self):
expected = "maailman"
folder = "level-1-j... | 29.903553 | 81 | 0.534035 | [
"MIT"
] | chfw/moban | tests/test_docs.py | 11,782 | Python |
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
from parlai.core.agents im... | 42.251429 | 105 | 0.552069 | [
"BSD-3-Clause"
] | gmkim90/KBKAIST_Chatbot | parlai/agents/seq2seq/seq2seq.py | 22,182 | Python |
# Copyright 2018 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... | 37.004464 | 102 | 0.699441 | [
"Apache-2.0"
] | DeuroIO/Deuro-tensorflow | tensorflow/python/distribute/cross_device_utils.py | 24,867 | Python |
from time import sleep
from ec2mc import __main__
def test_user_commands():
"""test all user commands."""
assert __main__.main([
"user", "create", "ec2mc_test_user", "setup_users", "--default"
]) is not False
sleep(5)
assert __main__.main([
"user", "list"
]) is not False
as... | 26.730769 | 71 | 0.604317 | [
"MIT"
] | TakingItCasual/easymc | tests/test_user_commands.py | 695 | Python |
import numpy as np
import tensorlayerx as tlx
import gammagl.mpops as mpops
from .num_nodes import maybe_num_nodes
from .check import check_is_numpy
def coalesce(edge_index, edge_attr=None, num_nodes=None, reduce="add", is_sorted=False, sort_by_row=True):
"""Row-wise sorts :obj:`edge_index` and removes its duplic... | 42.704225 | 106 | 0.649406 | [
"Apache-2.0"
] | BUPT-GAMMA/GammaGL | gammagl/utils/coalesce.py | 3,032 | 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 applicable law or agreed to in writing, software
# d... | 46.513514 | 78 | 0.665258 | [
"Apache-2.0"
] | Metaswitch/calico-nova | nova/tests/unit/conductor/tasks/test_live_migrate.py | 18,931 | Python |
"""
Script to show the wireframe of a given mesh (read from a file) in an interactive
Viewer.
"""
from viewer import *
from mesh.obj import OBJFile
import sys
if __name__ == "__main__":
app = Viewer()
if len(sys.argv) > 1:
try:
obj = OBJFile.read(sys.argv[1])
app.scene.addObje... | 23.038462 | 81 | 0.592654 | [
"MIT"
] | fwidmaier/mesh_handler | wireframe.py | 599 | Python |
# The MIT License (MIT)
# Copyright (c) 2015 Yanzheng Li
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify,... | 31.52439 | 80 | 0.572534 | [
"MIT"
] | mizuki-nana/coreVM | python/tests/assert.py | 2,585 | Python |
import logging
import pandas as pd
from flask import Flask, request
from gevent.pywsgi import WSGIServer
from time import sleep
from func import rms, meas_to_influx, rms_to_influx, config
logger = logging.getLogger(config['log_name'])
logger.setLevel(logging.INFO)
h_stream = logging.StreamHandler()
h_stream.setLevel(... | 22.87234 | 79 | 0.664186 | [
"MIT"
] | dave-cz/esp32_power_meter | server/server.py | 1,075 | Python |
# coding: utf-8
"""
Provides the exporter tool. The exporter can be used to export ComodIT entities
to local directories.
"""
from __future__ import print_function
from builtins import object
import os
from comodit_client.api.collection import EntityNotFoundException
from comodit_client.api.exceptions import PythonAp... | 31.822134 | 106 | 0.600795 | [
"MIT"
] | geoco84/comodit-client | comodit_client/api/exporter.py | 8,051 | Python |
from __future__ import absolute_import, division, print_function
import argparse
import sys
import os
import py
import pytest
from _pytest.config import argparsing as parseopt
@pytest.fixture
def parser():
return parseopt.Parser()
class TestParser(object):
def test_no_help_by_default(self, capsys):
... | 39.249258 | 86 | 0.597112 | [
"BSD-3-Clause"
] | 2-GARIK20/wpt | tools/third_party/pytest/testing/test_parseopt.py | 13,227 | Python |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
# pylint: ... | 42.770883 | 117 | 0.685843 | [
"MIT"
] | Co0olboi/azure-sdk-for-python | sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_models.py | 35,842 | Python |
#!/usr/bin/env python
from circuits import Component
from circuits.web import JSONRPC, Controller
from .helpers import urlopen
from .jsonrpclib import ServerProxy
class App(Component):
def eval(self, s):
return eval(s)
class Root(Controller):
def index(self):
return "Hello World!"
def t... | 18.948718 | 65 | 0.645467 | [
"MIT"
] | hugovk/circuits | tests/web/test_jsonrpc.py | 739 | Python |
from output.models.saxon_data.all.all001_xsd.all001 import Doc
__all__ = [
"Doc",
]
| 14.833333 | 62 | 0.719101 | [
"MIT"
] | tefra/xsdata-w3c-tests | output/models/saxon_data/all/all001_xsd/__init__.py | 89 | Python |
from django import forms
from .models import Todo
class TodoForm(forms.ModelForm):
class Meta:
model = Todo
fields="__all__"
| 16.375 | 32 | 0.755725 | [
"MIT"
] | Ronlin1/To-Do-App | app/forms.py | 131 | Python |
# Copyright 2019 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... | 36.424779 | 84 | 0.744412 | [
"Apache-2.0"
] | 13957166977/model-optimization | tensorflow_model_optimization/__init__.py | 4,116 | Python |
"""
Constructor functions intended to be shared by pd.array, Series.__init__,
and Index.__new__.
These should not depend on core.internals.
"""
from __future__ import annotations
from collections import abc
from typing import TYPE_CHECKING, Any, Optional, Sequence, Union, cast
import numpy as np
import numpy.ma as m... | 33.578867 | 88 | 0.626123 | [
"BSD-3-Clause"
] | BhavarthShah/pandas | pandas/core/construction.py | 21,927 | Python |
"""
DuckDuckGo (Images)
@website https://duckduckgo.com/
@provide-api yes (https://duckduckgo.com/api),
but images are not supported
@using-api no
@results JSON (site requires js to get images)
@stable no (JSON can change)
@parse url, title, img_src
@todo avoid extra... | 27.076923 | 103 | 0.631088 | [
"MIT"
] | AlexRogalskiy/DevArtifacts | master/searx-master/searx/engines/duckduckgo_images.py | 2,464 | Python |
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Havenir and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
class PortOfLoading(Document):
pass
| 23.545455 | 49 | 0.776062 | [
"MIT"
] | umar567/shipment-repo | shipments/shipments/doctype/port_of_loading/port_of_loading.py | 259 | Python |
import os
import sys
import argparse
import numpy as np
from PIL import Image
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.optim import Adam
from torch.utils.data import Dataset
import torchvision.transforms as transforms
import pickle
de... | 28.578125 | 77 | 0.697649 | [
"MIT"
] | Zeng-WH/ML2020 | CNN/code/filter_visualiton.py | 2,173 | Python |
from functools import wraps
import sys
import traceback
from ploomber.io import TerminalWriter
from ploomber.exceptions import DAGBuildError, DAGRenderError
# TODO: there are two types of cli commands: the ones that execute user's
# code (ploomber build/task) and the ones that parse a dag/task but do not
# execute it.... | 32.552632 | 78 | 0.630558 | [
"Apache-2.0"
] | abhishak3/ploomber | src/ploomber/cli/io.py | 2,474 | Python |
import json
import os
import shutil
import tempfile
def copytree(src, dst, symlinks=False, ignore=None):
for item in os.listdir(src):
s = os.path.join(src, item)
d = os.path.join(dst, item)
if os.path.isdir(s):
shutil.copytree(s, d, symlinks, ignore)
else:
s... | 31.321918 | 98 | 0.535535 | [
"MIT"
] | claremacrae/docs | deploy_gh_pages.py | 4,573 | Python |
# -*- coding: utf-8 -*-
"""็ฌ่ซ้
็ฝฎๆไปถ"""
import os
# MYSQL
MYSQL_IP = "localhost"
MYSQL_PORT = 3306
MYSQL_DB = "feapder"
MYSQL_USER_NAME = "feapder"
MYSQL_USER_PASS = "feapder123"
# REDIS
# IP:PORT
REDISDB_IP_PORTS = "localhost:6379"
REDISDB_USER_PASS = ""
REDISDB_DB = 0
# # ็ฌ่ซ็ธๅ
ณ
# # COLLECTOR
COLLECTOR_SLEEP_TIME = 1 ... | 23.309859 | 70 | 0.735347 | [
"MIT"
] | AYiXi/feapder | tests/spider/setting.py | 2,239 | Python |
import random
class Playlist:
"""
A list of routines (aka a list of light effect layer lists, or a list of
flame sequences) all intended for use in a single context (e.g. when the
headset is on). One routine in the playlist is selected at any given time.
"""
def __init__(self, routines, index... | 34.025 | 78 | 0.588538 | [
"Apache-2.0"
] | FlamingLotusGirls/soma | pier14/opc-client/playlist.py | 1,361 | Python |
"""
Small script to generate gdal_warp commands
for projecting rasters to the Behrmann projection
to be able to run the generated bat file you should have gdalwarp in your path or run it from an OSGeo4W Shell
"""
import os
root = r"D:\a\data\BioOracle_scenarios_30s_min250"
output = root + r"_equal_area" #os.path.absp... | 43.424242 | 157 | 0.586183 | [
"Unlicense"
] | samuelbosch/phd | rasters/project_to_behrmann.py | 1,433 | Python |
import json
import logging
from django.http import JsonResponse
logger = logging.getLogger('log')
from wxcloudrun.utils.SQL.DBUtils import DBUtils
def test1(request):
print(request.headers)
logger.info(request.headers)
rsp = JsonResponse({'code': 0, 'errorMsg': '๐'}, json_dumps_params={'ensure_ascii':... | 19.166667 | 95 | 0.727536 | [
"MIT"
] | nixiaopan/nipan | wxcloudrun/np_test/views.py | 348 | Python |
import sqlite3
from checktheplug.models.Server import Server
"""
Operations to manage accessing the server database.
"""
class ServerDao:
"""
Sets up the object with the sql connection.
"""
def __init__(self, settings):
self.conn = sqlite3.connect(settings.database)
"""
... | 37.012346 | 140 | 0.53936 | [
"MIT"
] | maximx1/checktheplug | checktheplug/data/ServerDao.py | 2,998 | Python |
from rest_framework import serializers
from apps.challenge.models import Clan
class ClanSerializer(serializers.ModelSerializer):
class Meta:
model = Clan
fields = (
'name', 'leader', 'image', 'score', 'wins', 'losses', 'draws'
)
| 22.666667 | 73 | 0.632353 | [
"MIT"
] | SharifAIChallenge/AIC21-Backend | apps/challenge/serializers/clan.py | 272 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 5/15/20 4:49 PM
# @File : grover.py
# qubit number=4
# total number=25
import cirq
import cirq.google as cg
from typing import Optional
import sys
from math import log2
import numpy as np
#thatsNoCode
def make_circuit(n: int, input_qubit):
c = cirq.Ci... | 32.068493 | 80 | 0.668518 | [
"BSD-3-Clause"
] | UCLA-SEAL/QDiff | data/cirq_new/cirq_program/startCirq_Class840.py | 2,341 | Python |
from seleniumbase import BaseCase
from werkzeug.security import generate_password_hash
from qa327_test.conftest import base_url
from qa327.models import User, Ticket
# Mock a sample user
TEST_USER = User(
email='test_frontend@test.com',
name='test_frontend',
password=generate_password_hash('test_frontend')... | 26.938776 | 79 | 0.669697 | [
"Apache-2.0",
"MIT"
] | nicoleooi/cmpe327 | qa327_test/frontend/geek_base.py | 1,320 | Python |
import pytest
from vdirsyncer.storage.dav import _BAD_XML_CHARS
from vdirsyncer.storage.dav import _merge_xml
from vdirsyncer.storage.dav import _parse_xml
def test_xml_utilities():
x = _parse_xml(
b"""<?xml version="1.0" encoding="UTF-8" ?>
<multistatus xmlns="DAV:">
<response>
... | 29.085106 | 72 | 0.516459 | [
"BSD-3-Clause"
] | Bleala/vdirsyncer | tests/storage/dav/test_main.py | 1,367 | Python |
from __future__ import division
import numpy as np
from numpy.random import rand
import pandas as pd
# --- List of available filters
FILTERS=[
{'name':'Moving average','param':100,'paramName':'Window Size','paramRange':[0,100000],'increment':1},
{'name':'Low pass 1st order','param':1.0,'paramName':'Cutoff Fre... | 31.002882 | 119 | 0.533278 | [
"MIT"
] | cdrtm/pyDatView | pydatview/tools/signal.py | 10,758 | Python |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-04-15 06:13
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import jsonfield.fields
class Migration(migrations.Migration):
in... | 41.941176 | 134 | 0.596073 | [
"MIT"
] | jtauber/oxlos2 | oxlos/migrations/0001_initial.py | 2,852 | Python |
from setuptools import find_packages, setup
setup(
name="hacker_news",
version="dev",
author="Elementl",
author_email="hello@elementl.com",
classifiers=[
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8"... | 26.5 | 66 | 0.539982 | [
"Apache-2.0"
] | kbd/dagster | examples/hacker_news/setup.py | 1,113 | Python |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making ่้ฒธๆบไบPaaSๅนณๅฐ็คพๅบ็ (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... | 46.769231 | 115 | 0.763158 | [
"Apache-2.0"
] | jamesgetx/bk-bcs | bcs-ui/backend/tests/components/test_cm.py | 1,234 | Python |
import os
import sys
import json
import datetime
import numpy as np
import skimage.draw
from bs4 import BeautifulSoup as bs
import cv2
import imgaug
from utils import *
# Root directory of the project
ROOT_DIR = os.path.abspath("../../")
# Inference result directory
RESULTS_DIR = os.path.abspath("./inference/")
# Impo... | 39.112601 | 98 | 0.582699 | [
"Apache-2.0"
] | yhpengtu/CenterIMask | tools/convet_voc2coco/voc2coco.py | 14,589 | Python |
from tint.ssl.context import PFSContextFactory
from tint.log import Logger
from tint.protocols.tintp import ConnectionPool
from tint.protocols.tintp import TintProtocolFactory
from tint.friends import FriendsList
class Peer(object):
def __init__(self, keyStore, storage, resolver):
self.keyStore = keyStor... | 39 | 94 | 0.651163 | [
"MIT"
] | 8468/tint | tint/peer.py | 3,354 | Python |
"""Count Encoder"""
import numpy as np
import pandas as pd
import category_encoders.utils as util
from copy import copy
from sklearn.base import BaseEstimator, TransformerMixin
__author__ = 'joshua t. dunn'
class CountEncoder(BaseEstimator, TransformerMixin):
def __init__(self, verbose=0, cols=None, drop_invar... | 36.139665 | 93 | 0.541738 | [
"BSD-3-Clause"
] | JoshuaC3/categorical-encoding | category_encoders/count.py | 12,938 | Python |
#The term schedule that gets displayed. Can do multiple terms in the case of displaying
#summer and fall at the same time. ie termNames ['2201','2208']
termNames=['2218']
majorTemplate='in/majorPage.html.mako'
#Add new majors here.
#Name: short name for the major
#classFile: the csv file containing all the classes in... | 57.097087 | 112 | 0.60857 | [
"MIT"
] | sdtaylor/scheduleCrossRef | config.py | 5,881 | Python |
# ---------------------------------------------------------------------
# Syslog server
# ---------------------------------------------------------------------
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
# Python modules
im... | 30.072727 | 99 | 0.538089 | [
"BSD-3-Clause"
] | nocproject/noc | services/syslogcollector/syslogserver.py | 1,654 | Python |
import logging
import os
import subprocess
logger = logging.getLogger(__name__)
class Combiner(object):
def __init__(self, options):
self.options = options
def combine(self, page_file_names):
output_file_name = self.options.output_file_name[0]
logger.info("combine %d pages into %s",... | 29.689655 | 87 | 0.663182 | [
"Apache-2.0"
] | wuan/scan_pdf | src/scan_pdf/combine.py | 861 | Python |
import logging
import unittest
import numpy as np
import pandas as pd
import scipy.stats as stats
import diffxpy.api as de
class _TestPairwiseNull:
noise_model: str
def _prepate_data(
self,
n_cells: int,
n_genes: int,
n_groups: int
):
if self.nois... | 37.649351 | 104 | 0.657641 | [
"BSD-3-Clause"
] | gokceneraslan/diffxpy | diffxpy/unit_test/test_pairwise.py | 5,798 | Python |
__all__ = ['CompilerSanitizer']
from enum import Enum, unique
@unique
class CompilerSanitizer(Enum):
NONE = 'none'
ADDRESS = 'address'
THREAD = 'thread'
UNDEFINED = 'undefined'
MEMORY = 'memory'
| 16.769231 | 31 | 0.66055 | [
"MIT"
] | benoit-dubreuil/template-cpp20-agnostic-build-ci-cd | conf/script/src/build_system/compiler/build_option/sanitizer.py | 218 | Python |
"""pythonic_orcfighter
This is one of the different GameUnits that are used in the desing patterns examples.
:copyright: 2020, Jean Tardelli
:license: The MIT license (MIT). See LICENSE file for further details.
"""
from pythonic_abstractgameunit import AbstractGameUnit
class OrcFighter(AbstractGameUnit):
"""Cr... | 30.3125 | 85 | 0.736082 | [
"MIT"
] | jeantardelli/wargameRepo | wargame/designpatterns/pythonic_orcfighter.py | 485 | Python |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('documents', '0004_uuidfield'),
('meetings', '0009_auto_20170106_1414'),
]
operations = [
... | 26.5 | 150 | 0.656947 | [
"Apache-2.0"
] | ecs-org/ecs | ecs/meetings/migrations/0010_meeting_documents_zip.py | 583 | Python |
import collections
import functools
import itertools
import operator
from contextlib import suppress
from typing import Any, Dict, List
import numpy as np
import toolz
from cached_property import cached_property
import ibis.common.exceptions as com
import ibis.expr.datatypes as dt
import ibis.expr.rules as rlz
import... | 24.984392 | 99 | 0.624954 | [
"Apache-2.0"
] | odidev/ibis | ibis/expr/operations.py | 92,852 | Python |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from .. import _utilities, _tables
from ... | 42.712551 | 325 | 0.645308 | [
"Apache-2.0"
] | pulumi/pulumi-azure-nextgen | sdk/python/pulumi_azure_nextgen/devtestlab/schedule.py | 10,550 | Python |
data = "cqjxjnds"
import string
import re
lc = string.ascii_lowercase
next = dict(zip(lc[:-1], lc[1:]))
three_seq = ["".join(z) for z in zip(lc[:-2], lc[1:-1], lc[2:])]
def check(pw):
if "i" in pw or "o" in pw or "l" in pw:
return False
three_match = False
for seq in three_seq:
if seq in... | 17.865385 | 64 | 0.557589 | [
"MIT"
] | lamperi/aoc | 2015/11/solve.py | 929 | Python |
# Qiwi module advanced usage example v1.00
# 17/05/2021
# https://t.me/ssleg ยฉ 2021
import logging
import qiwi_module
# ะฝะฐัััะพะนะบะฐ ะปะพะณัะปะฐะนะปะฐ test,log, ััะดะฐ ะฑัะดัั ะทะฐะฟะธััะฒะฐัััั ะฒัะต ะพัะธะฑะบะธ ะธ ะฟัะตะดัะฟัะตะถะดะตะฝะธั.
lfile = logging.FileHandler('test.log', 'a', 'utf-8')
lfile.setFormatter(logging.Formatter('%(levelname)s %(modul... | 38.581818 | 112 | 0.780396 | [
"MIT"
] | ssleg/qiwi_module | adv_sample.py | 3,101 | Python |
def estimate_pi_parallel(N, lview, N_per_trial=1E6):
result = lview.map(estimate_pi, [N_per_trial for i in range(N)])
while not result.ready():
print(result.progress)
time.sleep(0.5)
return np.mean(list(result))
estimate_pi_parallel(100, lview)
| 30.444444 | 68 | 0.693431 | [
"BSD-3-Clause"
] | Peshal1067/PythonLectures | solutions/example2.py | 274 | Python |
# -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.base.exchange import Exchange
# -----------------------------------------------------------------------------
try:
basestri... | 47.17664 | 521 | 0.469924 | [
"MIT"
] | TheMagooo/ccxt | python/ccxt/okex.py | 164,036 | Python |
from pipeline import *
class SentenceLimiter:
"""
Limit the text, word boundaries and
sentence boundaries of a given document
to the number of sentences given
"""
def run(self, document, number_sentences):
"""
:param: number_sentences, starts with 0 for the fist sentence
... | 35.076923 | 117 | 0.645468 | [
"MIT"
] | hadyelsahar/RE-NLG-Dataset | pipeline/filter.py | 2,736 | Python |
# Copyright 2021 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, ... | 31.165517 | 77 | 0.669617 | [
"Apache-2.0"
] | luis5tb/networking-bgp-ovn | networking_bgp_ovn/drivers/openstack/utils/frr.py | 4,519 | Python |
# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... | 37.505882 | 111 | 0.754391 | [
"Apache-2.0"
] | shameerb/incubator-airflow | dags/jenkins_dag.py | 3,188 | Python |
# coding: utf-8
"""
FlashBlade REST API
A lightweight client for FlashBlade REST API 2.3, developed by Pure Storage, Inc. (http://www.purestorage.com/).
OpenAPI spec version: 2.3
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import... | 44.544365 | 449 | 0.638331 | [
"BSD-2-Clause"
] | Flav-STOR-WL/py-pure-client | pypureclient/flashblade/FB_2_3/api/link_aggregation_groups_api.py | 18,575 | Python |
# model settings
model = dict(
type='CenterNet',
pretrained='./pretrain/darknet53.pth',
backbone=dict(
type='DarknetV3',
layers=[1, 2, 8, 8, 4],
inplanes=[3, 32, 64, 128, 256, 512],
planes=[32, 64, 128, 256, 512, 1024],
norm_cfg=dict(type='BN'),
out_indices=(1... | 29.59596 | 86 | 0.63959 | [
"Apache-2.0"
] | mrsempress/mmdetection | configs/eftnet/R2_ttf53_whh_3lr_1x.py | 2,930 | Python |
## @package onnx
#Module caffe2.python.onnx.onnxifi
"""
ONNXIFI a Caffe2 net
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from caffe2.proto import caffe2_pb2
from caffe2.python import core, workspace
import ca... | 29.877551 | 85 | 0.602459 | [
"Apache-2.0"
] | JustinBear99/Mask_RCNN | detectron/lib/python3.6/site-packages/caffe2/python/onnx/onnxifi.py | 1,464 | Python |
#!/usr/bin/env python
"""TcEx Framework Validate Module."""
# standard library
import ast
import importlib
import json
import os
import sys
import traceback
from collections import deque
from pathlib import Path
from typing import Dict, Union
# third-party
import colorama as c
# from jsonschema import SchemaError, Va... | 39.400362 | 98 | 0.542186 | [
"Apache-2.0"
] | benjaminPurdy/tcex | tcex/bin/validate.py | 21,749 | Python |
import os
from access import Access
from user import User
log = os.path.dirname(os.path.abspath(__file__)) + "/temp/access.log"
class UserDAO(object):
__database = None
__cursor = None
def __init__(self):
self.__database = Access()
self.__cursor = self.__database.getCursor()
self.... | 36.06383 | 102 | 0.59174 | [
"MIT"
] | saraivaufc/PySpy | database/userDAO.py | 1,695 | Python |
import disnake, youtube_dl
import src.core.embeds as embeds
import src.core.functions as funcs
from disnake.ext import commands
prefix = funcs.get_prefix()
class Music(commands.Cog):
def __init__(self, bot: commands.Bot):
self.bot = bot
@commands.group(invoke_without_command=True, description="Conne... | 37.258503 | 94 | 0.59266 | [
"MIT"
] | Jonak-Adipta-Kalita/JAK-Discord-Bot | src/cogs/commands/music.py | 5,477 | Python |
# -*- coding: utf-8 -*-
#Chucky_Bot
import LINETCR
from LINETCR.lib.curve.ttypes import *
from datetime import datetime
from bs4 import BeautifulSoup
from threading import Thread
from googletrans import Translator
from gtts import gTTS
import time,random,sys,json,codecs,threading,glob,urllib,urllib2,urllib3,re,ast,os,... | 41.510932 | 453 | 0.419462 | [
"MIT"
] | sahrukanja/fryant1 | Chuckysb.py | 148,684 | Python |
# -*- coding: utf-8 -*-
# Copyright (c) 2019, TUSHAR TAJNE and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe import _
class District(Document):
def validate(self):
name = str(self.district.c... | 25.785714 | 51 | 0.759003 | [
"MIT"
] | tushar7724/SPS | sps/sps/doctype/district/district.py | 361 | Python |
def appendAndDelete(s, t, k):
iter=0
s=[]
t=[]
while s:
s.pop(0)
iter+=1
for i in t:
s.append(i)
iter+=1
if iter==k:
print("Yes")
else:
print("No")
| 13.052632 | 29 | 0.362903 | [
"MIT"
] | kasyap1234/codingproblems | append and delete.py | 248 | Python |
from django.db import models
from django.contrib.auth import get_user_model
from django.urls import reverse
from django.utils.translation import gettext_lazy as _
from tinymce import HTMLField
# Create your models here.
User = get_user_model()
class PostView(models.Model):
user = models.ForeignKey... | 33.11828 | 80 | 0.667208 | [
"MIT"
] | zulune/Just-Django-Blog | src/posts/models.py | 3,080 | Python |
import unittest
import os
import numpy as np
from dotenv import load_dotenv
from nlpaug.util import AudioLoader
import nlpaug.augmenter.spectrogram as nas
class TestLoudnessSpec(unittest.TestCase):
@classmethod
def setUpClass(cls):
env_config_path = os.path.abspath(
os.path.join(os.path.d... | 33.382979 | 81 | 0.6297 | [
"MIT"
] | lucidworks/nlpaug | test/augmenter/spectrogram/test_loudness_spec.py | 1,569 | Python |
"""
Create the numpy.core.multiarray namespace for backward compatibility. In v1.16
the multiarray and umath c-extension modules were merged into a single
_multiarray_umath extension module. So we replicate the old namespace
by importing from the extension module.
"""
import functools
import warnings
from . import o... | 32.274235 | 128 | 0.619571 | [
"MIT"
] | 180Studios/LoginApp | venv/lib/python3.7/site-packages/numpy/core/multiarray.py | 50,606 | Python |
from os import environ
from kombu import Queue, Exchange
CELERY_BROKER_URL = environ.get('CELERY_BROKER_URL')
CELERY_RESULT_BACKEND = environ.get('CELERY_RESULT_BACKEND')
CELERY_TIMEZONE = environ.get('TZ', 'UTC')
CELERY_RESULT_PERSISTENT = True
CELERY_TASK_TRACK_STARTED = True
CELERY_TASK_TIME_LIMIT = 30 * 60
CELER... | 24.694444 | 88 | 0.752531 | [
"MIT"
] | SilinAlexander/django-chat | web/src/additional_settings/celery_settings.py | 889 | Python |
# Copyright (c) 2021 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
#
# Unless required by appli... | 34.989324 | 87 | 0.54465 | [
"ECL-2.0",
"Apache-2.0"
] | LemonNoel/PGL | apps/Graph4KG/utils.py | 9,832 | Python |
# Copyright 2018 Contributors to Hyperledger Sawtooth
#
# 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 ... | 44.993421 | 88 | 0.702588 | [
"Apache-2.0"
] | kthblmfld/sawtooth-next-directory | tests/rbac/common/addresser/user_test.py | 6,839 | Python |
import sys, os
import json
from requests import get
sensorID = sys.argv[1]
SupervisorToken = os.environ["SUPERVISOR_TOKEN"]
url = "http://supervisor/core/api/states/"+sensorID
headers = {
"Authorization": "Bearer "+SupervisorToken,
"content-type": "application/json",
}
ha_sensor_data_request = get(url, hea... | 21.7 | 51 | 0.748848 | [
"MIT"
] | PecceG2/HASS-SNMP-Sensors-and-Entities-addon | data/get-sensor-data.py | 434 | Python |
# List the type colors for the editor
AIR = (0, 0, 0)
GRASS = (100, 200, 40)
ROCK = (106, 106, 106)
LAVA = (252, 144, 3)
WATER = (0, 0, 255)
PLAYER = (155, 191, 250)
PLAYER_END = (40, 30, 100)
SPIKE_UP = (204, 24, 24)
SPIKE_DOWN = (166, 8, 8)
# List all the used types
types = ['GRASS', 'ROCK', 'LAVA', 'WATER', 'PLAYER... | 27.052632 | 99 | 0.640078 | [
"MIT"
] | Kronifer/cj8-repo | tools/LevelCreator/ezTypes.py | 514 | Python |
"""
Matrix operations for neuroswarms models.
Author: Joseph Monaco (jmonaco@jhu.edu)
Affiliation: Johns Hopkins University
Created: 2019-05-12
Updated: 2020-11-16
Related paper:
Monaco, J.D., Hwang, G.M., Schultz, K.M. et al. Cognitive swarming in complex
environments with attractor dynamics and oscillatory... | 30.376106 | 81 | 0.621267 | [
"MIT"
] | jdmonaco/neuroswarms | neuroswarms/matrix.py | 6,867 | Python |
# Copyright 2018-2021 Xanadu Quantum 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
# Unless required by applicable law or... | 31.342593 | 136 | 0.550812 | [
"Apache-2.0"
] | Omid-Hassasfar/pennylane | pennylane/ops/qubit/arithmetic_ops.py | 6,771 | 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) AutoRest Code Generator.
# Changes may ... | 48.35 | 134 | 0.70243 | [
"MIT"
] | AFengKK/azure-sdk-for-python | sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/_configuration.py | 3,868 | Python |
from talon import Module, Context
import appscript
mod = Module()
ctx = Context()
ctx.matches = r"""
os: mac
"""
@mod.action_class
class Actions:
def run_shortcut(name: str):
"""Runs a shortcut on macOS"""
pass
@ctx.action_class("user")
class UserActions:
def run_shortcut(name: str... | 17.434783 | 77 | 0.653367 | [
"MIT"
] | palexjo/pokey_talon | code/platforms/mac/user.py | 401 | Python |
# Definition for binary tree with next pointer.
# class TreeLinkNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
# self.next = None
class Solution:
# @param root, a tree link node
# @return nothing
def connect(self, root):
... | 33.625 | 70 | 0.585502 | [
"MIT"
] | Fenghuapiao/PyLeetcode | LeetcodeAlgorithms/116. Populating Next Right Pointers in Each Node/populating-next-right-pointers-in-each-node.py | 538 | Python |
import datetime
from platform import python_version
from six import integer_types, string_types, text_type
class _NO_VALUE(object):
pass
# we don't use NOTHING because it might be returned from various APIs
NO_VALUE = _NO_VALUE()
_SUPPORTED_TYPES = (float, bool, str, datetime.datetime, type(None)) + \
stri... | 26.86747 | 77 | 0.590583 | [
"BSD-3-Clause"
] | kdeyev/mongomock | tests/diff.py | 2,230 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.