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 |
|---|---|---|---|---|---|---|---|---|
#
# Copyright 2014 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 ... | 38.14658 | 88 | 0.571343 | [
"Apache-2.0"
] | Harkishen-Singh/google-maps-services-python | test/test_client.py | 11,711 | Python |
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
... | 44.177419 | 79 | 0.71632 | [
"BSD-3-Clause"
] | vincent-lg/tsunami | src/secondaires/peche/commandes/banc/creer.py | 2,751 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class MybankPaymentTradeFinancingOrderRefundModel(object):
def __init__(self):
self._amount = None
self._biz_no = None
self._currency_value = None
self._ext_info = None
... | 30.107955 | 79 | 0.578411 | [
"Apache-2.0"
] | Anning01/alipay-sdk-python-all | alipay/aop/api/domain/MybankPaymentTradeFinancingOrderRefundModel.py | 5,299 | Python |
"""Plugins for CMS"""
from django.utils.translation import ugettext_lazy as _
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from emencia.django.newsletter.cmsplugin_newsletter import settings
from emencia.django.newsletter.cmsplugin_newsletter.models import SubscriptionFormPlugin
f... | 34.153846 | 88 | 0.698949 | [
"BSD-3-Clause"
] | nephila/djangocms-newsletter | djangocms_newsletter/cmsplugin_newsletter/cms_plugins.py | 1,332 | Python |
import bpy
track = bpy.context.edit_movieclip.tracking.tracks.active
track.color = (0.0, 1.0, 0.0)
track.use_custom_color = True
| 21.666667 | 57 | 0.761538 | [
"Unlicense"
] | 1-MillionParanoidTterabytes/Blender-2.79b-blackened | release/scripts/presets/tracking_track_color/near_plane.py | 130 | Python |
# GENERATED BY KOMAND SDK - DO NOT EDIT
import komand
import json
class Input:
RESOURCEGROUP = "resourceGroup"
SUBSCRIPTIONID = "subscriptionId"
class Output:
VALUE = "value"
class ListVmInput(komand.Input):
schema = json.loads("""
{
"type": "object",
"title": "Variables",
"proper... | 37.224641 | 177 | 0.39752 | [
"MIT"
] | TonyHamil/insightconnect-plugins | azure_compute/komand_azure_compute/actions/list_vm/schema.py | 176,147 | Python |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'potato.settings')
try:
from django.core.management import execute_from_command_line
except Impor... | 28.782609 | 73 | 0.678248 | [
"MIT"
] | aidswidjaja/PotatoBoard | manage.py | 662 | Python |
# coding: utf-8
import logging
import os
import shutil
import sys
import tempfile
import unittest
import pytest
import fiona
logging.basicConfig(stream=sys.stderr, level=logging.INFO)
class UnicodePathTest(unittest.TestCase):
def setUp(self):
tempdir = tempfile.mkdtemp()
self.dir = os.path.jo... | 34.936 | 77 | 0.53973 | [
"BSD-3-Clause"
] | Juanlu001/Fiona | tests/test_unicode.py | 4,392 | Python |
from setuptools import setup, find_packages
__author__ = 'Giulio Rossetti'
__license__ = "BSD 2 Clause"
__email__ = "giulio.rossetti@gmail.com"
# Get the long description from the README file
# with open(path.join(here, 'README.md'), encoding='utf-8') as f:
# long_description = f.read()
setup(name='demon',
... | 36.977778 | 109 | 0.615385 | [
"BSD-2-Clause"
] | KDDComplexNetworkAnalysis/DEMON | setup.py | 1,664 | Python |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
import logging
import unittest
from ml.rl.models.example_sequence_model import ExampleSequenceModel
from ml.rl.test.models.test_utils import check_save_load
logger = logging.getLogger(__name__)
class TestExampleSequence... | 30.766667 | 87 | 0.713976 | [
"BSD-3-Clause"
] | MisterTea/BlueWhale | ml/rl/test/models/test_sequence_model.py | 923 | Python |
from rest_framework import serializers
from apps.currency.models import Currency
class CurrencyWalletSerializer(serializers.ModelSerializer):
actual_nonce = serializers.SerializerMethodField("get_nonce")
def get_nonce(self, wallet):
return wallet.nonce
class Meta:
from apps.wallet.model... | 27.142857 | 81 | 0.620175 | [
"MIT"
] | ecoo-app/ecoo-backend | apps/currency/serializers.py | 1,140 | Python |
# --------------------------------------------------------
# Deformable Convolutional Networks
# Copyright (c) 2017 Microsoft
# Copyright (c) 2019 IBM Corp
# Licensed under The Apache-2.0 License [see LICENSE for details]
# Written by Haozhi Qi
# --------------------------------------------------------
import cPickle
... | 84.961203 | 180 | 0.616405 | [
"Apache-2.0"
] | chi3x10/RepMet | fpn/symbols/resnet_v1_101_fpn_dcn_rcnn.py | 87,595 | Python |
from . import GB, HDB
from typing import Literal
class Client:
def __init__(self, t: Literal["gb", "hbba", "dbba"]):
self.type = t
def create(self):
if self.type == "gb":
return GB()
elif self.type == "hb":
return HDB("hbba")
elif self.type == "db":
... | 21.75 | 57 | 0.511494 | [
"Apache-2.0"
] | Lasx/gb688_downloader | standard/client.py | 348 | Python |
import sys
from CGMFtk import histories as fh
if __name__ == "__main__":
hist = fh.Histories(sys.argv[1])
print(len(hist.getFissionHistories()))
| 22 | 42 | 0.714286 | [
"MIT"
] | beykyle/omp-uq | analysis/tools/count_histories.py | 154 | Python |
# -*- coding: utf-8 -*-
# Copyright (c) 2022, bahaa and Contributors
# See license.txt
from __future__ import unicode_literals
# import frappe
import unittest
class TestAlaqoal(unittest.TestCase):
pass
| 18.636364 | 44 | 0.756098 | [
"MIT"
] | bahaaabed/AumAlqura | calender/calender/doctype/alaqoal/test_alaqoal.py | 205 | Python |
# <a href="https://colab.research.google.com/github/couyang24/general_learning-tiffany/blob/master/Titanic/analysis/colab_titanic_main.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Need to mount Drive on or upload kaggle.json
from google.colab ... | 26.425197 | 252 | 0.674762 | [
"Apache-2.0"
] | couyang24/general_learning | Titanic/analysis/colab_titanic_main.py | 6,712 | Python |
# Generated by Django 2.1.3 on 2018-11-24 07:01
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Job',
fields=[
('id', models.AutoField(auto... | 24.043478 | 114 | 0.56962 | [
"MIT"
] | muhammadh-s/web-portfolio | jobs/migrations/0001_initial.py | 553 | Python |
import os
import pandas as pd
import re
def sort_human(l):
"""Sort a list of strings by numerical."""
def convert(text): return float(text) if text.isdigit() else text
def alphanum(key): return [convert(c)
for c in re.split('([-+]?[0-9]*\.?[0-9]*)', key)]
l.sort(key=alp... | 34.240964 | 81 | 0.54715 | [
"MIT"
] | multimodalspectroscopy/hypothermia-bayescmd | results_processing/ABC/csv_processing.py | 2,842 | Python |
#! /usr/bin/enc python
# -*- coding: utf-8 -*-
# author: Irving He
# email: 1910646@tongji.edu.cn
import logging
import argparse
import os
import random
import numpy as np
from tqdm import tqdm
import datetime
from datetime import timedelta
import torch
import torch.distributed as dist
from Data_utils import get_l... | 33.665158 | 117 | 0.620699 | [
"MIT"
] | HzcIrving/DLRL-PlayGround | VIT/Train.py | 7,578 | Python |
"""
Django settings for hiren project.
Generated by 'django-admin startproject' using Django 1.8.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build paths ... | 26.16129 | 80 | 0.663132 | [
"MIT"
] | pyprism/Hiren-Git-Commit-Management | hiren/settings.py | 4,055 | Python |
__author__ = "Stefan Weißenberger and Johannes Gasteiger"
__license__ = "MIT"
import os
import numpy as np
from scipy.linalg import expm
import torch
from torch_geometric.data import Data, InMemoryDataset
from torch_geometric.datasets import Planetoid, Amazon, Coauthor
from seeds import development_seed... | 33.376947 | 98 | 0.589696 | [
"MIT"
] | gasteigerjo/gdc | data.py | 10,715 | Python |
"""This contains all of the model filters used by the Shepherd application."""
# Django & Other 3rd Party Libraries
import django_filters
from crispy_forms.bootstrap import (
Accordion,
AccordionGroup,
InlineCheckboxes,
PrependedText,
)
from crispy_forms.helper import FormHelper
from crispy_forms.layou... | 33.952941 | 126 | 0.580388 | [
"BSD-3-Clause"
] | DemanNL/Ghostwriter | ghostwriter/shepherd/filters.py | 5,772 | Python |
# Copyright 2018 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 agre... | 35.577808 | 115 | 0.588924 | [
"MIT"
] | MattePalte/Bugs-Quantum-Computing-Platforms | artifacts/old_dataset_versions/minimal_commits/pennylane/pennylane#385/after/test_tf.py | 26,292 | Python |
from django import forms
from utilities.forms import BootstrapMixin, ExpandableIPAddressField
__all__ = (
'IPAddressBulkCreateForm',
)
class IPAddressBulkCreateForm(BootstrapMixin, forms.Form):
pattern = ExpandableIPAddressField(
label='Address pattern'
)
| 20 | 68 | 0.764286 | [
"Apache-2.0"
] | AS207960/netbox | netbox/ipam/forms/bulk_create.py | 280 | Python |
# Version of the library that will be used to upload to pypi
__version__ = "0.28.0.dev0"
# Git tag that will be checked to determine whether to trigger upload to pypi
__release_tag__ = None
| 31.833333 | 77 | 0.769634 | [
"Apache-2.0"
] | AKIRA-natsu/ml-agents | gym-unity/gym_unity/__init__.py | 191 | Python |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for L{twisted.web.distrib}.
"""
from os.path import abspath
from xml.dom.minidom import parseString
try:
import pwd
except ImportError:
pwd = None
from zope.interface.verify import verifyObject
from twisted.python import filep... | 34.636364 | 83 | 0.61308 | [
"MIT"
] | 12123ads/learn_python3_spider | stackoverflow/venv/lib/python3.6/site-packages/twisted/web/test/test_distrib.py | 18,288 | Python |
from datetime import datetime
from chess_game.daos.player_dao import PlayerDao
from chess_game.models.player import Player
def test_player_dao_init(mongo_database):
player_dao = PlayerDao(mongo_database)
assert mongo_database == player_dao._mongo_database
def test_dao_create_and_find_player(mongo_database)... | 31.432432 | 88 | 0.736028 | [
"MIT"
] | jrj92280/python-eve-backend | test/integration/daos/test_player_dao.py | 1,163 | Python |
import pathlib
from setuptools import setup
here = pathlib.Path(__file__).parent.resolve()
# Get the long description from the README file
long_description = (here / "README.md").read_text(encoding="utf-8")
setup(
name="MCsniperPY",
version="0.20.6",
description="Minecraft name sniper writte... | 33.733333 | 75 | 0.652174 | [
"MIT"
] | tropicbliss/MCsniperPY | setup.py | 1,012 | Python |
from typing import List
class Solution:
def minPathSum(self, grid: List[List[int]]) -> int:
m = len(grid)
if m == 0:
return 0
if m == 1:
return sum(grid[0])
n = len(grid[0])
dp = [[0] * n for _ in range(m)]
for x in range(n):
... | 24.527778 | 75 | 0.383918 | [
"MIT"
] | Sanster/LeetCode | 064_minimum_path_sum.py | 883 | Python |
'''
This module hooks fast.ai Learners to Weights & Biases through a callback.
Requested logged data can be configured through the callback constructor.
Examples:
WandbCallback can be used when initializing the Learner::
```
from wandb.fastai import WandbCallback
[...]
learn = Learner(... | 37.944206 | 120 | 0.575274 | [
"Apache-2.0"
] | MPGek/client | wandb/fastai/__init__.py | 8,841 | Python |
import os
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext
from Cython.Distutils import build_ext
import numpy as np
from os.path import join as pjoin
from setup_cuda import cuda_setup
mpi_compile_args = os.popen("mpic++ --showme:compile").read().strip().split(' ')
mpi_link_ar... | 33.333333 | 80 | 0.587895 | [
"MIT"
] | NinaHerrmann/muesli2py | swig_muesli/muesli/da/setup_da.py | 1,900 | Python |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import numpy as np
from sklearn.decomposition import PCA
from reco_utils.dataset.download_utils import maybe_download
from IPython import embed
def length_normalize(matrix):
"""Length normalize the matrix
Args:
... | 24.977778 | 78 | 0.685943 | [
"MIT"
] | 154King154/recommenders | reco_utils/recommender/geoimc/geoimc_utils.py | 1,124 | Python |
from common import IssueProcess, Common
from typing import Any, List
import os
# assignee dict which will be assigned to handle issues
_GO_OWNER = {'ArcturusZhang'}
# 'github assignee': 'token'
_ASSIGNEE_TOKEN_GO = {'ArcturusZhang': os.getenv('AZURESDK_BOT_TOKEN')}
class IssueProcessGo(IssueProcess):
pass
cla... | 25.48 | 72 | 0.744113 | [
"MIT"
] | AFengKK/azure-sdk-for-python | scripts/release_helper/go.py | 637 | Python |
from airflow.hooks.base_hook import BaseHook
class AzureBlobStorageCredentials(BaseHook):
def __init__(self, conn_id="azure_blob_storage_default"):
self.conn_id = conn_id
def get_credentials(self):
connection_object = self.get_connection(self.conn_id)
extras = connection_object.extra_... | 33.052632 | 67 | 0.710191 | [
"Apache-2.0"
] | FHoffmannCode/dbnd | modules/dbnd-airflow/src/dbnd_airflow_contrib/credentials_helper_azure.py | 628 | Python |
# Generated by Django 3.2.3 on 2021-05-19 08:50
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0002_auto_20210519_0849'),
]
operations = [
migrations.AlterField(
model_name='profile',
name='year',
... | 27.052632 | 183 | 0.589494 | [
"MIT"
] | EricLiclair/testapi | api/migrations/0003_alter_profile_year.py | 514 | Python |
# -*- coding: utf-8 -*-
import io
import sys
import textwrap
from itertools import chain
from pprint import pprint
import pytest
import canmatrix.canmatrix
import canmatrix.formats.sym
def test_colliding_mux_values():
f = io.BytesIO(
textwrap.dedent(
'''\
FormatVersion=5.0 // Do ... | 27.8175 | 119 | 0.560528 | [
"BSD-2-Clause"
] | AjinkyaPasalkar/canmatrix | src/canmatrix/tests/test_sym.py | 11,127 | Python |
#!/usr/bin/env python
import rospy
from apriltag_ros.msg import AprilTagDetectionArray
from apriltag_ros.msg import AprilTagDetection
from find_object_2d.msg import ObjectsStamped
import tf
import geometry_msgs.msg
objFramePrefix_ = "object"
distanceMax_ = 0.0
def callback(data):
global objFramePrefix_
global... | 41.744681 | 133 | 0.646789 | [
"BSD-3-Clause"
] | BrainGardenAI/rtabmap_ros | scripts/objects_to_tags.py | 1,962 | Python |
from django.forms.utils import flatatt
from django.utils.html import format_html, format_html_join
from django.utils.translation import gettext as _
from wagtail.core import blocks
from wagtail.core.blocks import PageChooserBlock
from wagtail.images.blocks import ImageChooserBlock
from wagtailmarkdown.utils import ren... | 38.086538 | 314 | 0.639611 | [
"BSD-2-Clause"
] | edmoss345/iogt | home/blocks.py | 7,922 | Python |
class Solution:
def longestCommonSubsequence(self, text1: str, text2: str) -> int:
'''
#最长连续公共子串
l1=len(text1)
l2=len(text2)
if l1==0 or l2==0:
return 0
dp = [[0 for i in range(l2)] for i in range(l1)]
res = 0
if text1[0]==text2[0]:
... | 27.225 | 119 | 0.435721 | [
"Apache-2.0"
] | Rylie-W/LeetRecord | DP/Leetcode1143.py | 2,248 | Python |
from __future__ import print_function
import torch
from torch import nn
import numpy as np
import torch.nn.functional as F
from torch.autograd import Variable
from constant import *
from torch.nn.utils.rnn import pack_padded_sequence
class EncoderGRU(nn.Module):
def __init__(self,
vocab_size,emb_dim... | 43.422886 | 151 | 0.635655 | [
"MIT"
] | thunlp/AMNRE | CNN/src/models.py | 8,728 | Python |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@File : utils_node.py
@Time : 2022/03/08 14:35:13
@Author : Jianwen Chen
@Version : 1.0
@Contact : chenjw48@mail2.sysu.edu.cn
@License : (C)Copyright 2021-2022, SAIL-Lab
'''
######################################## import area ######################... | 37.331658 | 133 | 0.63481 | [
"MIT"
] | jcchan23/SAIL | Repeat/CoMPT/utils_node.py | 7,429 | Python |
from djangocms_style.cms_plugins import StylePlugin
from cms.plugin_pool import plugin_pool
from django.utils.translation import gettext_lazy as _
from .models import TaccsiteSection
# Plugins
@plugin_pool.register_plugin
class TaccsiteSectionPlugin(StylePlugin):
"""
Patterns > "Section" Plugin
https://... | 28.119048 | 101 | 0.58171 | [
"BSD-2-Clause"
] | tacc-wbomar/Core-CMS-Plugin-Section | djangocms_tacc_section/cms_plugins.py | 1,181 | Python |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from .models import Location,Category,Image
# Register your models here.
admin.site.register(Location)
admin.site.register(Category)
admin.site.register(Image)
class Image(admin.ModelAdmin):
search_fields = ('image_... | 23.571429 | 43 | 0.778788 | [
"MIT"
] | leigh90/TheLumiere | shots/admin.py | 330 | Python |
# -*- coding: utf-8 -*-
"""
Authors: Tim Hessels
Module: Collect/SRTM
Description:
This module downloads DEM data from http://earlywarning.usgs.gov/hydrodata/.
Use the DEM functions to download and create DEM images in Gtiff format.
Examples:
from pyWAPOR.Collect import SRTM
SRTM.DEM(Dir='C:/TempDEM4/', latlim=[29, ... | 20.95 | 76 | 0.711217 | [
"Apache-2.0"
] | DHI-GRAS/wapor-et-look | pyWAPOR/Collect/SRTM/__init__.py | 419 | Python |
"""
Selects a matplotlib backend so you can run without a GUI/tkinter. Supports:
- PyQt5
- PySide2
- WX
- Tkinter
"""
from pyNastran.gui import IS_DEV
if IS_DEV:
# there is no interactive backend when testing on TravisCI
matplotlib_backend = 'Agg'
else:
# fails if using the terminal and PyQt/PySide & ... | 28.965517 | 77 | 0.642857 | [
"BSD-3-Clause"
] | 214929177/pyNastran | pyNastran/gui/matplotlib_backend.py | 840 | Python |
# The new config inherits a base config to highlight the necessary modification
_base_ = '../retinanet_r50_fpn_1x_coco.py'
# We also need to change the num_classes in head to match the dataset's annotation
model = dict(
pretrained=None,
)
# Modify dataset related settings
dataset_type = 'COCODataset'
classes = (... | 37.493976 | 117 | 0.54563 | [
"Apache-2.0"
] | tuanphan09/mmdetection | configs/retinanet/traffic_sign/retinanet_r50_fpn_1x_traffic_sign.py | 3,151 | Python |
#!/usr/bin/env python
# Copyright 1996-2019 Cyberbotics 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/LICENSE-2.0
#
# Unless required by applica... | 40.943182 | 120 | 0.611157 | [
"Apache-2.0"
] | junjihashimoto/webots | tests/sources/test_header_version.py | 3,603 | Python |
import sys, imp, atexit, os
sys.path.append("/home/courses/cs3214/software/pexpect-dpty/");
import pexpect, shellio, signal, time, os, re, proc_check
# Determine the path this file is in
thisdir = os.path.dirname(os.path.realpath(__file__))
#Ensure the shell process is terminated
def force_shell_termination(shell_pr... | 34.714286 | 120 | 0.687243 | [
"MIT"
] | mikefeneley/school | Systems/esh-spring-2015.git/src/plugins/systemInfo_test.py | 1,458 | Python |
import os
import numpy as np
import pandas as pd
from sklearn.datasets.samples_generator import make_swiss_roll
import torch
import torchvision
from torchvision import transforms
import glob
import random
import config as cfg
import utils.metadata as meta
from . import csv_loader
from . import img_loader
# Datasets
#... | 31.571429 | 96 | 0.639106 | [
"MIT"
] | bfortuner/machine-learning | utils/datasets.py | 7,293 | Python |
#!/usr/bin/env python
import sys
import subprocess
try:
import gtk
except:
print >> sys.stderr, "You need to install the python gtk bindings"
sys.exit(1)
# import vte
try:
import vte
except:
error = gtk.MessageDialog (None, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK,
'You need to install... | 27.325843 | 153 | 0.576891 | [
"MIT"
] | sylvainmouquet/multipleterm | multipleterm.py | 2,432 | Python |
import torch
import numpy as np
import torch.utils.data
from net import SurnameLSTM
from data import SurnameDataset
if __name__ == '__main__':
net = SurnameLSTM()
state_dict = torch.load('model.pth')
net.load_state_dict(state_dict)
dataset = SurnameDataset(subset='val')
data_loader = torch.utils.d... | 36.21875 | 113 | 0.670406 | [
"MIT"
] | linkinpark213/pytorch-lstm-toy | test.py | 1,159 | Python |
__all__ = ['read_cif','cif_site_labels']
from ase.io import read
from ase.spacegroup import spacegroup
import sys
import os
import logging
from math import *
import numpy as np
import pkg_resources
import warnings
warnings.filterwarnings("ignore")
path = '.temp_files/'
filepath = pkg_resources.resource_filename(__na... | 29.632212 | 99 | 0.532814 | [
"MIT"
] | cwaitt/zse | cif_tools.py | 12,327 | Python |
# -*- coding: utf-8 -*-
#
# Copyright 2018 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | 43.980583 | 161 | 0.634216 | [
"Apache-2.0"
] | Abd-Elrazek/google-cloud-python | texttospeech/google/cloud/texttospeech_v1beta1/gapic/text_to_speech_client.py | 13,590 | Python |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2019-03-18 04:04
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wildlifecompliance', '0146_auto_20190308_1626'),
]
operations = [
migration... | 27.666667 | 162 | 0.628227 | [
"Apache-2.0"
] | Djandwich/wildlifecompliance | wildlifecompliance/migrations/0147_returntype_return_type.py | 581 | Python |
from python_dwd.additionals.functions import check_parameters, retrieve_time_resolution_from_filename,\
retrieve_parameter_from_filename, retrieve_period_type_from_filename, determine_parameters
from python_dwd.enumerations.period_type_enumeration import PeriodType
from python_dwd.enumerations.time_resolution_enume... | 53.289474 | 119 | 0.788148 | [
"MIT"
] | ikamensh/python_dwd | tests/additionals/test_functions.py | 2,025 | Python |
# Copyright 2012-2019 The Meson development team
# 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... | 46.847044 | 197 | 0.609497 | [
"Apache-2.0"
] | tolnaisz/meson | mesonbuild/interpreter.py | 222,664 | Python |
# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE
import pytest # noqa: F401
import numpy as np # noqa: F401
import cupy as cp # noqa: F401
import awkward as ak # noqa: F401
def test_num_1():
content = ak.Array(
["one", "two", "three", "four", "five", "six", "se... | 36.258242 | 88 | 0.54387 | [
"BSD-3-Clause"
] | colesbury/awkward-1.0 | tests-cuda/test_0345-cuda-num.py | 6,599 | Python |
from kfp.components import create_component_from_func, InputPath, OutputPath
def keras_convert_hdf5_model_to_tf_saved_model(
model_path: InputPath('KerasModelHdf5'),
converted_model_path: OutputPath('TensorflowSavedModel'),
):
'''Converts Keras HDF5 model to Tensorflow SavedModel format.
Args:
... | 39.058824 | 182 | 0.734187 | [
"Apache-2.0"
] | 9rince/kfp | components/_converters/KerasModelHdf5/to_TensorflowSavedModel/component.py | 1,328 | Python |
import logging
from croncierge import cmd_services
def log_cmd(cmd_response):
logging.info(f"Command response:\n{cmd_response}")
def test_cmd_stdout():
cmd = "python3 /home/maxim/projects/celecron/tests/test_croncierge/debug_cmd.py"
log_cmd(cmd_services.run_cmd(cmd))
def test_cmd_stderr():
cmd = "p... | 25.272727 | 84 | 0.717626 | [
"Apache-2.0"
] | mburdeev/croncierge | tests/test_croncierge/test_cmd_services.py | 556 | Python |
from datetime import timedelta
import pytest
from django.utils import timezone
from electeez_auth.models import User
@pytest.mark.django_db
def test_otp(client):
user = User.objects.create(email='otp@example.com')
token = user.otp_new(redirect='valid')
response = client.post(token.path)
assert respo... | 25.846154 | 60 | 0.696429 | [
"MIT"
] | Joneswn/Baloti | electeez_auth/test_otp.py | 672 | Python |
import sys
from query_common import filter_records, ProjectMixins
from redcap import Project # note this is from PyCap.redcap
from typing import List
"""
This class of functions are responsible of retrieving relevant data structures from the CNFUN tables
"""
class CNFUN_project(ProjectMixins):
"""
One baby ... | 32.44186 | 110 | 0.650538 | [
"MIT"
] | CNBP/RCAPI | query_CNFUN.py | 2,790 | Python |
from user import User
__all__ =[
"User"
] | 9.2 | 21 | 0.630435 | [
"MIT"
] | WuraLab/wuralab.github.io | pilot/__init__.py | 46 | Python |
# coding: utf-8
"""
ESP Documentation
The Evident Security Platform API (version 2.0) is designed to allow users granular control over their Amazon Web Service security experience by allowing them to review alerts, monitor signatures, and create custom signatures.
OpenAPI spec version: v2_sdk
Ge... | 25.091371 | 230 | 0.539146 | [
"MIT"
] | EvidentSecurity/esp-sdk-python | esp_sdk/models/role.py | 4,943 | Python |
import pandas as pd
import numpy as np
import wave
from scipy.io import wavfile
import os
import librosa
import pydub
import ffmpeg
from librosa.feature import melspectrogram
import warnings
from sklearn.utils import shuffle
from sklearn.utils import class_weight
from PIL import Image
import sklearn
import tensorflow ... | 39.045802 | 148 | 0.714761 | [
"Apache-2.0"
] | kimhyuns91/bird_call | import_and_model.py | 5,115 | Python |
# coding: utf-8
"""
Wavefront REST API
<p>The Wavefront REST API enables you to interact with Wavefront servers using standard REST API tools. You can use the REST API to automate commonly executed operations such as automatically tagging sources.</p><p>When you make REST API calls outside the Wavefront REST ... | 30.243902 | 409 | 0.726613 | [
"Apache-2.0"
] | PowerOlive/python-client | test/test_dashboard.py | 1,240 | Python |
# coding: utf-8
"""Webmail tests."""
from __future__ import unicode_literals
import os
import shutil
import tempfile
try:
import mock
except ImportError:
from unittest import mock
from six import BytesIO
from django.core import mail
from django.urls import reverse
from modoboa.admin import factories as ad... | 39.392473 | 762 | 0.600792 | [
"MIT"
] | modoboa/modoboa-webmail | modoboa_webmail/tests/test_views.py | 14,655 | Python |
# -*- coding: utf-8 -*-
"""
General description
-------------------
This example illustrates the effect of activity_costs.
There are the following components:
- demand_heat: heat demand (constant, for the sake of simplicity)
- fireplace: wood firing, burns "for free" if somebody is around
- boiler: gas f... | 27.387755 | 74 | 0.554024 | [
"MIT"
] | Bachibouzouk/oemof-examples | oemof_examples/oemof.solph/v0.4.x/activity_costs/activity_costs.py | 2,684 | Python |
# Copyright (c) 2019 Graphcore Ltd. All rights reserved.
import numpy as np
import popart
import torch
import pytest
from op_tester import op_tester
def test_and(op_tester):
d1 = (np.random.randn(2) > 0).astype(np.bool_)
d2 = (np.random.randn(2) > 0).astype(np.bool_)
def init_builder(builder):
i1... | 27 | 61 | 0.61745 | [
"MIT"
] | gglin001/popart | tests/integration/operators_test/boolean_test.py | 4,023 | Python |
#!/bin/env python
""" Module to display weather info on polybar """
# -*- coding: utf-8 -*-
import argparse
import datetime
import logging
import os
import time
import requests
import importlib
# pylint: disable=redefined-builtin
from requests import ConnectionError
from requests.exceptions import HTTPError, Timeou... | 27.059406 | 94 | 0.662642 | [
"BSD-3-Clause"
] | NearHuscarl/dotfiles | .config/polybar/weather/weather.py | 5,497 | Python |
#!/usr/bin/env python3
import sys
import argparse
import time
import socket
from socket import socket as Socket
def main():
# Command line arguments. Use a server_port > 1024 by default so that we can run
# server without sudo.
parser = argparse.ArgumentParser()
parser.add_argument('--server-po... | 28.881579 | 84 | 0.653759 | [
"CC0-1.0"
] | akshayrb22/Kurose-and-Ross-socket-programming-exercises | ping/ping.py | 2,195 | Python |
matrix_a = [[1,2,3], [4,5,6]]
result = [ [ element for element in t] for t in zip(*matrix_a)]
print(result) | 35.666667 | 63 | 0.635514 | [
"MIT"
] | caru1613/introduction_to_python_TEAMLAB_MOOC | lab_assignment/lab_bla/linux_mac/sample/matrix_transpose.py | 107 | Python |
from unittest import TestCase
import os.path as osp
from datumaro.components.format_detection import (
FormatDetectionConfidence, FormatRequirementsUnmet, apply_format_detector,
)
from datumaro.util.test_utils import TestDir
from tests.requirements import Requirements, mark_requirement
class FormatDetectionTest... | 38.207921 | 79 | 0.671029 | [
"MIT"
] | TOsmanov/datumaro | tests/test_format_detection.py | 7,718 | Python |
#!/usr/bin/env python
import re
import time
from tools.multiclass_shared import prepare_data
# run with toy data
[traindat, label_traindat, testdat, label_testdat] = prepare_data()
# run with opt-digits if available
#[traindat, label_traindat, testdat, label_testdat] = prepare_data(False)
parameter_list = [[traindat,... | 31.655556 | 180 | 0.703054 | [
"BSD-3-Clause"
] | neroangelo296/shogun | examples/undocumented/python/classifier_multiclass_ecoc.py | 2,849 | Python |
# Import dependencies
# Math/Torch
import numpy as np
import torch.nn as nn
# Typing
from typing import List
# Instantiate class
class MRR(nn.Module):
"""Compute MRR metric (Mean reciprocal rank)"""
def __init__(self, max_rank = 10):
super(MRR, self).__init__()
# Set max mrr rank
se... | 32.447059 | 130 | 0.603698 | [
"MIT",
"Apache-2.0",
"BSD-3-Clause"
] | platiagro/tasks | tasks/retriever/mrr.py | 2,758 | Python |
#
# 1573. Number of Ways to Split a String
#
# Q: https://leetcode.com/problems/number-of-ways-to-split-a-string/
# A: https://leetcode.com/problems/number-of-ways-to-split-a-string/discuss/830433/Javascript-Python3-C%2B%2B-solutions
#
class Solution:
def numWays(self, S: str, MOD = int(1e9 + 7)) -> int:
N... | 39.275862 | 124 | 0.543459 | [
"MIT"
] | claytonjwong/leetcode-py | 1573_number_ways_to_split_string.py | 1,143 | Python |
"""
WSGI config for kongoauth project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SE... | 23.294118 | 78 | 0.787879 | [
"MIT"
] | AppointmentGuru/AuthenticationGuru | kongoauth/wsgi.py | 396 | Python |
# -:- coding:utf8 -:-
import base64
import hmac
import json
import sys
import time
import urllib
import uuid
from hashlib import sha1
import requests
from flask import current_app
from werkzeug.local import LocalProxy
DEFAULT_URL = 'https://sms.aliyuncs.com'
SMS = LocalProxy(lambda: current_app.exten... | 33.0625 | 114 | 0.600504 | [
"MIT"
] | by46/flask-kits | flask_kits/sms/__init__.py | 3,186 | Python |
import matplotlib
matplotlib.use('Agg')
import os
from os.path import join
import argparse
import torch
import numpy as np
import pickle
import sys
import datetime
sys.path.append('./utils')
from torch import optim
from torch import nn
from torch import multiprocessing
from torch.optim import lr_scheduler
from torch.a... | 43.650307 | 169 | 0.646381 | [
"MIT"
] | msieb1/LTCN | train_pose_euler_crop.py | 14,230 | Python |
#!/usr/bin/env python3
#-------------------------------------------------------------
#
# 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 t... | 42.468085 | 119 | 0.695892 | [
"Apache-2.0"
] | AlexanderErtl/systemds | src/main/python/post_setup.py | 1,996 | Python |
import logging
import numpy as np
import math
import psutil
import time
from autogluon.common.features.types import R_BOOL, R_CATEGORY, R_OBJECT, S_BOOL, S_TEXT_NGRAM, S_TEXT_SPECIAL, S_DATETIME_AS_INT
from autogluon.core.constants import REGRESSION
from autogluon.core.utils.exceptions import NotEnoughMemoryError
fro... | 48.106007 | 237 | 0.653518 | [
"Apache-2.0"
] | taesup-aws/autogluon | tabular/src/autogluon/tabular/models/knn/knn_model.py | 13,614 | Python |
from utils import *
row_units = [cross(r, cols) for r in rows]
column_units = [cross(rows, c) for c in cols]
square_units = [cross(rs, cs) for rs in ('ABC','DEF','GHI') for cs in ('123','456','789')]
unitlist = row_units + column_units + square_units
# TODO: Update the unit list to add the new diagonal units
diagon... | 33.309013 | 113 | 0.633552 | [
"MIT"
] | justinlnx/artificial-intelligence | Projects/1_Sudoku/solution.py | 7,761 | Python |
"""
Module: 'uheapq' on micropython-v1.16-esp32
"""
# MCU: {'ver': 'v1.16', 'port': 'esp32', 'arch': 'xtensawin', 'sysname': 'esp32', 'release': '1.16.0', 'name': 'micropython', 'mpy': 10757, 'version': '1.16.0', 'machine': 'ESP32 module (spiram) with ESP32', 'build': '', 'nodename': 'esp32', 'platform': 'esp32', 'fami... | 27.473684 | 287 | 0.58046 | [
"MIT"
] | mattytrentini/micropython-stubs | stubs/micropython-v1_16-esp32/uheapq.py | 522 | Python |
#!/usr/bin/env python2.5
#
# Copyright 2009 the Melange 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 appl... | 26.236842 | 74 | 0.748245 | [
"Apache-2.0"
] | MatthewWilkes/mw4068-packaging | src/melange/src/soc/models/expando_base.py | 997 | Python |
from sqlalchemy.orm.exc import NoResultFound
from zeeguu_core.model import User, Language, UserWord, Text, Bookmark
def own_or_crowdsourced_translation(user, word: str, from_lang_code: str, context: str):
own_past_translation = get_own_past_translation(user, word, from_lang_code, context)
if own_past_trans... | 31.982143 | 91 | 0.685092 | [
"MIT"
] | C0DK/Zeeguu-Core | zeeguu_core/crowd_translations/__init__.py | 1,791 | Python |
import _plotly_utils.basevalidators
class MarkerValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="marker", parent_name="splom", **kwargs):
super(MarkerValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
d... | 47.792857 | 76 | 0.54521 | [
"MIT"
] | mastermind88/plotly.py | packages/python/plotly/plotly/validators/splom/_marker.py | 6,691 | Python |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import argparse
import logging
import os
import time
import detectron2.utils.comm as comm
import torch
from d2go.config import (
CfgNode as CN,
auto_scale_world_size,
reroute_config_path,
temp_defrost,
)
fro... | 31.544343 | 88 | 0.654678 | [
"Apache-2.0"
] | Dinesh101041/d2go | d2go/setup.py | 10,315 | Python |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import torch
from ax.exceptions.model import ModelError
from ax.models.torch.utils import (
_gen... | 46.367232 | 88 | 0.680151 | [
"MIT"
] | Balandat/Ax | ax/models/tests/test_torch_model_utils.py | 8,207 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
.. py:currentmodule:: trim.montecarlo.source
.. moduleauthor:: Hendrix Demers <hendrix.demers@mail.mcgill.ca>
"""
# Copyright 2019 Hendrix Demers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance wi... | 30.423077 | 74 | 0.719343 | [
"Apache-2.0"
] | drix00/pytrim-montecarlo | trim/montecarlo/options/source.py | 2,373 | Python |
#!/usr/bin/env python3
import utils
utils.check_version((3,7)) # make sure we are running at least Python 3.7
utils.clear() # clear the screen
print('Greetings!')
color = ''
while (color != 'red'):color = input("What is my favorite color? ")
while (color != 'red'):
color = color.l... | 25.368421 | 82 | 0.558091 | [
"MIT"
] | BraffordHunter/E01a-Control-Structues | main8.py | 482 | Python |
from qtpy.QtWidgets import QDialog, QLineEdit, QPushButton, QLabel, QVBoxLayout
from brainrender_gui.style import style, update_css
class AddRegionsWindow(QDialog):
left = 250
top = 250
width = 400
height = 300
label_msg = (
"Write the acronyms of brainregions "
+ "you wish to ad... | 27.526316 | 79 | 0.602677 | [
"BSD-3-Clause"
] | brainglobe/bg-brainrender-gui | brainrender_gui/widgets/add_regions.py | 2,615 | Python |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import distro
import logging
import platform
from pathlib import Path
from typing import (
Union,
)
from mozphab im... | 31.489899 | 85 | 0.648597 | [
"MPL-2.0"
] | cgsheeh/review | mozphab/telemetry.py | 6,235 | Python |
import os
import numpy as np
import pickle
import pathlib
from random import shuffle, choice
def get_info_dataset(dataset_path, update=False):
# TODO: Implements some checks to verify edits to the dataset from last pickle.dump(data)
storing_data_path = dataset_path + "/info.txt"
if update and os.path.exi... | 48.8375 | 120 | 0.604044 | [
"MIT"
] | 1Stohk1/tami | utils/preprocessing_data.py | 3,907 | Python |
import json
import logging
import sys
from typing import Any, Callable, Dict, List
from dhis2.core.http import BaseHttpRequest
from dhis2.core.inventory import HostResolved, Inventory, resolve_one
from fhir.resources.bundle import Bundle
from .models.svcm import CodeList, SVCMConfig
from .svcm_resources import build_... | 28.204225 | 114 | 0.615481 | [
"BSD-3-Clause"
] | dhis2/dhis2-python | dhis2_core/src/dhis2/code_list/svcm.py | 4,005 | Python |
#!/usr/bin/env python
"""
This is a crude script for detecting reference leaks in the C-based cbor2
implementation. It is by no means fool-proof and won't pick up all possible ref
leaks, but it is a reasonable "confidence test" that things aren't horribly
wrong. The script assumes you're in an environment with objgrap... | 33.738938 | 93 | 0.570361 | [
"MIT"
] | Chia-Network/cbor2 | scripts/ref_leak_test.py | 7,625 | Python |
#
# Copyright 2018 Analytics Zoo 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... | 40.631313 | 97 | 0.595649 | [
"Apache-2.0"
] | DiegoCao/analytics-zoo | pyzoo/test/zoo/chronos/model/forecast/test_lstm_forecaster.py | 8,045 | Python |
from pypy.objspace.std.iterobject import W_SeqIterObject
from pypy.interpreter.error import OperationError
class TestW_IterObject:
def body3(self, w_iter):
w = self.space.wrap
assert self.space.eq_w(self.space.next(w_iter), w(5))
assert self.space.eq_w(self.space.next(w_iter), w(3))
... | 31.153846 | 82 | 0.571193 | [
"MIT"
] | igormcoelho/neo-boa | idea2/pypyjs-3/deps/pypy/pypy/objspace/std/test/test_iterobject.py | 4,860 | Python |
# -*- coding: utf-8 -*-
"""
"""
import argparse
import os
import sys
if __name__ == '__main__':
pass
| 7.857143 | 26 | 0.572727 | [
"Apache-2.0"
] | mzntaka0/audy | audy/mix/noise.py | 110 | Python |
import numpy as np
# Thinning morphological operation applied using lookup tables.
# We convert the 3x3 neighbourhood surrounding a pixel to an index
# used to lookup the output in a lookup table.
# Bit masks for each neighbour
# 1 2 4
# 8 16 32
# 64 128 256
NEIGH_MASK_EAST = 32
NEIGH_MASK_NORTH_EAST = 4
N... | 27.70354 | 106 | 0.632487 | [
"MIT"
] | CipiOrhei/eecvf | Benchmarking/bsds500/bsds/thin.py | 6,261 | Python |
#!/usr/bin/env python3
"""
Usage: program | ./memcheck.py
"""
import fileinput
import pdb
with fileinput.input() as f:
data = "".join(f)
s = {}
for l in data.splitlines():
if "malloc:" in l:
c = l.split(":")
s[c[-1].strip()] = l
# print("malloc:%s" %c[-1].strip... | 16.882353 | 44 | 0.463415 | [
"Apache-2.0"
] | lbyoo/l_clib | py/memcheck.py | 620 | Python |
import random
class Card:
def __init__(self, suit, rank):
self.suit = suit
self.rank = rank
def __str__(self):
return f"{self.suit} {self.rank}: {BlackJack.values[self.rank]}"
class Hand:
def __init__(self):
self.cards = [] # start with empty list
self.value = ... | 31.822878 | 116 | 0.57224 | [
"MIT"
] | tse4a/Python-Challenge | BlackJack.py | 8,624 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.