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 |
|---|---|---|---|---|---|---|---|---|---|---|
examples/source/benchmarks/googlenet_model.py | ably77/dcos-tensorflow-tools | 7 | 7800 | <reponame>ably77/dcos-tensorflow-tools
# Copyright 2017 The TensorFlow 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/LIC... | # Copyright 2017 The TensorFlow 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 by applica... | en | 0.788726 | # Copyright 2017 The TensorFlow 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 by applica... | 2.137445 | 2 |
demos/prey-predator/prey_predator_abm/sim_params.py | neo-empresarial/covid-19 | 3 | 7801 | """
Simulation parameters.
"""
SIMULATION_TIME_STEPS = 300
| """
Simulation parameters.
"""
SIMULATION_TIME_STEPS = 300
| en | 0.282705 | Simulation parameters. | 0.964519 | 1 |
process_ops.py | gcosne/generative_inpainting | 11 | 7802 | <reponame>gcosne/generative_inpainting
import cv2
import numpy as np
try:
import scipy
# scipy.ndimage cannot be accessed until explicitly imported
from scipy import ndimage
except ImportError:
scipy = None
def flip_axis(x, axis):
x = np.asarray(x).swapaxes(axis, 0)
x = x[::-1, ...]
x = x... | import cv2
import numpy as np
try:
import scipy
# scipy.ndimage cannot be accessed until explicitly imported
from scipy import ndimage
except ImportError:
scipy = None
def flip_axis(x, axis):
x = np.asarray(x).swapaxes(axis, 0)
x = x[::-1, ...]
x = x.swapaxes(0, axis)
return x
def r... | en | 0.661012 | # scipy.ndimage cannot be accessed until explicitly imported Performs a random rotation of a Numpy image tensor. # Arguments x: Input tensor. Must be 3D. rg: Rotation range, in degrees. row_axis: Index of axis for rows in the input tensor. col_axis: Index of axis for columns in the i... | 2.915613 | 3 |
keystone/tests/unit/token/test_provider.py | maestro-hybrid-cloud/keystone | 0 | 7803 | <filename>keystone/tests/unit/token/test_provider.py
# 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... | <filename>keystone/tests/unit/token/test_provider.py
# 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... | en | 0.859654 | # 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, software # distributed under t... | 2.039033 | 2 |
fasm2bels/database/connection_db_utils.py | mithro/symbiflow-xc-fasm2bels | 0 | 7804 | import functools
def create_maybe_get_wire(conn):
c = conn.cursor()
@functools.lru_cache(maxsize=None)
def get_tile_type_pkey(tile):
c.execute('SELECT pkey, tile_type_pkey FROM phy_tile WHERE name = ?',
(tile, ))
return c.fetchone()
@functools.lru_cache(maxsize=None... | import functools
def create_maybe_get_wire(conn):
c = conn.cursor()
@functools.lru_cache(maxsize=None)
def get_tile_type_pkey(tile):
c.execute('SELECT pkey, tile_type_pkey FROM phy_tile WHERE name = ?',
(tile, ))
return c.fetchone()
@functools.lru_cache(maxsize=None... | en | 0.349999 | SELECT name FROM tile_type WHERE pkey = ( SELECT tile_type_pkey FROM phy_tile WHERE name = ?); WITH selected_tile(phy_tile_pkey, tile_type_pkey) AS ( SELECT pkey, tile_type_pkey FROM phy_tile WHERE name = ? ) SELECT wire.pkey FROM wire WHERE wire.phy_tile_pkey = ( SELECT select... | 2.274933 | 2 |
ppr-api/src/services/payment_service.py | bcgov/ppr-deprecated | 1 | 7805 | """A module that provides functionality for accessing the Payments API."""
import enum
import http
import logging
import requests
from fastapi import Depends, Header, HTTPException
from fastapi.security.http import HTTPAuthorizationCredentials
import auth.authentication
import config
import schemas.payment
logger ... | """A module that provides functionality for accessing the Payments API."""
import enum
import http
import logging
import requests
from fastapi import Depends, Header, HTTPException
from fastapi.security.http import HTTPAuthorizationCredentials
import auth.authentication
import config
import schemas.payment
logger ... | en | 0.818063 | A module that provides functionality for accessing the Payments API. An enumeration of the filing codes available to PPR. A service used for interacting with the Payments API. Initialize the repository with the Authorization and Account-Id headers provided in the request. Submit a payment request and provide the detail... | 3.116772 | 3 |
SmerekaRoman/HW_6/HW 6.3.py | kolyasalubov/Lv-639.pythonCore | 0 | 7806 | <reponame>kolyasalubov/Lv-639.pythonCore
def numb_of_char(a):
d = {}
for char in set(a):
d[char] = a.count(char)
return d
a = numb_of_char(str(input("Input the word please: ")))
print(a)
| def numb_of_char(a):
d = {}
for char in set(a):
d[char] = a.count(char)
return d
a = numb_of_char(str(input("Input the word please: ")))
print(a) | none | 1 | 3.725338 | 4 | |
0201-0300/0251-Flatten 2D Vector/0251-Flatten 2D Vector.py | jiadaizhao/LeetCode | 49 | 7807 | <reponame>jiadaizhao/LeetCode
class Vector2D:
def __init__(self, v: List[List[int]]):
def getIt():
for row in v:
for val in row:
yield val
self.it = iter(getIt())
self.val = next(self.it, None)
def next(self) -> int:
... | class Vector2D:
def __init__(self, v: List[List[int]]):
def getIt():
for row in v:
for val in row:
yield val
self.it = iter(getIt())
self.val = next(self.it, None)
def next(self) -> int:
result = self.val
... | en | 0.846573 | # Your Vector2D object will be instantiated and called as such: # obj = Vector2D(v) # param_1 = obj.next() # param_2 = obj.hasNext() | 3.320823 | 3 |
logger_decorator.py | jbhayback/reconciliation-manager | 0 | 7808 | from datetime import datetime
import inspect
def log_time(msg=None):
def decorator(f):
nonlocal msg
if msg is None:
msg = '{} time spent: '.format(f.__name__)
def inner(*args, **kwargs):
# check if the object has a logger
global logger
if ar... | from datetime import datetime
import inspect
def log_time(msg=None):
def decorator(f):
nonlocal msg
if msg is None:
msg = '{} time spent: '.format(f.__name__)
def inner(*args, **kwargs):
# check if the object has a logger
global logger
if ar... | en | 0.807622 | # check if the object has a logger | 2.935186 | 3 |
lf3py/di/__init__.py | rog-works/lf3py | 0 | 7809 | <gh_stars>0
from lf3py.di.di import DI # noqa F401
| from lf3py.di.di import DI # noqa F401 | uz | 0.378174 | # noqa F401 | 1.12426 | 1 |
critical/tasks.py | lenarother/django-critical-css | 2 | 7810 | <reponame>lenarother/django-critical-css
import logging
from django.utils.safestring import mark_safe
from django_rq import job
from inline_static.css import transform_css_urls
logger = logging.getLogger(__name__)
@job
def calculate_critical_css(critical_id, original_path):
from .exceptions import CriticalExcep... | import logging
from django.utils.safestring import mark_safe
from django_rq import job
from inline_static.css import transform_css_urls
logger = logging.getLogger(__name__)
@job
def calculate_critical_css(critical_id, original_path):
from .exceptions import CriticalException
from .models import Critical
... | none | 1 | 1.957091 | 2 | |
test.py | wei2912/bce-simulation | 0 | 7811 | <filename>test.py<gh_stars>0
#!/usr/bin/env python
# coding=utf-8
"""
This script tests the simulations of the experiments.
"""
import math
from utils import coin_var, needle_var
def main():
needle_var_vals = [
(1.1, 1.0),
(1.4, 1.0),
(2.0, 1.0),
(2.9, 1.0),
(3.3, 1.0),
... | <filename>test.py<gh_stars>0
#!/usr/bin/env python
# coding=utf-8
"""
This script tests the simulations of the experiments.
"""
import math
from utils import coin_var, needle_var
def main():
needle_var_vals = [
(1.1, 1.0),
(1.4, 1.0),
(2.0, 1.0),
(2.9, 1.0),
(3.3, 1.0),
... | en | 0.613038 | #!/usr/bin/env python # coding=utf-8 This script tests the simulations of the experiments. | 2.745444 | 3 |
instructions/instructions.py | fernandozanutto/PyNES | 0 | 7812 | <reponame>fernandozanutto/PyNES
from addressing import *
from instructions.base_instructions import SetBit, ClearBit
from instructions.generic_instructions import Instruction
from status import Status
# set status instructions
class Sec(SetBit):
identifier_byte = bytes([0x38])
bit = Status.StatusTypes.carry
... | from addressing import *
from instructions.base_instructions import SetBit, ClearBit
from instructions.generic_instructions import Instruction
from status import Status
# set status instructions
class Sec(SetBit):
identifier_byte = bytes([0x38])
bit = Status.StatusTypes.carry
class Sei(SetBit):
identifi... | en | 0.526788 | # set status instructions # clear status instructions | 2.640989 | 3 |
python/530.minimum-absolute-difference-in-bst.py | vermouth1992/Leetcode | 0 | 7813 | #
# @lc app=leetcode id=530 lang=python3
#
# [530] Minimum Absolute Difference in BST
#
# https://leetcode.com/problems/minimum-absolute-difference-in-bst/description/
#
# algorithms
# Easy (55.23%)
# Total Accepted: 115.5K
# Total Submissions: 209K
# Testcase Example: '[4,2,6,1,3]'
#
# Given the root of a Binary S... | #
# @lc app=leetcode id=530 lang=python3
#
# [530] Minimum Absolute Difference in BST
#
# https://leetcode.com/problems/minimum-absolute-difference-in-bst/description/
#
# algorithms
# Easy (55.23%)
# Total Accepted: 115.5K
# Total Submissions: 209K
# Testcase Example: '[4,2,6,1,3]'
#
# Given the root of a Binary S... | en | 0.72734 | # # @lc app=leetcode id=530 lang=python3 # # [530] Minimum Absolute Difference in BST # # https://leetcode.com/problems/minimum-absolute-difference-in-bst/description/ # # algorithms # Easy (55.23%) # Total Accepted: 115.5K # Total Submissions: 209K # Testcase Example: '[4,2,6,1,3]' # # Given the root of a Binary S... | 3.796878 | 4 |
tensorflow/python/eager/remote_cloud_tpu_test.py | abhaikollara/tensorflow | 26 | 7814 | <reponame>abhaikollara/tensorflow<filename>tensorflow/python/eager/remote_cloud_tpu_test.py<gh_stars>10-100
# Copyright 2019 The TensorFlow 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 obtai... | # Copyright 2019 The TensorFlow 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 by applicable ... | en | 0.828083 | # Copyright 2019 The TensorFlow 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 by applicable ... | 1.75073 | 2 |
test/functional/bsv-blocksize-params.py | gbtn/bitcoin-sv-gbtn | 3 | 7815 | #!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Copyright (c) 2017 The Bitcoin developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""
Test that the blockmaxsize and excessiveblocksize paramete... | #!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Copyright (c) 2017 The Bitcoin developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""
Test that the blockmaxsize and excessiveblocksize paramete... | en | 0.665786 | #!/usr/bin/env python3 # Copyright (c) 2015-2016 The Bitcoin Core developers # Copyright (c) 2017 The Bitcoin developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. Test that the blockmaxsize and excessiveblocksize parameters a... | 2.216647 | 2 |
yotta/test/cli/outdated.py | headlessme/yotta | 0 | 7816 | <reponame>headlessme/yotta
#!/usr/bin/env python
# Copyright 2015 ARM Limited
#
# Licensed under the Apache License, Version 2.0
# See LICENSE file for details.
# standard library modules, , ,
import unittest
# internal modules:
from . import util
from . import cli
Test_Outdated = {
'module.json':'''{
"name": "tes... | #!/usr/bin/env python
# Copyright 2015 ARM Limited
#
# Licensed under the Apache License, Version 2.0
# See LICENSE file for details.
# standard library modules, , ,
import unittest
# internal modules:
from . import util
from . import cli
Test_Outdated = {
'module.json':'''{
"name": "test-outdated",
"version": "... | en | 0.588331 | #!/usr/bin/env python # Copyright 2015 ARM Limited # # Licensed under the Apache License, Version 2.0 # See LICENSE file for details. # standard library modules, , , # internal modules: { "name": "test-outdated", "version": "0.0.0", "description": "Test yotta outdated", "author": "<NAME> <<EMAIL>>", "license"... | 2.224413 | 2 |
geoposition/tests/urls.py | Starcross/django-geoposition | 0 | 7817 | <filename>geoposition/tests/urls.py
from django.urls import path, include
from django.contrib import admin
from example.views import poi_list
admin.autodiscover()
urlpatterns = [
path('', poi_list),
path('admin/', admin.site.urls),
]
| <filename>geoposition/tests/urls.py
from django.urls import path, include
from django.contrib import admin
from example.views import poi_list
admin.autodiscover()
urlpatterns = [
path('', poi_list),
path('admin/', admin.site.urls),
]
| none | 1 | 1.830012 | 2 | |
A_Stocker/Stocker.py | Allen1218/Python_Project_Interesting | 1 | 7818 | <reponame>Allen1218/Python_Project_Interesting<filename>A_Stocker/Stocker.py
import threading
import tushare as ts
import pandas as pd
import datetime
STOCK = {#'002594':[1,170.15], ## 比亚迪 / 几手,成本价
'601012':[11,99.9], ## 隆基股份
'002340':[12,8.72], ## 格林美
'603259':[1,141.7], ## 药明康德
... | import threading
import tushare as ts
import pandas as pd
import datetime
STOCK = {#'002594':[1,170.15], ## 比亚迪 / 几手,成本价
'601012':[11,99.9], ## 隆基股份
'002340':[12,8.72], ## 格林美
'603259':[1,141.7], ## 药明康德
'002346':[10,10.68], ## 柘中股份
#'600438':[9,42.96], ## ... | zh | 0.278067 | #'002594':[1,170.15], ## 比亚迪 / 几手,成本价 ## 隆基股份 ## 格林美 ## 药明康德 ## 柘中股份 #'600438':[9,42.96], ## 通威股份 #'002475':[3,59.51], ## 立讯精密 #'603308':[1,33.49], ## 应流股份 #'002415': [3, 66.40], ## 海康威视 # '600559':[3,35.3], ## 老白干 # '601100':[1, 114.5], ## 恒立液压 # '603466':[6, 22.40] ## 风语筑 # s # #rodo process all... | 2.332051 | 2 |
tests/extractors/test_etrade.py | mkazin/StatementRenamer | 0 | 7819 | <filename>tests/extractors/test_etrade.py
from datetime import datetime
from statement_renamer.extractors.etrade import ETradeDateExtractor as EXTRACTOR_UNDER_TEST
from statement_renamer.extractors.factory import ExtractorFactory
TESTDATA = (
"""
PAGE 1 OF 6 February 1, 2019 - March 31, 2019AccountNumber:###... | <filename>tests/extractors/test_etrade.py
from datetime import datetime
from statement_renamer.extractors.etrade import ETradeDateExtractor as EXTRACTOR_UNDER_TEST
from statement_renamer.extractors.factory import ExtractorFactory
TESTDATA = (
"""
PAGE 1 OF 6 February 1, 2019 - March 31, 2019AccountNumber:###... | en | 0.581989 | PAGE 1 OF 6 February 1, 2019 - March 31, 2019AccountNumber:####-####AccountType:ROTH IRA PAGE 5 OF 6Account Number: ####-####Statement Period : February 1, 2019 - March 31, 2019Account Type TolearnmoreabouttheRSDAProgram,pleasereviewyourRSDAProgramCustomerAgreement,visitwww.etrade.com,orcallusat1-800-387-23... | 2.744523 | 3 |
Estrutura_Decisao/who.py | M3nin0/supreme-broccoli | 0 | 7820 | <reponame>M3nin0/supreme-broccoli<gh_stars>0
prod1 = float(input("Insira o valor do produto A: "))
prod2 = float(input("Insira o valor do produto B: "))
prod3 = float(input("Insira o valor do produto C: "))
if prod1 < prod2 and prod1 < prod3:
print ("Escolha o produto A é o mais barato")
elif prod2 < prod1 and pro... | prod1 = float(input("Insira o valor do produto A: "))
prod2 = float(input("Insira o valor do produto B: "))
prod3 = float(input("Insira o valor do produto C: "))
if prod1 < prod2 and prod1 < prod3:
print ("Escolha o produto A é o mais barato")
elif prod2 < prod1 and prod2 < prod3:
print ("Escolha o produto B é... | none | 1 | 3.940113 | 4 | |
ProgettoLube/WebInspector/venv/Lib/site-packages/tensorflow/_api/v2/compat/v2/train/experimental/__init__.py | Lube-Project/ProgettoLube | 2 | 7821 | <reponame>Lube-Project/ProgettoLube
# This file is MACHINE GENERATED! Do not edit.
# Generated by: tensorflow/python/tools/api/generator/create_python_api.py script.
"""Public API for tf.train.experimental namespace.
"""
from __future__ import print_function as _print_function
import sys as _sys
from tensorflow.pyth... | # This file is MACHINE GENERATED! Do not edit.
# Generated by: tensorflow/python/tools/api/generator/create_python_api.py script.
"""Public API for tf.train.experimental namespace.
"""
from __future__ import print_function as _print_function
import sys as _sys
from tensorflow.python.training.experimental.loss_scale ... | en | 0.708208 | # This file is MACHINE GENERATED! Do not edit. # Generated by: tensorflow/python/tools/api/generator/create_python_api.py script. Public API for tf.train.experimental namespace. | 1.278612 | 1 |
SciDataTool/Methods/VectorField/plot_3D_Data.py | BenjaminGabet/SciDataTool | 0 | 7822 | <gh_stars>0
def plot_3D_Data(
self,
*arg_list,
is_norm=False,
unit="SI",
component_list=None,
save_path=None,
x_min=None,
x_max=None,
y_min=None,
y_max=None,
z_min=None,
z_max=None,
z_range=None,
is_auto_ticks=True,
is_auto_range=False,
is_2D_view=False,
... | def plot_3D_Data(
self,
*arg_list,
is_norm=False,
unit="SI",
component_list=None,
save_path=None,
x_min=None,
x_max=None,
y_min=None,
y_max=None,
z_min=None,
z_max=None,
z_range=None,
is_auto_ticks=True,
is_auto_range=False,
is_2D_view=False,
is_same_s... | en | 0.584242 | Plots a field as a function of time Parameters ---------- self : Output an Output object Data_str : str name of the Data Object to plot (e.g. "mag.Br") *arg_list : list of str arguments to specify which axes to plot is_norm : bool boolean indicating if the field ... | 2.81881 | 3 |
tests/unittests/plotting/test_plotly_backend.py | obilaniu/orion | 1 | 7823 | <reponame>obilaniu/orion<filename>tests/unittests/plotting/test_plotly_backend.py
"""Collection of tests for :mod:`orion.plotting.backend_plotly`."""
import copy
import numpy
import pandas
import plotly
import pytest
import orion.client
from orion.analysis.partial_dependency_utils import partial_dependency_grid
from ... | """Collection of tests for :mod:`orion.plotting.backend_plotly`."""
import copy
import numpy
import pandas
import plotly
import pytest
import orion.client
from orion.analysis.partial_dependency_utils import partial_dependency_grid
from orion.core.worker.experiment import Experiment
from orion.plotting.base import (
... | en | 0.889459 | Collection of tests for :mod:`orion.plotting.backend_plotly`. Build a mocked space Mock experiment to_pandas to return given data (or default one) Return a mocked regressor which just predict iterated integers Mocked Regressor Returns counting of predictions requested. # + numpy.random.normal(0, self.i, size=data.shap... | 2.169374 | 2 |
autodiff/debug_vjp.py | Jakob-Unfried/msc-legacy | 1 | 7824 | import pdb
import warnings
from jax import custom_vjp
@custom_vjp
def debug_identity(x):
"""
acts as identity, but inserts a pdb trace on the backwards pass
"""
warnings.warn('Using a module intended for debugging')
return x
def _debug_fwd(x):
warnings.warn('Using a module intended for debu... | import pdb
import warnings
from jax import custom_vjp
@custom_vjp
def debug_identity(x):
"""
acts as identity, but inserts a pdb trace on the backwards pass
"""
warnings.warn('Using a module intended for debugging')
return x
def _debug_fwd(x):
warnings.warn('Using a module intended for debu... | en | 0.840896 | acts as identity, but inserts a pdb trace on the backwards pass # noinspection PyUnusedLocal | 2.280749 | 2 |
mileage.py | vwfinley/mileage | 0 | 7825 | #!/usr/bin/env python
# Some helpful links
# https://docs.python.org/3/library/tkinter.html
# https://www.python-course.eu/tkinter_entry_widgets.php
import tkinter as tk
class Application(tk.Frame):
def __init__(self, root=None):
super().__init__(root)
self.root = root
... | #!/usr/bin/env python
# Some helpful links
# https://docs.python.org/3/library/tkinter.html
# https://www.python-course.eu/tkinter_entry_widgets.php
import tkinter as tk
class Application(tk.Frame):
def __init__(self, root=None):
super().__init__(root)
self.root = root
... | en | 0.39301 | #!/usr/bin/env python # Some helpful links # https://docs.python.org/3/library/tkinter.html # https://www.python-course.eu/tkinter_entry_widgets.php | 4.052377 | 4 |
rankings/elo.py | ulternate/table_tennis_league | 0 | 7826 | def elo(winner_rank, loser_rank, weighting):
"""
:param winner: The Player that won the match.
:param loser: The Player that lost the match.
:param weighting: The weighting factor to suit your comp.
:return: (winner_new_rank, loser_new_rank) Tuple.
This follows the ELO ranking method.
"""
... | def elo(winner_rank, loser_rank, weighting):
"""
:param winner: The Player that won the match.
:param loser: The Player that lost the match.
:param weighting: The weighting factor to suit your comp.
:return: (winner_new_rank, loser_new_rank) Tuple.
This follows the ELO ranking method.
"""
... | en | 0.921296 | :param winner: The Player that won the match. :param loser: The Player that lost the match. :param weighting: The weighting factor to suit your comp. :return: (winner_new_rank, loser_new_rank) Tuple. This follows the ELO ranking method. # Set a floor of 100 for the rankings. | 3.756622 | 4 |
src/samplics/regression/glm.py | samplics-org/samplics | 14 | 7827 | <gh_stars>10-100
from __future__ import annotations
from typing import Any, Callable, Optional, Union
import numpy as np
# import pandas as pd
import statsmodels.api as sm
from samplics.estimation.expansion import TaylorEstimator
from samplics.utils.formats import dict_to_dataframe, fpc_as_dict, numpy_array, remove... | from __future__ import annotations
from typing import Any, Callable, Optional, Union
import numpy as np
# import pandas as pd
import statsmodels.api as sm
from samplics.estimation.expansion import TaylorEstimator
from samplics.utils.formats import dict_to_dataframe, fpc_as_dict, numpy_array, remove_nans
from sampli... | en | 0.844739 | # import pandas as pd General linear models under complex survey sampling | 2.270646 | 2 |
tests/test_scopes.py | leg100/scopes | 0 | 7828 | <filename>tests/test_scopes.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `scopes` package."""
import os
print(os.getenv('PYTHONPATH'))
import pytest
from click.testing import CliRunner
from scopes.tasks import tasks, bolt, spout, builder
from scopes.graph import G, build, topological_sort, traver... | <filename>tests/test_scopes.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `scopes` package."""
import os
print(os.getenv('PYTHONPATH'))
import pytest
from click.testing import CliRunner
from scopes.tasks import tasks, bolt, spout, builder
from scopes.graph import G, build, topological_sort, traver... | en | 0.555672 | #!/usr/bin/env python # -*- coding: utf-8 -*- Tests for `scopes` package. Sample pytest fixture. See more at: http://doc.pytest.org/en/latest/fixture.html # import requests # return requests.get('https://github.com/audreyr/cookiecutter-pypackage') Sample pytest test function with the pytest fixture as an argument.... | 2.319385 | 2 |
timeparse/LunarSolarConverter/__init__.py | tornadoyi/timeparse | 0 | 7829 | # -*- coding: utf-8 -*-
__author__ = 'isee15'
import LunarSolarConverter
converter = LunarSolarConverter.LunarSolarConverter()
def LunarToSolar(year, month, day, isleap = False):
lunar = LunarSolarConverter.Lunar(year, month, day, isleap)
solar = converter.LunarToSolar(lunar)
return (solar.solarYear, sol... | # -*- coding: utf-8 -*-
__author__ = 'isee15'
import LunarSolarConverter
converter = LunarSolarConverter.LunarSolarConverter()
def LunarToSolar(year, month, day, isleap = False):
lunar = LunarSolarConverter.Lunar(year, month, day, isleap)
solar = converter.LunarToSolar(lunar)
return (solar.solarYear, sol... | en | 0.769321 | # -*- coding: utf-8 -*- | 3.216206 | 3 |
examples/hello-pt/custom/cifar10validator.py | ArnovanHilten/NVFlare | 155 | 7830 | # Copyright (c) 2021, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | # Copyright (c) 2021, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | en | 0.86731 | # Copyright (c) 2021, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to... | 1.858252 | 2 |
lambda/enable-traffic-mirroring.py | wrharding/aws-infra | 1 | 7831 | # MIT License
# Copyright (c) 2020-2021 <NAME> (https://www.chrisfarris.com)
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# t... | # MIT License
# Copyright (c) 2020-2021 <NAME> (https://www.chrisfarris.com)
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# t... | en | 0.710502 | # MIT License # Copyright (c) 2020-2021 <NAME> (https://www.chrisfarris.com) # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to ... | 1.552657 | 2 |
src/value_function.py | wu6u3/async_trpo | 6 | 7832 | <reponame>wu6u3/async_trpo
"""
State-Value Function
Written by <NAME> (pat-coady.github.io)
Modified by <NAME> (wu6u3) into asynchronous version
"""
import tensorflow as tf
import numpy as np
from sklearn.utils import shuffle
#import os
class NNValueFunction(object):
""" NN-based state-value function """
de... | """
State-Value Function
Written by <NAME> (pat-coady.github.io)
Modified by <NAME> (wu6u3) into asynchronous version
"""
import tensorflow as tf
import numpy as np
from sklearn.utils import shuffle
#import os
class NNValueFunction(object):
""" NN-based state-value function """
def __init__(self, obs_dim, h... | en | 0.645006 | State-Value Function Written by <NAME> (pat-coady.github.io) Modified by <NAME> (wu6u3) into asynchronous version #import os NN-based state-value function Args: obs_dim: number of dimensions in observation vector (int) hid1_mult: size of first hidden layer, multiplier of obs_dim # learning rat... | 2.529323 | 3 |
mdepub/actions/__init__.py | bkidwell/mdepub | 35 | 7833 | <reponame>bkidwell/mdepub
"""mdepub actions -- these modules do the actual work."""
import archive
import clean
import create
import epub
import extract
import html
import newid
import version
| """mdepub actions -- these modules do the actual work."""
import archive
import clean
import create
import epub
import extract
import html
import newid
import version | en | 0.257409 | mdepub actions -- these modules do the actual work. | 0.955009 | 1 |
gbe/views/make_bid_view.py | bethlakshmi/gbe-divio-djangocms-python2.7 | 1 | 7834 | from django.views.generic import View
from django.utils.decorators import method_decorator
from django.contrib.auth.decorators import login_required
from django.views.decorators.cache import never_cache
from django.contrib import messages
from django.http import HttpResponseRedirect
from django.urls import reverse
from... | from django.views.generic import View
from django.utils.decorators import method_decorator
from django.contrib.auth.decorators import login_required
from django.views.decorators.cache import never_cache
from django.contrib import messages
from django.http import HttpResponseRedirect
from django.urls import reverse
from... | en | 0.899333 | # check bid validity # save bid # if this isn't a draft, move forward through process, setting up # payment review if payment is needed | 1.909927 | 2 |
epicteller/core/dao/character.py | KawashiroNitori/epicteller | 0 | 7835 | <reponame>KawashiroNitori/epicteller<filename>epicteller/core/dao/character.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
from collections import defaultdict
from typing import List, Optional, Iterable, Dict
import base62
from sqlalchemy import select, and_
from sqlalchemy.dialects.mysql import insert ... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
from collections import defaultdict
from typing import List, Optional, Iterable, Dict
import base62
from sqlalchemy import select, and_
from sqlalchemy.dialects.mysql import insert as mysql_insert
from epicteller.core.model.character import Character
from epi... | en | 0.352855 | #!/usr/bin/env python # -*- coding: utf-8 -*- | 2.241949 | 2 |
examples/sentence_classfication/task_sentiment_classification_roformer_v2.py | Tongjilibo/bert4torch | 49 | 7836 | <gh_stars>10-100
#! -*- coding:utf-8 -*-
# 情感分类例子,RoPE相对位置编码
# 官方项目:https://github.com/ZhuiyiTechnology/roformer-v2
# pytorch参考项目:https://github.com/JunnYu/RoFormer_pytorch
from bert4torch.tokenizers import Tokenizer
from bert4torch.models import build_transformer_model, BaseModel
from bert4torch.snippets import seque... | #! -*- coding:utf-8 -*-
# 情感分类例子,RoPE相对位置编码
# 官方项目:https://github.com/ZhuiyiTechnology/roformer-v2
# pytorch参考项目:https://github.com/JunnYu/RoFormer_pytorch
from bert4torch.tokenizers import Tokenizer
from bert4torch.models import build_transformer_model, BaseModel
from bert4torch.snippets import sequence_padding, Call... | zh | 0.903103 | #! -*- coding:utf-8 -*- # 情感分类例子,RoPE相对位置编码 # 官方项目:https://github.com/ZhuiyiTechnology/roformer-v2 # pytorch参考项目:https://github.com/JunnYu/RoFormer_pytorch # 建立分词器 # 加载数据集 加载数据,并尽量划分为不超过maxlen的句子 # 加载数据集 # 定义bert上的模型结构 # 指定好model和对应的ckpt地址 # 定义使用的loss和optimizer,这里支持自定义 # 用足够小的学习率 # 定义评价函数 评估与保存 # model.save_weights('be... | 2.576085 | 3 |
pyscf/nao/test/test_0037_aos.py | fdmalone/pyscf | 1 | 7837 | # Copyright 2014-2018 The PySCF Developers. 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 by appl... | # Copyright 2014-2018 The PySCF Developers. 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 by appl... | en | 0.83646 | # Copyright 2014-2018 The PySCF Developers. 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 by appl... | 1.975928 | 2 |
code_week12_713_719/is_graph_bipartite_hard.py | dylanlee101/leetcode | 0 | 7838 | '''
给定一个无向图graph,当这个图为二分图时返回true。
如果我们能将一个图的节点集合分割成两个独立的子集A和B,并使图中的每一条边的两个节点一个来自A集合,一个来自B集合,我们就将这个图称为二分图。
graph将会以邻接表方式给出,graph[i]表示图中与节点i相连的所有节点。每个节点都是一个在0到graph.length-1之间的整数。这图中没有自环和平行边: graph[i] 中不存在i,并且graph[i]中没有重复的值。
示例 1:
输入: [[1,3], [0,2], [1,3], [0,2]]
输出: true
解释:
无向图如下:
0----1
| |
| |
3----2
我们可以将... | '''
给定一个无向图graph,当这个图为二分图时返回true。
如果我们能将一个图的节点集合分割成两个独立的子集A和B,并使图中的每一条边的两个节点一个来自A集合,一个来自B集合,我们就将这个图称为二分图。
graph将会以邻接表方式给出,graph[i]表示图中与节点i相连的所有节点。每个节点都是一个在0到graph.length-1之间的整数。这图中没有自环和平行边: graph[i] 中不存在i,并且graph[i]中没有重复的值。
示例 1:
输入: [[1,3], [0,2], [1,3], [0,2]]
输出: true
解释:
无向图如下:
0----1
| |
| |
3----2
我们可以将... | zh | 0.942093 | 给定一个无向图graph,当这个图为二分图时返回true。 如果我们能将一个图的节点集合分割成两个独立的子集A和B,并使图中的每一条边的两个节点一个来自A集合,一个来自B集合,我们就将这个图称为二分图。 graph将会以邻接表方式给出,graph[i]表示图中与节点i相连的所有节点。每个节点都是一个在0到graph.length-1之间的整数。这图中没有自环和平行边: graph[i] 中不存在i,并且graph[i]中没有重复的值。 示例 1: 输入: [[1,3], [0,2], [1,3], [0,2]] 输出: true 解释: 无向图如下: 0----1 | | | | 3----2 我们可以将节点分成... | 3.895346 | 4 |
data_preprocessing/decision_tree_regression.py | Frost199/Machine_Learning | 0 | 7839 | # -*- coding: utf-8 -*-
"""
Created on Tue Apr 17 06:44:47 2018
@author: <NAME>
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.tree import DecisionTreeRegressor
# importing the dataset
dataset = pd.read_csv('Position_Salaries.csv')
# take all the columns but leave the last on... | # -*- coding: utf-8 -*-
"""
Created on Tue Apr 17 06:44:47 2018
@author: <NAME>
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.tree import DecisionTreeRegressor
# importing the dataset
dataset = pd.read_csv('Position_Salaries.csv')
# take all the columns but leave the last on... | en | 0.773133 | # -*- coding: utf-8 -*- Created on Tue Apr 17 06:44:47 2018 @author: <NAME> # importing the dataset # take all the columns but leave the last one(-1) # always make sure our independent variable is a matrix not a vector and # dependent variable can be a vector # splitting the dataset into a training set and a test set ... | 3.265364 | 3 |
user_messages/apps.py | everaccountable/django-user-messages | 0 | 7840 | <filename>user_messages/apps.py
from django.apps import AppConfig
from django.conf import settings
from django.core import checks
from django.template import engines
from django.template.backends.django import DjangoTemplates
from django.utils.text import capfirst
from django.utils.translation import gettext_lazy as _
... | <filename>user_messages/apps.py
from django.apps import AppConfig
from django.conf import settings
from django.core import checks
from django.template import engines
from django.template.backends.django import DjangoTemplates
from django.utils.text import capfirst
from django.utils.translation import gettext_lazy as _
... | none | 1 | 1.97334 | 2 | |
evalml/tests/objective_tests/test_standard_metrics.py | sharshofski/evalml | 0 | 7841 | from itertools import product
import numpy as np
import pandas as pd
import pytest
from sklearn.metrics import matthews_corrcoef as sk_matthews_corrcoef
from evalml.objectives import (
F1,
MAPE,
MSE,
AccuracyBinary,
AccuracyMulticlass,
BalancedAccuracyBinary,
BalancedAccuracyMulticlass,
... | from itertools import product
import numpy as np
import pandas as pd
import pytest
from sklearn.metrics import matthews_corrcoef as sk_matthews_corrcoef
from evalml.objectives import (
F1,
MAPE,
MSE,
AccuracyBinary,
AccuracyMulticlass,
BalancedAccuracyBinary,
BalancedAccuracyMulticlass,
... | en | 0.908589 | # These values are not possible for LogLossBinary but we need them for 100% coverage # We might add an objective where lower is better that can take negative values in the future | 2.286637 | 2 |
server-python3/server.py | Aaron-Ming/websocket_terminal | 40 | 7842 | <reponame>Aaron-Ming/websocket_terminal<filename>server-python3/server.py<gh_stars>10-100
import os
import urllib.parse
import eventlet
import eventlet.green.socket
# eventlet.monkey_patch()
import eventlet.websocket
import eventlet.wsgi
import wspty.pipe
from flask import Flask, request, redirect
from wspty.EchoTermi... | import os
import urllib.parse
import eventlet
import eventlet.green.socket
# eventlet.monkey_patch()
import eventlet.websocket
import eventlet.wsgi
import wspty.pipe
from flask import Flask, request, redirect
from wspty.EchoTerminal import EchoTerminal
from wspty.EncodedTerminal import EncodedTerminal
from wspty.Webso... | ko | 0.154588 | # eventlet.monkey_patch() | 2.361007 | 2 |
tests/unit/test_roger_promote.py | seomoz/roger-mesos-tools | 0 | 7843 | # -*- encoding: utf-8 -*-
"""
Unit test for roger_promote.py
"""
import tests.helper
import unittest
import os
import os.path
import pytest
import requests
from mockito import mock, Mock, when
from cli.roger_promote import RogerPromote
from cli.appconfig import AppConfig
from cli.settings import Settings
from cl... | # -*- encoding: utf-8 -*-
"""
Unit test for roger_promote.py
"""
import tests.helper
import unittest
import os
import os.path
import pytest
import requests
from mockito import mock, Mock, when
from cli.roger_promote import RogerPromote
from cli.appconfig import AppConfig
from cli.settings import Settings
from cl... | en | 0.760753 | # -*- encoding: utf-8 -*- Unit test for roger_promote.py | 2.216655 | 2 |
data/collectors.py | papb/COVID-19 | 6 | 7844 | <filename>data/collectors.py
import json
import pandas as pd
import requests
def load_dump_covid_19_data():
COVID_19_BY_CITY_URL='https://raw.githubusercontent.com/wcota/covid19br/master/cases-brazil-cities-time.csv'
by_city=(pd.read_csv(COVID_19_BY_CITY_URL)
.query('country == "Brazil"')
... | <filename>data/collectors.py
import json
import pandas as pd
import requests
def load_dump_covid_19_data():
COVID_19_BY_CITY_URL='https://raw.githubusercontent.com/wcota/covid19br/master/cases-brazil-cities-time.csv'
by_city=(pd.read_csv(COVID_19_BY_CITY_URL)
.query('country == "Brazil"')
... | en | 0.654944 | # TODO: download excel file only once # Add capital city name # Add capital population Loads a CSV file from JH repository and make some transforms Loads the latest COVID-19 global data from Johns Hopkins University repository | 3.11136 | 3 |
testsuite/testsuite_helpers.py | freingruber/JavaScript-Raider | 91 | 7845 | <gh_stars>10-100
import config as cfg
import utils
import native_code.executor as executor
number_performed_tests = 0
expectations_correct = 0
expectations_wrong = 0
def reset_stats():
global number_performed_tests, expectations_correct, expectations_wrong
number_performed_tests = 0
expectations_correc... | import config as cfg
import utils
import native_code.executor as executor
number_performed_tests = 0
expectations_correct = 0
expectations_wrong = 0
def reset_stats():
global number_performed_tests, expectations_correct, expectations_wrong
number_performed_tests = 0
expectations_correct = 0
expecta... | en | 0.90368 | # Test PASSED # In this case I throw an exception to stop execution because speed optimized functions must always be correct # Raising an exception shows the stacktrace which contains the line number where a check failed # Test PASSED # In this case I throw an exception to stop execution because speed optimized functio... | 2.492708 | 2 |
examples/my_configs/two.py | davidhyman/override | 0 | 7846 | <filename>examples/my_configs/two.py
from .one import *
fruit = 'banana'
colour = 'orange'
sam['eggs'] = 'plenty'
sam.pop('ham')
| <filename>examples/my_configs/two.py
from .one import *
fruit = 'banana'
colour = 'orange'
sam['eggs'] = 'plenty'
sam.pop('ham')
| none | 1 | 1.737415 | 2 | |
students/K33402/Komarov_Georgy/LAB2/elevennote/src/api/urls.py | aglaya-pill/ITMO_ICT_WebDevelopment_2021-2022 | 0 | 7847 | <filename>students/K33402/Komarov_Georgy/LAB2/elevennote/src/api/urls.py
from django.urls import path, include
from rest_framework_jwt.views import obtain_jwt_token
from rest_framework.routers import DefaultRouter
from .views import NoteViewSet
app_name = 'api'
router = DefaultRouter(trailing_slash=False)
router.reg... | <filename>students/K33402/Komarov_Georgy/LAB2/elevennote/src/api/urls.py
from django.urls import path, include
from rest_framework_jwt.views import obtain_jwt_token
from rest_framework.routers import DefaultRouter
from .views import NoteViewSet
app_name = 'api'
router = DefaultRouter(trailing_slash=False)
router.reg... | none | 1 | 1.782504 | 2 | |
PathPlanning/run.py | CandleStein/VAlg | 0 | 7848 | from planning_framework import path
import cv2 as cv
import numpy as np
import argparse
import matplotlib.pyplot as plt
parser = argparse.ArgumentParser(description="Path Planning Visualisation")
parser.add_argument(
"-n",
"--n_heuristic",
default=2,
help="Heuristic for A* Algorithm (default = 2). 0 f... | from planning_framework import path
import cv2 as cv
import numpy as np
import argparse
import matplotlib.pyplot as plt
parser = argparse.ArgumentParser(description="Path Planning Visualisation")
parser.add_argument(
"-n",
"--n_heuristic",
default=2,
help="Heuristic for A* Algorithm (default = 2). 0 f... | en | 0.582334 | # true if mouse is pressed # if True, draw rectangle. Press 'm' to toggle to curve # mouse callback function # cv.waitKey(20) | 2.977346 | 3 |
Codeforces/problems/0136/A/136A.py | object-oriented-human/competitive | 2 | 7849 | <gh_stars>1-10
n = int(input())
line = list(map(int, input().split()))
l = {}
res = ""
for i, j in enumerate(line):
l[j] = i+1
for k in range(n):
res += str(l[k+1]) + " "
print(res.rstrip()) | n = int(input())
line = list(map(int, input().split()))
l = {}
res = ""
for i, j in enumerate(line):
l[j] = i+1
for k in range(n):
res += str(l[k+1]) + " "
print(res.rstrip()) | none | 1 | 3.27523 | 3 | |
generatey.py | YiLisa/DSCI560-hw2 | 0 | 7850 | <filename>generatey.py
import pandas as pd
def main():
input = pd.read_csv('random_x.csv', header=None)
x=input[0].tolist()
y = []
for n in x:
y.append(3*int(n)+6)
df = pd.DataFrame(y)
df.to_csv('output_y.csv', index=False, header=False)
if __name__ == '__main__':
main()
print... | <filename>generatey.py
import pandas as pd
def main():
input = pd.read_csv('random_x.csv', header=None)
x=input[0].tolist()
y = []
for n in x:
y.append(3*int(n)+6)
df = pd.DataFrame(y)
df.to_csv('output_y.csv', index=False, header=False)
if __name__ == '__main__':
main()
print... | none | 1 | 3.448807 | 3 | |
setup.py | burn874/mtg | 0 | 7851 | import re
from pkg_resources import parse_requirements
import pathlib
from setuptools import find_packages, setup
README_FILE = 'README.md'
REQUIREMENTS_FILE = 'requirements.txt'
VERSION_FILE = 'mtg/_version.py'
VERSION_REGEXP = r'^__version__ = \'(\d+\.\d+\.\d+)\''
r = re.search(VERSION_REGEXP, open(VERSION_FILE).r... | import re
from pkg_resources import parse_requirements
import pathlib
from setuptools import find_packages, setup
README_FILE = 'README.md'
REQUIREMENTS_FILE = 'requirements.txt'
VERSION_FILE = 'mtg/_version.py'
VERSION_REGEXP = r'^__version__ = \'(\d+\.\d+\.\d+)\''
r = re.search(VERSION_REGEXP, open(VERSION_FILE).r... | none | 1 | 1.973269 | 2 | |
avilla/core/resource/interface.py | RF-Tar-Railt/Avilla | 0 | 7852 | <filename>avilla/core/resource/interface.py
from __future__ import annotations
from dataclasses import dataclass
from avilla.core.platform import Base
from avilla.core.resource import Resource, ResourceProvider
@dataclass
class ResourceMatchPrefix:
resource_type: type[Resource]
keypath: str | None = None
... | <filename>avilla/core/resource/interface.py
from __future__ import annotations
from dataclasses import dataclass
from avilla.core.platform import Base
from avilla.core.resource import Resource, ResourceProvider
@dataclass
class ResourceMatchPrefix:
resource_type: type[Resource]
keypath: str | None = None
... | none | 1 | 2.307915 | 2 | |
viewer_examples/plugins/median_filter.py | atemysemicolon/scikit-image | 0 | 7853 | <filename>viewer_examples/plugins/median_filter.py
from skimage import data
from skimage.filter.rank import median
from skimage.morphology import disk
from skimage.viewer import ImageViewer
from skimage.viewer.widgets import Slider, OKCancelButtons, SaveButtons
from skimage.viewer.plugins.base import Plugin
def media... | <filename>viewer_examples/plugins/median_filter.py
from skimage import data
from skimage.filter.rank import median
from skimage.morphology import disk
from skimage.viewer import ImageViewer
from skimage.viewer.widgets import Slider, OKCancelButtons, SaveButtons
from skimage.viewer.plugins.base import Plugin
def media... | none | 1 | 2.314453 | 2 | |
autotest/test_gwf_buy_lak01.py | scharlton2/modflow6 | 3 | 7854 | <gh_stars>1-10
# Test the buoyancy package and the variable density flows between the lake
# and the gwf model. This model has 4 layers and a lake incised within it.
# The model is transient and has heads in the aquifer higher than the initial
# stage in the lake. As the model runs, the lake and aquifer equalize and
... | # Test the buoyancy package and the variable density flows between the lake
# and the gwf model. This model has 4 layers and a lake incised within it.
# The model is transient and has heads in the aquifer higher than the initial
# stage in the lake. As the model runs, the lake and aquifer equalize and
# should end up... | en | 0.778732 | # Test the buoyancy package and the variable density flows between the lake # and the gwf model. This model has 4 layers and a lake incised within it. # The model is transient and has heads in the aquifer higher than the initial # stage in the lake. As the model runs, the lake and aquifer equalize and # should end up... | 2.582623 | 3 |
lesson-08/roll_dice_v1.0.py | hemiaoio/pylearning | 1 | 7855 | """
功能:模拟掷骰子
版本:1.0
"""
import random
def roll_dice():
roll = random.randint(1, 6)
return roll
def main():
total_times = 100000
result_list = [0] * 6
for i in range(total_times):
roll = roll_dice()
result_list[roll-1] += 1
for i, x in enumerate(result_list):
... | """
功能:模拟掷骰子
版本:1.0
"""
import random
def roll_dice():
roll = random.randint(1, 6)
return roll
def main():
total_times = 100000
result_list = [0] * 6
for i in range(total_times):
roll = roll_dice()
result_list[roll-1] += 1
for i, x in enumerate(result_list):
... | zh | 0.999261 | 功能:模拟掷骰子 版本:1.0 | 3.693894 | 4 |
composer/dataflow-python3/main.py | gxercavins/gcp-snippets | 2 | 7856 | <filename>composer/dataflow-python3/main.py
import argparse
import logging
import apache_beam as beam
from apache_beam.options.pipeline_options import PipelineOptions
from apache_beam.options.pipeline_options import SetupOptions
def run(argv=None, save_main_session=True):
"""Dummy pipeline to test Python3 operator... | <filename>composer/dataflow-python3/main.py
import argparse
import logging
import apache_beam as beam
from apache_beam.options.pipeline_options import PipelineOptions
from apache_beam.options.pipeline_options import SetupOptions
def run(argv=None, save_main_session=True):
"""Dummy pipeline to test Python3 operator... | en | 0.574772 | Dummy pipeline to test Python3 operator. # Just a simple test | 2.082485 | 2 |
dingtalk/message/conversation.py | kangour/dingtalk-python | 88 | 7857 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2017/11/30 下午3:02
# @Author : Matrix
# @Github : https://github.com/blackmatrix7/
# @Blog : http://www.cnblogs.com/blackmatrix/
# @File : messages.py
# @Software: PyCharm
import json
from ..foundation import *
from json import JSONDecodeError
__author__ = 'blackm... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2017/11/30 下午3:02
# @Author : Matrix
# @Github : https://github.com/blackmatrix7/
# @Blog : http://www.cnblogs.com/blackmatrix/
# @File : messages.py
# @Software: PyCharm
import json
from ..foundation import *
from json import JSONDecodeError
__author__ = 'blackm... | zh | 0.431877 | #!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2017/11/30 下午3:02 # @Author : Matrix # @Github : https://github.com/blackmatrix7/ # @Blog : http://www.cnblogs.com/blackmatrix/ # @File : messages.py # @Software: PyCharm # 如果传入的msgcontent不能转换为json格式,依旧传给钉钉,由钉钉处理 # 请求参数整理 | 1.836874 | 2 |
backend/garpix_page/setup.py | griviala/garpix_page | 0 | 7858 | <reponame>griviala/garpix_page<filename>backend/garpix_page/setup.py
from setuptools import setup, find_packages
from os import path
here = path.join(path.abspath(path.dirname(__file__)), 'garpix_page')
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='... | from setuptools import setup, find_packages
from os import path
here = path.join(path.abspath(path.dirname(__file__)), 'garpix_page')
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='garpix_page',
version='2.23.0',
description='',
long_desc... | none | 1 | 1.310001 | 1 | |
.kodi/addons/plugin.video.p2p-streams/resources/core/livestreams.py | C6SUMMER/allinclusive-kodi-pi | 0 | 7859 | # -*- coding: utf-8 -*-
""" p2p-streams (c) 2014 enen92 fightnight
This file contains the livestream addon engine. It is mostly based on divingmule work on livestreams addon!
Functions:
xml_lists_menu() -> main menu for the xml list category
addlista() -> add a new list. It'll ask for local or rem... | # -*- coding: utf-8 -*-
""" p2p-streams (c) 2014 enen92 fightnight
This file contains the livestream addon engine. It is mostly based on divingmule work on livestreams addon!
Functions:
xml_lists_menu() -> main menu for the xml list category
addlista() -> add a new list. It'll ask for local or rem... | en | 0.582742 | # -*- coding: utf-8 -*- p2p-streams (c) 2014 enen92 fightnight This file contains the livestream addon engine. It is mostly based on divingmule work on livestreams addon! Functions: xml_lists_menu() -> main menu for the xml list category addlista() -> add a new list. It'll ask for local or remote a... | 2.200475 | 2 |
RainIt/rain_it/ric/Procedure.py | luisgepeto/RainItPi | 0 | 7860 | <gh_stars>0
from ric.RainItComposite import RainItComposite
class Procedure(RainItComposite):
def __init__(self):
super().__init__()
def get_pickle_form(self):
return self
| from ric.RainItComposite import RainItComposite
class Procedure(RainItComposite):
def __init__(self):
super().__init__()
def get_pickle_form(self):
return self | none | 1 | 2.180404 | 2 | |
1067.py | FahimFBA/URI-Problem-Solve | 3 | 7861 | <gh_stars>1-10
valor = int(input())
for i in range(valor+1):
if(i%2 != 0):
print(i) | valor = int(input())
for i in range(valor+1):
if(i%2 != 0):
print(i) | none | 1 | 3.569414 | 4 | |
api-reference-examples/python/te-tag-query/api-example-update.py | b-bold/ThreatExchange | 997 | 7862 | #!/usr/bin/env python
# ================================================================
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
# ================================================================
import sys
import json
import TE
TE.Net.setAppTokenFromEnvName("TX_ACCESS_TOKEN")
postPar... | #!/usr/bin/env python
# ================================================================
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
# ================================================================
import sys
import json
import TE
TE.Net.setAppTokenFromEnvName("TX_ACCESS_TOKEN")
postPar... | en | 0.552636 | #!/usr/bin/env python # ================================================================ # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # ================================================================ # ID of the descriptor to be updated | 1.875067 | 2 |
loaner/web_app/backend/api/shelf_api_test.py | Bottom-Feeders/GrabNGO | 0 | 7863 | # Copyright 2018 Google Inc. 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 by applicable law or a... | # Copyright 2018 Google Inc. 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 by applicable law or a... | en | 0.865095 | # Copyright 2018 Google Inc. 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 by applicable law or a... | 1.675881 | 2 |
app/views/main.py | ArmandDS/ai_bert_resumes | 1 | 7864 | from flask import render_template, jsonify, Flask, redirect, url_for, request
from app import app
import random
import os
# import tensorflow as tf
# import numpy as np
# import sys
# import spacy
# nlp = spacy.load('en')
# sys.path.insert(0, "/content/bert_experimental")
# from bert_experimental.finetuning.text_pre... | from flask import render_template, jsonify, Flask, redirect, url_for, request
from app import app
import random
import os
# import tensorflow as tf
# import numpy as np
# import sys
# import spacy
# nlp = spacy.load('en')
# sys.path.insert(0, "/content/bert_experimental")
# from bert_experimental.finetuning.text_pre... | en | 0.395618 | # import tensorflow as tf # import numpy as np # import sys # import spacy # nlp = spacy.load('en') # sys.path.insert(0, "/content/bert_experimental") # from bert_experimental.finetuning.text_preprocessing import build_preprocessor # from bert_experimental.finetuning.graph_ops import load_graph # restored_graph = load_... | 2.219543 | 2 |
ahrs/filters/complementary.py | jaluebbe/ahrs | 0 | 7865 | # -*- coding: utf-8 -*-
"""
Complementary Filter
====================
Attitude quaternion obtained with gyroscope and accelerometer-magnetometer
measurements, via complementary filter.
First, the current orientation is estimated at time :math:`t`, from a previous
orientation at time :math:`t-1`, and a given ... | # -*- coding: utf-8 -*-
"""
Complementary Filter
====================
Attitude quaternion obtained with gyroscope and accelerometer-magnetometer
measurements, via complementary filter.
First, the current orientation is estimated at time :math:`t`, from a previous
orientation at time :math:`t-1`, and a given ... | en | 0.522727 | # -*- coding: utf-8 -*- Complementary Filter
====================
Attitude quaternion obtained with gyroscope and accelerometer-magnetometer
measurements, via complementary filter.
First, the current orientation is estimated at time :math:`t`, from a previous
orientation at time :math:`t-1`, and a given angula... | 2.506427 | 3 |
aliyun-python-sdk-ehpc/aliyunsdkehpc/request/v20180412/EditJobTemplateRequest.py | yndu13/aliyun-openapi-python-sdk | 1,001 | 7866 | <gh_stars>1000+
# 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"... | # 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... | en | 0.86503 | # 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... | 1.683925 | 2 |
tests/common/models/test_execution.py | angry-tony/ceph-lcm-decapod | 41 | 7867 | # -*- coding: utf-8 -*-
# Copyright (c) 2016 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | # -*- coding: utf-8 -*-
# Copyright (c) 2016 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | en | 0.838083 | # -*- coding: utf-8 -*- # Copyright (c) 2016 Mirantis Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ... | 1.877144 | 2 |
board/models.py | Fahreeve/TaskManager | 0 | 7868 | from django.contrib.auth.models import User
from django.core.validators import MaxValueValidator, MinValueValidator
from django.db import models
from django.utils.translation import ugettext_lazy as _
class Task(models.Model):
CLOSE = 'cl'
CANCEL = 'ca'
LATER = 'la'
UNDEFINED = 'un'
CHOICES = (
... | from django.contrib.auth.models import User
from django.core.validators import MaxValueValidator, MinValueValidator
from django.db import models
from django.utils.translation import ugettext_lazy as _
class Task(models.Model):
CLOSE = 'cl'
CANCEL = 'ca'
LATER = 'la'
UNDEFINED = 'un'
CHOICES = (
... | none | 1 | 2.067338 | 2 | |
test/test_hex_line.py | bicobus/Hexy | 72 | 7869 | import numpy as np
import hexy as hx
def test_get_hex_line():
expected = [
[-3, 3, 0],
[-2, 2, 0],
[-1, 2, -1],
[0, 2, -2],
[1, 1, -2],
]
start = np.array([-3, 3, 0])
end = np.array([1, 1, -2])
print(hx.get_hex_line(start, end))
... | import numpy as np
import hexy as hx
def test_get_hex_line():
expected = [
[-3, 3, 0],
[-2, 2, 0],
[-1, 2, -1],
[0, 2, -2],
[1, 1, -2],
]
start = np.array([-3, 3, 0])
end = np.array([1, 1, -2])
print(hx.get_hex_line(start, end))
... | none | 1 | 2.986338 | 3 | |
wofry/propagator/propagators2D/integral.py | PaNOSC-ViNYL/wofry | 0 | 7870 | <reponame>PaNOSC-ViNYL/wofry<filename>wofry/propagator/propagators2D/integral.py
# propagate_2D_integral: Simplification of the Kirchhoff-Fresnel integral. TODO: Very slow and give some problems
import numpy
from wofry.propagator.wavefront2D.generic_wavefront import GenericWavefront2D
from wofry.propagator.propagat... | # propagate_2D_integral: Simplification of the Kirchhoff-Fresnel integral. TODO: Very slow and give some problems
import numpy
from wofry.propagator.wavefront2D.generic_wavefront import GenericWavefront2D
from wofry.propagator.propagator import Propagator2D
# TODO: check resulting amplitude normalization (fft and ... | en | 0.783655 | # propagate_2D_integral: Simplification of the Kirchhoff-Fresnel integral. TODO: Very slow and give some problems # TODO: check resulting amplitude normalization (fft and srw likely agree, convolution gives too high amplitudes, so needs normalization) 2D Fresnel-Kirchhoff propagator via simplified integral NOTE:... | 2.862553 | 3 |
Problems/Study Plans/Dynamic Programming/Dynamic Programming I/07_delete_and_earn.py | andor2718/LeetCode | 1 | 7871 | <filename>Problems/Study Plans/Dynamic Programming/Dynamic Programming I/07_delete_and_earn.py
# https://leetcode.com/problems/delete-and-earn/
class Solution:
def deleteAndEarn(self, nums: list[int]) -> int:
num_profits = dict()
for num in nums:
num_profits[num] = num_profits.get(num, ... | <filename>Problems/Study Plans/Dynamic Programming/Dynamic Programming I/07_delete_and_earn.py
# https://leetcode.com/problems/delete-and-earn/
class Solution:
def deleteAndEarn(self, nums: list[int]) -> int:
num_profits = dict()
for num in nums:
num_profits[num] = num_profits.get(num, ... | en | 0.870386 | # https://leetcode.com/problems/delete-and-earn/ | 3.373651 | 3 |
Desafio051.py | GabrielSanchesRosa/Python | 0 | 7872 | <gh_stars>0
# Desenvolva um programa que leia o primeiro termo e a razão de uma PA. No final mostre, os 10 primeiros termos dessa prograssão.
primeiro = int(input("Primeiro Termo: "))
razao = int(input("Razão: "))
decimo = primeiro + (10 - 1) * razao
for c in range(primeiro, decimo + razao, razao):
print(f"{c}", en... | # Desenvolva um programa que leia o primeiro termo e a razão de uma PA. No final mostre, os 10 primeiros termos dessa prograssão.
primeiro = int(input("Primeiro Termo: "))
razao = int(input("Razão: "))
decimo = primeiro + (10 - 1) * razao
for c in range(primeiro, decimo + razao, razao):
print(f"{c}", end=" -> ")
pr... | pt | 0.994836 | # Desenvolva um programa que leia o primeiro termo e a razão de uma PA. No final mostre, os 10 primeiros termos dessa prograssão. | 3.885947 | 4 |
tiddlyweb/filters/limit.py | tiddlyweb/tiddlyweb | 57 | 7873 | """
A :py:mod:`filter <tiddlyweb.filters>` type to limit a group of entities
using a syntax similar to SQL Limit::
limit=<index>,<count>
limit=<count>
"""
import itertools
def limit_parse(count='0'):
"""
Parse the argument of a ``limit`` :py:mod:`filter <tiddlyweb.filters>`
for a count and index... | """
A :py:mod:`filter <tiddlyweb.filters>` type to limit a group of entities
using a syntax similar to SQL Limit::
limit=<index>,<count>
limit=<count>
"""
import itertools
def limit_parse(count='0'):
"""
Parse the argument of a ``limit`` :py:mod:`filter <tiddlyweb.filters>`
for a count and index... | en | 0.617931 | A :py:mod:`filter <tiddlyweb.filters>` type to limit a group of entities using a syntax similar to SQL Limit:: limit=<index>,<count> limit=<count> Parse the argument of a ``limit`` :py:mod:`filter <tiddlyweb.filters>` for a count and index argument, return a function which does the limiting. Exception... | 3.31954 | 3 |
pytorch_keras_converter/API.py | sonibla/pytorch_keras_converter | 17 | 7874 | """
Simple API to convert models between PyTorch and Keras
(Conversions from Keras to PyTorch aren't implemented)
"""
from . import utility
from . import tests
from . import io_utils as utils
import tensorflow
def convert(model,
input_shape,
weights=True,
quiet=True,
i... | """
Simple API to convert models between PyTorch and Keras
(Conversions from Keras to PyTorch aren't implemented)
"""
from . import utility
from . import tests
from . import io_utils as utils
import tensorflow
def convert(model,
input_shape,
weights=True,
quiet=True,
i... | en | 0.818842 | Simple API to convert models between PyTorch and Keras (Conversions from Keras to PyTorch aren't implemented) Conversion between PyTorch and Keras (Conversions from Keras to PyTorch aren't implemented) Arguments: -model: A Keras or PyTorch model or layer to convert -input_shape: ... | 3.527183 | 4 |
examples/enable_notifications.py | kjwill/bleak | 0 | 7875 | # -*- coding: utf-8 -*-
"""
Notifications
-------------
Example showing how to add notifications to a characteristic and handle the responses.
Updated on 2019-07-03 by hbldh <<EMAIL>>
"""
import sys
import logging
import asyncio
import platform
from bleak import BleakClient
from bleak import _logger as logger
CH... | # -*- coding: utf-8 -*-
"""
Notifications
-------------
Example showing how to add notifications to a characteristic and handle the responses.
Updated on 2019-07-03 by hbldh <<EMAIL>>
"""
import sys
import logging
import asyncio
import platform
from bleak import BleakClient
from bleak import _logger as logger
CH... | en | 0.799439 | # -*- coding: utf-8 -*- Notifications ------------- Example showing how to add notifications to a characteristic and handle the responses. Updated on 2019-07-03 by hbldh <<EMAIL>> # <--- Change to the characteristic you want to enable notifications from. # <--- Change to your device's address here if you are using Wi... | 2.906982 | 3 |
pyrules/storages/base.py | miraculixx/pyrules | 17 | 7876 | <reponame>miraculixx/pyrules<gh_stars>10-100
class BaseStorage(object):
def get_rule(self, name):
raise NotImplementedError()
def get_ruleset(self, name):
raise NotImplementedError()
| class BaseStorage(object):
def get_rule(self, name):
raise NotImplementedError()
def get_ruleset(self, name):
raise NotImplementedError() | none | 1 | 1.911611 | 2 | |
src/15 listener_and_backdoor/listener_2.py | raminjafary/ethical-hacking | 0 | 7877 | <filename>src/15 listener_and_backdoor/listener_2.py<gh_stars>0
#!/usr/bin/python
import socket
class Listener:
def __init__(self,ip,port):
listener = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
listener.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1)
#options to reuse sockets
#listener.bind(("loc... | <filename>src/15 listener_and_backdoor/listener_2.py<gh_stars>0
#!/usr/bin/python
import socket
class Listener:
def __init__(self,ip,port):
listener = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
listener.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1)
#options to reuse sockets
#listener.bind(("loc... | en | 0.66066 | #!/usr/bin/python #options to reuse sockets #listener.bind(("localhost",1234)) #listen for connecion backlog is set to 0 don't need to wory about 0 | 2.954163 | 3 |
dialogflow/history2xls.py | ray-hrst/temi-tools | 1 | 7878 | <filename>dialogflow/history2xls.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
""" Convert Dialogflow history to spreadsheet
User must manually copy the history from the browser and save this in a text file.
This reads the textfile, parses the data, and saves it to a spreadsheet.
Example training sample:
USER
... | <filename>dialogflow/history2xls.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
""" Convert Dialogflow history to spreadsheet
User must manually copy the history from the browser and save this in a text file.
This reads the textfile, parses the data, and saves it to a spreadsheet.
Example training sample:
USER
... | en | 0.651145 | #!/usr/bin/env python3 # -*- coding: utf-8 -*- Convert Dialogflow history to spreadsheet User must manually copy the history from the browser and save this in a text file. This reads the textfile, parses the data, and saves it to a spreadsheet. Example training sample: USER サワディカ Nov 4, 11:19 PM AGENT No matched i... | 3.500482 | 4 |
recognition/views.py | usathe71-u/Attendance-System-Face-Recognition | 3 | 7879 | from django.shortcuts import render,redirect
from .forms import usernameForm,DateForm,UsernameAndDateForm, DateForm_2
from django.contrib import messages
from django.contrib.auth.models import User
import cv2
import dlib
import imutils
from imutils import face_utils
from imutils.video import VideoStream
from imutils.fa... | from django.shortcuts import render,redirect
from .forms import usernameForm,DateForm,UsernameAndDateForm, DateForm_2
from django.contrib import messages
from django.contrib.auth.models import User
import cv2
import dlib
import imutils
from imutils import face_utils
from imutils.video import VideoStream
from imutils.fa... | en | 0.825666 | #import mpld3 #utility functions: # Detect face #Loading the HOG face detector and the shape predictpr for allignment #Add path to the shape predictor ######CHANGE TO RELATIVE PATH LATER #capture images from the webcam and process and detect the face # Initialize the video stream #time.sleep(2.0) ####CHECK###### # Our ... | 2.174212 | 2 |
2018/05.py | GillesArcas/Advent_of_Code | 0 | 7880 | import re
import string
DATA = '05.txt'
def react(polymer):
pairs = '|'.join([a + b + '|' + b + a for a, b in zip(string.ascii_lowercase, string.ascii_uppercase)])
length = len(polymer)
while 1:
polymer = re.sub(pairs, '', polymer)
if len(polymer) == length:
retu... | import re
import string
DATA = '05.txt'
def react(polymer):
pairs = '|'.join([a + b + '|' + b + a for a, b in zip(string.ascii_lowercase, string.ascii_uppercase)])
length = len(polymer)
while 1:
polymer = re.sub(pairs, '', polymer)
if len(polymer) == length:
retu... | none | 1 | 3.276272 | 3 | |
lib/fbuild/builders/__init__.py | felix-lang/fbuild | 40 | 7881 | <reponame>felix-lang/fbuild
import abc
import contextlib
import os
import sys
from functools import partial
from itertools import chain
import fbuild
import fbuild.db
import fbuild.path
import fbuild.temp
from . import platform
# ------------------------------------------------------------------------------
class Mi... | import abc
import contextlib
import os
import sys
from functools import partial
from itertools import chain
import fbuild
import fbuild.db
import fbuild.path
import fbuild.temp
from . import platform
# ------------------------------------------------------------------------------
class MissingProgram(fbuild.ConfigFa... | en | 0.614639 | # ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------ L{find_program} is a test that searches the paths for one of the programs in I{name}. If one is found, it is returned. If not, the next name in the ... | 2.474084 | 2 |
WebServer.py | i3uex/CompareML | 0 | 7882 | import json
import cherrypy
import engine
class WebServer(object):
@cherrypy.expose
def index(self):
return open('public/index.html', encoding='utf-8')
@cherrypy.expose
class GetOptionsService(object):
@cherrypy.tools.accept(media='text/plain')
def GET(self):
return json.dumps({
... | import json
import cherrypy
import engine
class WebServer(object):
@cherrypy.expose
def index(self):
return open('public/index.html', encoding='utf-8')
@cherrypy.expose
class GetOptionsService(object):
@cherrypy.tools.accept(media='text/plain')
def GET(self):
return json.dumps({
... | en | 0.364017 | Use the options selected by the user to execute all algorithms :param options: { is_default_dataset: bool, dataset: str, providers: [] algorithms: [] target: str } if is_default_dataset is ... | 2.610424 | 3 |
tuprolog/solve/exception/error/existence/__init__.py | DavideEva/2ppy | 1 | 7883 | from typing import Union
from tuprolog import logger
# noinspection PyUnresolvedReferences
import jpype.imports
# noinspection PyUnresolvedReferences
import it.unibo.tuprolog.solve.exception.error as errors
from tuprolog.core import Term, Atom
from tuprolog.solve import ExecutionContext, Signature
ExistenceError = err... | from typing import Union
from tuprolog import logger
# noinspection PyUnresolvedReferences
import jpype.imports
# noinspection PyUnresolvedReferences
import it.unibo.tuprolog.solve.exception.error as errors
from tuprolog.core import Term, Atom
from tuprolog.solve import ExecutionContext, Signature
ExistenceError = err... | en | 0.462226 | # noinspection PyUnresolvedReferences # noinspection PyUnresolvedReferences | 2.042224 | 2 |
cptk/core/fetcher.py | RealA10N/cptk | 5 | 7884 | <filename>cptk/core/fetcher.py
from __future__ import annotations
from typing import TYPE_CHECKING
import pkg_resources
from bs4 import BeautifulSoup
from requests import session
from cptk.scrape import PageInfo
from cptk.scrape import Website
from cptk.utils import cptkException
if TYPE_CHECKING:
from cptk.scr... | <filename>cptk/core/fetcher.py
from __future__ import annotations
from typing import TYPE_CHECKING
import pkg_resources
from bs4 import BeautifulSoup
from requests import session
from cptk.scrape import PageInfo
from cptk.scrape import Website
from cptk.utils import cptkException
if TYPE_CHECKING:
from cptk.scr... | en | 0.9399 | Raised when the clone command is called with a 'PageInfo' instance that doesn't describe anything that can be cloned. Raised when trying to fetch information from a website that is not registed and can't be handled by cptk. Recives an arbitrary page info instance and tries to match it with a Website cla... | 2.738153 | 3 |
machine_learning/deep_reinforcement_learning_grasping/drlgrasp/drlgrasp/pybullet_envs/kuka_reach_with_visual.py | Hinson-A/guyueclass | 227 | 7885 | import pybullet as p
import pybullet_data
import gym
from gym import spaces
from gym.utils import seeding
import numpy as np
from math import sqrt
import random
import time
import math
import cv2
import torch
import os
def random_crop(imgs, out):
"""
args:
imgs: shape (B,C,H,W)
... | import pybullet as p
import pybullet_data
import gym
from gym import spaces
from gym.utils import seeding
import numpy as np
from math import sqrt
import random
import time
import math
import cv2
import torch
import os
def random_crop(imgs, out):
"""
args:
imgs: shape (B,C,H,W)
... | en | 0.486973 | args:
imgs: shape (B,C,H,W)
out: output size (e.g. 84) # lower limits for null space # upper limits for null space # joint ranges for null space # restposes for null space # joint damping coefficents # I really do not know the parameter's effect. # the direction is from the light source position to th... | 2.31545 | 2 |
bucket_4C/python-Pillow/patches/patch-setup.py | jrmarino/ravensource | 17 | 7886 | <reponame>jrmarino/ravensource
--- setup.py.orig 2019-07-02 19:13:39 UTC
+++ setup.py
@@ -465,9 +465,7 @@ class pil_build_ext(build_ext):
_add_directory(include_dirs, "/usr/X11/include")
elif (
- sys.platform.startswith("linux")
- or sys.platform.startswith("gnu")
- ... | --- setup.py.orig 2019-07-02 19:13:39 UTC
+++ setup.py
@@ -465,9 +465,7 @@ class pil_build_ext(build_ext):
_add_directory(include_dirs, "/usr/X11/include")
elif (
- sys.platform.startswith("linux")
- or sys.platform.startswith("gnu")
- or sys.platform.startsw... | none | 1 | 1.477857 | 1 | |
tests/ut/cpp/python_input/gtest_input/pre_activate/ir_fusion_test.py | GeekHee/mindspore | 0 | 7887 | <reponame>GeekHee/mindspore
# Copyright 2019 Huawei Technologies Co., Ltd
#
# 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... | # Copyright 2019 Huawei Technologies Co., Ltd
#
# 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... | en | 0.756184 | # Copyright 2019 Huawei Technologies Co., Ltd # # 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... | 1.630164 | 2 |
tdx/abc.py | TrainerDex/DiscordBot | 2 | 7888 | <reponame>TrainerDex/DiscordBot
from abc import ABC
from typing import Dict
from redbot.core import Config
from redbot.core.bot import Red
from trainerdex.client import Client
class MixinMeta(ABC):
"""
Base class for well behaved type hint detection with composite class.
Basically, to keep developers sa... | from abc import ABC
from typing import Dict
from redbot.core import Config
from redbot.core.bot import Red
from trainerdex.client import Client
class MixinMeta(ABC):
"""
Base class for well behaved type hint detection with composite class.
Basically, to keep developers sane when not all attributes are d... | en | 0.877125 | Base class for well behaved type hint detection with composite class. Basically, to keep developers sane when not all attributes are defined in each mixin. | 2.592952 | 3 |
app.py | PolinaRomanchenko/Victorious_Secret_DSCI_532 | 0 | 7889 | import dash
import dash_core_components as dcc
import dash_html_components as html
import dash_bootstrap_components as dbc
import pandas as pd
import numpy as np
import altair as alt
import vega_datasets
alt.data_transformers.enable('default')
alt.data_transformers.disable_max_rows()
app = dash.Dash(__name__, assets_f... | import dash
import dash_core_components as dcc
import dash_html_components as html
import dash_bootstrap_components as dbc
import pandas as pd
import numpy as np
import altair as alt
import vega_datasets
alt.data_transformers.enable('default')
alt.data_transformers.disable_max_rows()
app = dash.Dash(__name__, assets_f... | en | 0.843141 | # Boostrap CSS. # noqa: E501 # df = pd.read_csv("https://raw.github.ubc.ca/MDS-2019-20/DSCI_531_lab4_anas017/master/data/Police_Department_Incidents_-_Previous_Year__2016_.csv?token=<PASSWORD>%3D") # top 4 crimes df subset # Create a plot of the Displacement and the Horsepower of the cars dataset # making the slider #b... | 2.439926 | 2 |
catkin_ws/src:/opt/ros/kinetic/lib/python2.7/dist-packages:/home/bala/duckietown/catkin_ws/src:/home/bala/duckietown/catkin_ws/src/lib/python2.7/site-packages/geometry/subspaces/__init__.py | johnson880319/Software | 0 | 7890 | <reponame>johnson880319/Software
# coding=utf-8
from .subspaces import *
| # coding=utf-8
from .subspaces import * | en | 0.644078 | # coding=utf-8 | 1.032755 | 1 |
detection/contor.py | chika626/chainer_rep | 0 | 7891 | <reponame>chika626/chainer_rep
import json
import math
from PIL import Image,ImageDraw
import pandas as pd
import glob
import argparse
import copy
import numpy as np
import matplotlib.pyplot as plt
import pickle
import cv2
from PIL import ImageEnhance
import chainer
from chainer.datasets import Concate... | import json
import math
from PIL import Image,ImageDraw
import pandas as pd
import glob
import argparse
import copy
import numpy as np
import matplotlib.pyplot as plt
import pickle
import cv2
from PIL import ImageEnhance
import chainer
from chainer.datasets import ConcatenatedDataset
from chainer.data... | en | 0.161858 | # c , H , W = img.shape # 変換後データ配列 # # 単一の場合のコード # img = Image.open('cont/transed/X.jpg') # img=img.convert('L') # img=np.asarray(img) # ret2, img = cv2.threshold(img, 0, 255, cv2.THRESH_OTSU) # img=Image.fromarray(img) # img=img.convert('RGB') # transed = run(img) # transed.save('transec_0.png') # return # 大量変換機 | 2.138811 | 2 |
train.py | hjl-yul154/autodeeplab | 1 | 7892 | import os
import pdb
import warnings
import numpy as np
import torch
import torch.nn as nn
import torch.utils.data
import torch.backends.cudnn
import torch.optim as optim
import dataloaders
from utils.utils import AverageMeter
from utils.loss import build_criterion
from utils.metrics import Evaluator
from utils.step_... | import os
import pdb
import warnings
import numpy as np
import torch
import torch.nn as nn
import torch.utils.data
import torch.backends.cudnn
import torch.optim as optim
import dataloaders
from utils.utils import AverageMeter
from utils.loss import build_criterion
from utils.metrics import Evaluator
from utils.step_... | en | 0.249896 | # loss = criterion(outputs, target) # test_loss+=loss.item() | 2.002383 | 2 |
test.py | xxaxdxcxx/miscellaneous-code | 0 | 7893 | class Solution:
# dictionary keys are tuples, storing results
# structure of the tuple:
# (level, prev_sum, val_to_include)
# value is number of successful tuples
def fourSumCount(self, A, B, C, D, prev_sum=0, level=0, sums={}):
"""
:type A: List[int]
:type B: List[int]
... | class Solution:
# dictionary keys are tuples, storing results
# structure of the tuple:
# (level, prev_sum, val_to_include)
# value is number of successful tuples
def fourSumCount(self, A, B, C, D, prev_sum=0, level=0, sums={}):
"""
:type A: List[int]
:type B: List[int]
... | en | 0.710117 | # dictionary keys are tuples, storing results # structure of the tuple: # (level, prev_sum, val_to_include) # value is number of successful tuples :type A: List[int] :type B: List[int] :type C: List[int] :type D: List[int] :rtype: int # handle clearing dictionary between tests # base cas... | 3.47305 | 3 |
src/boot.py | johngtrs/krux | 0 | 7894 | # The MIT License (MIT)
# Copyright (c) 2021 <NAME>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merg... | # The MIT License (MIT)
# Copyright (c) 2021 <NAME>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merg... | en | 0.79675 | # The MIT License (MIT) # Copyright (c) 2021 <NAME> # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge,... | 2.145698 | 2 |
smartfields/processors/video.py | suhaibroomy/django-smartfields | 0 | 7895 | <reponame>suhaibroomy/django-smartfields<filename>smartfields/processors/video.py
import re
import six
from smartfields.processors.base import ExternalFileProcessor
from smartfields.utils import ProcessingError
__all__ = [
'FFMPEGProcessor'
]
class FFMPEGProcessor(ExternalFileProcessor):
duration_re = re.com... | import re
import six
from smartfields.processors.base import ExternalFileProcessor
from smartfields.utils import ProcessingError
__all__ = [
'FFMPEGProcessor'
]
class FFMPEGProcessor(ExternalFileProcessor):
duration_re = re.compile(r'Duration: (?P<hours>\d+):(?P<minutes>\d+):(?P<seconds>\d+)')
progress_r... | none | 1 | 2.639082 | 3 | |
tests/test_vmtkScripts/test_vmtksurfaceconnectivity.py | ramtingh/vmtk | 0 | 7896 | ## Program: VMTK
## Language: Python
## Date: January 12, 2018
## Version: 1.4
## Copyright (c) <NAME>, <NAME>, All rights reserved.
## See LICENSE file for details.
## This software is distributed WITHOUT ANY WARRANTY; without even
## the implied warranty of MERCHANTABILITY or FITNESS FOR A PAR... | ## Program: VMTK
## Language: Python
## Date: January 12, 2018
## Version: 1.4
## Copyright (c) <NAME>, <NAME>, All rights reserved.
## See LICENSE file for details.
## This software is distributed WITHOUT ANY WARRANTY; without even
## the implied warranty of MERCHANTABILITY or FITNESS FOR A PAR... | en | 0.813863 | ## Program: VMTK ## Language: Python ## Date: January 12, 2018 ## Version: 1.4 ## Copyright (c) <NAME>, <NAME>, All rights reserved. ## See LICENSE file for details. ## This software is distributed WITHOUT ANY WARRANTY; without even ## the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTI... | 2.263942 | 2 |
sssoon/forms.py | Kingpin-Apps/django-sssoon | 2 | 7897 | <gh_stars>1-10
from django import forms
from nocaptcha_recaptcha.fields import NoReCaptchaField
class NewsletterForm(forms.Form):
email = forms.EmailField(label='Email', required=True,
widget=forms.TextInput(attrs={
'id': 'newsletter-email',
... | from django import forms
from nocaptcha_recaptcha.fields import NoReCaptchaField
class NewsletterForm(forms.Form):
email = forms.EmailField(label='Email', required=True,
widget=forms.TextInput(attrs={
'id': 'newsletter-email',
... | none | 1 | 2.312255 | 2 | |
simple_run_menu.py | william01110111/simple_run_menu | 0 | 7898 | <reponame>william01110111/simple_run_menu
#! /bin/python3
# simple run menu
import os
import stat
def is_file_executable(path):
executable = stat.S_IEXEC | stat.S_IXGRP | stat.S_IXOTH
if not os.path.isfile(path):
return False
st = os.stat(path)
mode = st.st_mode
if not mode & executable:
return False
return... | #! /bin/python3
# simple run menu
import os
import stat
def is_file_executable(path):
executable = stat.S_IEXEC | stat.S_IXGRP | stat.S_IXOTH
if not os.path.isfile(path):
return False
st = os.stat(path)
mode = st.st_mode
if not mode & executable:
return False
return True
def get_files_in_dir(directory):
i... | en | 0.133357 | #! /bin/python3 # simple run menu | 2.74288 | 3 |
mne/io/cnt/tests/test_cnt.py | stevemats/mne-python | 1,953 | 7899 |
# Author: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
# License: BSD-3-Clause
import os.path as op
import numpy as np
from numpy.testing import assert_array_equal
import pytest
from mne import pick_types
from mne.datasets import testing
from mne.io.tests.test_raw import _test_raw_reader
from mne.io.cnt import rea... |
# Author: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
# License: BSD-3-Clause
import os.path as op
import numpy as np
from numpy.testing import assert_array_equal
import pytest
from mne import pick_types
from mne.datasets import testing
from mne.io.tests.test_raw import _test_raw_reader
from mne.io.cnt import rea... | en | 0.705158 | # Author: <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # # License: BSD-3-Clause Test reading raw cnt files. # make sure we use annotations event if we synthesized stim # test eog='auto' # test bads # the data has "05/10/200 17:35:31" so it is set to None Test comparing annotations and events. | 2.122447 | 2 |