max_stars_repo_path stringlengths 4 286 | max_stars_repo_name stringlengths 5 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.03M | content_cleaned stringlengths 6 1.03M | language stringclasses 111
values | language_score float64 0.03 1 | comments stringlengths 0 556k | edu_score float64 0.32 5.03 | edu_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... | <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... | en | 0.411522 | # convert to zero base #xary = [] #yary = [] #xary.append(pos1) #yary.append(pos2) #for pp in right_connect.get(p,[]): # st0 = states[pp] # score1 += get_score( c_score, p, pp, st1 ,st0) # score2 += get_score( c_score, p, pp, st2, st0) line format example: V 1 6854 6854_A_A 6854_A_G 6854 22781 # we can run thi... | 2.03713 | 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... | 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 keras.layers.convolutional import UpSampling2D, Conv... | en | 0.684615 | Provides a (random) weighted average between real and generated image samples # Following parameter and optimizer set as recommended in paper # Build the generator and critic #------------------------------- # Construct Computational Graph # for the Critic #------------------------------- # Freeze generator's lay... | 2.490402 | 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
| <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
| none | 1 | 2.21494 | 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... | ###############################################################################
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
###############################################################################
imp... | en | 0.385486 | ############################################################################### # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. ############################################################################### # R... | 1.977067 | 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... | '''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... | en | 0.139466 | Test package. Test xroms.open_netcdf(). Test xroms.open_zarr(). | 2.233262 | 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,... | 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,... | en | 0.733934 | # url(r'^demoproject/', include('demoproject.foo.urls')), | 1.5406 | 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):... | <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):... | en | 0.542106 | Equation of motion used to modify virbato. ##Change in vibratoStrength depending on meditation values## ##@ToDo - Change to include more momentum build up etc## #Init USB:MIDI interface. #print(mido.get_output_names()) #Used to originally find correct serial port. #In... | 2.906651 | 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,... | #!/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,show
from bokeh.p... | en | 0.393067 | #!/usr/bin/env python3 # -*- coding: utf-8 -*- Created on Wed Jul 31 11:47:47 2019 @author: yanyanyu Tab1-plot1: candlestick <b><p style="color:blue;">Overview: </p></b> <b>Company:</b> {}<br> <b>Address:</b> {} <br> <b>City:</b> {}... | 2.323398 | 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 *... | # -*- 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 *... | en | 0.305518 | # -*- coding:utf-8 -*- # 25*2*6 # conv first # h_flat3 = tf.reshape(h_pool3, [-1, 400]) #tf.train.exponential_decay(0.001, global_step, 500, 0.9,staircase=True) # self.trainop = tf.train.RMSPropOptimizer(self.learning_rate, 0.99, 0.0, 1e-6).minimize(self.loss) # 25*2*6 # conv first # h_flat3 = tf.reshape(h_pool3, [-1... | 2.803869 | 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... | 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... | en | 0.744981 | # If loading a video, use 'break' instead of 'continue'. # Flip the image horizontally for a later selfie-view display, and convert # the BGR image to RGB. # To improve performance, optionally mark the image as not writeable to # pass by reference. # Draw the hand annotations on the image. #cx, cy = int(hand_landmarks.... | 2.597604 | 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 ... | 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 in the given... | en | 0.731587 | 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 in the given folder -> split this folder - if there are dir/s in the folde... | 2.749127 | 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()
... |
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()
... | en | 0.627925 | # Return worker back # tlogger.info('WorkerHub: put task id: %s in cache keyed by worker task: %s' % (task_id, worker_task)) | 2.622582 | 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... | 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():
# Decide on whic... | en | 0.846215 | classdocs Constructor # Decide on which platform this runs | 3.133644 | 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 ... | """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 ... | en | 0.879693 | Django Admin Panels for App Admin View for SendingAddress The primary address can not be deleted via the django admin | 2.439107 | 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",
]... | 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",
]... | none | 1 | 1.354197 | 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 ... | 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 = pitch
... | de | 0.685874 | ###Fig. 1 of Ref. [1] ###Fig. 1 of Ref. [1] ######## Basic data ############# ######## Derived from Basic data ########### ##### Routing for CMC Load ############### M3 routing ########################### ############### M2 routing ########################### ################# M1 routing ###################### | 2.479037 | 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 ... | 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 ... | hu | 0.990594 | #/") # -------- A028, TC-0037 Cookie kezelési tájékoztató -------- # Cookie-k elfogadása folyamat # # Cookie-k elutasítása folyamat # self.driver.find_element_by_xpath( # "//button[@class='cookie__bar__buttons__button cookie__bar__buttons__button--decline']").click() # # time.sleep(2) # -------- A002, TC-0002 Regis... | 2.77826 | 3 |
config.py | amalshaji/python-playground | 14 | 7317 | from pydantic import BaseSettings
class Settings(BaseSettings):
deta_project_key: str
settings = Settings()
| from pydantic import BaseSettings
class Settings(BaseSettings):
deta_project_key: str
settings = Settings()
| none | 1 | 1.661705 | 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... | #!/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... | en | 0.698414 | #!/usr/bin/env python This module provides configuration options for OS project. No more magic numbers! # words # bytes # length od RS in blocks # length of DS in blocks # timer value # buffer size # number of blocks in HD # default priorities # Process states # Page tables # Shared memory # blocks dedicated for user t... | 1.697112 | 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... | #!/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 URDF file. The model describes its kine... | en | 0.807923 | #!/usr/bin/env python Class that imports a Puma 560 URDF model ``Puma560()`` is a class which imports a Unimation Puma560 robot definition from a URDF file. The model describes its kinematic and graphical characteristics. .. runblock:: pycon >>> import roboticstoolbox as rtb >>> robo... | 2.801452 | 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
... | #!/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
"""Define t... | en | 0.674399 | #!/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 Define the cl... | 2.185622 | 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... | #!/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-Identifier: BS... | en | 0.51121 | #!/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-Identifier: BSD-2-Clau... | 2.56962 | 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... | 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... | en | 0.94395 | # save height, advance blocks as usual, then hook our claim tx processing # TODO: generate claim undo info! Undo information holds a claim state **before** a transaction changes it There are 4 possibilities when processing it, of which only 3 are valid ones: 1. the claim is known and the undo info has ... | 1.94945 | 2 |
ProjectEuler.Problem.013.py | jihunroh/ProjectEuler-Python | 0 | 7323 | from ProjectEulerCommons.Base import *
numbers_list = """37107287533902102798797998220837590246510135740250
46376937677490009712648124896970078050417018260538
74324986199524741059474233309513058123726617309629
91942213363574161572522430563301811072406154908250
23067588207539346171171980310421047513778063246676
8926167... | from ProjectEulerCommons.Base import *
numbers_list = """37107287533902102798797998220837590246510135740250
46376937677490009712648124896970078050417018260538
74324986199524741059474233309513058123726617309629
91942213363574161572522430563301811072406154908250
23067588207539346171171980310421047513778063246676
8926167... | ru | 0.306721 | 37107287533902102798797998220837590246510135740250 46376937677490009712648124896970078050417018260538 74324986199524741059474233309513058123726617309629 91942213363574161572522430563301811072406154908250 23067588207539346171171980310421047513778063246676 89261670696623633820136378418383684178734361726757 28112879812849... | 1.169574 | 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",... | """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", description="Datasets related endpoints... | en | 0.823401 | Endpoint for the manipulation of datasets Return a list of all datasets known by the platform Return a list of all datasets known by the platform, along with their variables and time periods Return the variables and time periods available in a dataset Return an unique layer name Return an unique layer name Retu... | 2.640642 | 3 |
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],... | <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],... | none | 1 | 3.098646 | 3 | |
mlgorithms/knn/__init__.py | doycode/mlgorithms | 9 | 7326 | from .knn import KNNClassifier
__all__ = ['KNNClassifier'] | from .knn import KNNClassifier
__all__ = ['KNNClassifier'] | none | 1 | 1.061115 | 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... | <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... | en | 0.883091 | Strip 'control characters', as XML 1.0 does not allow them and the API may return data in XML. | 2.30842 | 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")
... | 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")
... | en | 0.827049 | # exception handled locally # @app.route("GET", "/") # if uncommented raises route already declared exception # async def also_root(reader, writer, request): # return # will be caught by global exception handler For demo purposes show system is still alive # uncaught exceptions raised in route handlers end up here... | 2.857083 | 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... | 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... | en | 0.346832 | # construct unet structure # Defines the submodule with skip connection. # X -------------------identity---------------------- X # |-- downsampling -- |submodule| -- upsampling --| | 2.514847 | 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... | #!/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):
pass
def t... | en | 0.385896 | #!/usr/bin/env python # -*- coding: utf-8 -*- # Path hack # noqa | 2.661821 | 3 |
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... | 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... | en | 0.449172 | # TODO: deal with undo redo # ============================================================================== # Main # ============================================================================== | 1.91662 | 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... | 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... | es | 0.749574 | #divicio de enteros | 2.912154 | 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... | # 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... | en | 0.812749 | # 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.450214 | 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 = ... | <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 = ... | none | 1 | 2.81839 | 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... | """
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('DJANGO_SETTIN... | en | 0.767463 | 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/ | 1.911063 | 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... | 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... | none | 1 | 1.881932 | 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>"
... | #!/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>"
__contact__ = "... | en | 0.285798 | #!/usr/bin/env python3 # -*- coding: utf-8 -*- Module Name Description... | 2.745071 | 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... | 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... | en | 0.771342 | # Fills in the oceans # Defines the continents # Sets the size of the map # Converts the coordinates to map points # Draws the points on the map # Labels each point with the location name # Here we are reading in a shape file, which places state boundary # information for our Basemap # get current axes instance # Loadi... | 3.012703 | 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]
... | 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]
hour_float = 1.0*hour+minute... | en | 0.533307 | #parameters #Is it day or night? # night # night # year # month # day of month # hr # min # sec # wait 30 min if its before midnight # normal wait # day #implicit else # year # month # day of month # hr # min # sec # program (never) ends | 3.453914 | 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
| __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
| none | 1 | 1.406444 | 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 ... | <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 ... | en | 0.774905 | #!/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 the License at: # http://www.apache.org/lice... | 2.25196 | 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... | 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... | de | 0.39874 | # http://scikit-learn.org # http://scikit-learn.org/stable/modules/generated/sklearn.svm.SVC.html # uses hard examples if not ignored # train parameters of the classifier ########################################################################## # main ###################################################################... | 2.170992 | 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():
"""入力データの読み込... | 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():
"""入力データの読み込... | ja | 0.99957 | 入力データの読み込み アルゴリズム 1. 50未満の中でペアにできるものを探す 1-1. queの末端でペアを作れる場合、左端を固定し和が50以上で最小になるように右を選んでペアにする 1-2. queの末端でペアを作れない場合、末端2つを取り出した上で3個以上の組み合わせで消化する 1-2-1. 右末端で和が50以上なら右から左に探索して和が50以上になる最小値を得る->組にして除外 1-2-2. 右末端でも和が50にならないなら右末端をして1-2に戻る -> 全部を消化しても50にならないならそのまま全部を足してしまう 2. 1と同じことを全体かつ閾値150で行う # 50... | 3.087593 | 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... | #!/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):
return i(v1, v2, v3, 4)
def i(v1, v2, v3, v4):
return j(v1, v2, v3, v4, 5)
d... | ru | 0.258958 | #!/usr/bin/python | 3.331653 | 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... | 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... | none | 1 | 2.418846 | 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... | 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
]
percentage ... | en | 0.263598 | # [ 3.71470260e-04 2.68477348e-04 1.72623153e-04 8.33101319e-05 # 0.00000000e+00 -7.77931251e-05 -1.50508665e-04 -2.18544754e-04 # -2.82262747e-04] | 2.518629 | 3 |
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) | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from caqe import app
app.run(debug=True, threaded=True) | en | 0.352855 | #!/usr/bin/env python # -*- coding: utf-8 -*- | 1.05759 | 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'
... | """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'
from docopt imp... | en | 0.408668 | 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. # NOQA # Python 2.x # Python 3.x # l.setLevel... | 2.029239 | 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.
# --------------------------------------------------------------------... | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | en | 0.42147 | # -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------... | 2.394178 | 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> <... | ############################ Copyrights and license ############################
# #
# Copyright 2017 <NAME> <<EMAIL>> #
# Copyright 2017 Simon <<EMAIL>> #
# Copyright 2018 <NAME> <<EMAIL>> ... | en | 0.646676 | ############################ Copyrights and license ############################ # # # Copyright 2017 <NAME> <<EMAIL>> # # Copyright 2017 Simon <<EMAIL>> # # Copyright 2018 <NAME> <<EMAIL>> ... | 1.834276 | 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... | """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", "from": "host"}'... | en | 0.479582 | Tests for remote module. Ensure simple data can be parsed. Ensure valid app_list data can be parsed. Ensure simple data can be parsed. Ensure simple data can be parsed. | 2.52345 | 3 |
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... | 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... | none | 1 | 2.163697 | 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.... | 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.... | en | 0.859555 | Decorator that performs a typecheck on the input to a function When initialized, include list of accepted datatypes and the arg_name to enforce the check on. Can totally be daisy-chained. If a non-accepted datastructure is passed, throws an exception function %s does not accept %s, accepted types are: %s First ... | 3.168437 | 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... | # -*- 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... | en | 0.392136 | # -*- coding: utf-8 -*- # TenderUAProcessTest # TenderUAResourceTest # TenderUATest # TenderUAResourceTest # TenderUAProcessTest # TODO: change attribute identifier | 2.079295 | 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... | 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... | en | 0.632962 | 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 (dict): dictionary to write append (bool): if true, will append to file instead of overwriting, default=False Reads a dictionary from a... | 2.904859 | 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:
... | # -*- 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:
<NAME>
<NAME>
Grupo de Pesquisa:
Gradiente de Mo... | pt | 0.881321 | # -*- 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:
<NAME>
<NAME>
Grupo de Pesquisa:
Gradiente de Modelage... | 3.529059 | 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]:
... | 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]:
# move m... | en | 0.8887 | :type height: List[int] :rtype: int # move m from left to right # found a local convave shape # search the remainder part from [m,right] # reset m as min hight between left and right # since right is higher than left, we can guarantee that # each index in interval (left,right) will increase height[left]-height[m] 's ... | 3.830435 | 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... | # 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 range(S+1)]... | ja | 0.474398 | # list(map(int, input().split())) # int(input()) 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)でより高速.) # 何も足さない (= S自身のみの1通りを表すためのやつ.) # A[s] = sum(A[:(s-3)+1]) % mod # どっちでもOK.速いのは下のやつ. | 2.642777 | 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
... | 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
... | en | 0.640531 | Factory for components running under an AnalysisServer. An instance would typically be passed to :meth:`openmdao.main.factorymanager.register_class_factory`. host: string Host name or IP address of the AnalysisServer to connect to. port: int Port number of the AnalysisServer to connect... | 2.776558 | 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... | <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... | en | 0.710367 | # Generated by Django 2.1 on 2018-08-24 09:25 | 1.284918 | 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", ... | <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", ... | en | 0.847075 | # 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. `image.tarball("files/xyz.tar", "/a/b")` extracts tarball located at `files/xyz.tar` to `/a/b` in the image -- - `source` is one of: - an `... | 2.342341 | 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... | 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... | en | 0.677482 | # iterate through the current dir up to the root dir "/" to find a # .sqlmat.json # from arguments # find dsn from ./.sqlmat.json # default dsn using username # run psql client # run dbdump # generate alembic migrations \ # A generic, single database configuration. [alembic] # path to migration scripts script_location... | 2.488075 | 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': '',
... | 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': '',
... | none | 1 | 2.546518 | 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
"""
... | #!/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
"""
... | en | 0.809533 | #!/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.092297 | 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... | <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... | ja | 0.985219 | #" #") #") | 2.615688 | 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... | ##############################################################################
#
# 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... | en | 0.413284 | ############################################################################## # # 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.508986 | 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... | # 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... | en | 0.90003 | # Generated by Django 2.2 on 2020-11-07 01:03 | 1.466577 | 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... | 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... | en | 0.5402 | Redirect to /docs Get dependency versions # for route in app.routes: # body_field = getattr(route, 'body_field', None) # if body_field: # body_field.type_.__name__ = 'name' | 2.206318 | 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... | #!/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['enable_rgb_stream'],
... | fr | 0.221828 | #!/usr/bin/env python3 | 2.101542 | 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)
| 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) | none | 1 | 2.400369 | 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... | #!/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_alphabet = {'A':'A... | en | 0.811728 | #!/usr/bin/python -tt # 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 # Description: converts DNA string to amino acid string Return the t... | 2.552011 | 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... | # -*- 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/thread-local objec... | en | 0.742145 | # -*- coding: UTF-8 -*- Helper for working with flask Helper class for interacting with flask framework. Improves testability by avoiding accessing flask global/thread-local objects everywhere. # type: (Flask) -> None # type: () -> Flask # type: () -> logging.Logger # type: () -> bytes # type: () -> Text | 2.548456 | 3 |
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... | # 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... | en | 0.569886 | # Imports # Need to be executed from cd to MCarloLongRuns # Define the domains # increment = 1/scale # print(param) # Run experiment # Inputs # Outputs | 2.053453 | 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... | 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... | none | 1 | 4.139487 | 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` ... | # 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` ... | en | 0.786012 | # 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` modu... | 2.904756 | 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... | 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+Piglatin."
... | en | 0.288899 | Please use the endpoint /translate to access this api. Usage: "{}translate?text=Translate+this+text+into+Piglatin." | 3.053472 | 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
... | 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
screen.tracer(0)
right_paddle = Pad... | en | 0.849007 | # Turn off animation to show paddle after it has been shifted # bounce when the ball hit the wall # detect collision with the paddle # detect R paddle miss # detect L paddle miss | 3.607515 | 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))
... | <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))
... | en | 0.852883 | Multistate Sales Tax Calculator Using the prompt, attempt to get a decimal from the user Given an amount as a number Return a string formatted as a dollar amount Prompt for the order amount and state If the state is Wisconsin, prompt for the county Print the sales tax and total amount | 4.031815 | 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... | 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 = None,
step: bool = None, ... | en | 0.490025 | :mod:`util.verify` -- Input verification ======================================== Common input verification methods. # Mandatory imports Verify if the input range tuple fullfils the requirements. An error is raised if a criteria is failed. # required # optional # required # optional | 3.298604 | 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:
... | 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:
... | none | 1 | 2.391791 | 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... | #
"""
"""
# 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 endianness:... | ja | 0.253764 | # # end_pymotw_header | 2.740492 | 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... | <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... | en | 0.826213 | # -*- coding: utf-8 -*- Module grouping network-related utilities and functions. HTTPAdapter which adds a default timeout to requests. Allows timeout to be overridden on a per-request basis. Initialisation. Sends PreparedRequest object. Returns Response object. Parameters ---------- request... | 2.900837 | 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'... | 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'))
return resp | none | 1 | 2.326255 | 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... | 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... | en | 0.569447 | #wasderivedfrom: source #remove identity, persistenID, displayID, version #remove attachment (if empty) #add library sheets #add postprocessing function to remove unecessaries # global varibales for homespace, document, and sheet # set Excel file into a dataframe # convert the dataframe into a dictionary # set dictiona... | 2.482351 | 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... | #
# 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... | en | 0.601179 | # # Copyright 2021 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # # get logs only for this token address # can have duplicates # transfer_event = self.get_transfer_event(tx['blockNumber'], sender, receiver) # try again in this case # verify sender of the tx using the Tx record # grab the metadatastor... | 1.699025 | 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... | #!/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 cgmodsel.utils ... | en | 0.640661 | #!/usr/bin/env python3 # -*- coding: utf-8 -*- @author: <NAME> (<EMAIL>), 2019 #import scipy #import abc #import time #from cgmodsel.utils import logsumexp # pylint: disable=unbalanced-tuple-unpacking # pylint: disable=W0511 # todos # pylint: disable=R0914 # too many locals #############################################... | 1.911581 | 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... | """ 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... | en | 0.504461 | 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 # Dummy class so things parse. A base class for linear solvers Set up any LinearSolver object Computes the norm of the linear residual Scipy's GMRES Solver.... | 2.376821 | 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)))
| 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)))
| none | 1 | 3.55697 | 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... | <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... | en | 0.670439 | 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 subString char: char to delete, default is ','. Get the p... | 3.930295 | 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(
... | 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(
"Credits",... | none | 1 | 2.590136 | 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.... | # -*- 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.... | en | 0.801396 | # -*- coding: utf-8 -*- Abstract base class for wrapping the multi-layer perceptron functionality from Lasagne. # Aggregate all regularization parameters into common dictionaries. # Create the layers one by one, connecting to previous. # NOTE: Numbers don't match up exactly for pooling; one off. The logic is convol... | 2.281199 | 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... | 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... | none | 1 | 2.115371 | 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... | # 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... | en | 0.797967 | # Made by Kerberos # this script is part of the Official L2J Datapack Project. # Visit http://www.l2jdp.com/forum/ for more details. | 2.198717 | 2 |
examples/in.py | alehander42/pseudo-python | 94 | 7394 | s = [4, 2]
if '2' in s:
print(s)
| s = [4, 2]
if '2' in s:
print(s)
| none | 1 | 2.903713 | 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... | # 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... | en | 0.854336 | # 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.097134 | 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... | 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",
"torch>=1.5",
"tensorboar... | none | 1 | 1.192726 | 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... | """
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... | en | 0.606426 | modeling TO build up the graph Inputs ------ config : * batch_size : mini batch size * log_dir : path to save training summary * learning_rate : adam's learning rate * hidden_size : number of hidden units in LSTM * rnn_layers : number ... | 2.544101 | 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.... | <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.... | en | 0.634989 | #!/usr/bin/env python3 # noqa: F401 # test progress output for each batch size # to test if progress calculation aligns with the actual iteration # all perturbations_per_eval should reach progress of 100% # Remaining tests are for cases where forward function returns a scalar # as either a float, integer, 0d tensor or ... | 2.176699 | 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... | <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... | en | 0.582009 | # -*- coding: utf-8 -*- # Define here the models for your scraped items # # See documentation in: # http://doc.scrapy.org/en/latest/topics/items.html | 2.259672 | 2 |