max_stars_repo_path stringlengths 3 269 | max_stars_repo_name stringlengths 4 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.05M | score float64 0.23 5.13 | int_score int64 0 5 |
|---|---|---|---|---|---|---|
sast_controller/tests/drivers/test_checkmarx_connection.py | dovbiyi/reapsaw | 41 | 12790951 | <filename>sast_controller/tests/drivers/test_checkmarx_connection.py
import unittest
from unittest import mock
from sast_controller.drivers.cx import CheckmarxConnection
class TestCheckmarxConnection(unittest.TestCase):
def setUp(self):
requests_session_patcher = mock.patch('sast_controller.drivers.cx.Ch... | 2.484375 | 2 |
di-gui/PythonDisk.py | gumuming/python-struc | 0 | 12790952 | import os
def disk_usage(path):
total = os.path.getsize(path)
if os.path.isdir(path):
for fileName in os.listdir(path):
childPath = os.path.join(path,fileName)
total += disk_usage(childPath)
print('0:<7'.format(total),path)
return total | 3.375 | 3 |
Framework/utilities/logger/__init__.py | jonreding2010/MAQS.Python | 0 | 12790953 | from Framework.utilities.logger import LoggingEnabled
from Framework.utilities.logger import MessageType
from Framework.utilities.logger import TestResultType | 1.09375 | 1 |
MD_plotting_toolkit/tests/test_data_processing.py | wehs7661/MD_plotting_toolkit | 0 | 12790954 | ####################################################################
# #
# MD_plotting_toolkit, #
# a python package to visualize the results obtained from MD #
# ... | 2.578125 | 3 |
crank/net/module/mlfb.py | abeersaqib/crank | 162 | 12790955 | <reponame>abeersaqib/crank<filename>crank/net/module/mlfb.py
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright (c) 2021 <NAME> <<EMAIL>>
#
# Distributed under terms of the MIT license.
"""
"""
import librosa
import scipy.signal
import torch
import torch.nn as nn
class MLFBLayer(torch.nn... | 2.046875 | 2 |
vigenerdecipher.py | Arkar1an/Vigenere-Cipher | 0 | 12790956 | <filename>vigenerdecipher.py<gh_stars>0
# <NAME>
# Homework 2, problem 2
"""This reads from a text file and returns a string of the text"""
def read_from_a_file(the_file):
file=open(the_file,'r')
the_string=file.read()
file.close()
return the_string
"""This takes in a string and writes that string to... | 4.125 | 4 |
lesson7/lesson7.1.py | thomaswhitcomb/ucsd-deep-learning-using-tensorflow | 0 | 12790957 | <filename>lesson7/lesson7.1.py
###############################################
# MNIST Image Classification Using Linear Regression #
################################################
# 1.1 Load the libraries
#
import sys
import matplotlib.pyplot as plt
import tensorflow as tf
import numpy as np
from sklearn.metrics imp... | 3.734375 | 4 |
LeetCode/0720. Longest Word in Dictionary/solution.py | InnoFang/oh-my-algorithms | 1 | 12790958 | <filename>LeetCode/0720. Longest Word in Dictionary/solution.py
"""
59 / 59 test cases passed.
Runtime: 76 ms
Memory Usage: 15.9 MB
"""
class Solution:
def longestWord(self, words: List[str]) -> str:
Trie = lambda: collections.defaultdict(Trie)
trie = Trie()
END = True
for i, word i... | 3.75 | 4 |
examples/orientation_demo.py | Jakubach/pytrigno | 0 | 12790959 | from pytrigno import TrignoAccel
from pytrigno import TrignoEMG
from pytrigno import TrignoOrientation
import numpy as np
from scipy.spatial.transform import Rotation as R
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import time
#Reading one sensor accel data:
#t=TrignoAccel(channel_range=(0... | 2.71875 | 3 |
ctrials/charts.py | nk9/clinical-trials | 18 | 12790960 | #!/usr/bin/python
import json
import os
import sys
from . import db
from . import utils
def create(chartsPath, dbPath, force):
jsonString = createCharts(loadChartDefs(), dbPath, force)
if (len(jsonString)):
chartsFile = open(chartsPath, 'w')
chartsFile.write(jsonString)
chartsFile.close()
def loadChartDef... | 2.9375 | 3 |
algs4/eightAlgsInPython/merge_sort.py | sennhvi/algorithms | 0 | 12790961 | <gh_stars>0
##
# Created by sennhviwang
# Time: Sun Sep 27 16:23:38 CST 2015.
#
# Merge sort
# Data Structure: Array
# Time Complexity-Best: O(nlogn) typical, O(n) natural variant
# Time Complexity-Average: O(nlogn)
# Time Complexity-Worst: O(nlogn)
# Space Complexity-Worst: O(n) auxiliary
#
#... | 3.671875 | 4 |
skysol/validation/error_metrics.py | fcco/SkySol | 1 | 12790962 | <filename>skysol/validation/error_metrics.py
# encoding=utf8
from __future__ import division
import numpy as np
"""
Different error metrics.
Defintion and description of some from
Zhang et al., 2013, Metrics for Evaluating the
Accuracy of Solar Power Forecasting, conference paper,
3rd International Workshop on In... | 2.921875 | 3 |
Examples/ApiExamples/ex_pdf_save_options.py | alex-dudin/Aspose.Words-for-Python-via-.NET | 3 | 12790963 | # Copyright (c) 2001-2022 Aspose Pty Ltd. All Rights Reserved.
#
# This file is part of Aspose.Words. The source code in this file
# is only intended as a supplement to the documentation, and is provided
# "as is", without warranty of any kind, either expressed or implied.
import io
import os
from datetime import date... | 2.6875 | 3 |
gm/string/strip_quotes.py | thareUSGS/craterstats | 1 | 12790964 | # Copyright (c) 2021, <NAME>
# Licensed under BSD 3-Clause License. See LICENSE.txt for details.
def strip_quotes(s):
if s[0]==s[-1] and s[0] in ['"',"'"]:
return s[1:-1]
else:
return s | 3.03125 | 3 |
turbine.py | FanaticalFighter/pyRankine | 2 | 12790965 | <gh_stars>1-10
import iapws
class Turbine():
"""
Turbine class
Represents a turbine in the Rankine cycle
"""
def __init__(self, inletState):
"""
Initializes the turbine with the previous conditions
inletState: The state of the steam on the Turbine's inlet.
M... | 3.09375 | 3 |
backend/app/alembic/versions/0b840782b66f_initial_model_again.py | totalhack/zar | 1 | 12790966 | """Initial model again
Revision ID: 0b840782b66f
Revises:
Create Date: 2020-10-27 17:24:10.636183
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '0b840782b66f'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands aut... | 1.953125 | 2 |
wireshark-2.0.13/tools/make-services.py | mahrukhfida/mi | 0 | 12790967 | <reponame>mahrukhfida/mi<filename>wireshark-2.0.13/tools/make-services.py
#!/usr/bin/env python
#
# Parses the CSV version of the IANA Service Name and Transport Protocol Port Number Registry
# and generates a services(5) file.
#
# Wireshark - Network traffic analyzer
# By <NAME> <<EMAIL>>
# Copyright 2013 <NAME>
#
# T... | 2.140625 | 2 |
webhook/event.py | opolis/exchange | 10 | 12790968 | <filename>webhook/event.py
# Generate a dynamo event for local testing.
# Usage: python webhook/event.py COIN tx.json
# where coin is BTC or ETH
import json
import sys
from string import Template
TEMPLATE='''
{
"Records": [
{
"eventID": "c4ca4238a0b923820dcc509a6f75849b",
"eventName": "INSERT",
... | 2.4375 | 2 |
cogs/guilds.py | fennr/Samuro-HotsBot | 1 | 12790969 | <filename>cogs/guilds.py
""""
Samuro Bot
Автор: *fennr*
github: https://github.com/fennr/Samuro-HotsBot
Бот для сообществ по игре Heroes of the Storm
"""
from discord import Embed, utils
from discord.ext import commands
from utils import library
from utils.classes.Const import config
clear = '\u200b'
class Ruhots... | 2.3125 | 2 |
i.py | samridhl/Assignment-5 | 0 | 12790970 | #!/usr/bin/python
import re
import sys
import fileinput
import json
import urllib
user_gene_name = raw_input('Enter the gene name')
for line in fileinput.input(['/data/Homo_sapiens.GRCh37.75.gtf']):
if re.match(r'.*\t.*\tgene\t', line):
text_in_column = re.split('\t',line)
if len(text_in_column... | 3.265625 | 3 |
python/parse_date.py | kev0960/ModooCode | 39 | 12790971 | import os
def add_date_to_md(link, publish_date):
if os.path.exists('./md/dump_' + str(link) + '.md'):
with open('./md/dump_' + str(link) + '.md') as f:
content = f.read()
content = content.split('\n')
for i in range(2, len(content)):
if content[i].find('... | 2.9375 | 3 |
test/test.py | PGE383-HPC-Students/assignment13 | 0 | 12790972 | <gh_stars>0
#/usr/bin/env python
#
# Copyright 2020-2021 <NAME>
#
# 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 applic... | 1.875 | 2 |
pystopwatch2/test.py | ildoonet/pystopwatch | 69 | 12790973 | <gh_stars>10-100
import time
import unittest
from pystopwatch2.watch import PyStopwatch
class TestStringMethods(unittest.TestCase):
def test_stopwatch(self):
w = PyStopwatch()
w.start('a')
time.sleep(1)
w.pause('a')
e = w.get_elapsed('a')
self.assertAlmostEqual(1.... | 2.9375 | 3 |
qespresso/documents.py | QEF/qexsd | 4 | 12790974 | <reponame>QEF/qexsd
# -*- coding: utf-8 -*-
#
# Copyright (c), 2015-2016, Quantum Espresso Foundation and SISSA (Scuola
# Internazionale Superiore di Studi Avanzati). All rights reserved.
# This file is distributed under the terms of the MIT License. See the
# file 'LICENSE' in the root directory of the present distrib... | 1.75 | 2 |
domain/serializers/example_serializer.py | kirberich/django-heroku-template | 0 | 12790975 | from data.models import TestModel
from rest_framework import serializers
class ExampleSerializer(serializers.ModelSerializer):
class Meta:
model = TestModel
fields = ('id', 'created', 'updated', 'method_field')
method_field = serializers.SerializerMethodField()
def get_method_field(self,... | 2.359375 | 2 |
overview.py | ReachY/just_do_it | 1 | 12790976 | # 线程池
from multiprocessing.pool import ThreadPool # 相当于from multiprocessing.dummy import Process
pool = ThreadPool(5)
pool.apply_async(lambda x: x * x, ("args1", 'args2',))
# super函数 https://wiki.jikexueyuan.com/project/explore-python/Class/super.html
# Base
# / \
# / \
# A B
# \ /
... | 3.5625 | 4 |
aioroutes/exceptions.py | tailhook/aio-routes | 2 | 12790977 | <filename>aioroutes/exceptions.py
import abc
class WebException(Exception):
"""Base for all exceptions which render error code (and page) to client"""
@abc.abstractmethod
def default_response(self):
pass
class Forbidden(WebException):
def default_response(self):
return (403,
... | 3.0625 | 3 |
setup.py | AlderDHT/alder | 2 | 12790978 | <filename>setup.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
setup.py
Basic setup file to enable pip install
See:
http://pythonhosted.org//setuptools/setuptools.html
https://pypi.python.org/pypi/setuptools
python setup.py register sdist upload
"""
# Import python libs
import os
import sys
from setupt... | 1.96875 | 2 |
zsolozsma/migrations/0014_auto_20200506_1847.py | molnarm/liturgia.tv | 4 | 12790979 | # Generated by Django 3.0.5 on 2020-05-06 16:47
from django.db import migrations
import secrets
def copy_schedule(apps, schema_editor):
Event = apps.get_model('zsolozsma', 'Event')
EventSchedule = apps.get_model('zsolozsma', 'EventSchedule')
events_dict = {}
for event in Event.objects.all()... | 1.765625 | 2 |
python/lvmtan/BasdaMoccaXCluPythonServiceWorker.py | sdss/lvmtan | 0 | 12790980 | <filename>python/lvmtan/BasdaMoccaXCluPythonServiceWorker.py<gh_stars>0
# -*- coding: utf-8 -*-
#
# @Author: <NAME> (<EMAIL>)
# @Date: 2021-06-15
# @Filename: BasdaMoccaXCluPythonServiceWorker.py
# @License: BSD 3-clause (http://www.opensource.org/licenses/BSD-3-Clause)
import BasdaMoccaException
import BasdaMoccaX
i... | 2.234375 | 2 |
examples/zentweepy/src/zentweepy/cli.py | hiway/python-zentropi | 5 | 12790981 | <filename>examples/zentweepy/src/zentweepy/cli.py
# coding=utf-8
from zentropi import run_agents
from .zentweepy import ZenTweepy
def main():
zentweepy = ZenTweepy(name='ZenTweepy', auth='<PASSWORD>')
run_agents(zentweepy, shell=False, space='zentropia',
endpoint='wss://zentropi.com/')
| 1.757813 | 2 |
src/campaigns/migrations/0009_auto_20160828_2114.py | mrts/foodbank-campaign | 1 | 12790982 | <filename>src/campaigns/migrations/0009_auto_20160828_2114.py
# -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2016-08-28 18:14
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import tinymce.models
class Migration(migrations.Migration):
dep... | 1.507813 | 2 |
ironmotion.py | andykuszyk/ironmotion | 1 | 12790983 | <gh_stars>1-10
import argparse
from ironmotion import commands
if __name__ == '__main__':
parser = argparse.ArgumentParser()
subparsers = parser.add_subparsers()
record_parser = subparsers.add_parser('record', help='Used to record a gesture to a file.')
record_parser.add_argument('gesture_file', ... | 2.609375 | 3 |
src/Model/nets/ALOHA_net.py | cmikke97/AMSG | 3 | 12790984 | <reponame>cmikke97/AMSG
# Copyright 2021, <NAME>.
#
# Developed as a thesis project at the TORSEC research group of the Polytechnic of Turin (Italy) under the supervision
# of professor <NAME> and engineer <NAME> and with the support of engineer <NAME>.
#
# Licensed under the Apache License, Version 2.0 (the "License")... | 1.992188 | 2 |
tests/test_themes.py | andymckay/amo-validator | 0 | 12790985 | import validator.testcases.themes as themes
from validator.errorbundler import ErrorBundle
from validator.constants import PACKAGE_THEME
from helper import _do_test
from js_helper import _do_real_test_raw
def test_theme_chrome_manifest():
"Tests that a theme has a valid chrome manifest file."
_do_test("tests... | 2.09375 | 2 |
api/App.py | carreath/SWE4103-Project | 0 | 12790986 | #!/usr/bin/env python3
from flask import Flask, render_template, make_response
from common import DatabaseMigrator
from flask_restful import Api
from flask_cors import CORS
from resources import *
import config
import sys
import os
from OpenSSL import SSL
from flask import request
context = SSL.Context(SSL.SSLv23_ME... | 2.40625 | 2 |
client/cldcmds/fm_actions.py | cdubiel/firstmile | 6 | 12790987 | import logging
import common
from cliff.command import Command
class FirstMileLogs(Command):
"Retrieve FirstMile sandbox logs"
log = logging.getLogger(__name__)
def _extract_logs(self):
cmd = "sudo docker ps -a | grep firstmile | head -1 | awk '{print $1}'"
err, output = common.exec... | 2.5 | 2 |
src/models/.ipynb_checkpoints/svc-checkpoint.py | ddl-aambekar/MovieGenrePrediction | 1 | 12790988 | # non deep learning on bag of words
# load pickles and libraries
from src.utils.eval_metrics import *
from src.utils.initialize import *
from sklearn.model_selection import train_test_split
import pickle
with open('data/processed/movies_with_overviews.pkl','rb') as f:
movies_with_overviews=pickle.load(f)
with ope... | 2.640625 | 3 |
ippon/point/permissions.py | morynicz/ippon_back | 0 | 12790989 | <filename>ippon/point/permissions.py
from rest_framework import permissions
import ippon.models
import ippon.models.fight
import ippon.models.tournament as tm
import ippon.point.serializers as pts
import ippon.utils.permissions as ip
class IsPointOwnerOrReadOnly(permissions.BasePermission):
def has_permission(s... | 2.21875 | 2 |
src/bo4e/com/zeitreihenwert.py | bo4e/BO4E-python | 1 | 12790990 | <gh_stars>1-10
"""
Contains Zeitreihenwert class
and corresponding marshmallow schema for de-/serialization
"""
from datetime import datetime
import attr
from marshmallow import fields
from bo4e.com.zeitreihenwertkompakt import Zeitreihenwertkompakt, ZeitreihenwertkompaktSchema
from bo4e.validators import check_bis_i... | 1.9375 | 2 |
v7_pickle_web_interface/flask/introspection/static_call_graph.py | carlosal1015/proofofconcept | 14 | 12790991 | #!/usr/bin/env python3
import glob
import re
list_of_py_files = glob.glob('*.py')
py_dict = {}
for py_file in list_of_py_files:
#print(py_file)
with open(py_file) as fil:
py_content = fil.readlines()
py_dict[py_file] = py_content
py_code_dict = {}
for py_file, list_of_lines in py_dict.items():
... | 3.203125 | 3 |
library/keystone_service_provider.py | pgraziano/ursula | 193 | 12790992 | <reponame>pgraziano/ursula<gh_stars>100-1000
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2016, IBM
# 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/licen... | 1.671875 | 2 |
experiment.py | csadorf/signac-sacred-integration | 0 | 12790993 | from signac import init_project
from sacred import Experiment
from flow import FlowProject
ex = Experiment()
project = init_project('signac-sacred-integration')
class SacredProject(FlowProject):
pass
@ex.capture
def func(weights, bar):
return None
@ex.capture
@SacredProject.pre(lambda job: 'bar' not in ... | 2.046875 | 2 |
diplomacy_research/models/datasets/supervised_dataset.py | wwongkamjan/dipnet_press | 39 | 12790994 | # ==============================================================================
# Copyright 2019 - <NAME>
#
# NOTICE: 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, ... | 1.945313 | 2 |
models/user_model.py | yhy940806/flask-restfulapi-snippet | 42 | 12790995 | import json
from db_config import db
class User(db.Model):
__tablename__ = 'users'
username = db.Column(db.String(80), primary_key=True)
email = db.Column(db.String(120), unique=True, nullable=False)
def json(self):
return{'username': self.username, 'email': self.email}
@staticmethod
... | 2.6875 | 3 |
margot/data/frames.py | pymargot/margot | 11 | 12790996 | <reponame>pymargot/margot
from inspect import getmembers
import pandas as pd
from margot.data.features import BaseFeature
from margot.data.symbols import Symbol
from margot.data.ratio import Ratio
class MargotDataFrame(object):
"""A MargotDataFrame brings together symbols, columns, features and ratios.
Exa... | 3.015625 | 3 |
data_sets/synthetic_review_prediction/article_0/generate.py | Octavian-ai/synthetic-graph-data | 16 | 12790997 | <filename>data_sets/synthetic_review_prediction/article_0/generate.py
from ..classes import PersonWroteReview, ReviewOfProduct, IsGoldenFlag
import random
from ..meta_classes import DataSetProperties
from ..experiment_1.simple_data_set import SimpleDataSet
from ..utils import DatasetWriter
from graph_io import QueryPa... | 2.15625 | 2 |
tests/__init__.py | lpnueg4/-logzero | 1,091 | 12790998 | <filename>tests/__init__.py
# -*- coding: utf-8 -*-
"""Unit test package for logzero."""
| 0.917969 | 1 |
tests/test_widgets.py | cdeitrick/Lolipop | 6 | 12790999 | <reponame>cdeitrick/Lolipop
from unittest.mock import patch
from loguru import logger
import pandas
import pytest
from muller import dataio, widgets
@pytest.mark.parametrize(
"columns, expected",
[
(['1', '66', '0', 'X9', 'xc', 'x33', 'col4'], ['1', '66', '0', 'X9', 'x33']),
( ['Genotype', 0, 1 ,2, 3], [0, 1, 2... | 2.421875 | 2 |
racing_rl/training/utils.py | luigiberducci/racing-rl | 5 | 12791000 | <gh_stars>1-10
import numpy as np
import random
import torch
def seeding(seed: int):
np.random.seed(seed)
random.seed(seed)
torch.manual_seed(seed) | 2.046875 | 2 |
scripts/juju-setup.py | girishgc/onos | 1 | 12791001 | <filename>scripts/juju-setup.py
#!/usr/bin/python
import subprocess
import json
import socket
jujuconfig="/usr/local/src/openstack.cfg"
# Assumption: VMs have same hostname as service that runs inside
machines = ["mysql", "rabbitmq-server", "keystone", "glance", "nova-cloud-controller",
"neutron-gateway"... | 1.664063 | 2 |
rnn_compression_factorization/src/module/compressed_deepConv.py | snudm-starlab/VMLMF | 38 | 12791002 |
################################################################################
# Starlab RNN-compression with factorization method : Lowrank and group-lowrank rnn
#
# Author: <NAME> (<EMAIL>), Seoul National University
# U Kang (<EMAIL>), Seoul National University
#
# Version : 1.0
# Date : Nov 10, 2020
# Ma... | 2.546875 | 3 |
lanfactory/trainers/keras_mlp.py | AlexanderFengler/LANfactory | 1 | 12791003 | import numpy as np
import uuid
import os
import pandas as pd
import psutil
import pickle
#import kde_info
#from lanfactory.config import
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras.models import load_model
from tensorflow.python.client import device_lib
import warnings
from lanfactory.ut... | 2.28125 | 2 |
conftest.py | zacharycohn/pants | 49 | 12791004 | <reponame>zacharycohn/pants<filename>conftest.py<gh_stars>10-100
import config
from app import make_app
import pytest
from sqlalchemy import create_engine, MetaData
@pytest.yield_fixture
def app():
create_db(config.SQLA_URI)
autoapi_app = make_app()
yield autoapi_app
drop_db(config.SQLA_URI)
def cr... | 2.1875 | 2 |
tests/test_desktop.py | dclong/config | 0 | 12791005 | <reponame>dclong/config
"""Test the misc module.
"""
import subprocess as sp
def test_nomachine():
"""Test installing and configuring NoMachine.
"""
cmd = "xinstall nomachine"
sp.run(cmd, shell=True, check=True)
def test_version():
"""Test the version command.
"""
cmd = "xinstall version... | 1.796875 | 2 |
aviata/flights/utils.py | reyuan8/aviata | 0 | 12791006 | <gh_stars>0
import requests
import datetime
from aviata.flights.consts import directions
from aviata.flights.models import Direction, Flight
SEARCH_API = 'https://api.skypicker.com/flights'
CHECK_API = 'https://booking-api.skypicker.com/api/v0.1/check_flights?'
PARTNER = 'picky'
def create_flight(result):
flig... | 2.6875 | 3 |
testsuite/tests/apicast/auth/test_basic_auth_app_id.py | dlaso99/3scale-tests | 5 | 12791007 | """
Service requires credentials (app_id, app_key) to be passed using the Basic Auth
Rewrite ./spec/functional_specs/auth/basic_auth_app_id_spec.rb
"""
import pytest
from threescale_api.resources import Service
from testsuite.utils import basic_auth_string
@pytest.fixture(scope="module")
def service_settings(servi... | 2.234375 | 2 |
learning_journal/jinja_filters.py | palindromed/pet-project | 0 | 12791008 | # coding=utf-8
from __future__ import unicode_literals
from markdown import markdown as markdown_
def dateformat(date):
if not date:
return ""
return date.strftime('%Y-%m-%d')
def datetimeformat(date):
if not date:
return ""
return date.strftime('%Y-%m-%d %I:%M %p')
def markdown(t... | 2.84375 | 3 |
Python/make_fig_spect_energy_budg.py | ashwinvis/augieretal_jfm_2019_shallow_water | 1 | 12791009 | #!/usr/bin/env python
import pylab as pl
import fluidsim as fls
import os
import h5py
from fluidsim.base.output.spect_energy_budget import cumsum_inv
from base import _index_where, _k_f, _eps, set_figsize, matplotlib_rc, epsetstmax
from paths import paths_sim, exit_if_figure_exists
def fig2_seb(path, fig=None, ax=No... | 1.921875 | 2 |
rickroll/db.py | mvolfik/rickroll | 4 | 12791010 | from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
class Rickroll(db.Model):
__tablename__ = "rickrolls"
url = db.Column(db.String, primary_key=True)
title = db.Column(db.String, nullable=False)
imgurl = db.Column(db.String, nullable=False)
redirecturl = db.Column(db.String, nullable=False... | 2.578125 | 3 |
modules/plot_tools.py | LucaAmbrogioni/CascadingFlow | 7 | 12791011 | import numpy as np
import matplotlib.pyplot as plt
def plot_model(variational_model, X_true, K, M, savename=None):
for k in range(K):
X, mu, x_pre, log_jacobian, epsilon_loss = variational_model.sample_timeseries(M)
plt.plot(np.transpose(X[:, k, :].detach().numpy()), alpha=0.2)
plt.plot(np.... | 2.6875 | 3 |
bin/genbank2sequences.py | linsalrob/EdwardsLab | 30 | 12791012 | <reponame>linsalrob/EdwardsLab<filename>bin/genbank2sequences.py
#!/usr/bin/env python
"""
Convert a genbank file to sequences
"""
import os
import sys
import gzip
import argparse
from roblib import genbank_to_faa, genbank_to_fna, genbank_to_orfs, genbank_to_ptt, genbank_to_functions, genbank_seqio
from roblib import ... | 2.828125 | 3 |
conductor/conductor/solver/triage_tool/traige_latency.py | aalsudais/optf-has | 0 | 12791013 | <gh_stars>0
#
# -------------------------------------------------------------------------
# Copyright (c) 2015-2018 AT&T Intellectual Property
#
# 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 Lic... | 1.820313 | 2 |
sam/app-order-management/functions/sqscallbackfunction/app.py | wongcyrus/aws-stepfunctions-examples | 57 | 12791014 | <reponame>wongcyrus/aws-stepfunctions-examples<gh_stars>10-100
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
import json
import boto3
from aws_xray_sdk.core import xray_recorder
from aws_xray_sdk.core import patch_all
patch_all()
client = boto3.client('stepfunct... | 2.21875 | 2 |
Maximum_slice_problem/MaxSliceSum.py | aisolab/codility_lessons | 1 | 12791015 | <filename>Maximum_slice_problem/MaxSliceSum.py
from sys import maxsize
def solution(A):
max_sum = -maxsize
max_ending = 0
for a in A:
max_ending += a
if max_ending > max_sum:
max_sum = max_ending
if max_ending < 0:
max_ending = 0
return max_sum
de... | 3.09375 | 3 |
produce_docs/produce_docs.py | ShulzLab/pGenUtils | 0 | 12791016 | <reponame>ShulzLab/pGenUtils
import os,sys
_localpath = os.path.dirname(os.getcwd())
_packages_path = os.path.dirname(_localpath)
print(_packages_path)
sys.path.append(_packages_path)
from pGenUtils.docs import mkds_make_docfiles
mkds_make_docfiles(_localpath) | 1.914063 | 2 |
Examples/Additional Application Layer Example/Coffee/app/app.py | davidhozic/Discord-Shilling-Bot | 12 | 12791017 | import framework, datetime, os, random
already_sent = False
randomized_images = []
IMAGE_PATH = "./app/images/"
@framework.data_function
def get_data():
global already_sent, randomized_images
datum=datetime.datetime.now()
if datum.hour == 10 and not already_sent:
already_sent = True
... | 2.71875 | 3 |
setup.py | WhyNotHugo/ocaclient | 0 | 12791018 | #!/usr/bin/env python
from setuptools import setup
setup(
name="ocaclient",
description="A very simple client for OCA's web services.",
author="<NAME>",
author_email="<EMAIL>",
url="https://github.com/WhyNotHugo/ocaclient",
license="MIT",
packages=["ocaclient"],
install_requires=[
... | 1.1875 | 1 |
tests/test.py | dgwhited/project_lockdown | 37 | 12791019 | <reponame>dgwhited/project_lockdown<filename>tests/test.py
# -*- coding: utf-8 -*-
import unittest
class ExampleTestCases(unittest.TestCase):
"""test case"""
def test_check_test(self):
self.assertTrue(True)
if __name__ == '__main__':
unittest.main() | 2 | 2 |
holoviews/tests/plotting/matplotlib/testpathplot.py | jewfro-cuban/holoviews | 0 | 12791020 | <filename>holoviews/tests/plotting/matplotlib/testpathplot.py
import numpy as np
from holoviews.core import NdOverlay
from holoviews.element import Polygons, Contours
from .testplot import TestMPLPlot, mpl_renderer
class TestPolygonPlot(TestMPLPlot):
def test_polygons_colored(self):
polygons = NdOverla... | 2.421875 | 2 |
prescient/gosm/structures/skeleton_scenario.py | iSoron/Prescient | 21 | 12791021 | # ___________________________________________________________________________
#
# Prescient
# Copyright 2020 National Technology & Engineering Solutions of Sandia, LLC
# (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
# Government retains certain rights in this software.
# This software is ... | 2.015625 | 2 |
solver/spoof.py | juandesant/astrometry.net | 460 | 12791022 | <reponame>juandesant/astrometry.net
# This file is part of the Astrometry.net suite.
# Licensed under a 3-clause BSD style license - see LICENSE
try:
import pyfits
except ImportError:
try:
from astropy.io import fits as pyfits
except ImportError:
raise ImportError("Cannot import either pyfit... | 2.15625 | 2 |
bin_missing.py | hyanwong/tsinfer-benchmarks | 0 | 12791023 | """
Sample data files with missing data create ancestors at many different time points,
often only one ancestor in each time point, which can cause difficulties parallelising
the inference. This script takes a sampledata file (usually containing missing data),
calculates the times-as-freq values, then bins them into fr... | 2.359375 | 2 |
backend-django/prolibra/library_api/migrations/0039_alter_denda_jumlah_hari_telat.py | dhifafaz/tubes-basdat | 0 | 12791024 | # Generated by Django 3.2 on 2021-05-10 00:54
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('library_api', '0038_auto_20210510_0054'),
]
operations = [
migrations.AlterField(
model_name='denda',
name='jumlah_har... | 1.304688 | 1 |
src/implib/package.py | carlashley/adobe-mun-kinobi | 2 | 12791025 | <gh_stars>1-10
"""Adobe Package"""
import plistlib
from dataclasses import dataclass, field
from pathlib import Path
from sys import exit
from typing import Any, Dict, List, Optional, Union, TYPE_CHECKING
from urllib.parse import urlparse
from .appicon import find_app_icon
from .xmltodict import convert_xml, read_xml... | 1.804688 | 2 |
jackpot/migrations/0009_auto_20180721_1247.py | clonetech/jackpotsone | 0 | 12791026 | # Generated by Django 2.0.6 on 2018-07-21 09:47
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('jackpot', '0008_jackpot_no'),
]
operations = [
migrations.RemoveField(
model_name='jackpot',
name='away_odds',
),
... | 1.398438 | 1 |
kuna/kuna.py | kazanzhy/kuna | 1 | 12791027 | <reponame>kazanzhy/kuna
# -*- coding: utf-8 -*-
"""Main module."""
import hashlib
import hmac
import json
import time
import requests
try:
from urllib.parse import urlencode
except ImportError:
from urllib import urlencode
API_VERSION = '2'
KUNA_API_URL_PREFIX = 'api/v{}'.format(API_VERSION)
KUNA_API_BASEUR... | 2.625 | 3 |
labs/lab6/problem5.py | ioanabirsan/python | 0 | 12791028 | # Write another variant of the function from the previous exercise that returns those elements
# that have at least one attribute that corresponds to a key-value pair in the dictionary.
import re
def corresponding_elements(xml_path, attrs):
elements = set()
keys = attrs.keys()
try:
f = open(xm... | 3.96875 | 4 |
tests/test_transform/test_x5.py | physimals/fslpy | 6 | 12791029 | #!/usr/bin/env python
#
# test_x5.py -
#
# Author: <NAME> <<EMAIL>>
#
import os.path as op
import numpy as np
import pytest
import h5py
import fsl.data.image as fslimage
import fsl.utils.tempdir as tempdir
import fsl.transform.affine as affine
import fsl.transform.fnirt as fnirt
import fsl.tr... | 2.03125 | 2 |
venv/Lib/site-packages/torch/ao/nn/sparse/quantized/dynamic/__init__.py | Westlanderz/AI-Plat1 | 1 | 12791030 | from .linear import Linear
__all__ = [
"Linear",
]
| 1.078125 | 1 |
iron-unconditioned-reflexes/renderer.py | zshimanchik/iron-unconditioned-reflexes | 0 | 12791031 | from System.Windows import Point
from System.Windows.Shapes import *
from System.Windows.Controls import Grid, Canvas
from System.Windows.Media import Brushes, ScaleTransform, TranslateTransform, RotateTransform, TransformGroup, RadialGradientBrush, Color
import math
from animal import Gender
class Renderer(object)... | 2.71875 | 3 |
test/test_integration.py | project-origin/ledger-sdk-python | 0 | 12791032 | import unittest
import pytest
import time
from datetime import datetime, timezone
from bip32utils import BIP32Key
from testcontainers.compose import DockerCompose
from src.origin_ledger_sdk import Ledger, Batch, BatchStatus, MeasurementType, PublishMeasurementRequest, IssueGGORequest, TransferGGORequest, SplitGGOReq... | 2.03125 | 2 |
test/app_testing/test_apps/sag_exception/custom/np_trainer.py | drbeh/NVFlare | 0 | 12791033 | import time
from nvflare.apis.executor import Executor
from nvflare.apis.fl_constant import ReturnCode
from nvflare.apis.fl_context import FLContext
from nvflare.apis.shareable import Shareable
from nvflare.apis.signal import Signal
from nvflare.app_common.app_constant import AppConstants
class NPTrainer(Executor):
... | 2.109375 | 2 |
products/ui/llbuildui/model.py | uraimo/swift-llbuild | 1,034 | 12791034 | import struct
from sqlalchemy import *
from sqlalchemy.orm import relation, relationship
from sqlalchemy.ext.declarative import declarative_base
# DB Declaration
Base = declarative_base()
class KeyName(Base):
__tablename__ = "key_names"
id = Column(Integer, nullable=False, primary_key=True)
name = Colu... | 2.5625 | 3 |
3. BinarySearch.py | KishalayB18/Mini-Python-Projects | 0 | 12791035 | <reponame>KishalayB18/Mini-Python-Projects<filename>3. BinarySearch.py
from array import*
a=array('i',[])
def binarySearch(a, val):
lb=0
ub=len(a)-1
while lb<=ub:
mid=(lb+ub)//2
if a[mid]== val:
return mid
elif a[mid]>val:
ub=mid-1
elif a[... | 3.828125 | 4 |
core/dbt/config/__init__.py | darrenhaken/dbt | 0 | 12791036 | <gh_stars>0
from .renderer import ConfigRenderer
from .profile import Profile, UserConfig, PROFILES_DIR
from .project import Project
from .runtime import RuntimeConfig
| 1.046875 | 1 |
utils/views.py | Open-CMMS/openCMMS_backend | 3 | 12791037 | """This is our file to provide our endpoints for our utilities."""
import logging
import os
from drf_yasg.utils import swagger_auto_schema
from maintenancemanagement.models import Equipment, FieldObject
from openCMMS.settings import BASE_DIR
from utils.data_provider import (
DataProviderException,
add_job,
... | 2.265625 | 2 |
hwr/cae/cae_trainer.py | KatharinaHermann/tum-Advanced-DL-for-robotics-RL | 2 | 12791038 | <filename>hwr/cae/cae_trainer.py<gh_stars>1-10
import tensorflow as tf
import tensorflow.keras.optimizers as opt
import numpy as np
import argparse
import os
import matplotlib.pyplot as plt
from tensorflow.data import Dataset
from tensorflow.keras.losses import BinaryCrossentropy
from hwr.cae.cae import CAE
from hwr.r... | 2.5625 | 3 |
examples/modeling_helices/helical_params_torsion-angle-scan/get_helical_parameters.py | shirtsgroup/analyze_foldamers | 1 | 12791039 | <gh_stars>1-10
import os
import numpy as np
import matplotlib.pyplot as pyplot
from statistics import mean
from simtk import unit
from foldamers.cg_model.cgmodel import CGModel
from foldamers.parameters.reweight import (
get_mbar_expectation,
get_free_energy_differences,
get_temperature_list,
)
from foldame... | 1.890625 | 2 |
tests/test_basic.py | Pomb/memorite | 0 | 12791040 | import unittest
class MyTest(unittest.TestCase):
def test(self):
self.assertEqual(42, 42)
| 2.6875 | 3 |
cazipcode/search.py | MacHu-GWU/cazipcode-project | 0 | 12791041 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import random
import heapq
from math import radians, cos
from functools import total_ordering
from sqlalchemy import select, func, and_
try:
from .data import (
engine, t,
find_province, find_city, find_area_name, fields,
)
from .pkg.nameddict ... | 2.78125 | 3 |
airflow/utils/code_utils.py | shrutimantri/airflow | 15 | 12791042 | <reponame>shrutimantri/airflow
# 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 (... | 2.453125 | 2 |
ldap2pg/defaults.py | ng-pe/ldap2pg | 151 | 12791043 | from itertools import chain
from textwrap import dedent
from .utils import string_types
shared_queries = dict(
datacl=dedent("""\
WITH grants AS (
SELECT
(aclexplode(datacl)).grantee AS grantee,
(aclexplode(datacl)).privilege_type AS priv
FROM pg_catalog.pg_database
WHERE da... | 2.234375 | 2 |
acs_test_scripts/TestStep/Utilities/Math/MathOperation.py | wangji1/test-framework-and-suites-for-android | 8 | 12791044 | """
Copyright (C) 2017 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
softw... | 2.5 | 2 |
devit/tools.py | uranusjr/subl-open-project | 0 | 12791045 | import os
import pathlib
import subprocess
import sys
import fuzzywuzzy.fuzz
FUZZY_FIND_THRESHOLD = 75
class _Tool:
def find_cmd(self, directory):
if sys.platform == "win32":
cmd_exts = self.cmd_exts
else:
cmd_exts = [""]
for ext in cmd_exts:
path = p... | 2.28125 | 2 |
setup.py | TobiasHerr/iterpipe-fork | 1 | 12791046 | <reponame>TobiasHerr/iterpipe-fork
import re
from setuptools import setup
def get_version():
with open('iterpipe/__init__.py', "r") as vfh:
vline = vfh.read()
vregex = r"^__version__ = ['\"]([^'\"]*)['\"]"
match = re.search(vregex, vline, re.M)
if match:
return match.group(1)
else:... | 1.734375 | 2 |
azure-upload.py | xcllnt/azure-upload | 0 | 12791047 | <reponame>xcllnt/azure-upload<filename>azure-upload.py<gh_stars>0
#!/usr/bin/env python
#
# Copyright (c) 2015 <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of so... | 1.78125 | 2 |
linkedlist.py | amulyakashyap09/pyds | 0 | 12791048 | <gh_stars>0
class Node:
def __init__(self, data):
self.data = data
self.ref = None
class LinkedList:
def __init__(self):
self.start_node = None
def traverse_list(self):
if self.start_node is None:
print("List is empty")
else:
node = self.start_node
while(node is not None):... | 4.09375 | 4 |
urls/surt2url.py | ibnesayeed/utils | 0 | 12791049 | #!/usr/bin/env python3
import fileinput
for line in fileinput.input():
try:
host, rest = line.strip().split(")", 1)
host = ".".join(reversed(host.strip(",").split(",")))
print(f"https://{host}{rest or '/'}")
except BrokenPipeError:
break
except:
print(line, end="")
| 3.1875 | 3 |
u2pl/utils/loss_helper.py | Haochen-Wang409/U2PL | 96 | 12791050 | import numpy as np
import scipy.ndimage as nd
import torch
import torch.nn as nn
from torch.nn import functional as F
from .utils import dequeue_and_enqueue
def compute_rce_loss(predict, target):
from einops import rearrange
predict = F.softmax(predict, dim=1)
with torch.no_grad():
_, num_cls, ... | 2.1875 | 2 |