content stringlengths 7 928k | avg_line_length float64 3.5 33.8k | max_line_length int64 6 139k | alphanum_fraction float64 0.08 0.96 | licenses list | repository_name stringlengths 7 104 | path stringlengths 4 230 | size int64 7 928k | lang stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|
#!/usr/bin/env python3
# Enter your code here. Read input from STDIN. Print output to STDOUT
def string_manipulate(string):
even_string=''
odd_string=''
for idx, val in enumerate(string):
if idx % 2 == 0:
even_string+=val
else:
odd_string+=val
return even_... | 21.12 | 69 | 0.566288 | [
"MIT"
] | vas610/hackerrank-30daysofcode-python | day6.py | 528 | Python |
class A:
def foo(self):
print("A")
class B(A):
# def foo(self):
# print("B")
pass
class C(A):
def foo(self):
print("C")
super(C, self).foo()
class D(B, C):
def foo(self):
print("D")
super(D, self).foo()
if __name__ == '__main__':
d = D()
... | 13.12 | 28 | 0.445122 | [
"MIT"
] | jiauy/before_work | PythonAndOop/N42_super_3.py | 328 | Python |
from torch.utils.data import Dataset
from typing import List
import torch
from .. import SentenceTransformer
from ..readers.InputExample import InputExample
class SentencesDataset(Dataset):
"""
Dataset for smart batching, that is each batch is only padded to its longest sequence instead of padding all
sequ... | 35.195122 | 115 | 0.680527 | [
"MIT"
] | 21WelfareForEveryone/WelfareForEveryOne | ai/KoSentenceBERTchatbot/KoSentenceBERT/sentence_transformers/datasets/SentencesDataset.py | 1,443 | Python |
# -*- coding: utf-8 -*-
"""
Exception and warning classes used throughout the framework.
Error: Base class, all exceptions should the subclass of this class.
- NoUsername: Username is not in user-config.py, or it is invalid.
- UserBlocked: Username or IP has been blocked
- AutoblockUser: requested action on a v... | 24.122383 | 79 | 0.696262 | [
"MIT"
] | 5j9/pywikibot-core | pywikibot/exceptions.py | 14,980 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 3/5/2018 1:49 PM
# @Author : sunyonghai
# @File : xml_utils.py
# @Software: ZJ_AI
#此程序用于编辑xml文件
# =========================================================
import random
import xml.etree.ElementTree as ET
from xml.etree.ElementTree import Element
import os
im... | 36.15748 | 118 | 0.496225 | [
"MIT"
] | FMsunyh/re_com | development/server/algorithm/tf_faster_rcnn/data_processing/utils/xml_utils.py | 14,434 | Python |
import numpy as np
from collections import defaultdict
from scipy.optimize import minimize_scalar, root_scalar, bracket
from scipy.special import logsumexp
def em_worst_expected_error(n=2, eps=1, delta=1):
def foo(p):
return np.log(p) * (1 - 1 / (1 + (n-1)*p))
a = -minimize_scalar(lambda p: foo(p), bou... | 29.403361 | 88 | 0.575879 | [
"MIT"
] | gonzalo-munillag/Exponential_Randomised_Response | Experiments/mechanisms.py | 3,499 | Python |
from plotly.basedatatypes import BaseTraceType as _BaseTraceType
import copy as _copy
class Histogram2dContour(_BaseTraceType):
# class properties
# --------------------
_parent_path_str = ""
_path_str = "histogram2dcontour"
_valid_props = {
"autobinx",
"autobiny",
"autoco... | 37.934111 | 89 | 0.557871 | [
"MIT"
] | labaran1/plotly.py | packages/python/plotly/plotly/graph_objs/_histogram2dcontour.py | 120,327 | Python |
"""
Some settings for the config files
"""
# defaultdir = '/data/ncbi/taxonomy/current'
# defaultdir = '/home/edwa0468/ncbi/taxonomy'
defaultdir = '/raid60/usr/data/NCBI/taxonomy/current/'
def get_db_dir():
"""
Just return the default dir listed above
:return: the default location for the sqllite database... | 23.4 | 58 | 0.700855 | [
"MIT"
] | linsalrob/EdwardsLab | taxon/config.py | 351 | Python |
# Generated by scripts/localization_gen.py
def _config_pretty_models(_, count):
ot = 'о'
if count == 1:
et = 'ь'
ot = 'а'
elif count in [2, 3, 4]:
et = 'и'
else:
et = 'ей'
pretty = ['ноль', 'одна', 'две', 'три', 'четыре', 'пять', 'шесть']
count = pretty[count] i... | 33.820189 | 100 | 0.598265 | [
"Apache-2.0",
"MIT"
] | Aculeasis/mdmTerminal2 | src/languages/ru.py | 15,427 | Python |
"""
A script that simulates a Python shell and accepts arbitrary commands to
execute. For use by service tests.
| Copyright 2017-2022, Voxel51, Inc.
| `voxel51.com <https://voxel51.com/>`_
|
"""
import os
os.environ["FIFTYONE_DISABLE_SERVICES"] = "1"
from fiftyone.service.ipc import IPCServer
env = {}
def handle_... | 19.62963 | 72 | 0.688679 | [
"Apache-2.0"
] | 3Demonica/fiftyone | tests/utils/interactive_python.py | 530 | Python |
from typing import List
import numpy as np
import pandas as pd
from pyspark.sql.functions import pandas_udf, PandasUDFType
from pyspark.sql.types import *
# from pyspark.sql.functions import pandas_udf,PandasUDFType
from pyspark.sql.types import StructType
from cerebralcortex.core.datatypes import DataStream
from cer... | 44.456081 | 357 | 0.614028 | [
"BSD-2-Clause"
] | MD2Korg/CerebralCortex-2.0 | cerebralcortex/markers/brushing/features.py | 13,159 | Python |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('addressbook', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='address',
name='c... | 21 | 73 | 0.609524 | [
"BSD-3-Clause"
] | 7wonders/django-addresses | addressbook/migrations/0002_auto_20150903_2227.py | 420 | Python |
# coding: utf-8
"""
Files
Upload and manage files. # noqa: E501
The version of the OpenAPI document: v3
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from hubspot.files.files.configuration import Configuration
class NextPage(object):
"""N... | 27.385185 | 139 | 0.583717 | [
"Apache-2.0"
] | Catchoom/hubspot-api-python | hubspot/files/files/models/next_page.py | 3,697 | Python |
import os
import sys
import pandas as pd
import numpy as np
import pdb
import torch
import torch.nn as nn
import torch.nn.functional as F
sys.path.insert(1,"../")
sys.path.insert(1,"../../")
sys.path.insert(1,"../../../")
sys.path.insert(1,"../../../../")
sys.path.insert(1,"../../../../../")
from confi... | 32.069767 | 167 | 0.705584 | [
"MIT"
] | ciceklab/targeted_brain_tumor_margin_assessment | train_with_your_data/scripts/cpmg/automated_metabolite_quantification/full_ppm_spectrum_network_per_metabolite/gaba/config.py | 2,758 | Python |
from flask import session, jsonify, redirect, request, Response, abort
from flask_login import current_user
from werkzeug.utils import secure_filename
from functools import wraps
from srht.objects import User
from srht.database import db, Base
from srht.config import _cfg
import json
import os
import urllib
import req... | 27.106195 | 106 | 0.588965 | [
"MIT"
] | prplecake/legacy.sr.ht | srht/common.py | 3,063 | Python |
"""
For...in em Python
Iterando strings com for...in
função range recebe esses argumentos (start=0, stop, step=1)
"""
texto = input('informe seu CPF: ')
texto_novo = ''
for letra in range(len(texto)):
if letra % 3 == 0:
texto_novo += '.' + texto[letra]
continue
texto_novo += texto[letra]
pr... | 19.941176 | 60 | 0.625369 | [
"MIT"
] | KaicPierre/Curso-de-Python3 | basico/aula019/aula019.py | 341 | Python |
#!/usr/bin/python python3
#
# Python script for finding websites which are prone to SQL injections
# Do crawling on bing or google for possible vuln urls
# Check url with qoute ' and catch error messages
# Run sqlmap against urls
#
# License:
# MIT - (c) 2016 ThomasTJ (TTJ)
#
import sys # Qui... | 46.040419 | 206 | 0.497773 | [
"MIT"
] | ThomasTJdev/python_gdork_sqli | findsqlinj.py | 30,755 | Python |
# micropolisnoticepanel.py
#
# Micropolis, Unix Version. This game was released for the Unix platform
# in or about 1990 and has been modified for inclusion in the One Laptop
# Per Child program. Copyright (C) 1989 - 2007 Electronic Arts Inc. If
# you need assistance with this program, you may contact:
# http://wi... | 36.110429 | 101 | 0.678899 | [
"MIT"
] | cmoimoro/gym-micropolis-ga | micropolis/MicropolisCore/src/pyMicropolis/micropolisEngine/micropolisnoticepanel.py | 5,886 | Python |
import json
import datetime
import time
import boto3
import os
def train_and_generate_recommendations(event, context):
# 200 is the HTTP status code for "ok".
status_code = 200
try:
# From the input parameter named "event", get the body, which contains
# the input rows.
event_bod... | 32.938525 | 136 | 0.603957 | [
"Apache-2.0"
] | Snowflake-Labs/sfguide-recommender-pipeline | sls/handler.py | 8,037 | Python |
#
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | 34.565217 | 112 | 0.686289 | [
"Apache-2.0"
] | Alice-6161/FATE | examples/pipeline/homo_logistic_regression/pipeline-homo-lr-cv.py | 3,975 | Python |
from urllib.parse import urlparse
from dotenv import load_dotenv
import requests
import os
import argparse
def shorten_link(token, url):
response = requests.post(
"https://api-ssl.bitly.com/v4/bitlinks",
headers={"Authorization": "Bearer {}".format(token)},
json={"long_url": url})
resp... | 31.462963 | 73 | 0.646851 | [
"MIT"
] | v-sht/url-shortener | main.py | 1,844 | Python |
from flask import (
Blueprint,
render_template,
g,
Response,
request,
redirect,
url_for,
abort,
)
from flask.helpers import flash
from flask_login import login_required
from saws.blueprints.utils.utils_ec2 import (
get_ec2_info,
get_key_pairs,
download_key_pair,
launch_in... | 26.958333 | 99 | 0.674137 | [
"BSD-2-Clause"
] | vlttnv/saws | saws/blueprints/compute.py | 3,882 | Python |
# AutoTransform
# Large scale, component based code modification library
#
# Licensed under the MIT License <http://opensource.org/licenses/MIT>
# SPDX-License-Identifier: MIT
# Copyright (c) 2022-present Nathan Rockenbach <http://github.com/nathro>
# @black_format
"""A change represents a submission from a run of Au... | 37.538462 | 91 | 0.780738 | [
"MIT"
] | nathro/AutoTransform | src/python/autotransform/change/__init__.py | 488 | 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 ... | 48.712644 | 234 | 0.674139 | [
"MIT"
] | James-DBA-Anderson/azure-sdk-for-python | sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/models/amazon_redshift_linked_service_py3.py | 4,238 | Python |
import os,sys
import numpy as np
import h5py, time, argparse, itertools, datetime
from scipy import ndimage
import torchvision.utils as vutils
# tensorboardX
from tensorboardX import SummaryWriter
class AverageMeter(object):
"""Computes and stores the average and current value"""
def __init__(self):
... | 24.025 | 68 | 0.627471 | [
"MIT"
] | ygCoconut/pytorch_connectomics | torch_connectomics/io/misc.py | 961 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Based on AboutArrays in the Ruby Koans
#
from runner.koan import *
class AboutLists(Koan):
def test_creating_lists(self):
empty_list = list()
self.assertEqual(list, type(empty_list))
self.assertEqual(0, len(empty_list))
def test_list_... | 31.463636 | 79 | 0.576712 | [
"MIT"
] | forwardBench/pythonKoans | python3/koans/about_lists.py | 3,461 | Python |
###
# Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2009, James McCoy
# 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 copyr... | 51.147059 | 79 | 0.757332 | [
"BSD-3-Clause"
] | DalavanCloud/supybot | plugins/Factoids/config.py | 3,478 | Python |
from seleniumbase import BaseCase
class MyTourClass(BaseCase):
def test_google_tour(self):
self.open('https://google.com/ncr')
self.wait_for_element('input[title="Search"]')
# Create a website tour using the ShepherdJS library with "dark" theme
# Same as: self.create_shepherd_to... | 49.606061 | 79 | 0.622175 | [
"MIT"
] | 1374250553/SeleniumBase | examples/tour_examples/google_tour.py | 3,274 | 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... | 41.669355 | 81 | 0.596865 | [
"MIT"
] | DemonDamon/mask-detection-based-on-tf2odapi | object_detection/utils/target_assigner_utils_test.py | 10,334 | Python |
from pypy.tool.pairtype import pairtype
from pypy.annotation import model as annmodel
from pypy.objspace.flow.model import Constant
from pypy.rpython.lltypesystem import lltype
from pypy.rlib.rarithmetic import r_uint
from pypy.rlib.objectmodel import hlinvoke
from pypy.rpython import robject
from pypy.rlib import obje... | 39.57 | 93 | 0.627496 | [
"MIT"
] | benoitc/pypy | pypy/rpython/rdict.py | 3,957 | Python |
import voluptuous as vol
from esphome.components import fan, output
import esphome.config_validation as cv
from esphome.const import CONF_HIGH, CONF_LOW, CONF_MAKE_ID, CONF_MEDIUM, CONF_NAME, \
CONF_OSCILLATION_OUTPUT, CONF_OUTPUT, CONF_SPEED, CONF_SPEED_COMMAND_TOPIC, \
CONF_SPEED_STATE_TOPIC
from esphome.cpp... | 41.044444 | 86 | 0.707093 | [
"MIT"
] | Russel-dox/ESPHome | esphome/components/fan/speed.py | 1,847 | Python |
print()
print("--- Math ---")
print(1+1)
print(1*3)
print(1/2)
print(3**2)
print(4%2)
print(4%2 == 0)
print(type(1))
print(type(1.0)) | 13.3 | 21 | 0.586466 | [
"MIT"
] | augustoscher/python-excercises | basics/math.py | 133 | Python |
import os
from keystoneauth1.identity import v3
from keystoneauth1 import session
from novaclient import client
VERSION=2
AUTH_URL=os.getenv("OS_AUTH_URL")
USERNAME=os.getenv("OS_USERNAME")
PASSWORD=os.getenv("OS_PASSWORD")
PROJECT_ID=os.getenv("OS_PROJECT_ID")
PROJECT_NAME=os.getenv("OS_PROJECT_NAME")
USER_DOMAIN_ID=... | 31.791667 | 79 | 0.781127 | [
"Apache-2.0"
] | Manashree/I590-Projects-BigData-Software | src/hw-5/lib/nclient.py | 763 | Python |
"""This module contains the general information for IdentMetaSystemFsm ManagedObject."""
from ...ucsmo import ManagedObject
from ...ucscoremeta import MoPropertyMeta, MoMeta
from ...ucsmeta import VersionMeta
class IdentMetaSystemFsmConsts:
COMPLETION_TIME_ = ""
CURRENT_FSM_NOP = "nop"
CURRENT_FSM_SYNC =... | 87.699531 | 3,753 | 0.756959 | [
"Apache-2.0"
] | CiscoUcs/ucsmsdk | ucsmsdk/mometa/ident/IdentMetaSystemFsm.py | 18,680 | Python |
import unittest
from sublist import check_lists, SUBLIST, SUPERLIST, EQUAL, UNEQUAL
class SublistTest(unittest.TestCase):
def test_unique_return_vals(self):
self.assertEqual(4, len(set([SUBLIST, SUPERLIST, EQUAL, UNEQUAL])))
def test_empty_lists(self):
self.assertEqual(EQUAL, check_lists([],... | 31.022727 | 75 | 0.586081 | [
"MIT"
] | KT12/Exercism | python/sublist/sublist_test.py | 2,730 | Python |
from sympycore import CollectingField as Algebra
Symbol = Algebra.Symbol
Number = Algebra.Number
Add = Algebra.Add
Mul = Algebra.Mul
Pow = Algebra.Pow
Terms = Algebra.Terms
Factors = Algebra.Factors
def test_symbol():
p = Symbol('p')
s = Symbol('s')
t = Symbol('t')
assert s.matches(s)=={}
assert ... | 29.427778 | 103 | 0.537474 | [
"Apache-2.0"
] | 1zinnur9/pymaclab | sympycore/basealgebra/tests/test_matches.py | 5,297 | Python |
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from google.ads.google_ads.v2.proto.resources import feed_item_target_pb2 as google_dot_ads_dot_googleads__v2_dot_proto_dot_resources_dot_feed__item__target__pb2
from google.ads.google_ads.v2.proto.services import feed_item_target_servic... | 50.826087 | 176 | 0.823211 | [
"Apache-2.0"
] | BenRKarl/google-ads-python | google/ads/google_ads/v2/proto/services/feed_item_target_service_pb2_grpc.py | 3,507 | Python |
# !/usr/bin/env python
# -*- coding: utf-8 -*-
"""Default module to train a xor classifier and write weights to disk."""
from keras.models import Sequential
from keras.layers.core import Dense, Activation
import keras.optimizers as kop
import numpy as np
import os
from sklearn.preprocessing import StandardScaler
try:... | 31.05814 | 111 | 0.671659 | [
"MIT"
] | ansrivas/keras-rest-server | createpickles.py | 2,671 | Python |
from __future__ import absolute_import, unicode_literals
from django.conf.urls import include, url
from django.contrib import admin
from django.views.generic import TemplateView
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^', TemplateView.as_view(template_name='base.html'), name='home'),
... | 29.272727 | 76 | 0.76087 | [
"BSD-3-Clause"
] | JostCrow/django-maintenance-window | tests/urls.py | 322 | Python |
import datetime
import unittest
import unittest.mock as mock
from betdaq.apiclient import APIClient
from betdaq.endpoints.account import Account
class AccountTest(unittest.TestCase):
def setUp(self):
client = APIClient('username', 'password')
self.account = Account(client)
@mock.patch('bet... | 46.04 | 106 | 0.742398 | [
"MIT"
] | ScoreX/betdaq | tests/test_account.py | 2,302 | Python |
from brownie import *
from helpers.constants import AddressZero
from helpers.registry import registry
from dotmap import DotMap
def connect_gnosis_safe(address):
return Contract.from_abi(
"GnosisSafe", address, registry.gnosis_safe.artifacts.GnosisSafe["abi"],
)
class GnosisSafeSystem:
def __ini... | 30.041667 | 80 | 0.627601 | [
"MIT"
] | EchoDao-BSC/badger-system | scripts/systems/gnosis_safe_system.py | 1,442 | Python |
from ctypes import *
import threading
import json
import os
import arcpy
class MyBuffer(threading.local):
def __init__(self):
self.buf = create_string_buffer(65535)
self.bufSize = sizeof(self.buf)
#arcpy.AddMessage("Created new Buffer {}".format(self.buf))
tls_var = MyBuffer()
from .G2Exception import ... | 43.196552 | 204 | 0.662808 | [
"MIT"
] | GeoJamesJones/ArcGIS-Senzing-Prototype | senzing/g2/sdk/python/G2ConfigMgr.py | 12,527 | Python |
start_num = int(input())
end_num = int(input())
prime_nums = []
for num in range(start_num, end_num + 1):
if num > 1:
for i in range(2, num//2+1):
if num % i == 0:
break
else:
prime_nums.append(num)
print(' '.join(map(str, prime_nums)) + ' ')
print(f'The ... | 22.555556 | 97 | 0.564039 | [
"MIT"
] | elenaborisova/Softuniada-Competition | softuniada_2021/01_easter_prize.py | 406 | Python |
class Node:
""" A singly-linked node. """
def __init__(self, data=None):
self.data = data
self.next = None
class SinglyLinkedList:
def __init__ (self):
self.tail = None
self.head = None
def append(self, data):
node = Node(data)
if self.h... | 20.375 | 34 | 0.542945 | [
"MIT"
] | PacktPublishing/Data-Structures-and-Algorithms-with-Python-Third-Edition | Chapter04/faster_append_singly_linked_list.py | 652 | Python |
# Copyright (c) 2019 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... | 43.789744 | 104 | 0.574072 | [
"Apache-2.0"
] | 0x45f/Paddle | python/paddle/fluid/trainer_factory.py | 8,539 | Python |
# https://en.m.wikipedia.org/wiki/Box_Drawing
from random import randrange
class Board:
# you only need to use update_board() outside this class.
def __init__(self, size, mine_numbers):
self.size = size
self.default_content = " ◌ "
self.board_data = self.create_board(self.size)
self.mine_numbers = mine_num... | 29.625 | 114 | 0.604486 | [
"MIT"
] | Epirius/minesweeper | board.py | 4,601 | Python |
import iris
from iris.experimental.ugrid import PARSE_UGRID_ON_LOAD
import geovista as gv
fname = "./qrclim.sst.ugrid.nc"
with PARSE_UGRID_ON_LOAD.context():
cube = iris.load_cube(fname)[0]
face_node = cube.mesh.face_node_connectivity
indices = face_node.indices_by_location()
lons, lats = cube.mesh.node_coords
... | 24.828571 | 79 | 0.735328 | [
"BSD-3-Clause"
] | trexfeathers/geovista | examples/example_from_unstructured__lfric.py | 869 | Python |
"""Post gen hook to ensure that the generated project
has only one package management, either pipenv or pip."""
import logging
import os
import shutil
import sys
_logger = logging.getLogger()
def clean_extra_package_management_files():
"""Removes either requirements files and folder or the Pipfile."""
use_pi... | 28.292683 | 79 | 0.637931 | [
"MIT"
] | HaeckelK/cookiecutter-flask | hooks/post_gen_project.py | 1,160 | Python |
# Copyright 2017 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 applicab... | 30.045 | 80 | 0.6442 | [
"Apache-2.0"
] | azhou42/tensorflow-models-private | research/pcl_rl/env_spec.py | 6,009 | Python |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2018-06-10 08:35
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('data_exchange', '0004_auto_20180610_0833'),
]
operations = [
migrations.Alt... | 25.730769 | 74 | 0.61136 | [
"MIT"
] | Ikochoy/mooclet-engine | mooclet_engine/data_exchange/migrations/0005_auto_20180610_0835.py | 669 | Python |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings.dev")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you ... | 33.4375 | 73 | 0.684112 | [
"Apache-2.0"
] | vtalks/vtalks.net | web/manage.py | 535 | Python |
# coding=utf-8
# Copyright 2018 The Google AI Language Team 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 ... | 38.071429 | 141 | 0.635241 | [
"Apache-2.0"
] | DATEXIS/adapter-transformers | tests/test_tokenization_fsmt.py | 6,396 | Python |
from django.db import models
from django.test import SimpleTestCase
from .models import Book, ChildModel1, ChildModel2
class IndexesTests(SimpleTestCase):
def test_suffix(self):
self.assertEqual(models.Index.suffix, 'idx')
def test_repr(self):
index = models.Index(fields=['title'])
... | 42.362637 | 102 | 0.679377 | [
"Apache-2.0"
] | HSunboy/hue | desktop/core/ext-py/Django-1.11/tests/model_indexes/tests.py | 3,855 | Python |
import urllib.request as ul
import json
import pandas as pd
def get_chart(ticker, period1, period2):
url = f"http://localhost:9000/chart/{ticker}?period1={period1}&period2={period2}"
request = ul.Request(url)
response = ul.urlopen(request)
rescode = response.getcode()
if rescode != 200:
... | 21.714286 | 85 | 0.674342 | [
"MIT"
] | SHSongs/EFT | client/main.py | 608 | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import numpy as np
from time import time
import tensorflow as tf
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.metrics import roc_auc_score
class ProductNN(BaseEstimator, TransformerMixin):
def __init__(self, feature_size, field_size, embedding_si... | 47.574924 | 120 | 0.577296 | [
"MIT"
] | Daniel1586/Initiative_RecSys | tutorials/chapter_05_ProductNN/ProductNN.py | 15,649 | Python |
# -*- coding: utf-8 -*-
"""
Created on Tue May 12 00:00:00 2020
@author: Shaji
"""
import boto3
import os
boto3.setup_default_session()
s3_client = boto3.client('s3')
def list_buckets(client=s3_client):
"""
Usage: [arg1]:[initialized s3 client object],
Description: Gets the list of buckets... | 33.035714 | 162 | 0.591712 | [
"MIT"
] | vkreat-tech/ctrl4bi | ctrl4bi/aws_connect.py | 2,775 | Python |
n1 = int(input('Digite um valor: '))
n2 = int(input('Digite outro valor: '))
s = n1 + n2
print('A soma entre {} e {} é igual a {}!'.format(n1, n2, s)) | 37.5 | 61 | 0.586667 | [
"MIT"
] | libaniaraujo/Python-Curso-em-Video | exe003.py | 151 | 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 use ... | 30.718919 | 289 | 0.608657 | [
"Apache-2.0"
] | KUAN-HSUN-LI/submarine | submarine-sdk/pysubmarine/submarine/experiment/models/kernel_spec.py | 5,683 | Python |
# Proton JS - Proton.py
# by Acropolis Point
# module imports
import os
import json
import time
from flask import Flask, jsonify, request, render_template
app = Flask(__name__)
@app.route('/new', methods=['POST'])
# new() function definition
def new():
os.system("python3 window.py " + request.get_data(as_text =... | 25.119048 | 73 | 0.648341 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | acropolis-point/ProtonJS | server.py | 1,055 | Python |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Copyright (c) 2017 The Californiacoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test running californiacoind with the -rpcbind ... | 45.422018 | 162 | 0.626742 | [
"MIT"
] | CaliforniaCoinCAC/californiacoin | test/functional/rpcbind_test.py | 4,951 | Python |
# needs:fix_opt_description
# needs:check_deprecation_status
# needs:check_opt_group_and_type
# needs:fix_opt_description_indentation
# needs:fix_opt_registration_consistency
# Copyright 2016 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# ... | 35.516729 | 79 | 0.690365 | [
"Apache-2.0"
] | jeckxie/gxzw-nova | nova/conf/libvirt.py | 38,216 | Python |
import re
import matplotlib.pyplot as plt
from DatasetHandler.ContentSupport import isNotNone, isNone
from Plotter.SavePlots import PlotSaver
class HistoryPlotter(object):
"""
This class provides a History plotting pipeline using mathplot.
"""
_using_history:bool = False # This for a later implemented... | 48.365979 | 231 | 0.553981 | [
"MIT"
] | ReleasedBrainiac/GraphToSequenceNN | Scripts/Plotter/PlotHistory.py | 18,766 | Python |
import json
from transformers.tokenization_utils import PreTrainedTokenizer
from yacs.config import CfgNode
from openprompt.data_utils import InputFeatures
import re
from openprompt import Verbalizer
from typing import *
import torch
import torch.nn as nn
import torch.nn.functional as F
from openprompt.utils.logging im... | 42.146597 | 183 | 0.652422 | [
"Apache-2.0"
] | BIT-ENGD/OpenPrompt | openprompt/prompts/one2one_verbalizer.py | 8,050 | Python |
# MIT License
#
# Copyright (C) 2021. Huawei Technologies Co., Ltd. All rights reserved.
#
# 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 th... | 33.24 | 83 | 0.690734 | [
"MIT"
] | ehtnamuh/Smarts-Fork | smarts/core/tests/test_sensors.py | 3,324 | Python |
from PIL import Image
import gspread
import hashlib
from googleapiclient.errors import HttpError
from oauth2client.service_account import ServiceAccountCredentials
import pickle
import os.path
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.... | 36.223958 | 130 | 0.63005 | [
"MIT"
] | IPL-Splat/IPL-Splat.github.io | dataProcessor/processBio.py | 6,955 | Python |
#
# Copyright Contributors to the OpenTimelineIO project
#
# Licensed under the Apache License, Version 2.0 (the "Apache License")
# with the following modification; you may not use this file except in
# compliance with the Apache License and the following modification to it:
# Section 6. Trademarks. is deleted and rep... | 38.877193 | 79 | 0.733303 | [
"Apache-2.0"
] | AWhetter/OpenTimelineIO | src/py-opentimelineio/opentimelineio/algorithms/timeline_algo.py | 2,216 | Python |
# -*- coding: utf-8 -*-
"""Functions to make simple plots with M/EEG data."""
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Denis Engemann <denis.engemann@gmail.com>
# Martin Luessi <mluessi@nmr.mgh.harvard.edu>
# Eric Larson <larson.eric.d@gmail.com>
# Cathy Nangini... | 37.417305 | 79 | 0.572595 | [
"BSD-3-Clause"
] | Aniket-Pradhan/mne-python | mne/viz/misc.py | 48,875 | Python |
#!/usr/bin/env python3
# Copyright (c) 2019-2020 The PIVX developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Tests v2, v3 and v4 Zerocoin Spends
'''
from time import sleep
from test_framework.authproxy import JSONRPC... | 43.775148 | 117 | 0.643687 | [
"MIT"
] | pw512/peony | test/functional/wallet_zerocoin_publicspends.py | 7,398 | 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 ... | 38.121212 | 90 | 0.645469 | [
"MIT"
] | Jackbk/azure-iot-cli-extension | azext_iot/sdk/iothub/service/models/configuration_queries_test_response.py | 1,258 | Python |
########################################################
# run_tp.py
# Author: Jamie Zhu <jimzhu@GitHub>
# Created: 2014/2/6
# Last updated: 2014/5/8
# Implemented approach: CloudPred
# Evaluation metrics: MAE, NMAE, RMSE, MRE, NPRE
########################################################
import numpy as np
import os... | 36.040541 | 94 | 0.608549 | [
"MIT"
] | YuwenXiong/WS-DREAM | benchmarks/hybrid/CloudPred/run_tp.py | 2,667 | Python |
"""This code demonstrates how to perform the tested data reduction module.
"""
import os
import sys
import glob
import pyabf
import matplotlib.pyplot as plt
pathToHere = os.path.abspath(os.path.dirname(__file__))
pathToData = os.path.abspath(pathToHere + "/../data/")
pathToModule = os.path.abspath(pathTo... | 35.692308 | 123 | 0.608621 | [
"MIT"
] | MS44neuro/drtest | examples/scripts/data_reduction_ex1.py | 2,320 | Python |
"""
Validate that instances of `affine.Affine()` can be pickled and unpickled.
"""
import pickle
from multiprocessing import Pool
import affine
def test_pickle():
a = affine.Affine(1, 2, 3, 4, 5, 6)
assert pickle.loads(pickle.dumps(a)) == a
def _mp_proc(x):
# A helper function - needed for test_with_... | 24 | 74 | 0.668011 | [
"MIT"
] | Con-Mi/lambda-packs | Lxml_requests/source/affine/tests/test_pickle.py | 744 | Python |
# -*- coding: utf-8 -*-
"""
zeronimo.results
~~~~~~~~~~~~~~~~
:copyright: (c) 2013-2017 by Heungsub Lee
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from binascii import hexlify
from gevent.event import AsyncResult
from gevent.queue import Queue
from zeronimo.... | 27.68 | 79 | 0.615607 | [
"BSD-3-Clause"
] | sublee/zeronimo | zeronimo/results.py | 4,844 | Python |
from forums.models import Forum, Comment
from django.views import View
from django.views import generic
from django.shortcuts import render, get_object_or_404, redirect
from django.urls import reverse
from django.contrib.auth.mixins import LoginRequiredMixin
from forums.forms import CommentForm
from myarts.owner imp... | 33.016949 | 106 | 0.724846 | [
"MIT"
] | wajihma/Django | forums/views.py | 1,948 | Python |
#!/usr/bin/env python
"""Parse a keyword-value message.
History:
2002-12-16 ROwen
2003-06-25 ROwen Modified to return an opscore.RO.Alg.OrderedDict
2003-11-19 ROwen Modified header: keywords with no values may have an '='.
Added "noValKey=" to test cases as it caused an infinite loop.
2004-0... | 39.111111 | 92 | 0.636048 | [
"BSD-3-Clause"
] | sdss/opscore | python/opscore/RO/ParseMsg/ParseData.py | 3,168 | Python |
from django.template.backends import django
from django.shortcuts import render, redirect
def main_board(request):
return render(request, 'main_page.html')
def redirect_main(request):
return redirect('main_boar_url', permanent=True)
| 20.5 | 52 | 0.780488 | [
"MIT"
] | nikonura/ITMO_ICT_WebProgramming_2020 | students/k3342/laboratory_works/Nikonchuk_Anna/Lr1/minos/minos/views.py | 246 | Python |
# -*- coding: utf-8 -*-
#
# Copyright 2017 Mycroft AI 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 ... | 48.168067 | 79 | 0.527041 | [
"Apache-2.0"
] | JarbasAl/lingua-franca | test/test_parse_sv.py | 5,778 | Python |
# -----------------------------------------------------
# File: temperature.py
# Author: Tanner L
# Date: 09/20/19
# Desc: Temperature sensor communication
# Inputs:
# Outputs: temperature
# -----------------------------------------------------
import threading as th
import logging
import time
import interface
import a... | 29.681818 | 89 | 0.469117 | [
"MIT"
] | tdroque/byke_interface | byke_interface/temperature.py | 1,959 | Python |
from bokeh.layouts import gridplot
from bokeh.models import BooleanFilter, CDSView, ColumnDataSource
from bokeh.plotting import figure, show
source = ColumnDataSource(data=dict(x=[1, 2, 3, 4, 5], y=[1, 2, 3, 4, 5]))
booleans = [True if y_val > 2 else False for y_val in source.data['y']]
view = CDSView(filter=BooleanFi... | 40.388889 | 85 | 0.698762 | [
"BSD-3-Clause"
] | harmbuisman/bokeh | sphinx/source/docs/user_guide/examples/data_filtering_boolean_filter.py | 727 | Python |
# while ve if ile hesap makinesi ornegi
giriş = """
(1) topla
(2) çıkar
(3) çarp
(4) böl
(5) karesini hesapla
(6) karekök hesapla
(7) cikis
"""
print(giriş)
while True:
soru = int(input("Yapmak istediğiniz işlemin numarasını girin : "))
if soru == 7:
print("çıkılıyor...")
br... | 31.615385 | 80 | 0.574209 | [
"MIT"
] | omerkocadayi/WeWantEd---Pythona-Giris | 04-hesap-makinesi.py | 1,754 | Python |
import os.path as osp
import pickle
import shutil
import tempfile
import time
import mmcv
import torch
import torch.distributed as dist
from mmcv.image import tensor2imgs
from mmcv.runner import get_dist_info
from mmdet.core import encode_mask_results
def single_gpu_test(model,
data_loader,
... | 35.732984 | 79 | 0.603077 | [
"Apache-2.0"
] | lizhaoliu-Lec/Conformer | mmdetection/mmdet/apis/test.py | 6,825 | Python |
"""
Toxopy (https://github.com/bchaselab/Toxopy)
© M. Alyetama, University of Nebraska at Omaha
Licensed under the terms of the MIT license
"""
from toxopy import fwarnings, trials
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
def dlcboxplot(file,
variable,
y... | 29.484127 | 65 | 0.499058 | [
"MIT"
] | bchaselab/Toxopy | toxopy/dlcboxplot.py | 3,718 | Python |
import os
from django.test import TestCase
from django.core.exceptions import ValidationError
from unittest import mock
from conda.cli.python_api import Commands
from tethys_apps.cli import install_commands
FNULL = open(os.devnull, 'w')
class TestServiceInstallHelpers(TestCase):
@mock.patch('builtins.open', sid... | 52.559395 | 120 | 0.707253 | [
"BSD-2-Clause"
] | Aquaveo/tethys | tests/unit_tests/test_tethys_apps/test_cli/test_install_commands.py | 24,335 | Python |
import logging
import pytest
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import kornia as kornia
logger = logging.getLogger(__name__)
class TestIntegrationFocalLoss:
# optimization
thresh = 1e-1
lr = 1e-3
num_iterations = 1000
num_classes = 2
... | 30.736842 | 70 | 0.602312 | [
"Apache-2.0"
] | BloodAxe/kornia | test/integration/test_focal.py | 2,336 | Python |
"""Tasks to help Robot Framework packaging and other development.
Executed by Invoke <http://pyinvoke.org>. Install it with `pip install invoke`
and run `invoke --help` and `invoke --list` for details how to execute tasks.
See BUILD.rst for packaging and releasing instructions.
"""
from pathlib import Path
from urll... | 36.23741 | 118 | 0.694163 | [
"ECL-2.0",
"Apache-2.0"
] | ConradDjedjebi/robotframework | tasks.py | 10,074 | Python |
#!/usr/bin/env python3
# Copyright (c) 2014-2020 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 backup features.
Test case is:
4 nodes. 1 2 and 3 send transactions between each other... | 38.722944 | 187 | 0.650755 | [
"MIT"
] | tcoin01/Agrocoin | test/functional/wallet_backup.py | 8,945 | Python |
# Copyright 2008-2015 Nokia Solutions and Networks
#
# 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 l... | 32.686131 | 77 | 0.648504 | [
"ECL-2.0",
"Apache-2.0"
] | moto-timo/robotframework | src/robot/running/outputcapture.py | 4,478 | Python |
"""A module for useful functions.
:author: Matthew Gidden <matthew.gidden _at_ gmail.com>
"""
import numpy as np
rms = lambda a, axis=None: np.sqrt(np.mean(np.square(a), axis=axis))
| 23.5 | 68 | 0.696809 | [
"BSD-3-Clause"
] | gidden/cyclopts | cyclopts/functionals.py | 188 | Python |
"""
Support for showing the date and the time.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.time_date/
"""
from datetime import timedelta
import asyncio
import logging
import voluptuous as vol
from homeassistant.components.sensor import PLATFO... | 30.40367 | 79 | 0.645142 | [
"MIT"
] | mweinelt/home-assistant | homeassistant/components/sensor/time_date.py | 3,314 | Python |
# NASA EO-Metadata-Tools Python interface for the Common Metadata Repository (CMR)
#
# https://cmr.earthdata.nasa.gov/search/site/docs/search/api.html
#
# Copyright (c) 2020 United States Government as represented by the Administrator
# of the National Aeronautics and Space Administration. All Rights Reserved.
#
# ... | 38.032922 | 100 | 0.62757 | [
"Apache-2.0"
] | nasa/eo-metadata-tools | CMR/python/cmr/util/network.py | 9,242 | Python |
import copy
from enum import Enum
import multiprocessing
import numpy as np
from functools import cmp_to_key
import plotly as py
import plotly.figure_factory as ff
import plotly.graph_objects as go
from plotly.subplots import make_subplots
import plotly
from collections import defaultdict
import os
from pynvml import *... | 45.999041 | 229 | 0.59318 | [
"MIT"
] | GIS-PuppetMaster/TENSILE | pycode/tinyflow/Scheduler.py | 49,665 | Python |
horasextra = int(input("¿Cuantas horas extra has trabajado? "))
horas = horasextra + 35 #elminimo
extra = 0
sueldo = 0
class trabajo:
def __init__(self, horasextra, horas, extra, sueldo): #defino el constructor
self.horasextra = horasextra
self.horas = horas
self.extra = extra
self.s... | 43.208333 | 144 | 0.60945 | [
"Apache-2.0"
] | joseluis031/Introducci-n-a-la-algor-tmica | ej11.py | 1,042 | Python |
class Hamming:
def distance(self, gene1, gene2):
if type(gene1) != str or type(gene2) != str:
return "Genes have to be strings"
if len(gene1) != len(gene2):
return "Genes have to have same lenghts"
diff = 0
for i in range(0, len(gene1)):
if gene1[i... | 34.545455 | 52 | 0.513158 | [
"MIT"
] | TestowanieAutomatyczneUG/laboratorium-7-wgulan | src/sample/Hamming.py | 380 | Python |
#!/usr/bin/env python
# -*- coding: UTF8 -*-
import site
import sys
import time
import rpyc
from rpyc.core.service import Service, ModuleNamespace
from rpyc.lib.compat import execute, is_py3k
import threading
import weakref
import traceback
import os
import subprocess
import threading
import multiprocessing
import logg... | 24.375 | 132 | 0.730598 | [
"BSD-3-Clause"
] | wrtcoder/pupy | client/reverse_ssl.py | 2,925 | Python |
# -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.4'
# jupytext_version: 1.2.1
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
import sys
print(sys.path)
sys.... | 23.298969 | 96 | 0.567257 | [
"MIT"
] | msakai/chainer-differentiable-mpc | examples/Boyd_lqr.py | 2,276 | Python |
'''
Created on August 18th 2020
@author: Nisha Srinivas
'''
import faro
import os
import faro.proto.proto_types as pt
import faro.proto.face_service_pb2 as fsd
import numpy as np
import pyvision as pv
import time
from PIL import Image
import json
import faro.proto.geometry_pb2 as geo
from array import array
roc = N... | 44.027897 | 331 | 0.640347 | [
"MIT"
] | ORNL/faro | src/faro/face_workers/RankOneFaceWorker.py | 20,517 | Python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from locales import Locales
print("content-type:text/html\n\n")
locales_obj = Locales('en')
print(locales_obj.get_missing_translations())
| 18.8 | 45 | 0.723404 | [
"MIT"
] | letztes/achtelbass2web | get_missing_translations.py | 188 | Python |
"""
Generate Steady-State Auditory Evoked Potential (SSAEP)
=======================================================
Steady-State Auditory Evoked Potential (SSAEP) - also known as Auditory
Steady-State Response (ASSR) - stimulus presentation.
"""
from time import time
import numpy as np
from pandas import DataFrame... | 25.923767 | 90 | 0.619962 | [
"BSD-3-Clause"
] | Neuroelektroteknia/eeg-notebooks | eegnb/experiments/auditory_ssaep/ssaep.py | 5,781 | Python |
import sqlalchemy
from databases import Database
DATABASE_URL = "sqlite:///sampleSQlite.db"
database = Database(DATABASE_URL)
sqlalchemy_engine = sqlalchemy.create_engine(DATABASE_URL)
def get_database() -> Database:
return database
| 21.818182 | 58 | 0.8 | [
"MIT"
] | spideynolove/Other-repo | backend/fastapi/build_dsApp/Databases/sqlalchemy/database.py | 240 | Python |
import os
from ml_serving import Config as ServingConfig
class ClusteringConfig(ServingConfig):
min_cluster_size: int
cosine_thrsh: float
def __init__(self, **kwargs):
super().__init__()
for arg, dtype in self.__class__.__annotations__.items():
if arg in kwargs:
... | 31.714286 | 66 | 0.630631 | [
"MIT"
] | gasparian/ml-serving-template | producers/short-texts-clustering/src/clustering/config.py | 444 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.