hexsha stringlengths 40 40 | size int64 2 1.02M | ext stringclasses 10
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 6 130 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 245 | max_issues_repo_name stringlengths 6 130 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 245 | max_forks_repo_name stringlengths 6 130 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 2 1.02M | avg_line_length float64 1 417k | max_line_length int64 1 987k | alphanum_fraction float64 0 1 | content_no_comment stringlengths 0 1.01M | is_comment_constant_removed bool 1
class | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f726d15285b7c2f6ec452d3585c75aaddfd2bc1d | 594 | py | Python | examples/vagrant_todo/provision/recipes/project.py | avladev/pypro | 7eb98c5ebd9830104689d105c36424b24c72b475 | [
"MIT"
] | null | null | null | examples/vagrant_todo/provision/recipes/project.py | avladev/pypro | 7eb98c5ebd9830104689d105c36424b24c72b475 | [
"MIT"
] | null | null | null | examples/vagrant_todo/provision/recipes/project.py | avladev/pypro | 7eb98c5ebd9830104689d105c36424b24c72b475 | [
"MIT"
] | 1 | 2019-07-15T21:35:03.000Z | 2019-07-15T21:35:03.000Z | import pypro.core
import os
class CreateConfig(pypro.core.Recipe):
def __init__(self, source, destination):
self.source = source
self.destination = destination
def run(self, runner, arguments=None):
# Read the template file
content = ''
with open(self.source, 'r') as ... | 27 | 58 | 0.622896 | import pypro.core
import os
class CreateConfig(pypro.core.Recipe):
def __init__(self, source, destination):
self.source = source
self.destination = destination
def run(self, runner, arguments=None):
content = ''
with open(self.source, 'r') as f:
content =... | true | true |
f726d1ac18979248f061387ecccea5858da651fb | 974 | py | Python | for python/data/ggiramahor/pframe.py | aerolalit/Auto-Testing-Python-Programs | dd49ab266c9f0fd8e34278f68f8af017711942e3 | [
"MIT"
] | 4 | 2019-10-03T21:16:51.000Z | 2019-10-04T01:28:08.000Z | for python/data/ggiramahor/pframe.py | aerolalit/Auto-Testing | dd49ab266c9f0fd8e34278f68f8af017711942e3 | [
"MIT"
] | null | null | null | for python/data/ggiramahor/pframe.py | aerolalit/Auto-Testing | dd49ab266c9f0fd8e34278f68f8af017711942e3 | [
"MIT"
] | null | null | null | #350111
#a3-p10.py
#Gloria Giramahoro
#g.giramahoro@jacobs-university.de
#1.defining a function that prints a rectangle made of a character
def print_frame(n,m,c):
count = 1
if (n >= m):
product1 = n*c
print (product1)
for count in range(1,m-1):
words1 = str(' ')
... | 22.651163 | 67 | 0.532854 |
def print_frame(n,m,c):
count = 1
if (n >= m):
product1 = n*c
print (product1)
for count in range(1,m-1):
words1 = str(' ')
words = (n-4)*words1
print (c,words,c)
count = count+1
print (product1)
else :
... | true | true |
f726d2195174ef150cf9c6dca642b46141ce4e9e | 13,720 | py | Python | demystifying/feature_extraction/mlp_feature_extractor.py | delemottelab/demystifying | e8527b52d5fbe0570cd391921ecda5aefceb797a | [
"MIT"
] | 16 | 2020-01-04T14:46:03.000Z | 2021-07-10T05:54:05.000Z | demystifying/feature_extraction/mlp_feature_extractor.py | delemottelab/demystifying | e8527b52d5fbe0570cd391921ecda5aefceb797a | [
"MIT"
] | 11 | 2020-01-10T16:18:17.000Z | 2022-03-20T09:53:33.000Z | demystifying/feature_extraction/mlp_feature_extractor.py | delemottelab/demystifying | e8527b52d5fbe0570cd391921ecda5aefceb797a | [
"MIT"
] | 3 | 2020-03-16T04:35:01.000Z | 2022-02-10T12:39:01.000Z | from __future__ import absolute_import, division, print_function
import logging
import sys
logging.basicConfig(
stream=sys.stdout,
format='%(asctime)s %(name)s-%(levelname)s: %(message)s',
datefmt='%Y-%m-%d %H:%M:%S')
import numpy as np
from sklearn.neural_network import MLPClassifier, MLPRegressor
from ... | 52.769231 | 183 | 0.624344 | from __future__ import absolute_import, division, print_function
import logging
import sys
logging.basicConfig(
stream=sys.stdout,
format='%(asctime)s %(name)s-%(levelname)s: %(message)s',
datefmt='%Y-%m-%d %H:%M:%S')
import numpy as np
from sklearn.neural_network import MLPClassifier, MLPRegressor
from ... | true | true |
f726d5a556fdd6e0a03f5723767785d9c1e98fa3 | 2,358 | py | Python | parallelization/collect.py | allisonChilton/Reed-Solomon | 62c367ba44940df24c7dfa23331e491f35607abc | [
"MIT"
] | null | null | null | parallelization/collect.py | allisonChilton/Reed-Solomon | 62c367ba44940df24c7dfa23331e491f35607abc | [
"MIT"
] | null | null | null | parallelization/collect.py | allisonChilton/Reed-Solomon | 62c367ba44940df24c7dfa23331e491f35607abc | [
"MIT"
] | null | null | null | import sys
import os
import subprocess
import re
import time
from dataclasses import dataclass
from typing import List
import pandas
time_reg = re.compile("Checkpoint \d: ([\d\\.]{1,})")
def run_cmd(cmd):
print(f"Running {cmd}")
proc = subprocess.run(cmd, shell=True, capture_output=True)
stdout = proc.std... | 31.026316 | 83 | 0.563189 | import sys
import os
import subprocess
import re
import time
from dataclasses import dataclass
from typing import List
import pandas
time_reg = re.compile("Checkpoint \d: ([\d\\.]{1,})")
def run_cmd(cmd):
print(f"Running {cmd}")
proc = subprocess.run(cmd, shell=True, capture_output=True)
stdout = proc.std... | true | true |
f726d81ab8d4dbd5bfa8f4889d90ea24f3a749f0 | 6,230 | py | Python | ckanext/reclineview/tests/test_view.py | florianm/ckan | 1cfd98d591ac70b4eb81048bcd227b6c1354b1bf | [
"Apache-2.0"
] | 2 | 2015-07-17T19:09:52.000Z | 2017-08-30T20:23:44.000Z | ckanext/reclineview/tests/test_view.py | florianm/ckan | 1cfd98d591ac70b4eb81048bcd227b6c1354b1bf | [
"Apache-2.0"
] | 12 | 2015-01-19T18:03:56.000Z | 2016-04-11T16:40:33.000Z | ckanext/reclineview/tests/test_view.py | florianm/ckan | 1cfd98d591ac70b4eb81048bcd227b6c1354b1bf | [
"Apache-2.0"
] | 3 | 2015-03-31T06:19:42.000Z | 2016-06-27T15:32:28.000Z | import paste.fixture
import pylons.config as config
import ckan.model as model
import ckan.tests.legacy as tests
import ckan.plugins as p
import ckan.lib.helpers as h
import ckanext.reclineview.plugin as plugin
import ckan.lib.create_test_data as create_test_data
import ckan.config.middleware as middleware
from ckan.... | 34.804469 | 78 | 0.643499 | import paste.fixture
import pylons.config as config
import ckan.model as model
import ckan.tests.legacy as tests
import ckan.plugins as p
import ckan.lib.helpers as h
import ckanext.reclineview.plugin as plugin
import ckan.lib.create_test_data as create_test_data
import ckan.config.middleware as middleware
from ckan.... | true | true |
f726d92eda80cb6386391bf319320971dd446ebc | 3,824 | py | Python | Algorithmic Methods of Data Mining/Final_project/graph_partitioning1.py | JayWu7/Machine-Learning-Courses-Study-Record | 7586c3429514bc21c7cfe42f85ca8c0fcf8f072b | [
"Apache-2.0"
] | 1 | 2019-12-04T12:03:11.000Z | 2019-12-04T12:03:11.000Z | Algorithmic Methods of Data Mining/Final_project/graph_partitioning1.py | JayWu7/Machine-Learning-Courses-Study-Record | 7586c3429514bc21c7cfe42f85ca8c0fcf8f072b | [
"Apache-2.0"
] | null | null | null | Algorithmic Methods of Data Mining/Final_project/graph_partitioning1.py | JayWu7/Machine-Learning-Courses-Study-Record | 7586c3429514bc21c7cfe42f85ca8c0fcf8f072b | [
"Apache-2.0"
] | 1 | 2019-11-18T11:20:58.000Z | 2019-11-18T11:20:58.000Z | import numpy as np
from sklearn.cluster import KMeans
import time
from scipy.sparse.linalg import eigs
from scipy.sparse import csr_matrix
class Graph:
def __init__(self, data_name):
self.filename = data_name
self.n = None
self.k = None
self.edges = self.form_graph()
# sel... | 30.110236 | 94 | 0.537918 | import numpy as np
from sklearn.cluster import KMeans
import time
from scipy.sparse.linalg import eigs
from scipy.sparse import csr_matrix
class Graph:
def __init__(self, data_name):
self.filename = data_name
self.n = None
self.k = None
self.edges = self.form_graph()
= No... | true | true |
f726d9f05387af7ecf63d8618efca4e9f2591141 | 1,539 | py | Python | python/test/crawl_stocks/crawlstocks/spiders/GuchengBlockCodes.py | qrsforever/workspace | 53c7ce7ca7da62c9fbb3d991ae9e4e34d07ece5f | [
"MIT"
] | 2 | 2017-06-07T03:20:42.000Z | 2020-01-07T09:14:26.000Z | python/test/crawl_stocks/crawlstocks/spiders/GuchengBlockCodes.py | qrsforever/workspace | 53c7ce7ca7da62c9fbb3d991ae9e4e34d07ece5f | [
"MIT"
] | null | null | null | python/test/crawl_stocks/crawlstocks/spiders/GuchengBlockCodes.py | qrsforever/workspace | 53c7ce7ca7da62c9fbb3d991ae9e4e34d07ece5f | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
import re
import scrapy
from crawlstocks.items import GuchengStockCodeItem
class GuchengblockcodesSpider(scrapy.Spider):
name = 'GuchengBlockCodes'
allowed_domains = ['hq.gucheng.com']
custom_settings = {
'ITEM_PIPELINES' : {'crawlstocks.pipelines.file.GuchengCrawlList... | 38.475 | 100 | 0.578298 |
import re
import scrapy
from crawlstocks.items import GuchengStockCodeItem
class GuchengblockcodesSpider(scrapy.Spider):
name = 'GuchengBlockCodes'
allowed_domains = ['hq.gucheng.com']
custom_settings = {
'ITEM_PIPELINES' : {'crawlstocks.pipelines.file.GuchengCrawlListPipeline':200}
... | true | true |
f726da1790877622a36dac64245198de83414f60 | 2,545 | py | Python | bigml/tests/create_projection_steps.py | devs-cloud/python_ml | 05d90f5ce1862a5d2d8ff99d2e46446dc1d5af3c | [
"Apache-2.0"
] | null | null | null | bigml/tests/create_projection_steps.py | devs-cloud/python_ml | 05d90f5ce1862a5d2d8ff99d2e46446dc1d5af3c | [
"Apache-2.0"
] | null | null | null | bigml/tests/create_projection_steps.py | devs-cloud/python_ml | 05d90f5ce1862a5d2d8ff99d2e46446dc1d5af3c | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
#!/usr/bin/env python
#
# Copyright 2018-2020 BigML
#
# 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 requi... | 35.84507 | 77 | 0.703733 |
import json
import time
from nose.tools import assert_almost_equals, eq_, assert_is_not_none
from datetime import datetime, timedelta
from world import world
from bigml.api import HTTP_CREATED
from bigml.api import FINISHED, FAULTY
from bigml.api import get_status
from read_projection_steps import i_g... | true | true |
f726da9544773e11f11ee7b9f04bc69fd7f46c4b | 8,615 | py | Python | EOD_api/test_EOD_api.py | webclinic017/time-series-pipeline | 5ac418b91e395a48cba397f95d25d221adfff9bd | [
"MIT"
] | 3 | 2021-08-28T10:55:12.000Z | 2021-12-01T20:42:38.000Z | EOD_api/test_EOD_api.py | webclinic017/time-series-pipeline | 5ac418b91e395a48cba397f95d25d221adfff9bd | [
"MIT"
] | null | null | null | EOD_api/test_EOD_api.py | webclinic017/time-series-pipeline | 5ac418b91e395a48cba397f95d25d221adfff9bd | [
"MIT"
] | 1 | 2021-09-26T16:07:24.000Z | 2021-09-26T16:07:24.000Z | import os
import re
import datetime
import unittest
from io import StringIO
from unittest.mock import patch
import pandas as pd
import EOD_api as eod
TOKEN = os.environ["EOD_TOKEN"]
def date_parser(string):
date_pattern = re.compile("([0-9]{4}-[0-9]{2}-[0-9]{2})[ ]", re.VERBOSE)
return date_pattern.sub(r"\... | 43.075 | 165 | 0.51863 | import os
import re
import datetime
import unittest
from io import StringIO
from unittest.mock import patch
import pandas as pd
import EOD_api as eod
TOKEN = os.environ["EOD_TOKEN"]
def date_parser(string):
date_pattern = re.compile("([0-9]{4}-[0-9]{2}-[0-9]{2})[ ]", re.VERBOSE)
return date_pattern.sub(r"\... | true | true |
f726daae43a8790a611a80a7e3876da1fd12b7ee | 2,804 | py | Python | var/spack/repos/builtin/packages/r-pmcmrplus/package.py | player1537-forks/spack | 822b7632222ec5a91dc7b7cda5fc0e08715bd47c | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 11 | 2015-10-04T02:17:46.000Z | 2018-02-07T18:23:00.000Z | var/spack/repos/builtin/packages/r-pmcmrplus/package.py | player1537-forks/spack | 822b7632222ec5a91dc7b7cda5fc0e08715bd47c | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 22 | 2017-08-01T22:45:10.000Z | 2022-03-10T07:46:31.000Z | var/spack/repos/builtin/packages/r-pmcmrplus/package.py | player1537-forks/spack | 822b7632222ec5a91dc7b7cda5fc0e08715bd47c | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 4 | 2016-06-10T17:57:39.000Z | 2018-09-11T04:59:38.000Z | # Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RPmcmrplus(RPackage):
"""Calculate Pairwise Multiple Comparisons of Mean Rank Sums Extende... | 53.923077 | 95 | 0.722183 |
from spack import *
class RPmcmrplus(RPackage):
cran = "PMCMRplus"
version('1.9.3', sha256='76baba60f57343fa5bb6f6d2ea27aab77178e02b0d2f9d5d74abde7d18994f03')
depends_on('r@3.5.0:', type=('build', 'run'))
depends_on('r-mvtnorm@1.0:', type=('build', 'run'))
depends_on('r-multcompview', type... | true | true |
f726dce4683e7d5956b6554b0e5f04d2913f0e26 | 4,225 | py | Python | session4/e_animations_2axis.py | Leylasaadi/MACT20.21_Digital_tools_Big_Data_part_2 | 94cafa0581ec36a305867ebfdcb91c787aa77a16 | [
"Apache-2.0"
] | null | null | null | session4/e_animations_2axis.py | Leylasaadi/MACT20.21_Digital_tools_Big_Data_part_2 | 94cafa0581ec36a305867ebfdcb91c787aa77a16 | [
"Apache-2.0"
] | null | null | null | session4/e_animations_2axis.py | Leylasaadi/MACT20.21_Digital_tools_Big_Data_part_2 | 94cafa0581ec36a305867ebfdcb91c787aa77a16 | [
"Apache-2.0"
] | null | null | null | # encoding: utf-8
##################################################
# This script shows how to create animated plots using matplotlib and a basic dataset
# Multiple tutorials inspired the current design but they mostly came from:
# hhttps://towardsdatascience.com/how-to-create-animated-graphs-in-python-bb619cc2dec1
#... | 46.428571 | 169 | 0.725444 | true | true | |
f726ddf1c1dac0d3d3a8df65efc42e4d30590ce6 | 9,073 | py | Python | mars/lib/nvutils.py | hxri/mars | f7864f00911883b94800b63856f0e57648d3d9b4 | [
"Apache-2.0"
] | 2,413 | 2018-12-06T09:37:11.000Z | 2022-03-30T15:47:39.000Z | mars/lib/nvutils.py | hxri/mars | f7864f00911883b94800b63856f0e57648d3d9b4 | [
"Apache-2.0"
] | 1,335 | 2018-12-07T03:06:18.000Z | 2022-03-31T11:45:57.000Z | mars/lib/nvutils.py | hxri/mars | f7864f00911883b94800b63856f0e57648d3d9b4 | [
"Apache-2.0"
] | 329 | 2018-12-07T03:12:41.000Z | 2022-03-29T21:49:57.000Z | # -*- coding: utf-8 -*-
# Copyright 1999-2021 Alibaba Group Holding 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 require... | 27.831288 | 109 | 0.689518 |
import logging
import os
import sys
import uuid
from collections import namedtuple
from ctypes import c_char, c_char_p, c_int, c_uint, c_ulonglong, byref,\
create_string_buffer, Structure, POINTER, CDLL
logger = logging.getLogger(__name__)
CUDA_SUCCESS = 0
CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT ... | true | true |
f726de42bea9102ed23d3fe9ef9fa07cf1e1fe0c | 595 | py | Python | dbaas/account/admin/__init__.py | didindinn/database-as-a-service | 747de31ff8546f7874ddd654af860e130afd17a0 | [
"BSD-3-Clause"
] | null | null | null | dbaas/account/admin/__init__.py | didindinn/database-as-a-service | 747de31ff8546f7874ddd654af860e130afd17a0 | [
"BSD-3-Clause"
] | null | null | null | dbaas/account/admin/__init__.py | didindinn/database-as-a-service | 747de31ff8546f7874ddd654af860e130afd17a0 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.contrib import admin
from django.contrib.auth.models import User, Group
from ..models import Team, Role, AccountUser, Organization
from .user import CustomUserAdmin
from .role import RoleAdmin
from .team import TeamAdmin
from... | 31.315789 | 58 | 0.820168 |
from __future__ import absolute_import, unicode_literals
from django.contrib import admin
from django.contrib.auth.models import User, Group
from ..models import Team, Role, AccountUser, Organization
from .user import CustomUserAdmin
from .role import RoleAdmin
from .team import TeamAdmin
from .organization import O... | true | true |
f726dea29d24103ee493a83474a24f027af1befb | 11,256 | py | Python | theano/gof/tests/test_destroyhandler.py | mdda/Theano | 6ca7b2b65000e371f009b617d41bc5a90f022d38 | [
"BSD-3-Clause"
] | null | null | null | theano/gof/tests/test_destroyhandler.py | mdda/Theano | 6ca7b2b65000e371f009b617d41bc5a90f022d38 | [
"BSD-3-Clause"
] | null | null | null | theano/gof/tests/test_destroyhandler.py | mdda/Theano | 6ca7b2b65000e371f009b617d41bc5a90f022d38 | [
"BSD-3-Clause"
] | null | null | null | from __future__ import print_function
from six.moves import xrange
from theano.gof.type import Type
from theano.gof import graph
from theano.gof.graph import Variable, Apply
from theano.gof.op import Op
from theano.gof.opt import * # noqa
from theano.gof import destroyhandler
from theano.gof.fg import FunctionGraph,... | 25.875862 | 87 | 0.613184 | from __future__ import print_function
from six.moves import xrange
from theano.gof.type import Type
from theano.gof import graph
from theano.gof.graph import Variable, Apply
from theano.gof.op import Op
from theano.gof.opt import *
from theano.gof import destroyhandler
from theano.gof.fg import FunctionGraph, Incon... | true | true |
f726ded0f21d12ce2859ff426b0a1110e948ea9e | 3,510 | py | Python | inlp/tag/ltp.py | IgowWang/IgorNLP | 3d1bd119bed19f386f30ca1ad4bad98f4200661a | [
"Apache-2.0"
] | 2 | 2016-02-26T09:13:58.000Z | 2017-01-28T13:15:19.000Z | inlp/tag/ltp.py | IgowWang/IgorNLP | 3d1bd119bed19f386f30ca1ad4bad98f4200661a | [
"Apache-2.0"
] | null | null | null | inlp/tag/ltp.py | IgowWang/IgorNLP | 3d1bd119bed19f386f30ca1ad4bad98f4200661a | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# IgorNLP:ltp 词性标注模块
#
# Author: Igor
import os
import tempfile
from subprocess import PIPE
from nltk.internals import overridden, compat
from inlp.tag.api import TaggerI
from inlp.utils import ltp_cmd
class LtpPosTagger(TaggerI):
'''
ltp 词性标注模块
#test:
sentences = [['这', '是... | 30.258621 | 126 | 0.582906 |
import os
import tempfile
from subprocess import PIPE
from nltk.internals import overridden, compat
from inlp.tag.api import TaggerI
from inlp.utils import ltp_cmd
class LtpPosTagger(TaggerI):
def __init__(self, path_to_ltp, path_to_model=None, path_to_lexicon=None, threads=1,
encoding='u... | true | true |
f726df462e44abc76e9c11946685af130da6d59c | 96 | py | Python | boa3_test/test_sc/relational_test/BoolEquality.py | hal0x2328/neo3-boa | 6825a3533384cb01660773050719402a9703065b | [
"Apache-2.0"
] | 25 | 2020-07-22T19:37:43.000Z | 2022-03-08T03:23:55.000Z | boa3_test/test_sc/relational_test/BoolEquality.py | hal0x2328/neo3-boa | 6825a3533384cb01660773050719402a9703065b | [
"Apache-2.0"
] | 419 | 2020-04-23T17:48:14.000Z | 2022-03-31T13:17:45.000Z | boa3_test/test_sc/relational_test/BoolEquality.py | hal0x2328/neo3-boa | 6825a3533384cb01660773050719402a9703065b | [
"Apache-2.0"
] | 15 | 2020-05-21T21:54:24.000Z | 2021-11-18T06:17:24.000Z | from boa3.builtin import public
@public
def Main(a: bool, b: bool) -> bool:
return a == b
| 13.714286 | 35 | 0.645833 | from boa3.builtin import public
@public
def Main(a: bool, b: bool) -> bool:
return a == b
| true | true |
f726e11a06f3a64832e31beeb29cda0f35f7559f | 12,310 | py | Python | tasks.py | nautobot/nautobot-plugin-chatops-aci | d5e92cbaa261e4fbcb175131d03fc6f4e63bc241 | [
"Apache-2.0"
] | null | null | null | tasks.py | nautobot/nautobot-plugin-chatops-aci | d5e92cbaa261e4fbcb175131d03fc6f4e63bc241 | [
"Apache-2.0"
] | 4 | 2021-12-01T19:20:21.000Z | 2022-02-24T22:05:18.000Z | tasks.py | nautobot/nautobot-plugin-chatops-aci | d5e92cbaa261e4fbcb175131d03fc6f4e63bc241 | [
"Apache-2.0"
] | 1 | 2022-01-06T16:37:34.000Z | 2022-01-06T16:37:34.000Z | """Tasks for use with Invoke.
(c) 2020-2021 Network To Code
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 t... | 31.564103 | 177 | 0.646304 |
from distutils.util import strtobool
from invoke import Collection, task as invoke_task
import os
def is_truthy(arg):
if isinstance(arg, bool):
return arg
return bool(strtobool(arg))
namespace = Collection("nautobot_plugin_chatops_aci")
namespace.configure(
{
"nautobot_plugin_chatops_... | true | true |
f726e32c037672a3a1015b66f43061d44ada00cc | 1,226 | py | Python | tryalgo/dist_grid.py | Shloub/tryalgo | ec01a16dd6a6053047f1948531bd5e9b2abf0fab | [
"MIT"
] | null | null | null | tryalgo/dist_grid.py | Shloub/tryalgo | ec01a16dd6a6053047f1948531bd5e9b2abf0fab | [
"MIT"
] | null | null | null | tryalgo/dist_grid.py | Shloub/tryalgo | ec01a16dd6a6053047f1948531bd5e9b2abf0fab | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Distances in a grid
# jill-jenn vie et christoph durr - 2014-2015
from collections import deque
# snip{
def dist_grid(grid, source, target=None):
"""Distances in a grid by BFS
:param grid: matrix with 4-neighborhood
:param (int,int) source: pair of row, c... | 30.65 | 69 | 0.513866 |
from collections import deque
def dist_grid(grid, source, target=None):
rows = len(grid)
cols = len(grid[0])
dir = [(0, +1, '>'), (0, -1, '<'), (+1, 0, 'v'), (-1, 0, '^')]
i, j = source
grid[i][j] = 's'
Q = deque()
Q.append(source)
while Q:
i1, j1 = Q.popleft()
fo... | true | true |
f726e3fffed7bf64ee84e30593164304e7fa5261 | 83,112 | py | Python | genepattern/utils/clustering.py | genepattern/genepattern-utils | 950d748301b3c4d07ad8d24c9b037bbb9b4c80e2 | [
"BSD-3-Clause"
] | null | null | null | genepattern/utils/clustering.py | genepattern/genepattern-utils | 950d748301b3c4d07ad8d24c9b037bbb9b4c80e2 | [
"BSD-3-Clause"
] | null | null | null | genepattern/utils/clustering.py | genepattern/genepattern-utils | 950d748301b3c4d07ad8d24c9b037bbb9b4c80e2 | [
"BSD-3-Clause"
] | null | null | null | """
Copied and modified from the dev branch of:
https://github.com/genepattern/HierarchicalClustering
on 2018-01-31
"""
import sys
import numpy as np
from statistics import mode
from sklearn.metrics import pairwise
from sklearn import metrics
from scipy.cluster.hierarchy import dendrogram
import matplotlib.pyplot as p... | 41.66015 | 132 | 0.623869 | import sys
import numpy as np
from statistics import mode
from sklearn.metrics import pairwise
from sklearn import metrics
from scipy.cluster.hierarchy import dendrogram
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import itertools
from sklearn.cluster import AgglomerativeClustering
import... | true | true |
f726e468fffed12d4ce9bb88c0a2c8505212f61d | 6,650 | py | Python | visualizer/visualizer/network.py | NikKaem/mapf-project | d99727d5f62380cf2a7d37dec70b5cdc71db3fb6 | [
"MIT"
] | null | null | null | visualizer/visualizer/network.py | NikKaem/mapf-project | d99727d5f62380cf2a7d37dec70b5cdc71db3fb6 | [
"MIT"
] | null | null | null | visualizer/visualizer/network.py | NikKaem/mapf-project | d99727d5f62380cf2a7d37dec70b5cdc71db3fb6 | [
"MIT"
] | null | null | null | from threading import Thread
import socket
import select
import time
import os
import clingo
import argparse
from PyQt5.QtCore import *
class VisualizerSocket(object):
def __init__(self, default_host = '127.0.0.1', default_port = 5000, socket_name = 'socket'):
self._host = default_host
se... | 29.424779 | 96 | 0.530226 | from threading import Thread
import socket
import select
import time
import os
import clingo
import argparse
from PyQt5.QtCore import *
class VisualizerSocket(object):
def __init__(self, default_host = '127.0.0.1', default_port = 5000, socket_name = 'socket'):
self._host = default_host
se... | true | true |
f726e4b41f15fdd676d9d580ff8e3144b72f2f13 | 4,712 | py | Python | taxumap-manuscript-notebooks/embeddings.py | jsevo/taxumap | 1a02518dca822a65847994910177c74607243dae | [
"MIT"
] | 5 | 2021-11-21T16:47:17.000Z | 2022-02-04T16:57:15.000Z | taxumap-manuscript-notebooks/embeddings.py | jsevo/taxumap | 1a02518dca822a65847994910177c74607243dae | [
"MIT"
] | 13 | 2021-03-31T19:08:10.000Z | 2022-02-15T19:57:18.000Z | taxumap-manuscript-notebooks/embeddings.py | jsevo/taxumap | 1a02518dca822a65847994910177c74607243dae | [
"MIT"
] | 3 | 2021-09-22T19:21:36.000Z | 2022-02-10T21:39:35.000Z | from sklearn.manifold import TSNE
from sklearn.decomposition import PCA, KernelPCA
from umap import UMAP
from sklearn.preprocessing import MinMaxScaler
RUNEMBEDDINGS = False
if RUNEMBEDDINGS:
#simple PCA
pcaembedding = PCA(n_components=2).fit_transform(XASV.fillna(0))
#base embedding (kernel pca)
... | 40.62069 | 150 | 0.574278 | from sklearn.manifold import TSNE
from sklearn.decomposition import PCA, KernelPCA
from umap import UMAP
from sklearn.preprocessing import MinMaxScaler
RUNEMBEDDINGS = False
if RUNEMBEDDINGS:
pcaembedding = PCA(n_components=2).fit_transform(XASV.fillna(0))
kernelpcaembedding = KernelPCA(n_compo... | true | true |
f726e62af700d6cd869103c9f957465198c2bb6d | 218 | py | Python | structurizr/model/enterprise.py | sixty-north/structurizr-python | 856d0476935952c256981f3628663915768ee85e | [
"Apache-2.0"
] | 15 | 2017-07-20T20:43:40.000Z | 2021-11-12T11:25:01.000Z | structurizr/model/enterprise.py | sixty-north/structurizr-python | 856d0476935952c256981f3628663915768ee85e | [
"Apache-2.0"
] | 2 | 2017-06-05T17:41:05.000Z | 2018-09-11T08:18:07.000Z | structurizr/model/enterprise.py | sixty-north/structurizr-python | 856d0476935952c256981f3628663915768ee85e | [
"Apache-2.0"
] | 7 | 2017-08-16T19:51:24.000Z | 2020-09-24T09:47:35.000Z | class Enterprise:
def __init__(self, name):
if len(name.strip()) == 0:
raise ValueError("Name must be specified.")
self._name = name
def get_name(self):
return self._name
| 19.818182 | 55 | 0.577982 | class Enterprise:
def __init__(self, name):
if len(name.strip()) == 0:
raise ValueError("Name must be specified.")
self._name = name
def get_name(self):
return self._name
| true | true |
f726e62b1de4faf4969737dc866dadf797d1e5a6 | 3,616 | py | Python | reminder/admin/forms.py | luk-kop/event-reminder-apscheduler | 405c9731d340d111aac83094a93b06ec60256754 | [
"MIT"
] | 1 | 2021-04-02T11:07:12.000Z | 2021-04-02T11:07:12.000Z | reminder/admin/forms.py | luk-kop/event-reminder-apscheduler | 405c9731d340d111aac83094a93b06ec60256754 | [
"MIT"
] | 2 | 2021-03-20T22:04:50.000Z | 2021-06-09T07:02:36.000Z | reminder/admin/forms.py | luk-kop/event-reminder | 405c9731d340d111aac83094a93b06ec60256754 | [
"MIT"
] | null | null | null | from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, SelectField, IntegerField
from wtforms.validators import InputRequired, EqualTo, Regexp, Length, NumberRange, Optional, Email
from reminder.custom_wtforms import MxRecordValidator
class NewUserForm(FlaskForm):
"""
Validators for ... | 56.5 | 118 | 0.518252 | from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, SelectField, IntegerField
from wtforms.validators import InputRequired, EqualTo, Regexp, Length, NumberRange, Optional, Email
from reminder.custom_wtforms import MxRecordValidator
class NewUserForm(FlaskForm):
username = StringField(... | true | true |
f726e725cce6a2546e0dca558dcc54f0ee808e67 | 954 | py | Python | apps/node/src/app/main/users/role.py | AmrMKayid/PyGrid | 695a041649f7cfab6acc7d1495e2a6132f65d529 | [
"Apache-2.0"
] | 7 | 2020-04-20T22:22:08.000Z | 2020-07-25T17:32:08.000Z | apps/node/src/app/main/users/role.py | AmrMKayid/PyGrid | 695a041649f7cfab6acc7d1495e2a6132f65d529 | [
"Apache-2.0"
] | 3 | 2020-04-24T21:20:57.000Z | 2020-05-28T09:17:02.000Z | apps/node/src/app/main/users/role.py | AmrMKayid/PyGrid | 695a041649f7cfab6acc7d1495e2a6132f65d529 | [
"Apache-2.0"
] | 4 | 2020-04-24T22:32:37.000Z | 2020-05-25T19:29:20.000Z | from ... import BaseModel, db
class Role(BaseModel):
__tablename__ = "role"
id = db.Column(db.Integer(), primary_key=True, autoincrement=True)
name = db.Column(db.String())
can_triage_jobs = db.Column(db.Boolean())
can_edit_settings = db.Column(db.Boolean())
can_create_users = db.Column(db.Bo... | 36.692308 | 75 | 0.645702 | from ... import BaseModel, db
class Role(BaseModel):
__tablename__ = "role"
id = db.Column(db.Integer(), primary_key=True, autoincrement=True)
name = db.Column(db.String())
can_triage_jobs = db.Column(db.Boolean())
can_edit_settings = db.Column(db.Boolean())
can_create_users = db.Column(db.Bo... | true | true |
f726e80aacceea27942a112dde7b312235a8f554 | 35,185 | py | Python | sdks/python/apache_beam/typehints/decorators.py | VrishaliShah/beam | c27f5f724e38fbec829d9cf8920fac2bdedb7ca4 | [
"Apache-2.0"
] | null | null | null | sdks/python/apache_beam/typehints/decorators.py | VrishaliShah/beam | c27f5f724e38fbec829d9cf8920fac2bdedb7ca4 | [
"Apache-2.0"
] | 2 | 2021-08-25T16:17:07.000Z | 2022-02-10T04:23:10.000Z | sdks/python/apache_beam/typehints/decorators.py | VrishaliShah/beam | c27f5f724e38fbec829d9cf8920fac2bdedb7ca4 | [
"Apache-2.0"
] | 1 | 2020-01-16T17:00:26.000Z | 2020-01-16T17:00:26.000Z | #
# 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 us... | 34.562868 | 109 | 0.699986 |
from __future__ import absolute_import
import inspect
import itertools
import logging
import sys
import traceback
import types
from builtins import next
from builtins import object
from builtins import zip
from typing import Any
from typing import Callable
from typing import Dict
from typing import... | true | true |
f726e812891f79ad91797716634694dc86a45c44 | 4,022 | py | Python | h/services/group.py | julien-cheng/h | 36c8ec044725720cf36f0986cdf025395aca8929 | [
"BSD-2-Clause"
] | 2 | 2019-08-04T07:22:11.000Z | 2020-07-17T05:01:41.000Z | h/services/group.py | 11-eleven-11/h | 91c7a4504ad7471ed3e30246763a03e6c1cc531b | [
"BSD-2-Clause"
] | null | null | null | h/services/group.py | 11-eleven-11/h | 91c7a4504ad7471ed3e30246763a03e6c1cc531b | [
"BSD-2-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import sqlalchemy as sa
from h.models import Group, User
from h.models.group import ReadableBy
from h.util import group as group_util
class GroupService(object):
def __init__(self, session, user_fetcher):
"""
Create a new groups se... | 31.920635 | 87 | 0.60915 |
from __future__ import unicode_literals
import sqlalchemy as sa
from h.models import Group, User
from h.models.group import ReadableBy
from h.util import group as group_util
class GroupService(object):
def __init__(self, session, user_fetcher):
self.session = session
self.user_fetcher = user_f... | true | true |
f726e91e889b74acf6f116c6d95887b343147e4d | 73,451 | py | Python | tools/sourcecode/Python-3.10.0/Lib/asyncio/base_events.py | gagominecraft12/Blueity-Client-Retrace | d42a927a85226d73da66123922d9ea11cc20ac3d | [
"MIT"
] | 33 | 2021-07-25T14:23:35.000Z | 2022-03-31T00:17:30.000Z | tools/sourcecode/Python-3.10.0/Lib/asyncio/base_events.py | gagominecraft12/Blueity-Client-Retrace | d42a927a85226d73da66123922d9ea11cc20ac3d | [
"MIT"
] | 32 | 2019-04-26T12:29:36.000Z | 2022-03-08T14:24:30.000Z | Lib/asyncio/base_events.py | val-verde/cpython | 17aa701d799d5e071d83205d877f722f1498a09f | [
"0BSD"
] | 3 | 2019-11-12T15:21:58.000Z | 2020-09-04T14:27:55.000Z | """Base implementation of event loop.
The event loop can be broken up into a multiplexer (the part
responsible for notifying us of I/O events) and the event loop proper,
which wraps a multiplexer with functionality for scheduling callbacks,
immediately or at a given time in the future.
Whenever a public API takes a c... | 38.516518 | 83 | 0.573689 |
import collections
import collections.abc
import concurrent.futures
import functools
import heapq
import itertools
import os
import socket
import stat
import subprocess
import threading
import time
import traceback
import sys
import warnings
import weakref
try:
import ssl
except ImportError:
ssl = None
fro... | true | true |
f726e9f4ca4961a8ea29f9196c6fa380bedb6b8e | 1,865 | py | Python | test/unittest/committee_test.py | Cocos-BCX/Python-Middleware | 9e8db14cdbf12131964d48d1189e0686b69369a8 | [
"MIT"
] | 101 | 2019-07-24T08:30:30.000Z | 2021-02-18T15:11:59.000Z | test/unittest/committee_test.py | marcomgsilva/Python-Middleware | 9e8db14cdbf12131964d48d1189e0686b69369a8 | [
"MIT"
] | 4 | 2019-08-01T10:06:29.000Z | 2019-11-29T08:32:34.000Z | test/unittest/committee_test.py | marcomgsilva/Python-Middleware | 9e8db14cdbf12131964d48d1189e0686b69369a8 | [
"MIT"
] | 7 | 2019-08-11T16:02:41.000Z | 2021-02-11T04:23:51.000Z | import unittest
from config import Config
class CommitteeTestCase(unittest.TestCase):
def testCreateCommittee(self):
params = {
"url": " ",
"account": "1.2.25"
}
gph = Config().gph
try:
print("CreateCommittee:", gph.committee_member_create(**par... | 27.835821 | 77 | 0.527614 | import unittest
from config import Config
class CommitteeTestCase(unittest.TestCase):
def testCreateCommittee(self):
params = {
"url": " ",
"account": "1.2.25"
}
gph = Config().gph
try:
print("CreateCommittee:", gph.committee_member_create(**par... | true | true |
f726eaa4291a25a6faf61571bc3ad1b43a3541f2 | 4,011 | py | Python | PhysicsTools/Heppy/python/physicsutils/genutils.py | pasmuss/cmssw | 566f40c323beef46134485a45ea53349f59ae534 | [
"Apache-2.0"
] | null | null | null | PhysicsTools/Heppy/python/physicsutils/genutils.py | pasmuss/cmssw | 566f40c323beef46134485a45ea53349f59ae534 | [
"Apache-2.0"
] | null | null | null | PhysicsTools/Heppy/python/physicsutils/genutils.py | pasmuss/cmssw | 566f40c323beef46134485a45ea53349f59ae534 | [
"Apache-2.0"
] | null | null | null | from PhysicsTools.Heppy.physicsobjects.PhysicsObjects import printOut
from PhysicsTools.Heppy.physicsobjects.PhysicsObjects import GenParticle
def findStatus1Leptons(particle):
'''Returns status 1 e and mu among the particle daughters'''
leptons = []
for i in range( particle.numberOfDaughters() ):
... | 33.705882 | 86 | 0.605834 | from PhysicsTools.Heppy.physicsobjects.PhysicsObjects import printOut
from PhysicsTools.Heppy.physicsobjects.PhysicsObjects import GenParticle
def findStatus1Leptons(particle):
leptons = []
for i in range( particle.numberOfDaughters() ):
dau = particle.daughter(i)
if dau.status() == 1:
... | true | true |
f726ebf3b8c2775c6822150273cdcd7cd4ffc96d | 2,878 | py | Python | factor_tools.py | ericgreveson/projecteuler | 1844bf383fca871b82d88ef1eb3a9b1a0e363054 | [
"Apache-2.0"
] | null | null | null | factor_tools.py | ericgreveson/projecteuler | 1844bf383fca871b82d88ef1eb3a9b1a0e363054 | [
"Apache-2.0"
] | null | null | null | factor_tools.py | ericgreveson/projecteuler | 1844bf383fca871b82d88ef1eb3a9b1a0e363054 | [
"Apache-2.0"
] | null | null | null | from fractions import Fraction
import math
def compute_factors(n):
"""
Return a list of all factors (proper divisors) of a number n, including the factor 1
"""
factors = [1]
for i in range(2, int(math.sqrt(n)) + 1):
if n % i == 0:
factors.append(i)
factors.append(n /... | 25.927928 | 95 | 0.59729 | from fractions import Fraction
import math
def compute_factors(n):
factors = [1]
for i in range(2, int(math.sqrt(n)) + 1):
if n % i == 0:
factors.append(i)
factors.append(n // i)
return factors
def is_prime(n, prime_cache=None, prime_cache_max=None):
if n in [2, 3... | true | true |
f726ebfcc0be524ce8e65eb0ea66ac8411693e2e | 1,175 | py | Python | course_grader/dao/__init__.py | uw-it-aca/gradepage | 7059d715cc112ad0ecb0e5012f716e525ee7b3bc | [
"Apache-2.0"
] | 1 | 2017-01-29T09:52:06.000Z | 2017-01-29T09:52:06.000Z | course_grader/dao/__init__.py | uw-it-aca/gradepage | 7059d715cc112ad0ecb0e5012f716e525ee7b3bc | [
"Apache-2.0"
] | 287 | 2017-03-09T00:17:20.000Z | 2022-01-08T00:36:34.000Z | course_grader/dao/__init__.py | uw-it-aca/gradepage | 7059d715cc112ad0ecb0e5012f716e525ee7b3bc | [
"Apache-2.0"
] | null | null | null | # Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
from django.conf import settings
from django.utils.timezone import (
get_default_timezone, localtime, is_naive, make_aware)
from datetime import datetime
from uw_sws import SWS_DAO, sws_now
from abc import ABC, abstractmethod
... | 25.543478 | 79 | 0.700426 |
from django.conf import settings
from django.utils.timezone import (
get_default_timezone, localtime, is_naive, make_aware)
from datetime import datetime
from uw_sws import SWS_DAO, sws_now
from abc import ABC, abstractmethod
def __update_get(self, url, response):
pass
SWS_DAO._update_get = __update_get... | true | true |
f726ec3d0e2d020ea619b787e5eec91931023911 | 5,455 | py | Python | bin/make_changelog.py | nyuszika7h/rclone | 7bf056316fe82aa9566f6e482da5cd9b184ac3f7 | [
"MIT"
] | 3 | 2018-08-25T01:14:39.000Z | 2022-03-22T00:36:27.000Z | bin/make_changelog.py | nyuszika7h/rclone | 7bf056316fe82aa9566f6e482da5cd9b184ac3f7 | [
"MIT"
] | 1 | 2020-12-01T17:00:00.000Z | 2020-12-01T17:00:00.000Z | bin/make_changelog.py | nyuszika7h/rclone | 7bf056316fe82aa9566f6e482da5cd9b184ac3f7 | [
"MIT"
] | 2 | 2021-01-16T07:35:41.000Z | 2021-01-16T08:41:00.000Z | #!/usr/bin/python3
"""
Generate a markdown changelog for the rclone project
"""
import os
import sys
import re
import datetime
import subprocess
from collections import defaultdict
IGNORE_RES = [
r"^Add .* to contributors$",
r"^Start v\d+\.\d+(\.\d+)?-DEV development$",
r"^Version v\d+\.\d+(\.\d+)?$",
]
... | 31.171429 | 128 | 0.6033 |
import os
import sys
import re
import datetime
import subprocess
from collections import defaultdict
IGNORE_RES = [
r"^Add .* to contributors$",
r"^Start v\d+\.\d+(\.\d+)?-DEV development$",
r"^Version v\d+\.\d+(\.\d+)?$",
]
IGNORE_RE = re.compile("(?:" + "|".join(IGNORE_RES) + ")")
CATEGORY = re.compi... | true | true |
f726ef153fc15bb0f73f2ddd0be42d2221822c43 | 12,328 | py | Python | dnnutil/training.py | catalys1/dnnutil | a55a73ae59c5ac0117f58d8d8136bdd32902141f | [
"MIT"
] | null | null | null | dnnutil/training.py | catalys1/dnnutil | a55a73ae59c5ac0117f58d8d8136bdd32902141f | [
"MIT"
] | 9 | 2018-07-31T02:53:23.000Z | 2019-03-28T16:57:45.000Z | dnnutil/training.py | catalys1/dnnutil | a55a73ae59c5ac0117f58d8d8136bdd32902141f | [
"MIT"
] | null | null | null | import torch
import numpy as np
import dnnutil.network as network
import time
__all__ = ['calculate_accuracy', 'Trainer', 'ClassifierTrainer', 'AutoencoderTrainer']
def calculate_accuracy(prediction, label, axis=1):
'''calculate_accuracy(prediction, label)
Computes the mean accuracy over a batch of pre... | 36.473373 | 86 | 0.596042 | import torch
import numpy as np
import dnnutil.network as network
import time
__all__ = ['calculate_accuracy', 'Trainer', 'ClassifierTrainer', 'AutoencoderTrainer']
def calculate_accuracy(prediction, label, axis=1):
return torch.eq(prediction.argmax(axis), label).float().mean().item()
class Trainer(object):
... | true | true |
f726efc91697481d09f75f4837fbbf66b5fd0535 | 4,736 | py | Python | build_nec_file.py | crumpstrr33/NEC_scripts | fcb88afc538c884dab141ac26529ed3adf53e81e | [
"MIT"
] | null | null | null | build_nec_file.py | crumpstrr33/NEC_scripts | fcb88afc538c884dab141ac26529ed3adf53e81e | [
"MIT"
] | null | null | null | build_nec_file.py | crumpstrr33/NEC_scripts | fcb88afc538c884dab141ac26529ed3adf53e81e | [
"MIT"
] | null | null | null | """
This script uses python to build a `.nec` file. This allows
for the use of variables and other arithmetic which is much
easier in python. For information on the cards specified by the
arguments, e.g. EX or RP, check out https://www.nec2.org/part_3/cards/
"""
from datetime import datetime as dt
from math import *
... | 39.798319 | 81 | 0.618243 | from datetime import datetime as dt
from math import *
def build_nec_file(
comments,
wires,
constants,
frequency=[],
excitations=[],
rad_pattern=[],
output="output",
lims=[2, 5, 10, 20, 30, 40, 50, 60, 70, 80],
sig_figs=2,
verbose=0,
):
def _format_rows(rows, car... | true | true |
f726f0ecbf1474170ae42090ca93cfbcb7385ec8 | 1,735 | py | Python | flightServices/flightApp/views.py | saibottrenham/djangorest | 45efadabb19cf421a282b98f3480cf49789eaae1 | [
"MIT"
] | null | null | null | flightServices/flightApp/views.py | saibottrenham/djangorest | 45efadabb19cf421a282b98f3480cf49789eaae1 | [
"MIT"
] | null | null | null | flightServices/flightApp/views.py | saibottrenham/djangorest | 45efadabb19cf421a282b98f3480cf49789eaae1 | [
"MIT"
] | null | null | null | from django.shortcuts import render
from flightApp.models import Flight, Passenger, Reservation
from flightApp.serializers import FlightSerializer, PassengerSerializer, ReservationSerializer
from rest_framework import viewsets
from rest_framework.response import Response
from rest_framework.decorators import api_view
f... | 34.019608 | 97 | 0.748703 | from django.shortcuts import render
from flightApp.models import Flight, Passenger, Reservation
from flightApp.serializers import FlightSerializer, PassengerSerializer, ReservationSerializer
from rest_framework import viewsets
from rest_framework.response import Response
from rest_framework.decorators import api_view
f... | true | true |
f726f0f2c8fef30d17ac352da7f4d08edb92adb8 | 15,583 | py | Python | nemo/collections/asr/models/classification_models.py | vinayphadnis/NeMo | 9dc7773c48e164b8a82051bb558a728c6eeb85ec | [
"Apache-2.0"
] | 2 | 2020-10-08T13:38:46.000Z | 2020-10-14T15:09:34.000Z | nemo/collections/asr/models/classification_models.py | vinayphadnis/NeMo | 9dc7773c48e164b8a82051bb558a728c6eeb85ec | [
"Apache-2.0"
] | null | null | null | nemo/collections/asr/models/classification_models.py | vinayphadnis/NeMo | 9dc7773c48e164b8a82051bb558a728c6eeb85ec | [
"Apache-2.0"
] | 1 | 2020-12-18T14:23:37.000Z | 2020-12-18T14:23:37.000Z | # Copyright (c) 2020, 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 copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | 46.10355 | 258 | 0.686774 |
import copy
from typing import Dict, List, Optional, Union
import torch
from omegaconf import DictConfig, ListConfig, OmegaConf
from pytorch_lightning import Trainer
from nemo.collections.asr.data.audio_to_text import AudioLabelDataset
from nemo.collections.asr.models.asr_model import ASRModel
from nemo... | true | true |
f726f228726b7b2b3f9d488b6ba21009b47132f1 | 881 | py | Python | website/addons/s3/__init__.py | sf2ne/Playground | 95b2d222d7ac43baca0249acbfc34e043d6a95b3 | [
"Apache-2.0"
] | null | null | null | website/addons/s3/__init__.py | sf2ne/Playground | 95b2d222d7ac43baca0249acbfc34e043d6a95b3 | [
"Apache-2.0"
] | 13 | 2020-03-24T15:29:41.000Z | 2022-03-11T23:15:28.000Z | website/addons/s3/__init__.py | sf2ne/Playground | 95b2d222d7ac43baca0249acbfc34e043d6a95b3 | [
"Apache-2.0"
] | null | null | null | import os
from . import model
from . import routes
from . import views
MODELS = [model.AddonS3UserSettings, model.AddonS3NodeSettings]
USER_SETTINGS_MODEL = model.AddonS3UserSettings
NODE_SETTINGS_MODEL = model.AddonS3NodeSettings
ROUTES = [routes.settings_routes]
SHORT_NAME = 's3'
FULL_NAME = 'Amazon S3'
OWNERS ... | 20.97619 | 81 | 0.727582 | import os
from . import model
from . import routes
from . import views
MODELS = [model.AddonS3UserSettings, model.AddonS3NodeSettings]
USER_SETTINGS_MODEL = model.AddonS3UserSettings
NODE_SETTINGS_MODEL = model.AddonS3NodeSettings
ROUTES = [routes.settings_routes]
SHORT_NAME = 's3'
FULL_NAME = 'Amazon S3'
OWNERS ... | true | true |
f726f26f0db530e1d6ac7228dc6da3573ce0200f | 237 | py | Python | CodingTestForEmployment/Part3/implementation/implementation1.py | lkc263/Algorithm_Study_Python | 5b9a74ecf7e864c861df2280a1bf4b393b0fcbca | [
"MIT"
] | null | null | null | CodingTestForEmployment/Part3/implementation/implementation1.py | lkc263/Algorithm_Study_Python | 5b9a74ecf7e864c861df2280a1bf4b393b0fcbca | [
"MIT"
] | null | null | null | CodingTestForEmployment/Part3/implementation/implementation1.py | lkc263/Algorithm_Study_Python | 5b9a74ecf7e864c861df2280a1bf4b393b0fcbca | [
"MIT"
] | null | null | null | n = input()
front_n = n[0:len(n)//2]
back_n = n[len(n)//2:len(n)]
front_n = map(int,front_n)
back_n = map(int,back_n)
result_f = sum(front_n)
result_b = sum(back_n)
if result_f == result_b:
print('LUCKY')
else:
print('READY') | 15.8 | 28 | 0.637131 | n = input()
front_n = n[0:len(n)//2]
back_n = n[len(n)//2:len(n)]
front_n = map(int,front_n)
back_n = map(int,back_n)
result_f = sum(front_n)
result_b = sum(back_n)
if result_f == result_b:
print('LUCKY')
else:
print('READY') | true | true |
f726f3e6b68297e13227e122ba85506dd2bb46e5 | 2,762 | py | Python | pyclustering/samples/__init__.py | JosephChataignon/pyclustering | bf4f51a472622292627ec8c294eb205585e50f52 | [
"BSD-3-Clause"
] | 1,013 | 2015-01-26T19:50:14.000Z | 2022-03-31T07:38:48.000Z | pyclustering/samples/__init__.py | peterlau0626/pyclustering | bf4f51a472622292627ec8c294eb205585e50f52 | [
"BSD-3-Clause"
] | 542 | 2015-01-20T16:44:32.000Z | 2022-01-29T14:57:20.000Z | pyclustering/samples/__init__.py | peterlau0626/pyclustering | bf4f51a472622292627ec8c294eb205585e50f52 | [
"BSD-3-Clause"
] | 262 | 2015-03-19T07:28:12.000Z | 2022-03-30T07:28:24.000Z | """!
@brief pyclustering module for samples.
@authors Andrei Novikov (pyclustering@yandex.ru)
@date 2014-2020
@copyright BSD-3-Clause
"""
class answer_reader:
"""!
@brief Answer reader for samples that are used by pyclustering library.
"""
def __init__(self, answer_path):
... | 26.815534 | 118 | 0.589428 |
class answer_reader:
def __init__(self, answer_path):
self.__answer_path = answer_path
self.__clusters = None
self.__noise = None
def get_clusters(self):
self.__read_answer()
return self.__clusters
def get_noise(self):
self.__read_answer... | true | true |
f726f53393a6475b58d999e2bc14d087f34c543e | 1,919 | py | Python | calendar_events/views.py | alexkyllo/django-calendar-events | f1ad2c2b858f93a1256604ff9f7b223914acf29e | [
"Apache-2.0"
] | 1 | 2016-09-09T04:16:10.000Z | 2016-09-09T04:16:10.000Z | calendar_events/views.py | alexkyllo/django-calendar-events | f1ad2c2b858f93a1256604ff9f7b223914acf29e | [
"Apache-2.0"
] | null | null | null | calendar_events/views.py | alexkyllo/django-calendar-events | f1ad2c2b858f93a1256604ff9f7b223914acf29e | [
"Apache-2.0"
] | 2 | 2018-04-19T19:29:46.000Z | 2018-09-21T00:18:22.000Z | from django.shortcuts import render, render_to_response
from django.http import Http404
from django.http import HttpResponse, HttpResponseRedirect
from django.template import RequestContext
from django.views.decorators.http import require_GET, require_POST, require_http_methods
from models import *
from forms import *
... | 35.537037 | 133 | 0.756123 | from django.shortcuts import render, render_to_response
from django.http import Http404
from django.http import HttpResponse, HttpResponseRedirect
from django.template import RequestContext
from django.views.decorators.http import require_GET, require_POST, require_http_methods
from models import *
from forms import *
... | true | true |
f726f57c229488230500b5d7998e2d3d8ba1a490 | 176 | py | Python | regular-expressions-tutorial/verify_email.py | dapopov-st/python-youtube-code | 770c9291988898f259ad28bbab5989acee8fb830 | [
"MIT"
] | 262 | 2020-03-17T03:24:35.000Z | 2022-03-22T12:50:02.000Z | regular-expressions-tutorial/verify_email.py | dapopov-st/python-youtube-code | 770c9291988898f259ad28bbab5989acee8fb830 | [
"MIT"
] | 14 | 2020-07-12T14:17:36.000Z | 2022-03-21T09:38:45.000Z | regular-expressions-tutorial/verify_email.py | dapopov-st/python-youtube-code | 770c9291988898f259ad28bbab5989acee8fb830 | [
"MIT"
] | 583 | 2020-02-12T17:54:21.000Z | 2022-03-30T03:59:21.000Z | import re
pattern = "[a-zA-Z0-9]+@[a-zA-z]+\.(com|edu|net)"
user_input = input()
if(re.search(pattern, user_input)):
print("valid email")
else:
print("invalid email")
| 19.555556 | 49 | 0.636364 | import re
pattern = "[a-zA-Z0-9]+@[a-zA-z]+\.(com|edu|net)"
user_input = input()
if(re.search(pattern, user_input)):
print("valid email")
else:
print("invalid email")
| true | true |
f726f5c4e2f692389ad5a170f072d70c27e57734 | 3,838 | py | Python | reservation_rest_api.py | usc-isi-i2/wikidata-reservation | 1298ec2a7b347ed88bc93fa30531fa9b10c651a7 | [
"MIT"
] | null | null | null | reservation_rest_api.py | usc-isi-i2/wikidata-reservation | 1298ec2a7b347ed88bc93fa30531fa9b10c651a7 | [
"MIT"
] | null | null | null | reservation_rest_api.py | usc-isi-i2/wikidata-reservation | 1298ec2a7b347ed88bc93fa30531fa9b10c651a7 | [
"MIT"
] | null | null | null | from flask import Flask, request
from reservation_service import get_qnode, read_data, register, delete_namespace
import json
import logging
from tabulate import tabulate
app = Flask(__name__)
ALLOWED_EXTENSIONS = {'xls', 'yaml', 'csv', 'json'}
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
# logging.ba... | 36.552381 | 113 | 0.632882 | from flask import Flask, request
from reservation_service import get_qnode, read_data, register, delete_namespace
import json
import logging
from tabulate import tabulate
app = Flask(__name__)
ALLOWED_EXTENSIONS = {'xls', 'yaml', 'csv', 'json'}
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
logging.ba... | true | true |
f726f5c80de9e071ad05e77e26f7512ec0cee0dd | 5,269 | py | Python | models.py | gautamMalu/Aesthetic_attributes_maps | f2462c92d414f9457a3babd32171b071e4703515 | [
"MIT"
] | 22 | 2017-07-14T02:53:27.000Z | 2021-03-19T20:13:12.000Z | models.py | gautamMalu/Aesthetic_attributes_maps | f2462c92d414f9457a3babd32171b071e4703515 | [
"MIT"
] | 3 | 2017-07-25T03:01:23.000Z | 2018-06-27T14:03:43.000Z | models.py | gautamMalu/Aesthetic_attributes_maps | f2462c92d414f9457a3babd32171b071e4703515 | [
"MIT"
] | 11 | 2017-07-14T08:23:33.000Z | 2021-11-24T09:18:48.000Z | from keras.applications.resnet50 import ResNet50
from keras.applications.vgg16 import VGG16
from keras.layers import Flatten, Dropout, Lambda, GlobalAveragePooling2D, merge, Input, Dense
from keras.models import Model
import keras.backend as K
#from keras.utils.visualize_util import plot
#from SpatialPyramidPooling imp... | 37.368794 | 126 | 0.707155 | from keras.applications.resnet50 import ResNet50
from keras.applications.vgg16 import VGG16
from keras.layers import Flatten, Dropout, Lambda, GlobalAveragePooling2D, merge, Input, Dense
from keras.models import Model
import keras.backend as K
def l2_normalize(x):
return K.l2_normalize(x, 0)
def l2_normalize_... | true | true |
f726f884a93cc0f5b265ff93d535edd969498ccd | 518 | py | Python | Models/initialize.py | jeffrey-clark/gender_in_academia | 25f76abfccb06ee7d6a630ee1d4cecdbf6dbe21d | [
"MIT"
] | null | null | null | Models/initialize.py | jeffrey-clark/gender_in_academia | 25f76abfccb06ee7d6a630ee1d4cecdbf6dbe21d | [
"MIT"
] | null | null | null | Models/initialize.py | jeffrey-clark/gender_in_academia | 25f76abfccb06ee7d6a630ee1d4cecdbf6dbe21d | [
"MIT"
] | null | null | null | # import dependencies
import os, re, io, sys
import pandas as pd
#import mysql.connector
import json
import numpy as np
# import function collections
from Functions.j_functions import *
from Functions.language import *
from Functions.functions import *
# set universal variables
project_root = os.path.abspath(os.path... | 24.666667 | 83 | 0.69305 |
import os, re, io, sys
import pandas as pd
import json
import numpy as np
from Functions.j_functions import *
from Functions.language import *
from Functions.functions import *
project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
pref_order = ['app_id', 'name', 'surname', 'financier', '... | true | true |
f726f911716ec981e91b4ea974dc3e14779424c2 | 29,285 | py | Python | zdd.py | sonecabr/marathon-lb-rsyslog | 1e4f6a738b7b7afaa0b2a70c67963b95f8ee54c8 | [
"Apache-2.0"
] | null | null | null | zdd.py | sonecabr/marathon-lb-rsyslog | 1e4f6a738b7b7afaa0b2a70c67963b95f8ee54c8 | [
"Apache-2.0"
] | null | null | null | zdd.py | sonecabr/marathon-lb-rsyslog | 1e4f6a738b7b7afaa0b2a70c67963b95f8ee54c8 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python3
import argparse
import csv
import json
import logging
import math
import socket
import subprocess
import sys
import time
import traceback
from datetime import datetime
from collections import namedtuple
import requests
import six.moves.urllib as urllib
from common import (get_marathon_auth_par... | 35.325694 | 82 | 0.623937 |
import argparse
import csv
import json
import logging
import math
import socket
import subprocess
import sys
import time
import traceback
from datetime import datetime
from collections import namedtuple
import requests
import six.moves.urllib as urllib
from common import (get_marathon_auth_params, set_logging_args,... | true | true |
f726fa1e73e6103ef46be0193e0b17c20617c6fb | 2,819 | py | Python | generator/modules/caffe.py | kklemon/deepo | 038063faf9a4c883a853aac77471e859f61b0d0a | [
"MIT"
] | null | null | null | generator/modules/caffe.py | kklemon/deepo | 038063faf9a4c883a853aac77471e859f61b0d0a | [
"MIT"
] | null | null | null | generator/modules/caffe.py | kklemon/deepo | 038063faf9a4c883a853aac77471e859f61b0d0a | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from .__module__ import Module, dependency, source
from .tools import Tools
from .boost import Boost
from .python import Python
from .opencv import Opencv
@dependency(Tools, Python, Boost, Opencv)
@source('git')
class Caffe(Module):
def build(self):
pyver = self.composer.ver(Pytho... | 40.855072 | 90 | 0.496985 |
from .__module__ import Module, dependency, source
from .tools import Tools
from .boost import Boost
from .python import Python
from .opencv import Opencv
@dependency(Tools, Python, Boost, Opencv)
@source('git')
class Caffe(Module):
def build(self):
pyver = self.composer.ver(Python)
cpu_only = s... | true | true |
f726fac98d42191736a2bb1553a3990d3286b9b1 | 4,770 | py | Python | surfpy/simplegribmessage.py | mjmayank1/surfpy | 969b1a626db7606a42fab0eae445fcb351d6cbcd | [
"MIT"
] | 46 | 2018-04-08T15:56:32.000Z | 2022-01-05T17:36:55.000Z | surfpy/simplegribmessage.py | mjmayank1/surfpy | 969b1a626db7606a42fab0eae445fcb351d6cbcd | [
"MIT"
] | 13 | 2017-08-15T13:12:10.000Z | 2021-03-23T09:09:04.000Z | surfpy/simplegribmessage.py | mjmayank1/surfpy | 969b1a626db7606a42fab0eae445fcb351d6cbcd | [
"MIT"
] | 15 | 2018-03-08T16:52:19.000Z | 2021-12-27T21:17:37.000Z | try:
from grippy.message import Message
except:
Message = None
from .location import Location
import math
import datetime
from . import tools
class SimpleGribMessage(Message):
def __init__(self, data, offset):
super(SimpleGribMessage, self).__init__(data, offset)
@property
def model_time... | 30.974026 | 128 | 0.692034 | try:
from grippy.message import Message
except:
Message = None
from .location import Location
import math
import datetime
from . import tools
class SimpleGribMessage(Message):
def __init__(self, data, offset):
super(SimpleGribMessage, self).__init__(data, offset)
@property
def model_time... | true | true |
f726fb4d2abc77279d107a4f456ba056c71958e4 | 2,801 | py | Python | tests/test_lsp.py | Zhu-Liu/cp2k-input-tools | 3c84e82554bc5cde687395499e3d6f9e2b50e13b | [
"MIT"
] | null | null | null | tests/test_lsp.py | Zhu-Liu/cp2k-input-tools | 3c84e82554bc5cde687395499e3d6f9e2b50e13b | [
"MIT"
] | null | null | null | tests/test_lsp.py | Zhu-Liu/cp2k-input-tools | 3c84e82554bc5cde687395499e3d6f9e2b50e13b | [
"MIT"
] | 1 | 2020-12-22T19:20:53.000Z | 2020-12-22T19:20:53.000Z | from pathlib import Path
from time import sleep
import io
import sys
import pytest
from . import TEST_DIR
try:
from pygls.features import INITIALIZE, TEXT_DOCUMENT_DID_OPEN
from pygls.types import DidOpenTextDocumentParams, TextDocumentItem, InitializeParams
except ImportError:
pytest.skip("pygls unavail... | 32.952941 | 128 | 0.735809 | from pathlib import Path
from time import sleep
import io
import sys
import pytest
from . import TEST_DIR
try:
from pygls.features import INITIALIZE, TEXT_DOCUMENT_DID_OPEN
from pygls.types import DidOpenTextDocumentParams, TextDocumentItem, InitializeParams
except ImportError:
pytest.skip("pygls unavail... | true | true |
f726fcafaecf7a7db97b64adcecf290f5e75fcde | 862 | py | Python | emailnetwork/tests/test_graph.py | utomoreza/emailnetwork | 5b9e3532173256be6e766e216d54aaa895210adc | [
"MIT"
] | 8 | 2021-03-26T12:36:47.000Z | 2022-03-16T22:48:05.000Z | emailnetwork/tests/test_graph.py | utomoreza/emailnetwork | 5b9e3532173256be6e766e216d54aaa895210adc | [
"MIT"
] | 8 | 2021-02-20T08:47:21.000Z | 2022-01-21T10:18:50.000Z | emailnetwork/tests/test_graph.py | utomoreza/emailnetwork | 5b9e3532173256be6e766e216d54aaa895210adc | [
"MIT"
] | 17 | 2021-01-28T02:38:38.000Z | 2022-03-27T08:07:49.000Z | import os
from unittest import TestCase, mock
from emailnetwork.extract import MBoxReader
# from emailnetwork.graph import plot_single_email
import emailnetwork.graph as graph
MBOX_PATH = f'{os.path.dirname(__file__)}/test.mbox'
@mock.patch(f"{__name__}.graph.plt")
def test_plot_single_directed(mock_plt):
reader... | 31.925926 | 200 | 0.722738 | import os
from unittest import TestCase, mock
from emailnetwork.extract import MBoxReader
import emailnetwork.graph as graph
MBOX_PATH = f'{os.path.dirname(__file__)}/test.mbox'
@mock.patch(f"{__name__}.graph.plt")
def test_plot_single_directed(mock_plt):
reader = MBoxReader(MBOX_PATH)
graph.plot_single_dir... | true | true |
f726fcb5e7e57b3c5f279ecd143cbfc0329a5cc9 | 5,866 | py | Python | globus_cli/parsing/command_state.py | glentner/globus-cli | a6542d6824cc123f60088bf2602cd7a0fdb0e64e | [
"Apache-2.0"
] | null | null | null | globus_cli/parsing/command_state.py | glentner/globus-cli | a6542d6824cc123f60088bf2602cd7a0fdb0e64e | [
"Apache-2.0"
] | null | null | null | globus_cli/parsing/command_state.py | glentner/globus-cli | a6542d6824cc123f60088bf2602cd7a0fdb0e64e | [
"Apache-2.0"
] | null | null | null | import warnings
import click
import jmespath
from globus_cli import config
# Format Enum for output formatting
# could use a namedtuple, but that's overkill
JSON_FORMAT = "json"
TEXT_FORMAT = "text"
UNIX_FORMAT = "unix"
class CommandState:
def __init__(self):
# default is config value, or TEXT if it's ... | 28.896552 | 80 | 0.579782 | import warnings
import click
import jmespath
from globus_cli import config
JSON_FORMAT = "json"
TEXT_FORMAT = "text"
UNIX_FORMAT = "unix"
class CommandState:
def __init__(self):
# default is config value, or TEXT if it's not set
self.output_format = config.get_output_format() or TEXT_FORMAT
... | true | true |
f726fe1931108c84f05c321fc08cb81032045981 | 272 | py | Python | accounts/views.py | Monkasen/blog_project | fac6618007d03e4f127f0c0c302a90595054ff12 | [
"CC0-1.0"
] | null | null | null | accounts/views.py | Monkasen/blog_project | fac6618007d03e4f127f0c0c302a90595054ff12 | [
"CC0-1.0"
] | null | null | null | accounts/views.py | Monkasen/blog_project | fac6618007d03e4f127f0c0c302a90595054ff12 | [
"CC0-1.0"
] | null | null | null | from django.contrib.auth.forms import UserCreationForm
from django.urls import reverse_lazy
from django.views import generic
class SignUpView(generic.CreateView):
form_class = UserCreationForm
success_url = reverse_lazy('login')
template_name = 'signup.html'
| 30.222222 | 54 | 0.797794 | from django.contrib.auth.forms import UserCreationForm
from django.urls import reverse_lazy
from django.views import generic
class SignUpView(generic.CreateView):
form_class = UserCreationForm
success_url = reverse_lazy('login')
template_name = 'signup.html'
| true | true |
f726fee2b9520f0732bc657c2498044fa21cf593 | 6,213 | py | Python | human_eval.py | nlindqv/pytorch_RVAE | d9e58134965f69aad557fb3bd2478500a51210f8 | [
"MIT"
] | null | null | null | human_eval.py | nlindqv/pytorch_RVAE | d9e58134965f69aad557fb3bd2478500a51210f8 | [
"MIT"
] | null | null | null | human_eval.py | nlindqv/pytorch_RVAE | d9e58134965f69aad557fb3bd2478500a51210f8 | [
"MIT"
] | null | null | null | import argparse
import os
import pandas as pd
import numpy as np
import torch as t
from torch.optim import Adam
import pickle5 as pickle
import json
import random
from sample import sample_with_input, sample_with_beam
from utils.batch_loader import BatchLoader, clean_str
from model.paraphraser import Par... | 40.607843 | 116 | 0.597779 | import argparse
import os
import pandas as pd
import numpy as np
import torch as t
from torch.optim import Adam
import pickle5 as pickle
import json
import random
from sample import sample_with_input, sample_with_beam
from utils.batch_loader import BatchLoader, clean_str
from model.paraphraser import Par... | true | true |
f726fef4bfca13a95ea4893f0812a453b7a6ce20 | 727 | py | Python | setup.py | krajasek/pyjama | e8cfd7ac07cfca37a73f8060ff28867a0e35909e | [
"MIT"
] | null | null | null | setup.py | krajasek/pyjama | e8cfd7ac07cfca37a73f8060ff28867a0e35909e | [
"MIT"
] | null | null | null | setup.py | krajasek/pyjama | e8cfd7ac07cfca37a73f8060ff28867a0e35909e | [
"MIT"
] | null | null | null | from setuptools import setup, find_packages
from pyjamaparty.strutils.string_builder import StringBuilder
description = 'Set of casual python utilities'
long_description = StringBuilder('{}, written standing on shoulders of giants.'.format(description))
long_description += ' Tools include a string builder, singleton d... | 34.619048 | 100 | 0.763411 | from setuptools import setup, find_packages
from pyjamaparty.strutils.string_builder import StringBuilder
description = 'Set of casual python utilities'
long_description = StringBuilder('{}, written standing on shoulders of giants.'.format(description))
long_description += ' Tools include a string builder, singleton d... | true | true |
f726ff12eef650ff5b72b0281b3558b574845521 | 2,507 | py | Python | app.py | jleclanche/quassel-weblog | 127de4f13f61e424fad4e33c89c288a64cef9b61 | [
"MIT"
] | 5 | 2016-08-08T17:32:52.000Z | 2019-06-04T13:21:18.000Z | app.py | quassel/quassel-weblog | 127de4f13f61e424fad4e33c89c288a64cef9b61 | [
"MIT"
] | null | null | null | app.py | quassel/quassel-weblog | 127de4f13f61e424fad4e33c89c288a64cef9b61 | [
"MIT"
] | null | null | null | import hashlib
import re
from datetime import date, timedelta
from flask import Flask, render_template, request, abort
from jinja2.utils import urlize
from sqlalchemy import asc, desc
from sqlalchemy.orm import joinedload
from quassel import quassel_session, Message, Buffer, Sender, Network
import settings
app = Fla... | 28.168539 | 75 | 0.691264 | import hashlib
import re
from datetime import date, timedelta
from flask import Flask, render_template, request, abort
from jinja2.utils import urlize
from sqlalchemy import asc, desc
from sqlalchemy.orm import joinedload
from quassel import quassel_session, Message, Buffer, Sender, Network
import settings
app = Fla... | true | true |
f727011bf8d2cc213c21de27b98b3b27c47d249a | 520 | py | Python | tests/nnapi/specs/V1_2/reduce_any_2D_nnfw.mod.py | bogus-sudo/ONE-1 | 7052a817eff661ec2854ed2e7ee0de5e8ba82b55 | [
"Apache-2.0"
] | 255 | 2020-05-22T07:45:29.000Z | 2022-03-29T23:58:22.000Z | tests/nnapi/specs/V1_2/reduce_any_2D_nnfw.mod.py | bogus-sudo/ONE-1 | 7052a817eff661ec2854ed2e7ee0de5e8ba82b55 | [
"Apache-2.0"
] | 5,102 | 2020-05-22T07:48:33.000Z | 2022-03-31T23:43:39.000Z | tests/nnapi/specs/V1_2/reduce_any_2D_nnfw.mod.py | bogus-sudo/ONE-1 | 7052a817eff661ec2854ed2e7ee0de5e8ba82b55 | [
"Apache-2.0"
] | 120 | 2020-05-22T07:51:08.000Z | 2022-02-16T19:08:05.000Z | # model
model = Model()
i1 = Input("input", "TENSOR_BOOL8", "{3, 4}")
axis = Int32Scalar("axis", 1)
keepDims = False
out1 = Output("output", "TENSOR_BOOL8", "{3}")
model = model.Operation("REDUCE_ANY", i1, axis, keepDims).To(out1)
# Example 1. Input in operand 0, 1
input0 = {i1: # input 0
[False, False, Fals... | 26 | 66 | 0.611538 |
model = Model()
i1 = Input("input", "TENSOR_BOOL8", "{3, 4}")
axis = Int32Scalar("axis", 1)
keepDims = False
out1 = Output("output", "TENSOR_BOOL8", "{3}")
model = model.Operation("REDUCE_ANY", i1, axis, keepDims).To(out1)
input0 = {i1:
[False, False, False, False,
False, True, False, False,
... | true | true |
f727017762f29818a9fcaf162bb13d318487b8a6 | 1,219 | py | Python | var/spack/repos/builtin/packages/relax/package.py | player1537-forks/spack | 822b7632222ec5a91dc7b7cda5fc0e08715bd47c | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 11 | 2015-10-04T02:17:46.000Z | 2018-02-07T18:23:00.000Z | var/spack/repos/builtin/packages/relax/package.py | player1537-forks/spack | 822b7632222ec5a91dc7b7cda5fc0e08715bd47c | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 22 | 2017-08-01T22:45:10.000Z | 2022-03-10T07:46:31.000Z | var/spack/repos/builtin/packages/relax/package.py | player1537-forks/spack | 822b7632222ec5a91dc7b7cda5fc0e08715bd47c | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 4 | 2016-06-10T17:57:39.000Z | 2018-09-11T04:59:38.000Z | # Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Relax(CMakePackage):
"""A set of Reflex libraries for the most common used general data ty... | 32.078947 | 95 | 0.656276 |
from spack import *
class Relax(CMakePackage):
homepage = "https://twiki.cern.ch/twiki/bin/view/LCG/RELAX"
url = "http://lcgpackages.web.cern.ch/lcgpackages/tarFiles/sources/RELAX-1.tar.gz"
tags = ['hep']
version('root6', sha256='1d24b1a0884bbe99d60f7d02fea45d59695c158ab5e53516ac3fb780eb4... | true | true |
f72701a8444dcb76142a4a452fafb56971989631 | 4,930 | py | Python | Fashion_Test.py | denis19973/Keras-RFCN | e62670c2e01ac1e942f513d324642cf8d6aee368 | [
"MIT"
] | 88 | 2018-05-04T08:04:02.000Z | 2022-01-05T02:57:28.000Z | Fashion_Test.py | denis19973/Keras-RFCN | e62670c2e01ac1e942f513d324642cf8d6aee368 | [
"MIT"
] | 16 | 2018-07-03T11:58:51.000Z | 2021-07-12T04:49:05.000Z | Fashion_Test.py | mitulrm/FaceRFCN | 5e1fdaf197b3a93c22a82d9476a3f9a1c804e398 | [
"MIT"
] | 33 | 2018-05-04T08:02:32.000Z | 2022-01-09T14:39:06.000Z | """
Keras RFCN
Copyright (c) 2018
Licensed under the MIT License (see LICENSE for details)
Written by parap1uie-s@github.com
"""
'''
This is a demo to Eval a RFCN model with DeepFashion Dataset
http://mmlab.ie.cuhk.edu.hk/projects/DeepFashion.html
'''
from KerasRFCN.Model.Model import RFCN_Model
from KerasRFCN.Config... | 35.214286 | 96 | 0.650913 |
from KerasRFCN.Model.Model import RFCN_Model
from KerasRFCN.Config import Config
import KerasRFCN.Utils
import os
from keras.preprocessing import image
import pickle
import numpy as np
import argparse
import matplotlib.pyplot as plt
import matplotlib.patches as patches
class RFCNNConfig(Config):
NAME = "Fa... | true | true |
f72701ca82258a63b2f05eaaa0b57d341079e90e | 13,760 | py | Python | mhdb/write_ttl.py | charlie42/mhdb-tables2turtles | b289cc79b85e7c5d63bdf1b718e4e1d7bf188864 | [
"Apache-2.0"
] | 1 | 2020-04-15T14:22:14.000Z | 2020-04-15T14:22:14.000Z | mhdb/write_ttl.py | charlie42/mhdb-tables2turtles | b289cc79b85e7c5d63bdf1b718e4e1d7bf188864 | [
"Apache-2.0"
] | 3 | 2020-03-03T17:49:04.000Z | 2020-03-09T18:40:26.000Z | mhdb/write_ttl.py | charlie42/mhdb-tables2turtles | b289cc79b85e7c5d63bdf1b718e4e1d7bf188864 | [
"Apache-2.0"
] | 1 | 2020-04-20T15:05:42.000Z | 2020-04-20T15:05:42.000Z | #!/usr/bin/env python3
"""
This program contains generic functions to build a Turtle (Terse RDF Triple Language) document.
Authors:
- Arno Klein, 2017-2020 (arno@childmind.org) http://binarybottle.com
- Jon Clucas, 2017–2018 (jon.clucas@childmind.org)
Copyright 2020, Child Mind Institute (http://childmind.or... | 25.063752 | 95 | 0.50952 |
import os
import sys
top_dir = os.path.abspath(os.path.join(
(__file__),
os.pardir,
os.pardir
))
if top_dir not in sys.path:
sys.path.append(top_dir)
import numpy as np
def language_string(s, lang="en"):
return(
"\"\"\"{0}\"\"\"@{1}".format(
return_string(
s,
... | true | true |
f72703a3d0c01193efa4ecd4a94ed6ea309de133 | 3,106 | py | Python | Question_prepare/answers/answer_rotation.py | KuKuXia/DeepLearningMugenKnock | 979cf05e65e352da36453337380a418a2a2fdccb | [
"MIT"
] | null | null | null | Question_prepare/answers/answer_rotation.py | KuKuXia/DeepLearningMugenKnock | 979cf05e65e352da36453337380a418a2a2fdccb | [
"MIT"
] | null | null | null | Question_prepare/answers/answer_rotation.py | KuKuXia/DeepLearningMugenKnock | 979cf05e65e352da36453337380a418a2a2fdccb | [
"MIT"
] | null | null | null | import cv2
import numpy as np
from glob import glob
import matplotlib.pyplot as plt
np.random.seed(0)
num_classes = 2
img_height, img_width = 64, 64
CLS = ['akahara', 'madara']
# get train data
def data_load(path, hf=False, vf=False, rot=None):
xs = []
ts = []
paths = []
for dir_path in glob(pa... | 26.775862 | 87 | 0.433033 | import cv2
import numpy as np
from glob import glob
import matplotlib.pyplot as plt
np.random.seed(0)
num_classes = 2
img_height, img_width = 64, 64
CLS = ['akahara', 'madara']
def data_load(path, hf=False, vf=False, rot=None):
xs = []
ts = []
paths = []
for dir_path in glob(path + '/*'):
... | true | true |
f72703e878cca7379abbf6d41d3989ee572b5ae9 | 283 | py | Python | app/user/urls.py | Eslamhathout/restuarant_reservation_api | 67292e95eed13b5bee423a443180230b9de4c036 | [
"MIT"
] | null | null | null | app/user/urls.py | Eslamhathout/restuarant_reservation_api | 67292e95eed13b5bee423a443180230b9de4c036 | [
"MIT"
] | null | null | null | app/user/urls.py | Eslamhathout/restuarant_reservation_api | 67292e95eed13b5bee423a443180230b9de4c036 | [
"MIT"
] | null | null | null | from django.urls import path
from user import views
app_name = 'user'
urlpatterns = [
path('create/', views.createUserView.as_view(), name='create'),
path('token/', views.CreateTokenView.as_view(), name='token'),
path('me/', views.ManageUserView.as_view(), name='me'),
] | 31.444444 | 67 | 0.689046 | from django.urls import path
from user import views
app_name = 'user'
urlpatterns = [
path('create/', views.createUserView.as_view(), name='create'),
path('token/', views.CreateTokenView.as_view(), name='token'),
path('me/', views.ManageUserView.as_view(), name='me'),
] | true | true |
f7270451a42cc428358813a37592ce306c2d3a9e | 263 | py | Python | courses/templatetags/course_tags.py | pauljherrera/avantiweb | 40b87e754e68a0e2adcf5e1640d5e2e0c8637d0a | [
"MIT"
] | null | null | null | courses/templatetags/course_tags.py | pauljherrera/avantiweb | 40b87e754e68a0e2adcf5e1640d5e2e0c8637d0a | [
"MIT"
] | null | null | null | courses/templatetags/course_tags.py | pauljherrera/avantiweb | 40b87e754e68a0e2adcf5e1640d5e2e0c8637d0a | [
"MIT"
] | null | null | null | from django import template
register = template.Library()
@register.filter
def model_name(obj):
try:
return obj._meta.model_name
except AttributeError:
return None
@register.filter
def filter_course_id(obj, filter_):
return obj.filter(course_id=filter_) | 18.785714 | 37 | 0.790875 | from django import template
register = template.Library()
@register.filter
def model_name(obj):
try:
return obj._meta.model_name
except AttributeError:
return None
@register.filter
def filter_course_id(obj, filter_):
return obj.filter(course_id=filter_) | true | true |
f72704eca60cfb15f7653086792eaae9dad19395 | 21,810 | py | Python | backend/opnreco/syncbase.py | OpenPaymentNetwork/opnreco | 99c8955d7e200fe11fc23c3568879c543940b168 | [
"MIT"
] | null | null | null | backend/opnreco/syncbase.py | OpenPaymentNetwork/opnreco | 99c8955d7e200fe11fc23c3568879c543940b168 | [
"MIT"
] | null | null | null | backend/opnreco/syncbase.py | OpenPaymentNetwork/opnreco | 99c8955d7e200fe11fc23c3568879c543940b168 | [
"MIT"
] | null | null | null |
from decimal import Decimal
from opnreco.models.db import File
from opnreco.models.db import Movement
from opnreco.models.db import now_func
from opnreco.models.db import OwnerLog
from opnreco.models.db import Peer
from opnreco.models.db import TransferDownloadRecord
from opnreco.models.db import TransferRecord
from o... | 36.966102 | 79 | 0.509078 |
from decimal import Decimal
from opnreco.models.db import File
from opnreco.models.db import Movement
from opnreco.models.db import now_func
from opnreco.models.db import OwnerLog
from opnreco.models.db import Peer
from opnreco.models.db import TransferDownloadRecord
from opnreco.models.db import TransferRecord
from o... | true | true |
f727055625800f39e74865dd3234c711f006f0de | 23,966 | py | Python | electroncash/tests/test_transaction.py | christroutner/Electron-Cash | d5217ed3e878bd56977181f022f9e5c43f449241 | [
"MIT"
] | 208 | 2017-07-25T19:52:15.000Z | 2018-09-21T13:44:58.000Z | electroncash/tests/test_transaction.py | christroutner/Electron-Cash | d5217ed3e878bd56977181f022f9e5c43f449241 | [
"MIT"
] | 1,478 | 2018-09-24T09:30:13.000Z | 2022-03-29T15:48:17.000Z | electroncash/tests/test_transaction.py | christroutner/Electron-Cash | d5217ed3e878bd56977181f022f9e5c43f449241 | [
"MIT"
] | 159 | 2018-09-24T12:56:47.000Z | 2022-03-28T23:52:17.000Z | import unittest
from pprint import pprint
from .. import transaction
from ..address import Address, ScriptOutput, PublicKey
from ..bitcoin import TYPE_ADDRESS, TYPE_PUBKEY, TYPE_SCRIPT
from ..keystore import xpubkey_to_address
from ..util import bh2u
unsigned_blob = '010000000149f35e43fefd22d8bb9e4b3ff294c6286154c2... | 78.320261 | 780 | 0.791747 | import unittest
from pprint import pprint
from .. import transaction
from ..address import Address, ScriptOutput, PublicKey
from ..bitcoin import TYPE_ADDRESS, TYPE_PUBKEY, TYPE_SCRIPT
from ..keystore import xpubkey_to_address
from ..util import bh2u
unsigned_blob = '010000000149f35e43fefd22d8bb9e4b3ff294c6286154c2... | true | true |
f7270752dcf18a0603f052723ab81ca799050193 | 2,977 | py | Python | parsers/archived/US_BPA.py | electricitymap/electricitymap-contrib | 6572b12d1cef72c734b80273598e156ebe3c22ea | [
"MIT"
] | 143 | 2022-01-01T10:56:58.000Z | 2022-03-31T11:25:47.000Z | parsers/archived/US_BPA.py | electricitymap/electricitymap-contrib | 6572b12d1cef72c734b80273598e156ebe3c22ea | [
"MIT"
] | 276 | 2021-12-30T15:57:15.000Z | 2022-03-31T14:57:16.000Z | parsers/archived/US_BPA.py | electricitymap/electricitymap-contrib | 6572b12d1cef72c734b80273598e156ebe3c22ea | [
"MIT"
] | 44 | 2021-12-30T19:48:42.000Z | 2022-03-29T22:46:16.000Z | #!/usr/bin/env python3
# Archive reason: No longer in use.
"""Parser for the Bonneville Power Administration area of the USA."""
import logging
from io import StringIO
import arrow
import pandas as pd
import requests
GENERATION_URL = "https://transmission.bpa.gov/business/operations/Wind/baltwg.txt"
GENERATION_MA... | 25.228814 | 90 | 0.64125 |
import logging
from io import StringIO
import arrow
import pandas as pd
import requests
GENERATION_URL = "https://transmission.bpa.gov/business/operations/Wind/baltwg.txt"
GENERATION_MAPPING = {
"Wind": "wind",
"Hydro": "hydro",
"Fossil/Biomass": "unknown",
"Nuclear": "nuclear",
}
def get_data... | true | true |
f727078e22cc661d90d89e25a90adb97e4f7dee0 | 2,049 | py | Python | pre_commit_hooks/detect_aws_credentials.py | pk026/pre-commit-hooks | 3fa02652357ff0dbb42b5bc78c673b7bc105fcf3 | [
"MIT"
] | null | null | null | pre_commit_hooks/detect_aws_credentials.py | pk026/pre-commit-hooks | 3fa02652357ff0dbb42b5bc78c673b7bc105fcf3 | [
"MIT"
] | null | null | null | pre_commit_hooks/detect_aws_credentials.py | pk026/pre-commit-hooks | 3fa02652357ff0dbb42b5bc78c673b7bc105fcf3 | [
"MIT"
] | 1 | 2016-05-06T15:27:07.000Z | 2016-05-06T15:27:07.000Z | from __future__ import print_function
from __future__ import unicode_literals
import argparse
import os
from six.moves import configparser # pylint: disable=import-error
def get_your_keys(credentials_file):
"""reads the secret keys in your credentials file in order to be able to
look for them in the submit... | 28.458333 | 82 | 0.646657 | from __future__ import print_function
from __future__ import unicode_literals
import argparse
import os
from six.moves import configparser
def get_your_keys(credentials_file):
aws_credentials_file_path = os.path.expanduser(credentials_file)
if not os.path.exists(aws_credentials_file_path):
return ... | true | true |
f72707b300b185159ce19245e032dddc604d32ab | 17,706 | py | Python | pytorch_src/ResnetV2.py | ccj5351/hmr_rgbd | d1dcf81d72c11e1f502f2c494cd86425f384d9cc | [
"MIT"
] | null | null | null | pytorch_src/ResnetV2.py | ccj5351/hmr_rgbd | d1dcf81d72c11e1f502f2c494cd86425f384d9cc | [
"MIT"
] | 1 | 2020-12-09T07:29:00.000Z | 2020-12-09T07:29:00.000Z | pytorch_src/ResnetV2.py | ccj5351/hmr_rgbd | d1dcf81d72c11e1f502f2c494cd86425f384d9cc | [
"MIT"
] | null | null | null | # !/usr/bin/env python3
# -*-coding:utf-8-*-
# @file:
# @brief:
# @author: Changjiang Cai, ccai1@stevens.edu, caicj5351@gmail.com
# @version: 0.0.1
# @creation date: 23-10-2019
# @last modified: Wed 30 Oct 2019 03:17:36 PM EDT
"""
file: ResnetV2.py
author: Changjiang Cai
mark: adopted from:
... | 40.797235 | 127 | 0.605162 |
import torch.nn as nn
import torch.nn.functional as F
import torch
from torch.nn.parameter import Parameter
import torch.optim as optim
import numpy as np
import math
import torchvision
import sys
cout, stride):
super(Bottleneck_V2, self).__init__()
cmid = cout// self.expansion
s... | true | true |
f727081df263bc130ba55eb6cf42a0583ef84e06 | 543 | py | Python | problems/chapter05/Ysi/dp_c.py | tokuma09/algorithm_problems | 58534620df73b230afbeb12de126174362625a78 | [
"CC0-1.0"
] | 1 | 2021-07-07T15:46:58.000Z | 2021-07-07T15:46:58.000Z | problems/chapter05/Ysi/dp_c.py | tokuma09/algorithm_problems | 58534620df73b230afbeb12de126174362625a78 | [
"CC0-1.0"
] | 5 | 2021-06-05T14:16:41.000Z | 2021-07-10T07:08:28.000Z | problems/chapter05/Ysi/dp_c.py | tokuma09/algorithm_problems | 58534620df73b230afbeb12de126174362625a78 | [
"CC0-1.0"
] | null | null | null | def main():
n = int(input())
welfare = []
for i in range(n):
a, b, c = map(int, input().split())
welfare.append([a, b, c])
dp = [[0, 0, 0] for _ in range(n+1)]
for i in range(1, n+1):
dp[i][0] = max(dp[i-1][1] + welfare[i-1][0], dp[i-1][2] + welfare[i-1][0])
dp[i][1... | 30.166667 | 82 | 0.464088 | def main():
n = int(input())
welfare = []
for i in range(n):
a, b, c = map(int, input().split())
welfare.append([a, b, c])
dp = [[0, 0, 0] for _ in range(n+1)]
for i in range(1, n+1):
dp[i][0] = max(dp[i-1][1] + welfare[i-1][0], dp[i-1][2] + welfare[i-1][0])
dp[i][1... | true | true |
f7270905c7aba4a402b7cd24c6eb95248f25ce9c | 1,368 | py | Python | setup.py | RevengeComing/DemonHunter | 8ab5fc0e8e4f33c3e299cba78555f33b96cc28d8 | [
"MIT"
] | 52 | 2017-02-06T10:43:42.000Z | 2022-03-06T02:21:57.000Z | setup.py | RevengeComing/DemonHunter | 8ab5fc0e8e4f33c3e299cba78555f33b96cc28d8 | [
"MIT"
] | 4 | 2017-05-03T23:28:43.000Z | 2018-05-16T18:40:28.000Z | setup.py | RevengeComing/DemonHunter | 8ab5fc0e8e4f33c3e299cba78555f33b96cc28d8 | [
"MIT"
] | 10 | 2017-05-03T23:18:45.000Z | 2022-03-31T13:51:06.000Z | from setuptools import setup, find_packages
long_description = """
DemonHunter is a framework to create a Honeypot network very simple and easy.
"""
requirements = [
"httptools==0.0.11",
"aiohttp==2.3.10",
"bcrypt==3.1.4",
"flask==0.12.2",
"flask-login==0.4.1",
"flask-sqlalchemy==2.3.2",
... | 23.186441 | 77 | 0.574561 | from setuptools import setup, find_packages
long_description = """
DemonHunter is a framework to create a Honeypot network very simple and easy.
"""
requirements = [
"httptools==0.0.11",
"aiohttp==2.3.10",
"bcrypt==3.1.4",
"flask==0.12.2",
"flask-login==0.4.1",
"flask-sqlalchemy==2.3.2",
... | true | true |
f727096ddb4e3b582b8a50d866549fed8ea616db | 2,026 | py | Python | exp/python_c3_class_mro/python_c3_mro_anler.py | nicolasessisbreton/fython | 988f5a94cee8b16b0000501a22239195c73424a1 | [
"Apache-2.0"
] | 41 | 2016-01-21T05:14:45.000Z | 2021-11-24T20:37:21.000Z | exp/python_c3_class_mro/python_c3_mro_anler.py | nicolasessisbreton/fython | 988f5a94cee8b16b0000501a22239195c73424a1 | [
"Apache-2.0"
] | 5 | 2016-01-21T05:36:37.000Z | 2016-08-22T19:26:51.000Z | exp/python_c3_class_mro/python_c3_mro_anler.py | nicolasessisbreton/fython | 988f5a94cee8b16b0000501a22239195c73424a1 | [
"Apache-2.0"
] | 3 | 2016-01-23T04:03:44.000Z | 2016-08-21T15:58:38.000Z | # taken from https://gist.github.com/anler/1144867
def C3(cls, *mro_lists):
"""Implementation of the Python's C3 Algorithm.
Notes:
* The order of items in an MRO should be preserved in all of
its future subclasses
"""
import itertools
# Make a copy so we don't change existing... | 36.836364 | 87 | 0.55923 |
def C3(cls, *mro_lists):
import itertools
mro_lists = [list(mro_list[:]) for mro_list in mro_lists]
# Set up the new MRO with the class itself
mro = [cls]
# The real algorithm goes here
while True:
# Reset for the next round of tests
candidate_found = False
... | true | true |
f72709c4742158734a8a8151b8c373a41c265cb7 | 13,728 | py | Python | jc/parsers/netstat.py | shaikustin/jc | b59e38cfd2c8a7f5868e05d5562557b1c27e5e56 | [
"MIT"
] | 3,215 | 2019-10-24T15:25:56.000Z | 2022-03-31T15:43:01.000Z | jc/parsers/netstat.py | shaikustin/jc | b59e38cfd2c8a7f5868e05d5562557b1c27e5e56 | [
"MIT"
] | 109 | 2019-11-02T16:22:29.000Z | 2022-03-30T17:32:17.000Z | jc/parsers/netstat.py | shaikustin/jc | b59e38cfd2c8a7f5868e05d5562557b1c27e5e56 | [
"MIT"
] | 75 | 2020-02-07T00:16:32.000Z | 2022-03-29T09:29:53.000Z | """jc - JSON CLI output utility `netstat` command output parser
Caveats:
- Use of multiple `l` options is not supported on OSX (e.g. `netstat -rlll`)
- Use of the `A` option is not supported on OSX when using the `r` option (e.g. `netstat -rA`)
Usage (cli):
$ netstat | jc --netstat
or
$ jc netstat
Usa... | 29.908497 | 99 | 0.436844 | import jc.utils
class info():
version = '1.10'
description = '`netstat` command parser'
author = 'Kelly Brazil'
author_email = 'kellyjonbrazil@gmail.com'
compatible = ['linux', 'darwin', 'freebsd']
magic_commands = ['netstat']
__version__ = info.version
def _process(proc_data):
f... | true | true |
f7270a9ece60d01e3332a67758dc9efe26f5976e | 3,799 | py | Python | tests/test_02_app/test_custom_app.py | hairychris/uvicorn-gunicorn-docker | 5c1f3538b14a52676e0723497e1f65947382888b | [
"MIT"
] | null | null | null | tests/test_02_app/test_custom_app.py | hairychris/uvicorn-gunicorn-docker | 5c1f3538b14a52676e0723497e1f65947382888b | [
"MIT"
] | null | null | null | tests/test_02_app/test_custom_app.py | hairychris/uvicorn-gunicorn-docker | 5c1f3538b14a52676e0723497e1f65947382888b | [
"MIT"
] | null | null | null | import time
from pathlib import Path, PurePath
import docker
import pytest
import requests
from ..utils import (
CONTAINER_NAME,
IMAGE_NAME,
get_config,
get_logs,
remove_previous_container,
)
client = docker.from_env()
def verify_container(container, response_text):
config_data = get_config... | 33.619469 | 88 | 0.609371 | import time
from pathlib import Path, PurePath
import docker
import pytest
import requests
from ..utils import (
CONTAINER_NAME,
IMAGE_NAME,
get_config,
get_logs,
remove_previous_container,
)
client = docker.from_env()
def verify_container(container, response_text):
config_data = get_config... | true | true |
f7270af0eb3dba69ec7cddb1fdb8c33f7344108d | 1,231 | py | Python | src/modules/agents/noisy_agents.py | mariuslindegaard/6.867_MARL_project | 572b88b4d491db8a1673535868f4bf9aff58f73d | [
"Apache-2.0"
] | 401 | 2021-02-23T02:42:42.000Z | 2022-03-21T08:22:37.000Z | src/modules/agents/noisy_agents.py | mariuslindegaard/6.867_MARL_project | 572b88b4d491db8a1673535868f4bf9aff58f73d | [
"Apache-2.0"
] | 21 | 2021-04-10T10:05:07.000Z | 2022-03-29T10:09:03.000Z | src/modules/agents/noisy_agents.py | mariuslindegaard/6.867_MARL_project | 572b88b4d491db8a1673535868f4bf9aff58f73d | [
"Apache-2.0"
] | 90 | 2021-02-15T08:37:04.000Z | 2022-03-21T06:37:15.000Z | import torch.nn as nn
import torch.nn.functional as F
from utils.noisy_liner import NoisyLinear
from torch.nn import LayerNorm
class NoisyRNNAgent(nn.Module):
def __init__(self, input_shape, args):
super(NoisyRNNAgent, self).__init__()
self.args = args
self.fc1 = nn.Linear(input_shape, arg... | 35.171429 | 86 | 0.640942 | import torch.nn as nn
import torch.nn.functional as F
from utils.noisy_liner import NoisyLinear
from torch.nn import LayerNorm
class NoisyRNNAgent(nn.Module):
def __init__(self, input_shape, args):
super(NoisyRNNAgent, self).__init__()
self.args = args
self.fc1 = nn.Linear(input_shape, arg... | true | true |
f7270bef7a963e5cdee0174d9826895442fbf65b | 11,468 | py | Python | modules/flow.py | aasensio/bayesDI | 4ddad57d89c3512b4c4ee5684ddc5608060ebdec | [
"MIT"
] | 2 | 2021-08-20T07:59:05.000Z | 2021-12-02T20:19:48.000Z | modules/flow.py | aasensio/bayesDI | 4ddad57d89c3512b4c4ee5684ddc5608060ebdec | [
"MIT"
] | null | null | null | modules/flow.py | aasensio/bayesDI | 4ddad57d89c3512b4c4ee5684ddc5608060ebdec | [
"MIT"
] | null | null | null | import numpy as np
import torch
import torch.nn.functional as F
from nflows import transforms, distributions, flows, utils
import nflows.nn.nets as nn_
import matplotlib.pyplot as pl
from modules import resnet
# https://github.com/stephengreen/lfi-gw/blob/master/lfigw/nde_flows.py
def create_linear_transform(input_di... | 42.791045 | 155 | 0.593129 | import numpy as np
import torch
import torch.nn.functional as F
from nflows import transforms, distributions, flows, utils
import nflows.nn.nets as nn_
import matplotlib.pyplot as pl
from modules import resnet
def create_linear_transform(input_dim):
permutation = transforms.RandomPermutation(features = inpu... | true | true |
f7270cc5a74622d850496e16ffaf8362ce017691 | 3,489 | py | Python | WebServer/microservices/dispatcher/auth_token.py | AnneEjsing/TrafficDataAnonymisation | 6ee5b4a46d53a656299d6a53896175b78008228a | [
"MIT"
] | 1 | 2020-03-12T13:27:58.000Z | 2020-03-12T13:27:58.000Z | WebServer/microservices/dispatcher/auth_token.py | AnneEjsing/TrafficDataAnonymisation | 6ee5b4a46d53a656299d6a53896175b78008228a | [
"MIT"
] | 7 | 2020-04-02T12:47:45.000Z | 2022-03-02T07:35:49.000Z | WebServer/microservices/dispatcher/auth_token.py | AnneEjsing/Traffic-Data-Anonymisation-Web | 6ee5b4a46d53a656299d6a53896175b78008228a | [
"MIT"
] | null | null | null | import base64
import requests
import json
import hashlib
import hmac
from enum import IntEnum
from datetime import datetime, timedelta
import os
secretKey = os.getenv("SECRET_KEY")
def valid_token(token):
return ('.' in token) and len(token.split('.')) == 3
def verify_credentials(email, pwd):
data = {"email... | 28.137097 | 131 | 0.665807 | import base64
import requests
import json
import hashlib
import hmac
from enum import IntEnum
from datetime import datetime, timedelta
import os
secretKey = os.getenv("SECRET_KEY")
def valid_token(token):
return ('.' in token) and len(token.split('.')) == 3
def verify_credentials(email, pwd):
data = {"email... | true | true |
f7270eb6f31c026c910661b3d770b077b26405bb | 990 | py | Python | scenedetect/main.py | zhaipro/MySceneDetect | fbbe085b05e916d52253ffddd91848c3e85b2fe9 | [
"MIT"
] | null | null | null | scenedetect/main.py | zhaipro/MySceneDetect | fbbe085b05e916d52253ffddd91848c3e85b2fe9 | [
"MIT"
] | null | null | null | scenedetect/main.py | zhaipro/MySceneDetect | fbbe085b05e916d52253ffddd91848c3e85b2fe9 | [
"MIT"
] | 2 | 2019-11-27T04:44:11.000Z | 2020-01-15T05:32:59.000Z | import sys
import time
import cv2
import numpy as np
def scenedetect(cap, threshold=30, min_scene_len=15):
w = cap.get(cv2.CAP_PROP_FRAME_WIDTH)
downscale_factor = int(w / 200)
last_hsv = None
first = 0
curr = 0
while True:
ret, im = cap.read()
if not ret:
break
... | 24.146341 | 72 | 0.614141 | import sys
import time
import cv2
import numpy as np
def scenedetect(cap, threshold=30, min_scene_len=15):
w = cap.get(cv2.CAP_PROP_FRAME_WIDTH)
downscale_factor = int(w / 200)
last_hsv = None
first = 0
curr = 0
while True:
ret, im = cap.read()
if not ret:
break
... | true | true |
f727103bf36fa5841b9d61da58cc4ea81dc4118e | 4,404 | py | Python | desertbot/modules/admin/Ignore.py | Helle-Daryd/DesertBot | 0b497db135a4c08dfbdb59108f830ba12fdc6465 | [
"MIT",
"BSD-3-Clause"
] | 7 | 2018-03-20T17:10:10.000Z | 2021-11-17T18:58:04.000Z | desertbot/modules/admin/Ignore.py | Helle-Daryd/DesertBot | 0b497db135a4c08dfbdb59108f830ba12fdc6465 | [
"MIT",
"BSD-3-Clause"
] | 109 | 2015-08-20T13:16:35.000Z | 2022-01-21T19:40:35.000Z | desertbot/modules/admin/Ignore.py | Helle-Daryd/DesertBot | 0b497db135a4c08dfbdb59108f830ba12fdc6465 | [
"MIT",
"BSD-3-Clause"
] | 7 | 2018-03-29T05:55:01.000Z | 2021-02-05T19:19:39.000Z | """
Created on Feb 09, 2018
@author: StarlitGhost
"""
import re
from collections import OrderedDict
from twisted.plugin import IPlugin
from zope.interface import implementer
from desertbot.moduleinterface import IModule
from desertbot.modules.commandinterface import BotCommand, admin
from desertbot.response import I... | 37.965517 | 93 | 0.603542 | import re
from collections import OrderedDict
from twisted.plugin import IPlugin
from zope.interface import implementer
from desertbot.moduleinterface import IModule
from desertbot.modules.commandinterface import BotCommand, admin
from desertbot.response import IRCResponse
@implementer(IPlugin, IModule)
class Ignor... | true | true |
f727105123cecc3f0975d6ac12017569a168ee54 | 3,444 | py | Python | tests/ut/python/parallel/test_dropout_do_mask.py | GuoSuiming/mindspore | 48afc4cfa53d970c0b20eedfb46e039db2a133d5 | [
"Apache-2.0"
] | 55 | 2020-12-17T10:26:06.000Z | 2022-03-28T07:18:26.000Z | tests/ut/python/parallel/test_dropout_do_mask.py | forwhat461/mindspore | 59a277756eb4faad9ac9afcc7fd526e8277d4994 | [
"Apache-2.0"
] | null | null | null | tests/ut/python/parallel/test_dropout_do_mask.py | forwhat461/mindspore | 59a277756eb4faad9ac9afcc7fd526e8277d4994 | [
"Apache-2.0"
] | 14 | 2021-01-29T02:39:47.000Z | 2022-03-23T05:00:26.000Z | # Copyright 2020 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... | 35.142857 | 103 | 0.707027 |
import numpy as np
import mindspore as ms
from mindspore import context, Tensor, Parameter
from mindspore.common.api import _executor
from mindspore.nn import Cell, TrainOneStepCell, Momentum
from mindspore.ops import operations as P
class Net(Cell):
def __init__(self, mul_weight, strategy1=None, s... | true | true |
f72710d9f65e5ca4beff6e82aed8a822c535c132 | 5,172 | py | Python | tests/unit/test_charm.py | gabrielcocenza/prometheus-bind-exporter-operator | 8998f049f68e72a71b7d97949d9a0e1dc57d8113 | [
"Apache-2.0"
] | null | null | null | tests/unit/test_charm.py | gabrielcocenza/prometheus-bind-exporter-operator | 8998f049f68e72a71b7d97949d9a0e1dc57d8113 | [
"Apache-2.0"
] | null | null | null | tests/unit/test_charm.py | gabrielcocenza/prometheus-bind-exporter-operator | 8998f049f68e72a71b7d97949d9a0e1dc57d8113 | [
"Apache-2.0"
] | null | null | null | # Copyright 2021 Unicorn
# See LICENSE file for licensing details.
#
# Learn more about testing at: https://juju.is/docs/sdk/testing
import unittest
from unittest import mock
import charm
from ops.model import Unit
from ops.testing import Harness
class TestCharm(unittest.TestCase):
def assert_active_unit(self, u... | 42.04878 | 97 | 0.687355 |
import unittest
from unittest import mock
import charm
from ops.model import Unit
from ops.testing import Harness
class TestCharm(unittest.TestCase):
def assert_active_unit(self, unit: Unit):
self.assertEqual(unit.status.name, "active")
self.assertEqual(unit.status.message, "Unit is ready")
... | true | true |
f727121629beee502e1de4f5eae42d70c7b1b0db | 12,344 | py | Python | tensorflow/python/keras/layers/preprocessing/categorical.py | lightyang/tensorflow | 1a455a77d80fa788fd7963530dd130ad7d902226 | [
"Apache-2.0"
] | null | null | null | tensorflow/python/keras/layers/preprocessing/categorical.py | lightyang/tensorflow | 1a455a77d80fa788fd7963530dd130ad7d902226 | [
"Apache-2.0"
] | 2 | 2021-08-25T16:13:06.000Z | 2022-02-10T02:19:43.000Z | tensorflow/python/keras/layers/preprocessing/categorical.py | Hyperclaw79/tensorflow | 14c58e1d380b2001ffdf7ef782d44ad1a21f763c | [
"Apache-2.0"
] | null | null | null | # 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 applica... | 40.208469 | 80 | 0.679439 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tensorflow.python.framework import sparse_tensor
from tensorflow.python.framewo... | true | true |
f727139b39073fe544e6ea44332b015dc4cb68d8 | 7,589 | py | Python | applications/views.py | AndyUGA/ugahacks5 | 6a7787b50d9e8ea9685c3e36c38da6bc699bca77 | [
"MIT"
] | null | null | null | applications/views.py | AndyUGA/ugahacks5 | 6a7787b50d9e8ea9685c3e36c38da6bc699bca77 | [
"MIT"
] | null | null | null | applications/views.py | AndyUGA/ugahacks5 | 6a7787b50d9e8ea9685c3e36c38da6bc699bca77 | [
"MIT"
] | null | null | null | # Create your views here.
from __future__ import print_function
import logging
from datetime import timedelta
from django import http
from django.contrib import messages
from django.contrib.auth.mixins import UserPassesTestMixin
from django.core.exceptions import ValidationError
from django.http import Http404, HttpR... | 36.311005 | 112 | 0.65305 |
from __future__ import print_function
import logging
from datetime import timedelta
from django import http
from django.contrib import messages
from django.contrib.auth.mixins import UserPassesTestMixin
from django.core.exceptions import ValidationError
from django.http import Http404, HttpResponseRedirect, JsonResp... | true | true |
f72715df1abfb3b959b3006e717ef5f1bb7888f0 | 90 | py | Python | app/reserve/__init__.py | YaJunCui/bhbmjsfwzx | 1241b433663d5bcd170d61ab3e31423304f8a257 | [
"Apache-2.0"
] | null | null | null | app/reserve/__init__.py | YaJunCui/bhbmjsfwzx | 1241b433663d5bcd170d61ab3e31423304f8a257 | [
"Apache-2.0"
] | null | null | null | app/reserve/__init__.py | YaJunCui/bhbmjsfwzx | 1241b433663d5bcd170d61ab3e31423304f8a257 | [
"Apache-2.0"
] | null | null | null | from flask import Blueprint
reserve = Blueprint('reserve', __name__)
from . import views | 18 | 40 | 0.777778 | from flask import Blueprint
reserve = Blueprint('reserve', __name__)
from . import views | true | true |
f727170830757a9927a76f877b9aa62a8ac16456 | 4,123 | py | Python | scripts/appleseedMaya/menu.py | mororo250/appleseed-maya | 267d747d56b10fea716d014a6952e2a3de91b69c | [
"MIT"
] | 85 | 2016-03-02T13:52:08.000Z | 2022-01-07T22:45:30.000Z | scripts/appleseedMaya/menu.py | markreidvfx/appleseed-maya | d8dbf4b4134b34edc6c30b3f5e51f042de6abbf0 | [
"MIT"
] | 167 | 2016-01-29T17:45:44.000Z | 2021-09-17T04:47:17.000Z | scripts/appleseedMaya/menu.py | markreidvfx/appleseed-maya | d8dbf4b4134b34edc6c30b3f5e51f042de6abbf0 | [
"MIT"
] | 24 | 2016-01-29T17:37:06.000Z | 2022-01-07T15:55:24.000Z |
#
# This source file is part of appleseed.
# Visit https://appleseedhq.net/ for additional information and resources.
#
# This software is released under the MIT license.
#
# Copyright (c) 2016-2019 Esteban Tovagliari, The appleseedhq Organization
#
# Permission is hereby granted, free of charge, to any person obtaini... | 29.876812 | 86 | 0.696338 |
import os
import maya.cmds as mc
import maya.mel as mel
from logger import logger
from util import createLocator
def showAbout():
if mc.window('appleseedAboutDialog', query=True, exists=True):
mc.deleteUI('appleseedAboutDialog')
window = mc.window('appleseedAboutDialo... | true | true |
f727178eb81e72d2d877679f084f64e3e80cf022 | 2,302 | py | Python | test/functional/wallet_coinbase_category.py | picacoin/picacoin | a6b6c1053d796fac077d1c4ce63e09014002b364 | [
"MIT"
] | 1 | 2021-06-17T01:38:26.000Z | 2021-06-17T01:38:26.000Z | test/functional/wallet_coinbase_category.py | picacoin/picacoin | a6b6c1053d796fac077d1c4ce63e09014002b364 | [
"MIT"
] | null | null | null | test/functional/wallet_coinbase_category.py | picacoin/picacoin | a6b6c1053d796fac077d1c4ce63e09014002b364 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# Copyright (c) 2014-2018 The Picacoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test coinbase transactions return the correct categories.
Tests listtransactions, listsinceblock, and... | 38.366667 | 75 | 0.650738 |
from test_framework.test_framework import PicacoinTestFramework
from test_framework.util import (
assert_array_result
)
class CoinbaseCategoryTest(PicacoinTestFramework):
def set_test_params(self):
self.num_nodes = 1
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
... | true | true |
f727180f817153cce34f871f9fe22f9853129f9e | 717 | py | Python | WEEKS/CD_Sata-Structures/_MISC/misc-examples/python3-book-examples/re/re_negative_look_behind.py | webdevhub42/Lambda | b04b84fb5b82fe7c8b12680149e25ae0d27a0960 | [
"MIT"
] | null | null | null | WEEKS/CD_Sata-Structures/_MISC/misc-examples/python3-book-examples/re/re_negative_look_behind.py | webdevhub42/Lambda | b04b84fb5b82fe7c8b12680149e25ae0d27a0960 | [
"MIT"
] | null | null | null | WEEKS/CD_Sata-Structures/_MISC/misc-examples/python3-book-examples/re/re_negative_look_behind.py | webdevhub42/Lambda | b04b84fb5b82fe7c8b12680149e25ae0d27a0960 | [
"MIT"
] | null | null | null | # Copyright (c) 2010 Doug Hellmann. All rights reserved.
#
"""Negative look behind assertion.
"""
# end_pymotw_header
import re
address = re.compile(
"""
^
# An address: username@domain.tld
[\w\d.+-]+ # username
# Ignore noreply addresses
(?<!noreply)
@
([\w\d.]+\.)+ # do... | 18.868421 | 65 | 0.591353 |
import re
address = re.compile(
"""
^
# An address: username@domain.tld
[\w\d.+-]+ # username
# Ignore noreply addresses
(?<!noreply)
@
([\w\d.]+\.)+ # domain name prefix
(com|org|edu) # limit the allowed top-level domains
$
""",
re.VERBOSE,
)
candi... | true | true |
f727184e862d83fc9178a8cd67a0568c1ac7bed2 | 1,740 | py | Python | pandas/tests/categorical/test_algos.py | stillmatic/pandas | da067b2fe4cdc43eac5349e0648cfbbe4b96dbbd | [
"PSF-2.0",
"Apache-2.0",
"BSD-3-Clause-No-Nuclear-License-2014",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | 2 | 2021-01-13T09:40:44.000Z | 2021-01-13T09:40:52.000Z | pandas/tests/categorical/test_algos.py | stillmatic/pandas | da067b2fe4cdc43eac5349e0648cfbbe4b96dbbd | [
"PSF-2.0",
"Apache-2.0",
"BSD-3-Clause-No-Nuclear-License-2014",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | null | null | null | pandas/tests/categorical/test_algos.py | stillmatic/pandas | da067b2fe4cdc43eac5349e0648cfbbe4b96dbbd | [
"PSF-2.0",
"Apache-2.0",
"BSD-3-Clause-No-Nuclear-License-2014",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | null | null | null | import pytest
import numpy as np
import pandas as pd
import pandas.util.testing as tm
@pytest.mark.parametrize('ordered', [True, False])
@pytest.mark.parametrize('categories', [
['b', 'a', 'c'],
['a', 'b', 'c', 'd'],
])
def test_factorize(categories, ordered):
cat = pd.Categorical(['b', 'b', 'a', 'c', No... | 34.8 | 65 | 0.58046 | import pytest
import numpy as np
import pandas as pd
import pandas.util.testing as tm
@pytest.mark.parametrize('ordered', [True, False])
@pytest.mark.parametrize('categories', [
['b', 'a', 'c'],
['a', 'b', 'c', 'd'],
])
def test_factorize(categories, ordered):
cat = pd.Categorical(['b', 'b', 'a', 'c', No... | true | true |
f727187cf5688be60c2c2db7a635f08927f1a6e9 | 3,431 | py | Python | utils/unshrtn.py | rongpenl/twarc | 1294fc717d16787b631236cd43e9f2b3155d3d96 | [
"MIT"
] | null | null | null | utils/unshrtn.py | rongpenl/twarc | 1294fc717d16787b631236cd43e9f2b3155d3d96 | [
"MIT"
] | null | null | null | utils/unshrtn.py | rongpenl/twarc | 1294fc717d16787b631236cd43e9f2b3155d3d96 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
"""
Unfortunately the "expanded_url" as supplied by Twitter aren't fully
expanded one hop past t.co.
unshrtn.py will attempt to completely unshorten URLs and add them as the
"unshortened_url" key to each url, and emit the tweet as JSON again on stdout.
This script starts 10 seaprate processes w... | 25.043796 | 100 | 0.609443 |
import re
import json
import time
import urllib.request, urllib.parse, urllib.error
import logging
import argparse
import fileinput
import multiprocessing
POOL_SIZE = 10
unshrtn_url = "http://localhost:3000"
retries = 2
wait = 15
logging.basicConfig(filename="unshorten.log", level=logging.INFO)
def unshorten_u... | true | true |
f727189e07ca7e93ec6cf131f33eb666eb02749e | 7,355 | py | Python | python/dl.py | mkuznets/ytbackup | 834cf65432860bc3fbd92d7d79f2449464ee3ed0 | [
"MIT"
] | null | null | null | python/dl.py | mkuznets/ytbackup | 834cf65432860bc3fbd92d7d79f2449464ee3ed0 | [
"MIT"
] | null | null | null | python/dl.py | mkuznets/ytbackup | 834cf65432860bc3fbd92d7d79f2449464ee3ed0 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
import argparse
import contextlib
import copy
import glob
import hashlib
import http.client
import json
import logging
import os
import shutil
import stat
import sys
import typing
import urllib.error
from unittest import mock
SYSTEM_EXCS = (urllib.error.URLError, http.client.HTTPException, OSErr... | 28.397683 | 85 | 0.556628 |
import argparse
import contextlib
import copy
import glob
import hashlib
import http.client
import json
import logging
import os
import shutil
import stat
import sys
import typing
import urllib.error
from unittest import mock
SYSTEM_EXCS = (urllib.error.URLError, http.client.HTTPException, OSError)
STDERR = sys.std... | true | true |
f727190f87503bd55a12dd3ee0e9882c00f0b9d2 | 4,189 | py | Python | Prototype.py | supersamdam/ConversationalAI | bb6013c33f6332aee57abbae310577c056c6fdc1 | [
"MIT"
] | 1 | 2021-02-17T16:38:56.000Z | 2021-02-17T16:38:56.000Z | Prototype.py | samaydumasia/ConversationalAI | bb6013c33f6332aee57abbae310577c056c6fdc1 | [
"MIT"
] | null | null | null | Prototype.py | samaydumasia/ConversationalAI | bb6013c33f6332aee57abbae310577c056c6fdc1 | [
"MIT"
] | null | null | null | import numpy as np
import pandas as pd
import re
import nltk
nltk.download('stopwords')
from nltk.corpus import stopwords
from nltk.stem.porter import PorterStemmer
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.model_selection import train_test_split
from sklearn.naive_bayes import GaussianNB... | 39.149533 | 139 | 0.644307 | import numpy as np
import pandas as pd
import re
import nltk
nltk.download('stopwords')
from nltk.corpus import stopwords
from nltk.stem.porter import PorterStemmer
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.model_selection import train_test_split
from sklearn.naive_bayes import GaussianNB... | true | true |
f7271956500274e8b25a12c00f4764c1033c5146 | 4,346 | py | Python | modisco/value_provider.py | XiaotingChen/tfmodisco | 17cbafe806942304a02e8134fe10224bdff38b0c | [
"MIT"
] | null | null | null | modisco/value_provider.py | XiaotingChen/tfmodisco | 17cbafe806942304a02e8134fe10224bdff38b0c | [
"MIT"
] | null | null | null | modisco/value_provider.py | XiaotingChen/tfmodisco | 17cbafe806942304a02e8134fe10224bdff38b0c | [
"MIT"
] | null | null | null | from __future__ import division, print_function, absolute_import
import numpy as np
import scipy.stats
class AbstractValueProvider(object):
def __call__(self, seqlet):
raise NotImplementedError()
@classmethod
def from_hdf5(cls, grp):
the_class = eval(grp.attrs["class"])
return th... | 32.676692 | 77 | 0.637598 | from __future__ import division, print_function, absolute_import
import numpy as np
import scipy.stats
class AbstractValueProvider(object):
def __call__(self, seqlet):
raise NotImplementedError()
@classmethod
def from_hdf5(cls, grp):
the_class = eval(grp.attrs["class"])
return th... | true | true |
f727196220df796339c62b0c3941e771d9d06e76 | 119 | py | Python | model_helpers/flatten.py | FlorianKlemt/pytorch-latent-i2a | 36809bf3adda1fcffaccd27e352b7ad2338060a7 | [
"MIT"
] | 3 | 2019-02-24T07:37:36.000Z | 2020-03-17T16:00:38.000Z | model_helpers/flatten.py | FlorianKlemt/pytorch-latent-i2a | 36809bf3adda1fcffaccd27e352b7ad2338060a7 | [
"MIT"
] | null | null | null | model_helpers/flatten.py | FlorianKlemt/pytorch-latent-i2a | 36809bf3adda1fcffaccd27e352b7ad2338060a7 | [
"MIT"
] | null | null | null | import torch
class Flatten(torch.nn.Module):
def forward(self,input):
return input.view(input.size(0), -1) | 23.8 | 44 | 0.680672 | import torch
class Flatten(torch.nn.Module):
def forward(self,input):
return input.view(input.size(0), -1) | true | true |
f7271973927dc75098169d414d35dcc361007bc5 | 2,078 | py | Python | scripts/data_dir_to_fasta.py | yuzhiguo07/openfold | 5fb0f074066387b9969578b8bf68f7e046c778af | [
"Apache-2.0"
] | 789 | 2021-11-12T16:12:21.000Z | 2022-03-28T05:45:19.000Z | scripts/data_dir_to_fasta.py | yuzhiguo07/openfold | 5fb0f074066387b9969578b8bf68f7e046c778af | [
"Apache-2.0"
] | 84 | 2021-11-12T22:23:50.000Z | 2022-03-29T01:06:06.000Z | scripts/data_dir_to_fasta.py | yuzhiguo07/openfold | 5fb0f074066387b9969578b8bf68f7e046c778af | [
"Apache-2.0"
] | 114 | 2021-11-12T16:00:57.000Z | 2022-03-27T21:32:31.000Z | import argparse
import logging
import os
from openfold.data import mmcif_parsing
from openfold.np import protein, residue_constants
def main(args):
fasta = []
for fname in os.listdir(args.data_dir):
basename, ext = os.path.splitext(fname)
basename = basename.upper()
fpath = os.path.jo... | 29.685714 | 67 | 0.547161 | import argparse
import logging
import os
from openfold.data import mmcif_parsing
from openfold.np import protein, residue_constants
def main(args):
fasta = []
for fname in os.listdir(args.data_dir):
basename, ext = os.path.splitext(fname)
basename = basename.upper()
fpath = os.path.jo... | true | true |
f727197bfaf0ad1a02e1a5e39ce0bac083ab567e | 6,741 | py | Python | configs/_base_/models/cascade_mask_rcnn_swin_fpn.py | AminRezaei0x443/Swin-Transformer-Object-Detection | 5376785b9e7b172a1d08cbb87362d5631b47eca9 | [
"Apache-2.0"
] | null | null | null | configs/_base_/models/cascade_mask_rcnn_swin_fpn.py | AminRezaei0x443/Swin-Transformer-Object-Detection | 5376785b9e7b172a1d08cbb87362d5631b47eca9 | [
"Apache-2.0"
] | null | null | null | configs/_base_/models/cascade_mask_rcnn_swin_fpn.py | AminRezaei0x443/Swin-Transformer-Object-Detection | 5376785b9e7b172a1d08cbb87362d5631b47eca9 | [
"Apache-2.0"
] | null | null | null | # model settings
model = dict(
type='CascadeRCNN',
pretrained=None,
backbone=dict(
type='SwinTransformer',
embed_dim=96,
depths=[2, 2, 6, 2],
num_heads=[3, 6, 12, 24],
window_size=7,
mlp_ratio=4.,
qkv_bias=True,
qk_scale=None,
drop_rate... | 34.218274 | 79 | 0.446966 |
model = dict(
type='CascadeRCNN',
pretrained=None,
backbone=dict(
type='SwinTransformer',
embed_dim=96,
depths=[2, 2, 6, 2],
num_heads=[3, 6, 12, 24],
window_size=7,
mlp_ratio=4.,
qkv_bias=True,
qk_scale=None,
drop_rate=0.,
att... | true | true |
f7271afaec979ef8020208ff603d1aed3f64fd7f | 7,132 | py | Python | backend/src/services/asr/iflytek_asr.py | didi/MeetDot | a57009d30c1347a9b85950c2e02b77685ce63952 | [
"Apache-2.0"
] | 6 | 2021-09-23T14:53:58.000Z | 2022-02-18T10:14:17.000Z | backend/src/services/asr/iflytek_asr.py | didi/MeetDot | a57009d30c1347a9b85950c2e02b77685ce63952 | [
"Apache-2.0"
] | null | null | null | backend/src/services/asr/iflytek_asr.py | didi/MeetDot | a57009d30c1347a9b85950c2e02b77685ce63952 | [
"Apache-2.0"
] | 1 | 2021-09-24T02:48:50.000Z | 2021-09-24T02:48:50.000Z | """
iflytek stream ASR service class (using WebSocket)
"""
import gevent
import os
from .interface import (
SpeechRecognitionConfig,
SpeechRecognitionRequest,
SpeechRecognitionResponse,
)
from .stream_asr import StreamAsr
from ..tokenizer import Tokenizer
import sys
import hashlib
from hashlib import sha1... | 31.982063 | 94 | 0.580342 | import gevent
import os
from .interface import (
SpeechRecognitionConfig,
SpeechRecognitionRequest,
SpeechRecognitionResponse,
)
from .stream_asr import StreamAsr
from ..tokenizer import Tokenizer
import sys
import hashlib
from hashlib import sha1
import hmac
import base64
import json
import time
from web... | true | true |
f7271b097f49a4ac7e244128ea6b6cecfc86fd93 | 1,008 | py | Python | api/celery/worker/config.py | keitaroinc/spodeli-novosti | f74d4658f2df02536c0cc05e60ade4c2fd7efeac | [
"BSD-2-Clause"
] | 1 | 2018-06-07T09:21:28.000Z | 2018-06-07T09:21:28.000Z | api/celery/worker/config.py | keitaroinc/spodeli-novosti | f74d4658f2df02536c0cc05e60ade4c2fd7efeac | [
"BSD-2-Clause"
] | null | null | null | api/celery/worker/config.py | keitaroinc/spodeli-novosti | f74d4658f2df02536c0cc05e60ade4c2fd7efeac | [
"BSD-2-Clause"
] | 1 | 2018-06-07T09:21:31.000Z | 2018-06-07T09:21:31.000Z | # -*-coding:utf-8-*-
import os
class BaseConfig(object):
"""Base configuration."""
DEBUG = True
BROKER_URL = os.getenv('BROKER_URL', 'amqp://guest:guest@localhost:5672/')
BROKER_POOL_LIMIT = os.getenv('BROKER_POOL_LIMIT', None)
CELERY_ENABLE_UTC = True
CELERY_TIMEZONE = os.getenv('CELERY_TIMEZO... | 30.545455 | 78 | 0.703373 |
import os
class BaseConfig(object):
DEBUG = True
BROKER_URL = os.getenv('BROKER_URL', 'amqp://guest:guest@localhost:5672/')
BROKER_POOL_LIMIT = os.getenv('BROKER_POOL_LIMIT', None)
CELERY_ENABLE_UTC = True
CELERY_TIMEZONE = os.getenv('CELERY_TIMEZONE', 'UTC')
CELERYD_CONCURRENCY = os.getenv('C... | true | true |
f7271c70df3a4e2a5327a3da3f3419e8bf553154 | 71 | py | Python | ModelHelper/__init__.py | yasarc4/Auto_time_series | 5a9aa5c535fbe09a4cc59e44124a5de435ac5059 | [
"MIT"
] | 7 | 2018-06-18T20:14:30.000Z | 2019-05-24T08:21:52.000Z | ModelHelper/__init__.py | yasarc4/Auto_time_series | 5a9aa5c535fbe09a4cc59e44124a5de435ac5059 | [
"MIT"
] | null | null | null | ModelHelper/__init__.py | yasarc4/Auto_time_series | 5a9aa5c535fbe09a4cc59e44124a5de435ac5059 | [
"MIT"
] | 1 | 2019-06-08T18:20:57.000Z | 2019-06-08T18:20:57.000Z | from .prophet_helper import ProphetHelper
__all__ = ['ProphetHelper']
| 17.75 | 41 | 0.802817 | from .prophet_helper import ProphetHelper
__all__ = ['ProphetHelper']
| true | true |
f7271cc4b96db4c6911f4848e194d1acf37f4ccd | 9,988 | py | Python | spyder/widgets/ipythonconsole/shell.py | computeVision/spyder | 0a71273e0a1bad8fb9812ee8054c0a2711a6178e | [
"MIT"
] | null | null | null | spyder/widgets/ipythonconsole/shell.py | computeVision/spyder | 0a71273e0a1bad8fb9812ee8054c0a2711a6178e | [
"MIT"
] | null | null | null | spyder/widgets/ipythonconsole/shell.py | computeVision/spyder | 0a71273e0a1bad8fb9812ee8054c0a2711a6178e | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""
Shell Widget for the IPython Console
"""
import ast
import uuid
from qtpy.QtCore import Signal
from qtpy.QtWidgets import QMessageBox
from spyder.config.base i... | 37.130112 | 83 | 0.605527 |
import ast
import uuid
from qtpy.QtCore import Signal
from qtpy.QtWidgets import QMessageBox
from spyder.config.base import _
from spyder.config.gui import config_shortcut, fixed_shortcut
from spyder.py3compat import to_text_string
from spyder.utils import programs
from spyder.widgets.arraybuilder import SHORT... | true | true |
f7271cf5c26369051323e3140d6893796b0e8cba | 1,752 | py | Python | macarico/actors/bow.py | bgalbraith/macarico | 448e3e7f088dde0f4eb016fbdee857221b9523fb | [
"MIT"
] | 121 | 2019-04-09T15:44:26.000Z | 2022-03-29T19:56:19.000Z | macarico/actors/bow.py | bgalbraith/macarico | 448e3e7f088dde0f4eb016fbdee857221b9523fb | [
"MIT"
] | 1 | 2019-04-10T16:07:04.000Z | 2019-05-09T00:41:19.000Z | macarico/actors/bow.py | bgalbraith/macarico | 448e3e7f088dde0f4eb016fbdee857221b9523fb | [
"MIT"
] | 11 | 2019-04-09T16:13:34.000Z | 2019-09-30T23:31:14.000Z | from __future__ import division, generators, print_function
import torch
import torch.nn as nn
import macarico
import macarico.util as util
from macarico.util import Var, Varng
class BOWActor(macarico.Actor):
def __init__(self, attention, n_actions, act_history_length=1, obs_history_length=0):
self.att_d... | 39.818182 | 105 | 0.619863 | from __future__ import division, generators, print_function
import torch
import torch.nn as nn
import macarico
import macarico.util as util
from macarico.util import Var, Varng
class BOWActor(macarico.Actor):
def __init__(self, attention, n_actions, act_history_length=1, obs_history_length=0):
self.att_d... | true | true |
f7271d2609206d32d2b77afed5f598fa29a5e6b0 | 1,463 | py | Python | api/v2/serializers/details/project_volume.py | simpsonw/atmosphere | 3a5203ef0b563de3a0e8c8c8715df88186532d7a | [
"BSD-3-Clause"
] | 197 | 2016-12-08T02:33:32.000Z | 2022-03-23T14:27:47.000Z | api/v2/serializers/details/project_volume.py | simpsonw/atmosphere | 3a5203ef0b563de3a0e8c8c8715df88186532d7a | [
"BSD-3-Clause"
] | 385 | 2017-01-03T22:51:46.000Z | 2020-12-16T16:20:42.000Z | api/v2/serializers/details/project_volume.py | benlazarine/atmosphere | 38fad8e4002e510e8b4294f2bb5bc75e8e1817fa | [
"BSD-3-Clause"
] | 50 | 2016-12-08T08:32:25.000Z | 2021-12-10T00:21:39.000Z | from core.models import Project, Volume
from rest_framework import serializers
from api.v2.serializers.summaries import ProjectSummarySerializer
from .volume import VolumeSerializer
class ProjectRelatedField(serializers.PrimaryKeyRelatedField):
def get_queryset(self):
return Project.objects.all()
def... | 33.25 | 76 | 0.726589 | from core.models import Project, Volume
from rest_framework import serializers
from api.v2.serializers.summaries import ProjectSummarySerializer
from .volume import VolumeSerializer
class ProjectRelatedField(serializers.PrimaryKeyRelatedField):
def get_queryset(self):
return Project.objects.all()
def... | true | true |
f7271d3ae4367499cf666b0eda40d2fc6daee534 | 20,768 | py | Python | jax/_src/errors.py | machineko/jax | 5a9048a0058d027000afc5707413d24209aa6f9f | [
"Apache-2.0"
] | 1 | 2021-09-14T07:12:46.000Z | 2021-09-14T07:12:46.000Z | jax/_src/errors.py | josephrocca/jax | ab544cb26dfea3147c336754d3e3eb457a405e38 | [
"Apache-2.0"
] | 6 | 2022-01-03T22:13:42.000Z | 2022-02-14T22:07:51.000Z | jax/_src/errors.py | kbnarayanavit/jax | 1e3c4833c97302caf6046ff99656b8ff21430b8d | [
"Apache-2.0"
] | 1 | 2021-08-11T20:57:59.000Z | 2021-08-11T20:57:59.000Z | # Copyright 2021 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 36.499121 | 111 | 0.658995 |
from jax import core
class _JAXErrorMixin:
_error_page = 'https://jax.readthedocs.io/en/latest/errors.html'
_module_name = "jax.errors"
def __init__(self, message: str):
error_page = self._error_page
module_name = self._module_name
class_name = self.__class__.__name__
error_msg = f... | true | true |
f7271e85642896049a5ab911d13a4ad8df8ec1de | 14,429 | py | Python | PaddleNLP/emotion_detection/run_classifier.py | FrancisLiang/models-1 | e14d5bc1ab36d0dd11977f27cff54605bf99c945 | [
"Apache-2.0"
] | 1 | 2022-02-08T06:00:29.000Z | 2022-02-08T06:00:29.000Z | PaddleNLP/emotion_detection/run_classifier.py | FrancisLiang/models-1 | e14d5bc1ab36d0dd11977f27cff54605bf99c945 | [
"Apache-2.0"
] | null | null | null | PaddleNLP/emotion_detection/run_classifier.py | FrancisLiang/models-1 | e14d5bc1ab36d0dd11977f27cff54605bf99c945 | [
"Apache-2.0"
] | 2 | 2019-05-06T12:10:15.000Z | 2019-09-01T04:28:10.000Z | """
Emotion Detection Task
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import time
import argparse
import multiprocessing
import sys
sys.path.append("../")
import paddle
import paddle.fluid as fluid
import numpy as np
from models.classif... | 38.171958 | 136 | 0.587012 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import time
import argparse
import multiprocessing
import sys
sys.path.append("../")
import paddle
import paddle.fluid as fluid
import numpy as np
from models.classification import nets
import read... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.