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 |
|---|---|---|---|---|---|---|---|---|
from django.contrib import auth
from django.shortcuts import render
from rest_framework import generics, authentication, permissions
from rest_framework.authtoken.views import ObtainAuthToken
from rest_framework.settings import api_settings
from user.serializers import UserSerializer, AuthTokenSerializer
class Cre... | 30.545455 | 66 | 0.772817 | [
"MIT"
] | xemperforya/recipe-app-api | app/user/views.py | 1,008 | 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 ... | 42.123438 | 201 | 0.678734 | [
"MIT"
] | Hamster-Huey/azure-cli-extensions | src/aks-preview/azext_aks_preview/vendored_sdks/azure_mgmt_preview_aks/v2022_03_02_preview/operations/_managed_cluster_snapshots_operations.py | 26,959 | Python |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2019-03-10 12:23
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('gram', '0004_auto_20190310_1510'),
]
operations = [
migrations.AlterField(
... | 21.619048 | 58 | 0.614537 | [
"MIT"
] | viisualworks/instanoir | gram/migrations/0005_auto_20190310_1523.py | 454 | Python |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 35.209424 | 110 | 0.635167 | [
"Apache-2.0"
] | AMS-Kepler/airflow | airflow/providers/databricks/hooks/databricks.py | 13,450 | Python |
import pytorch_lightning as pl
from pytorch_lightning.utilities.parsing import lightning_getattr, lightning_setattr
class MultipleShootingCallback(pl.Callback):
"""This callback increases the length of the training sequences each epoch.
This technique is well known in the SciML community and documented in th... | 43.5 | 90 | 0.715837 | [
"MIT"
] | martenlienen/finite-element-networks | finite_element_networks/lightning/callbacks.py | 3,133 | Python |
import os
import sys
sys.path.append('/trinity/home/m.gasanov/monica/sensitivity/sobol/SALib')
from SALib.analyze import sobol
from SALib.sample import saltelli
from SALib.test_functions import Ishigami
from SALib.util import read_param_file
from numpy import genfromtxt
# Read the parameter range file and generate sa... | 36.472727 | 103 | 0.674477 | [
"Apache-2.0"
] | mishagrol/SA_agro_model | Sobol_SA_horizont/CN/sobol.py | 2,006 | Python |
from .Detector import Detector
import time
import numpy as np
import PyTango
class LC400Buffer(Detector):
"""
Class representing the LC400 piezo machine under the
control of the LC400ScanControl Tango device, used for
reading the flyscan positions.
"""
def __init__(self, name=None, device=No... | 33.852273 | 76 | 0.595166 | [
"MIT"
] | alexbjorling/acquisition-framework | contrast/detectors/LC400Buffer.py | 2,979 | Python |
for tt in range(int(input())):
n = int(input())
ans = 0
arr = list(map(int,input().split()))
freq = dict()
for i in range(n):
arr[i] -= i
if arr[i] not in freq:
freq[arr[i]] = 0
freq[arr[i]] += 1
for i in freq:
ans += freq[i]*(freq[i]-1)//2
... | 22.666667 | 40 | 0.432353 | [
"MIT"
] | mishrakeshav/Competitive-Programming | Code Forces/Round 719/D.py | 340 | Python |
# -*- coding: utf-8 -*-
"""OpenCTI valhalla connector core module."""
import os
import yaml
import time
from typing import Any, Dict, Mapping, Optional
from datetime import datetime
from .knowledge import KnowledgeImporter
from .models import Status
from pycti import OpenCTIConnectorHelper, get_config_variable
from... | 36.157576 | 88 | 0.599397 | [
"Apache-2.0"
] | DEMON1A/connectors | valhalla/src/valhalla/core.py | 5,966 | Python |
from interp_marcs_alpha_v6 import interp_marcs
import numpy as np
import time
input_model_path='/project2/alexji/MARCS'
output_model_path='test-MARCS'
teff_arr = [3200,3300,3400,3500,3600,3700,3800,3900,4000,4250,4500,4750,
5000]
logg_arr = np.arange(0., 5.5, 0.5)
feh_arr = np.arange(-4., 1.5, 0.5)
alphaf... | 36.472222 | 78 | 0.493526 | [
"MIT"
] | alexji/turbopy | turbopy/interp_marcs/testmies.py | 1,313 | Python |
# Copyright (c) 2017-present, Facebook, 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 o... | 48.5625 | 81 | 0.628486 | [
"MIT"
] | Bigwode/FPN-Pytorch | lib/datasets/dummy_datasets.py | 2,331 | Python |
import logging
from django.utils.decorators import method_decorator
from django_filters.rest_framework import DjangoFilterBackend
from drf_yasg.utils import swagger_auto_schema
from rest_condition import Or
from rest_framework import filters, viewsets
from rest_framework.permissions import IsAdminUser, IsAuthenticated... | 37.537313 | 97 | 0.749105 | [
"MIT"
] | System-Design-2/user-service | src/users/views/user.py | 2,515 | Python |
"""
Copyright (c) 2019 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 ... | 38.333333 | 94 | 0.590373 | [
"MIT"
] | 565353780/open-vino | multi_camera_multi_person_tracking/utils/network_wrappers.py | 3,220 | Python |
import carla
from carla import ColorConverter as cc
from ROAR_Sim.carla_client.util.sensors import IMUSensor
from Bridges.bridge import Bridge
from typing import Union
from ROAR.utilities_module.vehicle_models import (
VehicleControl,
Vehicle,
)
from ROAR.utilities_module.data_structures_models import (
Loc... | 36.338798 | 89 | 0.64 | [
"Apache-2.0"
] | Amanda-Chiang/ROAR | Bridges/carla_bridge.py | 6,650 | Python |
import importlib
import inspect
import logging
import os
from app.plugin import Hook, Command
PLUGINS_DIR = 'plugins'
def find_plugins():
"""Returns a list of plugin path names."""
for root, dirs, files in os.walk(PLUGINS_DIR):
for file in files:
if file.endswith('.py'):
... | 31.903846 | 84 | 0.607595 | [
"Apache-2.0"
] | glombard/python-plugin-experiment | app/processor.py | 1,659 | Python |
# -*- coding: utf-8 -*-
# TODO: find unused functions and kill them
import logging
import copy
import operator
import utool as ut
import vtool as vt
import numpy as np
import itertools as it
from functools import partial, reduce
from wbia.expt import cfghelpers
from wbia.expt import experiment_helpers
print, rrr, prof... | 41.211403 | 339 | 0.563803 | [
"Apache-2.0"
] | WildMeOrg/wildbook-ia | wbia/expt/test_result.py | 111,317 | Python |
from neopixel import NeoPixel
from machine import Pin
from time import sleep
from os import urandom
#pin = Pin(14, Pin.OUT)
np = NeoPixel(Pin(2, Pin.OUT), 8)
pin = Pin(14, Pin.IN)
test = 7/10
while True:
can_win = True
if pin.value() == 0:
can_win = False
for i in range(20):
for i in range(0, 8)... | 19.770833 | 72 | 0.523709 | [
"MIT"
] | martilad/MI-PYT2018 | lessons/MicroPython/forbes.py | 949 | Python |
import itertools
preamble = 25
numbers = []
with open('input.txt') as file:
for line in file:
numbers.append(int(line))
print(numbers)
for i in range(preamble, len(numbers)):
pairs = itertools.combinations(numbers[i-preamble: i], 2)
match = False
for pair in pairs:
if sum(pair) == nu... | 21.972222 | 72 | 0.573957 | [
"MIT"
] | phoenix10k/advent-of-code | aoc-2020/python/day-09/main.py | 791 | Python |
#!/usr/bin/env python
"""Tests for `SEIR` package."""
import os
import pytest
from click.testing import CliRunner
from SEIR import cli
@pytest.fixture
def response():
"""Sample pytest fixture.
See more at: http://doc.pytest.org/en/latest/fixture.html
"""
import requests
return requests.get('h... | 22.372549 | 77 | 0.687993 | [
"MIT"
] | sellisd/seir | tests/test_SEIR.py | 1,141 | Python |
# -*- coding: utf-8 -*-
import os
print '-------操作文件和目录-------'
# 操作系统名字
print os.name + '\n'
print '\n' + '详细的系统信息'
print os.uname()
print '\n' + '环境变量'
print os.environ
print '\n' + '获取某个环境变量的值'
print os.getenv('PATH')
print '\n'
# 查看当前目录的绝对路径:
print os.path.abspath('.')
selfAbsPath = os.path.abspath('.')
#... | 18.948718 | 68 | 0.627876 | [
"MIT"
] | PomTTcat/pythonPersonTips | Python/pythonLevel1/python0811_file.py | 1,962 | Python |
import berserk
import chaturanga
token = 'token'
bot_id = 'sultankhan2'
session = berserk.TokenSession(token)
lichess = berserk.Client(session)
for event in lichess.bots.stream_incoming_events():
if event['type'] == 'challenge':
challenge = event['challenge']
if challenge['variant']['key'] == 'st... | 36.480769 | 70 | 0.508698 | [
"MIT"
] | Cheran-Senthil/SultanKhan2 | main.py | 1,897 | Python |
import sys, os, pwd, signal, time
from resource_management import *
from resource_management.core.base import Fail
from resource_management.core.exceptions import ComponentIsNotRunning
from subprocess import call
from impala_base import ImpalaBase
class StateStore(ImpalaBase):
#Call setup.sh to install the service... | 31.789474 | 85 | 0.63521 | [
"Apache-2.0"
] | cas-bigdatalab/ambari-chs | ambari-server/src/main/resources/stacks/HDP/2.5/services/IMPALA/package/scripts/impala-state-store.py | 1,812 | Python |
from django.conf import settings
from django.conf.urls import patterns, include
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from peekaboo.base.monkeypatches import patch
patch()
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatt... | 34.789474 | 75 | 0.681543 | [
"MPL-2.0"
] | mozilla/peekaboo | peekaboo/urls.py | 1,322 | Python |
# Un meșter trebuie să paveze întreaga pardoseală a unei bucătării cu formă
# dreptunghiulară de dimensiune L_1×L_2 centimetri, cu plăci de gresie
# pătrate, toate cu aceeași dimensiune. Știind că meșterul nu vrea să taie nici o
# placă de gresie și vrea să folosească un număr minim de plăci, să se
# determine dimensiu... | 32.26087 | 81 | 0.708895 | [
"MIT"
] | micu01/ProgAlgo | Lab01/lab01_03.py | 773 | Python |
# -*- coding: utf-8 -*- {{{
# vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et:
#
# Copyright 2020, Battelle Memorial Institute.
#
# 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... | 30.948529 | 95 | 0.646947 | [
"Apache-2.0",
"BSD-2-Clause"
] | craig8/volttron | requirements.py | 4,209 | Python |
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
import xml.dom.minidom as minidom
import os
import PIL
import numpy as... | 43.070175 | 132 | 0.544399 | [
"MIT"
] | zjjszj/PS_DM_mydetector_faster_rcnn_pytorch | faster_rcnn/datasets/pascal_voc2.py | 29,460 | Python |
from django.urls import include, path
from rest_framework import routers
from .views import classroom, students, teachers, quizzes
urlpatterns = [
path('', classroom.home, name='home'),
path('quizzes/', quizzes.QuizViewSet.as_view({'get': 'list'}), name='quizzes_list'),
path('students/', include(([
... | 57.2 | 133 | 0.68007 | [
"MIT"
] | mauriciovieira/django-schools | django_school/classroom/urls.py | 1,716 | Python |
#!/usr/bin/env python3
# license removed for brevity
#策略 機械手臂 四點來回跑
import rospy
import os
import numpy as np
from std_msgs.msg import String
from ROS_Socket.srv import *
from ROS_Socket.msg import *
import math
import enum
import .ArmCommand.Hiwin_RT605_Arm_Command as ArmTask
##----Arm state-----------
Arm_state_flag ... | 31.006061 | 145 | 0.578088 | [
"MIT"
] | SamKaiYang/2019_Hiwin_Shaking | src/.history/Test/HiwinRT605_Strategy_test_20190620132725.py | 10,410 | Python |
import argparse
import multiprocessing
import os
import threading
import time
from typing import Any, Tuple, Union, Dict, Optional
from .helper import _get_event, ConditionalEvent
from ... import __stop_msg__, __ready_msg__, __default_host__
from ...enums import PeaRoleType, RuntimeBackendType, SocketType
from ...exce... | 38.984211 | 115 | 0.605778 | [
"Apache-2.0"
] | MaxielMrvaljevic/jina | jina/peapods/peas/__init__.py | 14,814 | Python |
from getpass import getuser
from os.path import abspath, join, exists
from uuid import uuid4
from seisflows.tools import unix
from seisflows.tools.config import ParameterError, SeisflowsParameters, SeisflowsPaths, custom_import
PAR = SeisflowsParameters()
PATH = SeisflowsPaths()
class tiger_md(custom_import('syste... | 26.285714 | 101 | 0.621377 | [
"BSD-2-Clause"
] | chukren/seisflows | seisflows/system/tiger_md.py | 1,104 | Python |
# discover devices
# by clach04 (https://github.com/clach04)
# found at https://github.com/codetheweb/tuyapi/issues/5#issuecomment-348799963
# tested with Python 3.6.4 on Gentoo Linux
import socket
import struct
host_port = 6666
host_ip = '239.255.255.250'
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, so... | 26.466667 | 79 | 0.735516 | [
"Apache-2.0"
] | SDNick484/rectec_status | discover_devices.py | 794 | Python |
#
# Copyright 2018 Quantopian, 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 wr... | 29.196429 | 144 | 0.624159 | [
"Apache-2.0"
] | quantrocket-llc/trading-calendars | trading_calendars/exchange_calendar_cmes.py | 3,270 | Python |
# -*- coding: utf-8 -*-
import xlrd
import pandas as pd
import numpy as np
mirna_sim_path = '../data/miRNA_sim.xlsx'
disease_sim_path = '../data/disease_sim.xlsx'
mirna_disease_ass_path = '../data/miRNA_disease.csv'
mirna_data_dict_path = "../data/mirna_data_dict.npy"
disease_data_dict_path = "../data/disease... | 29.784615 | 85 | 0.642562 | [
"MIT"
] | dayunliu/SMALF | code/get_data.py | 1,936 | Python |
from unittest import TestCase
from family_tree.member import Member
from family_tree import constants
from family_tree.family_tree import FamilyTree
class TestFamilyTree(TestCase):
def setUp(self):
self.ftree = FamilyTree()
def test_add_child(self):
result = self.ftree.add_child("Father", "M... | 34.76699 | 76 | 0.596481 | [
"MIT"
] | Zim95/meet_the_family | tests/integration/test_family_tree.py | 3,581 | 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... | 40.868217 | 80 | 0.519537 | [
"Apache-2.0"
] | 00arun00/tensorflow | tensorflow/python/ops/ragged/ragged_dynamic_partition_op_test.py | 10,544 | Python |
from setuptools import setup
setup(
name="sphinx_rtd_theme_http",
version="1.0.0",
author="Ashley Whetter",
url="https://github.com/AWhetter/sphinx_rtd_theme_http/browse",
py_modules=["sphinx_rtd_theme_http"],
install_requires=[
"sphinx_rtd_theme",
],
classifiers=[
'Fra... | 30.666667 | 67 | 0.607488 | [
"BSD-3-Clause"
] | AWhetter/sphinx_rtd_theme_http | setup.py | 828 | Python |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test BIP65 (CHECKLOCKTIMEVERIFY).
Test that the CHECKLOCKTIMEVERIFY soft-fork activates at (regtest) b... | 36 | 97 | 0.650637 | [
"MIT"
] | ComputerCraftr/devault | test/functional/feature_cltv.py | 9,108 | Python |
"""
Taken from vithursant's repo:
https://github.com/vithursant/MagnetLoss-PyTorch/blob/master/magnet_loss/magnet_loss.py
"""
import numpy as np
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.nn.functional as F
class MagnetLoss(nn.Module):
"""
Magnet loss technique presen... | 40.105932 | 187 | 0.65177 | [
"MIT"
] | jiajunhua/HaydenFaulkner-pytorch.repmet | losses/magnet_loss.py | 9,465 | Python |
# Copyright 2013-2020 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)
from spack import *
class RIca(RPackage):
"""Independent Component Analysis (ICA) using various algorithms: FastICA,... | 43.857143 | 95 | 0.763301 | [
"ECL-2.0",
"Apache-2.0",
"MIT"
] | 0t1s1/spack | var/spack/repos/builtin/packages/r-ica/package.py | 921 | Python |
import collections
import caffe2.python.hypothesis_test_util as hu
import hypothesis.strategies as st
import numpy as np
from caffe2.python import core, dyndep, workspace
from caffe2.quantization.server.dnnlowp_test_utils import check_quantized_results_close
from hypothesis import given
dyndep.InitOpsL... | 35.012195 | 94 | 0.573668 | [
"MIT"
] | Westlanderz/AI-Plat1 | venv/Lib/site-packages/caffe2/quantization/server/gather_dnnlowp_op_test.py | 2,871 | 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... | 34.804688 | 88 | 0.668238 | [
"Apache-2.0"
] | Aakash-2904/addons | setup.py | 4,455 | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import re
import core.pywikibot as pywikibot
from utils import (
SITE_NAMES,
create_links_string,
read_log,
generate_list_page,
)
def main():
site = pywikibot.Site()
for site_name in SITE_NAMES:
page_name, site_regexp, list_page = generate_l... | 30.170213 | 120 | 0.594499 | [
"MIT"
] | MCPN/NPBot | outdated/site_update.py | 1,485 | Python |
from fractions import Fraction
def left_rect(f,x,h):
return f(x)
def mid_rect(f,x,h):
return f(x + h/2)
def right_rect(f,x,h):
return f(x+h)
def trapezium(f,x,h):
return (f(x) + f(x+h))/2.0
def simpson(f,x,h):
return (f(x) + 4*f(x + h/2) + f(x+h))/6.0
def cube(x):
return x*x*x
def reciprocal(x):
re... | 34.267857 | 88 | 0.581032 | [
"MIT"
] | ethansaxenian/RosettaDecode | lang/Python/numerical-integration-1.py | 1,919 | Python |
# -*- coding: utf-8 -*-
import json
import os
from collections import ChainMap
from django.contrib.messages import constants as messages
def bool_from_env(var, default: bool=False) -> bool:
"""Helper for converting env string into boolean.
Returns bool True for string values: '1' or 'true', False otherwise.... | 32.371476 | 104 | 0.674949 | [
"Apache-2.0"
] | p-bo/ralph | src/ralph/settings/base.py | 19,520 | Python |
from OpenGLCffi.GLES3 import params
@params(api='gles3', prms=['index', 'divisor'])
def glVertexAttribDivisorNV(index, divisor):
pass
| 19.571429 | 47 | 0.751825 | [
"MIT"
] | cydenix/OpenGLCffi | OpenGLCffi/GLES3/EXT/NV/instanced_arrays.py | 137 | Python |
# -*- coding: utf-8 -*-
'''
Encapsulate the different transports available to Salt. Currently this is only ZeroMQ.
'''
import salt.payload
import salt.auth
class Channel(object):
@staticmethod
def factory(opts, **kwargs):
# Default to ZeroMQ for now
ttype = 'zeromq'
if 'transport_ty... | 33.453608 | 89 | 0.589522 | [
"Apache-2.0"
] | otrempe/salt | salt/transport/__init__.py | 3,245 | Python |
# Copyright 2019 Xilinx 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, ... | 28.931034 | 74 | 0.771156 | [
"Apache-2.0"
] | guochunhe/Vitis-AI | models/AI-Model-Zoo/VAI-1.3-Model-Zoo-Code/PyTorch/pt_personreid-res18_market1501_176_80_1.1G_1.3/code/network/__init__.py | 839 | Python |
from django.shortcuts import render,redirect
from django.contrib.auth import login, authenticate
from django.contrib.auth.decorators import login_required
from django.urls.base import reverse
import datetime as dt
from .models import Profile,Project,Rating,User
from .forms import *
from .email import send_welcome_email... | 31.705 | 101 | 0.645639 | [
"MIT"
] | MugeraH/Awwards | main/views.py | 6,341 | Python |
from .fsapi_core import *
import time
from xml.dom import minidom
class FSAPI_Node(object):
NAN = -65536
def __init__(self, fsapi_type: str, fsapi_property_alias: str = None, fsapi_set_method_alias: str = None):
self._fsapi_type = fsapi_type
self._fsapi_property_alias = fsap... | 45.368644 | 121 | 0.500607 | [
"MIT"
] | jentz1986/shng-undok-plugin | fsapi/fsapi_node.py | 10,707 | Python |
class TestResults:
def __init__(self, name):
self.name = name
self.results = []
def add_result(self, result):
self.results.append(result) | 24.285714 | 35 | 0.611765 | [
"MIT"
] | nokia-wroclaw/innovativeproject-resttest | src/indor/test_results.py | 170 | Python |
import logging
from logging import config
from distutils.util import strtobool
from pgopttune.utils.logger import logging_dict
from pgopttune.config.postgres_server_config import PostgresServerConfig
from pgopttune.config.tune_config import TuneConfig
from pgopttune.config.workload_sampling_config import WorkloadSampli... | 42.652174 | 116 | 0.734455 | [
"Apache-2.0"
] | ssl-oyamata/postgres_opttune | sampling_workload.py | 1,962 | Python |
from .fhirbase import fhirbase
class ImplementationGuide(fhirbase):
"""
A set of rules of how FHIR is used to solve a particular problem. This
resource is used to gather all the parts of an implementation guide
into a logical whole and to publish a computable definition of all the
parts.
Attr... | 35.31828 | 91 | 0.623211 | [
"MIT"
] | Hector-hedb12/Cardea | cardea/fhir/ImplementationGuide.py | 16,423 | Python |
# Copyright 2015-2015 by Eric Rasche. All rights reserved.
#
# This file is part of the Biopython distribution and governed by your
# choice of the "Biopython License Agreement" or the "BSD 3-Clause License".
# Please see the LICENSE file that should have been included as part of this
# package.
"""Bio.AlignIO support... | 40.089783 | 137 | 0.546915 | [
"BSD-3-Clause"
] | BioinfoCat/biopython | Bio/AlignIO/MauveIO.py | 12,949 | Python |
import logging
import os
import json
import tensorflow as tf
import pandas as pd
import numpy as np
from tqdm import tqdm
import datetime
from pdb import set_trace
from time import sleep
from openpyxl import load_workbook, Workbook
from openpyxl.worksheet.table import Table
from tensorflow.keras.losses import categoric... | 59.392534 | 128 | 0.629793 | [
"MIT"
] | NEGU93/cvnn | cvnn/montecarlo.py | 52,503 | Python |
# -*- coding: utf-8 -*-
from typing import Text
from zerver.lib.test_classes import WebhookTestCase
class DropboxHookTests(WebhookTestCase):
STREAM_NAME = 'test'
URL_TEMPLATE = "/api/v1/external/dropbox?&api_key={api_key}&stream={stream}"
FIXTURE_DIR_NAME = 'dropbox'
def test_file_updated(self) -> No... | 40.896552 | 93 | 0.682968 | [
"Apache-2.0"
] | Romdeau/zulip | zerver/webhooks/dropbox/tests.py | 1,186 | Python |
from typing import Dict, Iterator, List, Optional, Tuple, Union
from ..constant.util import Amount, ItemPointer, Number
from .item_wrapper import item_type
from .other_wrapper import *
__all__ = [
'ItemType', 'Item', 'Empty',
'Accessory', 'EnchantedBook', 'ReforgeStone', 'TravelScroll',
'Bow', 'Sword',
... | 19.423684 | 77 | 0.618886 | [
"MIT"
] | peter-hunt/skyblock | skyblock/object/object.py | 7,381 | Python |
# Copyright 2015 The Oppia 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 applicable ... | 38.850467 | 78 | 0.675487 | [
"Apache-2.0"
] | Himanshu1495/oppia | core/controllers/collection_viewer.py | 4,157 | Python |
"""Tools for converting to other outputs."""
def to_getdist(nested_samples):
"""Convert from anesthetic to getdist samples.
Parameters
----------
nested_samples: MCMCSamples or NestedSamples
anesthetic samples to be converted
Returns
-------
getdist_samples: getdist.mcsamples.MCS... | 31.928571 | 67 | 0.58613 | [
"MIT"
] | Stefan-Heimersheim/anesthetic | anesthetic/convert.py | 894 | Python |
#!/usr/bin/python
from ansible.module_utils.basic import AnsibleModule
def main():
# Define your modules arguments
module_args = dict(
name=dict(type="str", required=True),
new=dict(type="bool", required=False, default=False),
)
# Create an instance of the AnsibleModule class
mo... | 23.5 | 86 | 0.690671 | [
"Apache-2.0"
] | kinther/ansible_course | bonus2/collateral/modules/library/test_module.py | 611 | Python |
# -*- coding: utf-8 -*-
# @Time : 2019/7/18 上午9:54
# @Author : Lart Pang
# @FileName: metric.py
# @Project : MINet
# @GitHub : https://github.com/lartpang
import numpy as np
def cal_pr_mae_meanf(prediction, gt):
assert prediction.dtype == np.uint8
assert gt.dtype == np.uint8
assert prediction.shape ... | 30.807229 | 92 | 0.492374 | [
"MIT"
] | Farzanehkaji/MINet | code/utils/metric.py | 2,605 | Python |
import os
import logging
from typing import Dict, Union
from datetime import timedelta
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import pandas as pd
import mlflow
import torch
import pytorch_lightning as pl
import pprint
pp = pprint.PrettyPrinter(indent=4)
from arnet i... | 42.93808 | 278 | 0.602855 | [
"MIT"
] | ZeyuSun/flare-prediction-smarp | arnet/modeling/learner.py | 13,869 | Python |
import sys
import json
import scrapapps
import scrapping
from textrank import TextRankSentences
import preprocessing
import summ
import textrankkeyword
import bss4
url = sys.argv[1]
# url = request.POST.get('web_link', None)
#web_link = scrapapps.scrap_data(url)
web_link = scrapping.scrap_data(url)
#Get Title
judul... | 19.558559 | 60 | 0.722248 | [
"MIT"
] | piscalpratama/KMSV2 | file/py/result_mashara.py | 2,171 | Python |
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--infile", default=None, type=str, required=True, help="path of input file to preprocess")
parser.add_argument("--outfile", default=None, type=str, required=True,help="output file path")
args = parser.parse_args()
lines=open(args.infile,'r').readl... | 31.375 | 111 | 0.699203 | [
"Apache-2.0"
] | Vaidehi99/OBPE | Fine-tuning/Utility Files/wikiann_preprocessor.py | 502 | Python |
import os
import logging, glob
from pathlib import Path
from functools import reduce, partial
from operator import getitem
from datetime import datetime
# from .logger import setup_logging
# import logger.setup_logging
# from . import logger
from .logger import setup_logging
from .util import read_json, write_json
# pr... | 39.016304 | 142 | 0.630868 | [
"MIT"
] | weinajin/evaluate_multimodal_medical_image_heatmap_explanation | code/utils/parse_config.py | 7,179 | Python |
'''
Scenario discovery utilities used by both :mod:`cart` and :mod:`prim`
'''
from __future__ import (absolute_import, print_function, division,
unicode_literals)
import abc
import enum
import itertools
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.patches as patche... | 28.130597 | 81 | 0.570588 | [
"BSD-3-Clause"
] | brodderickrodriguez/EMA_lite | ema_workbench/analysis/scenario_discovery_util.py | 22,617 | Python |
import sys
import os
from cx_Freeze import setup, Executable
# because of how namespace packages work, cx-freeze isn't finding zope.interface
# the following will import it, find the path of zope, and add a new empty
# file name _init__.py at the /site-packages/python2.7/zope path.
# this was found here:
# https://bit... | 33.703704 | 88 | 0.715385 | [
"MIT"
] | derwolfe/twisted-cxfreeze-example | setup.py | 910 | Python |
# -*- coding: utf-8 -*
'''问卷数据分析工具包
Created on Tue Nov 8 20:05:36 2016
@author: JSong
1、针对问卷星数据,编写并封装了很多常用算法
2、利用report工具包,能将数据直接导出为PPTX
该工具包支持一下功能:
1、编码问卷星、问卷网等数据
2、封装描述统计和交叉分析函数
3、支持生成一份整体的报告和相关数据
'''
import os
import re
import sys
import math
import time
import pandas as pd
import numpy as np
import matplo... | 36.697011 | 156 | 0.537062 | [
"MIT"
] | brightgeng/reportgen | reportgen/questionnaire/questionnaire.py | 121,305 | Python |
# -*- coding: utf-8 -*-
"""Functions for retrieving raw and processed run data"""
from datetime import datetime
from html_table_parser import HTMLTableParser
from utils import convert_numbers
import commands
import vcf
def laneHTML(run, path):
"""Retrieve data from the lane.html page, the data is the general run... | 42.507163 | 144 | 0.527469 | [
"MIT"
] | UMCUGenetics/Trend_Analysis_tool | scripts/upload/data/import_data.py | 14,835 | Python |
"""
Consensus Algorithm for 2 Robots using MLP Model
Scene: Robot 1, Robot 3
Inputs: Mx, My
Outputs: Ux, Uy
"""
import torch
import MLP_Model
import math
import numpy as np
import rclpy
from rclpy.node import Node
from tf2_msgs.msg import TFMessage
from std_msgs.msg import Float32
import time
L = 1
d = 0.5
# load... | 34.22549 | 157 | 0.572615 | [
"MIT"
] | HusseinLezzaik/Consensus-Algorithm-for-2-Mobile-Robots | Real Topology Graph/GNN Model 2/Cyclic Graph/test_n2_robot3.py | 6,982 | Python |
# pylint: disable=missing-docstring
# pylint: disable=unbalanced-tuple-unpacking
import os
from resdk.tests.functional.base import BaseResdkFunctionalTest
class TestUpload(BaseResdkFunctionalTest):
def get_samplesheet(self):
"""Return path of an annotation samplesheet."""
files_path = os.path.no... | 38.418182 | 89 | 0.560288 | [
"Apache-2.0"
] | tristanbrown/resolwe-bio-py | resdk/tests/functional/data_upload/e2e_upload.py | 19,017 | Python |
HUME_UUID = "9cb37270-69f5-4dc0-9fd5-7183da5ffc19"
DEVICE_UUID_1 = "e2bf93b6-9b5d-4944-a863-611b6b6600e7"
DEVICE_UUID_2 = "e2bf93b6-9b5d-4944-a863-611b6b6600e1"
DEVICE_UUID_3 = "e2bf93b6-9b5d-4944-a863-611b6b6600e2"
BASIC_LED_CAPS = {
'uuid': DEVICE_UUID_1,
'name': 'Basic LED',
'category': 1,
'type': 1... | 24.111111 | 54 | 0.589862 | [
"MIT"
] | megacorpincorporated/hint | backend/device/test_defs.py | 434 | Python |
import logging
import pandas as pd
import pyodbc
from django.db import models
from fernet_fields import EncryptedCharField
from datastores.mixins import GetConnectionMixin
from datastores.util import get_query, structure_tables_views
logger = logging.getLogger(__name__)
class AzureDatastore(GetConnectionMixin, mod... | 37.096386 | 105 | 0.624553 | [
"BSD-2-Clause"
] | harry-consulting/SAEF1 | saefportal/datastores/models/azure_datastore.py | 3,079 | Python |
from typing import Dict
import pyarrow as pa
import regex as re
from feast import ValueType
def trino_to_feast_value_type(trino_type_as_str: str) -> ValueType:
type_map: Dict[str, ValueType] = {
"tinyint": ValueType.INT32,
"smallint": ValueType.INT32,
"int": ValueType.INT32,
"int... | 28.839286 | 86 | 0.603406 | [
"Apache-2.0"
] | Agent007/feast | sdk/python/feast/infra/offline_stores/contrib/trino_offline_store/trino_type_map.py | 3,230 | Python |
from psutil import virtual_memory, cpu_freq, disk_usage, cpu_percent, cpu_count, swap_memory
from subprocess import check_output
#from termcolor import colored
from colorhex import colorex, BOLD, BLINKING, UNDERLINE, ITALIC
from time import sleep
from sys import exit
from os import system
CPU_MODEL = check_out... | 44.766234 | 185 | 0.669423 | [
"MIT"
] | devlocalhost/pymonitr | pymn_v6.py | 6,894 | Python |
import signal
import sys
import logging
import decimal
import datetime
from pymysqlreplication import BinLogStreamReader
from pymysqlreplication.row_event import (
DeleteRowsEvent,
UpdateRowsEvent,
WriteRowsEvent,
)
def mysql_stream(conf, mongo, queue_out):
logger = logging.getLogger(__name__)
#... | 36.401869 | 103 | 0.52837 | [
"Apache-2.0"
] | furuiyang0715/mymongo | mymongolib/mysql.py | 4,127 | Python |
#Program to plot a point
from cg_algorithms.circle_algorithms import circle_algorithms
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import sys
import math
import time
def init():
glClearColor(0.0, 0.0, 0.0, 0.0)
gluOrtho2D(-250.0, 250.0, -250.0, 250.0)
def plot_points():
g... | 20.340909 | 61 | 0.697207 | [
"MIT"
] | Siddharths8212376/cg_algorithms | tests/test_circle.py | 895 | Python |
from __future__ import absolute_import, division, print_function
import pytest
pytest.importorskip('numpy')
import dask.array as da
from dask.array.utils import assert_eq as _assert_eq
from dask.core import get_deps
from dask.context import set_options
import numpy as np
# temporary until numpy functions migrated
tr... | 39.060345 | 86 | 0.634591 | [
"MIT"
] | broy-va/SciWorCS | webpage/lib/python3.5/site-packages/dask/array/tests/test_reductions.py | 13,593 | Python |
#!/usr/bin/python
import sdk_common
import yaml
import re
import uuid
import random
import os
import time
# Block in charge of running integration tests (using Docker compose)
class SDKIntegrationTestRunner(sdk_common.BuildStepUsingGradle):
def __init__(self, logger=None):
super(SDKIntegrationTestRunner, ... | 48.259542 | 120 | 0.61373 | [
"Apache-2.0"
] | ARMmbed/mbed-cloud-sdk-java | scripts/sdk_run_integration_tests.py | 6,322 | Python |
#!/usr/bin/env python
import numpy as np
import scipy
from shared_utils import ArrayUtils
class SkellamMetrics:
def __init__(self, x_metrics, y_metrics, y_hat, model, l0, l1, training_values):
self._y = y_metrics
self._y_hat = y_hat
self.model = model
self.l0 = ArrayUtils.convert_t... | 38.524194 | 119 | 0.639941 | [
"Apache-2.0"
] | nathan-bennett/skellam | metrics/__init__.py | 4,777 | Python |
#!/bin/env python
# -*- coding: utf-8 -*-
"""test Queue
by Valentyn Stadnytskyi
created: August 2, 2019
This is a test library to evaluate the performance of the code.
Queue is an abstract data structure, somewhat similar to Stacks.
Unlike stacks, a queue is open at both its ends.
One ... | 36.714286 | 108 | 0.582144 | [
"BSD-3-Clause"
] | rcm2dev/circular_buffer_numpy | circular_buffer_numpy/tests/test_circular_buffer.py | 4,626 | Python |
from __future__ import absolute_import
from contextlib import contextmanager
from mock import Mock, patch
from celery import states
from celery.exceptions import IncompleteStream, TimeoutError
from celery.five import range
from celery.result import (
AsyncResult,
EagerResult,
TaskSetResult,
result_fro... | 32.691877 | 77 | 0.605604 | [
"BSD-3-Clause"
] | sivaprakashniet/push_pull | p2p/lib/python2.7/site-packages/celery/tests/tasks/test_result.py | 23,342 | Python |
from future import standard_library
standard_library.install_aliases()
from builtins import zip
from contextlib import contextmanager
import datetime
import io
import os
import time
import tempfile
import xml.etree.ElementTree as ET
from salesforce_bulk.util import IteratorBytesIO
from sqlalchemy.ext.automap import a... | 39.35723 | 150 | 0.59038 | [
"BSD-3-Clause"
] | davidmreed/CumulusCI | cumulusci/tasks/bulkdata.py | 32,391 | Python |
# 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 ag... | 33.207921 | 79 | 0.699463 | [
"Apache-2.0"
] | KaranToor/MA450 | google-cloud-sdk/.install/.backup/lib/googlecloudsdk/core/diagnostics/diagnostic_base.py | 3,354 | Python |
# -----------------------------------------------------------------------------
# Copyright (c) 2020 Nicolas P. Rougier. All rights reserved.
# Distributed under the (new) BSD License.
# -----------------------------------------------------------------------------
import numpy as np
import hypyp.ext.mpl3d.glm as glm
fr... | 31.3125 | 88 | 0.565314 | [
"BSD-3-Clause"
] | FranckPrts/HyPyP | hypyp/ext/mpl3d/camera.py | 4,511 | Python |
import numpy as np
import os
import pickle
import pytest
import re
import time
import shutil
from copy import deepcopy
from numpy import allclose, isclose
from flare import struc, env, gp
from flare.parameters import Parameters
from flare.mgp import MappedGaussianProcess
from flare.lammps import lammps_calculator
fro... | 31.210269 | 91 | 0.617 | [
"MIT"
] | aaronchen0316/flare | tests/test_mgp.py | 12,765 | Python |
# GENERATED VERSION FILE
# TIME: Fri May 21 12:58:40 2021
__version__ = '0.1.0+62e3868'
short_version = '0.1.0'
version_info = (0, 1, 0)
| 22.833333 | 32 | 0.686131 | [
"Apache-2.0"
] | callzhang/qdtrack | qdtrack/version.py | 137 | Python |
from setuptools import setup, find_packages
import pathlib
here = pathlib.Path(__file__).parent.resolve()
long_description = (here / "README.md").read_text(encoding="utf-8")
setup(
name="conda-store",
version='0.3.8',
url="https://github.com/Quansight/conda-store",
author="Chris Ostrouchov",
desc... | 34.128205 | 67 | 0.637115 | [
"BSD-3-Clause"
] | datalayer-externals/conda-store | conda-store/setup.py | 1,331 | Python |
from PLOI.guidance.base_guidance import BaseSearchGuidance
from PLOI.guidance.no_guidance import NoSearchGuidance
from PLOI.guidance.gnn_guidance import GNNSearchGuidance
| 42.75 | 58 | 0.894737 | [
"MIT"
] | tomsilver/ploi | guidance/__init__.py | 171 | Python |
"""
MTGJSON EnumValues Object
"""
import json
import logging
import pathlib
from typing import Any, Dict, List, Union
from ..compiled_classes.mtgjson_all_printings import MtgjsonAllPrintingsObject
from ..consts import OUTPUT_PATH
from ..utils import sort_internal_lists
from .mtgjson_structures import MtgjsonStructures... | 35.658065 | 87 | 0.564502 | [
"MIT"
] | 0az/mtgjson | mtgjson5/compiled_classes/mtgjson_enum_values.py | 5,527 | Python |
#!/usr/bin/env python3
import sys
import chpl_platform, overrides, third_party_utils
from utils import error, memoize, warning
@memoize
def get():
platform_val = chpl_platform.get('target')
linux = platform_val.startswith('linux64')
osx = platform_val.startswith('darwin')
val = overrides.get('CHPL_UN... | 27.210526 | 81 | 0.626692 | [
"ECL-2.0",
"Apache-2.0"
] | ShreyasKhandekar/chapel | util/chplenv/chpl_unwind.py | 2,068 | Python |
#!/usr/bin/env python3
# Copyright 2020 The Emscripten Authors. All rights reserved.
# Emscripten is available under two separate licenses, the MIT license and the
# University of Illinois/NCSA Open Source License. Both these licenses can be
# found in the LICENSE file.
import json
import os
import re
import shutil
... | 38.581699 | 209 | 0.546586 | [
"MIT"
] | AIEdX/emscripten | tests/benchmark_sse.py | 11,806 | Python |
from django.urls import path, re_path
from .views import *
app_name = 'component'
urlpatterns = [
path('', ComponentListView.as_view(), name='list'),
path('add/', ComponentCreateView.as_view(), name='create'),
re_path(r'^(?P<pk>[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})/$',
... | 58.458333 | 179 | 0.565217 | [
"MIT"
] | iotile/iotile_cloud | server/apps/component/urls.py | 1,403 | Python |
# coding=utf-8
import json
import urllib
import urllib2
from bs4 import BeautifulSoup
def run(bot, chat_id, user, keyConfig='', message='', totalResults=1):
requestText = str(message)
if requestText == '':
totalSteamGames = int(Get_steam_total())
totalGOGGames = int(Get_GOG_total())
... | 46.724138 | 163 | 0.609502 | [
"Apache-2.0"
] | SalamiArmy/TelegramSteamBotForGoogleAppEngine | telegram_commands/getgame.py | 10,840 | Python |
import logging
from typing import Dict, Sequence
from talon import Context, Module, actions
from .user_settings import get_list_from_csv
mod = Module()
ctx = Context()
mod.list("vocabulary", desc="additional vocabulary words")
# Default words that will need to be capitalized.
# DON'T EDIT THIS. Edit settings/words... | 38.654321 | 98 | 0.677579 | [
"MIT"
] | DylanOpet/knausj_talon | code/vocabulary.py | 6,262 | Python |
# coding: utf-8
"""
Decision Lens API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: 1.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
impor... | 26.902439 | 129 | 0.7534 | [
"MIT"
] | dlens/dlxapi | python/test/test_project_attachment_removed_message_payload.py | 1,103 | Python |
#!/usr/bin/env python3
import sys
def gen_freq(freq: float, duration: int):
tmp = 0.0
pri = chr(32)
sec = chr(126)
for i in range(duration):
if (tmp >= freq):
tmp -= freq
pri, sec = sec, pri
tmp += 1.0
print(pri, end='')
sys.stdout.flush()
if __name... | 21 | 50 | 0.528571 | [
"Unlicense"
] | kodo-pp/nplayer | .pake/pkgdir/files/opt/nplayer/gen_freq.py | 420 | Python |
# coding=utf-8
# *** WARNING: this file was generated by pulumigen. ***
# *** 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 . import outpu... | 54.782772 | 454 | 0.694196 | [
"Apache-2.0"
] | sunbing81/pulumi-kubernetes | sdk/python/pulumi_kubernetes/events/v1/outputs.py | 14,627 | Python |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-03-17 21:35
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('UserManagement', '0028_auto_20170316_1206'),
]
operations = [
migrations.Ad... | 23.285714 | 73 | 0.633947 | [
"MIT"
] | SkillSmart/ConferenceManagementSystem | UserManagement/migrations/0029_course_institution_abbr.py | 489 | Python |
import math
t = int(raw_input())
for i in range(t) :
n = int(raw_input())
print math.factorial(n)
'''Why using math.factorial() is faster?
beacuse many of the Python libraries are in C or C++ and not it Python.
Hence the speed improves.'''
| 22.727273 | 74 | 0.684 | [
"MIT"
] | tapaswenipathak/Competitive-Programming | CodeChef/FCTRL2.py | 250 | Python |
"""Models for assessing primal feasibility"""
from __future__ import unicode_literals
from .set import ConstraintSet
from ..nomials import Variable, VectorVariable, parse_subs, NomialArray
from ..keydict import KeyDict
from .. import NamedVariables, SignomialsEnabled
class ConstraintsRelaxedEqually(ConstraintSet):
... | 40.391566 | 79 | 0.633557 | [
"MIT"
] | giserh/gpkit | gpkit/constraints/relax.py | 6,705 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.