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/ml_final_project/utils/evaluators/default.py | yuvalot/ml_final_project | 0 | 1900 | <gh_stars>0
def default_evaluator(model, X_test, y_test):
"""A simple evaluator that takes in a model,
and a test set, and returns the loss.
Args:
model: The model to evaluate.
X_test: The features matrix of the test set.
y_test: The one-hot labels matrix of the... | def default_evaluator(model, X_test, y_test):
"""A simple evaluator that takes in a model,
and a test set, and returns the loss.
Args:
model: The model to evaluate.
X_test: The features matrix of the test set.
y_test: The one-hot labels matrix of the test set.
... | en | 0.787639 | A simple evaluator that takes in a model,
and a test set, and returns the loss.
Args:
model: The model to evaluate.
X_test: The features matrix of the test set.
y_test: The one-hot labels matrix of the test set.
Returns:
The loss on the test set... | 2.813897 | 3 |
test.py | wangjm12138/Yolov3_wang | 0 | 1901 | import random
class Yolov3(object):
def __init__(self):
self.num=0
self.input_size=[8,16,32]
def __iter__(self):
return self
def __next__(self):
a = random.choice(self.input_size)
self.num=self.num+1
if self.num<3:
return a
else:
raise StopIteration
yolo=Yolov3()
for data in yolo:
print(data)
| import random
class Yolov3(object):
def __init__(self):
self.num=0
self.input_size=[8,16,32]
def __iter__(self):
return self
def __next__(self):
a = random.choice(self.input_size)
self.num=self.num+1
if self.num<3:
return a
else:
raise StopIteration
yolo=Yolov3()
for data in yolo:
print(data)
| none | 1 | 3.606509 | 4 | |
utils/dsp.py | huchenxucs/WaveRNN | 0 | 1902 | <reponame>huchenxucs/WaveRNN
import math
import numpy as np
import librosa
from utils import hparams as hp
from scipy.signal import lfilter
import soundfile as sf
def label_2_float(x, bits):
return 2 * x / (2**bits - 1.) - 1.
def float_2_label(x, bits):
assert abs(x).max() <= 1.0
x = (x + 1.) * (2**bits... | import math
import numpy as np
import librosa
from utils import hparams as hp
from scipy.signal import lfilter
import soundfile as sf
def label_2_float(x, bits):
return 2 * x / (2**bits - 1.) - 1.
def float_2_label(x, bits):
assert abs(x).max() <= 1.0
x = (x + 1.) * (2**bits - 1) / 2
return x.clip(0... | en | 0.546661 | # librosa.output.write_wav(path, x.astype(np.float32), sr=hp.sample_rate) def build_mel_basis(): return librosa.filters.mel(hp.sample_rate, hp.n_fft, n_mels=hp.num_mels, fmin=hp.fmin) # TODO: get rid of log2 - makes no sense Uses Griffin-Lim phase reconstruction to convert from a normalized mel spectrogram back... | 2.460748 | 2 |
loldib/getratings/models/NA/na_talon/na_talon_jng.py | koliupy/loldib | 0 | 1903 | <filename>loldib/getratings/models/NA/na_talon/na_talon_jng.py
from getratings.models.ratings import Ratings
class NA_Talon_Jng_Aatrox(Ratings):
pass
class NA_Talon_Jng_Ahri(Ratings):
pass
class NA_Talon_Jng_Akali(Ratings):
pass
class NA_Talon_Jng_Alistar(Ratings):
pass
class NA_Talon_Jng_Amumu(R... | <filename>loldib/getratings/models/NA/na_talon/na_talon_jng.py
from getratings.models.ratings import Ratings
class NA_Talon_Jng_Aatrox(Ratings):
pass
class NA_Talon_Jng_Ahri(Ratings):
pass
class NA_Talon_Jng_Akali(Ratings):
pass
class NA_Talon_Jng_Alistar(Ratings):
pass
class NA_Talon_Jng_Amumu(R... | none | 1 | 1.473408 | 1 | |
utils/turkish.py | derenyilmaz/personality-analysis-framework | 1 | 1904 | class TurkishText():
"""Class for handling lowercase/uppercase conversions of Turkish characters..
Attributes:
text -- Turkish text to be handled
"""
text = ""
l = ['ı', 'ğ', 'ü', 'ş', 'i', 'ö', 'ç']
u = ['I', 'Ğ', 'Ü', 'Ş', 'İ', 'Ö', 'Ç']
def __init__(self, text):
self.te... | class TurkishText():
"""Class for handling lowercase/uppercase conversions of Turkish characters..
Attributes:
text -- Turkish text to be handled
"""
text = ""
l = ['ı', 'ğ', 'ü', 'ş', 'i', 'ö', 'ç']
u = ['I', 'Ğ', 'Ü', 'Ş', 'İ', 'Ö', 'Ç']
def __init__(self, text):
self.te... | en | 0.660541 | Class for handling lowercase/uppercase conversions of Turkish characters.. Attributes: text -- Turkish text to be handled Converts the text into uppercase letters. Returns string. Converts the text into lowercase letters. Returns string. Converts each first letter to uppercase, and the rest... | 3.798293 | 4 |
app/helpers/geocode.py | Soumya117/finnazureflaskapp | 0 | 1905 | import googlemaps
gmaps = googlemaps.Client(key='google_key')
def get_markers(address):
geocode_result = gmaps.geocode(address)
return geocode_result[0]['geometry']['location']
| import googlemaps
gmaps = googlemaps.Client(key='google_key')
def get_markers(address):
geocode_result = gmaps.geocode(address)
return geocode_result[0]['geometry']['location']
| none | 1 | 2.685389 | 3 | |
tf/estimators/keras_estimator.py | aspratyush/dl_utils | 0 | 1906 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# Imports
import os
import numpy as np
import tensorflow as tf
def run(model, X, Y, optimizer=None, nb_epochs=30, nb_batches=128):
"""
Run the estimator
"""
if optimizer is None:
optim... | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# Imports
import os
import numpy as np
import tensorflow as tf
def run(model, X, Y, optimizer=None, nb_epochs=30, nb_batches=128):
"""
Run the estimator
"""
if optimizer is None:
optim... | en | 0.412491 | # Imports Run the estimator # 1. Compile the model # 2. Create an estimator # Training # 3a. Create the training function # 3b. Train the model # Evaluate # 4a. Evaluate the model # 4b. Evaluate the model Overloaded function to create an estimator using tf.data.Dataset :param model : uncompiled keras model :par... | 2.735986 | 3 |
isign/archive.py | l0ui3/isign | 1 | 1907 | """ Represents an app archive. This is an app at rest, whether it's a naked
app bundle in a directory, or a zipped app bundle, or an IPA. We have a
common interface to extract these apps to a temp file, then resign them,
and create an archive of the same type """
import abc
import biplist
from bundle impor... | """ Represents an app archive. This is an app at rest, whether it's a naked
app bundle in a directory, or a zipped app bundle, or an IPA. We have a
common interface to extract these apps to a temp file, then resign them,
and create an archive of the same type """
import abc
import biplist
from bundle impor... | en | 0.908404 | Represents an app archive. This is an app at rest, whether it's a naked app bundle in a directory, or a zipped app bundle, or an IPA. We have a common interface to extract these apps to a temp file, then resign them, and create an archive of the same type find paths to executables. Cached in helper_paths # ... | 2.05785 | 2 |
conan/tools/env/virtualrunenv.py | dscole/conan | 0 | 1908 | from conan.tools.env import Environment
def runenv_from_cpp_info(conanfile, cpp_info):
""" return an Environment deducing the runtime information from a cpp_info
"""
dyn_runenv = Environment(conanfile)
if cpp_info is None: # This happens when the dependency is a private one = BINARY_SKIP
retu... | from conan.tools.env import Environment
def runenv_from_cpp_info(conanfile, cpp_info):
""" return an Environment deducing the runtime information from a cpp_info
"""
dyn_runenv = Environment(conanfile)
if cpp_info is None: # This happens when the dependency is a private one = BINARY_SKIP
retu... | en | 0.885216 | return an Environment deducing the runtime information from a cpp_info # This happens when the dependency is a private one = BINARY_SKIP # cpp_info.exes is not defined yet # If it is a build_require this will be the build-os, otherwise it will be the host-os captures the conanfile environment that is defined from its ... | 2.30511 | 2 |
src/api/api_lists/models/list.py | rrickgauer/lists | 0 | 1909 | <gh_stars>0
"""
**********************************************************************************
List model
**********************************************************************************
"""
from enum import Enum
from dataclasses import dataclass
from uuid import UUID
from datetime import datetime
class ListTy... | """
**********************************************************************************
List model
**********************************************************************************
"""
from enum import Enum
from dataclasses import dataclass
from uuid import UUID
from datetime import datetime
class ListType(str, Enum... | el | 0.289297 | ********************************************************************************** List model ********************************************************************************** | 2.652871 | 3 |
config/appdaemon/apps/power_alarm.py | azogue/hassio_config | 18 | 1910 | <filename>config/appdaemon/apps/power_alarm.py
# -*- coding: utf-8 -*-
"""
Automation task as a AppDaemon App for Home Assistant -
current meter PEAK POWER notifications
"""
import datetime as dt
from enum import IntEnum
import appdaemon.plugins.hass.hassapi as hass
LOG_LEVEL = "INFO"
LOG_LEVEL_ALERT = "WARNING"
LOG... | <filename>config/appdaemon/apps/power_alarm.py
# -*- coding: utf-8 -*-
"""
Automation task as a AppDaemon App for Home Assistant -
current meter PEAK POWER notifications
"""
import datetime as dt
from enum import IntEnum
import appdaemon.plugins.hass.hassapi as hass
LOG_LEVEL = "INFO"
LOG_LEVEL_ALERT = "WARNING"
LOG... | en | 0.770559 | # -*- coding: utf-8 -*- Automation task as a AppDaemon App for Home Assistant - current meter PEAK POWER notifications # 10% over limit # secs # Big power consumers Handler for different kinds of power notifications. Used to centralize push message construction. # noinspection PyClassHasNoInit App to notify power ... | 2.274929 | 2 |
mailmynet/Maildir/proxy_postfix/Twisted-11.0.0/build/lib.linux-x86_64-2.6/twisted/internet/gtk2reactor.py | SPIN-UMass/SWEET | 3 | 1911 | # -*- test-case-name: twisted.internet.test -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
This module provides support for Twisted to interact with the glib/gtk2
mainloop.
In order to use this support, simply do the following::
| from twisted.internet import gtk2reactor
| ... | # -*- test-case-name: twisted.internet.test -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
This module provides support for Twisted to interact with the glib/gtk2
mainloop.
In order to use this support, simply do the following::
| from twisted.internet import gtk2reactor
| ... | en | 0.831384 | # -*- test-case-name: twisted.internet.test -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. This module provides support for Twisted to interact with the glib/gtk2 mainloop. In order to use this support, simply do the following:: | from twisted.internet import gtk2reactor | gtk2r... | 2.100861 | 2 |
run_mod.py | fpl-analytics/gr_crypto | 0 | 1912 | <reponame>fpl-analytics/gr_crypto
"""
Setup:
- Import Libraries
- Setup tf on multiple cores
- Import Data
"""
import pandas as pd
import numpy as np
import tensorflow as tf
import seaborn as sns
from time import time
import multiprocessing
import random
import os
from tensorflow.keras.models import Sequ... | """
Setup:
- Import Libraries
- Setup tf on multiple cores
- Import Data
"""
import pandas as pd
import numpy as np
import tensorflow as tf
import seaborn as sns
from time import time
import multiprocessing
import random
import os
from tensorflow.keras.models import Sequential
from tensorflow.keras.layer... | en | 0.745457 | Setup: - Import Libraries - Setup tf on multiple cores - Import Data Preprocess Linear Regression # 1 step # 15 step calculate and store components seperately process: - first, get rolling values for each timestamp - then, predict 1 and 15 gaps and store in array # Production Steps: - Get train, val tes... | 2.286824 | 2 |
bot.py | menlen/one | 0 | 1913 | <reponame>menlen/one
# This example show how to use inline keyboards and process button presses
import telebot
import time
from telebot.types import InlineKeyboardMarkup, InlineKeyboardButton
import os, sys
from PIL import Image, ImageDraw, ImageFont
import random
TELEGRAM_TOKEN = '<KEY>'
bot = telebot.Tele... | # This example show how to use inline keyboards and process button presses
import telebot
import time
from telebot.types import InlineKeyboardMarkup, InlineKeyboardButton
import os, sys
from PIL import Image, ImageDraw, ImageFont
import random
TELEGRAM_TOKEN = '<KEY>'
bot = telebot.TeleBot(TELEGRAM_TOKEN)
... | en | 0.604728 | # This example show how to use inline keyboards and process button presses # get an image # make a blank image for the text, initialized to transparent text color # get a font # get a drawing context # draw text, half opacity \
Juda soz!!!, Ismingizni yozing \
Juda soz!!!, Ismingizni yozin... | 2.877211 | 3 |
novice/python-unit-testing/answers/test_rectangle2.py | Southampton-RSG/2019-03-13-southampton-swc | 1 | 1914 | <reponame>Southampton-RSG/2019-03-13-southampton-swc
from rectangle2 import rectangle_area
def test_unit_square():
assert rectangle_area([0, 0, 1, 1]) == 1.0
def test_large_square():
assert rectangle_area([1, 1, 4, 4]) == 9.0
def test_actual_rectangle():
assert rectangle_area([0, 1, 4, 7]) == 24.0
| from rectangle2 import rectangle_area
def test_unit_square():
assert rectangle_area([0, 0, 1, 1]) == 1.0
def test_large_square():
assert rectangle_area([1, 1, 4, 4]) == 9.0
def test_actual_rectangle():
assert rectangle_area([0, 1, 4, 7]) == 24.0 | none | 1 | 3.092102 | 3 | |
tests/requestreply.py | unclechu/py-radio-class | 0 | 1915 | # -*- coding: utf-8 -*-
from unittest import TestCase, TestLoader
from radio import (Radio, ListenerNotFound, ReplyHandlerAlreadyBound,
HandlerAlreadyBound)
def init_radio(f):
def wrap(self, *args):
self.radio = Radio()
return f(self, *args)
return wrap
class TestRadio... | # -*- coding: utf-8 -*-
from unittest import TestCase, TestLoader
from radio import (Radio, ListenerNotFound, ReplyHandlerAlreadyBound,
HandlerAlreadyBound)
def init_radio(f):
def wrap(self, *args):
self.radio = Radio()
return f(self, *args)
return wrap
class TestRadio... | en | 0.892351 | # -*- coding: utf-8 -*- "request", "reply" and "stopReplying" methods work correctly. Keyword arguments works correctly. "reply" fails when trying to bound handler that is already bounded. # General exception # Child exception "stopReplying" fails when trying to unbound handler that was not bounded. "stopReplyi... | 2.81389 | 3 |
mayan/apps/rest_api/exceptions.py | sophiawa/Mayan-EDMS | 1 | 1916 | <gh_stars>1-10
class APIError(Exception):
"""
Base exception for the API app
"""
pass
class APIResourcePatternError(APIError):
"""
Raised when an app tries to override an existing URL regular expression
pattern
"""
pass
| class APIError(Exception):
"""
Base exception for the API app
"""
pass
class APIResourcePatternError(APIError):
"""
Raised when an app tries to override an existing URL regular expression
pattern
"""
pass | en | 0.740907 | Base exception for the API app Raised when an app tries to override an existing URL regular expression pattern | 2.250872 | 2 |
tests/unit/types/message/test_message.py | Immich/jina | 1 | 1917 | <reponame>Immich/jina
import sys
from typing import Sequence
import pytest
from jina import Request, QueryLang, Document
from jina.clients.request import request_generator
from jina.proto import jina_pb2
from jina.proto.jina_pb2 import EnvelopeProto
from jina.types.message import Message
from jina.types.request impor... | import sys
from typing import Sequence
import pytest
from jina import Request, QueryLang, Document
from jina.clients.request import request_generator
from jina.proto import jina_pb2
from jina.proto.jina_pb2 import EnvelopeProto
from jina.types.message import Message
from jina.types.request import _trigger_fields
from... | en | 0.914513 | # access r.train # now it is read # write access r.train # now it is read # write access r.train # now it is read # write access r.train # now it is read # write access r.train # now it is read # write access r.train # now it is read # q1 and q2 refer to the same | 1.916499 | 2 |
tabnine-vim/third_party/ycmd/ycmd/tests/python/testdata/project/settings_extra_conf.py | MrMonk3y/vimrc | 10 | 1918 | import os
import sys
DIR_OF_THIS_SCRIPT = os.path.abspath( os.path.dirname( __file__ ) )
def Settings( **kwargs ):
return {
'interpreter_path': sys.executable,
'sys_path': [ os.path.join( DIR_OF_THIS_SCRIPT, 'third_party' ) ]
}
| import os
import sys
DIR_OF_THIS_SCRIPT = os.path.abspath( os.path.dirname( __file__ ) )
def Settings( **kwargs ):
return {
'interpreter_path': sys.executable,
'sys_path': [ os.path.join( DIR_OF_THIS_SCRIPT, 'third_party' ) ]
}
| none | 1 | 1.959297 | 2 | |
SmartCache/sim/Utilities/setup.py | Cloud-PG/smart-cache | 1 | 1919 | from distutils.core import setup
setup(
name='utils',
version='1.0.0',
author='<NAME>',
author_email='<EMAIL>',
packages=[
'utils',
],
scripts=[],
url='https://github.com/Cloud-PG/smart-cache',
license='Apache 2.0 License',
description='Utils for the SmartCache project',... | from distutils.core import setup
setup(
name='utils',
version='1.0.0',
author='<NAME>',
author_email='<EMAIL>',
packages=[
'utils',
],
scripts=[],
url='https://github.com/Cloud-PG/smart-cache',
license='Apache 2.0 License',
description='Utils for the SmartCache project',... | none | 1 | 1.196507 | 1 | |
homeassistant/components/eight_sleep/binary_sensor.py | liangleslie/core | 2 | 1920 | <gh_stars>1-10
"""Support for Eight Sleep binary sensors."""
from __future__ import annotations
import logging
from pyeight.eight import EightSleep
from homeassistant.components.binary_sensor import (
BinarySensorDeviceClass,
BinarySensorEntity,
)
from homeassistant.core import HomeAssistant
from homeassista... | """Support for Eight Sleep binary sensors."""
from __future__ import annotations
import logging
from pyeight.eight import EightSleep
from homeassistant.components.binary_sensor import (
BinarySensorDeviceClass,
BinarySensorEntity,
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers.enti... | en | 0.803738 | Support for Eight Sleep binary sensors. Set up the eight sleep binary sensor. Representation of a Eight Sleep heat-based sensor. Initialize the sensor. Return true if the binary sensor is on. | 2.397709 | 2 |
ravem/tests/util_test.py | bpedersen2/indico-plugins-cern | 0 | 1921 | # This file is part of the CERN Indico plugins.
# Copyright (C) 2014 - 2022 CERN
#
# The CERN Indico plugins are free software; you can redistribute
# them and/or modify them under the terms of the MIT License; see
# the LICENSE file for more details.
from unittest.mock import MagicMock
import pytest
from requests.ex... | # This file is part of the CERN Indico plugins.
# Copyright (C) 2014 - 2022 CERN
#
# The CERN Indico plugins are free software; you can redistribute
# them and/or modify them under the terms of the MIT License; see
# the LICENSE file for more details.
from unittest.mock import MagicMock
import pytest
from requests.ex... | en | 0.857146 | # This file is part of the CERN Indico plugins. # Copyright (C) 2014 - 2022 CERN # # The CERN Indico plugins are free software; you can redistribute # them and/or modify them under the terms of the MIT License; see # the LICENSE file for more details. | 2.221702 | 2 |
apps/organization/urls.py | stormsha/StormOnline | 18 | 1922 | # _*_ coding: utf-8 _*_
# ---------------------------
__author__ = 'StormSha'
__date__ = '2018/3/28 18:01'
# ---------------------------
# -------------------------django----------------------
from django.conf.urls import url
from .views import OrgView, AddUserAskView, OrgHomeView, OrgCourseView, OrgDescView, OrgTeach... | # _*_ coding: utf-8 _*_
# ---------------------------
__author__ = 'StormSha'
__date__ = '2018/3/28 18:01'
# ---------------------------
# -------------------------django----------------------
from django.conf.urls import url
from .views import OrgView, AddUserAskView, OrgHomeView, OrgCourseView, OrgDescView, OrgTeach... | en | 0.160987 | # _*_ coding: utf-8 _*_ # --------------------------- # --------------------------- # -------------------------django---------------------- # --------------机构收藏------------------------- # -----------------------teacher------------------------------ | 1.874254 | 2 |
tech_project/lib/python2.7/site-packages/filer/migrations/0010_auto_20180414_2058.py | priyamshah112/Project-Descripton-Blog | 0 | 1923 | <filename>tech_project/lib/python2.7/site-packages/filer/migrations/0010_auto_20180414_2058.py<gh_stars>0
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('fi... | <filename>tech_project/lib/python2.7/site-packages/filer/migrations/0010_auto_20180414_2058.py<gh_stars>0
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('fi... | en | 0.769321 | # -*- coding: utf-8 -*- | 1.482175 | 1 |
SLHCUpgradeSimulations/Configuration/python/aging.py | ckamtsikis/cmssw | 852 | 1924 | <gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
# handle normal mixing or premixing
def getHcalDigitizer(process):
if hasattr(process,'mixData'):
return process.mixData
if hasattr(process,'mix') and hasattr(process.mix,'digitizers') and hasattr(process.mix.digitizers,'hcal'):
return... | import FWCore.ParameterSet.Config as cms
# handle normal mixing or premixing
def getHcalDigitizer(process):
if hasattr(process,'mixData'):
return process.mixData
if hasattr(process,'mix') and hasattr(process.mix,'digitizers') and hasattr(process.mix.digitizers,'hcal'):
return process.mix.digiti... | en | 0.844684 | # handle normal mixing or premixing # change assumptions about lumi rate # turnon = True enables default, False disables # recalibration and darkening always together # needs lumi to set proper ZS thresholds (tbd) # todo: determine ZS threshold adjustments # adjust PF thresholds for increased noise # based on: https://... | 1.767167 | 2 |
xml_parser.py | cbschaff/nlimb | 12 | 1925 | import numpy as np
import xml.etree.ElementTree as ET
class Geom(object):
def __init__(self, geom):
self.xml = geom
self.params = []
def get_params(self):
return self.params.copy()
def set_params(self, new_params):
self.params = new_params
def update_point(self, p, ne... | import numpy as np
import xml.etree.ElementTree as ET
class Geom(object):
def __init__(self, geom):
self.xml = geom
self.params = []
def get_params(self):
return self.params.copy()
def set_params(self, new_params):
self.params = new_params
def update_point(self, p, ne... | en | 0.405473 | # radius # + rfac * (new_params[1] / self.params[1]) # radius # update only after computing p1, p2 # dictionary of legal geometry types # assume only one geometry per body #assert robot.get_height() == 1.31 #assert robot.get_height() == .6085 #env.render() | 2.7922 | 3 |
app/http/middleware/LoadUserMiddleware.py | josephmancuso/masonite-forum | 11 | 1926 | <filename>app/http/middleware/LoadUserMiddleware.py
''' Load User Middleware'''
from masonite.facades.Auth import Auth
class LoadUserMiddleware:
''' Middleware class which loads the current user into the request '''
def __init__(self, Request):
''' Inject Any Dependencies From The Service Container ''... | <filename>app/http/middleware/LoadUserMiddleware.py
''' Load User Middleware'''
from masonite.facades.Auth import Auth
class LoadUserMiddleware:
''' Middleware class which loads the current user into the request '''
def __init__(self, Request):
''' Inject Any Dependencies From The Service Container ''... | en | 0.835581 | Load User Middleware Middleware class which loads the current user into the request Inject Any Dependencies From The Service Container Run This Middleware Before The Route Executes Run This Middleware After The Route Executes Load user into the request | 3.05054 | 3 |
src/unittest/python/merciful_elo_limit_tests.py | mgaertne/minqlx-plugin-tests | 4 | 1927 | <reponame>mgaertne/minqlx-plugin-tests
from minqlx_plugin_test import *
import logging
import unittest
from mockito import *
from mockito.matchers import *
from hamcrest import *
from redis import Redis
from merciful_elo_limit import *
class MercifulEloLimitTests(unittest.TestCase):
def setUp(self):
... | from minqlx_plugin_test import *
import logging
import unittest
from mockito import *
from mockito.matchers import *
from hamcrest import *
from redis import Redis
from merciful_elo_limit import *
class MercifulEloLimitTests(unittest.TestCase):
def setUp(self):
setup_plugin()
setup_cvars({
... | none | 1 | 2.216389 | 2 | |
meiduo_mall/celery_tasks/sms/tasks.py | Vent-Any/meiduo_mall_cangku | 0 | 1928 | from ronglian_sms_sdk import SmsSDK
from celery_tasks.main import app
# 写我们的任务(函数)
# 任务必须要celery的实例对象装饰器task装饰
# 任务包的任务需要celery调用自检检查函数。(在main里面写。)
@app.task
def celery_send_sms_code(mobile, sms_code):
accId = '<KEY>'
accToken = '514a8783b8c2481ebbeb6a814434796f'
appId = '<KEY>'
# 9.1. 创建荣联云 实例对象
... | from ronglian_sms_sdk import SmsSDK
from celery_tasks.main import app
# 写我们的任务(函数)
# 任务必须要celery的实例对象装饰器task装饰
# 任务包的任务需要celery调用自检检查函数。(在main里面写。)
@app.task
def celery_send_sms_code(mobile, sms_code):
accId = '<KEY>'
accToken = '514a8783b8c2481ebbeb6a814434796f'
appId = '<KEY>'
# 9.1. 创建荣联云 实例对象
... | zh | 0.960847 | # 写我们的任务(函数) # 任务必须要celery的实例对象装饰器task装饰 # 任务包的任务需要celery调用自检检查函数。(在main里面写。) # 9.1. 创建荣联云 实例对象 # 我们发送短信的模板,值 只能是 1 因为我们是测试用户 # '手机号1,手机号2' 给哪些手机号发送验证码,只能是测试手机号 # ('变量1', '变量2') 涉及到模板的变量 # 您的验证码为{1},请于{2} 分钟内输入 # 您的验证码为666999,请于5 分钟内输入 # 9.2. 发送短信 | 1.88997 | 2 |
delphiIDE.py | JeisonJHA/Plugins-Development | 0 | 1929 | import sublime_plugin
class MethodDeclaration(object):
"""docstring for MethodDeclaration"""
def __init__(self):
self._methodclass = None
self.has_implementation = False
self.has_interface = False
@property
def has_implementation(self):
return self._has_implementation... | import sublime_plugin
class MethodDeclaration(object):
"""docstring for MethodDeclaration"""
def __init__(self):
self._methodclass = None
self.has_implementation = False
self.has_interface = False
@property
def has_implementation(self):
return self._has_implementation... | en | 0.433983 | docstring for MethodDeclaration docstring for ClassDeclaration # // { "keys": ["ctrl+shift+x"], "command": "delphi_ide", "args": {"teste": "delphimethodnav"}} # view.window().run_command('show_panel', # args={"panel": 'output.find_results', "toggle": True}) # exit because it is not in a method # has_implementation # ha... | 2.51042 | 3 |
python/test_pip_package.py | syt123450/tfjs-converter | 0 | 1930 | # Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | # Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | en | 0.771218 | # Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s... | 2.157297 | 2 |
script.ezclean/resources/lib/modules/skinz.py | rrosajp/script.ezclean | 5 | 1931 | <reponame>rrosajp/script.ezclean<gh_stars>1-10
# -*- coding: UTF-8 -*-
import os, re, shutil, time, xbmc
from resources.lib.modules import control
try: import json as simplejson
except: import simplejson
ADDONS = os.path.join(control.HOMEPATH, 'addons')
def currSkin():
return control.skin
def getOld(old):
... | # -*- coding: UTF-8 -*-
import os, re, shutil, time, xbmc
from resources.lib.modules import control
try: import json as simplejson
except: import simplejson
ADDONS = os.path.join(control.HOMEPATH, 'addons')
def currSkin():
return control.skin
def getOld(old):
try:
old = '"%s"' % old
quer... | en | 0.222803 | # -*- coding: UTF-8 -*- | 2.331152 | 2 |
pyhap/characteristic.py | bdraco/HAP-python | 0 | 1932 | <filename>pyhap/characteristic.py
"""
All things for a HAP characteristic.
A Characteristic is the smallest unit of the smart home, e.g.
a temperature measuring or a device status.
"""
import logging
from pyhap.const import (
HAP_PERMISSION_READ,
HAP_REPR_DESC,
HAP_REPR_FORMAT,
HAP_REPR_IID,
HAP_R... | <filename>pyhap/characteristic.py
"""
All things for a HAP characteristic.
A Characteristic is the smallest unit of the smart home, e.g.
a temperature measuring or a device status.
"""
import logging
from pyhap.const import (
HAP_PERMISSION_READ,
HAP_REPR_DESC,
HAP_REPR_FORMAT,
HAP_REPR_IID,
HAP_R... | en | 0.733667 | All things for a HAP characteristic. A Characteristic is the smallest unit of the smart home, e.g. a temperature measuring or a device status. # ### HAP Format ### # ### HAP Units ### # ### Properties ### Generic exception class for characteristic errors. Represents a HAP characteristic, the smallest unit of the smart... | 2.703502 | 3 |
configs/_base_/datasets/uniter/vqa_dataset_uniter.py | linxi1158/iMIX | 23 | 1933 | <filename>configs/_base_/datasets/uniter/vqa_dataset_uniter.py<gh_stars>10-100
dataset_type = 'UNITER_VqaDataset'
data_root = '/home/datasets/mix_data/UNITER/VQA/'
train_datasets = ['train']
test_datasets = ['minival'] # name not in use, but have defined one to run
vqa_cfg = dict(
train_txt_dbs=[
data_ro... | <filename>configs/_base_/datasets/uniter/vqa_dataset_uniter.py<gh_stars>10-100
dataset_type = 'UNITER_VqaDataset'
data_root = '/home/datasets/mix_data/UNITER/VQA/'
train_datasets = ['train']
test_datasets = ['minival'] # name not in use, but have defined one to run
vqa_cfg = dict(
train_txt_dbs=[
data_ro... | en | 0.907431 | # name not in use, but have defined one to run # 5120, # 10240, | 1.552538 | 2 |
students/k3340/laboratory_works/laboratory_works/Arlakov_Denis/laboratiry_work_2_and_3/lab/django-react-ecommerce-master/home/urls.py | TonikX/ITMO_ICT_-WebProgramming_2020 | 10 | 1934 | from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path, include, re_path
from django.views.generic import TemplateView
urlpatterns = [
path('api-auth/', include('rest_framework.urls')),
path('rest-auth/', include('rest_auth.urls... | from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path, include, re_path
from django.views.generic import TemplateView
urlpatterns = [
path('api-auth/', include('rest_framework.urls')),
path('rest-auth/', include('rest_auth.urls... | none | 1 | 1.725477 | 2 | |
20200416_Socialmail/mailserverUi.py | karta1782310/python-docx-automated-report-generation | 0 | 1935 | #!/bin/bash
# -*- coding: UTF-8 -*-
# 基本控件都在这里面
from PyQt5.QtWebEngineWidgets import QWebEngineView
from PyQt5.QtWidgets import (QApplication, QMainWindow, QWidget, QGridLayout, QMessageBox, QFileDialog,
QLabel, QLineEdit, QPushButton, QComboBox, QCheckBox, QDateTimeEdit,
... | #!/bin/bash
# -*- coding: UTF-8 -*-
# 基本控件都在这里面
from PyQt5.QtWebEngineWidgets import QWebEngineView
from PyQt5.QtWidgets import (QApplication, QMainWindow, QWidget, QGridLayout, QMessageBox, QFileDialog,
QLabel, QLineEdit, QPushButton, QComboBox, QCheckBox, QDateTimeEdit,
... | zh | 0.588967 | #!/bin/bash # -*- coding: UTF-8 -*- # 基本控件都在这里面 # self.resize(720,500) # self.sub_win = SubWindow() # 默認狀態欄 # 標題欄 # 窗口透明度 QComboBox::item:checked { height: 12px; border: 1px solid #32414B; margin-top: 0px; margin-bottom: 0px; padding: 4px; ... | 2.276778 | 2 |
nntools/layers/corrmm.py | 317070/nntools | 0 | 1936 | """
GpuCorrMM-based convolutional layers
"""
import numpy as np
import theano
import theano.tensor as T
from theano.sandbox.cuda.basic_ops import gpu_contiguous
from theano.sandbox.cuda.blas import GpuCorrMM
from .. import init
from .. import nonlinearities
from . import base
# base class for all layers that rely ... | """
GpuCorrMM-based convolutional layers
"""
import numpy as np
import theano
import theano.tensor as T
from theano.sandbox.cuda.basic_ops import gpu_contiguous
from theano.sandbox.cuda.blas import GpuCorrMM
from .. import init
from .. import nonlinearities
from . import base
# base class for all layers that rely ... | en | 0.846072 | GpuCorrMM-based convolutional layers # base class for all layers that rely on GpuCorrMM directly # no option specified, default to valid mode # only works for odd filter size, but the even filter size case is probably not worth supporting. # flip width, height | 2.710877 | 3 |
tests/python/correctness/simple_test_aux_index.py | dubey/weaver | 163 | 1937 | <filename>tests/python/correctness/simple_test_aux_index.py
#! /usr/bin/env python
#
# ===============================================================
# Description: Sanity check for fresh install.
#
# Created: 2014-08-12 16:42:52
#
# Author: <NAME>, <EMAIL>
#
# Copyright (C) 2013, Cornell Uni... | <filename>tests/python/correctness/simple_test_aux_index.py
#! /usr/bin/env python
#
# ===============================================================
# Description: Sanity check for fresh install.
#
# Created: 2014-08-12 16:42:52
#
# Author: <NAME>, <EMAIL>
#
# Copyright (C) 2013, Cornell Uni... | en | 0.734534 | #! /usr/bin/env python # # =============================================================== # Description: Sanity check for fresh install. # # Created: 2014-08-12 16:42:52 # # Author: <NAME>, <EMAIL> # # Copyright (C) 2013, Cornell University, see the LICENSE file # for licensing... | 2.097785 | 2 |
ldtools/helpers.py | dmr/Ldtools | 3 | 1938 | <reponame>dmr/Ldtools<gh_stars>1-10
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
try:
unicode
except NameError:
basestring = unicode = str # Python 3
import logging
import rdflib
from rdflib import compare
logger = logging.getLogger("ldtools")
RESET_SEQ = "\033[0m"
COLOR_... | # -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
try:
unicode
except NameError:
basestring = unicode = str # Python 3
import logging
import rdflib
from rdflib import compare
logger = logging.getLogger("ldtools")
RESET_SEQ = "\033[0m"
COLOR_SEQ = "\033[1;%dm"
BOLD_SEQ = "\033[... | en | 0.889001 | # -*- coding: utf-8 -*- # Python 3 # The background is set with 40 plus the number of the color, and # the foreground with 30 # These are the sequences need to get colored ouput Compares graph2 to graph1 and highlights everything that changed. Colored if pygments available # quick fix for wrong type # Return if bot... | 2.231202 | 2 |
fakenet/diverters/debuglevels.py | AzzOnFire/flare-fakenet-ng | 0 | 1939 | # Debug print levels for fine-grained debug trace output control
DNFQUEUE = (1 << 0) # netfilterqueue
DGENPKT = (1 << 1) # Generic packet handling
DGENPKTV = (1 << 2) # Generic packet handling with TCP analysis
DCB = (1 << 3) # Packet handlign callbacks
DPROCFS = (1 << 4) # procfs
DIPTBLS = (... | # Debug print levels for fine-grained debug trace output control
DNFQUEUE = (1 << 0) # netfilterqueue
DGENPKT = (1 << 1) # Generic packet handling
DGENPKTV = (1 << 2) # Generic packet handling with TCP analysis
DCB = (1 << 3) # Packet handlign callbacks
DPROCFS = (1 << 4) # procfs
DIPTBLS = (... | en | 0.624543 | # Debug print levels for fine-grained debug trace output control # netfilterqueue # Generic packet handling # Generic packet handling with TCP analysis # Packet handlign callbacks # procfs # iptables # Nonlocal-destined datagrams # DPF (Dynamic Port Forwarding) # DPF (Dynamic Port Forwarding) Verbose # IP redirection f... | 2.18009 | 2 |
multichannel_lstm/train.py | zhr1201/Multi-channel-speech-extraction-using-DNN | 65 | 1940 | <filename>multichannel_lstm/train.py
'''
Script for training the model
'''
import tensorflow as tf
import numpy as np
from input import BatchGenerator
from model import MultiRnn
import time
from datetime import datetime
import os
import matplotlib as mpl
mpl.use('Agg')
from matplotlib import pyplot as plt
sum_dir = '... | <filename>multichannel_lstm/train.py
'''
Script for training the model
'''
import tensorflow as tf
import numpy as np
from input import BatchGenerator
from model import MultiRnn
import time
from datetime import datetime
import os
import matplotlib as mpl
mpl.use('Agg')
from matplotlib import pyplot as plt
sum_dir = '... | en | 0.772899 | Script for training the model # dir to write summary # dir to store the model # dir of the data set # effective FFT points # build the model # input data and referene data placeholder # make inference # compute loss # generator for epoch data # generator for batch data # training the net | 2.81616 | 3 |
python_modules/dagster/dagster/daemon/cli/__init__.py | elsenorbw/dagster | 0 | 1941 | <reponame>elsenorbw/dagster
import os
import sys
import threading
import time
import warnings
from contextlib import ExitStack
import click
import pendulum
from dagster import __version__
from dagster.core.instance import DagsterInstance
from dagster.daemon.controller import (
DEFAULT_DAEMON_HEARTBEAT_TOLERANCE_SE... | import os
import sys
import threading
import time
import warnings
from contextlib import ExitStack
import click
import pendulum
from dagster import __version__
from dagster.core.instance import DagsterInstance
from dagster.daemon.controller import (
DEFAULT_DAEMON_HEARTBEAT_TOLERANCE_SECONDS,
DagsterDaemonCont... | de | 0.355891 | # pylint:disable=E1123 | 2.143377 | 2 |
tests/exhaustive/nfl_tests.py | atklaus/sportsreference | 1 | 1942 | <filename>tests/exhaustive/nfl_tests.py
import sys, os
sys.path.append(os.path.dirname(os.path.dirname(sys.path[0])))
from sportsreference.nfl.teams import Teams
for team in Teams():
print(team.name)
for player in team.roster.players:
print(player.name)
for game in team.schedule:
print(game... | <filename>tests/exhaustive/nfl_tests.py
import sys, os
sys.path.append(os.path.dirname(os.path.dirname(sys.path[0])))
from sportsreference.nfl.teams import Teams
for team in Teams():
print(team.name)
for player in team.roster.players:
print(player.name)
for game in team.schedule:
print(game... | none | 1 | 2.783279 | 3 | |
rust-old/python/examples/map_fields.py | SerebryakovMA/quelea | 3 | 1943 | import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import sys
sys.path.append("../")
from quelea import *
nx = 217
ny = 133
x0 = 0
x1 = 30 # lambdas
y0 = 0
y1 = 20 # lambdas
xs = np.linspace(x0, x1, nx)
ys = np.linspace(y0, y1, ny)
# 2d array of (x, y, z, t)
coords = np.array( [ [x, y, 0, 0] for ... | import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import sys
sys.path.append("../")
from quelea import *
nx = 217
ny = 133
x0 = 0
x1 = 30 # lambdas
y0 = 0
y1 = 20 # lambdas
xs = np.linspace(x0, x1, nx)
ys = np.linspace(y0, y1, ny)
# 2d array of (x, y, z, t)
coords = np.array( [ [x, y, 0, 0] for ... | en | 0.638919 | # lambdas # lambdas # 2d array of (x, y, z, t) # for map_fields function this should be converted from 2D to 1D array # plane wave # normalized field amplitude # frequency # parameters of the plane wave # now convert to 2d arrays | 2.394049 | 2 |
test.py | t-kaichi/hyperspoof | 10 | 1944 | <gh_stars>1-10
import os
from absl import app
from absl import flags
import numpy as np
import tqdm
from tensorflow.keras import Model
from albumentations import (
Compose, HorizontalFlip, RandomBrightness,RandomContrast,
ShiftScaleRotate, ToFloat, VerticalFlip)
from utils import reset_tf
from eval_utils impo... | import os
from absl import app
from absl import flags
import numpy as np
import tqdm
from tensorflow.keras import Model
from albumentations import (
Compose, HorizontalFlip, RandomBrightness,RandomContrast,
ShiftScaleRotate, ToFloat, VerticalFlip)
from utils import reset_tf
from eval_utils import calc_score_v... | en | 0.711257 | # spoof file path # "04": replay # dataset generation # cv2.BORDER_REFLECT_101 # build and load models # variance of the penultimate features # process live images # process spoof images # spoof label: 10000 # calculate accuracy # save results | 1.854448 | 2 |
generator/apps.py | TheJacksonLaboratory/jaxid_generator | 2 | 1945 | from django.conf import settings
from suit import apps
from suit.apps import DjangoSuitConfig
from suit.menu import ParentItem, ChildItem
APP_NAME = settings.APP_NAME
WIKI_URL = settings.WIKI_URL
class SuitConfig(DjangoSuitConfig):
name = 'suit'
verbose_name = 'Mbiome Core JAXid Generator'
site_title = '... | from django.conf import settings
from suit import apps
from suit.apps import DjangoSuitConfig
from suit.menu import ParentItem, ChildItem
APP_NAME = settings.APP_NAME
WIKI_URL = settings.WIKI_URL
class SuitConfig(DjangoSuitConfig):
name = 'suit'
verbose_name = 'Mbiome Core JAXid Generator'
site_title = '... | en | 0.306596 | # header_date_format = 'l, d-M-o' # header_time_format = 'H:i e' # menu_handler = None # Show changelist top actions only if any row is selected # # Enables two column layout for change forms with submit row on the right # Hide name/"original" column for all tabular inlines. # May be overridden in Inline class by su... | 1.898272 | 2 |
tiled-lutnet/training-software/MNIST-CIFAR-SVHN/models/MNIST/scripts/lutnet_init.py | awai54st/LUTNet | 38 | 1946 | import h5py
import numpy as np
np.set_printoptions(threshold=np.nan)
from shutil import copyfile
copyfile("dummy_lutnet.h5", "pretrained_bin.h5") # create pretrained.h5 using datastructure from dummy.h5
bl = h5py.File("baseline_pruned.h5", 'r')
#dummy = h5py.File("dummy.h5", 'r')
pretrained = h5py.File("pretrained_b... | import h5py
import numpy as np
np.set_printoptions(threshold=np.nan)
from shutil import copyfile
copyfile("dummy_lutnet.h5", "pretrained_bin.h5") # create pretrained.h5 using datastructure from dummy.h5
bl = h5py.File("baseline_pruned.h5", 'r')
#dummy = h5py.File("dummy.h5", 'r')
pretrained = h5py.File("pretrained_b... | en | 0.44501 | # create pretrained.h5 using datastructure from dummy.h5 #dummy = h5py.File("dummy.h5", 'r') # dense layer 1 # dense layer 2 # randomisation and pruning recovery # expand randomisation map across tiles # connect1 only # dense layer 3 # randomisation and pruning recovery # expand randomisation map across tiles # connect... | 2.268347 | 2 |
pkgs/nltk-3.2-py27_0/lib/python2.7/site-packages/nltk/classify/weka.py | wangyum/anaconda | 0 | 1947 | <reponame>wangyum/anaconda
# Natural Language Toolkit: Interface to Weka Classsifiers
#
# Copyright (C) 2001-2015 NLTK Project
# Author: <NAME> <<EMAIL>>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
"""
Classifiers that make use of the external 'Weka' package.
"""
from __future__ impo... | # Natural Language Toolkit: Interface to Weka Classsifiers
#
# Copyright (C) 2001-2015 NLTK Project
# Author: <NAME> <<EMAIL>>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
"""
Classifiers that make use of the external 'Weka' package.
"""
from __future__ import print_function
import t... | en | 0.658551 | # Natural Language Toolkit: Interface to Weka Classsifiers # # Copyright (C) 2001-2015 NLTK Project # Author: <NAME> <<EMAIL>> # URL: <http://nltk.org/> # For license information, see LICENSE.TXT Classifiers that make use of the external 'Weka' package. # Make sure java's configured first. # Make sure we can find java ... | 2.307812 | 2 |
src/si/data/dataset.py | pg428/SIB | 0 | 1948 | import pandas as pd
import numpy as np
from src.si.util.util import label_gen
__all__ = ['Dataset']
class Dataset:
def __init__(self, X=None, Y=None,
xnames: list = None,
yname: str = None):
""" Tabular Dataset"""
if X is None:
raise Exception("Trying ... | import pandas as pd
import numpy as np
from src.si.util.util import label_gen
__all__ = ['Dataset']
class Dataset:
def __init__(self, X=None, Y=None,
xnames: list = None,
yname: str = None):
""" Tabular Dataset"""
if X is None:
raise Exception("Trying ... | en | 0.383593 | Tabular Dataset Creates a DataSet from a data file. :param filename: The filename :type filename: str :param sep: attributes separator, defaults to "," :type sep: str, optional :return: A DataSet object :rtype: DataSet Creates a DataSet from a pandas dataframe. :... | 3.388072 | 3 |
stubs/m5stack_flowui-1_4_0-beta/display.py | RonaldHiemstra/micropython-stubs | 38 | 1949 | <reponame>RonaldHiemstra/micropython-stubs
"""
Module: 'display' on M5 FlowUI v1.4.0-beta
"""
# MCU: (sysname='esp32', nodename='esp32', release='1.11.0', version='v1.11-284-g5d8e1c867 on 2019-08-30', machine='ESP32 module with ESP32')
# Stubber: 1.3.1
class TFT:
''
BLACK = 0
BLUE = 255
BMP = 2
BOT... | """
Module: 'display' on M5 FlowUI v1.4.0-beta
"""
# MCU: (sysname='esp32', nodename='esp32', release='1.11.0', version='v1.11-284-g5d8e1c867 on 2019-08-30', machine='ESP32 module with ESP32')
# Stubber: 1.3.1
class TFT:
''
BLACK = 0
BLUE = 255
BMP = 2
BOTTOM = -9004
CENTER = -9003
COLOR_BI... | en | 0.138132 | Module: 'display' on M5 FlowUI v1.4.0-beta # MCU: (sysname='esp32', nodename='esp32', release='1.11.0', version='v1.11-284-g5d8e1c867 on 2019-08-30', machine='ESP32 module with ESP32') # Stubber: 1.3.1 | 1.980807 | 2 |
dbclient/__init__.py | dmoore247/db-migration | 0 | 1950 | import json, requests, datetime
from cron_descriptor import get_description
from .dbclient import dbclient
from .JobsClient import JobsClient
from .ClustersClient import ClustersClient
from .WorkspaceClient import WorkspaceClient
from .ScimClient import ScimClient
from .LibraryClient import LibraryClient
from .HiveCli... | import json, requests, datetime
from cron_descriptor import get_description
from .dbclient import dbclient
from .JobsClient import JobsClient
from .ClustersClient import ClustersClient
from .WorkspaceClient import WorkspaceClient
from .ScimClient import ScimClient
from .LibraryClient import LibraryClient
from .HiveCli... | none | 1 | 1.110699 | 1 | |
UI/ControlSlider/__init__.py | peerke88/SkinningTools | 7 | 1951 | <filename>UI/ControlSlider/__init__.py
# -*- coding: utf-8 -*-
# SkinWeights command and component editor
# Copyright (C) 2018 <NAME>
# Website: http://www.trevorius.com
#
# pyqt attribute sliders
# Copyright (C) 2018 <NAME>
# Website: http://danieleniero.com/
#
# neighbour finding algorythm
# Copyright (C) 2... | <filename>UI/ControlSlider/__init__.py
# -*- coding: utf-8 -*-
# SkinWeights command and component editor
# Copyright (C) 2018 <NAME>
# Website: http://www.trevorius.com
#
# pyqt attribute sliders
# Copyright (C) 2018 <NAME>
# Website: http://danieleniero.com/
#
# neighbour finding algorythm
# Copyright (C) 2... | en | 0.705921 | # -*- coding: utf-8 -*- # SkinWeights command and component editor # Copyright (C) 2018 <NAME> # Website: http://www.trevorius.com # # pyqt attribute sliders # Copyright (C) 2018 <NAME> # Website: http://danieleniero.com/ # # neighbour finding algorythm # Copyright (C) 2018 <NAME> # Website: http://www.janpijpers.com/ ... | 1.514337 | 2 |
homeassistant/components/fritz/sensor.py | EuleMitKeule/core | 3 | 1952 | <reponame>EuleMitKeule/core
"""AVM FRITZ!Box binary sensors."""
from __future__ import annotations
from collections.abc import Callable
from dataclasses import dataclass
from datetime import datetime, timedelta
import logging
from typing import Any, Literal
from fritzconnection.core.exceptions import (
FritzActio... | """AVM FRITZ!Box binary sensors."""
from __future__ import annotations
from collections.abc import Callable
from dataclasses import dataclass
from datetime import datetime, timedelta
import logging
from typing import Any, Literal
from fritzconnection.core.exceptions import (
FritzActionError,
FritzActionFaile... | en | 0.618049 | AVM FRITZ!Box binary sensors. Calculate uptime with deviation. Return uptime from device. Return uptime from connection. Return external ip from device. # type: ignore[no-any-return] Return upload transmission rate. # type: ignore[no-any-return] Return download transmission rate. # type: ignore[no-any-return] Return up... | 2.150911 | 2 |
Ifc/IfcBase.py | gsimon75/IFC_parser | 28 | 1953 | from Ifc.ClassRegistry import ifc_class, ifc_abstract_class, ifc_fallback_class
@ifc_abstract_class
class IfcEntity:
"""
Generic IFC entity, only for subclassing from it
"""
def __init__(self, rtype, args):
"""
rtype: Resource type
args: Arguments in *reverse* order, so you can... | from Ifc.ClassRegistry import ifc_class, ifc_abstract_class, ifc_fallback_class
@ifc_abstract_class
class IfcEntity:
"""
Generic IFC entity, only for subclassing from it
"""
def __init__(self, rtype, args):
"""
rtype: Resource type
args: Arguments in *reverse* order, so you can... | en | 0.887008 | Generic IFC entity, only for subclassing from it rtype: Resource type args: Arguments in *reverse* order, so you can just args.pop() from it Generic IFC entity: type and args Marked with '*' it states that some supertype had defined that attribute, but in the subtype it is a derived (calculated) value, so i... | 2.704908 | 3 |
middleware/io-monitor/recipes-common/io-monitor/io-monitor/io_monitor/utils/data_collector.py | xe1gyq/stx-utils | 0 | 1954 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (c) 2016 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
import logging
import os
from io_monitor.constants import DOMAIN
from io_monitor.utils.data_window import DataCollectionWindow
LOG = logging.getLogger(DOMAIN)
class DeviceDataCollec... | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (c) 2016 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
import logging
import os
from io_monitor.constants import DOMAIN
from io_monitor.utils.data_window import DataCollectionWindow
LOG = logging.getLogger(DOMAIN)
class DeviceDataCollec... | en | 0.537808 | # vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright (c) 2016 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # # Moving average windows # Device status # Data tracked # Bail if threshold is not set # Set the congestion status based on await moving average # LOG.debug("%s: e = %s, v= %f" % (self.n... | 2.043055 | 2 |
examples/language-modeling/debias_lm_hps_tune.py | SoumyaBarikeri/transformers | 1 | 1955 | <filename>examples/language-modeling/debias_lm_hps_tune.py
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file ex... | <filename>examples/language-modeling/debias_lm_hps_tune.py
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file ex... | en | 0.63805 | # coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA 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 cop... | 1.918824 | 2 |
checksums.py | pgp/RootHelperClientTestInteractions | 1 | 1956 | from net_common import *
import struct
import sys
def getDirHashOpts(withNames=False,
ignoreThumbsFiles=True,
ignoreUnixHiddenFiles=True,
ignoreEmptyDirs=True):
return bytearray([((1 if withNames else 0) +
(2 if ignoreThumbsFiles else ... | from net_common import *
import struct
import sys
def getDirHashOpts(withNames=False,
ignoreThumbsFiles=True,
ignoreUnixHiddenFiles=True,
ignoreEmptyDirs=True):
return bytearray([((1 if withNames else 0) +
(2 if ignoreThumbsFiles else ... | en | 0.432286 | # path = encodeString('/dev/null') # HASH request # sock.sendall(bytearray(b'\x01')) # choose MD5 algorithm # choose SHA3-224 algorithm # send dirHashOpts byte (unused for regular files) # len of path as unsigned short # response first byte: \x00 OK or \xFF ERROR # print(toHex(sock.recv(16))) # 128 bit (16 byte) md5 d... | 2.073346 | 2 |
investment_report/migrations/0020_auto_20180911_1005.py | uktrade/pir-api | 1 | 1957 | <filename>investment_report/migrations/0020_auto_20180911_1005.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-09-11 10:05
from __future__ import unicode_literals
import config.s3
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('investme... | <filename>investment_report/migrations/0020_auto_20180911_1005.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-09-11 10:05
from __future__ import unicode_literals
import config.s3
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('investme... | en | 0.654961 | # -*- coding: utf-8 -*- # Generated by Django 1.11.13 on 2018-09-11 10:05 | 1.38919 | 1 |
tests/test-scripts/threadpools.py | whalesalad/filprofiler | 521 | 1958 | <gh_stars>100-1000
"""Validate that number of threads in thread pools is set to 1."""
import numexpr
import blosc
import threadpoolctl
# APIs that return previous number of threads:
assert numexpr.set_num_threads(2) == 1
assert blosc.set_nthreads(2) == 1
for d in threadpoolctl.threadpool_info():
assert d["num_th... | """Validate that number of threads in thread pools is set to 1."""
import numexpr
import blosc
import threadpoolctl
# APIs that return previous number of threads:
assert numexpr.set_num_threads(2) == 1
assert blosc.set_nthreads(2) == 1
for d in threadpoolctl.threadpool_info():
assert d["num_threads"] == 1, d | en | 0.953737 | Validate that number of threads in thread pools is set to 1. # APIs that return previous number of threads: | 2.679875 | 3 |
scripts/viewStokespat.py | David-McKenna/AntPat | 5 | 1959 | <gh_stars>1-10
#!/usr/bin/env python
"""A simple viewer for Stokes patterns based on two far-field pattern files.
(Possibly based on one FF pattern files if it has two requests: one for each
polarization channel.)"""
import os
import argparse
import numpy
import matplotlib.pyplot as plt
from antpat.reps.sphgridfun.tvec... | #!/usr/bin/env python
"""A simple viewer for Stokes patterns based on two far-field pattern files.
(Possibly based on one FF pattern files if it has two requests: one for each
polarization channel.)"""
import os
import argparse
import numpy
import matplotlib.pyplot as plt
from antpat.reps.sphgridfun.tvecfun import TVec... | en | 0.758091 | #!/usr/bin/env python A simple viewer for Stokes patterns based on two far-field pattern files. (Possibly based on one FF pattern files if it has two requests: one for each polarization channel.) Convert Jones matrix to Stokes vector. This assumes dual-pol antenna receiving unpolarized unit valued radiation i.e. in... | 2.560165 | 3 |
utils.py | lingjiao10/Facial-Expression-Recognition.Pytorch | 0 | 1960 | '''Some helper functions for PyTorch, including:
- progress_bar: progress bar mimic xlua.progress.
- set_lr : set the learning rate
- clip_gradient : clip gradient
'''
import os
import sys
import time
import math
import torch
import torch.nn as nn
import torch.nn.init as init
from torch.autogr... | '''Some helper functions for PyTorch, including:
- progress_bar: progress bar mimic xlua.progress.
- set_lr : set the learning rate
- clip_gradient : clip gradient
'''
import os
import sys
import time
import math
import torch
import torch.nn as nn
import torch.nn.init as init
from torch.autogr... | en | 0.36743 | Some helper functions for PyTorch, including:
- progress_bar: progress bar mimic xlua.progress.
- set_lr : set the learning rate
- clip_gradient : clip gradient #获取控制台行、列数 ##', os.popen('stty size', 'r').read()) #[==>........ 19/225 ...........] | Loss: 1.961 | Acc: 22.000% (537/2432) # Reset for new bar... | 2.859169 | 3 |
string-method/src/analysis/FE_analysis/index_converter.py | delemottelab/gpcr-string-method-2019 | 0 | 1961 | from __future__ import absolute_import, division, print_function
import logging
import sys
logging.basicConfig(
stream=sys.stdout,
level=logging.DEBUG,
format='%(asctime)s %(name)s-%(levelname)s: %(message)s',
datefmt='%Y-%m-%d %H:%M:%S')
import numpy as np
import utils
logger = logging.getLogger("ind... | from __future__ import absolute_import, division, print_function
import logging
import sys
logging.basicConfig(
stream=sys.stdout,
level=logging.DEBUG,
format='%(asctime)s %(name)s-%(levelname)s: %(message)s',
datefmt='%Y-%m-%d %H:%M:%S')
import numpy as np
import utils
logger = logging.getLogger("ind... | none | 1 | 2.259306 | 2 | |
Ex029 Aula 11-Cores no Terminal.py | andersontmachado/ExerciciosPython | 1 | 1962 | <gh_stars>1-10
print('\033[7;30mOla mundo\033[m!!!')
| print('\033[7;30mOla mundo\033[m!!!') | none | 1 | 1.793048 | 2 | |
cirq-pasqal/cirq_pasqal/pasqal_device.py | pavoljuhas/Cirq | 1 | 1963 | # Copyright 2020 The Cirq Developers
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | # Copyright 2020 The Cirq Developers
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | en | 0.834004 | # Copyright 2020 The Cirq Developers # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ... | 2.110378 | 2 |
command_line/show.py | huwjenkins/dials | 0 | 1964 | <reponame>huwjenkins/dials
import os
import sys
import numpy as np
import iotbx.phil
from cctbx import uctbx
from dxtbx.model.experiment_list import ExperimentListFactory
from scitbx.math import five_number_summary
import dials.util
from dials.array_family import flex
from dials.util import Sorry, tabulate
help_mes... | import os
import sys
import numpy as np
import iotbx.phil
from cctbx import uctbx
from dxtbx.model.experiment_list import ExperimentListFactory
from scitbx.math import five_number_summary
import dials.util
from dials.array_family import flex
from dials.util import Sorry, tabulate
help_message = """
Examples::
d... | en | 0.704521 | Examples:: dials.show models.expt dials.show image_*.cbf dials.show observations.refl \ show_scan_varying = False .type = bool .help = "Whether or not to show the crystal at each scan point." show_shared_models = False .type = bool .help = "Show which models are linked to which experiments" show_all_re... | 2.210662 | 2 |
app/config/env_jesa.py | OuissalTAIM/jenkins | 0 | 1965 | # -*- coding: utf-8 -*-
from enum import Enum, IntEnum, unique
import os
APP_NAME = "mine2farm"
NETWORK_NAME = "CenterAxis"
LOG_LEVEL_CONSOLE = "WARNING"
LOG_LEVEL_FILE = "INFO"
APP_FOLDER = os.getenv("JESA_MINE2FARM_HOME", "C:/GitRepos/mine2farm/")
LOG_FOLDER = APP_FOLDER + "app/log/"
LOG_FILE = "%(asctime)_" + AP... | # -*- coding: utf-8 -*-
from enum import Enum, IntEnum, unique
import os
APP_NAME = "mine2farm"
NETWORK_NAME = "CenterAxis"
LOG_LEVEL_CONSOLE = "WARNING"
LOG_LEVEL_FILE = "INFO"
APP_FOLDER = os.getenv("JESA_MINE2FARM_HOME", "C:/GitRepos/mine2farm/")
LOG_FOLDER = APP_FOLDER + "app/log/"
LOG_FILE = "%(asctime)_" + AP... | en | 0.544605 | # -*- coding: utf-8 -*- # DB # Results # RabbitMQ # Memcached # Dashboard # Monitoring # Mongodb-bi # Mongodb # params # Model | 2.086239 | 2 |
myFirstApp/travello/models.py | cankush625/Django | 0 | 1966 | from django.db import models
# Create your models here.
class Destination(models.Model) :
name = models.CharField(max_length = 100)
img = models.ImageField(upload_to = 'pics')
desc = models.TextField()
price = models.IntegerField()
offer = models.BooleanField(default = False)
class News()... | from django.db import models
# Create your models here.
class Destination(models.Model) :
name = models.CharField(max_length = 100)
img = models.ImageField(upload_to = 'pics')
desc = models.TextField()
price = models.IntegerField()
offer = models.BooleanField(default = False)
class News()... | en | 0.963489 | # Create your models here. | 2.265057 | 2 |
app/app.py | Moustique-bot/hands-on-2021 | 0 | 1967 | import base64
import io
import dash
import dash_core_components as dcc
import dash_html_components as html
import dash_bootstrap_components as dbc
from dash.dependencies import Input, Output
import numpy as np
import tensorflow as tf
from PIL import Image
from constants import CLASSES
import yaml
with open('app.ya... | import base64
import io
import dash
import dash_core_components as dcc
import dash_html_components as html
import dash_bootstrap_components as dbc
from dash.dependencies import Input, Output
import numpy as np
import tensorflow as tf
from PIL import Image
from constants import CLASSES
import yaml
with open('app.ya... | en | 0.37817 | # Load DNN model Classify image by model Parameters ---------- content: image content model: tf/keras classifier Returns ------- class id returned by model classifier # box argument clips image to (x1, y1, x2, y2) # Define application layout #html.Div('Raw Content'), #html.Pre(contents, style=pre_style)... | 2.427969 | 2 |
books/rakutenapi.py | NobukoYano/LibraryApp | 1 | 1968 | <gh_stars>1-10
import json
import requests
from django.conf import settings
class rakuten:
def get_json(self, isbn: str) -> dict:
appid = settings.RAKUTEN_APP_ID
# API request template
api = "https://app.rakuten.co.jp/services/api/BooksTotal/"\
"Search/20170404?format=json... | import json
import requests
from django.conf import settings
class rakuten:
def get_json(self, isbn: str) -> dict:
appid = settings.RAKUTEN_APP_ID
# API request template
api = "https://app.rakuten.co.jp/services/api/BooksTotal/"\
"Search/20170404?format=json&isbnjan={isbnj... | en | 0.378335 | # API request template # format get api URL # execute # decode to json # Check the status code # if failed | 2.493566 | 2 |
Random-Programs/optimization/root/v4.py | naumoff0/Archive | 0 | 1969 | print(int(input(""))**0.5) | print(int(input(""))**0.5) | none | 1 | 2.895113 | 3 | |
sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/_models_py3.py | rsdoherty/azure-sdk-for-python | 2,728 | 1970 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | en | 0.674584 | # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ... | 2.028133 | 2 |
school/views.py | pa-one-patel/college_managenment | 1 | 1971 | <filename>school/views.py
from django.shortcuts import render,redirect,reverse
from . import forms,models
from django.db.models import Sum
from django.contrib.auth.models import Group
from django.http import HttpResponseRedirect
from django.contrib.auth.decorators import login_required,user_passes_test
def home_view(r... | <filename>school/views.py
from django.shortcuts import render,redirect,reverse
from . import forms,models
from django.db.models import Sum
from django.contrib.auth.models import Group
from django.http import HttpResponseRedirect
from django.contrib.auth.decorators import login_required,user_passes_test
def home_view(r... | en | 0.426935 | #for showing signup/login button for teacher(by sumit) #for showing signup/login button for teacher(by sumit) #for showing signup/login button for student(by sumit) #for checking user is techer , student or admin(by sumit) #for dashboard of adminnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn(by sumit) #agg... | 2.159217 | 2 |
PaddleCV/tracking/pytracking/features/deep.py | weiwei1115/models | 2 | 1972 | <reponame>weiwei1115/models
import os
import numpy as np
from paddle import fluid
from ltr.models.bbreg.atom import atom_resnet50, atom_resnet18
from ltr.models.siamese.siam import siamfc_alexnet
from ltr.models.siam.siam import SiamRPN_AlexNet, SiamMask_ResNet50_sharp, SiamMask_ResNet50_base
from pytracking.... | import os
import numpy as np
from paddle import fluid
from ltr.models.bbreg.atom import atom_resnet50, atom_resnet18
from ltr.models.siamese.siam import siamfc_alexnet
from ltr.models.siam.siam import SiamRPN_AlexNet, SiamMask_ResNet50_sharp, SiamMask_ResNet50_base
from pytracking.admin.environment import env... | en | 0.75509 | ResNet18 feature.
args:
output_layers: List of layers to output.
net_path: Relative or absolute net path (default should be fine).
use_gpu: Use GPU or CPU. # don't use im /= 255. since we don't want to alter the input # Store the raw resnet features which are input to iounet # Store the ... | 1.966588 | 2 |
netesto/local/psPlot.py | fakeNetflix/facebook-repo-fbkutils | 346 | 1973 | #!/usr/bin/env python2
import sys
import random
import os.path
import shutil
import commands
import types
import math
#gsPath = '/usr/local/bin/gs'
gsPath = 'gs'
logFile = '/dev/null'
#logFile = 'plot.log'
#--- class PsPlot(fname, pageHeader, pageSubHeader, plotsPerPage)
#
class PsPlot(object):
def __init__(self... | #!/usr/bin/env python2
import sys
import random
import os.path
import shutil
import commands
import types
import math
#gsPath = '/usr/local/bin/gs'
gsPath = 'gs'
logFile = '/dev/null'
#logFile = 'plot.log'
#--- class PsPlot(fname, pageHeader, pageSubHeader, plotsPerPage)
#
class PsPlot(object):
def __init__(self... | en | 0.125974 | #!/usr/bin/env python2 #gsPath = '/usr/local/bin/gs' #logFile = 'plot.log' #--- class PsPlot(fname, pageHeader, pageSubHeader, plotsPerPage) # #inches # self.flog = open('./psPlot.out', 'a') #--- End() # #--- GetInc(vMin, vMax) # w = int(w/f) # if (vMax/f)%vInc != 0 or v1 % vInc != 0: #--- ValueConvert(v) # ... | 2.266492 | 2 |
physio2go/exercises/migrations/0003_auto_20161128_1753.py | hamole/physio2go | 0 | 1974 | <filename>physio2go/exercises/migrations/0003_auto_20161128_1753.py
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-11-28 06:53
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('exercises', '0002_auto_20161128_... | <filename>physio2go/exercises/migrations/0003_auto_20161128_1753.py
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-11-28 06:53
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('exercises', '0002_auto_20161128_... | en | 0.801193 | # -*- coding: utf-8 -*- # Generated by Django 1.10.3 on 2016-11-28 06:53 | 1.578215 | 2 |
setup.py | pasinskim/mender-python-client | 0 | 1975 | # Copyright 2021 Northern.tech AS
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | # Copyright 2021 Northern.tech AS
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | en | 0.847454 | # Copyright 2021 Northern.tech AS # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag... | 1.552616 | 2 |
Q295-v2.py | Linchin/python_leetcode_git | 0 | 1976 | """
295
find median from data stream
hard
"""
from heapq import *
class MedianFinder:
# max heap and min heap
def __init__(self):
"""
initialize your data structure here.
"""
self.hi = []
self.lo = []
def addNum(self, num: int) -> None:
heappush(self.lo,... | """
295
find median from data stream
hard
"""
from heapq import *
class MedianFinder:
# max heap and min heap
def __init__(self):
"""
initialize your data structure here.
"""
self.hi = []
self.lo = []
def addNum(self, num: int) -> None:
heappush(self.lo,... | en | 0.792431 | 295 find median from data stream hard # max heap and min heap initialize your data structure here. | 3.406723 | 3 |
raisimPy/examples/newtonsCradle.py | mstoelzle/raisimLib | 0 | 1977 | <reponame>mstoelzle/raisimLib
import os
import numpy as np
import raisimpy as raisim
import math
import time
raisim.World.setLicenseFile(os.path.dirname(os.path.abspath(__file__)) + "/../../rsc/activation.raisim")
world = raisim.World()
ground = world.addGround()
world.setTimeStep(0.001)
world.setMaterialPairProp("st... | import os
import numpy as np
import raisimpy as raisim
import math
import time
raisim.World.setLicenseFile(os.path.dirname(os.path.abspath(__file__)) + "/../../rsc/activation.raisim")
world = raisim.World()
ground = world.addGround()
world.setTimeStep(0.001)
world.setMaterialPairProp("steel", "steel", 0.1, 1.0, 0.0)
... | none | 1 | 1.859242 | 2 | |
nova/virt/hyperv/volumeops.py | viveknandavanam/nova | 1 | 1978 | <gh_stars>1-10
# Copyright 2012 <NAME>
# Copyright 2013 Cloudbase Solutions Srl
# 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.o... | # Copyright 2012 <NAME>
# Copyright 2013 Cloudbase Solutions Srl
# 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/LIC... | en | 0.874432 | # Copyright 2012 <NAME> # Copyright 2013 Cloudbase Solutions Srl # 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/LIC... | 1.635837 | 2 |
-Loan-Approval-Analysis/code.py | lakshit-sharma/greyatom-python-for-data-science | 0 | 1979 | # --------------
# Importing header files
import numpy as np
import pandas as pd
from scipy.stats import mode
# code starts here
bank = pd.read_csv(path)
categorical_var = bank.select_dtypes(include = 'object')
print(categorical_var)
numerical_var = bank.select_dtypes(include = 'number')
print(numeric... | # --------------
# Importing header files
import numpy as np
import pandas as pd
from scipy.stats import mode
# code starts here
bank = pd.read_csv(path)
categorical_var = bank.select_dtypes(include = 'object')
print(categorical_var)
numerical_var = bank.select_dtypes(include = 'number')
print(numeric... | en | 0.673908 | # -------------- # Importing header files # code starts here # loan amount term # Check the mean value # code ends here | 3.037436 | 3 |
others/train_RNN.py | jacobswan1/Video2Commonsense | 31 | 1980 | <filename>others/train_RNN.py
''' Training Scropt for V2C captioning task. '''
__author__ = '<NAME>'
import os
import numpy as np
from opts import *
from utils.utils import *
import torch.optim as optim
from model.Model import Model
from torch.utils.data import DataLoader
from utils.dataloader import VideoDataset
fro... | <filename>others/train_RNN.py
''' Training Scropt for V2C captioning task. '''
__author__ = '<NAME>'
import os
import numpy as np
from opts import *
from utils.utils import *
import torch.optim as optim
from model.Model import Model
from torch.utils.data import DataLoader
from utils.dataloader import VideoDataset
fro... | en | 0.78833 | Training Scropt for V2C captioning task. # cap_probs, cms_probs = model(fc_feats, cap_labels, cap_pos, cms_labels, cms_pos) # note: currently we just used most naive cross-entropy as training objective, # advanced loss func. like SELF-CRIT, different loss weights or stronger video feature # may lead performance boost, ... | 2.301818 | 2 |
new-influx-client.py | benlamonica/energy-monitor | 0 | 1981 | <filename>new-influx-client.py<gh_stars>0
import influxdb_client
from influxdb_client import InfluxDBClient
bucket = "python-client-sandbox"
org = "Energy Monitor"
token = "miQdAvNXHiNDVVzPzV5FpkCaR_8qdQ-L1FlPCOXQPI325Kbrh1fgfhkcDUZ4FepaebDdpZ-A1gmtnnjU0_hViA=="
url = "http://localhost:9999"
client = InfluxDBClient(u... | <filename>new-influx-client.py<gh_stars>0
import influxdb_client
from influxdb_client import InfluxDBClient
bucket = "python-client-sandbox"
org = "Energy Monitor"
token = "miQdAvNXHiNDVVzPzV5FpkCaR_8qdQ-L1FlPCOXQPI325Kbrh1fgfhkcDUZ4FepaebDdpZ-A1gmtnnjU0_hViA=="
url = "http://localhost:9999"
client = InfluxDBClient(u... | none | 1 | 2.319728 | 2 | |
tests/test_agent/test_manhole.py | guidow/pyfarm-agent | 0 | 1982 | # No shebang line, this module is meant to be imported
#
# Copyright 2014 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | # No shebang line, this module is meant to be imported
#
# Copyright 2014 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | en | 0.758152 | # No shebang line, this module is meant to be imported # # Copyright 2014 <NAME> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ... | 1.987022 | 2 |
func-button/klSigmode.py | xcgoo/uiKLine | 232 | 1983 | <gh_stars>100-1000
# coding: utf-8
"""
插入所有需要的库,和函数
"""
#----------------------------------------------------------------------
def klSigmode(self):
"""查找模式"""
if self.mode == 'deal':
self.canvas.updateSig(self.signalsOpen)
self.mode = 'dealOpen'
else:
self.canvas.updateSig(self.... | # coding: utf-8
"""
插入所有需要的库,和函数
"""
#----------------------------------------------------------------------
def klSigmode(self):
"""查找模式"""
if self.mode == 'deal':
self.canvas.updateSig(self.signalsOpen)
self.mode = 'dealOpen'
else:
self.canvas.updateSig(self.signals)
se... | zh | 0.50499 | # coding: utf-8 插入所有需要的库,和函数 #---------------------------------------------------------------------- 查找模式 | 2.400129 | 2 |
utils/thin.py | BnF-jadis/projet | 5 | 1984 | <filename>utils/thin.py
# 2020, BackThen Maps
# Coded by <NAME> https://github.com/RPetitpierre
# For Bibliothèque nationale de France (BnF)
import cv2, thinning, os
import numpy as np
import pandas as pd
import shapefile as shp
from skimage.measure import approximate_polygon
from PIL import Image, ImageDraw
from ... | <filename>utils/thin.py
# 2020, BackThen Maps
# Coded by <NAME> https://github.com/RPetitpierre
# For Bibliothèque nationale de France (BnF)
import cv2, thinning, os
import numpy as np
import pandas as pd
import shapefile as shp
from skimage.measure import approximate_polygon
from PIL import Image, ImageDraw
from ... | en | 0.838363 | # 2020, BackThen Maps # Coded by <NAME> https://github.com/RPetitpierre # For Bibliothèque nationale de France (BnF) Thinning/skeletonization of the road network image to a wired model. Input(s): road_network: black and white image of the road network (streets in white) path: path where the skeleton... | 2.843477 | 3 |
easy2fa/tests/test_checkinput.py | lutostag/otp | 3 | 1985 | from unittest import TestCase
from unittest.mock import patch
from easy2fa import cli
class TestCheckInput(TestCase):
@patch('builtins.input')
def test_default(self, mock_input):
mock_input.return_value = ''
self.assertEquals(cli.check_input('prompt', default='one'), 'one')
mock_input... | from unittest import TestCase
from unittest.mock import patch
from easy2fa import cli
class TestCheckInput(TestCase):
@patch('builtins.input')
def test_default(self, mock_input):
mock_input.return_value = ''
self.assertEquals(cli.check_input('prompt', default='one'), 'one')
mock_input... | none | 1 | 3.176231 | 3 | |
bert_finetuning/data_loader.py | nps1ngh/adversarial-bert-german-attacks-defense | 0 | 1986 | from torch.utils.data import TensorDataset, DataLoader, RandomSampler, SequentialSampler
from bert_finetuning.data import GermanData
class GermanDataLoader:
def __init__(
self,
data_paths,
model_name,
do_cleansing,
max_sequence_length,
batch_size=8,
... | from torch.utils.data import TensorDataset, DataLoader, RandomSampler, SequentialSampler
from bert_finetuning.data import GermanData
class GermanDataLoader:
def __init__(
self,
data_paths,
model_name,
do_cleansing,
max_sequence_length,
batch_size=8,
... | en | 0.211391 | Create Torch dataloaders for data splits ** FOR DEBUGGING **
if __name__ == "__main__":
## define data paths
germeval_data_paths = {
"train": "./datasets/hasoc_dataset/hasoc_german_train.csv",
"dev": "./datasets/hasoc_dataset/hasoc_german_validation.csv",
"test": "./datasets/haso... | 2.66234 | 3 |
data/dirty_mnist.py | Karthik-Ragunath/DDU | 43 | 1987 | <reponame>Karthik-Ragunath/DDU<filename>data/dirty_mnist.py
import torch
import numpy as np
import torch.utils.data as data
from torch.utils.data import Subset
from data.fast_mnist import create_MNIST_dataset
from data.ambiguous_mnist.ambiguous_mnist_dataset import AmbiguousMNIST
def get_train_valid_loader(root, bat... | import torch
import numpy as np
import torch.utils.data as data
from torch.utils.data import Subset
from data.fast_mnist import create_MNIST_dataset
from data.ambiguous_mnist.ambiguous_mnist_dataset import AmbiguousMNIST
def get_train_valid_loader(root, batch_size, val_seed=1, val_size=0.1, **kwargs):
error_msg... | en | 0.61663 | # load the dataset # AmbiguousMNIST does whiten the data itself # load the dataset | 2.5743 | 3 |
vantage6/server/resource/recover.py | jaspersnel/vantage6-server | 2 | 1988 | # -*- coding: utf-8 -*-
import logging
import datetime
from flask import request, render_template
from flask_jwt_extended import (
create_access_token,
decode_token
)
from jwt.exceptions import DecodeError
from flasgger import swag_from
from http import HTTPStatus
from pathlib import Path
from sqlalchemy.orm.e... | # -*- coding: utf-8 -*-
import logging
import datetime
from flask import request, render_template
from flask_jwt_extended import (
create_access_token,
decode_token
)
from jwt.exceptions import DecodeError
from flasgger import swag_from
from http import HTTPStatus
from pathlib import Path
from sqlalchemy.orm.e... | en | 0.706524 | # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # Resources / API's # ------------------------------------------------------------------------------ user can use recover token to reset their password. "submit email-adress receive token. # retrieve user based on e... | 2.060569 | 2 |
examples/basic_examples/aws_sns_sqs_middleware_service.py | tranvietanh1991/tomodachi | 1 | 1989 | import os
from typing import Any, Callable, Dict
import tomodachi
from tomodachi import aws_sns_sqs, aws_sns_sqs_publish
from tomodachi.discovery import AWSSNSRegistration
from tomodachi.envelope import JsonBase
async def middleware_function(
func: Callable, service: Any, message: Any, topic: str, context: Dict,... | import os
from typing import Any, Callable, Dict
import tomodachi
from tomodachi import aws_sns_sqs, aws_sns_sqs_publish
from tomodachi.discovery import AWSSNSRegistration
from tomodachi.envelope import JsonBase
async def middleware_function(
func: Callable, service: Any, message: Any, topic: str, context: Dict,... | en | 0.660119 | # Functionality before function is called # There's also the possibility to pass in extra arguments or keywords arguments, for example: # return_value = await func(*args, id='overridden', **kwargs) # Functinoality after function is called # Build own "discovery" functions, to be run on start and stop # See tomodachi/di... | 2.370196 | 2 |
ex9.py | ThitsarAung/python-exercises | 0 | 1990 | <reponame>ThitsarAung/python-exercises
types_of_people = 10
x = f"There are {types_of_people} types of people."
binary = "binary"
do_not = "don't"
y = f"Those who know {binary} and those who {do_not}."
print(x)
print(y)
print(f"I said: {x}")
print(f"I also said: '{y}'")
hilarious = False
joke_evaluation = "Isn't th... | types_of_people = 10
x = f"There are {types_of_people} types of people."
binary = "binary"
do_not = "don't"
y = f"Those who know {binary} and those who {do_not}."
print(x)
print(y)
print(f"I said: {x}")
print(f"I also said: '{y}'")
hilarious = False
joke_evaluation = "Isn't that joke so funny?! {}"
print(joke_eval... | none | 1 | 3.765052 | 4 | |
mmdnn/conversion/caffe/writer.py | 2yz/MMdnn | 3,442 | 1991 | <reponame>2yz/MMdnn
import base64
from google.protobuf import json_format
from importlib import import_module
import json
import numpy as np
import os
import sys
from mmdnn.conversion.caffe.errors import ConversionError
from mmdnn.conversion.caffe.common_graph import fetch_attr_value
from mmdnn.conversion.caffe.utils ... | import base64
from google.protobuf import json_format
from importlib import import_module
import json
import numpy as np
import os
import sys
from mmdnn.conversion.caffe.errors import ConversionError
from mmdnn.conversion.caffe.common_graph import fetch_attr_value
from mmdnn.conversion.caffe.utils import get_lower_cas... | en | 0.65921 | Dumpt a DL graph into a Json file. Dumpt a DL graph into a Python script. Emits the Python source for this node. #FIXME: # output = node.output # Set the node name # Decompose DAG into chains # Node is part of an existing chain. # Start a new chain for this node. # Generate Python code line by line Return the file path... | 2.344883 | 2 |
week1/85-maximal-rectangle.py | LionTao/algo_weekend | 0 | 1992 | <gh_stars>0
"""
leetcode-85
给定一个仅包含 0 和 1 , 大小为 rows x cols 的二维二进制矩阵, 找出只包含 1 的最大矩形, 并返回其面积。
"""
from typing import List
class Solution:
def maximalRectangle(self, matrix: List[List[str]]) -> int:
"""
统计直方图然后单调递增栈
"""
rows = len(matrix)
if rows == 0:
return 0
... | """
leetcode-85
给定一个仅包含 0 和 1 , 大小为 rows x cols 的二维二进制矩阵, 找出只包含 1 的最大矩形, 并返回其面积。
"""
from typing import List
class Solution:
def maximalRectangle(self, matrix: List[List[str]]) -> int:
"""
统计直方图然后单调递增栈
"""
rows = len(matrix)
if rows == 0:
return 0
columns ... | zh | 0.987775 | leetcode-85 给定一个仅包含 0 和 1 , 大小为 rows x cols 的二维二进制矩阵, 找出只包含 1 的最大矩形, 并返回其面积。 统计直方图然后单调递增栈 #单调递增栈 | 3.712433 | 4 |
pandapower/test/opf/test_costs_pwl.py | mathildebadoual/pandapower | 1 | 1993 | <reponame>mathildebadoual/pandapower
# -*- coding: utf-8 -*-
# Copyright (c) 2016-2018 by University of Kassel and Fraunhofer Institute for Energy Economics
# and Energy System Technology (IEE), Kassel. All rights reserved.
import numpy as np
import pytest
from pandapower.optimal_powerflow import OPFNotConverged
i... | # -*- coding: utf-8 -*-
# Copyright (c) 2016-2018 by University of Kassel and Fraunhofer Institute for Energy Economics
# and Energy System Technology (IEE), Kassel. All rights reserved.
import numpy as np
import pytest
from pandapower.optimal_powerflow import OPFNotConverged
import pandapower as pp
try:
impo... | en | 0.782301 | # -*- coding: utf-8 -*- # Copyright (c) 2016-2018 by University of Kassel and Fraunhofer Institute for Energy Economics # and Energy System Technology (IEE), Kassel. All rights reserved. Testing a very simple network for the resulting cost value constraints with OPF # boundaries: # create net # run OPF Testing a ve... | 2.356766 | 2 |
cookie_refresh.py | guoxianru/cookie_pool_lite | 0 | 1994 | # -*- coding: utf-8 -*-
# @Author: GXR
# @CreateTime: 2022-01-20
# @UpdateTime: 2022-01-20
import redis
import config
import cookie_login
from cookie_api import app
red = redis.Redis(
host=config.REDIS_HOST,
port=config.REDIS_PORT,
db=config.REDIS_DB,
decode_responses=True,
)
# 刷新cookie数量
def cooki... | # -*- coding: utf-8 -*-
# @Author: GXR
# @CreateTime: 2022-01-20
# @UpdateTime: 2022-01-20
import redis
import config
import cookie_login
from cookie_api import app
red = redis.Redis(
host=config.REDIS_HOST,
port=config.REDIS_PORT,
db=config.REDIS_DB,
decode_responses=True,
)
# 刷新cookie数量
def cooki... | en | 0.421406 | # -*- coding: utf-8 -*- # @Author: GXR # @CreateTime: 2022-01-20 # @UpdateTime: 2022-01-20 # 刷新cookie数量 | 2.700845 | 3 |
feemodel/app/__init__.py | bitcoinfees/feemodel | 12 | 1995 | from feemodel.app.transient import TransientOnline
from feemodel.app.pools import PoolsOnlineEstimator
from feemodel.app.predict import Prediction
from feemodel.app.simonline import SimOnline
__all__ = [
'TransientOnline',
'PoolsOnlineEstimator',
'Prediction',
'SimOnline'
]
| from feemodel.app.transient import TransientOnline
from feemodel.app.pools import PoolsOnlineEstimator
from feemodel.app.predict import Prediction
from feemodel.app.simonline import SimOnline
__all__ = [
'TransientOnline',
'PoolsOnlineEstimator',
'Prediction',
'SimOnline'
]
| none | 1 | 1.185335 | 1 | |
examples/server/models/image_file_upload.py | ParikhKadam/django-angular | 941 | 1996 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
# start tutorial
from django.db import models
from djng.forms import NgModelFormMixin, NgFormValidationMixin
from djng.styling.bootstrap3.forms import Bootstrap3ModelForm
class SubscribeUser(models.Model):
full_name = models.CharField(
"<NAME... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
# start tutorial
from django.db import models
from djng.forms import NgModelFormMixin, NgFormValidationMixin
from djng.styling.bootstrap3.forms import Bootstrap3ModelForm
class SubscribeUser(models.Model):
full_name = models.CharField(
"<NAME... | en | 0.614396 | # -*- coding: utf-8 -*- # start tutorial | 2.286488 | 2 |
python/tvm/topi/hexagon/slice_ops/add_subtract_multiply.py | yangulei/tvm | 4,640 | 1997 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may ... | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may ... | en | 0.845104 | # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u... | 2.137076 | 2 |
python_modules/automation/automation/docker/dagster_docker.py | jrouly/dagster | 0 | 1998 | <filename>python_modules/automation/automation/docker/dagster_docker.py
import contextlib
import os
from collections import namedtuple
import yaml
from dagster import __version__ as current_dagster_version
from dagster import check
from .ecr import ecr_image, get_aws_account_id, get_aws_region
from .utils import (
... | <filename>python_modules/automation/automation/docker/dagster_docker.py
import contextlib
import os
from collections import namedtuple
import yaml
from dagster import __version__ as current_dagster_version
from dagster import check
from .ecr import ecr_image, get_aws_account_id, get_aws_region
from .utils import (
... | en | 0.646735 | # Default repository prefix used for local images # Location of the template assets used here Represents a Dagster image. Properties: image (str): Name of the image build_cm (function): function that is a context manager for build (e.g. for populating a build cache) path (Option... | 2.377713 | 2 |
chrome/test/telemetry/chromeos/login_unittest.py | Fusion-Rom/android_external_chromium_org | 231 | 1999 | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import json
import logging
import os
import unittest
from telemetry.core import browser_finder
from telemetry.core import exceptions
from telemetry.core ... | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import json
import logging
import os
import unittest
from telemetry.core import browser_finder
from telemetry.core import exceptions
from telemetry.core ... | en | 0.597682 | # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. Returns True if cryptohome is mounted Finds and creates a browser for tests. if autotest_ext is True, also loads the autotest extension Returns the au... | 2.008684 | 2 |