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 |
|---|---|---|---|---|---|---|
src/py_scripts/fc_phasing.py | pb-jchin/FALCON_unzip | 2 | 7300 | <filename>src/py_scripts/fc_phasing.py
from pypeflow.common import *
from pypeflow.data import PypeLocalFile, makePypeLocalFile, fn
from pypeflow.task import PypeTask, PypeThreadTaskBase, PypeTaskBase
from pypeflow.controller import PypeWorkflow, PypeThreadWorkflow
from falcon_kit.FastaReader import FastaReader
import... | 2.046875 | 2 |
augmentation/combineds/wgan_gp_straight.py | pabloduque0/cnn_deconv_viz | 0 | 7301 | <reponame>pabloduque0/cnn_deconv_viz<gh_stars>0
from keras.datasets import mnist
from keras.layers.merge import _Merge
from keras.layers import Input, Dense, Reshape, Flatten, Dropout
from keras.layers import BatchNormalization, Activation, ZeroPadding2D
from keras.layers.advanced_activations import LeakyReLU
from kera... | 2.21875 | 2 |
Core/Block_C/RC480_Factory.py | BernardoB95/Extrator_SPEDFiscal | 1 | 7302 | <filename>Core/Block_C/RC480_Factory.py
from Core.IFactory import IFactory
from Regs.Block_C import RC480
class RC480Factory(IFactory):
def create_block_object(self, line):
self.rc480 = _rc480 = RC480()
_rc480.reg_list = line
return _rc480
| 2.234375 | 2 |
keras2onnx/proto/__init__.py | mgoldchild/keras-onnx | 0 | 7303 | ###############################################################################
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
###############################################################################
imp... | 1.984375 | 2 |
tests/test_load.py | ocefpaf/xroms | 4 | 7304 | '''Test package.'''
import xroms
from glob import glob
import os
def test_open_netcdf():
'''Test xroms.open_netcdf().'''
base = os.path.join(xroms.__path__[0],'..','tests','input')
files = glob('%s/ocean_his_000?.nc' % base)
ds = xroms.open_netcdf(files)
assert ds
def test_open_zar... | 2.234375 | 2 |
demoproject/demoproject/urls.py | alvnary18/django-nvd3 | 302 | 7305 | from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.home, name='home'),
url(r'^piechart/', views.demo_piechart, name='demo_piechart'),
url(r'^linechart/', views.demo_linechart, name='demo_linechart'),
url(r'^linechart_without_date/', views.demo_linechart_without_date,... | 1.546875 | 2 |
wired_version/mcs_wired.py | Harri-Renney/Mind_Control_Synth | 1 | 7306 | <filename>wired_version/mcs_wired.py
import time
import mido
from pinaps.piNapsController import PiNapsController
from NeuroParser import NeuroParser
"""
Equation of motion used to modify virbato.
"""
def positionStep(pos, vel, acc):
return pos + vel * 2 + (1/2) * acc * 4
def velocityStep(vel, acc):... | 2.90625 | 3 |
pipeline/visualization/single_tab.py | windblood/kafka_stock | 45 | 7307 | <gh_stars>10-100
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 31 11:47:47 2019
@author: yanyanyu
"""
"""
Tab1-plot1: candlestick
"""
import json
import datetime
import pandas as pd
from math import pi
from random import choice
from pytz import timezone
from bokeh.plotting import figure,... | 2.203125 | 2 |
traffic_predict/model.py | Wangjw6/project | 0 | 7308 | # -*- coding:utf-8 -*-
import tensorflow as tf
class CNN:
def __init__(self, save_or_load_path=None, trainable=True, learning_rate = 0.00002,timestep=9,road=189,predstep=1):
self.trainable = trainable
self.learning_rate = learning_rate
self.road = road
self.input_size = timestep *... | 2.796875 | 3 |
VirtualMouse-mediapipe.py | SanLiWuXun/Virtual-Control | 0 | 7309 | import cv2
import mediapipe as mp
from time import sleep
import numpy as np
import autopy
import pynput
wCam, hCam = 1280, 720
wScr, hScr = autopy.screen.size()
cap = cv2.VideoCapture(0)
cap.set(3, wCam)
cap.set(4, hCam)
mp_drawing = mp.solutions.drawing_utils
mp_hands = mp.solutions.hands
mouse = pynput.mouse.Cont... | 2.59375 | 3 |
util/tools/split_train_val.py | JochenZoellner/tf_neiss-1 | 0 | 7310 | <gh_stars>0
import glob
import logging
import os
import shutil
import sys
"""script to divide a folder with generated/training data into a train and val folder
- val folder contains 500 Samples if not changed in source code
- DOES NOT work if images structured in subfolders, see below
- if there is no dir ... | 2.625 | 3 |
Chapter10/neuroevolution/distributed_helpers.py | KonstantinKlepikov/Hands-on-Neuroevolution-with-Python | 51 | 7311 |
import threading
from queue import Queue
from multiprocessing.pool import ApplyResult
import tabular_logger as tlogger
class AsyncWorker(object):
@property
def concurrent_tasks(self):
raise NotImplementedError()
def run_async(self, task_id, task, callback):
raise NotImplementedError()
... | 2.625 | 3 |
make/platform/registry.py | tompis/casual | 0 | 7312 | <gh_stars>0
import os
registry = {}
class RegisterPlatform(object):
'''
classdocs
'''
def __init__(self, platform):
'''
Constructor
'''
self.platform = platform
def __call__(self, clazz):
registry[self.platform] = clazz
def platform():
# D... | 3.046875 | 3 |
mailer/admin.py | everyvoter/everyvoter | 5 | 7313 | """Django Admin Panels for App"""
from django.contrib import admin
from mailer import models
@admin.register(models.SendingAddress)
class SendingAddressAdmin(admin.ModelAdmin):
"""Admin View for SendingAddress"""
list_display = ('address', 'organization')
list_filter = ('organization__name',)
actions ... | 2.4375 | 2 |
tests/settings.py | systemallica/django-belt | 2 | 7314 | DEBUG = True
USE_TZ = True
SECRET_KEY = "dummy"
DATABASES = {"default": {"ENGINE": "django.db.backends.sqlite3", "NAME": ":memory:"}}
INSTALLED_APPS = [
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sites",
"rest_framework",
"django_filters",
"belt",
"tests.app",
]... | 1.359375 | 1 |
Cell_Generation/fabric_CMC_NMOS.py | ALIGN-analoglayout/2018-01-ALIGN | 8 | 7315 | <gh_stars>1-10
import sys
import json
import transformation
class StopPointGrid:
def __init__( self, nm, layer, direction, width, pitch, offset=0):
self.nm = nm
self.layer = layer
self.direction = direction
assert direction in ['v','h']
self.width = width
self.pitch ... | 2.453125 | 2 |
docs/testcases/all_in_one.py | tiramtaramta/conduit | 0 | 7316 | from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
import os
import time
import csv
from webdriver_manager.chrome import ChromeDriverManager
import math
from basic_function import ... | 2.78125 | 3 |
config.py | amalshaji/python-playground | 14 | 7317 | from pydantic import BaseSettings
class Settings(BaseSettings):
deta_project_key: str
settings = Settings()
| 1.671875 | 2 |
IV_semester/os/configs.py | dainiusjocas/labs | 1 | 7318 | #!/usr/bin/env python
''' This module provides configuration options for OS project. No more magic numbers! '''
BLOCK_SIZE = 16 # words
WORD_SIZE = 4 # bytes
# length od RS in blocks
RESTRICTED_LENGTH = 1
# length of DS in blocks
DS_LENGTH = 6
# timer value
TIMER_VALUE = 10
# buffer size
BUFFER_SIZE = 16
# num... | 1.703125 | 2 |
roboticstoolbox/models/URDF/Puma560.py | Russ76/robotics-toolbox-python | 0 | 7319 | <reponame>Russ76/robotics-toolbox-python
#!/usr/bin/env python
import numpy as np
from roboticstoolbox.robot.ERobot import ERobot
from math import pi
class Puma560(ERobot):
"""
Class that imports a Puma 560 URDF model
``Puma560()`` is a class which imports a Unimation Puma560 robot definition
from a... | 2.828125 | 3 |
functest/tests/unit/odl/test_odl.py | hashnfv/hashnfv-functest | 0 | 7320 | <gh_stars>0
#!/usr/bin/env python
# Copyright (c) 2016 Orange and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
... | 2.140625 | 2 |
ntpclients/ntptrace.py | OptimalRanging/NTPsec | 0 | 7321 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
ntptrace - trace peers of an NTP server
Usage: ntptrace [-n | --numeric] [-m number | --max-hosts=number]
[-r hostname | --host=hostname] [--help | --more-help]
hostname
See the manual page for details.
"""
# SPDX-License-Id... | 2.53125 | 3 |
lbrynet/wallet/server/block_processor.py | abueide/lbry | 0 | 7322 | import struct
import msgpack
from lbrynet.wallet.transaction import Transaction, Output
from torba.server.hash import hash_to_hex_str
from torba.server.block_processor import BlockProcessor
from lbrynet.schema.claim import Claim
from lbrynet.wallet.server.model import ClaimInfo
class LBRYBlockProcessor(BlockProce... | 1.953125 | 2 |
ProjectEuler.Problem.013.py | jihunroh/ProjectEuler-Python | 0 | 7323 | from ProjectEulerCommons.Base import *
numbers_list = """37107287533902102798797998220837590246510135740250
46376937677490009712648124896970078050417018260538
74324986199524741059474233309513058123726617309629
91942213363574161572522430563301811072406154908250
23067588207539346171171980310421047513778063246676
8926167... | 1.171875 | 1 |
api/app/endpoints/datasets.py | historeno/enermaps | 0 | 7324 | <reponame>historeno/enermaps<gh_stars>0
"""Endpoint for the manipulation of datasets
"""
import hashlib
from flask import Response
from flask_restx import Namespace, Resource, abort
from app.common import client
from app.common import datasets as datasets_fcts
from app.common import path
api = Namespace("datasets",... | 2.390625 | 2 |
python/p45.py | forewing/lc | 0 | 7325 | <filename>python/p45.py
class Solution:
def jump(self, nums: List[int]) -> int:
n = len(nums)
dp = [float('inf')] * n
dp[0] = 0
tail = 1
for i in range(n):
limit = min(n, i + nums[i] + 1)
for j in range(tail, limit):
dp[j] = min(dp[j],... | 3.109375 | 3 |
mlgorithms/knn/__init__.py | doycode/mlgorithms | 9 | 7326 | from .knn import KNNClassifier
__all__ = ['KNNClassifier'] | 1.0625 | 1 |
apps/configuration/fields.py | sotkonstantinidis/testcircle | 3 | 7327 | <filename>apps/configuration/fields.py
import unicodedata
from django.forms import fields
class XMLCompatCharField(fields.CharField):
"""
Strip 'control characters', as XML 1.0 does not allow them and the API may
return data in XML.
"""
def to_python(self, value):
value = super().to_pyth... | 2.3125 | 2 |
ademo.py | erikdelange/MicroPython-HTTP-Server | 0 | 7328 | import sys
import time
import uasyncio as asyncio
from ahttpserver import sendfile, Server
app = Server()
@app.route("GET", "/")
async def root(reader, writer, request):
writer.write(b"HTTP/1.1 200 OK\r\n")
writer.write(b"Connection: close\r\n")
writer.write(b"Content-Type: text/html\r\n")
... | 2.859375 | 3 |
models/audio_net.py | vipulSharma18/Deep-Self-Supervised-Audio-Video-Cosegmentation-with-Adaptive-Noise-Cancellation | 0 | 7329 | import torch
import torch.nn as nn
import torch.nn.functional as F
class Unet(nn.Module):
def __init__(self, fc_dim=64, num_downs=5, ngf=64, use_dropout=False):
super(Unet, self).__init__()
# construct unet structure
unet_block = UnetBlock(
ngf * 8, ngf * 8, input_n... | 2.515625 | 3 |
tests/test_core.py | cnschema/kgtool | 7 | 7330 | <reponame>cnschema/kgtool
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Path hack
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
try:
import unittest2 as unittest
except ImportError:
import unittest
from kgtool.core import * # noqa
class CoreTestCase(unittest.TestCase):
def setUp(self... | 2.390625 | 2 |
ui/Rhino/AGS/dev/AGS_toolbar_display_cmd.py | ricardoavelino/compas_ags | 1 | 7331 | from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import scriptcontext as sc
import compas_rhino
from compas_ags.rhino import SettingsForm
from compas_ags.rhino import FormObject
from compas_ags.rhino import ForceObject
__commandname__ = "AGS_toolbar_displa... | 1.914063 | 2 |
lpp/evaluator.py | VidoniJorge/c-interprete | 0 | 7332 | from typing import (
Any,
cast,
List,
Optional,
Type
)
import lpp.ast as ast
from lpp.builtins import BUILTINS
from lpp.object import(
Boolean,
Builtin,
Environment,
Error,
Function,
Integer,
Null,
Object,
ObjectType,
String,
Return
)
TRUE = Boolean(True... | 2.921875 | 3 |
cli/tests/pcluster/config/test_validators.py | QPC-database/aws-parallelcluster | 1 | 7333 | # Copyright 2019 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "LICENSE.txt" file accom... | 1.453125 | 1 |
flask_app.py | takamatsu-shyo/yolo-microservice | 0 | 7334 | <filename>flask_app.py
from flask import Flask
from flask import request
from flask import Response
from resources import resourcePing, resourceResolution
from message_protocol.resolution_input import parseResolutionInput
import json
app = Flask(__name__)
@app.route('/ping', methods=['GET'])
def ping():
output = ... | 2.828125 | 3 |
backend/server/server/wsgi.py | Stinger101/my_uno_ml_service | 0 | 7335 | <gh_stars>0
"""
WSGI config for server project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('D... | 1.929688 | 2 |
pycbc/config.py | mchestr/pycbc | 0 | 7336 | import os
from functools import reduce
import boto3
import yaml
from copy import deepcopy
from cryptography.fernet import Fernet
from pycbc import json
from pycbc.utils import AttrDict as d
s3 = boto3.client('s3')
_mapping_tag = yaml.resolver.BaseResolver.DEFAULT_MAPPING_TAG
_DEFAULTS = d({
'users': [],
'enc... | 1.882813 | 2 |
models/toolscontext/errorhandler.py | vinirossa/password_generator_test | 2 | 7337 | <gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
""" Module Name
Description...
"""
__author__ = "<NAME>"
__copyright__ = "Copyright 2021, <NAME>"
__credits__ = ["<NAME>","etc."]
__date__ = "2021/04/12"
__license__ = "GPL"
__version__ = "1.0.0"
__pythonversion__ = "3.9.1"
__maintainer__ = "<NAME>"
... | 2.640625 | 3 |
05-Intro-to-SpaCy/scripts/choropleth.py | henchc/Rediscovering-Text-as-Data | 15 | 7338 | def us_choropleth(t):
import matplotlib.cm
from matplotlib.patches import Polygon
from matplotlib.collections import PatchCollection
from matplotlib.colors import Normalize
import shapefile
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
import numpy as np
im... | 3.015625 | 3 |
take_day_and_night_pictures.py | ntmoore/skycamera | 0 | 7339 | <reponame>ntmoore/skycamera
import time
import os
#parameters
sunset_hr=8
dawn_hr=7
daytime_period_min=60
nighttime_period_min=1
time.localtime()
print("program starts at ",time.localtime());
while(1):
#Is it day or night?
time.localtime()
hour = time.localtime()[3]
minute = time.localtime()[4]
... | 3.265625 | 3 |
pytm/__init__.py | jeremyng123/pytm | 0 | 7340 | __all__ = ['Element', 'Server', 'ExternalEntity', 'Datastore', 'Actor', 'Process', 'SetOfProcesses', 'Dataflow', 'Boundary', 'TM', 'Action', 'Lambda', 'Threat']
from .pytm import Element, Server, ExternalEntity, Dataflow, Datastore, Actor, Process, SetOfProcesses, Boundary, TM, Action, Lambda, Threat
| 1.414063 | 1 |
malchive/utilities/comguidtoyara.py | 6un9-h0-Dan/malchive | 59 | 7341 | <filename>malchive/utilities/comguidtoyara.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright(c) 2021 The MITRE Corporation. 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 ... | 2.25 | 2 |
examples/voc2007_extract.py | sis0truk/pretrained-models.pytorch | 91 | 7342 | import os
import argparse
from tqdm import tqdm
import torch
from torch.autograd import Variable
from torch.utils import model_zoo
# http://scikit-learn.org
from sklearn.metrics import accuracy_score
from sklearn.metrics import average_precision_score
from sklearn.svm import LinearSVC
from sklearn.svm import SVC
imp... | 2.171875 | 2 |
main.py | tani-cat/point_maximizer | 1 | 7343 | import csv
import os
from collections import deque
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
INPUT_PATH = os.path.join(BASE_DIR, 'goods_source.csv')
OUTPUT_PATH = os.path.join(BASE_DIR, 'result.csv')
FILE_ENCODE = 'shift_jis'
INPUT_COLS = ('id', 'goods_name', 'price')
def import_csv():
"""入力データの読み込... | 3.09375 | 3 |
src/gui/tcltk/tcl/tests/langbench/proc.py | gspu/bitkeeper | 342 | 7344 | <reponame>gspu/bitkeeper<filename>src/gui/tcltk/tcl/tests/langbench/proc.py
#!/usr/bin/python
def a(val):
return b(val)
def b(val):
return c(val)
def c(val):
return d(val)
def d(val):
return e(val)
def e(val):
return f(val)
def f(val):
return g(val, 2)
def g(v1, v2):
return h(v1, v2, 3)
def h(v1, v2, v3):
r... | 2.515625 | 3 |
src/metrics.py | dmitryrubtsov/Recommender-systems | 0 | 7345 | import pandas as pd
import numpy as np
import swifter
def money_precision_at_k(y_pred: pd.Series, y_true: pd.Series, item_price, k=5):
y_pred = y_pred.swifter.progress_bar(False).apply(pd.Series)
user_filter = ~(y_true.swifter.progress_bar(False).apply(len) < k)
y_pred = y_pred.loc[user_filter]
y_tru... | 2.421875 | 2 |
diff_r_b.py | upupming/dragon | 1 | 7346 | <gh_stars>1-10
import numpy as np
size = 9
percentage_max = 0.08
xis = np.linspace(0.1 * (1-percentage_max), 0.1 * (1+percentage_max), size)
E_n = [
85219342462.9973,
85219254693.4412,
85219173007.4296,
85219096895.7433,
85219025899.6604,
85218959605.1170,
85218897637.6421,
85218839657.9502,
85218785358.0968... | 2.234375 | 2 |
src/run.py | rhiga2/mturk-tsep-test | 38 | 7347 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from caqe import app
app.run(debug=True, threaded=True) | 1.054688 | 1 |
src/main/python/hydra/lib/cli.py | bopopescu/hydra | 10 | 7348 | <gh_stars>1-10
"""hydra cli.
Usage:
hydra cli ls slaves
hydra cli ls apps
hydra cli ls task <app>
hydra cli [force] stop <app>
hydra cli scale <app> <scale>
hydra cli (-h | --help)
hydra cli --version
Options:
-h --help Show this screen.
--version Show version.
"""
__author__ = 'sushil'
... | 1.945313 | 2 |
azure-devops/azext_devops/test/common/test_format.py | doggy8088/azure-devops-cli-extension | 326 | 7349 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | 2.390625 | 2 |
github/GitReleaseAsset.py | aantr/WindowsHostManager | 1 | 7350 | <gh_stars>1-10
############################ Copyrights and license ############################
# #
# Copyright 2017 <NAME> <<EMAIL>> #
# Copyright 2017 Simon <<EMAIL>> #
# Copyright 2018 <NAME> <... | 1.789063 | 2 |
tests/test_remote.py | epenet/samsung-tv-ws-api | 0 | 7351 | <gh_stars>0
"""Tests for remote module."""
from unittest.mock import Mock, call, patch
from samsungtvws.remote import SamsungTVWS
def test_send_key(connection: Mock) -> None:
"""Ensure simple data can be parsed."""
open_response = (
'{"data": {"token": <PASSWORD>}, "event": "ms.channel.connect", "fro... | 2.390625 | 2 |
src/utils/pythonSrc/watchFaceParser/models/elements/battery/batteryGaugeElement.py | chm-dev/amazfitGTSwatchfaceBundle | 49 | 7352 | import logging
from watchFaceParser.models.elements.common.imageSetElement import ImageSetElement
class BatteryGaugeElement(ImageSetElement):
def __init__(self, parameter, parent, name = None):
super(BatteryGaugeElement, self).__init__(parameter = parameter, parent = parent, name = name)
def draw3(s... | 2.171875 | 2 |
indicoio/utils/__init__.py | JoseRoman/IndicoIo-python | 1 | 7353 | import inspect
import numpy as np
class TypeCheck(object):
"""
Decorator that performs a typecheck on the input to a function
"""
def __init__(self, accepted_structures, arg_name):
"""
When initialized, include list of accepted datatypes and the
arg_name to enforce the check on.... | 3.171875 | 3 |
openprocurement/tender/openuadefense/tests/tender.py | ProzorroUKR/openprocurement.tender.openuadefense | 0 | 7354 | # -*- coding: utf-8 -*-
import unittest
from openprocurement.api.tests.base import snitch
from openprocurement.api.tests.base import BaseWebTest
from openprocurement.tender.belowthreshold.tests.base import test_lots
from openprocurement.tender.belowthreshold.tests.tender import TenderResourceTestMixin
from openprocur... | 2.078125 | 2 |
fabry/tools/file_io.py | jmilhone/fabry_perot | 1 | 7355 | from __future__ import print_function, division
import os
import numpy as np
import h5py
def dict_2_h5(fname, dic, append=False):
'''Writes a dictionary to a hdf5 file with given filename
It will use lzf compression for all numpy arrays
Args:
fname (str): filename to write to
dic (dic... | 2.90625 | 3 |
derivadas.py | lucaspompeun/metodos-matematicos-aplicados-nas-engenharias-via-sistemas-computacionais | 16 | 7356 | <reponame>lucaspompeun/metodos-matematicos-aplicados-nas-engenharias-via-sistemas-computacionais
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 23 21:57:48 2019
INSTITUTO FEDERAL DE EDUCAÇÃO, CIÊNCIA E TECNOLOGIA DO PÁRA - IFPA ANANINDEUA
@author:
Prof. Dr. <NAME>
Discentes:
... | 3.640625 | 4 |
trapping_rain_water/solution.py | haotianzhu/C_Questions_Solutions | 0 | 7357 | <gh_stars>0
class Solution:
def trap(self, height):
"""
:type height: List[int]
:rtype: int
"""
if not height:
return 0
left = 0
right = len(height)-1
total_area = 0
if height[left] <= height[right]:
m = left
else:
m =right
while(left < right):
if height[left] <= height[right]:
... | 3.8125 | 4 |
ABC/178/D.py | yu9824/AtCoder | 0 | 7358 | <gh_stars>0
# list(map(int, input().split()))
# int(input())
import sys
sys.setrecursionlimit(10 ** 9)
'''
DP
A[n] = A[n-3] + A[n-4] + ... + A[0] (O(S**2))
ここで,A[n-1] = A[n-4] + A[n-5] + ... + A[0]より,
A[n] = A[n-3] + A[n-1]とも表せる.(O(S)でより高速.)
'''
mod = 10 ** 9 + 7
def main(*args):
S = args[0]
A = [0 for s in... | 2.5625 | 3 |
contrib/analysis_server/src/analysis_server/factory.py | OzanCKN/OpenMDAO-Framework | 1 | 7359 | from openmdao.main.factory import Factory
from analysis_server import client, proxy, server
class ASFactory(Factory):
"""
Factory for components running under an AnalysisServer.
An instance would typically be passed to
:meth:`openmdao.main.factorymanager.register_class_factory`.
host: string
... | 2.78125 | 3 |
web/migrations/0007_auto_20180824_0925.py | zinaukarenku/zkr-platform | 2 | 7360 | <filename>web/migrations/0007_auto_20180824_0925.py<gh_stars>1-10
# Generated by Django 2.1 on 2018-08-24 09:25
from django.db import migrations, models
import web.models
class Migration(migrations.Migration):
dependencies = [
('web', '0006_organizationmember_user'),
]
operations = [
mi... | 1.289063 | 1 |
antlir/bzl/image_actions/tarball.bzl | SaurabhAgarwala/antlir | 0 | 7361 | <filename>antlir/bzl/image_actions/tarball.bzl
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
load("//antlir/bzl:maybe_export_file.bzl", "maybe_export_file")
load("//antlir/bzl:shape.bzl", ... | 2.34375 | 2 |
sqlmat/utils.py | haobtc/sqlmat | 0 | 7362 | from typing import Tuple, List, Optional
import json
import sys
import os
import shlex
import asyncio
import argparse
import logging
import tempfile
from urllib.parse import urlparse
logger = logging.getLogger(__name__)
def find_sqlmat_json() -> Optional[dict]:
json_path = os.getenv('SQLMAT_JSON_PATH')
if jso... | 2.5 | 2 |
submit.py | young-geng/UVaClient | 2 | 7363 | import requests
from sys import stderr
import re
def submit(session, problem_id, language, source):
language_code = {
'c': 1,
'java': 2,
'c++': 3,
'pascal': 4,
'c++11': 5
}
url = "http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=25&page=save_submission"
data = {
'problemid': '',
... | 2.5625 | 3 |
FIGURE4/eddymoc_scripts/noresm_cesm_eddymoc_150yrs.py | adagj/ECS_SOconvection | 1 | 7364 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: <NAME>
year: 2019 - 2021
This script is used to calculate the eddy-induced overturning in CESM2 and NorESM2 (LM and MM) south of 50S
for the CMIP experiments piControl and abrupt-4xCO2 after 150
the average time is 30 years
The result is used in FIGURE 4
"""
... | 2.09375 | 2 |
wings/planner.py | KnowledgeCaptureAndDiscovery/wings-client | 0 | 7365 | <filename>wings/planner.py
import json
import re
class Planner(object):
def __init__(self, api_client):
self.api_client = api_client
def set_template(self, template):
self.wflowns = self.api_client.get_export_url() + "workflows/" + template + ".owl#"
self.wflowid = self.wflowns + tem... | 2.625 | 3 |
eggs/ZConfig-3.0.4-py2.7.egg/ZConfig/tests/test_cookbook.py | salayhin/talkofacta | 0 | 7366 | ##############################################################################
#
# Copyright (c) 2004 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... | 2.515625 | 3 |
src/bullet_point/migrations/0006_bulletpoint_sift_risk_score.py | ResearchHub/ResearchHub-Backend-Open | 18 | 7367 | # Generated by Django 2.2 on 2020-11-07 01:03
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bullet_point', '0005_bulletpoint_created_location'),
]
operations = [
migrations.AddField(
model_name='bulletpoint',
n... | 1.46875 | 1 |
main.py | ezhkovskii/instagrapi-rest | 0 | 7368 | import pkg_resources
from fastapi import FastAPI
from fastapi.openapi.utils import get_openapi
from starlette.responses import RedirectResponse, JSONResponse
from routers import auth, media, video, photo, user, igtv, clip, album, story, hashtag, direct
app = FastAPI()
app.include_router(auth.router)
app.include_route... | 2.203125 | 2 |
scripts/run_d435.py | suet-lee/mycelium | 6 | 7369 | <reponame>suet-lee/mycelium
#!/usr/bin/env python3
from mycelium import CameraD435
from mycelium_utils import Scripter
class ScripterExt(Scripter):
def run_main(self):
self.camera = CameraD435(
configuration_mode=self.cfg.d435['configuration_mode'],
enable_rgb_stream=self.cfg.d435... | 2.0625 | 2 |
examples/system/miniscreen/miniscreen_display_animated_image_once_simple_way.py | pi-top/pi-top-Python-SDK | 28 | 7370 | <reponame>pi-top/pi-top-Python-SDK
from PIL import Image
from pitop import Pitop
pitop = Pitop()
miniscreen = pitop.miniscreen
rocket = Image.open("/usr/lib/python3/dist-packages/pitop/miniscreen/images/rocket.gif")
miniscreen.play_animated_image(rocket)
| 2.203125 | 2 |
synbioinformatica.py | nemami/synbioinformatica | 0 | 7371 | <gh_stars>0
#!/usr/bin/python -tt
import sys, re, math
from decimal import *
# TODO: work on naming scheme
# TODO: add more ORIs
# TODO: assemblytree alignment
# TODO: Wobble, SOEing
# TODO: (digestion, ligation) redundant products
# TODO: for PCR and Sequencing, renormalize based on LCS
# TODO: tutorials
dna_alphab... | 2.515625 | 3 |
scriptd/app/flask_helper.py | jasonszang/scriptd | 1 | 7372 | <gh_stars>1-10
# -*- coding: UTF-8 -*-
"""Helper for working with flask"""
import logging
from flask import Flask
from flask import request
from typing import Text
class FlaskHelper(object):
"""
Helper class for interacting with flask framework.
Improves testability by avoiding accessing flask global/thr... | 2.40625 | 2 |
evology/research/MCarloLongRuns/Exp1_WSvsReturn.py | aymericvie/evology | 0 | 7373 | # Imports
import numpy as np
import pandas as pd
import sys
import tqdm
import warnings
import time
import ternary
from ternary.helpers import simplex_iterator
import multiprocessing as mp
warnings.simplefilter("ignore")
if sys.platform == "darwin":
sys.path.append("/Users/aymericvie/Documents/GitHub/evology/evol... | 2.0625 | 2 |
ex039.py | vinisantos7/PythonExercicios | 2 | 7374 | print("@"*30)
print("Alistamento - Serviço Militar")
print("@"*30)
from datetime import date
ano_nasc = int(input("Digite seu ano de nascimento: "))
ano_atual = date.today().year
idade = ano_atual - ano_nasc
print(f"Quem nasceu em {ano_nasc} tem {idade} anos em {ano_atual}")
if idade == 18:
print("É a hora de se... | 4.125 | 4 |
test/python/spl/tk17/opt/.__splpy/packages/streamsx/topology/tester.py | Jaimie-Jin1/streamsx.topology | 31 | 7375 | # coding=utf-8
# Licensed Materials - Property of IBM
# Copyright IBM Corp. 2017
"""Testing support for streaming applications.
Allows testing of a streaming application by creation conditions
on streams that are expected to become valid during the processing.
`Tester` is designed to be used with Python's `unittest` ... | 2.90625 | 3 |
piglatin_microservice/views/main.py | Curly-Mo/piglatin | 0 | 7376 | <gh_stars>0
from flask import request, jsonify, Blueprint
from .. import piglatin
main = Blueprint('main', __name__)
@main.route('/', methods=['GET', 'POST'])
def index():
response = """
Please use the endpoint /translate to access this api.
Usage: "{}translate?text=Translate+this+text+into+Pi... | 2.953125 | 3 |
projects/pong-game/pong.py | sumanentc/Python-Projects | 0 | 7377 | <reponame>sumanentc/Python-Projects
from turtle import Screen
from paddle import Paddle
from ball import Ball
import time
from scoreboard import ScoreBoard
screen = Screen()
screen.bgcolor('black')
screen.setup(width=800, height=600)
screen.title('pong')
# Turn off animation to show paddle after it has been shifted
... | 3.671875 | 4 |
ExPy/ExPy/module20.py | brad-h/expy | 0 | 7378 | <filename>ExPy/ExPy/module20.py
""" Multistate Sales Tax Calculator """
import os
from decimal import Decimal
from decimal import InvalidOperation
def prompt_decimal(prompt):
""" Using the prompt, attempt to get a decimal from the user """
while True:
try:
return Decimal(input(prompt))
... | 4.03125 | 4 |
pyvdms/util/verify.py | psmsmets/pyVDMS | 1 | 7379 | <reponame>psmsmets/pyVDMS
r"""
:mod:`util.verify` -- Input verification
========================================
Common input verification methods.
"""
# Mandatory imports
import numpy as np
__all__ = ['verify_tuple_range']
def verify_tuple_range(
input_range: tuple, allow_none: bool = True, name: str = Non... | 2.890625 | 3 |
api/image_similarity.py | reneraab/librephotos | 0 | 7380 | import numpy as np
import requests
from django.db.models import Q
from api.models import Photo, User
from api.util import logger
from ownphotos.settings import IMAGE_SIMILARITY_SERVER
def search_similar_embedding(user, emb, result_count=100, threshold=27):
if type(user) == int:
user_id = user
else:
... | 2.390625 | 2 |
WEEKS/CD_Sata-Structures/_MISC/misc-examples/python3-book-examples/struct/struct_endianness.py | webdevhub42/Lambda | 0 | 7381 | <gh_stars>0
#
"""
"""
# end_pymotw_header
import struct
import binascii
values = (1, "ab".encode("utf-8"), 2.7)
print("Original values:", values)
endianness = [
("@", "native, native"),
("=", "native, standard"),
("<", "little-endian"),
(">", "big-endian"),
("!", "network"),
]
for code, name in... | 2.5625 | 3 |
pydov/util/net.py | GuillaumeVandekerckhove/pydov | 32 | 7382 | <filename>pydov/util/net.py
# -*- coding: utf-8 -*-
"""Module grouping network-related utilities and functions."""
from queue import Empty, Queue
from threading import Thread
import requests
import urllib3
from requests.adapters import HTTPAdapter
import pydov
request_timeout = 300
class TimeoutHTTPAdapter(HTTPAd... | 2.90625 | 3 |
app/main/views.py | yiunsr/flask_labstoo_base | 0 | 7383 | <reponame>yiunsr/flask_labstoo_base
from flask.helpers import make_response
from flask.templating import render_template
from . import main
@main.route('/', methods=['GET', 'POST'])
@main.route('/index', methods=['GET', 'POST'])
def index():
resp = make_response(
render_template('main/index.html'... | 1.96875 | 2 |
SBOL2Excel/utils/sbol2excel.py | abamaj/SBOL-to-Excel | 0 | 7384 | import sbol2
import pandas as pd
import os
import logging
from openpyxl import load_workbook
from openpyxl.worksheet.table import Table, TableStyleInfo
from openpyxl.utils.dataframe import dataframe_to_rows
from openpyxl.styles import Font, PatternFill, Border, Side
from requests_html import HTMLSession
#wasderivedfro... | 2.484375 | 2 |
ocean_lib/models/data_token.py | akshay-ap/ocean.py | 0 | 7385 | #
# Copyright 2021 Ocean Protocol Foundation
# SPDX-License-Identifier: Apache-2.0
#
import json
import os
import time
from collections import namedtuple
import requests
from eth_utils import remove_0x_prefix
from ocean_lib.data_provider.data_service_provider import DataServiceProvider
from ocean_lib.enforce_typing_sh... | 1.703125 | 2 |
cgmodsel/prox.py | chrlen/cgmodsel | 0 | 7386 | <gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: <NAME> (<EMAIL>), 2019
"""
import numpy as np
#import scipy
#import abc
#import time
from scipy.optimize import approx_fprime
from scipy.linalg import eigh
from scipy import optimize
from cgmodsel.utils import _logsumexp_condprobs_red
#from cgm... | 1.882813 | 2 |
openmdao.main/src/openmdao/main/linearsolver.py | MrShoks/OpenMDAO-Framework | 1 | 7387 | """ Linear solvers that are used to solve for the gradient of an OpenMDAO System.
(Not to be confused with the OpenMDAO Solver classes.)
"""
# pylint: disable=E0611, F0401
import numpy as np
from scipy.sparse.linalg import gmres, LinearOperator
from openmdao.main.mpiwrap import MPI
from openmdao.util.graph import fix... | 2.375 | 2 |
Temperatures.py | VivianaEloisa/Viviana_first_repo | 0 | 7388 | def fahr_to_cels(a):
return (a-32)/1.8
def cels_to_fahr(b):
return(b*1.8)+32
c=50
d=10
print("{0} °F is {1}°C.".format(c,fahr_to_cels(c)))
print("{0}°C is {1}°F.".format(d,cels_to_fahr(d)))
| 3.5625 | 4 |
src/transform.py | Andres-CS/wallet-analysis | 0 | 7389 | <filename>src/transform.py
import csv
import re
'''
Delete char in substring of original string.
Used this function when, you want to delete
a character in a substring but not in the
rest of the original string.
Returns a string
-- PARAMETERS --
text: original string
start: start of subString
end: end of subSt... | 3.9375 | 4 |
game/views/credits_view.py | fisher60/pyweek-2021 | 0 | 7390 | <gh_stars>0
import arcade
from .menu_view import MenuView
TEXT_COLOR = arcade.csscolor.WHITE
class CreditsView(MenuView):
def __init__(self, parent_view):
super().__init__()
self.parent_view = parent_view
def on_draw(self):
arcade.start_render()
arcade.draw_text(
... | 2.53125 | 3 |
sknn_jgd/backend/lasagne/mlp.py | jgdwyer/nn-convection | 1 | 7391 | # -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, unicode_literals, print_function)
__all__ = ['MultiLayerPerceptronBackend']
import os
import sys
import math
import time
import types
import logging
import itertools
log = logging.getLogger('sknn')
import numpy
import theano
import sklearn.... | 2.28125 | 2 |
src/portals/admins/filters.py | IkramKhan-DevOps/pw-elearn | 2 | 7392 | import django_filters
from django.forms import TextInput
from src.accounts.models import User
from src.application.models import Quiz, StudentGrade
class UserFilter(django_filters.FilterSet):
username = django_filters.CharFilter(widget=TextInput(attrs={'placeholder': 'username'}), lookup_expr='icontains')
fi... | 2.125 | 2 |
L2J_DataPack/data/scripts/quests/998_FallenAngelSelect/__init__.py | Vladislav-Zolotaryov/L2J_Levelless_Custom | 0 | 7393 | # Made by Kerberos
# this script is part of the Official L2J Datapack Project.
# Visit http://www.l2jdp.com/forum/ for more details.
import sys
from com.l2jserver.gameserver.instancemanager import QuestManager
from com.l2jserver.gameserver.model.quest import State
from com.l2jserver.gameserver.model.quest import QuestS... | 2.203125 | 2 |
examples/in.py | alehander42/pseudo-python | 94 | 7394 | s = [4, 2]
if '2' in s:
print(s)
| 2.890625 | 3 |
ai_safety_gridworlds/environments/side_effects_sokoban.py | AicyDC/ai-safety-gridworlds | 0 | 7395 | # Copyright 2018 The AI Safety Gridworlds Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | 2.09375 | 2 |
setup.py | mirca/deepdow | 2 | 7396 | <reponame>mirca/deepdow
from setuptools import find_packages, setup
import deepdow
DESCRIPTION = "Portfolio optimization with deep learning"
LONG_DESCRIPTION = DESCRIPTION
INSTALL_REQUIRES = [
"cvxpylayers",
"matplotlib",
"mlflow",
"numpy>=1.16.5",
"pandas",
"pillow",
"seaborn",
"torc... | 1.367188 | 1 |
src/ref/WGAN_CNN_CNN_DISCRETE/Critic.py | chychen/nba_scrip_generation | 1 | 7397 | """
modeling
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import time
import shutil
import numpy as np
import tensorflow as tf
from tensorflow.contrib import rnn
from tensorflow.contrib import layers
from utils_cnn import Norm
class C_MODE... | 2.5625 | 3 |
tests/attr/test_kernel_shap.py | trsvchn/captum | 3,140 | 7398 | <filename>tests/attr/test_kernel_shap.py
#!/usr/bin/env python3
import io
import unittest
import unittest.mock
from typing import Any, Callable, List, Tuple, Union
import torch
from captum._utils.typing import BaselineType, TensorOrTupleOfTensorsGeneric
from captum.attr._core.kernel_shap import KernelShap
from tests.... | 2.1875 | 2 |
vol/items.py | volCommunity/vol-crawlers | 3 | 7399 | <filename>vol/items.py
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
import scrapy
class JobItem(scrapy.Item):
title = scrapy.Field()
url = scrapy.Field()
text = scrapy.Field()
labels = scrapy.Fie... | 2.265625 | 2 |