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 |
|---|---|---|---|---|---|---|---|---|
"""
Structured information on a coordinate point.
"""
# this file was auto-generated
from datetime import date, datetime
from fairgraph.base_v3 import EmbeddedMetadata, IRI
from fairgraph.fields import Field
class CoordinatePoint(EmbeddedMetadata):
"""
Structured information on a coordinate point.
"""... | 34.205882 | 173 | 0.675838 | [
"Apache-2.0"
] | HumanBrainProject/fairgraph | fairgraph/openminds/sands/miscellaneous/coordinate_point.py | 1,163 | Python |
# coding=utf-8
from pyecharts.chart import Chart
def kline_tooltip_formatter(params):
text = (
params[0].seriesName
+ "<br/>"
+ "- open:"
+ params[0].data[1]
+ "<br/>"
+ "- close:"
+ params[0].data[2]
+ "<br/>"
+ "- lowest:"
... | 27.884615 | 67 | 0.486437 | [
"Apache-2.0"
] | Amoswish/graduaction_design_pubgprediction | venv/lib/python3.7/site-packages/pyecharts/charts/kline.py | 2,347 | Python |
from pyexcel_io.sheet import (
SheetReader, SheetWriter, NamedContent
)
from pyexcel_io.book import BookWriter
from pyexcel_io.utils import is_empty_array
from nose.tools import raises
@raises(NotImplementedError)
def test_book_writer():
book = BookWriter()
book.create_sheet("test")
def test_is_empty_ar... | 25.075 | 56 | 0.606846 | [
"BSD-3-Clause"
] | AverkinSergei/pyexcel-io | tests/test_base.py | 3,009 | Python |
class FabricSheetType(ElementType,IDisposable):
""" Represents a fabric sheet type,used in the generation of fabric wires. """
@staticmethod
def CreateDefaultFabricSheetType(ADoc):
"""
CreateDefaultFabricSheetType(ADoc: Document) -> ElementId
Creates a new FabricSheetType object with a default n... | 26.237226 | 246 | 0.728265 | [
"MIT"
] | BCSharp/ironpython-stubs | release/stubs.min/Autodesk/Revit/DB/Structure/__init___parts/FabricSheetType.py | 14,378 | Python |
from __future__ import unicode_literals
from xml.dom import minidom
from django.contrib.syndication import views
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase
from django.utils import tzinfo
from django.utils.feedgenerator import rfc2822_date, rfc3339_date
from .models impo... | 40.006944 | 151 | 0.602847 | [
"BSD-3-Clause"
] | adambrenecki/django | tests/syndication/tests.py | 17,283 | Python |
# Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
# reserved. Use of this source code is governed by a BSD-style license that
# can be found in the LICENSE file.
from cef_parser import *
def make_function_body_block(cls):
impl = ' // ' + cls.get_name() + ' methods.\n'
funcs = cls.get_vir... | 29.444444 | 104 | 0.666149 | [
"BSD-3-Clause"
] | AkihideHasegawa/cef | tools/make_ctocpp_header.py | 4,505 | Python |
# The MIT License (MIT)
#
# Copyright (c) 2015, Nicolas Sebrecht & contributors
#
# 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
... | 41.419355 | 79 | 0.759346 | [
"MIT"
] | Deepanshu2017/imapfw | imapfw/testing/libcore.py | 1,284 | Python |
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 07 14:08:31 2016
@author: Mic
"""
from __future__ import division
from wiselib2.must import *
import numpy as np
import wiselib2.Rayman as rm
Gauss1d = lambda x ,y : None
from scipy import interpolate as interpolate
from matplotlib import pyplot as plt
class PsdFuns:
... | 28.234347 | 310 | 0.563138 | [
"MIT"
] | WISE-Project/wiselib2 | wiselib2/Noise.py | 15,783 | Python |
from collections import defaultdict
def list_to_map(Xs, ys):
labels_map = defaultdict(list)
for x, y in list(zip(Xs, ys)):
labels_map[y].append(x)
return labels_map | 23.25 | 35 | 0.682796 | [
"Apache-2.0"
] | kareemjano/image-toolbox | dataset_utils/general_utils.py | 186 | Python |
#!/Users/yaroten/Library/Mobile Documents/com~apple~CloudDocs/git/crawling_scraping/crawling_scraping/bin/python3
# $Id: rst2odt_prepstyles.py 5839 2009-01-07 19:09:28Z dkuhlman $
# Author: Dave Kuhlman <dkuhlman@rexx.com>
# Copyright: This module has been placed in the public domain.
"""
Fix a word-processor-generat... | 26.367647 | 113 | 0.650307 | [
"MIT"
] | litteletips/crawling_scraping | crawling_scraping/bin/rst2odt_prepstyles.py | 1,793 | Python |
import pytest
from engine.constants import G
from pytest import param as p
from .orbit_derived_parameters import OrbitalPeriod
@pytest.mark.parametrize(
("primary_mass", "secondary_mass", "semimajor_axis", "expected"),
[p(10e10, 100, 10, 76.9102, id="arbitrary period")],
)
def test_orbital_period(primary_mas... | 30.9375 | 80 | 0.747475 | [
"MIT"
] | RomainEndelin/keplerian_orbits | python/engine/functions/orbit_derived_parameters_test.py | 495 | Python |
# -*- coding: utf-8 -*-
__author__ = """Adam Geitgey"""
__email__ = 'ageitgey@gmail.com'
__version__ = '0.1.0'
from .api import load_image_file, face_locations, face_landmarks, face_encodings, compare_faces, face_distance
| 28 | 110 | 0.741071 | [
"MIT"
] | EmmanuelOwusu/Image_Processing | face_recognition/face_recognition/__init__.py | 224 | Python |
import json
import pytest
from great_expectations.core import ExpectationConfiguration, ExpectationSuite
from .test_expectation_suite import baseline_suite, exp1, exp2, exp3, exp4
@pytest.fixture
def empty_suite():
return ExpectationSuite(
expectation_suite_name="warning",
expectations=[],
... | 32.224066 | 84 | 0.683492 | [
"Apache-2.0"
] | lfpll/great_expectations | tests/core/test_expectation_suite_crud_methods.py | 7,766 | Python |
from collections import defaultdict
from typing import DefaultDict
from .. import utils
from .. import data
'''
A collection of functions o index faculty data.
No function in this class reads data from the data files, just works logic
on them. This helps keep the program modular, by separating the data sources
from t... | 27.916667 | 76 | 0.733002 | [
"MIT"
] | BraydenKO/RamLife | firebase/firestore-py/lib/faculty/logic.py | 3,015 | Python |
import sys
import struct
from math import sqrt
def cross(a, b):
return [
a[1] * b[2] - a[2] * b[1],
a[2] * b[0] - a[0] * b[2],
a[0] * b[1] - a[1] * b[0]
]
def dot(a, b):
return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]
def normalized(a):
s = 1 / sqrt(dot(a, a))
return [ a[0]... | 26.87931 | 84 | 0.502245 | [
"MIT"
] | eliemichel/GrainViewer | share/scripts/augen_octahedron2camera.py | 1,559 | Python |
"""
* GTDynamics Copyright 2021, Georgia Tech Research Corporation,
* Atlanta, Georgia 30332-0415
* All Rights Reserved
* See LICENSE for the license information
*
* @file test_print.py
* @brief Test printing with DynamicsSymbol.
* @author Gerry Chen
"""
import unittest
from io import StringIO
from unittest.m... | 34.694915 | 93 | 0.633122 | [
"BSD-2-Clause"
] | borglab/GTDynamics | python/tests/test_print.py | 2,047 | Python |
from flask_migrate import Migrate
from os import environ
from sys import exit
from config import config_dict
from app import create_app, db
get_config_mode = environ.get('GENTELELLA_CONFIG_MODE', 'Debug')
try:
config_mode = config_dict[get_config_mode.capitalize()]
except KeyError:
exit('Error: Invalid GENTE... | 24.470588 | 77 | 0.798077 | [
"MIT"
] | Allenhorst/hh_test | gentelella.py | 416 | Python |
from typing import Optional, Union, Tuple, Mapping, List
from torch import Tensor
from torch_geometric.data.storage import recursive_apply
from torch_geometric.typing import Adj
from torch_sparse import SparseTensor
from tsl.ops.connectivity import convert_torch_connectivity
from tsl.typing import DataArray, SparseTe... | 43.224806 | 80 | 0.603659 | [
"MIT"
] | TorchSpatiotemporal/tsl | tsl/data/mixin.py | 5,576 | Python |
"""
Write a function that takes in an array of integers and returns a sorted version of that array. Use the QuickSort algorithm to sort the array.
"""
def quick_sort(array):
if len(array) <= 1:
return array
_rec_helper(array, 0, len(array) - 1)
return array
def _rec_helper(array, start, end):
... | 25.772727 | 142 | 0.589947 | [
"MIT"
] | Surbeivol/daily-coding-problems | solutions/quick_sort.py | 1,134 | Python |
# -*- coding: utf-8 -*-
"""Example for a list question type.
Run example by typing `python -m examples.list` in your console."""
from pprint import pprint
import questionary
from examples import custom_style_dope
from questionary import Separator, Choice, prompt
def ask_pystyle(**kwargs):
# create the question ... | 26.071429 | 75 | 0.534247 | [
"MIT"
] | fossabot/questionary | examples/select.py | 1,463 | Python |
# -*- coding: utf-8 -*-
from zappa_boilerplate.database import db_session
from flask_wtf import Form
from wtforms import StringField, PasswordField
from wtforms.validators import DataRequired, Email, EqualTo, Length
from .models import User
class RegisterForm(Form):
username = StringField('Username',
... | 40.083333 | 98 | 0.630631 | [
"MIT"
] | 402900550b/dtnewman2 | zappa_boilerplate/user/forms.py | 1,443 | Python |
# An old version of OpenAI Gym's multi_discrete.py. (Was getting affected by Gym updates)
# (https://github.com/openai/gym/blob/1fb81d4e3fb780ccf77fec731287ba07da35eb84/gym/spaces/multi_discrete.py)
import numpy as np
import gym
class MultiDiscrete(gym.Space):
"""
- The multi-discrete action space consists o... | 53.522727 | 122 | 0.675159 | [
"MIT"
] | 51N84D/multiagent-particle-envs | multiagent/multi_discrete.py | 2,355 | Python |
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html
class VmallPipeline(object):
def process_item(self, item, spider):
return item
| 23.833333 | 65 | 0.70979 | [
"MIT"
] | gikoluo/vmall | vmall/pipelines.py | 286 | Python |
"""
app.py - Flask-based server.
@author Thomas J. Daley, J.D.
@version: 0.0.1
Copyright (c) 2019 by Thomas J. Daley, J.D.
"""
import argparse
import random
from flask import Flask, render_template, request, flash, redirect, url_for, session, jsonify
from wtforms import Form, StringField, TextAreaField, PasswordField,... | 28.769231 | 98 | 0.734626 | [
"MIT"
] | tjdaley/publicdataws | app/app.py | 2,992 | Python |
from . import auth
from . import groups
from . import hub
from . import proxy
from . import services
from . import users
from .base import *
default_handlers = []
for mod in (auth, hub, proxy, users, groups, services):
default_handlers.extend(mod.default_handlers)
| 22.5 | 55 | 0.744444 | [
"MIT"
] | KarmaScripter/PiggyPy | Lib/site-packages/jupyterhub/apihandlers/__init__.py | 270 | Python |
"""
A NumPy sub-namespace that conforms to the Python array API standard.
This submodule accompanies NEP 47, which proposes its inclusion in NumPy. It
is still considered experimental, and will issue a warning when imported.
This is a proof-of-concept namespace that wraps the corresponding NumPy
functions to give a c... | 26.889488 | 84 | 0.697775 | [
"BSD-3-Clause"
] | ArpitaChatterjee/numpy | numpy/array_api/__init__.py | 9,976 | Python |
# Copyright 2013 IBM Corp.
#
# 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 agree... | 43.90671 | 79 | 0.65654 | [
"Apache-2.0"
] | bopopescu/TestNova | nova/objects/service.py | 26,827 | Python |
# -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2016, Adrian Sampson.
#
# 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 t... | 37.574153 | 79 | 0.66287 | [
"MIT"
] | parapente/beets | test/test_art.py | 17,735 | 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 us... | 36.247544 | 80 | 0.692466 | [
"Apache-2.0"
] | AhnLab-OSS/beam | sdks/python/apache_beam/io/avroio_test.py | 18,450 | Python |
import os
from hisim import hisim_main
from hisim.simulationparameters import SimulationParameters
import shutil
import random
from hisim import log
from hisim.utils import PostProcessingOptions
import matplotlib.pyplot as plt
from hisim import utils
@utils.measure_execution_time
def test_basic_household():
# if o... | 44.575472 | 99 | 0.720212 | [
"MIT"
] | MF-Zerai/HiSim | tests/test_examples.py | 4,725 | Python |
'''
RenameBot
This file is a part of mrvishal2k2 rename repo
Dont kang !!!
© Mrvishal2k2
'''
import pyrogram
from pyrogram import Client, filters
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
import logging
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s - %(nam... | 38.977778 | 126 | 0.72805 | [
"MIT"
] | KoshikKumar17/TG-RenameBot | root/plugins/main_filter.py | 1,757 | Python |
import digi
import digi.on as on
@on.control
def h0(c):
for k, v in c.items():
v["status"] = v.get("intent",
v.get("status", "undef"))
if __name__ == '__main__':
digi.run()
| 15.785714 | 53 | 0.502262 | [
"Apache-2.0"
] | NetSys/dspace | mocks/colorlamp/driver/handler.py | 221 | Python |
"""
builtin_bracket.py
"""
from __future__ import print_function
from _devbuild.gen.id_kind_asdl import Id
from _devbuild.gen.runtime_asdl import value
from _devbuild.gen.syntax_asdl import (
word, word_e, word_t, word__String, bool_expr,
)
from _devbuild.gen.types_asdl import lex_mode_e
from asdl import runtime
... | 29.850534 | 82 | 0.651884 | [
"Apache-2.0"
] | Schweinepriester/oil | osh/builtin_bracket.py | 8,388 | Python |
import glob
import shutil
import subprocess
import os
import sys
import argparse
# Read and save metadata from file
def exiftool_metadata(path):
metadata = {}
exifToolPath = 'exifTool.exe'
''' use Exif tool to get the metadata '''
process = subprocess.Popen(
[
exifToolPath,
... | 32.755556 | 130 | 0.556083 | [
"MIT"
] | skrzypak/Soaf | app.py | 4,422 | 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 ... | 37.044444 | 78 | 0.637672 | [
"MIT"
] | JonathanGailliez/azure-sdk-for-python | azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/replication_status_py3.py | 1,667 | Python |
#!/usr/bin/env python
import SimpleHTTPServer
import SocketServer
import sys
import urllib
import logging
from optparse import OptionParser
class ResultsProvider(object):
'''Base class used to fetch data from server for forwarding'''
import requests
import socket
import time
def __init__(self, *... | 37.605634 | 129 | 0.607241 | [
"BSD-3-Clause"
] | stephenbradshaw/pentesting_stuff | helper_servers/http_forwarder.py | 8,010 | Python |
import spacy
from spacy.tokens import Doc, Span, Token
import urllib
import xml.etree.ElementTree as ET
import re
from SpacyHu.BaseSpacyHuComponent import BaseSpacyHuComponent
class HuLemmaMorph(BaseSpacyHuComponent):
def __init__(self,
nlp,
label='Morph',
url='h... | 36.305556 | 77 | 0.602142 | [
"MIT"
] | Prodinal/GateSpacyWrapping | SpacyHu/SpacyHu/LemmatizerMorphAnalyzer.py | 2,620 | Python |
def gen_mutants():
import tensorflow as tf
import pandas
import numpy as np
DATAFILE_TRAIN = 'mock_kaggle_edit_train.csv'
DATAFILE_VALIDATE = 'mock_kaggle_edit_... | 31.150134 | 232 | 0.62897 | [
"Apache-2.0"
] | anuragbms/Sales-forecasting-with-RNNs | MetamorphicTests/all_mutants/sales_forecasting_file/273.py | 11,619 | Python |
__version__ = '0.3.3'
import os
import sys
import logging
import argparse
from .core import WebCrawler
from .helpers import color_logging
def main():
""" parse command line options and run commands.
"""
parser = argparse.ArgumentParser(
description='A web crawler for testing website links validati... | 37.388889 | 94 | 0.63794 | [
"MIT"
] | debugtalk/WebCrawler | webcrawler/__init__.py | 4,038 | Python |
#!/usr/bin/env python
import bottle
import os, json
from .utils import distance, neighbours, direction
from .defensive import find_my_tail, trouble, find_enemy_tail, eat_food, find_my_tail_emergency
from .snake import Snake
from .gameboard import GameBoard
SAFTEY = 0
SNAKE = 1
FOOD = 3
DANGER = 5
def move_response(... | 29.506329 | 103 | 0.586015 | [
"MIT"
] | ntmk/battlesnake-2019-pixelated | app/main.py | 4,662 | Python |
#!/usr/bin/python3
# -*- coding: utf8 -*-
# Copyright (c) 2020 Baidu, 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... | 25.375 | 74 | 0.647783 | [
"Apache-2.0"
] | rickyHong/Qcompute-repl | QCompute/QuantumPlatform/ProcedureParams.py | 1,624 | Python |
class TopicDTO:
name = str
description = str
popularity = int
def __init__(self, name="", popularity=0, description = ""):
self.name=name
self.popularity=popularity
self.description = description
| 26.666667 | 64 | 0.625 | [
"MIT"
] | AngelStoyanov33/Flask-Forum | DTOs/TopicDTO.py | 240 | Python |
import os
from quick2wire.gpio import pins, In, Out, PullDown, gpio_admin
import pytest
@pytest.mark.gpio
@pytest.mark.loopback
class TestGPIO:
def test_pin_must_be_opened_before_use_and_is_unusable_after_being_closed(self):
pin = pins.pin(0)
with pytest.raises(IOError):
pin.... | 28.563107 | 90 | 0.569001 | [
"MIT"
] | pietersartain/ipseity | usr/share/quick2wire/test_gpio.py | 2,942 | Python |
#!/usr/bin/env python
# coding=utf-8
class PyPIPackageProject:
pass
| 10.571429 | 25 | 0.702703 | [
"MIT"
] | hansnow/asgi-webdav | asgi_webdav/core.py | 74 | Python |
import FWCore.ParameterSet.Config as cms
hltEgammaHcalPFClusterIsoUnseeded = cms.EDProducer("EgammaHLTHcalPFClusterIsolationProducer",
absEtaLowEdges = cms.vdouble(0.0, 1.479),
doRhoCorrection = cms.bool(False),
drMax = cms.double(0.3),
drVetoBarrel = cms.double(0.0),
drVetoEndcap = cms.double(0.0)... | 40.291667 | 93 | 0.718718 | [
"Apache-2.0"
] | PKUfudawei/cmssw | HLTrigger/Configuration/python/HLT_75e33/modules/hltEgammaHcalPFClusterIsoUnseeded_cfi.py | 967 | Python |
#!/usr/bin/env python
# encoding: utf-8
"""
@Author: yangwenhao
@Contact: 874681044@qq.com
@Software: PyCharm
@File: Cosine.py
@Time: 19-6-26 下午9:43
@Overview: Implement Cosine Score for speaker identification!
Enrollment set files will be in the 'Data/enroll_set.npy' and the classes-to-index file is 'Data/enroll_clas... | 31.777778 | 116 | 0.708791 | [
"MIT"
] | Wenhao-Yang/DeepSpeaker-pytorch | Score/Cosine_Score.py | 2,006 | Python |
"""
Copyright 2013 The Trustees of Princeton University
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... | 25.694268 | 96 | 0.715419 | [
"Apache-2.0"
] | jcnelson/syndicate | ms/storage/backends/google_appengine.py | 4,034 | Python |
import sys
import os
import math
import imageio
from moviepy.editor import *
import time
def read_video(video_name):
# Read video from file
video_name_input = 'testset/' + video_name
video = VideoFileClip(video_name_input)
return video
def video2frame(video_name):
video = read_video(video_name)... | 41.554795 | 256 | 0.659469 | [
"Apache-2.0"
] | PJunhyuk/people-counting-classification | video_pose_ed.py | 12,134 | Python |
from rest_framework import fields, serializers
from db.models.repos import Repo
class RepoSerializer(serializers.ModelSerializer):
project = fields.SerializerMethodField()
class Meta:
model = Repo
fields = ('project', 'created_at', 'updated_at', 'is_public', )
def get_user(self, obj):
... | 23.166667 | 71 | 0.688249 | [
"MPL-2.0"
] | AntonFriberg/polyaxon | polyaxon/api/repos/serializers.py | 417 | Python |
# coding=utf-8
from pub.tables.resources import *
from pub.tables.user import *
import pub.client.login as login
from pub.permission.user import is_logged,is_owner
def is_valid_key(key, r_type):
try:
resource_type.objects.get(key=key)
return False
except:
pass
try:
resour... | 26.384615 | 123 | 0.640074 | [
"MIT"
] | DASTUDIO/MyVHost | pub/permission/resource.py | 3,773 | Python |
import urllib2
from zope.interface import implements
from plone.portlets.interfaces import IPortletDataProvider
from plone.app.portlets.portlets import base
from Products.CMFCore.utils import getToolByName
from zope import schema
from zope.formlib import form
from Products.Five.browser.pagetemplatefile import ViewPa... | 32.694215 | 77 | 0.671638 | [
"MIT"
] | potzenheimer/buildout.wad | src/wad.blog/wad/blog/portlets/categories.py | 3,956 | Python |
from configparser import ConfigParser
import feedparser
import re
import requests
import tweepy
def get_id(xkcd_link: str) -> int:
"""
Exctract comic id from xkcd link
"""
match = re.search(r"\d+", xkcd_link)
if match:
return int(match.group())
else:
return 0
def get_xkcd_rss... | 22.170455 | 81 | 0.621732 | [
"MIT"
] | lwittchen/twitter-bots | xkcd_feed/src/utils.py | 1,951 | Python |
from django.urls import path
from el_galleria import views
urlpatterns = [
path('', views.index, name="home"),
path('category/<str:selected_category>/', views.category, name="category"),
path('search/<str:search_str>/', views.search, name="search")
] | 26.5 | 79 | 0.69434 | [
"MIT"
] | kennjr/mi-galleria | el_galleria/urls.py | 265 | Python |
"""api_gw_test"""
# Remove warnings when using pytest fixtures
# pylint: disable=redefined-outer-name
import json
from test.conftest import ENDPOINT_URL
# warning disabled, this is used as a pylint fixture
from test.elasticsearch_test import ( # pylint: disable=unused-import
es_client,
populate_es_test_case... | 30.376119 | 113 | 0.622445 | [
"Apache-2.0"
] | fredliporace/cbers-2-stac | test/api_gw_test.py | 10,176 | Python |
_base_ = [
'../_base_/datasets/ffhq_flip.py',
'../_base_/models/stylegan/stylegan2_base.py',
'../_base_/default_runtime.py'
]
model = dict(
type='MSPIEStyleGAN2',
generator=dict(
type='MSStyleGANv2Generator',
head_pos_encoding=dict(type='CSG'),
deconv2conv=True,
up_a... | 26.714286 | 79 | 0.649436 | [
"Apache-2.0"
] | DequanWang/actnn-mmgen | configs/positional_encoding_in_gans/mspie-stylegan2_c2_config-d_ffhq_256-512_b3x8_1100k.py | 1,683 | Python |
from jsonrpc import ServiceProxy
import sys
import string
# ===== BEGIN USER SETTINGS =====
# if you do not set these you will be prompted for a password for every command
rpcuser = ""
rpcpass = ""
# ====== END USER SETTINGS ======
if rpcpass == "":
access = ServiceProxy("http://127.0.0.1:25176")
else:
access = Se... | 24.110769 | 79 | 0.668198 | [
"MIT"
] | bitmea-project/bitmea | contrib/bitrpc/bitrpc.py | 7,836 | Python |
#!/usr/bin/env python3
#
# MIT License
#
# Copyright (c) 2020 EntySec
#
# 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,... | 33.854167 | 80 | 0.720615 | [
"MIT"
] | D3crypT0r/D3crypt | Head/typer.py | 1,625 | Python |
"""
DeepChEmbed (DCE) Models
"""
from dimreducer import DeepAutoEncoder
from cluster import KMeansLayer
from cluster import KMeans
from keras import Model
from keras import optimizers
from keras.utils import normalize
import numpy as np
class DCE():
"""
The class to build a deep chemical embedding model.
... | 41.430493 | 79 | 0.573763 | [
"MIT"
] | chembed/DeepChEmbed | deepchembed/dce.py | 9,241 | Python |
import datetime
from . import status
from .errors import InvalidAuthRequest, ProtocolVersionUnsupported, NoMutualAuthType
from .signing import Key
from .response import AuthResponse
class AuthPrincipal:
def __init__(self, userid, auth_methods, ptags=None, session_expiry=None):
self.userid = userid
... | 43.346535 | 95 | 0.646071 | [
"MIT"
] | edwinbalani/ucam-wls | ucam_wls/context.py | 8,756 | Python |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** 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, overload
from .. import... | 46.277056 | 294 | 0.710196 | [
"ECL-2.0",
"Apache-2.0"
] | chivandikwa/pulumi-aws | sdk/python/pulumi_aws/timestreamwrite/outputs.py | 10,690 | Python |
#
# PySNMP MIB module Nortel-MsCarrier-MscPassport-ExtensionsMIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-MsCarrier-MscPassport-ExtensionsMIB
# Produced by pysmi-0.3.4 at Wed May 1 14:29:54 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user ... | 114.243243 | 607 | 0.772652 | [
"Apache-2.0"
] | agustinhenze/mibs.snmplabs.com | pysnmp-with-texts/Nortel-MsCarrier-MscPassport-ExtensionsMIB.py | 4,227 | Python |
# Copyright 2020 The HuggingFace Team. 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 applicabl... | 36.33121 | 233 | 0.673562 | [
"Apache-2.0"
] | Ki6an/transformers | setup.py | 11,408 | Python |
from django.db import models
# Create your models here.
class BaseView(models.Model):
title = models.CharField(max_length=256)
def __unicode__(self):
return self.title
class port1View(models.Model):
def __unicode__(self):
return self.title
class port2View(models.Model):
title = models.CharField(max_length=... | 18.456522 | 41 | 0.762073 | [
"MIT"
] | nandosarracino/mymainsite | mainsite/models.py | 849 | Python |
with open('/home/pi/kown_hosts') as kown_f,open('/home/pi/cache_hosts') as cache_f:
kown_hosts = kown_f.readlines()
cache_hosts = set(cache_f.readlines())
kown_hosts = [host.split() for host in kown_hosts]
with open('/etc/ansible/hosts','w') as wf:
wf.writelines([x.split()[1]+"\n" for x in cache_hosts])
| 35.444444 | 83 | 0.689655 | [
"Apache-2.0"
] | yujmo/python | rewrite_multi_pis_ansilbe_hosts.py | 319 | Python |
# import the necessary packages
import sys
import cv2
import numpy as np
import pandas as pd
from tensorflow.keras.preprocessing.image import ImageDataGenerator
from sklearn.preprocessing import LabelBinarizer
from sklearn.preprocessing import MinMaxScaler
from sklearn.model_selection import train_test_split
from tenso... | 46.939467 | 288 | 0.666254 | [
"MIT"
] | solgenomics/DroneImageScripts | CNN/CNNProcessData.py | 19,386 | Python |
from numbers import Number
import yaml
from .color_tools import hex2rgb
def __default_grid__(ax):
"""This is a temporary function"""
ax.grid(b=True, which='major', color='#000000', alpha=0.2, linestyle='-', linewidth=0.5)
ax.grid(b=True, which='minor', color='#000000', alpha=0.1, linestyle='-', linewidth=0.25)
ax.... | 29.460674 | 147 | 0.691838 | [
"MIT"
] | SengerM/nicenquickplotlib | nicenquickplotlib/config_types.py | 2,622 | Python |
from machine import Pin, Map, PWM # include Pin, Map and PWM functions from machine module
import time # include time module
# create PWM on WIO BUZZER with 2000Hz frequency and 250 duty cycle
BUZZER = PWM(Pin(Map.WIO_BUZZER), freq=1000, duty=250)
| 37 | 92 | 0.741313 | [
"MIT"
] | lakshanthad/Wio_Terminal_Classroom_Ardupy | Classroom 4/Buzzer_PWM.py | 259 | Python |
import sys
from . import pghoard
sys.exit(pghoard.main())
| 10 | 24 | 0.733333 | [
"Apache-2.0"
] | Adnuntius/pghoard | pghoard/__main__.py | 60 | Python |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('cms', '__first__'),
]
operations = [
migrations.CreateModel(
name='GoogleMap',
fields=[
... | 72.533333 | 352 | 0.61826 | [
"Apache-2.0"
] | Glasgow2015/team-10 | env/lib/python2.7/site-packages/djangocms_googlemap/migrations_django/0001_initial.py | 3,264 | Python |
import os.path
import IMLearn.learners.regressors.linear_regression
from IMLearn.learners.regressors import PolynomialFitting
from IMLearn.utils import split_train_test
import numpy as np
import pandas as pd
import plotly.express as px
import plotly.io as pio
pio.templates.default = "simple_white"
from IMLearn.met... | 35.179104 | 108 | 0.65507 | [
"MIT"
] | noamwino/IML.HUJI | exercises/city_temperature_prediction.py | 4,714 | Python |
x = int(input())
m = int(input())
if x < 10:
if x <= m:
print(1)
else:
print(0)
else:
xarr = []
while x:
xarr = [x % 10] + xarr
x //= 10
n = len(xarr)
l = max(xarr) + 1
def check(base, xarr):
ans = xarr[0] * (base ** (n - 1))
if ans > m:
... | 18.977778 | 48 | 0.375878 | [
"MIT"
] | ApocalypseMac/CP | atcoder/ABC 192/D.py | 854 | Python |
def giving()
i01.moveHead(44,82)
i01.moveArm("left",15,55,68,10)
i01.moveArm("right",13,40,74,13)
i01.moveHand("left",61,0,14,0,0,180)
i01.moveHand("right",0,24,24,19,21,25)
i01.moveTorso(90,90,90)
| 25.5 | 39 | 0.681373 | [
"Apache-2.0"
] | Alexinator40/pyrobotlab | home/hairygael/GESTURES/giving.py | 204 | Python |
from tests.testmodels import Event, IntFields, MinRelation, Node, Reporter, Team, Tournament, Tree
from tortoise import Tortoise
from tortoise.contrib import test
from tortoise.exceptions import (
DoesNotExist,
FieldError,
IntegrityError,
MultipleObjectsReturned,
ParamsError,
)
from tortoise.express... | 40.353968 | 100 | 0.619911 | [
"Apache-2.0"
] | spacemanspiff2007/tortoise-orm | tests/test_queryset.py | 25,423 | Python |
from data_importers.github_importer import BaseGitHubImporter
class Command(BaseGitHubImporter):
srid = 27700
districts_srid = 27700
council_id = "EPS"
elections = ["2021-05-06"]
scraper_name = "wdiv-scrapers/DC-PollingStations-EpsomAndEwell"
geom_type = "gml"
seen = set()
def distri... | 30.590909 | 88 | 0.581724 | [
"BSD-3-Clause"
] | DemocracyClub/UK-Polling-Stations | polling_stations/apps/data_importers/management/commands/import_epsom_and_ewell.py | 1,346 | Python |
"""
Output demo
^^^^^^^^^^^^^^
Demonstrate various output usage supported by PyWebIO
:demo_host:`Demo </?pywebio_api=output_usage>` `Source code <https://github.com/wang0618/PyWebIO/blob/dev/demos/output_usage.py>`_
"""
from pywebio import start_server
from pywebio.output import *
from pywebio.session import hold, ge... | 37.19337 | 311 | 0.621064 | [
"MIT"
] | songshanyuwu/PyWebIO | demos/output_usage.py | 15,342 | Python |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-12-30 03:21
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
... | 27.735294 | 124 | 0.61824 | [
"MIT"
] | dishad/ADD | core/migrations/0002_auto_20161229_2221.py | 943 | Python |
# Copyright The PyTorch Lightning 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 to i... | 34.74 | 106 | 0.763961 | [
"Apache-2.0"
] | tszumowski/lightning-flash | flash_examples/object_detection.py | 1,737 | Python |
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 35.041721 | 162 | 0.699111 | [
"Apache-2.0"
] | StanislavParovoy/Keras | keras/initializers/initializers_v2.py | 26,877 | Python |
from operator import attrgetter
import pyangbind.lib.xpathhelper as xpathhelper
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType
from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType
from pyangbind.lib.base import PybindBase
from d... | 64.825397 | 995 | 0.727473 | [
"Apache-2.0"
] | extremenetworks/pybind | pybind/nos/v6_0_2f/interface/hundredgigabitethernet/switchport/access_mac_group_rspan_vlan_classification/access/__init__.py | 8,168 | Python |
# Generated by Django 2.0.5 on 2018-06-07 10:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('it_purchase_app', '0030_auto_20180607_1020'),
]
operations = [
migrations.AlterField(
model_name='purchase',
name='m... | 26.421053 | 146 | 0.609562 | [
"MIT"
] | gokhankaraboga/test | it_purchase_project/it_purchase_app/migrations/0031_auto_20180607_1031.py | 502 | Python |
#!/usr/bin/env python
# encoding: utf-8
from django.db import models
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from django_extensions.db.fields import AutoSlugField
from v1.recipe.models import Recipe
class GroceryList(models.Model):
"""
The GroceryL... | 34.671233 | 91 | 0.699723 | [
"MIT"
] | BitFis/openeats-api | v1/list/models.py | 2,531 | Python |
#!/usr/bin/python
import hashlib
import sys
v = sys.argv[1]
index = 0
pw = ''
i = 0
while True:
suffix = str(i)
h = hashlib.md5(v+suffix).hexdigest()
if h.startswith("00000"):
pw += h[5]
print(v+suffix,h,pw)
if len(pw) == 8:
break
i += 1
print(pw)
| 13.818182 | 41 | 0.519737 | [
"MIT"
] | CheyenneWills/adventofcode | 2016/day5/p1.py | 304 | Python |
from pandas import read_csv
from IPython.display import display
import numpy as np
import sys
import math
###############################
####Maria Eugenia Lopez #####
###############################
def fully_grown_depuration(number_to_remove=0.50):
return plants.loc[plants.height_m > number_to_remove]
def con... | 27.04918 | 75 | 0.621212 | [
"MIT"
] | Maruja/MariaLopez | Assignment/Environmental_Project/part_A.py | 1,650 | Python |
#
# PySNMP MIB module EdgeSwitch-IPV6-TUNNEL-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/EdgeSwitch-IPV6-TUNNEL-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:56:15 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version ... | 123.169811 | 896 | 0.780331 | [
"Apache-2.0"
] | agustinhenze/mibs.snmplabs.com | pysnmp/EdgeSwitch-IPV6-TUNNEL-MIB.py | 6,528 | Python |
"""Test cases for the pypfilt.io module."""
import datetime
import numpy as np
import os
from pypfilt.io import read_table, date_column
def test_read_datetime():
# Test data: sequential dates with Fibonacci sequence.
content = """
date count
2020-01-01 1
2020-01-02 1
2020-01-03 2
2020-01... | 25.5 | 66 | 0.617647 | [
"BSD-3-Clause"
] | ruarai/epifx.covid | local_pypfilt/tests/test_io.py | 1,326 | Python |
#coding:utf8
#authors : yqq
import logging
import json
from utils import decimal_default,get_linenumber
from base_handler import BaseHandler
from .proxy import AuthServiceProxy
from cashaddress import convert
import traceback
#设置精度
from decimal import Decimal
from decimal import getcontext
getcontext().prec = 8
f... | 43.808743 | 139 | 0.627541 | [
"MIT"
] | songning4/QBlockChainNotes | Python3/Tornado/apps/ExchangeWalletApi/ExWallet/bsv/handler.py | 24,277 | Python |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from abc import ABC
import torch
import torch.nn as nn
import torch.nn.functional as F
from lib.loss.loss_helper import FSAuxCELoss, FSAuxRMILoss
from lib.utils.tools.logger import Logger as Log
class Pixel... | 37.783505 | 112 | 0.600136 | [
"MIT"
] | NNNNAI/ContrastiveSeg | lib/loss/loss_contrast.py | 7,330 | Python |
# File: gsgmail_process_email.py
# Copyright (c) 2017-2021 Splunk Inc.
#
# Licensed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt)
import email
import tempfile
from collections import OrderedDict
import os
import re
from bs4 import BeautifulSoup, UnicodeDammit
import phantom.app as phantom
import p... | 38.744015 | 168 | 0.621304 | [
"Apache-2.0"
] | chunmanjimmyf/phantom-apps | Apps/phgsgmail/gsgmail_process_email.py | 42,076 | Python |
# Copyright 2021 ETH Zurich, Media Technology Center
#
# 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... | 49.591346 | 140 | 0.728938 | [
"Apache-2.0"
] | MTC-ETH/RecommenderSystems | preprocessing.py | 10,315 | Python |
# 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 os
from foundations.step import Step
from training.metric_logger import MetricLogger
from testing import test_case
class ... | 41.231884 | 96 | 0.660105 | [
"MIT"
] | sbam13/open_lth | training/test/test_metric_logger.py | 2,845 | Python |
import logging
import os
from enum import Enum
from functools import lru_cache
from typing import Optional
from pydantic import BaseSettings, PostgresDsn
logger = logging.getLogger(__name__)
class EnvironmentEnum(str, Enum):
PRODUCTION = "production"
LOCAL = "local"
class GlobalConfig(BaseSettings):
T... | 30.669725 | 107 | 0.714029 | [
"Apache-2.0"
] | Open-Earth-Foundation/traction | services/endorser/api/core/config.py | 3,343 | Python |
import _plotly_utils.basevalidators
class InsidetextanchorValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(self, plotly_name="insidetextanchor", parent_name="funnel", **kwargs):
super(InsidetextanchorValidator, self).__init__(
plotly_name=plotly_name,
paren... | 38.153846 | 87 | 0.669355 | [
"MIT"
] | labaran1/plotly.py | packages/python/plotly/plotly/validators/funnel/_insidetextanchor.py | 496 | Python |
#!/usr/bin/env python3
# Copyright (c) 2014-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 the wallet accounts properly when there are cloned transactions with malleated scriptsigs."""
fro... | 45.587786 | 168 | 0.64501 | [
"MIT"
] | weicrypto/wei | test/functional/wallet_txn_clone.py | 5,972 | Python |
import collections
from collections import defaultdict
import sys
import json
import random
from jsmin import jsmin
from io import StringIO
import numpy as np
import copy
import os
script_n = os.path.basename(__file__).split('.')[0]
script_n = script_n.split('_', 1)[1]
def to_ng(loc):
return (int(loc[0]/4), int(l... | 28.427673 | 122 | 0.623009 | [
"MIT"
] | htem/cb2_project_analysis | analysis/gen_db/mf_grc/gen_mf_locs_210518.py | 4,520 | Python |
import unittest
class TestPython(unittest.TestCase):
def test_float_to_int_coercion(self):
self.assertEqual(1, int(1.0))
def test_get_empty_dict(self):
self.assertIsNone({}.get('key'))
def test_trueness(self):
self.assertTrue(bool(10))
| 19.785714 | 41 | 0.67509 | [
"MIT"
] | microcoder/course-python-mipt | 4/tests/test_python.py | 277 | Python |
# third-party
from flask import render_template, url_for, request, jsonify
# locals
from . import warehouse
@warehouse.route('/element_types', methods=['GET'])
def index():
return render_template("warehouse/element_types.html")
@warehouse.route('/element_type', methods=['POST'])
def create_new_element_type():
... | 26.296296 | 70 | 0.707042 | [
"MIT"
] | thiagolcmelo/dynamic | warehouse/views.py | 710 | Python |
# copyright (c) 2018 paddlepaddle authors. all rights reserved.
#
# licensed under the apache license, version 2.0 (the "license");
# you may not use this file except in compliance with the license.
# you may obtain a copy of the license at
#
# http://www.apache.org/licenses/license-2.0
#
# unless required by app... | 42.29233 | 112 | 0.56919 | [
"Apache-2.0"
] | 0x45f/Paddle | python/paddle/fluid/contrib/slim/tests/test_quantization_pass.py | 29,224 | Python |
#!/usr/bin/envpython
# -*- coding: utf-8 -*-
def black(string):
return'\033[30m'+string+'\033[0m'
def blue(string):
return'\033[94m'+string+'\033[0m'
def gray(string):
return'\033[1;30m'+string+'\033[0m'
def green(string):
return'\033[92m'+string+'\033[0m'
def cyan(string):
return'\033[96m'+str... | 19.205128 | 39 | 0.635514 | [
"MIT"
] | Mattewn99/Instagram-Autogagement | utils/color.py | 749 | Python |
import cProfile
import json
import logging
import os
import pstats
import signal
import tempfile
import time
import traceback
from django.conf import settings
from django.utils.timezone import now as tz_now
from django.db import DatabaseError, OperationalError, connection as django_connection
from django.db.utils impo... | 40.840376 | 136 | 0.550178 | [
"Apache-2.0"
] | EzzioMoreira/awx | awx/main/dispatch/worker/callback.py | 8,699 | Python |
from flask import render_template, flash, redirect, url_for, request
from flask.views import MethodView
from app.middleware import auth
from app.models.user import User
from app.validators.register_form import RegisterForm
from app.services import avatar_service
class RegisterController(MethodView):
@auth.optional... | 25.934783 | 74 | 0.709975 | [
"MIT"
] | TheSynt4x/flask-blog | app/controllers/auth/register.py | 1,193 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.