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 |
|---|---|---|---|---|---|---|
wayback/__init__.py | edsu/wayback | 0 | 12781751 | <gh_stars>0
from ._version import get_versions
__version__ = get_versions()['version']
del get_versions
from ._client import ( # noqa
CdxRecord,
memento_url_data,
WaybackClient,
WaybackSession)
| 1.242188 | 1 |
Plugins/Aspose.BarCode Java for Jython/asposebarcode/WorkingWithBarcode/AdvanceFeatures/PatchCode.py | aspose-barcode/Aspose.BarCode-for-Java | 10 | 12781752 | <filename>Plugins/Aspose.BarCode Java for Jython/asposebarcode/WorkingWithBarcode/AdvanceFeatures/PatchCode.py
from asposebarcode import Settings
from com.aspose.barcode import BarCodeBuilder
from com.aspose.barcode import Symbology
class PatchCode:
def __init__(self):
dataDir = Settings.dataDir + 'Workin... | 2.625 | 3 |
scripts/user.py | GabrielTavernini/TelegramMap | 3 | 12781753 | class User:
def __init__(self, name, time, point, dist):
self.name = name
self.time = time
self.points = {point: dist} | 2.796875 | 3 |
examples/deadline/All-In-AWS-Infrastructure-Basic/python/package/lib/security_tier.py | aws-painec/aws-rfdk | 76 | 12781754 | <reponame>aws-painec/aws-rfdk
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
from aws_cdk.core import (
Construct,
Stack,
)
from aws_rfdk import (
DistinguishedName,
X509CertificatePem
)
class SecurityTier(Stack):
"""
The security ti... | 2.046875 | 2 |
sdk/python/pulumi_google_native/file/v1beta1/get_instance.py | AaronFriel/pulumi-google-native | 44 | 12781755 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
fro... | 1.742188 | 2 |
examples/retirement_accumulation.py | nheske/stocker | 7 | 12781756 | #!/usr/bin/env python3
# Include the directory up in the path:
import sys
sys.path.insert(0,'..')
# Import stocker:
import stocker
# Main:
if __name__== "__main__":
# Let's save in a combination of stocks and bonds for retirement. Weight the
# initial portfolio towards 100% stocks for 15 years, weighted 70% US ... | 3.03125 | 3 |
module2-sql-for-analysis/insert_titanic.py | ameralhomdy/DS-Unit-3-Sprint-2-SQL-and-Databases | 0 | 12781757 | <filename>module2-sql-for-analysis/insert_titanic.py
import psycopg2
import pandas as pd
import sqlite3
import helper
from settings import secrets
def load_dataset(fpath, verbose=False):
df = pd.read_csv(fpath)
df['Name'] = df['Name'].str.replace("'", "")
if verbose:
print('Shape is: ', df.shape)... | 3.375 | 3 |
zktx/storage.py | wenbobuaa/pykit | 0 | 12781758 | #!/usr/bin/env python
# coding: utf-8
import logging
from pykit import rangeset
from pykit import txutil
from .accessor import KeyValue
from .accessor import Value
from .status import COMMITTED
from .status import PURGED
from .status import STATUS
logger = logging.getLogger(__name__)
class StorageHelper(object):
... | 2.328125 | 2 |
tests/avalon_test_framework/tests/work_order_tests/test_submit_getresult.py | jinengandhi-intel/avalon | 0 | 12781759 | <gh_stars>0
import pytest
import logging
from src.libs.avalon_test_base import AvalonBase
from src.libs.verification_libs \
import verify_test, check_negative_test_responses,\
validate_response_code
from src.libs.pre_processing_libs \
import ResultStatus
from conftest import env
logger = logging.getLogger(... | 2.1875 | 2 |
ioutracker/dataloaders/MOTDataLoader.py | jiankaiwang/ioutracker | 3 | 12781760 | # -*- coding: utf-8 -*-
"""
@author: jiankaiwang
@version: 0.0.1
@date: 2020/03
@desc: The script implements the data loader of the MOT challenge.
@note:
Style: pylint_2015
@reference:
"""
import os
import logging
import pandas as pd
import requests
import tqdm
import zipfile
import argparse
# In[]
MOT_ID_LABEL = ... | 2.6875 | 3 |
main.py | Genzo4/knd-1190803 | 0 | 12781761 | <reponame>Genzo4/knd-1190803
import wx
from yoyo import read_migrations
from yoyo import get_backend
import options
from logzero import logger
class MainFrame(wx.Frame):
def __init__(self, *args, **kwds):
kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE
wx.Frame.__init__(self, *args, ... | 1.992188 | 2 |
face_pose_dataset/third_party/fsa_estimator/SSRNET_model.py | samuelbaltanas/face-pose-dataset | 1 | 12781762 | import logging
import sys
import numpy as np
from tensorflow.keras import backend as K
from tensorflow.keras import layers
from tensorflow.keras.layers import (
AveragePooling2D,
BatchNormalization,
Conv2D,
MaxPooling2D,
SeparableConv2D,
)
from tensorflow.keras.models import Model
sys.setrecursion... | 2.609375 | 3 |
python/pyo.py | dnagle-usgs/lidar-processing | 1 | 12781763 | import code
import os.path
import sys
sys.path.append(os.path.dirname(__file__))
import alps.site
yo = alps.site.yo
code.interact(local=locals())
| 1.625 | 2 |
queue_/queue_stack.py | makar-fedorov/programming-2021-19fpl | 0 | 12781764 | """
Programming for linguists
Implementation of the data structure "QueueStack"
"""
from typing import Iterable
class QueueStack:
"""
Queue Data Structure from Stack
"""
def __init__(self, data: Iterable = None, queue_size: int = 'no_info'):
if data and isinstance(data, list):
s... | 4.03125 | 4 |
tk_basic_as_possible.py | alvaro-root/pa2_2021 | 1 | 12781765 | """
Tkinter generic tasks
1. LOOK: Define the look of the screen
2. DO; Define the event handler routines
3. LOOK associated with DO: Associate interesting keyboard events with their handlers.
4. LISTEN: Loop forever, observing events. Exit when an exit event occurs.
"""
from tkinter import *
# Contain top level win... | 3.484375 | 3 |
cactus/listener/__init__.py | danielchasehooper/Cactus | 1,048 | 12781766 | <filename>cactus/listener/__init__.py
import logging
from cactus.listener.polling import PollingListener
logger = logging.getLogger(__name__)
try:
from cactus.listener.mac import FSEventsListener as Listener
except (ImportError, OSError):
logger.debug("Failed to load FSEventsListener, falling back to Poll... | 1.960938 | 2 |
eyws/docker.py | canelmas/eyws | 2 | 12781767 | <filename>eyws/docker.py
# Copyright 2018 <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 applicable law or agreed... | 2.15625 | 2 |
tests/__init__.py | posita/modwalk | 0 | 12781768 | <filename>tests/__init__.py
# -*- encoding: utf-8 -*-
# ======================================================================
"""
Copyright and other protections apply. Please see the accompanying
:doc:`LICENSE <LICENSE>` and :doc:`CREDITS <CREDITS>` file(s) for rights
and restrictions governing use of this software. ... | 1.679688 | 2 |
simulation/modem/util/qam_mapper.py | jdemel/GFDM-PHY-Reference | 0 | 12781769 | <filename>simulation/modem/util/qam_mapper.py<gh_stars>0
import numpy as np
import numpy as np
import matplotlib as plt
from commpy.utilities import bitarray2dec, dec2bitarray
from itertools import product
class QamMapper():
""" Creates a Quadrature Amplitude Modulation (QAM) Modem object.
Modi... | 2.875 | 3 |
pidf/__init__.py | jasmine125/pidf | 0 | 12781770 | # This page intentionally left blank | 0.765625 | 1 |
temboo/core/Library/DataGov/GetCensusIDByTypeAndName.py | jordanemedlock/psychtruths | 7 | 12781771 | <filename>temboo/core/Library/DataGov/GetCensusIDByTypeAndName.py
# -*- coding: utf-8 -*-
###############################################################################
#
# GetCensusIDByTypeAndName
# Retrieve the U.S. census ID for a specified geography type and name.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2... | 2.265625 | 2 |
app.py | itsron143/markov-gen | 1 | 12781772 | <gh_stars>1-10
from flask import Flask, current_app
from flask import render_template, request
from markov_gen.markov_gen import word_markovIt, ngram_markovIt
app = Flask(__name__)
def read_file(corpus):
file_path = "markov_gen/corpus/" + corpus + ".txt"
with current_app.open_resource(file_path, mode="r") as... | 2.59375 | 3 |
morse/main.py | augustin64/scripts | 0 | 12781773 | #!/usr/bin/python3
# max_score:392
import sys
import random
import platform
from optparse import OptionParser
if platform.system() == "Windows":
import msvcrt
import time
else:
from select import select
try:
import enquiries
choose = enquiries.choose
except: # On offre une autre option si le mod... | 2.8125 | 3 |
src/ggrc_risks/migrations/versions/20170502140636_377d935e1b21_migrate_urls_to_documents.py | Killswitchz/ggrc-core | 0 | 12781774 | # Copyright (C) 2017 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""
migrate urls to documents
Create Date: 2017-05-02 14:06:36.936410
"""
# disable Invalid constant name pylint warning for mandatory Alembic variables.
# pylint: disable=invalid-name
from ggrc.migrations... | 1.945313 | 2 |
51cto.py | hmilyfe/web-get | 0 | 12781775 | #!/usr/bin/python2.6
#coding=utf-8
#51cto自动领豆 by 2016-07-27
import requests
import time
from bs4 import BeautifulSoup
import random
def freedown(username,passwd):
header = {'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20100101 Firefox/14.0.1','Referer':'http://home.51cto.com/index'}
req = re... | 2.640625 | 3 |
misc/deep_learning_notes/Ch3 Advanced Tensorflow/GPU and device management tests/1_simple_GPU_test.py | tmjnow/MoocX | 7 | 12781776 | import tensorflow as tf
a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a')
b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b')
c = tf.matmul(a, b)
# Creates a session with log_device_placement set to True.
with tf.Session(config=tf.ConfigProto(log_device_placement=True)) as ses... | 2.5625 | 3 |
Advent2015/2.py | SSteve/AdventOfCode | 0 | 12781777 | import re
boxRegex = re.compile(r"(\d+)x(\d+)x(\d+)")
def day2(fileName):
totalPaper = 0
totalRibbon = 0
with open(fileName) as infile:
for line in infile:
match = boxRegex.match(line)
if match:
sides = sorted(int(side) for side in match.group(1, 2, 3))
totalPaper += 3 * sides[0] * sides[1] + 2 * s... | 3.34375 | 3 |
Demo/common/example_math_file.py | quecpython/EC100Y-SDK | 4 | 12781778 | # 数学运算math函数示例
import math
import log
# 设置日志输出级别
log.basicConfig(level=log.INFO)
math_log = log.getLogger("Math")
# x**y运算后的值
result = math.pow(2,3)
math_log.info(result)
# 8.0
# 取大于等于x的最小的整数值,如果x是一个整数,则返回x
result = math.ceil(4.12)
math_log.info(result)
# 5
# 把y的正负号加到x前面,可以使用0
result = math.copysign(2,-3)
math_... | 3.34375 | 3 |
pandas/tests/strings/test_extract.py | oricou/pandas | 2 | 12781779 | <gh_stars>1-10
from datetime import datetime
import re
import numpy as np
import pytest
from pandas import (
DataFrame,
Index,
MultiIndex,
Series,
_testing as tm,
)
def test_extract_expand_None():
values = Series(["fooBAD__barBAD", np.nan, "foo"])
with pytest.raises(ValueError, match="ex... | 2.5 | 2 |
double_pendulum_animated.py | ehoppmann/double-pendulum-matplotlib-subplots | 0 | 12781780 | <reponame>ehoppmann/double-pendulum-matplotlib-subplots<filename>double_pendulum_animated.py
#!/usr/bin/env python3
"""
===========================
The double pendulum problem
===========================
This animation illustrates the double pendulum problem.
"""
# Double pendulum formula translated from the C code a... | 3.78125 | 4 |
funhouse.py | thertzelle/funhouse-clock | 0 | 12781781 | import board
import neopixel
pixels = neopixel.NeoPixel(board.D6, 30, brightness=0.5, auto_write=False)
pixels.fill((255, 0, 0))
pixels.show()
| 2.53125 | 3 |
object_detection/evaluation/COCODataset.py | HeartFu/NeuralBabyTalk | 1 | 12781782 | import os
from PIL import Image
from pycocotools.coco import COCO
from torch.utils import data
class COCODataset(data.Dataset):
def __init__(self, images_path, ann_path, split='train', transform=None):
self.coco = COCO(ann_path)
self.image_path = images_path
self.ids = list(self.coco.imgs... | 2.765625 | 3 |
ClusterTools/cluster_szspec.py | deimqs/ClusterModel | 2 | 12781783 | """
This script gather functions related to the SZ spectrum
"""
import numpy as np
import astropy.units as u
from astropy import constants as const
from astropy.cosmology import Planck15 as cosmo
#===================================================
#========== CMB intensity
#========================================... | 2.8125 | 3 |
mowl/embeddings/translational/model.py | bio-ontology-research-group/OntoML | 0 | 12781784 | <gh_stars>0
from mowl.model import EmbeddingModel
from mowl.projection.factory import projector_factory
from mowl.projection.edge import Edge
#PyKEEN imports
from pykeen.triples import CoreTriplesFactory
from pykeen.models import TransE, TransH, TransR, TransD
from pykeen.training import SLCWATrainingLoop
from pykeen... | 2.03125 | 2 |
flask_saestorage.py | csuzhangxc/Flask-SaeStorage | 11 | 12781785 | # -*- coding: utf-8 -*-
from sae import storage
class SaeStorage(object):
def __init__(self, app=None):
self.app = app
if app is not None:
self.init_app(app)
def init_app(self, app):
access_key = app.config.get('SAE_ACCESS_KEY', storage.ACCESS_KEY)
secret_key = ap... | 2.53125 | 3 |
cassle/methods/vicreg.py | DonkeyShot21/cassle | 13 | 12781786 | <filename>cassle/methods/vicreg.py
import argparse
from typing import Any, Dict, List, Sequence
import torch
import torch.nn as nn
from cassle.losses.vicreg import vicreg_loss_func
from cassle.methods.base import BaseModel
class VICReg(BaseModel):
def __init__(
self,
output_dim: int,
proj... | 2.328125 | 2 |
bin/physiboss.py | sysbio-curie/pb4covid19 | 1 | 12781787 | # PhysiBoSS Tab
import os
from ipywidgets import Layout, Label, Text, Checkbox, Button, HBox, VBox, Box, \
FloatText, BoundedIntText, BoundedFloatText, HTMLMath, Dropdown, interactive, Output
from collections import deque, Counter
import xml.etree.ElementTree as ET
import matplotlib.pyplot as plt
from matplotlib.co... | 2.09375 | 2 |
src/compas_assembly/geometry/_geometry.py | GeneKao/compas_assembly | 0 | 12781788 | <reponame>GeneKao/compas_assembly
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
__all__ = ['Geometry']
class Geometry(object):
def __init__(self):
pass
def blocks(self):
raise NotImplementedError
def interfaces(self):
... | 2.375 | 2 |
src/harvest/posts.py | fhgr/harvest | 5 | 12781789 | <filename>src/harvest/posts.py
#!/usr/bin/env python3
# Forum Extraction AI and heuristic
# ---------------------------------
# (C)opyrights 2020 <NAME>
# simplifications:
# ================
# - only consider tags with a class attribute
# - vsm based on the hashing trick
# algorithm
# =========
# - match text to xpa... | 2.046875 | 2 |
python/param_utils.py | MeshFEM/MeshFEM | 19 | 12781790 | import enum
import mesh
from tri_mesh_viewer import TriMeshViewer
import parametrization
from matplotlib import pyplot as plt
def analysisPlots(m, uvs, figsize=(8,4), bins=200):
plt.figure(figsize=figsize)
plt.subplot(1, 2, 1)
for label, uv in uvs.items():
distortion = parametrization.conformalDist... | 2.109375 | 2 |
week_0_to_2/tree_analysis/hw0pr2/hw0pr2Answers.py | ScriptingBeyondCS/CS-35 | 0 | 12781791 | import os
import os.path
import shutil
# 1
def countFilesOfType(top, extension):
"""inputs: top: a String directory
extension: a String file extension
returns a count of files with a given extension in the directory
top and its subdirectories"""
count = 0
filename... | 3.90625 | 4 |
PCRC-MCDR.py | MiKayule/PCRC-MCDR | 0 | 12781792 | # -*- coding: utf-8 -*-
import sys
import importlib
import time
sys.path.append('plugins/')
PCRC = None
PREFIX = '!!PCRC'
# 0=guest 1=user 2=helper 3=admin
Permission = 1
def permission(server, info, perm):
if info.is_user:
if info.source == 1:
return True
elif server.get_permission_l... | 2.34375 | 2 |
pratik.py | Tesmi-ui/Tesmi-ux | 0 | 12781793 | <reponame>Tesmi-ui/Tesmi-ux<filename>pratik.py
import random
import math
def main():
user = int(input("inter a no.:" ))
print("your entered number is " user)
| 3.109375 | 3 |
untws/position.py | maanbsat/untws | 11 | 12781794 | <gh_stars>10-100
#!/usr/bin/env python
# encoding: utf-8
# position.py
#
# Created by <NAME> on 2013-09-02.
# Copyright (c) 2013 <NAME>. All rights reserved.
from untws.instrument import create_instrument
class Position(object):
"""Represents a single position"""
def __init__(self, connection, account... | 2.6875 | 3 |
output/copilot/python/timeout/house-robber.py | nhtnhan/CMPUT663-copilot-eval | 0 | 12781795 | <gh_stars>0
# https://leetcode.com/problems/house-robber/
class Solution(object):
def rob(self, nums):
"""
You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjace... | 3.65625 | 4 |
carla/evaluation/benchmark.py | jayanthyetukuri/CARLA | 0 | 12781796 | import timeit
from typing import Union
import numpy as np
import pandas as pd
import copy
from carla.evaluation.distances import get_distances
from carla.evaluation.nearest_neighbours import yNN, yNN_prob, yNN_dist
from carla.evaluation.manifold import yNN_manifold, sphere_manifold
from carla.evaluation.process_nans ... | 2.421875 | 2 |
config/appdaemon/apps/kodi_ambient_lights.py | azogue/hassio_config | 18 | 12781797 | # -*- coding: utf-8 -*-
"""
Automation task as a AppDaemon App for Home Assistant
This little app controls the ambient light when Kodi plays video,
dimming some lights and turning off others, and returning to the
initial state when the playback is finished.
In addition, it also sends notifications when starting the v... | 2.640625 | 3 |
fp-cloud-compute/fpstackutils/cmd/nova.py | 2535463841/fluent-python | 0 | 12781798 | import sys
from fp_lib.common import cliparser
from fp_lib.common import log
from fpstackutils.commands import nova
LOG = log.getLogger(__name__)
def main():
cli_parser = cliparser.SubCliParser('Python Nova Utils')
cli_parser.register_clis(nova.ResourcesInit,
nova.VMCleanup, nov... | 2.015625 | 2 |
src/fhdc/preprocessing.py | middlec000/fast_heirarchical_document_clustering | 0 | 12781799 | from nltk.stem import WordNetLemmatizer
from nltk.corpus import stopwords
# Note: Must download stuff for stopwords:
# showing info https://raw.githubusercontent.com/nltk/nltk_data/gh-pages/index.xml
import re
import string
from typing import Dict
from data_classes import *
def preprocess(docs: Dict[str,str], **kwargs... | 3.25 | 3 |
pretrain.py | rlaboulaye/turn-of-phrase | 0 | 12781800 | <reponame>rlaboulaye/turn-of-phrase<gh_stars>0
from argparse import ArgumentParser
import random
import time
from typing import Callable
from convokit import Corpus, download
import numpy as np
import torch
from torch import nn
import torch.backends.cudnn as cudnn
from torch.cuda.amp import GradScaler, autocast
from t... | 2.15625 | 2 |
degmo/vae/__init__.py | IcarusWizard/Deep-Generative-Models | 2 | 12781801 | <gh_stars>1-10
from .vae import VAE
from .fvae import FVAE
from .vqvae import VQ_VAE | 0.976563 | 1 |
remind.py | ksu-hmi/Remind_Rx | 0 | 12781802 | #Importing all the necessary libraries:
from tkinter import *
import datetime
import time
import sys
import signal
import os
import webbrowser
import time
import re
# Log into the app
print ("RemindRx, your guide to better health")
print("Enter Email address(Username): ")
email_address = input()
while "@" not in ema... | 4 | 4 |
main.py | Katreque/trab-means | 0 | 12781803 | from sklearn.cluster import KMeans
from random import randint
import numpy as np
import csv
import matplotlib.pyplot as plt
matriz = []
arrayCriacaoCentroides = []
with open('dataset_iris.csv') as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
largPetala = (row['larguraPetala'])
... | 3.046875 | 3 |
setup.py | Jim00000/waterwave-simulator | 1 | 12781804 | <reponame>Jim00000/waterwave-simulator
"""
Copyright (C) 2017 the team of Jim00000, ActKz and pityYo
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 limita... | 1.46875 | 1 |
server/processes/migrations/0082_auto_20191219_0855.py | CloudReactor/task_manager | 0 | 12781805 | <filename>server/processes/migrations/0082_auto_20191219_0855.py
# Generated by Django 2.2.2 on 2019-12-19 08:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('processes', '0081_auto_20191217_0709'),
]
operations = [
migrat... | 1.445313 | 1 |
stock_info.py | play0137/Stock_web_crawler | 4 | 12781806 | """ 個股月營收資訊 """
import re
import sys
import pdb
import pandas as pd
from stock_web_crawler import stock_crawler, delete_header, excel_formatting
import global_vars
def main():
global_vars.initialize_proxy()
""" valid input formats """
# inputs = "台積電 聯電"
# inputs = "2330 2314"
# inputs = "台積電... | 2.796875 | 3 |
examples/chrome-dino/main.py | robianmcd/keras-mri | 12 | 12781807 | <filename>examples/chrome-dino/main.py
from keras.models import Model
from keras.layers import Input, Conv2D, Flatten, Dense, concatenate
import numpy as np
import imageio
import os
import os.path as path
import kmri
base_path = path.dirname(path.realpath(__file__))
weights_path = path.join(base_path, 'model-weights.h... | 2.625 | 3 |
first_setup.py | EzraCerpac/SatLink | 8 | 12781808 | <gh_stars>1-10
import sys
import subprocess
# package list must follow the installation guide in README.md
package_list = ('itur==0.2.1', 'tqdm==4.56.0', 'pandas==1.2.1', 'pathos==0.2.7', 'astropy==4.2', 'pyqt5==5.15.2',
'matplotlib==3.4.1')
for package in package_list:
# implement pip as ... | 2.28125 | 2 |
tethys_quotas/models/tethys_app_quota.py | msouff/tethys | 79 | 12781809 | """
********************************************************************************
* Name: tethys_app_quota.py
* Author: tbayer, mlebarron
* Created On: April 2, 2019
* Copyright: (c) Aquaveo 2018
********************************************************************************
"""
import logging
from django.db impor... | 1.695313 | 2 |
python/RawNet2/dataloader.py | ishine/RawNet | 199 | 12781810 | <reponame>ishine/RawNet<gh_stars>100-1000
import numpy as np
import soundfile as sf
from torch.utils import data
class Dataset_VoxCeleb2(data.Dataset):
def __init__(self, list_IDs, base_dir, nb_samp = 0, labels = {}, cut = True, return_label = True, norm_scale = True):
'''
self.list_IDs : list of strings (each s... | 2.4375 | 2 |
test/test_group.py | malramsay64/hoomd-simple-force | 0 | 12781811 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2018 <NAME> <<EMAIL>>
#
# Distributed under terms of the MIT license.
import hoomd
import hoomd.simple_force
import hoomd.md
import numpy as np
context = hoomd.context.initialize("--notice-level=10 --mode=cpu")
uc = hoomd.lattice.unitcell... | 1.898438 | 2 |
website/discovery/views.py | gaybro8777/osf.io | 628 | 12781812 | <filename>website/discovery/views.py
from framework.flask import redirect
def redirect_activity_to_search(**kwargs):
return redirect('/search/')
| 1.695313 | 2 |
utils/orbits.py | tom-boyes-park/n-body-modelling | 1 | 12781813 | import logging
from typing import List
import matplotlib.pyplot as plt
import numpy as np
import streamlit as st
from matplotlib.animation import FuncAnimation
from scipy import integrate
from utils.objects import Body
logger = logging.getLogger(__name__)
# Arbitrary value for G (gravitational constant)
G = 1
def... | 3.28125 | 3 |
sjtwo-c/site_scons/color.py | seanlinc/Playmate | 2 | 12781814 | <gh_stars>1-10
import sys
import colorama
def _is_command_prompt():
return sys.stdin.isatty() is True
if _is_command_prompt():
colorama.init()
class ColorString(object):
COLORS = {
"red": colorama.Fore.RED,
"green": colorama.Fore.GREEN,
"yellow": colorama.Fore.YELLOW,
... | 2.984375 | 3 |
src/yw2nwlib/nwd_file.py | peter88213/yw2nw | 1 | 12781815 | """Provide a generic class for novelWriter item file representation.
Copyright (c) 2022 <NAME>
For further information see https://github.com/peter88213/yw2nw
Published under the MIT License (https://opensource.org/licenses/mit-license.php)
"""
import os
from pywriter.pywriter_globals import ERROR
class Nw... | 2.8125 | 3 |
2-hard/computer-terminal/main.py | mpillar/codeeval | 21 | 12781816 | <reponame>mpillar/codeeval<filename>2-hard/computer-terminal/main.py
import sys
class Screen:
_SCREEN_ROWS = 10
_SCREEN_COLS = 10
def __init__(self, terminal_input):
self.terminal_input = terminal_input
# Rendering variables.
self._in_overwrite_mode = True
self._current_ro... | 3.109375 | 3 |
utils/utils.py | cendaifeng/keras-face-recognition | 1 | 12781817 | import sys
from operator import itemgetter
import numpy as np
import cv2
import math
import matplotlib.pyplot as plt
# -----------------------------#
# 计算原始输入图像
# 每一次缩放的比例
# -----------------------------#
def calculateScales(img):
copy_img = img.copy()
pr_scale = 1.0
h, w, _ = copy_img.shape
if ... | 2.3125 | 2 |
modules/timer.py | DMCTruong/MoosikBot | 1 | 12781818 | <filename>modules/timer.py<gh_stars>1-10
##########################################################################################
# Program Name : Discord Bot
# Author : DMCTruong
# Last Updated : August 31, 2017
# License : MIT
# Description : A general purpose bot written for Discord... | 3.140625 | 3 |
code/traditional/KMM.py | Flsahkong/transferlearning | 9 | 12781819 | <gh_stars>1-10
# encoding=utf-8
"""
Created on 9:53 2019/4/21
@author: <NAME>
"""
"""
Kernel Mean Matching
# 1. Gretton, Arthur, et al. "Covariate shift by kernel mean matching." Dataset shift in machine learning 3.4 (2009): 5.
# 2. Huang, Jiayuan, et al. "Correcting sample selection bias by unlabeled data.... | 2.328125 | 2 |
RelayHandler/plugin.py | nyuszika7h/limnoria-plugins | 3 | 12781820 | <reponame>nyuszika7h/limnoria-plugins<gh_stars>1-10
# Copyright 2017, nyuszika7h <<EMAIL>>
#
# 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 limitatio... | 1.570313 | 2 |
poseidon/dags/city_docs/ob_testdocs_dags.py | panda-tech/poseidon-airflow | 0 | 12781821 | <filename>poseidon/dags/city_docs/ob_testdocs_dags.py
""" OnBase web tables _dags file"""
from airflow.operators.python_operator import PythonOperator
from airflow.operators.bash_operator import BashOperator
from trident.operators.s3_file_transfer_operator import S3FileTransferOperator
from airflow.operators.latest_onl... | 2.125 | 2 |
tests_scripts/Sprint1-f19/Sprint1-f19/tests/loginpageui.py | uno-isqa-8950/uno-cpi | 13 | 12781822 | <gh_stars>10-100
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
class LoginPageUi:
## URL
URL = 'https://uno-cpi-dev.herokuapp.com/'
# Locators for Login
Login_link = (By.XPATH, '//*[@id="target"]/ul/li[4]/a')
Username_field = (By.XPATH, '/html/body/di... | 2.3125 | 2 |
pyyadisk/__init__.py | ndrwpvlv/pyyadisk | 1 | 12781823 | <filename>pyyadisk/__init__.py
from .yandexdisk import YandexDisk
| 1.039063 | 1 |
lunch/models.py | pythondev0101/django_eats_easy_ordering_system | 0 | 12781824 | <gh_stars>0
from django.db import models
from django.contrib.auth.models import User
from django.urls import reverse
# Create your models here.
class Order(models.Model):
"""Blueprint for Order object"""
weekorder = models.ForeignKey('human_resource.OrderForWeek',on_delete=models.SET_NULL,null=True)
name ... | 2.375 | 2 |
server/server/settings.py | dcat52/interop | 0 | 12781825 | <gh_stars>0
"""
Django settings for the interop server.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BA... | 1.835938 | 2 |
tests/test_physics/test_fock/test_fock.py | sylviemonet/MrMustard | 33 | 12781826 | # Copyright 2021 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 2.125 | 2 |
tests/core/test_api_options.py | webbcam/tiflash | 5 | 12781827 | import pytest
import tiflash
class TestOptionsApi():
# Getters
def test_basic_get_option(self, tdev):
"""Tests basic get_option function"""
result = tiflash.get_option(tdev['option'],
serno=tdev['serno'],
connection=tdev['connection'],
devicetype=tdev['devi... | 2.046875 | 2 |
plugins/module_utils/plugins/plugin_base.py | sma-de/ansible-collections-base | 0 | 12781828 | <filename>plugins/module_utils/plugins/plugin_base.py
#!/usr/bin/env python
# TODO: copyright, owner license
#
"""
TODO module / file doc string
"""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import abc
import collections
import copy
import re
from ansible.errors impor... | 2.21875 | 2 |
lib/models/mixformer/__init__.py | SangbumChoi/MixFormer | 103 | 12781829 | from .mixformer import build_mixformer
from .mixformer_online import build_mixformer_online_score | 1 | 1 |
examples/cpu_usage/models.py | reesezxf/infi.clickhouse_orm | 3 | 12781830 | <filename>examples/cpu_usage/models.py
from infi.clickhouse_orm import Model, DateTimeField, UInt16Field, Float32Field, Memory
class CPUStats(Model):
timestamp = DateTimeField()
cpu_id = UInt16Field()
cpu_percent = Float32Field()
engine = Memory()
| 1.984375 | 2 |
mappgene/subscripts/ivar.py | aavilaherrera/mappgene | 7 | 12781831 | #!/usr/bin/env python3
import os,sys,glob,multiprocessing,time,csv,math,pprint
from parsl.app.app import python_app
from os.path import *
from mappgene.subscripts import *
@python_app(executors=['worker'])
def run_ivar(params):
subject_dir = params['work_dir']
subject = basename(subject_dir)
input_reads =... | 2.15625 | 2 |
pypadb/decorator/select.py | ChenzDNA/pypadb | 1 | 12781832 | <gh_stars>1-10
import functools
from types import GenericAlias
from typing import Callable, Any
from ..connection_pool import cursor_type, connection
from ..exception import RequireReturnTypeAnnotation
from ..utils import inspect_util
def select(sql: str, data_type: Any) -> Callable:
def deco(fun: Callable):
... | 2.375 | 2 |
simulation/utilities/util.py | 0xDBFB7/ionprinter | 0 | 12781833 | import math
import unittest
epsilon = 8.85*(10**-12.0) #vacuum permittivity
def electron_charge():
return 1.602*10**-19
def scharge_efield(beam_current,beam_velocity,beam_radius,sample_radius=None):
"""Calculate the electric field at the edge of a beam
Eq. 44 at https://arxiv.org/pdf/1401.3951.pdf
re... | 2.8125 | 3 |
Markov.py | timestocome/AliceInWonderland | 0 | 12781834 |
# http://github.com/timestocome/
# build a markov chain and use it to predict Alice In Wonderland/Through the Looking Glass text
import numpy as np
import pickle
from collections import Counter
import markovify # https://github.com/jsvine/markovify
################################################################... | 3.640625 | 4 |
test/schema.py | fanngyuan/vitess | 0 | 12781835 | #!/usr/bin/python
import os
import socket
import utils
import tablet
shard_0_master = tablet.Tablet()
shard_0_replica1 = tablet.Tablet()
shard_0_replica2 = tablet.Tablet()
shard_0_rdonly = tablet.Tablet()
shard_0_backup = tablet.Tablet()
shard_1_master = tablet.Tablet()
shard_1_replica1 = tablet.Tablet()
def setup... | 2.09375 | 2 |
keskiarvo_vs_mediaani/Python/keskiarvo_vs_mediaani.py | samuntiede/valokuvamatikka | 0 | 12781836 | # Kokeillaan mediaanin ja keskiarvon eroa. Kuvissa (30kpl) on oppilaita
# satunnaisissa kohdissa, ja kamera oli jalustalla luokkahuoneessa. Otetaan
# toisaalta keskiarvot ja toisaalta mediaanit pikseliarvoista.
# Lopputulokset ovat hyvin erilaiset!
#
# <NAME> huhtikuu 2021
# Matlab -> Python Ville Tilvis kesäkuu 2021
... | 2.890625 | 3 |
src/arghgreet.py | CaptSolo/LU_PySem_2020_1 | 1 | 12781837 | <filename>src/arghgreet.py
import argh
def main(name="Valdis", count=3):
"""
Printing a greeting message
For our friends
"""
for _ in range(count):
print(f'Hello {name}')
return None
if __name__ == "__main__":
argh.dispatch_command(main)
| 3.171875 | 3 |
examples/acreps/pendulum_cart.py | hanyas/reps | 8 | 12781838 | import numpy as np
import gym
from reps.acreps import acREPS
np.random.seed(1337)
env = gym.make('Pendulum-RL-v1')
env._max_episode_steps = 250
env.unwrapped.dt = 0.05
env.unwrapped.sigma = 1e-4
# env.seed(1337)
acreps = acREPS(env=env, kl_bound=0.1, discount=0.985, lmbda=0.95,
scale=[1., 1., 8.0, 2... | 2.125 | 2 |
agent_sched/packages/schedMain.py | mishahmadian/HPC_Provenance | 0 | 12781839 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
The main Module that keeps listening for any incoming RPC calls in order to
run the appropreate method to respond to the RPC request.
<NAME> (<EMAIL>)
"""
from subprocess import run, CalledProcessError, DEVNULL
from schedConfig import SchedConfig, ConfigReadExcetion
fro... | 2.234375 | 2 |
surveillance/stats.py | bkmeneguello/surveillance | 1 | 12781840 | <reponame>bkmeneguello/surveillance
import os
import statsd
client = statsd.StatsClient(prefix='surveillance',
host=os.environ.get('STATSD_HOST', 'localhost'),
port=int(os.environ.get('STATSD_PORT', 8125)),
maxudpsize=int(os.environ.g... | 2.203125 | 2 |
tests/loading.py | ecoinvent/bw_processing | 1 | 12781841 | <reponame>ecoinvent/bw_processing
# from bw_processing.loading import load_bytes
# from bw_processing import create_package
# from io import BytesIO
# from pathlib import Path
# import json
# import numpy as np
# import tempfile
# def test_load_package_in_directory():
# with tempfile.TemporaryDirectory() as td:
#... | 2.25 | 2 |
momentproblems/intersections.py | mwageringel/momentproblems | 0 | 12781842 | from sage.all import RDF, CDF, matrix, prod
import scipy.linalg
import numpy as np
def column_space_intersection(*As, tol, orthonormal=False):
r"""
Return a matrix with orthonormal columns spanning the intersection of the
column spaces of the given matrices.
INPUT:
- ``*As`` -- matrices with a fi... | 3.0625 | 3 |
settings/__init__.py | SublimeText/InactivePanes | 28 | 12781843 | <gh_stars>10-100
"""Provides a settings abstraction class.
Exported classes:
* Settings
"""
class Settings(object):
"""ST settings abstraction that helps with default values and running a callback when changed.
The main purpose is to always provide the correct value of a setting or a default,
if se... | 2.84375 | 3 |
setup.py | mikiec84/pyneurovault_upload | 1 | 12781844 | try:
from setuptools.core import setup
except ImportError:
from distutils.core import setup
__version__ = '0.1.0'
setup(
name='pyneurovault_upload',
version='0.1.0',
author='<NAME>',
author_email='<EMAIL>',
url='https://github.com/ljchang/pyneurovault_upload',
packages=['pyneurovault_u... | 1.398438 | 1 |
texttractor/__init__.py | walkr/texttractor | 0 | 12781845 | <filename>texttractor/__init__.py
# -*- coding: utf-8 -*-
from .core import TextTractor
from .core import TextCleaner
__author__ = '<NAME>'
__email__ = '<EMAIL>'
__version__ = '0.0.1'
__all__ = ['TextTractor', 'TextCleaner']
| 1.1875 | 1 |
authentik/stages/user_write/api.py | BeryJu/passbook | 15 | 12781846 | """User Write Stage API Views"""
from rest_framework.viewsets import ModelViewSet
from authentik.core.api.used_by import UsedByMixin
from authentik.flows.api.stages import StageSerializer
from authentik.stages.user_write.models import UserWriteStage
class UserWriteStageSerializer(StageSerializer):
"""UserWriteSt... | 2.21875 | 2 |
shadow/static.py | f1uzz/shadow | 1 | 12781847 | <gh_stars>1-10
from itertools import chain
from enum import Enum
from shadow.models import Queue, QueueList, Role, RoleList, Shard, ShardList, Ability, AbilityList
# queue types
QUEUES = QueueList(queues=[
Queue(
lcu_queue_name="Summoner's Rift",
ugg_queue_name="ranked_solo_5x5",
rank="pl... | 2.046875 | 2 |
Lipniacki2004/plot_func.py | okadalabipr/cancer_signaling | 1 | 12781848 | <reponame>okadalabipr/cancer_signaling
from matplotlib import pyplot as plt
def timecourse(sim):
plt.figure(figsize=(16,13))
plt.rcParams['font.family'] = 'Arial'
plt.rcParams['font.size'] = 15
plt.rcParams['axes.linewidth'] = 1
plt.rcParams['lines.linewidth'] = 1.5
plt.subplots_adjust(wspace=... | 2.234375 | 2 |
interpretation/deepseismic_interpretation/dutchf3/tests/test_dataloaders.py | elmajdma/seismic-deeplearning | 270 | 12781849 | <filename>interpretation/deepseismic_interpretation/dutchf3/tests/test_dataloaders.py<gh_stars>100-1000
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
"""
Tests for TrainLoader and TestLoader classes when overriding the file names of the seismic and label data.
"""
import... | 2.078125 | 2 |
preprocess_optimized.py | OEMarshall/REU2016-Supervised-Experiments | 0 | 12781850 | import numpy
import sys
import pickle
f = open("kddcup.names","r")
counter = 1
labels = {}; features = {}
for line in f:
line = line.strip() #get rid of period at end
if counter == 1:
s = line.split(",") #split first line on comma
for label in s:
labels[label] = 0 #each CSV in first line is label, add to
... | 2.546875 | 3 |