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
'''
Edit gizmo snapshot files: compress, delete, transfer across machines.
@author: Andrew Wetzel <arwetzel@gmail.com>
'''
# system ----
from __future__ import absolute_import, division, print_function # python 2 compatability
import os
import sys
import glob
import numpy as np
# local ----
i... | 37.668132 | 100 | 0.590641 | [
"Apache-2.0"
] | UAPH4582/PH482_582 | students_final_projects/group-f/gizmo_analysis/gizmo_file.py | 17,139 | Python |
import re
from django import forms
from django.contrib.admin.widgets import AdminFileWidget
from django.forms.models import inlineformset_factory, BaseInlineFormSet
from django.utils.translation import ugettext_lazy as _
from multi_email_field.forms import MultiEmailField
from pycon.sponsorship.models import Sponsor,... | 34.418919 | 94 | 0.586965 | [
"BSD-3-Clause"
] | tylerdave/PyCon-Website | pycon/sponsorship/forms.py | 5,094 | Python |
import logging
from common_lib.backend_service.generated.backend_service_v1_pb2_grpc import BackendServiceServicer
import common_lib.backend_service.generated.service_types_v1_pb2 as service_messages
from common_lib.grpc import GrpcExceptionHandler
logger = logging.getLogger(__name__)
class BackendService(BackendServ... | 34.078947 | 99 | 0.587645 | [
"MIT"
] | dgildeh/otel-python-cloud-run | backend-service/backend_service/service.py | 1,295 | Python |
class Solution:
def transpose(self, matrix: [[int]]) -> [[int]]:
m = len(matrix)
n = len(matrix[0])
res = [[0] * m for _ in range(n)]
for i in range(m) :
for j in range(n) :
res[j][i] = matrix[i][j]
return res
if __name__ == "__main__" :
s =... | 25.235294 | 52 | 0.459207 | [
"Apache-2.0"
] | russellgao/algorithm | dailyQuestion/2021/2021-02/02-25/python/solution.py | 429 | Python |
# A simple script to generate fake data
import sys, random, math, json
import datetime as dt
USAGE = 'Usage: python make_fake_fixtures.py [num_of_members] [num_of_games] [num_of_tournaments]'
# Fake Names: First and Last
GIVEN_NAMES = [ 'bruce', 'malcolm', 'kobe', 'peter', 'kaylee', 'inara' ]
LAST_NAMES = [ 'lee', 'r... | 36.904523 | 105 | 0.541667 | [
"MIT"
] | annabunches/agagd | scripts/make_fake_fixtures.py | 7,344 | Python |
# Generated by Django 2.2.7 on 2019-11-05 22:35
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
import orders.models
import orders.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
('courses', '0002_CourseGeniti... | 42.358974 | 167 | 0.641041 | [
"MIT"
] | iNerV/education-backend | src/orders/migrations/0001_initial.py | 1,652 | Python |
#!/usr/bin/python3
#
# Copyright (c) Siemens AG, 2020
# tiago.gasiba@gmail.com
#
# SPDX-License-Identifier: MIT
#
import subprocess
import results
import pexpect
import shutil
import util
import sys
import re
import os
print("Start Test")
# make clean
ret = subprocess.run(["make clean"], shell=True, stdout=subproc... | 45.470588 | 140 | 0.53273 | [
"MIT"
] | saucec0de/sifu | Challenges/C_CPP/0005_pizza/run.py | 7,730 | Python |
# (C) Copyright 2012-2019 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovern... | 27.164835 | 93 | 0.708738 | [
"Apache-2.0"
] | falkephi/skinnywms | skinnywms/wmssvr.py | 2,472 | Python |
temporary_zones = {
'forest': {
'room_keys': [
'a sacred grove of ancient wood', 'a sparsely-populated fledgling forest',
'a cluster of conifer trees'
]
},
'sewer': {
'room_keys': [
'a poorly-maintained sewage tunnel', 'a sewer tunnel constru... | 49.717514 | 101 | 0.520455 | [
"Unlicense"
] | kovitikus/hecate | rooms/zones.py | 8,804 | Python |
# Copyright 2016 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 30.422535 | 74 | 0.663889 | [
"Apache-2.0"
] | ammayathrajeshnair/googlecloudpython | vision/setup.py | 2,160 | Python |
"""Unit tests for the Nexus Parser
"""
from unittest import TestCase, main
from cogent3 import load_aligned_seqs
from cogent3.parse.nexus import (
MinimalNexusAlignParser,
find_fields,
get_BL_table,
get_tree_info,
parse_dnd,
parse_nexus_tree,
parse_PAUP_log,
parse_taxa,
parse_trans... | 43.02765 | 830 | 0.538021 | [
"BSD-3-Clause"
] | tla256/cogent3 | tests/test_parse/test_nexus.py | 18,674 | Python |
from matplotlib import rc
rc("font", family="serif", size=12)
rc("text", usetex=True)
rc("text.latex", preamble=open("macros.tex").read())
#import daft
import imp
daft = imp.load_source('daft', '/Users/kpmurphy/github/daft/daft.py')
import os
pgm = daft.PGM([4, 4], origin=[0, 0])
pgm.add_node(daft.Node("one", r"... | 28.365854 | 69 | 0.629407 | [
"MIT"
] | herupraptono/kevmurphyML | figureCode/daft/mlpXor.py | 1,163 | Python |
#! /usr/bin/env python3
# counts the number of regions in a matrix
# vertically and horizontally connected
# e.g.
# [1, 0, 1, 1]
# [0, 1, 0, 0]
# [1, 1, 0, 1]
# has 4 regions
class Patch(object):
def __init__(self, visited, value):
self.visited = visited
self.value = value
def __repr__(self)... | 23.783333 | 70 | 0.603364 | [
"Unlicense"
] | nisstyre56/Interview-Problems | regions.py | 1,427 | Python |
from __future__ import division
import errno
import os
import re
import shutil
import time
import uuid
from collections import namedtuple
from itertools import repeat
from pprint import pformat
import pytest
from cassandra import WriteFailure
from cassandra.concurrent import (execute_concurrent,
... | 43.051176 | 132 | 0.624398 | [
"Apache-2.0"
] | Ankou76ers/cassandra-dtest | cdc_test.py | 31,126 | Python |
from os.path import isfile
from os.path import join
import matplotlib.pyplot as plt
import pytest
from SciDataTool import DataTime, Data1D, DataLinspace, VectorField, Norm_ref
from numpy import linspace, sin, squeeze
from Tests import TEST_DATA_DIR
from Tests import save_plot_path as save_path
from pyleecan.Classes.I... | 31.835789 | 88 | 0.570427 | [
"Apache-2.0"
] | EOMYS-Public/pyleecan | Tests/Plot/test_plots.py | 15,128 | Python |
'''A module for loading settings'''
import logging.config
import sys
from logging import getLogger
from pathlib import Path
import yaml
from hazelsync.metrics import get_metrics_engine
DEFAULT_SETTINGS = '/etc/hazelsync.yaml'
CLUSTER_DIRECTORY = '/etc/hazelsync.d'
DEFAULT_LOGGING = {
'version': 1,
'formatt... | 33.241935 | 83 | 0.598496 | [
"Apache-2.0"
] | Japannext/hazelsync | hazelsync/settings.py | 4,122 | Python |
from src.models.user.contribs import (
ContributionDay,
FullContributionDay,
FullUserContributions,
Language,
RepoContributionStats,
UserContributions,
)
from src.models.user.follows import User, UserFollows
from src.models.user.main import FullUserPackage, UserPackage
from src.models.wrapped.ba... | 26.311111 | 85 | 0.724662 | [
"MIT"
] | avgupta456/github-trends | backend/src/models/__init__.py | 1,184 | Python |
# Generated by Django 3.0.5 on 2020-04-23 19:10
import datetime
from django.db import migrations, models
import django.db.models.deletion
import wagtail.core.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
('wagtailimages', '0001_squashed_0021'),
('wagtailcore'... | 40.934783 | 191 | 0.613914 | [
"MIT"
] | sfikrakow/www | blog/migrations/0001_initial.py | 1,883 | Python |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2020 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... | 39.217213 | 119 | 0.612917 | [
"Apache-2.0"
] | springborland/bk-sops | pipeline_plugins/variables/collections/sites/open/cc.py | 9,905 | Python |
# Import packages
import os
from tensorflow.keras.optimizers import Adam
from tensorflow.keras.datasets import mnist
from sklearn.preprocessing import LabelBinarizer
# Import model builder from model_build.py
from model_build import DRbuild
# Load MNIST dataset
((trainData, trainLabels), (testData, testLabels)) = mni... | 25.272727 | 70 | 0.735252 | [
"MIT"
] | eightlay/SudokuSolver | src/model_train.py | 1,390 | Python |
"""Account, user fixtures."""
import json
import logging
from time import monotonic, sleep
from typing import List, NamedTuple, Optional, Tuple
import pytest
from box import Box
from dynaconf import settings
from ambra_sdk.exceptions.service import DuplicateName, NotEmpty
from ambra_sdk.models import Group
from ambr... | 26.704871 | 79 | 0.554828 | [
"Apache-2.0"
] | agolovkina/sdk-python | tests/fixtures/account.py | 9,320 | Python |
import cv2 as cv
import numpy as np
from matplotlib import pyplot as plt
#直方图反向投影
def bitwise_and():
small = cv.imread("C:/1/image/small.jpg")
big = cv.imread("C:/1/image/big.jpg")
small_hsv = cv.cvtColor(small, cv.COLOR_BGR2HSV)
big_hsv = cv.cvtColor(big, cv.COLOR_BGR2HSV)
"""
h,s,v = cv.spl... | 27.508197 | 89 | 0.644815 | [
"Apache-2.0"
] | Sanduoo/OpenCV-Python | 11_ Histogram3.py | 1,732 | Python |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.10.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re... | 27.897297 | 121 | 0.583608 | [
"Apache-2.0"
] | StephenPCG/python | kubernetes/client/models/v2beta1_cross_version_object_reference.py | 5,161 | Python |
from flask import Flask, redirect, render_template, request
import os
import sys
from flasgger import Swagger
from server import app
from server.routes.prometheus import track_requests
from os import path
from userapp import improcess
import base64
app=Flask(__name__)
global images
images = []
# The python-flask sta... | 27.627273 | 94 | 0.678842 | [
"Apache-2.0"
] | Bhaskers-Blu-Org1/process-images-derive-insights | sources/image_preprocessor/__init__.py | 3,039 | Python |
import tensorflow as tf
from tensorflow.keras.callbacks import ModelCheckpoint
import os
class TensorBoardFix(tf.keras.callbacks.TensorBoard):
"""
This fixes incorrect step values when using the TensorBoard callback with custom summary ops
https://stackoverflow.com/questions/64642944/steps-of-tf-summar... | 38.175 | 107 | 0.603143 | [
"MIT"
] | aguirrejuan/ConvRFF | convRFF/utils/utils.py | 1,527 | Python |
# MIT License
#
# Copyright (C) IBM Corporation 2018
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge... | 47.571429 | 120 | 0.693176 | [
"MIT"
] | Agisthemantobeat/adversarial-robustness-toolbox | tests/attacks/test_virtual_adversarial.py | 9,657 | Python |
# Copyright 2021 Zilliz. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | 44.528302 | 110 | 0.752966 | [
"Apache-2.0"
] | L-Net-1992/towhee | towhee/engine/operator_runner/__init__.py | 2,360 | Python |
import json
import os
import glob
import cv2
annotations_info = {'images': [], 'annotations': [], 'categories': []}
CLASS_NAME = ('__background__','plane', 'baseball-diamond', 'bridge', 'ground-track-field',
'small-vehicle', 'large-vehicle', 'ship',
'tennis-court', 'basketball-court',... | 36.203704 | 99 | 0.640921 | [
"MIT"
] | NaCl-Ocean/Anchor_free_detection_rotation | tools/test_label.py | 2,019 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# sylco.py
"""
Combined algorithm by EA :
http://about.me/emre.aydin
http://github.com/eaydin
1) if letters < 3 : return 1
2) if doesn't end with "ted" or "tes" or "ses" or "ied", discard "es" and "ed" at the end.
3) discard trailing "e", except where ending is "le", als... | 30.597285 | 168 | 0.589175 | [
"Unlicense"
] | balysv/HaikuBotto | sylco.py | 6,762 | Python |
from .client import Client
from .resources import Code
from .constants import ERROR_CODE
from .constants import HTTP_STATUS_CODE
__all__ = [
'Client',
'Code',
'ERROR_CODE',
'HTTP_STATUS_CODE',
]
| 17.666667 | 39 | 0.716981 | [
"Apache-2.0"
] | PaypayBob/paypayopa-sdk-python | paypayopa/__init__.py | 212 | Python |
"""Remesh a 3D mesh.
author : Tom Van Mele, Matthias Rippmann
email : van.mele@arch.ethz.ch
"""
from __future__ import print_function
from compas.datastructures import Mesh
from compas.datastructures import trimesh_remesh
from compas.datastructures import mesh_quads_to_triangles
from compas.geometry import centroi... | 24.283186 | 72 | 0.721574 | [
"MIT"
] | Mahdi-Soheyli/compas | docs/_examples/mesh-remeshing-on-mesh.py | 2,744 | Python |
##################
### original author: Parashar Dhapola
### modified by Rintu Kutum
##################
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import pandas as pd
import re
import json
import pybedtools as pbt
import collections
from scipy.stats import ttest_ind, sem, mannwhitneyu, ... | 40.853211 | 104 | 0.654278 | [
"MIT"
] | rintukutum/TRF2-DNase-ChIP | 3-d-generate-Fig-3A-C-and-Suppl-fig-4A-D.py | 8,906 | Python |
import numpy as np
import pandas as pd
import os
import re
import fuelcell as fc
class Datum():
def __init__(self, name, data):
# data
self.name = name
self.raw_data = data
self.label = name
self.processed_data = None
self.expt_type = None
# processed values
self.current_data = None
self.potentia... | 20.613208 | 48 | 0.743707 | [
"MIT"
] | abhikandoi/fuelcell | fuelcell/model.py | 4,370 | Python |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
OpenAPI spec version: release-1.16
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
class Exten... | 32.239819 | 312 | 0.622737 | [
"Apache-2.0"
] | ACXLM/python | kubernetes/client/models/extensions_v1beta1_scale.py | 7,125 | Python |
#input variables to Monthly Attribution Paid Campaign Cloning Step 12: Deactivate + Delete Smart Campaigns
input={
'token': 'Token', #from Step 3: Get Token
'parent id': 'fid', #from Step 4: Get Lv2 Folder or Create Lv2 Folder
}
import re
import urllib.parse
import calendar
import datetime
headers = {
... | 31.903226 | 110 | 0.635996 | [
"MIT"
] | tyron-pretorius/zapier | monthly_attribution_paid_campaign_cloning/deactivate_+_delete_smart_campaigns.py | 989 | Python |
'''
Copyright 2020, Amazon Web Services Inc.
This code is licensed under MIT license (see LICENSE.txt for details)
Python 3
'''
class TransportException(Exception):
'''Raised by the transport layer for most issues.'''
class BadHTTPMethod(Exception):
'''Raised for methods missing from the requests library.'''... | 26.571429 | 78 | 0.734767 | [
"Apache-2.0"
] | 123BLiN/community | es_sink/es_sink/transport_exceptions.py | 558 | Python |
"""Controller para UpdateUser"""
from typing import Type, Optional
from datetime import datetime
from mitmirror.domain.usecases import UpdateUserInterface
from mitmirror.domain.models import User
from mitmirror.presenters.interfaces import ControllerInterface
from mitmirror.presenters.helpers import HttpRequest, HttpRe... | 31.409524 | 91 | 0.604912 | [
"MIT"
] | Claayton/mitmirror-api | mitmirror/presenters/controllers/users/update_user_controller.py | 3,299 | Python |
# Licensed under the MIT license
# http://opensource.org/licenses/mit-license.php
# Copyright 2006, Frank Scholz <coherence@beebits.net>
class RenderingControlClient:
def __init__(self, service):
self.service = service
self.namespace = service.get_type()
self.url = service.get_control_url... | 40.27907 | 98 | 0.630196 | [
"BSD-3-Clause"
] | AndyThirtover/wb_gateway | WebBrickLibs/coherence/upnp/services/clients/rendering_control_client.py | 3,464 | Python |
import os
from telethon import TelegramClient, events, sync
from dotenv import load_dotenv
sleeping_txt = "I'm sleeping right now, get back to you when I wake up"
turned_on = False
already_messaged_users = set()
if __name__ == "__main__":
load_dotenv(override=True, verbose=True)
api_id = int(os.getenv("API_I... | 32.480769 | 74 | 0.631735 | [
"MIT"
] | gmelodie/brb | main.py | 1,689 | Python |
from typing import TypeVar
from datetime import datetime
from gphotos import Utils
from gphotos.DbRow import DbRow
from gphotos.DatabaseMedia import DatabaseMedia
from gphotos.GoogleAlbumMedia import GoogleAlbumMedia
import logging
log = logging.getLogger(__name__)
# this allows self reference to this class in its fa... | 28.372549 | 68 | 0.629578 | [
"MIT"
] | dehnert/gphotos-sync | gphotos/GoogleAlbumsRow.py | 1,447 | Python |
import pygame
from game.game import Game
def initialization():
"""Инициализация нужных файлов игры"""
pygame.init()
pygame.display.set_icon(pygame.image.load("data/icon.bmp"))
pygame.display.set_caption('SPACE')
if __name__ == "__main__":
initialization()
game = Game()
game.run()
py... | 18.444444 | 63 | 0.671687 | [
"MIT"
] | shycoldii/asteroids | main.py | 361 | Python |
# External Dependencies
from __future__ import division
from numpy import isclose
from svgpathtools import Path
# Internal Dependencies
from misc4rings import isNear
class ClosedRingsOverlapError(Exception):
def __init__(self,mes):
self.mes = mes
def __str__(self):
return repr(self.mes)
def ... | 39.028708 | 250 | 0.608557 | [
"MIT"
] | mathandy/svg-dendro | noIntersections4rings.py | 8,157 | Python |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | 50.340909 | 106 | 0.561776 | [
"MIT"
] | aag09/azurecli | src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/validators.py | 6,645 | Python |
from pytest import fixture
from ..f9 import F9
@fixture(scope="module")
def f9() -> F9:
return F9()
def test_evaluate_solution(f9: F9, helpers):
helpers.test_evaluate_solution(f9)
def test_evaluate_population(f9: F9, helpers):
helpers.test_evaluate_population(f9)
def test_dsm(f9: F9, helpers):
... | 16.238095 | 46 | 0.72434 | [
"MIT"
] | piotr-rarus/evobench | evobench/continuous/cec2013lsgo/test/test_f9.py | 341 | Python |
import numbers
import warnings
import torch
from ignite.contrib.handlers.base_logger import BaseLogger, BaseOptimizerParamsHandler, BaseOutputHandler, \
BaseWeightsScalarHandler, BaseWeightsHistHandler
__all__ = ['TensorboardLogger', 'OptimizerParamsHandler', 'OutputHandler',
'WeightsScalarHandler', 'W... | 43.636156 | 120 | 0.618019 | [
"MIT"
] | kevinleewy/Human-Pose-Transfer | helper/custom_ignite_handlers/tensorboard_logger.py | 19,069 | Python |
# Copyright 2013 The Emscripten Authors. All rights reserved.
# Emscripten is available under two separate licenses, the MIT license and the
# University of Illinois/NCSA Open Source License. Both these licenses can be
# found in the LICENSE file.
from __future__ import print_function
import glob
import hashlib
impo... | 35.728547 | 545 | 0.628471 | [
"MIT"
] | Lectem/emscripten | tests/test_core.py | 313,518 | Python |
"""
License:
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 https://mozilla.org/MPL/2.0/.
"""
from collections.abc import MutableMapping
import posixpath
import boto3
import botocore
from botocore.exce... | 31.125 | 110 | 0.578581 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | DebadityaPal/Hub | hub/store/s3_storage.py | 3,735 | Python |
"""
Implementation of the `CID spec <https://github.com/multiformats/cid>`_.
This module differs from other modules of :mod:`~multiformats`, in that the functionality is completely
encapsulated by a single class :class:`CID`, which is imported from top level instead
of the module itself:
>>> from ... | 42.852359 | 137 | 0.627371 | [
"MIT"
] | hashberg-io/multiformats | multiformats/cid/__init__.py | 28,154 | Python |
import argparse
import torch
import os
import numpy as np
import random as rd
from models import GCN
from utils import get_folder_path
from base_solver import BaseSolver
MODEL = 'GCN'
parser = argparse.ArgumentParser()
# Dataset params
parser.add_argument("--dataset", type=str, default='Movielens', help="")
parser.... | 40.341085 | 119 | 0.710031 | [
"MIT"
] | 356255531/pytorch_geometric | benchmark/recsys/gcn_solver.py | 5,204 | Python |
"""add x,y to markers
Revision ID: 20f14f4f1de7
Revises: 21b54c24a2c8
Create Date: 2018-10-01 23:27:21.307860
"""
# revision identifiers, used by Alembic.
revision = '20f14f4f1de7'
down_revision = '21b54c24a2c8'
branch_labels = None
depends_on = None
import sqlalchemy as sa
from alembic import op
def upgrade():
... | 23.34375 | 71 | 0.682731 | [
"BSD-3-Clause"
] | AdiRoH/anyway | alembic/versions/20f14f4f1de7_add_x_y_to_markers.py | 747 | Python |
def mergeSort(_list):
n = len(_list)
if n > 1:
mid = n // 2 # int
left = _list[:mid]
right = _list[mid:]
mergeSort(left)
mergeSort(right)
i = j = k = 0
# 左右比較
while i < len(left) and j < len(right):
if left[i] < right[j]: # left ri... | 23.566667 | 57 | 0.35785 | [
"Apache-2.0"
] | sychen6192/Highlevel_Algorithm | sorting/0853426_HW1_merge.py | 735 | Python |
from collections.abc import Generator
x: Generator[str, str, None, None]
| 15 | 37 | 0.76 | [
"BSD-3-Clause"
] | kracekumar/pep585-upgrade | tests/example_files/classvar.py | 75 | Python |
#
# This file is part of SEQGIBBS
# (https://github.com/I-Bouros/seqgibbs.git) which is released
# under the MIT license. See accompanying LICENSE for copyright
# notice and full license details.
#
import unittest
import scipy.stats
import numpy as np
import numpy.testing as npt
import seqgibbs as gibbs
def fun(x)... | 34.043956 | 79 | 0.658328 | [
"MIT"
] | I-Bouros/seqgibbs | seqgibbs/tests/test_samplers.py | 6,196 | Python |
"""Implementation of group based authorization API.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import grp
import logging
_LOGGER = logging.getLogger(__name__)
def _group(template, resource, action, proid):... | 29.469136 | 77 | 0.485547 | [
"Apache-2.0"
] | bothejjms/treadmill | lib/python/treadmill/api/authz/group.py | 2,387 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright 2012-2018 EMBL - European Bioinformatics Institute
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Li... | 38.036522 | 131 | 0.64821 | [
"Apache-2.0"
] | SamFent/webservice-clients | python/emboss_pepwindow.py | 21,872 | Python |
# ccm node
from __future__ import absolute_import, with_statement
import os
import re
import shutil
import signal
import stat
import subprocess
import time
import yaml
from six import iteritems, print_
from ccmlib import common, extension
from ccmlib.node import Node, NodeError, ToolError
class DseNode(Node):
... | 44.422658 | 232 | 0.595488 | [
"Apache-2.0"
] | thobbs/ccm | ccmlib/dse_node.py | 20,390 | Python |
#!/usr/bin/env python
import os
import cv2
import numpy as np
from enum import Enum
import math
class Calc (Enum):
OPENCV = 1
GSL_MULTI_ROOT = 2
GSL_MULTI_FIT = 3
image_file_name = "Man2_10deg.png"
use_calc = Calc.GSL_MULTI_FIT
#use_calc = Calc.GSL_MULTI_ROOT
#use_calc = Calc.OPENCV
def get_project_xy(... | 38.468599 | 108 | 0.513374 | [
"Apache-2.0"
] | WeihanSun/python_sample | opencv/src/face_motion1.py | 7,963 | Python |
"""
Get attributes about images
Inspired by https://github.com/CSAILVision/places365/blob/master/run_placesCNN_unified.py
"""
from pathlib import Path
import argparse
from typing import List, Iterator, Tuple, Optional, Union, Dict
import hashlib
import json
from multiprocessing import Pool
import urllib.request
import ... | 30.006897 | 98 | 0.626599 | [
"MIT"
] | airbert-vln/bnb-dataset | scripts/detect_room.py | 13,053 | Python |
'''
Задача 1
Вывести на экран циклом пять строк из нулей, причем каждая строка должна быть пронумерована.
'''
# for i in range(1, 6):
# print(f'{i} --', '0'*i)
#######
# print('num 1')
# i = 0
# while i < 5:
# i += 1
# print('line', i, 'is 0')
#
# print('')
#######
'''
Задача 2
Пользователь в цикле ввод... | 16.902778 | 92 | 0.547247 | [
"MIT"
] | mgershevich/testl2 | example-l2.py | 4,165 | Python |
from django.contrib import admin
from .models import *
admin.site.register(Pokemon)
admin.site.register(PokemonEvolution)
admin.site.register(PokemonStat)
admin.site.register(Stat)
admin.site.register(EvolutionChain)
| 24.222222 | 37 | 0.830275 | [
"MIT"
] | JuanJTorres11/pokemon | search_pokemon/admin.py | 218 | Python |
from panda3d.core import CardMaker, Shader, Vec3, Vec2, NodePath, ColorBlendAttrib
from Section2SpaceflightDocking.Common import Common
import random
class Explosion():
cardMaker = None
@staticmethod
def getCard():
if Explosion.cardMaker is None:
Explosion.cardMaker = CardMaker("exp... | 41.246575 | 176 | 0.698107 | [
"BSD-3-Clause"
] | P3D-Space-Tech-Demo/Section-2-Spaceflight-and-Docking | Explosion.py | 3,011 | Python |
'''Faça um programa que leia uma frase pelo teclado e mostre quantas vezes aparece a letra “A”,
em que posição ela aparece a primeira vez e em que posição ela aparece a última vez.'''
frase=str(input('Digite uma frase: ')).upper().strip()
print('a letra A aparece {} vezes'.format(frase.count('A')))
print('ela aparece ... | 76 | 96 | 0.714912 | [
"MIT"
] | cassiakaren/Manipulando-Textos | ex26.py | 470 | Python |
from django.shortcuts import render, redirect
from django.core.urlresolvers import reverse
from .forms import EventCreateForm, NoteCreateForm, PropertyCreateForm, FileUploadForm,AlertCreateForm
from models import Event, Property, Note, File, Alert
from wsgiref.util import FileWrapper
from django.http import HttpRespons... | 29.012987 | 107 | 0.727096 | [
"MIT"
] | davidhorst/filecabinet | apps/main/views.py | 6,702 | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | 31.276271 | 92 | 0.615618 | [
"Apache-2.0"
] | meverett1167/Ansible_Demos | f5-ansible/library/modules/bigip_monitor_http.py | 18,453 | Python |
def write(path, content):
with open(path, "a+") as dst_file:
dst_file.write(content + '\n')
def read2mem(path):
with open(path) as f:
content = ''
while 1:
try:
lines = f.readlines(100)
except UnicodeDecodeError:
f.close()
... | 24.578947 | 40 | 0.466809 | [
"Apache-2.0"
] | dachmx/tfnotes | GDLnotes/src/util/file_helper.py | 467 | Python |
import argparse
import os
from solver import Solver
from data_loader import *
#from data_loader import *
from torch.backends import cudnn
from torch.utils import data
from torchvision import transforms as T
def main(config):
cudnn.benchmark = True
if not os.path.exists(config.model_path):
os.makedirs(... | 48.678571 | 185 | 0.652482 | [
"Apache-2.0"
] | sweezin/PI-DECODER | main.py | 4,135 | Python |
from alphafold2.util import *
from alphafold2.modules import * | 31 | 32 | 0.822581 | [
"BSD-3-Clause"
] | brennanaba/alphafold2-pytorch | alphafold2/__init__.py | 62 | Python |
import os
import shutil
from thlib.side.Qt import QtWidgets as QtGui
from thlib.side.Qt import QtGui as Qt4Gui
from thlib.side.Qt import QtCore
from thlib.environment import env_inst, env_tactic, cfg_controls, env_read_config, env_write_config, dl
import thlib.global_functions as gf
import thlib.tactic_classes as tc
fr... | 38.301987 | 171 | 0.645861 | [
"EPL-1.0"
] | listyque/TACTIC-Handler | thlib/ui_classes/ui_watch_folder_classes.py | 28,918 | Python |
# !/usr/bin/env python
# coding: utf-8
'''
Description:
Given a binary tree, return all root-to-leaf paths.
For example, given the following binary tree:
1
/ \
2 3
\
5
All root-to-leaf paths are: ["1->2->5", "1->3"]
Tags: Tree, Depth-first Search
'''
... | 23.660377 | 62 | 0.528708 | [
"MIT"
] | Jan-zou/LeetCode | python/Tree/257_binary_tree_paths.py | 1,254 | Python |
# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: anze@reciprocitylabs.com
# Maintained By: anze@reciprocitylabs.com
"""Add finished/verified dates to cycle tasks
Revision ID: 13e52f6a9deb
Revises... | 31.974359 | 106 | 0.754611 | [
"Apache-2.0"
] | Smotko/ggrc-core | src/ggrc_workflows/migrations/versions/20160104135243_13e52f6a9deb_add_finished_verified_dates_to_cycle_.py | 1,247 | Python |
print('|------------------------------------------------|');
print('| COMUTADOR DE GARRAFAS POR DINHEIRO |');
print('| |');
print('|--------GARRAFAS 1 LT - R$0.10 CENTAVOS---------|');
print('|--------GARRAFAS 2 LT - R$0.25 CENTAVOS---------|');
print('|-------... | 31.296296 | 67 | 0.494675 | [
"MIT"
] | carlosjrbk/Logica-de-Programa--o---IFPE | lista_1/exercicio 4.py | 845 | Python |
# Time: O(n^2)
# Space: O(1)
class Solution(object):
def triangleNumber(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
result = 0
nums.sort()
for i in reversed(xrange(2, len(nums))):
left, right = 0, i-1
while left < right:
... | 24.023256 | 68 | 0.414327 | [
"MIT"
] | 20kzhan/LeetCode-Solutions | Python/valid-triangle-number.py | 1,033 | Python |
# Distributed under the MIT License.
# See LICENSE.txt for details.
import numpy as np
from Evolution.Systems.CurvedScalarWave.Characteristics import (
char_speed_vpsi, char_speed_vzero, char_speed_vplus, char_speed_vminus)
def error(face_mesh_velocity, normal_covector, normal_vector, psi, phi,
inertia... | 42.981132 | 79 | 0.723881 | [
"MIT"
] | AlexCarpenter46/spectre | tests/Unit/Evolution/Systems/CurvedScalarWave/BoundaryConditions/ConstraintPreservingSphericalRadiation.py | 2,278 | Python |
v1=float(input("Digite o valor de um dos lados "))
v2=float(input("Digite o valor de outrpo lados "))
v3=float(input("Digite o valor do ultimo lado lados "))
if v1+v2 > v3 and v1+v3 > v2 and v2+v3 > v1:
if v1 == v2 == v3:
print(f'Com esses valores é possivel formar um triangulo equilátero')
elif v1 != v... | 48.769231 | 81 | 0.660883 | [
"MIT"
] | ThiagoPereira232/tecnico-informatica | 1 ano/logica-de-programacao/triangulo-tipo.py | 638 | Python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2017-2020 AVSystem <avsystem@avsystem.com>
#
# 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/... | 36.279412 | 121 | 0.673085 | [
"Apache-2.0"
] | bularcasergiu/Anjay | tools/lwm2m_object_registry.py | 4,934 | Python |
#!/usr/bin/python3
import os, argparse, difflib
lookup = {
"flare-form-field": "viur-form-bone",
"flare-form-submit": "viur-form-submit",
"flare-form": "viur-form",
"boneField": "ViurFormBone",
"sendForm": "ViurFormSubmit",
"viurForm": "ViurForm",
"boneSelector": "BoneSelector",
"modu... | 28.94382 | 73 | 0.494565 | [
"MIT"
] | incub8/flare | tools/flare-update.py | 2,576 | Python |
from django.urls import path, include
from rest_framework.routers import DefaultRouter
from profiles_api import views
router = DefaultRouter()
router.register('hello-viewset', views.HelloViewSet, base_name='hello-viewset')
router.register('profile', views.UserProfileViewSet)
router.register('feed', views.UserProfil... | 25.578947 | 79 | 0.781893 | [
"MIT"
] | yoniv/profiles-rest-api | profiles_api/urls.py | 486 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###################################################################
# Author: Mu yanru
# Date : 2019.3
# Email : muyanru345@163.com
###################################################################
"""MDockWidget"""
from dayu_widgets.qt import QDockWidget
class MDockWi... | 27.842105 | 76 | 0.489603 | [
"MIT"
] | 317431629/dayu_widgets | dayu_widgets/dock_widget.py | 529 | 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/.
from gaiatest import GaiaTestCase
from gaiatest.apps.ftu.app import Ftu
from gaiatest.apps.homescreen.app import Homescr... | 45.14 | 158 | 0.698715 | [
"Apache-2.0"
] | ADLR-es/gaia | tests/python/gaia-ui-tests/gaiatest/tests/functional/ftu/test_ftu_with_tour.py | 2,257 | Python |
import os
import pytest
from cassis import *
FIXTURE_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "test_files")
# Small xmi
@pytest.fixture
def small_xmi_path():
return os.path.join(FIXTURE_DIR, "xmi", "small_cas.xmi")
@pytest.fixture
def small_xmi(small_xmi_path):
with open(small_xmi... | 27.510949 | 97 | 0.71584 | [
"Apache-2.0"
] | cgaege/dkpro-cassis | tests/fixtures.py | 3,769 | Python |
import os
import pytest
import toml
from voluptuous import MultipleInvalid
from worker.conf_schemata import validate_general, validate_storage
def test_toml_loader():
config_dict = toml.load(os.getcwd() + '/src/tests/worker/config_handling/conf.toml')
validate_general(config_dict['general'])
validate_sto... | 35.384615 | 98 | 0.738043 | [
"MIT"
] | mehsoy/jaws | src/tests/worker/config_handling/test_toml_config_parser.py | 920 | Python |
import gym
import numpy as np
from gym import spaces
from stable_baselines.common.running_mean_std import RunningMeanStd
class ScaleRewardEnv(gym.RewardWrapper):
def __init__(self, env: gym.Env, scale):
gym.RewardWrapper.__init__(self, env)
self.scale = scale
def reward(self, reward: float) ... | 35.133663 | 115 | 0.533888 | [
"MIT"
] | artberryx/SAR | sb/stable_baselines_ex/common/wrappers_ex.py | 7,097 | Python |
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/console
api_key_sid = "SKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
api_key_secret = "your_api_key_secret"
client = Client(api_key_sid, api_key_secret)
publishedtrack = clie... | 35.153846 | 72 | 0.809628 | [
"MIT"
] | PatNeedham/api-snippets | video/rooms/participants/published-track/retrieve-track-published-by-participant/retrieve-track-published-by-participant.py | 457 | Python |
import argparse
import importlib
import mmcv
import numpy as np
import os
import os.path as osp
import time
import torch
from mmcv.parallel import MMDataParallel, MMDistributedDataParallel
from mmcv.runner import get_dist_info, init_dist, load_checkpoint
from openselfsup.datasets import build_dataloader, build_dataset... | 36.917582 | 77 | 0.637 | [
"Apache-2.0"
] | speedcell4/OpenSelfSup | tools/extract.py | 6,719 | Python |
"""Temkin Approximation isotherm model."""
import numpy
import scipy
from ..utilities.exceptions import CalculationError
from .base_model import IsothermBaseModel
class TemkinApprox(IsothermBaseModel):
r"""
Asymptotic approximation to the Temkin isotherm.
.. math::
n(p) = n_m \frac{K p}{1 + K ... | 30.0875 | 101 | 0.566265 | [
"MIT"
] | ReginaPeralta/ReginaPeralta | src/pygaps/modelling/temkinapprox.py | 4,816 | Python |
__author__ = "Johannes Köster"
__copyright__ = "Copyright 2015-2019, Johannes Köster"
__email__ = "koester@jimmy.harvard.edu"
__license__ = "MIT"
import html
import os
import shutil
import textwrap
import time
import tarfile
from collections import defaultdict, Counter
from itertools import chain, filterfalse, groupby... | 37.205561 | 132 | 0.529814 | [
"MIT"
] | baileythegreen/snakemake | snakemake/dag.py | 74,934 | Python |
#!/usr/bin/env python3
import matplotlib.pyplot as plt
import numpy as np
pool_forward = __import__('1-pool_forward').pool_forward
if __name__ == "__main__":
np.random.seed(0)
lib = np.load('../data/MNIST.npz')
X_train = lib['X_train']
m, h, w = X_train.shape
X_train_a = X_train.reshape((-1, h, w,... | 26.518519 | 62 | 0.606145 | [
"MIT"
] | kyeeh/holbertonschool-machine_learning | supervised_learning/0x07-cnn/1-main.py | 716 | Python |
from starlette.datastructures import URL
from dashboard.pagination import PageControl, get_page_controls, get_page_number
def test_single_page_does_not_include_any_pagination_controls():
"""
When there is only a single page, no pagination controls should render.
"""
url = URL("/")
controls = get_... | 36.005917 | 81 | 0.600329 | [
"BSD-3-Clause"
] | encode/dashboard | tests/test_pagination.py | 6,089 | Python |
# Generated by Django 2.2 on 2019-04-18 10:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0006_auto_20190417_2232'),
]
operations = [
migrations.AlterField(
model_name='question',
name='order',
... | 19.578947 | 45 | 0.58871 | [
"MIT"
] | chinhle23/monitorme | core/migrations/0007_auto_20190418_0646.py | 372 | Python |
# Generated by Django 2.2.1 on 2020-03-26 05:17
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('webapi', '0015_auto_20200326_0955'),
]
operations = [
migrations.AlterField(
model_name='property',
name='property_n... | 23.791667 | 63 | 0.579685 | [
"MIT"
] | kumagallium/labmine-api | src/webapi/migrations/0016_auto_20200326_1417.py | 571 | Python |
# MIT License
#
# Copyright (c) 2018 Haoxintong
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, p... | 36.339394 | 115 | 0.624083 | [
"MIT"
] | OmoooJ/gluon-facex | examples/mnist/train_mnist_arcloss.py | 5,996 | Python |
"""
A mechanism for plotting field values along a line through a dataset
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2017, yt Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distrib... | 35.015556 | 94 | 0.574602 | [
"BSD-3-Clause-Clear"
] | smressle/yt | yt/visualization/line_plot.py | 15,757 | Python |
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config['SECRET_KEY'] = '323b22caac41acbf'
app.config['SQLALCHEMY'] = 'sqlite:///site.db'
db = SQLAlchemy(app)
from inventorymanager import routes
db.create_all()
db.session.commit() | 22.833333 | 46 | 0.773723 | [
"MIT"
] | marcus-deans/InventoryTracker | inventorymanager/__init__.py | 274 | Python |
import pandas as pd
import numpy as np
import scipy.io
import dpsimpy
class Reader:
def __init__(self, mpc_file_path, mpc_name = 'mpc'):
# read input file (returns multidimensional dict)
self.mpc_raw = scipy.io.loadmat(mpc_file_path)
self.mpc_name = mpc_name
def process_mpc(self):
... | 45.745318 | 182 | 0.616751 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | DPsim-Simulator/DPsim | python/src/dpsim/matpower.py | 12,214 | Python |
from __future__ import print_function
import contextlib
import imp
import os
import shutil
import subprocess
import sys
import tempfile
from unittest import skip
from ctypes import *
import numpy as np
try:
import setuptools
except ImportError:
setuptools = None
import llvmlite.binding as ll
from numba impo... | 35.297619 | 119 | 0.600759 | [
"BSD-2-Clause",
"MIT"
] | eric-erki/numba | numba/tests/test_pycc.py | 11,860 | Python |
from config.config import db
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class User(Base):
__tablename__ = 'user'
username = db.Column(db.String, primary_key=True)
password = db.Column(db.String)
email = db.Column(db.String)
def __init__(self, username, emai... | 25.117647 | 55 | 0.697892 | [
"MIT"
] | EswarAleti/MVC-Architecture | model/user.py | 427 | Python |
from rest_framework import serializers
from django.contrib.auth.models import User
from .models import *
class UserSerializer(serializers.ModelSerializer):
class Meta:
model= User
fields = ['username','first_name','last_name','password','email','is_superuser']
class RolesSerializer(se... | 25.9375 | 89 | 0.684337 | [
"MIT"
] | jesuscol96/WebClassApp | WebClassApp/mainpage/serializers.py | 415 | Python |
from typing import List
from flake8_functions_names.custom_types import FuncdefInfo
from flake8_functions_names.utils.imports import is_module_installed
from flake8_functions_names.words import VERBS, PURE_VERBS, BLACKLISTED_WORDS_IN_FUNCTIONS_NAMES
def validate_returns_bool_if_names_said_so(funcdef: FuncdefInfo) ->... | 34.952941 | 100 | 0.671491 | [
"MIT"
] | Melevir/flake8-functions-names | flake8_functions_names/validators.py | 2,971 | Python |
#!/usr/bin/python
import cgi
import cgitb
import json
import parse_enumeration
cgitb.enable()
form = cgi.FieldStorage()
# Get data from fields
callback = form.getvalue('callback')
email = form.getvalue('email')
if (email is None):
email = "<ul><li>hello, world!</li></ul>"
print "Content-type: application/jso... | 18.296296 | 54 | 0.700405 | [
"CC0-1.0"
] | 18F/parse-shopping-list | src/process-request.py | 494 | Python |
#Punto 10 cambiar datos
lista=[]
datos=(input("cantidad de datos: "))
for i in range (0,datos):
alt=float(input("ingrese alturas: "))
lista.append(alt)
print("la altura maxima es ", max(lista))
##################################
lista=[]
numero=int(input("numero 1 para agregar una altura y numero 2 para bu... | 24.307692 | 105 | 0.607595 | [
"MIT"
] | Ricardoppp/Talleres_De_Algoritmos_Ricardo | Taller de Estrucuras de Control Repeticion/Punto10.py | 632 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.